5 * @image html img/widget/list/preview-00.png
6 * @image latex img/widget/list/preview-00.eps width=\textwidth
8 * @image html img/list.png
9 * @image latex img/list.eps width=\textwidth
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.
16 * A list is a very simple type of list widget. For more robust
17 * lists, @ref Genlist should probably be used.
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
34 * Available styles for it:
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
41 * Default text parts of the list items that you can use for are:
42 * @li "default" - label in the list item
44 * Supported elm_object_item common APIs.
45 * @li elm_object_item_disabled_set
46 * @li elm_object_item_disabled_get
47 * @li elm_object_item_part_text_set
48 * @li elm_object_item_part_text_get
49 * @li elm_object_item_part_content_set
50 * @li elm_object_item_part_content_get
51 * @li elm_object_item_part_content_unset
54 * @li @ref list_example_01
55 * @li @ref list_example_02
56 * @li @ref list_example_03
65 * @enum _Elm_List_Mode
66 * @typedef Elm_List_Mode
68 * Set list's resize behavior, transverse axis scroll and
69 * items cropping. See each mode's description for more details.
71 * @note Default value is #ELM_LIST_SCROLL.
73 * Values <b> don't </b> work as bitmask, only one can be chosen.
75 * @see elm_list_mode_set()
76 * @see elm_list_mode_get()
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() */
90 * Add a new list widget to the given parent Elementary
93 * @param parent The parent object.
94 * @return a new list widget handle or @c NULL, on errors.
96 * This function inserts a new list widget on the canvas.
100 EAPI Evas_Object *elm_list_add(Evas_Object *parent);
105 * @param obj The list object
107 * @note Call before running show() on the list object.
108 * @warning If not called, it won't display the list properly.
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);
115 * evas_object_show(li);
120 EAPI void elm_list_go(Evas_Object *obj);
123 * Enable or disable multiple items selection on the list object.
125 * @param obj The list object
126 * @param multi @c EINA_TRUE to enable multi selection or @c EINA_FALSE to
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.
133 * If a selected item is selected again, it will be unselected.
135 * @see elm_list_multi_select_get()
139 EAPI void elm_list_multi_select_set(Evas_Object *obj, Eina_Bool multi);
142 * Get a value whether multiple items selection is enabled or not.
144 * @see elm_list_multi_select_set() for details.
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.
153 EAPI Eina_Bool elm_list_multi_select_get(const Evas_Object *obj);
156 * Set which mode to use for the list object.
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.
162 * Set list's resize behavior, transverse axis scroll and
163 * items cropping. See each mode's description for more details.
165 * @note Default value is #ELM_LIST_SCROLL.
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.
170 * @see elm_list_mode_get()
174 EAPI void elm_list_mode_set(Evas_Object *obj, Elm_List_Mode mode);
177 * Get the mode the list is at.
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.
183 * @note see elm_list_mode_set() for more information.
187 EAPI Elm_List_Mode elm_list_mode_get(const Evas_Object *obj);
190 * Enable or disable horizontal mode on the list object.
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.
196 * @note Vertical mode is set by default.
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
203 * @see elm_list_horizontal_get()
207 EAPI void elm_list_horizontal_set(Evas_Object *obj, Eina_Bool horizontal);
210 * Get a value whether horizontal mode is enabled or not.
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.
217 * @see elm_list_horizontal_set() for details.
221 EAPI Eina_Bool elm_list_horizontal_get(const Evas_Object *obj);
224 * Enable or disable always select mode on the list object.
226 * @param obj The list object
227 * @param always_select @c EINA_TRUE to enable always select mode or
228 * @c EINA_FALSE to disable it.
230 * @note Always select mode is disabled by default.
232 * Default behavior of list items is to only call its callback function
233 * the first time it's pressed, i.e., when it is selected. If a selected
234 * item is pressed again, and multi-select is disabled, it won't call
235 * this function (if multi-select is enabled it will unselect the item).
237 * If always select is enabled, it will call the callback function
238 * every time a item is pressed, so it will call when the item is selected,
239 * and again when a selected item is pressed.
241 * @see elm_list_always_select_mode_get()
242 * @see elm_list_multi_select_set()
246 EAPI void elm_list_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select);
249 * Get a value whether always select mode is enabled or not, meaning that
250 * an item will always call its callback function, even if already selected.
252 * @param obj The list object
253 * @return @c EINA_TRUE means horizontal mode selection is enabled.
254 * @c EINA_FALSE indicates it's disabled. If @p obj is @c NULL,
255 * @c EINA_FALSE is returned.
257 * @see elm_list_always_select_mode_set() for details.
261 EAPI Eina_Bool elm_list_always_select_mode_get(const Evas_Object *obj);
264 * Set bouncing behaviour when the scrolled content reaches an edge.
266 * Tell the internal scroller object whether it should bounce or not
267 * when it reaches the respective edges for each axis.
269 * @param obj The list object
270 * @param h_bounce Whether to bounce or not in the horizontal axis.
271 * @param v_bounce Whether to bounce or not in the vertical axis.
273 * @see elm_scroller_bounce_set()
277 EAPI void elm_list_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce);
280 * Get the bouncing behaviour of the internal scroller.
282 * Get whether the internal scroller should bounce when the edge of each
283 * axis is reached scrolling.
285 * @param obj The list object.
286 * @param h_bounce Pointer to store the bounce state of the horizontal
288 * @param v_bounce Pointer to store the bounce state of the vertical
291 * @see elm_scroller_bounce_get()
292 * @see elm_list_bounce_set()
296 EAPI void elm_list_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce);
299 * Set the scrollbar policy.
301 * @param obj The list object
302 * @param policy_h Horizontal scrollbar policy.
303 * @param policy_v Vertical scrollbar policy.
305 * This sets the scrollbar visibility policy for the given scroller.
306 * #ELM_SCROLLER_POLICY_AUTO means the scrollbar is made visible if it
307 * is needed, and otherwise kept hidden. #ELM_SCROLLER_POLICY_ON turns
308 * it on all the time, and #ELM_SCROLLER_POLICY_OFF always keeps it off.
309 * This applies respectively for the horizontal and vertical scrollbars.
311 * The both are disabled by default, i.e., are set to
312 * #ELM_SCROLLER_POLICY_OFF.
316 EAPI void elm_list_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v);
319 * Get the scrollbar policy.
321 * @see elm_list_scroller_policy_get() for details.
323 * @param obj The list object.
324 * @param policy_h Pointer to store horizontal scrollbar policy.
325 * @param policy_v Pointer to store vertical scrollbar policy.
329 EAPI void elm_list_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v);
332 * Append a new item to the list object.
334 * @param obj The list object.
335 * @param label The label of the list item.
336 * @param icon The icon object to use for the left side of the item. An
337 * icon can be any Evas object, but usually it is an icon created
338 * with elm_icon_add().
339 * @param end The icon object to use for the right side of the item. An
340 * icon can be any Evas object.
341 * @param func The function to call when the item is clicked.
342 * @param data The data to associate with the item for related callbacks.
344 * @return The created item or @c NULL upon failure.
346 * A new item will be created and appended to the list, i.e., will
347 * be set as @b last item.
349 * Items created with this method can be deleted with elm_object_item_del().
351 * Associated @p data can be properly freed when item is deleted if a
352 * callback function is set with elm_widget_item_del_cb_set().
354 * If a function is passed as argument, it will be called every time this item
355 * is selected, i.e., the user clicks over an unselected item.
356 * If always select is enabled it will call this function every time
357 * user clicks over an item (already selected or not).
358 * If such function isn't needed, just passing
359 * @c NULL as @p func is enough. The same should be done for @p data.
361 * Simple example (with no function callback or data associated):
363 * li = elm_list_add(win);
364 * ic = elm_icon_add(win);
365 * elm_icon_file_set(ic, "path/to/image", NULL);
366 * elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE);
367 * elm_list_item_append(li, "label", ic, NULL, NULL, NULL);
369 * evas_object_show(li);
372 * @see elm_list_always_select_mode_set()
373 * @see elm_object_item_del()
374 * @see elm_widget_item_del_cb_set()
375 * @see elm_list_clear()
376 * @see elm_icon_add()
380 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);
383 * Prepend a new item to the list object.
385 * @param obj The list object.
386 * @param label The label of the list item.
387 * @param icon The icon object to use for the left side of the item. An
388 * icon can be any Evas object, but usually it is an icon created
389 * with elm_icon_add().
390 * @param end The icon object to use for the right side of the item. An
391 * icon can be any Evas object.
392 * @param func The function to call when the item is clicked.
393 * @param data The data to associate with the item for related callbacks.
395 * @return The created item or @c NULL upon failure.
397 * A new item will be created and prepended to the list, i.e., will
398 * be set as @b first item.
400 * Items created with this method can be deleted with elm_object_item_del().
402 * Associated @p data can be properly freed when item is deleted if a
403 * callback function is set with elm_widget_item_del_cb_set().
405 * If a function is passed as argument, it will be called every time this item
406 * is selected, i.e., the user clicks over an unselected item.
407 * If always select is enabled it will call this function every time
408 * user clicks over an item (already selected or not).
409 * If such function isn't needed, just passing
410 * @c NULL as @p func is enough. The same should be done for @p data.
412 * @see elm_list_item_append() for a simple code example.
413 * @see elm_list_always_select_mode_set()
414 * @see elm_object_item_del()
415 * @see elm_widget_item_del_cb_set()
416 * @see elm_list_clear()
417 * @see elm_icon_add()
421 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);
424 * Insert a new item into the list object before item @p before.
426 * @param obj The list object.
427 * @param before The list item to insert before.
428 * @param label The label of the list item.
429 * @param icon The icon object to use for the left side of the item. An
430 * icon can be any Evas object, but usually it is an icon created
431 * with elm_icon_add().
432 * @param end The icon object to use for the right side of the item. An
433 * icon can be any Evas object.
434 * @param func The function to call when the item is clicked.
435 * @param data The data to associate with the item for related callbacks.
437 * @return The created item or @c NULL upon failure.
439 * A new item will be created and added to the list. Its position in
440 * this list will be just before item @p before.
442 * Items created with this method can be deleted with elm_object_item_del().
444 * Associated @p data can be properly freed when item is deleted if a
445 * callback function is set with elm_widget_item_del_cb_set().
447 * If a function is passed as argument, it will be called every time this item
448 * is selected, i.e., the user clicks over an unselected item.
449 * If always select is enabled it will call this function every time
450 * user clicks over an item (already selected or not).
451 * If such function isn't needed, just passing
452 * @c NULL as @p func is enough. The same should be done for @p data.
454 * @see elm_list_item_append() for a simple code example.
455 * @see elm_list_always_select_mode_set()
456 * @see elm_object_item_del()
457 * @see elm_widget_item_del_cb_set()
458 * @see elm_list_clear()
459 * @see elm_icon_add()
463 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);
466 * Insert a new item into the list object after item @p after.
468 * @param obj The list object.
469 * @param after The list item to insert after.
470 * @param label The label of the list item.
471 * @param icon The icon object to use for the left side of the item. An
472 * icon can be any Evas object, but usually it is an icon created
473 * with elm_icon_add().
474 * @param end The icon object to use for the right side of the item. An
475 * icon can be any Evas object.
476 * @param func The function to call when the item is clicked.
477 * @param data The data to associate with the item for related callbacks.
479 * @return The created item or @c NULL upon failure.
481 * A new item will be created and added to the list. Its position in
482 * this list will be just after item @p after.
484 * Items created with this method can be deleted with elm_object_item_del().
486 * Associated @p data can be properly freed when item is deleted if a
487 * callback function is set with elm_widget_item_del_cb_set().
489 * If a function is passed as argument, it will be called every time this item
490 * is selected, i.e., the user clicks over an unselected item.
491 * If always select is enabled it will call this function every time
492 * user clicks over an item (already selected or not).
493 * If such function isn't needed, just passing
494 * @c NULL as @p func is enough. The same should be done for @p data.
496 * @see elm_list_item_append() for a simple code example.
497 * @see elm_list_always_select_mode_set()
498 * @see elm_object_item_del()
499 * @see elm_widget_item_del_cb_set()
500 * @see elm_list_clear()
501 * @see elm_icon_add()
505 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);
508 * Insert a new item into the sorted list object.
510 * @param obj The list object.
511 * @param label The label of the list item.
512 * @param icon The icon object to use for the left side of the item. An
513 * icon can be any Evas object, but usually it is an icon created
514 * with elm_icon_add().
515 * @param end The icon object to use for the right side of the item. An
516 * icon can be any Evas object.
517 * @param func The function to call when the item is clicked.
518 * @param data The data to associate with the item for related callbacks.
519 * @param cmp_func The comparing function to be used to sort list
520 * items <b>by #Elm_Object_Item item handles</b>. This function will
521 * receive two items and compare them, returning a non-negative integer
522 * if the second item should be place after the first, or negative value
523 * if should be placed before.
525 * @return The created item or @c NULL upon failure.
527 * @note This function inserts values into a list object assuming it was
528 * sorted and the result will be sorted.
530 * A new item will be created and added to the list. Its position in
531 * this list will be found comparing the new item with previously inserted
532 * items using function @p cmp_func.
534 * Items created with this method can be deleted with elm_object_item_del().
536 * Associated @p data can be properly freed when item is deleted if a
537 * callback function is set with elm_widget_item_del_cb_set().
539 * If a function is passed as argument, it will be called every time this item
540 * is selected, i.e., the user clicks over an unselected item.
541 * If always select is enabled it will call this function every time
542 * user clicks over an item (already selected or not).
543 * If such function isn't needed, just passing
544 * @c NULL as @p func is enough. The same should be done for @p data.
546 * @see elm_list_item_append() for a simple code example.
547 * @see elm_list_always_select_mode_set()
548 * @see elm_object_item_del()
549 * @see elm_widget_item_del_cb_set()
550 * @see elm_list_clear()
551 * @see elm_icon_add()
555 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);
558 * Remove all list's items.
560 * @param obj The list object
562 * @see elm_object_item_del()
563 * @see elm_list_item_append()
567 EAPI void elm_list_clear(Evas_Object *obj);
570 * Get a list of all the list items.
572 * @param obj The list object
573 * @return An @c Eina_List of list items, #Elm_Object_Item,
574 * or @c NULL on failure.
576 * @see elm_list_item_append()
577 * @see elm_object_item_del()
578 * @see elm_list_clear()
582 EAPI const Eina_List *elm_list_items_get(const Evas_Object *obj);
585 * Get the selected item.
587 * @param obj The list object.
588 * @return The selected list item.
590 * The selected item can be unselected with function
591 * elm_list_item_selected_set().
593 * The selected item always will be highlighted on list.
595 * @see elm_list_selected_items_get()
599 EAPI Elm_Object_Item *elm_list_selected_item_get(const Evas_Object *obj);
602 * Return a list of the currently selected list items.
604 * @param obj The list object.
605 * @return An @c Eina_List of list items, #Elm_Object_Item,
606 * or @c NULL on failure.
608 * Multiple items can be selected if multi select is enabled. It can be
609 * done with elm_list_multi_select_set().
611 * @see elm_list_selected_item_get()
612 * @see elm_list_multi_select_set()
616 EAPI const Eina_List *elm_list_selected_items_get(const Evas_Object *obj);
619 * Set the selected state of an item.
621 * @param it The list item
622 * @param selected The selected state
624 * This sets the selected state of the given item @p it.
625 * @c EINA_TRUE for selected, @c EINA_FALSE for not selected.
627 * If a new item is selected the previously selected will be unselected,
628 * unless multiple selection is enabled with elm_list_multi_select_set().
629 * Previously selected item can be get with function
630 * elm_list_selected_item_get().
632 * Selected items will be highlighted.
634 * @see elm_list_item_selected_get()
635 * @see elm_list_selected_item_get()
636 * @see elm_list_multi_select_set()
640 EAPI void elm_list_item_selected_set(Elm_Object_Item *it, Eina_Bool selected);
643 * Get whether the @p item is selected or not.
645 * @param it The list item.
646 * @return @c EINA_TRUE means item is selected. @c EINA_FALSE indicates
647 * it's not. If @p obj is @c NULL, @c EINA_FALSE is returned.
649 * @see elm_list_selected_item_set() for details.
650 * @see elm_list_item_selected_get()
654 EAPI Eina_Bool elm_list_item_selected_get(const Elm_Object_Item *it);
657 * Set or unset item as a separator.
659 * @param it The list item.
660 * @param setting @c EINA_TRUE to set item @p it as separator or
661 * @c EINA_FALSE to unset, i.e., item will be used as a regular item.
663 * Items aren't set as separator by default.
665 * If set as separator it will display separator theme, so won't display
668 * @see elm_list_item_separator_get()
672 EAPI void elm_list_item_separator_set(Elm_Object_Item *it, Eina_Bool setting);
675 * Get a value whether item is a separator or not.
677 * @see elm_list_item_separator_set() for details.
679 * @param it The list item.
680 * @return @c EINA_TRUE means item @p it is a separator. @c EINA_FALSE
681 * indicates it's not. If @p it is @c NULL, @c EINA_FALSE is returned.
685 EAPI Eina_Bool elm_list_item_separator_get(const Elm_Object_Item *it);
688 * Show @p item in the list view.
690 * @param it The list item to be shown.
692 * It won't animate list until item is visible. If such behavior is wanted,
693 * use elm_list_bring_in() instead.
697 EAPI void elm_list_item_show(Elm_Object_Item *it);
700 * Bring in the given item to list view.
702 * @param it The item.
704 * This causes list to jump to the given item @p item and show it
705 * (by scrolling), if it is not fully visible.
707 * This may use animation to do so and take a period of time.
709 * If animation isn't wanted, elm_list_item_show() can be used.
713 EAPI void elm_list_item_bring_in(Elm_Object_Item *it);
716 * Gets the base object of the item.
718 * @param it The list item
719 * @return The base object associated with @p item
721 * Base object is the @c Evas_Object that represents that item.
725 EAPI Evas_Object *elm_list_item_object_get(const Elm_Object_Item *it);
728 * Get the item before @p it in list.
730 * @param it The list item.
731 * @return The item before @p it, or @c NULL if none or on failure.
733 * @note If it is the first item, @c NULL will be returned.
735 * @see elm_list_item_append()
736 * @see elm_list_items_get()
740 EAPI Elm_Object_Item *elm_list_item_prev(const Elm_Object_Item *it);
743 * Get the item after @p it in list.
745 * @param it The list item.
746 * @return The item after @p it, or @c NULL if none or on failure.
748 * @note If it is the last item, @c NULL will be returned.
750 * @see elm_list_item_append()
751 * @see elm_list_items_get()
755 EAPI Elm_Object_Item *elm_list_item_next(const Elm_Object_Item *it);