diff options
Diffstat (limited to 'libraries/elementary/src/lib/elm_list.h')
-rw-r--r-- | libraries/elementary/src/lib/elm_list.h | 779 |
1 files changed, 779 insertions, 0 deletions
diff --git a/libraries/elementary/src/lib/elm_list.h b/libraries/elementary/src/lib/elm_list.h new file mode 100644 index 0000000..933a28e --- /dev/null +++ b/libraries/elementary/src/lib/elm_list.h | |||
@@ -0,0 +1,779 @@ | |||
1 | /** | ||
2 | * @defgroup List List | ||
3 | * @ingroup Elementary | ||
4 | * | ||
5 | * @image html img/widget/list/preview-00.png | ||
6 | * @image latex img/widget/list/preview-00.eps width=\textwidth | ||
7 | * | ||
8 | * @image html img/list.png | ||
9 | * @image latex img/list.eps width=\textwidth | ||
10 | * | ||
11 | * A list widget is a container whose children are displayed vertically or | ||
12 | * horizontally, in order, and can be selected. | ||
13 | * The list can accept only one or multiple items selection. Also has many | ||
14 | * modes of items displaying. | ||
15 | * | ||
16 | * A list is a very simple type of list widget. For more robust | ||
17 | * lists, @ref Genlist should probably be used. | ||
18 | * | ||
19 | * Smart callbacks one can listen to: | ||
20 | * - @c "activated" - The user has double-clicked or pressed | ||
21 | * (enter|return|spacebar) on an item. The @c event_info parameter | ||
22 | * is the item that was activated. | ||
23 | * - @c "clicked,double" - The user has double-clicked an item. | ||
24 | * The @c event_info parameter is the item that was double-clicked. | ||
25 | * - "selected" - when the user selected an item | ||
26 | * - "unselected" - when the user unselected an item | ||
27 | * - "longpressed" - an item in the list is long-pressed | ||
28 | * - "edge,top" - the list is scrolled until the top edge | ||
29 | * - "edge,bottom" - the list is scrolled until the bottom edge | ||
30 | * - "edge,left" - the list is scrolled until the left edge | ||
31 | * - "edge,right" - the list is scrolled until the right edge | ||
32 | * - "language,changed" - the program's language changed | ||
33 | * | ||
34 | * Available styles for it: | ||
35 | * - @c "default" | ||
36 | * | ||
37 | * Default content parts of the list items that you can use for are: | ||
38 | * @li "start" - A start position object in the list item | ||
39 | * @li "end" - A end position object in the list item | ||
40 | * | ||
41 | * Default text parts of the list items that you can use for are: | ||
42 | * @li "default" - label in the list item | ||
43 | * | ||
44 | * Supported elm_object_item common APIs. | ||
45 | * @li @ref elm_object_item_disabled_set | ||
46 | * @li @ref elm_object_item_disabled_get | ||
47 | * @li @ref elm_object_item_part_text_set | ||
48 | * @li @ref elm_object_item_part_text_get | ||
49 | * @li @ref elm_object_item_part_content_set | ||
50 | * @li @ref elm_object_item_part_content_get | ||
51 | * @li @ref elm_object_item_part_content_unset | ||
52 | * | ||
53 | * List of examples: | ||
54 | * @li @ref list_example_01 | ||
55 | * @li @ref list_example_02 | ||
56 | * @li @ref list_example_03 | ||
57 | */ | ||
58 | |||
59 | /** | ||
60 | * @addtogroup List | ||
61 | * @{ | ||
62 | */ | ||
63 | |||
64 | /** | ||
65 | * @enum _Elm_List_Mode | ||
66 | * @typedef Elm_List_Mode | ||
67 | * | ||
68 | * Set list's resize behavior, transverse axis scroll and | ||
69 | * items cropping. See each mode's description for more details. | ||
70 | * | ||
71 | * @note Default value is #ELM_LIST_SCROLL. | ||
72 | * | ||
73 | * Values <b> don't </b> work as bitmask, only one can be chosen. | ||
74 | * | ||
75 | * @see elm_list_mode_set() | ||
76 | * @see elm_list_mode_get() | ||
77 | * | ||
78 | * @ingroup List | ||
79 | */ | ||
80 | typedef enum | ||
81 | { | ||
82 | ELM_LIST_COMPRESS = 0, /**< Won't set any of its size hints to inform how a possible container should resize it. Then, if it's not created as a "resize object", it might end with zero dimensions. The list will respect the container's geometry and, if any of its items won't fit into its transverse axis, one won't be able to scroll it in that direction. */ | ||
83 | ELM_LIST_SCROLL, /**< Default value. Won't set any of its size hints to inform how a possible container should resize it. Then, if it's not created as a "resize object", it might end with zero dimensions. The list will respect the container's geometry and, if any of its items won't fit into its transverse axis, one will be able to scroll it in that direction (large items will get cropped). */ | ||
84 | ELM_LIST_LIMIT, /**< Set a minimum size hint on the list object, so that containers may respect it (and resize itself to fit the child properly). More specifically, a minimum size hint will be set for its transverse axis, so that the @b largest item in that direction fits well. Can have effects bounded by setting the list object's maximum size hints. */ | ||
85 | ELM_LIST_EXPAND, /**< Besides setting a minimum size on the transverse axis, just like the previous mode, will set a minimum size on the longitudinal axis too, trying to reserve space to all its children to be visible at a time. Can have effects bounded by setting the list object's maximum size hints. */ | ||
86 | ELM_LIST_LAST /**< Indicates error if returned by elm_list_mode_get() */ | ||
87 | } Elm_List_Mode; | ||
88 | |||
89 | /** | ||
90 | * Add a new list widget to the given parent Elementary | ||
91 | * (container) object. | ||
92 | * | ||
93 | * @param parent The parent object. | ||
94 | * @return a new list widget handle or @c NULL, on errors. | ||
95 | * | ||
96 | * This function inserts a new list widget on the canvas. | ||
97 | * | ||
98 | * @ingroup List | ||
99 | */ | ||
100 | EAPI Evas_Object *elm_list_add(Evas_Object *parent); | ||
101 | |||
102 | /** | ||
103 | * Starts the list. | ||
104 | * | ||
105 | * @param obj The list object | ||
106 | * | ||
107 | * @note Call before running show() on the list object. | ||
108 | * @warning If not called, it won't display the list properly. | ||
109 | * | ||
110 | * @code | ||
111 | * li = elm_list_add(win); | ||
112 | * elm_list_item_append(li, "First", NULL, NULL, NULL, NULL); | ||
113 | * elm_list_item_append(li, "Second", NULL, NULL, NULL, NULL); | ||
114 | * elm_list_go(li); | ||
115 | * evas_object_show(li); | ||
116 | * @endcode | ||
117 | * | ||
118 | * @ingroup List | ||
119 | */ | ||
120 | EAPI void elm_list_go(Evas_Object *obj); | ||
121 | |||
122 | /** | ||
123 | * Enable or disable multiple items selection on the list object. | ||
124 | * | ||
125 | * @param obj The list object | ||
126 | * @param multi @c EINA_TRUE to enable multi selection or @c EINA_FALSE to | ||
127 | * disable it. | ||
128 | * | ||
129 | * Disabled by default. If disabled, the user can select a single item of | ||
130 | * the list each time. Selected items are highlighted on list. | ||
131 | * If enabled, many items can be selected. | ||
132 | * | ||
133 | * If a selected item is selected again, it will be unselected. | ||
134 | * | ||
135 | * @see elm_list_multi_select_get() | ||
136 | * | ||
137 | * @ingroup List | ||
138 | */ | ||
139 | EAPI void elm_list_multi_select_set(Evas_Object *obj, Eina_Bool multi); | ||
140 | |||
141 | /** | ||
142 | * Get a value whether multiple items selection is enabled or not. | ||
143 | * | ||
144 | * @see elm_list_multi_select_set() for details. | ||
145 | * | ||
146 | * @param obj The list object. | ||
147 | * @return @c EINA_TRUE means multiple items selection is enabled. | ||
148 | * @c EINA_FALSE indicates it's disabled. If @p obj is @c NULL, | ||
149 | * @c EINA_FALSE is returned. | ||
150 | * | ||
151 | * @ingroup List | ||
152 | */ | ||
153 | EAPI Eina_Bool elm_list_multi_select_get(const Evas_Object *obj); | ||
154 | |||
155 | /** | ||
156 | * Set which mode to use for the list object. | ||
157 | * | ||
158 | * @param obj The list object | ||
159 | * @param mode One of #Elm_List_Mode: #ELM_LIST_COMPRESS, #ELM_LIST_SCROLL, | ||
160 | * #ELM_LIST_LIMIT or #ELM_LIST_EXPAND. | ||
161 | * | ||
162 | * Set list's resize behavior, transverse axis scroll and | ||
163 | * items cropping. See each mode's description for more details. | ||
164 | * | ||
165 | * @note Default value is #ELM_LIST_SCROLL. | ||
166 | * | ||
167 | * Only one can be set, if a previous one was set, it will be changed | ||
168 | * by the new mode set. Bitmask won't work as well. | ||
169 | * | ||
170 | * @see elm_list_mode_get() | ||
171 | * | ||
172 | * @ingroup List | ||
173 | */ | ||
174 | EAPI void elm_list_mode_set(Evas_Object *obj, Elm_List_Mode mode); | ||
175 | |||
176 | /** | ||
177 | * Get the mode the list is at. | ||
178 | * | ||
179 | * @param obj The list object | ||
180 | * @return One of #Elm_List_Mode: #ELM_LIST_COMPRESS, #ELM_LIST_SCROLL, | ||
181 | * #ELM_LIST_LIMIT, #ELM_LIST_EXPAND or #ELM_LIST_LAST on errors. | ||
182 | * | ||
183 | * @note see elm_list_mode_set() for more information. | ||
184 | * | ||
185 | * @ingroup List | ||
186 | */ | ||
187 | EAPI Elm_List_Mode elm_list_mode_get(const Evas_Object *obj); | ||
188 | |||
189 | /** | ||
190 | * Enable or disable horizontal mode on the list object. | ||
191 | * | ||
192 | * @param obj The list object. | ||
193 | * @param horizontal @c EINA_TRUE to enable horizontal or @c EINA_FALSE to | ||
194 | * disable it, i.e., to enable vertical mode. | ||
195 | * | ||
196 | * @note Vertical mode is set by default. | ||
197 | * | ||
198 | * On horizontal mode items are displayed on list from left to right, | ||
199 | * instead of from top to bottom. Also, the list will scroll horizontally. | ||
200 | * Each item will presents left icon on top and right icon, or end, at | ||
201 | * the bottom. | ||
202 | * | ||
203 | * @see elm_list_horizontal_get() | ||
204 | * | ||
205 | * @ingroup List | ||
206 | */ | ||
207 | EAPI void elm_list_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); | ||
208 | |||
209 | /** | ||
210 | * Get a value whether horizontal mode is enabled or not. | ||
211 | * | ||
212 | * @param obj The list object. | ||
213 | * @return @c EINA_TRUE means horizontal mode selection is enabled. | ||
214 | * @c EINA_FALSE indicates it's disabled. If @p obj is @c NULL, | ||
215 | * @c EINA_FALSE is returned. | ||
216 | * | ||
217 | * @see elm_list_horizontal_set() for details. | ||
218 | * | ||
219 | * @ingroup List | ||
220 | */ | ||
221 | EAPI Eina_Bool elm_list_horizontal_get(const Evas_Object *obj); | ||
222 | |||
223 | /** | ||
224 | * Set the list select mode. | ||
225 | * | ||
226 | * @param obj The list object | ||
227 | * @param mode The select mode | ||
228 | * | ||
229 | * elm_list_select_mode_set() changes item select mode in the list widget. | ||
230 | * - ELM_OBJECT_SELECT_MODE_DEFAULT : Items will only call their selection func and | ||
231 | * callback when first becoming selected. Any further clicks will | ||
232 | * do nothing, unless you set always select mode. | ||
233 | * - ELM_OBJECT_SELECT_MODE_ALWAYS : This means that, even if selected, | ||
234 | * every click will make the selected callbacks be called. | ||
235 | * - ELM_OBJECT_SELECT_MODE_NONE : This will turn off the ability to select items | ||
236 | * entirely and they will neither appear selected nor call selected | ||
237 | * callback functions. | ||
238 | * | ||
239 | * @see elm_list_select_mode_get() | ||
240 | * | ||
241 | * @ingroup List | ||
242 | */ | ||
243 | EAPI void | ||
244 | elm_list_select_mode_set(Evas_Object *obj, Elm_Object_Select_Mode mode); | ||
245 | |||
246 | /** | ||
247 | * Get the list select mode. | ||
248 | * | ||
249 | * @param obj The list object | ||
250 | * @return The select mode | ||
251 | * (If getting mode is failed, it returns ELM_OBJECT_SELECT_MODE_MAX) | ||
252 | * | ||
253 | * @see elm_list_select_mode_set() | ||
254 | * | ||
255 | * @ingroup List | ||
256 | */ | ||
257 | EAPI Elm_Object_Select_Mode | ||
258 | elm_list_select_mode_get(const Evas_Object *obj); | ||
259 | |||
260 | /** | ||
261 | * Set bouncing behaviour when the scrolled content reaches an edge. | ||
262 | * | ||
263 | * Tell the internal scroller object whether it should bounce or not | ||
264 | * when it reaches the respective edges for each axis. | ||
265 | * | ||
266 | * @param obj The list object | ||
267 | * @param h_bounce Whether to bounce or not in the horizontal axis. | ||
268 | * @param v_bounce Whether to bounce or not in the vertical axis. | ||
269 | * | ||
270 | * @see elm_scroller_bounce_set() | ||
271 | * | ||
272 | * @ingroup List | ||
273 | */ | ||
274 | EAPI void elm_list_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce); | ||
275 | |||
276 | /** | ||
277 | * Get the bouncing behaviour of the internal scroller. | ||
278 | * | ||
279 | * Get whether the internal scroller should bounce when the edge of each | ||
280 | * axis is reached scrolling. | ||
281 | * | ||
282 | * @param obj The list object. | ||
283 | * @param h_bounce Pointer to store the bounce state of the horizontal | ||
284 | * axis. | ||
285 | * @param v_bounce Pointer to store the bounce state of the vertical | ||
286 | * axis. | ||
287 | * | ||
288 | * @see elm_scroller_bounce_get() | ||
289 | * @see elm_list_bounce_set() | ||
290 | * | ||
291 | * @ingroup List | ||
292 | */ | ||
293 | EAPI void elm_list_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce); | ||
294 | |||
295 | /** | ||
296 | * Set the scrollbar policy. | ||
297 | * | ||
298 | * @param obj The list object | ||
299 | * @param policy_h Horizontal scrollbar policy. | ||
300 | * @param policy_v Vertical scrollbar policy. | ||
301 | * | ||
302 | * This sets the scrollbar visibility policy for the given scroller. | ||
303 | * #ELM_SCROLLER_POLICY_AUTO means the scrollbar is made visible if it | ||
304 | * is needed, and otherwise kept hidden. #ELM_SCROLLER_POLICY_ON turns | ||
305 | * it on all the time, and #ELM_SCROLLER_POLICY_OFF always keeps it off. | ||
306 | * This applies respectively for the horizontal and vertical scrollbars. | ||
307 | * | ||
308 | * The both are disabled by default, i.e., are set to | ||
309 | * #ELM_SCROLLER_POLICY_OFF. | ||
310 | * | ||
311 | * @ingroup List | ||
312 | */ | ||
313 | EAPI void elm_list_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v); | ||
314 | |||
315 | /** | ||
316 | * Get the scrollbar policy. | ||
317 | * | ||
318 | * @see elm_list_scroller_policy_get() for details. | ||
319 | * | ||
320 | * @param obj The list object. | ||
321 | * @param policy_h Pointer to store horizontal scrollbar policy. | ||
322 | * @param policy_v Pointer to store vertical scrollbar policy. | ||
323 | * | ||
324 | * @ingroup List | ||
325 | */ | ||
326 | EAPI void elm_list_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v); | ||
327 | |||
328 | /** | ||
329 | * Append a new item to the list object. | ||
330 | * | ||
331 | * @param obj The list object. | ||
332 | * @param label The label of the list item. | ||
333 | * @param icon The icon object to use for the left side of the item. An | ||
334 | * icon can be any Evas object, but usually it is an icon created | ||
335 | * with elm_icon_add(). | ||
336 | * @param end The icon object to use for the right side of the item. An | ||
337 | * icon can be any Evas object. | ||
338 | * @param func The function to call when the item is clicked. | ||
339 | * @param data The data to associate with the item for related callbacks. | ||
340 | * | ||
341 | * @return The created item or @c NULL upon failure. | ||
342 | * | ||
343 | * A new item will be created and appended to the list, i.e., will | ||
344 | * be set as @b last item. | ||
345 | * | ||
346 | * Items created with this method can be deleted with elm_object_item_del(). | ||
347 | * | ||
348 | * Associated @p data can be properly freed when item is deleted if a | ||
349 | * callback function is set with elm_widget_item_del_cb_set(). | ||
350 | * | ||
351 | * If a function is passed as argument, it will be called every time this item | ||
352 | * is selected, i.e., the user clicks over an unselected item. | ||
353 | * If always select is enabled it will call this function every time | ||
354 | * user clicks over an item (already selected or not). | ||
355 | * If such function isn't needed, just passing | ||
356 | * @c NULL as @p func is enough. The same should be done for @p data. | ||
357 | * | ||
358 | * Simple example (with no function callback or data associated): | ||
359 | * @code | ||
360 | * li = elm_list_add(win); | ||
361 | * ic = elm_icon_add(win); | ||
362 | * elm_icon_file_set(ic, "path/to/image", NULL); | ||
363 | * elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE); | ||
364 | * elm_list_item_append(li, "label", ic, NULL, NULL, NULL); | ||
365 | * elm_list_go(li); | ||
366 | * evas_object_show(li); | ||
367 | * @endcode | ||
368 | * | ||
369 | * @see elm_list_select_mode_set() | ||
370 | * @see elm_object_item_del() | ||
371 | * @see elm_widget_item_del_cb_set() | ||
372 | * @see elm_list_clear() | ||
373 | * @see elm_icon_add() | ||
374 | * | ||
375 | * @ingroup List | ||
376 | */ | ||
377 | EAPI Elm_Object_Item *elm_list_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data); | ||
378 | |||
379 | /** | ||
380 | * Prepend a new item to the list object. | ||
381 | * | ||
382 | * @param obj The list object. | ||
383 | * @param label The label of the list item. | ||
384 | * @param icon The icon object to use for the left side of the item. An | ||
385 | * icon can be any Evas object, but usually it is an icon created | ||
386 | * with elm_icon_add(). | ||
387 | * @param end The icon object to use for the right side of the item. An | ||
388 | * icon can be any Evas object. | ||
389 | * @param func The function to call when the item is clicked. | ||
390 | * @param data The data to associate with the item for related callbacks. | ||
391 | * | ||
392 | * @return The created item or @c NULL upon failure. | ||
393 | * | ||
394 | * A new item will be created and prepended to the list, i.e., will | ||
395 | * be set as @b first item. | ||
396 | * | ||
397 | * Items created with this method can be deleted with elm_object_item_del(). | ||
398 | * | ||
399 | * Associated @p data can be properly freed when item is deleted if a | ||
400 | * callback function is set with elm_widget_item_del_cb_set(). | ||
401 | * | ||
402 | * If a function is passed as argument, it will be called every time this item | ||
403 | * is selected, i.e., the user clicks over an unselected item. | ||
404 | * If always select is enabled it will call this function every time | ||
405 | * user clicks over an item (already selected or not). | ||
406 | * If such function isn't needed, just passing | ||
407 | * @c NULL as @p func is enough. The same should be done for @p data. | ||
408 | * | ||
409 | * @see elm_list_item_append() for a simple code example. | ||
410 | * @see elm_list_select_mode_set() | ||
411 | * @see elm_object_item_del() | ||
412 | * @see elm_widget_item_del_cb_set() | ||
413 | * @see elm_list_clear() | ||
414 | * @see elm_icon_add() | ||
415 | * | ||
416 | * @ingroup List | ||
417 | */ | ||
418 | EAPI Elm_Object_Item *elm_list_item_prepend(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data); | ||
419 | |||
420 | /** | ||
421 | * Insert a new item into the list object before item @p before. | ||
422 | * | ||
423 | * @param obj The list object. | ||
424 | * @param before The list item to insert before. | ||
425 | * @param label The label of the list item. | ||
426 | * @param icon The icon object to use for the left side of the item. An | ||
427 | * icon can be any Evas object, but usually it is an icon created | ||
428 | * with elm_icon_add(). | ||
429 | * @param end The icon object to use for the right side of the item. An | ||
430 | * icon can be any Evas object. | ||
431 | * @param func The function to call when the item is clicked. | ||
432 | * @param data The data to associate with the item for related callbacks. | ||
433 | * | ||
434 | * @return The created item or @c NULL upon failure. | ||
435 | * | ||
436 | * A new item will be created and added to the list. Its position in | ||
437 | * this list will be just before item @p before. | ||
438 | * | ||
439 | * Items created with this method can be deleted with elm_object_item_del(). | ||
440 | * | ||
441 | * Associated @p data can be properly freed when item is deleted if a | ||
442 | * callback function is set with elm_widget_item_del_cb_set(). | ||
443 | * | ||
444 | * If a function is passed as argument, it will be called every time this item | ||
445 | * is selected, i.e., the user clicks over an unselected item. | ||
446 | * If always select is enabled it will call this function every time | ||
447 | * user clicks over an item (already selected or not). | ||
448 | * If such function isn't needed, just passing | ||
449 | * @c NULL as @p func is enough. The same should be done for @p data. | ||
450 | * | ||
451 | * @see elm_list_item_append() for a simple code example. | ||
452 | * @see elm_list_select_mode_set() | ||
453 | * @see elm_object_item_del() | ||
454 | * @see elm_widget_item_del_cb_set() | ||
455 | * @see elm_list_clear() | ||
456 | * @see elm_icon_add() | ||
457 | * | ||
458 | * @ingroup List | ||
459 | */ | ||
460 | EAPI Elm_Object_Item *elm_list_item_insert_before(Evas_Object *obj, Elm_Object_Item *before, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data); | ||
461 | |||
462 | /** | ||
463 | * Insert a new item into the list object after item @p after. | ||
464 | * | ||
465 | * @param obj The list object. | ||
466 | * @param after The list item to insert after. | ||
467 | * @param label The label of the list item. | ||
468 | * @param icon The icon object to use for the left side of the item. An | ||
469 | * icon can be any Evas object, but usually it is an icon created | ||
470 | * with elm_icon_add(). | ||
471 | * @param end The icon object to use for the right side of the item. An | ||
472 | * icon can be any Evas object. | ||
473 | * @param func The function to call when the item is clicked. | ||
474 | * @param data The data to associate with the item for related callbacks. | ||
475 | * | ||
476 | * @return The created item or @c NULL upon failure. | ||
477 | * | ||
478 | * A new item will be created and added to the list. Its position in | ||
479 | * this list will be just after item @p after. | ||
480 | * | ||
481 | * Items created with this method can be deleted with elm_object_item_del(). | ||
482 | * | ||
483 | * Associated @p data can be properly freed when item is deleted if a | ||
484 | * callback function is set with elm_widget_item_del_cb_set(). | ||
485 | * | ||
486 | * If a function is passed as argument, it will be called every time this item | ||
487 | * is selected, i.e., the user clicks over an unselected item. | ||
488 | * If always select is enabled it will call this function every time | ||
489 | * user clicks over an item (already selected or not). | ||
490 | * If such function isn't needed, just passing | ||
491 | * @c NULL as @p func is enough. The same should be done for @p data. | ||
492 | * | ||
493 | * @see elm_list_item_append() for a simple code example. | ||
494 | * @see elm_list_select_mode_set() | ||
495 | * @see elm_object_item_del() | ||
496 | * @see elm_widget_item_del_cb_set() | ||
497 | * @see elm_list_clear() | ||
498 | * @see elm_icon_add() | ||
499 | * | ||
500 | * @ingroup List | ||
501 | */ | ||
502 | EAPI Elm_Object_Item *elm_list_item_insert_after(Evas_Object *obj, Elm_Object_Item *after, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data); | ||
503 | |||
504 | /** | ||
505 | * Insert a new item into the sorted list object. | ||
506 | * | ||
507 | * @param obj The list object. | ||
508 | * @param label The label of the list item. | ||
509 | * @param icon The icon object to use for the left side of the item. An | ||
510 | * icon can be any Evas object, but usually it is an icon created | ||
511 | * with elm_icon_add(). | ||
512 | * @param end The icon object to use for the right side of the item. An | ||
513 | * icon can be any Evas object. | ||
514 | * @param func The function to call when the item is clicked. | ||
515 | * @param data The data to associate with the item for related callbacks. | ||
516 | * @param cmp_func The comparing function to be used to sort list | ||
517 | * items <b>by #Elm_Object_Item item handles</b>. This function will | ||
518 | * receive two items and compare them, returning a non-negative integer | ||
519 | * if the second item should be place after the first, or negative value | ||
520 | * if should be placed before. | ||
521 | * | ||
522 | * @return The created item or @c NULL upon failure. | ||
523 | * | ||
524 | * @note This function inserts values into a list object assuming it was | ||
525 | * sorted and the result will be sorted. | ||
526 | * | ||
527 | * A new item will be created and added to the list. Its position in | ||
528 | * this list will be found comparing the new item with previously inserted | ||
529 | * items using function @p cmp_func. | ||
530 | * | ||
531 | * Items created with this method can be deleted with elm_object_item_del(). | ||
532 | * | ||
533 | * Associated @p data can be properly freed when item is deleted if a | ||
534 | * callback function is set with elm_widget_item_del_cb_set(). | ||
535 | * | ||
536 | * If a function is passed as argument, it will be called every time this item | ||
537 | * is selected, i.e., the user clicks over an unselected item. | ||
538 | * If always select is enabled it will call this function every time | ||
539 | * user clicks over an item (already selected or not). | ||
540 | * If such function isn't needed, just passing | ||
541 | * @c NULL as @p func is enough. The same should be done for @p data. | ||
542 | * | ||
543 | * @see elm_list_item_append() for a simple code example. | ||
544 | * @see elm_list_select_mode_set() | ||
545 | * @see elm_object_item_del() | ||
546 | * @see elm_widget_item_del_cb_set() | ||
547 | * @see elm_list_clear() | ||
548 | * @see elm_icon_add() | ||
549 | * | ||
550 | * @ingroup List | ||
551 | */ | ||
552 | EAPI Elm_Object_Item *elm_list_item_sorted_insert(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data, Eina_Compare_Cb cmp_func); | ||
553 | |||
554 | /** | ||
555 | * Remove all list's items. | ||
556 | * | ||
557 | * @param obj The list object | ||
558 | * | ||
559 | * @see elm_object_item_del() | ||
560 | * @see elm_list_item_append() | ||
561 | * | ||
562 | * @ingroup List | ||
563 | */ | ||
564 | EAPI void elm_list_clear(Evas_Object *obj); | ||
565 | |||
566 | /** | ||
567 | * Get a list of all the list items. | ||
568 | * | ||
569 | * @param obj The list object | ||
570 | * @return An @c Eina_List of list items, #Elm_Object_Item, | ||
571 | * or @c NULL on failure. | ||
572 | * | ||
573 | * @see elm_list_item_append() | ||
574 | * @see elm_object_item_del() | ||
575 | * @see elm_list_clear() | ||
576 | * | ||
577 | * @ingroup List | ||
578 | */ | ||
579 | EAPI const Eina_List *elm_list_items_get(const Evas_Object *obj); | ||
580 | |||
581 | /** | ||
582 | * Get the selected item. | ||
583 | * | ||
584 | * @param obj The list object. | ||
585 | * @return The selected list item. | ||
586 | * | ||
587 | * The selected item can be unselected with function | ||
588 | * elm_list_item_selected_set(). | ||
589 | * | ||
590 | * The selected item always will be highlighted on list. | ||
591 | * | ||
592 | * @see elm_list_selected_items_get() | ||
593 | * | ||
594 | * @ingroup List | ||
595 | */ | ||
596 | EAPI Elm_Object_Item *elm_list_selected_item_get(const Evas_Object *obj); | ||
597 | |||
598 | /** | ||
599 | * Return a list of the currently selected list items. | ||
600 | * | ||
601 | * @param obj The list object. | ||
602 | * @return An @c Eina_List of list items, #Elm_Object_Item, | ||
603 | * or @c NULL on failure. | ||
604 | * | ||
605 | * Multiple items can be selected if multi select is enabled. It can be | ||
606 | * done with elm_list_multi_select_set(). | ||
607 | * | ||
608 | * @see elm_list_selected_item_get() | ||
609 | * @see elm_list_multi_select_set() | ||
610 | * | ||
611 | * @ingroup List | ||
612 | */ | ||
613 | EAPI const Eina_List *elm_list_selected_items_get(const Evas_Object *obj); | ||
614 | |||
615 | /** | ||
616 | * Set the selected state of an item. | ||
617 | * | ||
618 | * @param it The list item | ||
619 | * @param selected The selected state | ||
620 | * | ||
621 | * This sets the selected state of the given item @p it. | ||
622 | * @c EINA_TRUE for selected, @c EINA_FALSE for not selected. | ||
623 | * | ||
624 | * If a new item is selected the previously selected will be unselected, | ||
625 | * unless multiple selection is enabled with elm_list_multi_select_set(). | ||
626 | * Previously selected item can be get with function | ||
627 | * elm_list_selected_item_get(). | ||
628 | * | ||
629 | * Selected items will be highlighted. | ||
630 | * | ||
631 | * @see elm_list_item_selected_get() | ||
632 | * @see elm_list_selected_item_get() | ||
633 | * @see elm_list_multi_select_set() | ||
634 | * | ||
635 | * @ingroup List | ||
636 | */ | ||
637 | EAPI void elm_list_item_selected_set(Elm_Object_Item *it, Eina_Bool selected); | ||
638 | |||
639 | /* | ||
640 | * Get whether the @p item is selected or not. | ||
641 | * | ||
642 | * @param it The list item. | ||
643 | * @return @c EINA_TRUE means item is selected. @c EINA_FALSE indicates | ||
644 | * it's not. If @p obj is @c NULL, @c EINA_FALSE is returned. | ||
645 | * | ||
646 | * @see elm_list_selected_item_set() for details. | ||
647 | * @see elm_list_item_selected_get() | ||
648 | * | ||
649 | * @ingroup List | ||
650 | */ | ||
651 | EAPI Eina_Bool elm_list_item_selected_get(const Elm_Object_Item *it); | ||
652 | |||
653 | /** | ||
654 | * Set or unset item as a separator. | ||
655 | * | ||
656 | * @param it The list item. | ||
657 | * @param setting @c EINA_TRUE to set item @p it as separator or | ||
658 | * @c EINA_FALSE to unset, i.e., item will be used as a regular item. | ||
659 | * | ||
660 | * Items aren't set as separator by default. | ||
661 | * | ||
662 | * If set as separator it will display separator theme, so won't display | ||
663 | * icons or label. | ||
664 | * | ||
665 | * @see elm_list_item_separator_get() | ||
666 | * | ||
667 | * @ingroup List | ||
668 | */ | ||
669 | EAPI void elm_list_item_separator_set(Elm_Object_Item *it, Eina_Bool setting); | ||
670 | |||
671 | /** | ||
672 | * Get a value whether item is a separator or not. | ||
673 | * | ||
674 | * @see elm_list_item_separator_set() for details. | ||
675 | * | ||
676 | * @param it The list item. | ||
677 | * @return @c EINA_TRUE means item @p it is a separator. @c EINA_FALSE | ||
678 | * indicates it's not. If @p it is @c NULL, @c EINA_FALSE is returned. | ||
679 | * | ||
680 | * @ingroup List | ||
681 | */ | ||
682 | EAPI Eina_Bool elm_list_item_separator_get(const Elm_Object_Item *it); | ||
683 | |||
684 | /** | ||
685 | * Show @p item in the list view. | ||
686 | * | ||
687 | * @param it The list item to be shown. | ||
688 | * | ||
689 | * It won't animate list until item is visible. If such behavior is wanted, | ||
690 | * use elm_list_bring_in() instead. | ||
691 | * | ||
692 | * @ingroup List | ||
693 | */ | ||
694 | EAPI void elm_list_item_show(Elm_Object_Item *it); | ||
695 | |||
696 | /** | ||
697 | * Bring in the given item to list view. | ||
698 | * | ||
699 | * @param it The item. | ||
700 | * | ||
701 | * This causes list to jump to the given item @p item and show it | ||
702 | * (by scrolling), if it is not fully visible. | ||
703 | * | ||
704 | * This may use animation to do so and take a period of time. | ||
705 | * | ||
706 | * If animation isn't wanted, elm_list_item_show() can be used. | ||
707 | * | ||
708 | * @ingroup List | ||
709 | */ | ||
710 | EAPI void elm_list_item_bring_in(Elm_Object_Item *it); | ||
711 | |||
712 | /** | ||
713 | * Gets the base object of the item. | ||
714 | * | ||
715 | * @param it The list item | ||
716 | * @return The base object associated with @p item | ||
717 | * | ||
718 | * Base object is the @c Evas_Object that represents that item. | ||
719 | * | ||
720 | * @ingroup List | ||
721 | */ | ||
722 | EAPI Evas_Object *elm_list_item_object_get(const Elm_Object_Item *it); | ||
723 | |||
724 | /** | ||
725 | * Get the item before @p it in list. | ||
726 | * | ||
727 | * @param it The list item. | ||
728 | * @return The item before @p it, or @c NULL if none or on failure. | ||
729 | * | ||
730 | * @note If it is the first item, @c NULL will be returned. | ||
731 | * | ||
732 | * @see elm_list_item_append() | ||
733 | * @see elm_list_items_get() | ||
734 | * | ||
735 | * @ingroup List | ||
736 | */ | ||
737 | EAPI Elm_Object_Item *elm_list_item_prev(const Elm_Object_Item *it); | ||
738 | |||
739 | /** | ||
740 | * Get the item after @p it in list. | ||
741 | * | ||
742 | * @param it The list item. | ||
743 | * @return The item after @p it, or @c NULL if none or on failure. | ||
744 | * | ||
745 | * @note If it is the last item, @c NULL will be returned. | ||
746 | * | ||
747 | * @see elm_list_item_append() | ||
748 | * @see elm_list_items_get() | ||
749 | * | ||
750 | * @ingroup List | ||
751 | */ | ||
752 | EAPI Elm_Object_Item *elm_list_item_next(const Elm_Object_Item *it); | ||
753 | |||
754 | /** | ||
755 | * Get the first item in the list | ||
756 | * | ||
757 | * This returns the first item in the list. | ||
758 | * | ||
759 | * @param obj The list object | ||
760 | * @return The first item, or NULL if none | ||
761 | * | ||
762 | * @ingroup List | ||
763 | */ | ||
764 | EAPI Elm_Object_Item *elm_list_first_item_get(const Evas_Object *obj); | ||
765 | |||
766 | /** | ||
767 | * Get the last item in the list | ||
768 | * | ||
769 | * This returns the last item in the list. | ||
770 | * | ||
771 | * @return The last item, or NULL if none | ||
772 | * | ||
773 | * @ingroup List | ||
774 | */ | ||
775 | EAPI Elm_Object_Item *elm_list_last_item_get(const Evas_Object *obj); | ||
776 | |||
777 | /** | ||
778 | * @} | ||
779 | */ | ||