1 #include <Elementary.h>
10 * A list is a very simple type of list widget. For more robust
11 * lists, @ref Genlist should probably be used.
13 * Signals that you can add callbacks for are:
15 * "clicked,double" - when the user double-clicked an item
16 * "selected" - when the user selected an item
17 * "unselected" - when the user selected an item
18 * "longpressed" - an item in the hoversel list is long-pressed
19 * "scroll,edge,top" - the list is scrolled until the top edge
20 * "scroll,edge,bottom" - the list is scrolled until the bottom edge
21 * "scroll,edge,left" - the list is scrolled until the left edge
22 * "scroll,edge,right" - the list is scrolled until the right edge
25 typedef struct _Widget_Data Widget_Data;
29 Evas_Object *scr, *box, *self;
30 Eina_List *items, *selected, *to_delete;
31 Elm_List_Item *last_selected_item;
34 Evas_Coord minw[2], minh[2];
35 Eina_Bool scr_minw : 1;
36 Eina_Bool scr_minh : 1;
41 } history[SWIPE_MOVES];
43 Eina_Bool fix_pending : 1;
44 Eina_Bool on_hold : 1;
46 Eina_Bool always_select : 1;
47 Eina_Bool longpressed : 1;
48 Eina_Bool wasselected : 1;
57 Evas_Object *icon, *end;
59 Ecore_Timer *long_timer;
60 Ecore_Timer *swipe_timer;
61 Eina_Bool deleted : 1;
62 Eina_Bool disabled : 1;
64 Eina_Bool is_even : 1;
65 Eina_Bool is_separator : 1;
67 Eina_Bool selected : 1;
68 Eina_Bool hilighted : 1;
69 Eina_Bool dummy_icon : 1;
70 Eina_Bool dummy_end : 1;
73 static const char *widtype = NULL;
74 static void _del_hook(Evas_Object *obj);
75 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
76 static void _theme_hook(Evas_Object *obj);
77 static void _sizing_eval(Evas_Object *obj);
78 static void _disable_hook(Evas_Object *obj);
79 static void _on_focus_hook(void *data, Evas_Object *obj);
80 static void _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source);
81 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
82 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
83 static void _fix_items(Evas_Object *obj);
84 static void _mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info);
85 static void _mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info);
86 static void _mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event_info);
87 static void _scroll_edge_left(void *data, Evas_Object *scr, void *event_info);
88 static void _scroll_edge_right(void *data, Evas_Object *scr, void *event_info);
89 static void _scroll_edge_top(void *data, Evas_Object *scr, void *event_info);
90 static void _scroll_edge_bottom(void *data, Evas_Object *scr, void *event_info);
91 static Eina_Bool _item_multi_select_up(Widget_Data *wd);
92 static Eina_Bool _item_multi_select_down(Widget_Data *wd);
93 static Eina_Bool _item_single_select_up(Widget_Data *wd);
94 static Eina_Bool _item_single_select_down(Widget_Data *wd);
95 static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
96 Evas_Callback_Type type, void *event_info);
97 static Eina_Bool _deselect_all_items(Widget_Data *wd);
99 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
100 static const char SIG_SELECTED[] = "selected";
101 static const char SIG_UNSELECTED[] = "unselected";
102 static const char SIG_LONGPRESSED[] = "longpressed";
103 static const char SIG_SCROLL_EDGE_TOP[] = "scroll,edge,top";
104 static const char SIG_SCROLL_EDGE_BOTTOM[] = "scroll,edge,bottom";
105 static const char SIG_SCROLL_EDGE_LEFT[] = "scroll,edge,left";
106 static const char SIG_SCROLL_EDGE_RIGHT[] = "scroll,edge,right";
108 static const Evas_Smart_Cb_Description _signals[] = {
109 {SIG_CLICKED_DOUBLE, ""},
111 {SIG_UNSELECTED, ""},
112 {SIG_LONGPRESSED, ""},
113 {SIG_SCROLL_EDGE_TOP, ""},
114 {SIG_SCROLL_EDGE_BOTTOM, ""},
115 {SIG_SCROLL_EDGE_LEFT, ""},
116 {SIG_SCROLL_EDGE_RIGHT, ""},
120 #define ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, ...) \
121 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, __VA_ARGS__); \
124 ERR("ERROR: "#it" has been DELETED.\n"); \
125 return __VA_ARGS__; \
129 _elm_list_item_free(Elm_List_Item *it)
131 evas_object_event_callback_del_full
132 (it->base.view, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, it);
133 evas_object_event_callback_del_full
134 (it->base.view, EVAS_CALLBACK_MOUSE_UP, _mouse_up, it);
135 evas_object_event_callback_del_full
136 (it->base.view, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, it);
139 evas_object_event_callback_del_full
140 (it->icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
141 _changed_size_hints, it->base.widget);
144 evas_object_event_callback_del_full
145 (it->end, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
146 _changed_size_hints, it->base.widget);
148 eina_stringshare_del(it->label);
150 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
151 if (it->long_timer) ecore_timer_del(it->long_timer);
152 if (it->icon) evas_object_del(it->icon);
153 if (it->end) evas_object_del(it->end);
155 elm_widget_item_del(it);
159 _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
161 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
162 Evas_Event_Key_Down *ev = event_info;
163 Widget_Data *wd = elm_widget_data_get(obj);
164 if (!wd) return EINA_FALSE;
165 if (!wd->items) return EINA_FALSE;
166 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
167 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
169 Elm_List_Item *it = NULL;
172 Evas_Coord step_x = 0;
173 Evas_Coord step_y = 0;
176 Evas_Coord page_x = 0;
177 Evas_Coord page_y = 0;
179 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
180 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
181 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
182 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
184 /* TODO: fix logic for horizontal mode */
185 if ((!strcmp(ev->keyname, "Left")) ||
186 (!strcmp(ev->keyname, "KP_Left")))
189 (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
190 (_item_multi_select_up(wd)))
191 || (_item_single_select_up(wd))))
193 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
199 else if ((!strcmp(ev->keyname, "Right")) ||
200 (!strcmp(ev->keyname, "KP_Right")))
203 (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
204 (_item_multi_select_down(wd)))
205 || (_item_single_select_down(wd))))
207 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
213 else if ((!strcmp(ev->keyname, "Up")) ||
214 (!strcmp(ev->keyname, "KP_Up")))
217 (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
218 (_item_multi_select_up(wd)))
219 || (_item_single_select_up(wd))))
221 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
227 else if ((!strcmp(ev->keyname, "Down")) ||
228 (!strcmp(ev->keyname, "KP_Down")))
231 (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
232 (_item_multi_select_down(wd)))
233 || (_item_single_select_down(wd))))
235 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
241 else if ((!strcmp(ev->keyname, "Home")) ||
242 (!strcmp(ev->keyname, "KP_Home")))
244 it = eina_list_data_get(wd->items);
245 elm_list_item_bring_in(it);
246 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
249 else if ((!strcmp(ev->keyname, "End")) ||
250 (!strcmp(ev->keyname, "KP_End")))
252 it = eina_list_data_get(eina_list_last(wd->items));
253 elm_list_item_bring_in(it);
254 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
257 else if ((!strcmp(ev->keyname, "Prior")) ||
258 (!strcmp(ev->keyname, "KP_Prior")))
263 x -= -(page_x * v_w) / 100;
270 y -= -(page_y * v_h) / 100;
275 else if ((!strcmp(ev->keyname, "Next")) ||
276 (!strcmp(ev->keyname, "KP_Next")))
281 x += -(page_x * v_w) / 100;
288 y += -(page_y * v_h) / 100;
293 else if (!strcmp(ev->keyname, "Escape"))
295 if (!_deselect_all_items(wd)) return EINA_FALSE;
296 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
299 else return EINA_FALSE;
301 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
302 elm_smart_scroller_child_pos_set(wd->scr, x, y);
307 _deselect_all_items(Widget_Data *wd)
309 if (!wd->selected) return EINA_FALSE;
311 elm_list_item_selected_set(wd->selected->data, EINA_FALSE);
317 _item_multi_select_up(Widget_Data *wd)
319 if (!wd->selected) return EINA_FALSE;
320 if (!wd->multi) return EINA_FALSE;
322 Elm_List_Item *prev = elm_list_item_prev(wd->last_selected_item);
323 if (!prev) return EINA_TRUE;
325 if (elm_list_item_selected_get(prev))
327 elm_list_item_selected_set(wd->last_selected_item, EINA_FALSE);
328 wd->last_selected_item = prev;
329 elm_list_item_show(wd->last_selected_item);
333 elm_list_item_selected_set(prev, EINA_TRUE);
334 elm_list_item_show(prev);
340 _item_multi_select_down(Widget_Data *wd)
342 if (!wd->selected) return EINA_FALSE;
343 if (!wd->multi) return EINA_FALSE;
345 Elm_List_Item *next = elm_list_item_next(wd->last_selected_item);
346 if (!next) return EINA_TRUE;
348 if (elm_list_item_selected_get(next))
350 elm_list_item_selected_set(wd->last_selected_item, EINA_FALSE);
351 wd->last_selected_item = next;
352 elm_list_item_show(wd->last_selected_item);
356 elm_list_item_selected_set(next, EINA_TRUE);
357 elm_list_item_show(next);
363 _item_single_select_up(Widget_Data *wd)
367 if (!wd->selected) prev = eina_list_data_get(eina_list_last(wd->items));
368 else prev = elm_list_item_prev(wd->last_selected_item);
370 if (!prev) return EINA_FALSE;
372 _deselect_all_items(wd);
374 elm_list_item_selected_set(prev, EINA_TRUE);
375 elm_list_item_show(prev);
380 _item_single_select_down(Widget_Data *wd)
384 if (!wd->selected) next = eina_list_data_get(wd->items);
385 else next = elm_list_item_next(wd->last_selected_item);
387 if (!next) return EINA_FALSE;
389 _deselect_all_items(wd);
391 elm_list_item_selected_set(next, EINA_TRUE);
392 elm_list_item_show(next);
397 _elm_list_process_deletions(Widget_Data *wd)
401 wd->walking++; // avoid nested deletion and also _sub_del() fix_items
403 EINA_LIST_FREE(wd->to_delete, it)
405 elm_widget_item_pre_notify_del(it);
407 wd->items = eina_list_remove_list(wd->items, it->node);
408 _elm_list_item_free(it);
415 _elm_list_walk(Widget_Data *wd)
419 ERR("ERROR: walking was negative. fixed!\n");
426 _elm_list_unwalk(Widget_Data *wd)
431 ERR("ERROR: walking became negative. fixed!\n");
439 _elm_list_process_deletions(wd);
443 wd->fix_pending = EINA_FALSE;
444 _fix_items(wd->self);
445 _sizing_eval(wd->self);
450 _del_pre_hook(Evas_Object *obj)
452 Widget_Data *wd = elm_widget_data_get(obj);
455 evas_object_event_callback_del(wd->scr,
456 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
457 _changed_size_hints);
458 evas_object_event_callback_del(wd->box,
459 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
460 _changed_size_hints);
464 _del_hook(Evas_Object *obj)
466 Widget_Data *wd = elm_widget_data_get(obj);
472 ERR("ERROR: list deleted while walking.\n");
475 EINA_LIST_FOREACH(wd->items, n, it) elm_widget_item_pre_notify_del(it);
476 _elm_list_unwalk(wd);
478 ERR("ERROR: leaking nodes!\n");
480 EINA_LIST_FREE(wd->items, it) _elm_list_item_free(it);
481 eina_list_free(wd->selected);
486 _show_region_hook(void *data, Evas_Object *obj)
488 Widget_Data *wd = elm_widget_data_get(data);
489 Evas_Coord x, y, w, h;
491 elm_widget_show_region_get(obj, &x, &y, &w, &h);
492 elm_smart_scroller_child_region_set(wd->scr, x, y, w, h);
496 _disable_hook(Evas_Object *obj)
498 Widget_Data *wd = elm_widget_data_get(obj);
500 if (elm_widget_disabled_get(obj))
502 _signal_emit_hook(obj, "elm,state,disabled", "elm");
503 elm_widget_scroll_freeze_push(obj);
504 elm_widget_scroll_hold_push(obj);
505 /* FIXME: if we get to have a way to only un-hilight items
506 * in the future, keeping them selected... */
507 _deselect_all_items(wd);
511 _signal_emit_hook(obj, "elm,state,enabled", "elm");
512 elm_widget_scroll_freeze_pop(obj);
513 elm_widget_scroll_hold_pop(obj);
518 _sizing_eval(Evas_Object *obj)
521 Widget_Data *wd = elm_widget_data_get(obj);
523 Evas_Coord vw, vh, minw, minh, maxw, maxh, w, h, vmw, vmh;
526 evas_object_size_hint_min_get(wd->box, &minw, &minh);
527 evas_object_size_hint_max_get(wd->box, &maxw, &maxh);
528 evas_object_size_hint_weight_get(wd->box, &xw, &yw);
529 if (!wd->scr) return;
530 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
533 if ((minw > 0) && (vw < minw)) vw = minw;
534 else if ((maxw > 0) && (vw > maxw)) vw = maxw;
536 else if (minw > 0) vw = minw;
539 if ((minh > 0) && (vh < minh)) vh = minh;
540 else if ((maxh > 0) && (vh > maxh)) vh = maxh;
542 else if (minh > 0) vh = minh;
543 evas_object_resize(wd->box, vw, vh);
546 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
548 if (wd->scr_minw) w = vmw + minw;
549 if (wd->scr_minh) h = vmh + minh;
551 evas_object_size_hint_max_get(obj, &maxw, &maxh);
552 if ((maxw > 0) && (w > maxw))
554 if ((maxh > 0) && (h > maxh))
557 evas_object_size_hint_min_set(obj, w, h);
561 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
563 Widget_Data *wd = elm_widget_data_get(obj);
564 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
569 _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
571 Widget_Data *wd = elm_widget_data_get(obj);
572 edje_object_signal_callback_add(elm_smart_scroller_edje_object_get(wd->scr),
573 emission, source, func_cb, data);
577 _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
579 Widget_Data *wd = elm_widget_data_get(obj);
580 edje_object_signal_callback_del_full(
581 elm_smart_scroller_edje_object_get(wd->scr),
582 emission, source, func_cb, data);
586 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
588 Widget_Data *wd = elm_widget_data_get(obj);
594 elm_smart_scroller_mirrored_set(wd->scr, rtl);
596 EINA_LIST_FOREACH(wd->items, n, it)
597 edje_object_mirrored_set(it->base.view, rtl);
601 _theme_hook(Evas_Object *obj)
603 Widget_Data *wd = elm_widget_data_get(obj);
608 _elm_widget_mirrored_reload(obj);
609 _mirrored_set(obj, elm_widget_mirrored_get(obj));
616 elm_smart_scroller_object_theme_set(obj, wd->scr, "list", "base",
617 elm_widget_style_get(obj));
618 // edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
619 edj = elm_smart_scroller_edje_object_get(wd->scr);
620 str = edje_object_data_get(edj, "focus_highlight");
621 if ((str) && (!strcmp(str, "on")))
622 elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
624 elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
625 elm_object_style_set(wd->scr, elm_widget_style_get(obj));
627 EINA_LIST_FOREACH(wd->items, n, it)
629 edje_object_scale_set(it->base.view, elm_widget_scale_get(obj) * _elm_config->scale);
637 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
639 Widget_Data *wd = elm_widget_data_get(obj);
641 if (elm_widget_focus_get(obj))
643 edje_object_signal_emit(wd->self, "elm,action,focus", "elm");
644 evas_object_focus_set(wd->self, EINA_TRUE);
646 if ((wd->selected) && (!wd->last_selected_item))
647 wd->last_selected_item = eina_list_data_get(wd->selected);
651 edje_object_signal_emit(wd->self, "elm,action,unfocus", "elm");
652 evas_object_focus_set(wd->self, EINA_FALSE);
657 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
659 Widget_Data *wd = elm_widget_data_get(data);
666 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
668 Widget_Data *wd = elm_widget_data_get(obj);
669 Evas_Object *sub = event_info;
675 if ((sub == wd->box) || (sub == wd->scr)) return;
677 EINA_LIST_FOREACH(wd->items, l, it)
679 if ((sub == it->icon) || (sub == it->end))
681 if (it->icon == sub) it->icon = NULL;
682 if (it->end == sub) it->end = NULL;
683 evas_object_event_callback_del_full
684 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints,
692 wd->fix_pending = EINA_TRUE;
699 _item_hilight(Elm_List_Item *it)
701 Evas_Object *obj = it->base.widget;
702 Widget_Data *wd = elm_widget_data_get(obj);
703 const char *selectraise;
706 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
707 if (it->hilighted) return;
709 evas_object_ref(obj);
712 edje_object_signal_emit(it->base.view, "elm,state,selected", "elm");
713 selectraise = edje_object_data_get(it->base.view, "selectraise");
714 if ((selectraise) && (!strcmp(selectraise, "on")))
715 evas_object_raise(it->base.view);
716 it->hilighted = EINA_TRUE;
718 _elm_list_unwalk(wd);
719 evas_object_unref(obj);
723 _item_select(Elm_List_Item *it)
725 Evas_Object *obj = it->base.widget;
726 Widget_Data *wd = elm_widget_data_get(obj);
729 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
732 if (wd->always_select) goto call;
735 it->selected = EINA_TRUE;
736 wd->selected = eina_list_append(wd->selected, it);
739 evas_object_ref(obj);
742 if (it->func) it->func((void *)it->base.data, it->base.widget, it);
743 evas_object_smart_callback_call(obj, SIG_SELECTED, it);
744 it->wd->last_selected_item = it;
746 _elm_list_unwalk(wd);
747 evas_object_unref(obj);
751 _item_unselect(Elm_List_Item *it)
753 Evas_Object *obj = it->base.widget;
754 Widget_Data *wd = elm_widget_data_get(obj);
755 const char *stacking, *selectraise;
758 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
759 if (!it->hilighted) return;
761 evas_object_ref(obj);
764 edje_object_signal_emit(it->base.view, "elm,state,unselected", "elm");
765 stacking = edje_object_data_get(it->base.view, "stacking");
766 selectraise = edje_object_data_get(it->base.view, "selectraise");
767 if ((selectraise) && (!strcmp(selectraise, "on")))
769 if ((stacking) && (!strcmp(stacking, "below")))
770 evas_object_lower(it->base.view);
772 it->hilighted = EINA_FALSE;
775 it->selected = EINA_FALSE;
776 wd->selected = eina_list_remove(wd->selected, it);
777 evas_object_smart_callback_call(it->base.widget, SIG_UNSELECTED, it);
780 _elm_list_unwalk(wd);
781 evas_object_unref(obj);
785 _swipe_cancel(void *data)
787 Elm_List_Item *it = data;
788 Widget_Data *wd = elm_widget_data_get(it->base.widget);
790 if (!wd) return ECORE_CALLBACK_CANCEL;
791 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, ECORE_CALLBACK_CANCEL);
792 wd->swipe = EINA_FALSE;
794 return ECORE_CALLBACK_RENEW;
798 _mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
800 Elm_List_Item *it = data;
801 Evas_Object *obj2 = it->base.widget;
802 Widget_Data *wd = elm_widget_data_get(obj2);
803 Evas_Event_Mouse_Move *ev = event_info;
806 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
808 evas_object_ref(obj2);
811 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
815 wd->on_hold = EINA_TRUE;
818 ecore_timer_del(it->long_timer);
819 it->long_timer = NULL;
821 if (!wd->wasselected)
824 if (wd->movements == SWIPE_MOVES) wd->swipe = EINA_TRUE;
827 wd->history[wd->movements].x = ev->cur.canvas.x;
828 wd->history[wd->movements].y = ev->cur.canvas.y;
829 if (abs((wd->history[wd->movements].x - wd->history[0].x)) > 40)
830 wd->swipe = EINA_TRUE;
836 _elm_list_unwalk(wd);
837 evas_object_unref(obj2);
841 _scroll_edge_left(void *data, Evas_Object *scr __UNUSED__, void *event_info __UNUSED__)
843 Evas_Object *obj = data;
844 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_LEFT, NULL);
848 _scroll_edge_right(void *data, Evas_Object *scr __UNUSED__, void *event_info __UNUSED__)
850 Evas_Object *obj = data;
851 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_RIGHT, NULL);
855 _scroll_edge_top(void *data, Evas_Object *scr __UNUSED__, void *event_info __UNUSED__)
857 Evas_Object *obj = data;
858 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_TOP, NULL);
862 _scroll_edge_bottom(void *data, Evas_Object *scr __UNUSED__, void *event_info __UNUSED__)
864 Evas_Object *obj = data;
865 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_BOTTOM, NULL);
869 _long_press(void *data)
871 Elm_List_Item *it = data;
872 Evas_Object *obj = it->base.widget;
873 Widget_Data *wd = elm_widget_data_get(obj);
877 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, ECORE_CALLBACK_CANCEL);
878 it->long_timer = NULL;
879 if (it->disabled) goto end;
881 wd->longpressed = EINA_TRUE;
882 evas_object_smart_callback_call(it->base.widget, SIG_LONGPRESSED, it);
885 return ECORE_CALLBACK_CANCEL;
889 _swipe(Elm_List_Item *it)
892 Widget_Data *wd = elm_widget_data_get(it->base.widget);
894 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
896 wd->swipe = EINA_FALSE;
897 for (i = 0; i < wd->movements; i++)
899 sum += wd->history[i].x;
900 if (abs(wd->history[0].y - wd->history[i].y) > 10) return;
903 sum /= wd->movements;
904 if (abs(sum - wd->history[0].x) <= 10) return;
905 evas_object_smart_callback_call(it->base.widget, "swipe", it);
909 _mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
911 Elm_List_Item *it = data;
912 Evas_Object *obj2 = it->base.widget;
913 Widget_Data *wd = elm_widget_data_get(obj2);
914 Evas_Event_Mouse_Down *ev = event_info;
917 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
918 if (ev->button != 1) return;
919 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = EINA_TRUE;
920 else wd->on_hold = EINA_FALSE;
921 if (wd->on_hold) return;
922 wd->wasselected = it->selected;
924 evas_object_ref(obj2);
928 wd->longpressed = EINA_FALSE;
929 if (it->long_timer) ecore_timer_del(it->long_timer);
930 it->long_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press, it);
931 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
932 it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
933 /* Always call the callbacks last - the user may delete our context! */
934 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
936 evas_object_smart_callback_call(it->base.widget, SIG_CLICKED_DOUBLE, it);
938 wd->swipe = EINA_FALSE;
941 _elm_list_unwalk(wd);
942 evas_object_unref(obj2);
946 _mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
948 Elm_List_Item *it = data;
949 Evas_Object *obj2 = it->base.widget;
950 Widget_Data *wd = elm_widget_data_get(obj2);
951 Evas_Event_Mouse_Up *ev = event_info;
954 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
955 if (ev->button != 1) return;
956 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) wd->on_hold = EINA_TRUE;
957 else wd->on_hold = EINA_FALSE;
958 wd->longpressed = EINA_FALSE;
961 ecore_timer_del(it->long_timer);
962 it->long_timer = NULL;
966 ecore_timer_del(it->swipe_timer);
967 it->swipe_timer = NULL;
971 if (wd->swipe) _swipe(data);
972 wd->on_hold = EINA_FALSE;
977 if (!wd->wasselected) _item_unselect(it);
984 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
986 evas_object_ref(obj2);
996 else _item_unselect(it);
1002 while (wd->selected)
1003 _item_unselect(wd->selected->data);
1009 const Eina_List *l, *l_next;
1012 EINA_LIST_FOREACH_SAFE(wd->selected, l, l_next, it2)
1013 if (it2 != it) _item_unselect(it2);
1019 _elm_list_unwalk(wd);
1020 evas_object_unref(obj2);
1023 static Elm_List_Item *
1024 _item_new(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data)
1026 Widget_Data *wd = elm_widget_data_get(obj);
1029 if (!wd) return NULL;
1030 it = elm_widget_item_new(obj, Elm_List_Item);
1032 it->label = eina_stringshare_add(label);
1036 it->base.data = data;
1037 it->base.view = edje_object_add(evas_object_evas_get(obj));
1038 edje_object_mirrored_set(it->base.view, elm_widget_mirrored_get(obj));
1039 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_DOWN,
1041 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_UP,
1043 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_MOVE,
1045 evas_object_size_hint_weight_set(it->base.view, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1046 evas_object_size_hint_align_set(it->base.view, EVAS_HINT_FILL, EVAS_HINT_FILL);
1049 elm_widget_sub_object_add(obj, it->icon);
1050 evas_object_event_callback_add(it->icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1051 _changed_size_hints, obj);
1055 elm_widget_sub_object_add(obj, it->end);
1056 evas_object_event_callback_add(it->end, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1057 _changed_size_hints, obj);
1063 _elm_list_mode_set_internal(Widget_Data *wd)
1068 if (wd->mode == ELM_LIST_LIMIT)
1072 wd->scr_minw = EINA_TRUE;
1073 wd->scr_minh = EINA_FALSE;
1077 wd->scr_minw = EINA_FALSE;
1078 wd->scr_minh = EINA_TRUE;
1081 else if (wd->mode == ELM_LIST_EXPAND)
1083 wd->scr_minw = EINA_TRUE;
1084 wd->scr_minh = EINA_TRUE;
1088 wd->scr_minw = EINA_FALSE;
1089 wd->scr_minh = EINA_FALSE;
1092 _sizing_eval(wd->self);
1096 _fix_items(Evas_Object *obj)
1098 Widget_Data *wd = elm_widget_data_get(obj);
1102 Evas_Coord minw[2] = { 0, 0 }, minh[2] = { 0, 0 };
1105 const char *style = elm_widget_style_get(obj);
1106 const char *it_plain = wd->h_mode ? "h_item" : "item";
1107 const char *it_odd = wd->h_mode ? "h_item_odd" : "item_odd";
1108 const char *it_compress = wd->h_mode ? "h_item_compress" : "item_compress";
1109 const char *it_compress_odd = wd->h_mode ? "h_item_compress_odd" : "item_compress_odd";
1113 wd->fix_pending = EINA_TRUE;
1117 evas_object_ref(obj);
1118 _elm_list_walk(wd); // watch out "return" before unwalk!
1120 EINA_LIST_FOREACH(wd->items, l, it)
1122 if (it->deleted) continue;
1125 evas_object_size_hint_min_get(it->icon, &mw, &mh);
1126 if (mw > minw[0]) minw[0] = mw;
1127 if (mh > minh[0]) minh[0] = mh;
1131 evas_object_size_hint_min_get(it->end, &mw, &mh);
1132 if (mw > minw[1]) minw[1] = mw;
1133 if (mh > minh[1]) minh[1] = mh;
1137 if ((minw[0] != wd->minw[0]) || (minw[1] != wd->minw[1]) ||
1138 (minw[0] != wd->minh[0]) || (minh[1] != wd->minh[1]))
1140 wd->minw[0] = minw[0];
1141 wd->minw[1] = minw[1];
1142 wd->minh[0] = minh[0];
1143 wd->minh[1] = minh[1];
1147 EINA_LIST_FOREACH(wd->items, l, it)
1153 if ((it->even != it->is_even) || (!it->fixed) || (redo))
1155 const char *stacking;
1157 /* FIXME: separators' themes seem to be b0rked */
1158 if (it->is_separator)
1159 _elm_theme_object_set(obj, it->base.view, "separator",
1160 wd->h_mode ? "horizontal" : "vertical",
1162 else if (wd->mode == ELM_LIST_COMPRESS)
1165 _elm_theme_object_set(obj, it->base.view, "list",
1166 it_compress, style);
1168 _elm_theme_object_set(obj, it->base.view, "list",
1169 it_compress_odd, style);
1174 _elm_theme_object_set(obj, it->base.view, "list", it_plain,
1177 _elm_theme_object_set(obj, it->base.view, "list", it_odd,
1180 stacking = edje_object_data_get(it->base.view, "stacking");
1183 if (!strcmp(stacking, "below"))
1184 evas_object_lower(it->base.view);
1185 else if (!strcmp(stacking, "above"))
1186 evas_object_raise(it->base.view);
1188 edje_object_part_text_set(it->base.view, "elm.text", it->label);
1190 if ((!it->icon) && (minh[0] > 0))
1192 it->icon = evas_object_rectangle_add(evas_object_evas_get(it->base.view));
1193 evas_object_color_set(it->icon, 0, 0, 0, 0);
1194 it->dummy_icon = EINA_TRUE;
1196 if ((!it->end) && (minh[1] > 0))
1198 it->end = evas_object_rectangle_add(evas_object_evas_get(it->base.view));
1199 evas_object_color_set(it->end, 0, 0, 0, 0);
1200 it->dummy_end = EINA_TRUE;
1204 evas_object_size_hint_min_set(it->icon, minw[0], minh[0]);
1205 evas_object_size_hint_max_set(it->icon, 99999, 99999);
1206 edje_object_part_swallow(it->base.view, "elm.swallow.icon", it->icon);
1210 evas_object_size_hint_min_set(it->end, minw[1], minh[1]);
1211 evas_object_size_hint_max_set(it->end, 99999, 99999);
1212 edje_object_part_swallow(it->base.view, "elm.swallow.end", it->end);
1216 // this may call up user and it may modify the list item
1217 // but we're safe as we're flagged as walking.
1218 // just don't process further
1219 edje_object_message_signal_process(it->base.view);
1223 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1224 edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw, mh);
1225 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1226 evas_object_size_hint_min_set(it->base.view, mw, mh);
1227 evas_object_show(it->base.view);
1229 if ((it->selected) || (it->hilighted))
1231 const char *selectraise;
1233 // this may call up user and it may modify the list item
1234 // but we're safe as we're flagged as walking.
1235 // just don't process further
1236 edje_object_signal_emit(it->base.view, "elm,state,selected", "elm");
1240 selectraise = edje_object_data_get(it->base.view, "selectraise");
1241 if ((selectraise) && (!strcmp(selectraise, "on")))
1242 evas_object_raise(it->base.view);
1245 edje_object_signal_emit(it->base.view, "elm,state,disabled",
1248 it->fixed = EINA_TRUE;
1249 it->is_even = it->even;
1255 evas_object_size_hint_min_get(wd->box, &mw, &mh);
1257 _elm_list_mode_set_internal(wd);
1259 _elm_list_unwalk(wd);
1260 evas_object_unref(obj);
1264 _hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1266 Widget_Data *wd = elm_widget_data_get(obj);
1269 elm_smart_scroller_hold_set(wd->scr, EINA_TRUE);
1273 _hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1275 Widget_Data *wd = elm_widget_data_get(obj);
1278 elm_smart_scroller_hold_set(wd->scr, EINA_FALSE);
1282 _freeze_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1284 Widget_Data *wd = elm_widget_data_get(obj);
1287 elm_smart_scroller_freeze_set(wd->scr, EINA_TRUE);
1291 _freeze_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1293 Widget_Data *wd = elm_widget_data_get(obj);
1296 elm_smart_scroller_freeze_set(wd->scr, EINA_FALSE);
1300 _resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1306 * Adds a list object.
1308 * @param parent The parent object
1309 * @return The created object or NULL upon failure
1314 elm_list_add(Evas_Object *parent)
1319 Evas_Coord minw, minh;
1321 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
1323 ELM_SET_WIDTYPE(widtype, "list");
1324 elm_widget_type_set(obj, "list");
1325 elm_widget_sub_object_add(parent, obj);
1326 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
1327 elm_widget_data_set(obj, wd);
1328 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
1329 elm_widget_del_hook_set(obj, _del_hook);
1330 elm_widget_theme_hook_set(obj, _theme_hook);
1331 elm_widget_disable_hook_set(obj, _disable_hook);
1332 elm_widget_can_focus_set(obj, EINA_TRUE);
1333 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
1334 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
1335 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
1336 elm_widget_event_hook_set(obj, _event_hook);
1338 wd->scr = elm_smart_scroller_add(e);
1339 elm_smart_scroller_widget_set(wd->scr, obj);
1340 elm_widget_resize_object_set(obj, wd->scr);
1341 evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1342 _changed_size_hints, obj);
1343 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &minw, &minh);
1344 evas_object_size_hint_min_set(obj, minw, minh);
1345 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
1347 elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE,
1348 _elm_config->thumbscroll_bounce_enable);
1350 wd->box = elm_box_add(parent);
1351 elm_box_homogenous_set(wd->box, 1);
1352 evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND, 0.0);
1353 evas_object_size_hint_align_set(wd->box, EVAS_HINT_FILL, 0.0);
1354 elm_widget_on_show_region_hook_set(wd->box, _show_region_hook, obj);
1355 elm_widget_sub_object_add(obj, wd->box);
1356 elm_smart_scroller_child_set(wd->scr, wd->box);
1357 evas_object_event_callback_add(wd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1358 _changed_size_hints, obj);
1360 evas_object_show(wd->box);
1364 wd->mode = ELM_LIST_SCROLL;
1366 evas_object_smart_callback_add(wd->scr, "edge,left", _scroll_edge_left, obj);
1367 evas_object_smart_callback_add(wd->scr, "edge,right", _scroll_edge_right, obj);
1368 evas_object_smart_callback_add(wd->scr, "edge,top", _scroll_edge_top, obj);
1369 evas_object_smart_callback_add(wd->scr, "edge,bottom", _scroll_edge_bottom, obj);
1371 evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
1372 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
1373 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
1374 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
1375 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
1377 evas_object_smart_callbacks_descriptions_set(obj, _signals);
1379 _mirrored_set(obj, elm_widget_mirrored_get(obj));
1385 * Appends an item to the list object.
1387 * @param obj The list object
1388 * @param label The label of the list item
1389 * @param icon The icon object to use for the left side of the item
1390 * @param end The icon object to use for the right side of the item
1391 * @param func The function to call when the item is clicked
1392 * @param data The data to associate with the item for related callbacks
1394 * @return The created item or NULL upon failure
1398 EAPI Elm_List_Item *
1399 elm_list_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data)
1401 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1402 Widget_Data *wd = elm_widget_data_get(obj);
1403 Elm_List_Item *it = _item_new(obj, label, icon, end, func, data);
1405 wd->items = eina_list_append(wd->items, it);
1406 it->node = eina_list_last(wd->items);
1407 elm_box_pack_end(wd->box, it->base.view);
1412 * Prepends an item to the list object.
1414 * @param obj The list object
1415 * @param label The label of the list item
1416 * @param icon The icon object to use for the left side of the item
1417 * @param end The icon object to use for the right side of the item
1418 * @param func The function to call when the item is clicked
1419 * @param data The data to associate with the item for related callbacks
1421 * @return The created item or NULL upon failure
1425 EAPI Elm_List_Item *
1426 elm_list_item_prepend(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data)
1428 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1429 Widget_Data *wd = elm_widget_data_get(obj);
1430 Elm_List_Item *it = _item_new(obj, label, icon, end, func, data);
1432 wd->items = eina_list_prepend(wd->items, it);
1433 it->node = wd->items;
1434 elm_box_pack_start(wd->box, it->base.view);
1439 * Inserts an item into the list object before @p before.
1441 * @param obj The list object
1442 * @param before The list item to insert before
1443 * @param label The label of the list item
1444 * @param icon The icon object to use for the left side of the item
1445 * @param end The icon object to use for the right side of the item
1446 * @param func The function to call when the item is clicked
1447 * @param data The data to associate with the item for related callbacks
1449 * @return The created item or NULL upon failure
1453 EAPI Elm_List_Item *
1454 elm_list_item_insert_before(Evas_Object *obj, Elm_List_Item *before, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data)
1459 EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
1460 if (!before->node) return NULL;
1461 ELM_LIST_ITEM_CHECK_DELETED_RETURN(before, NULL);
1463 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1464 wd = elm_widget_data_get(obj);
1465 if (!wd) return NULL;
1466 it = _item_new(obj, label, icon, end, func, data);
1467 wd->items = eina_list_prepend_relative_list(wd->items, it, before->node);
1468 it->node = before->node->prev;
1469 elm_box_pack_before(wd->box, it->base.view, before->base.view);
1474 * Inserts an item into the list object after @p after.
1476 * @param obj The list object
1477 * @param after The list item to insert after
1478 * @param label The label of the list item
1479 * @param icon The icon object to use for the left side of the item
1480 * @param end The icon object to use for the right side of the item
1481 * @param func The function to call when the item is clicked
1482 * @param data The data to associate with the item for related callbacks
1484 * @return The created item or NULL upon failure
1488 EAPI Elm_List_Item *
1489 elm_list_item_insert_after(Evas_Object *obj, Elm_List_Item *after, const char *label, Evas_Object *icon, Evas_Object *end, Evas_Smart_Cb func, const void *data)
1494 EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
1495 if (!after->node) return NULL;
1496 ELM_LIST_ITEM_CHECK_DELETED_RETURN(after, NULL);
1498 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1499 wd = elm_widget_data_get(obj);
1500 if (!wd) return NULL;
1501 it = _item_new(obj, label, icon, end, func, data);
1502 wd->items = eina_list_append_relative_list(wd->items, it, after->node);
1503 it->node = after->node->next;
1504 elm_box_pack_after(wd->box, it->base.view, after->base.view);
1509 * Insert a new item into the sorted list object.
1511 * @param obj The list object
1512 * @param label The label of the list item
1513 * @param icon The icon object to use for the left side of the item
1514 * @param end The icon object to use for the right side of the item
1515 * @param func The function to call when the item is clicked
1516 * @param data The data to associate with the item for related callbacks
1517 * @param cmp_func The function called for the sort.
1519 * @return The created item or NULL upon failure
1523 EAPI Elm_List_Item *
1524 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)
1526 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1527 Widget_Data *wd = elm_widget_data_get(obj);
1528 Elm_List_Item *it = _item_new(obj, label, icon, end, func, data);
1531 wd->items = eina_list_sorted_insert(wd->items, cmp_func, it);
1532 l = eina_list_data_find_list(wd->items, it);
1533 l = eina_list_next(l);
1536 it->node = eina_list_last(wd->items);
1537 elm_box_pack_end(wd->box, it->base.view);
1541 Elm_List_Item *before = eina_list_data_get(l);
1542 it->node = before->node->prev;
1543 elm_box_pack_before(wd->box, it->base.view, before->base.view);
1549 * Clears a list of all items.
1551 * @param obj The list object
1556 elm_list_clear(Evas_Object *obj)
1558 ELM_CHECK_WIDTYPE(obj, widtype);
1559 Widget_Data *wd = elm_widget_data_get(obj);
1563 if (!wd->items) return;
1565 eina_list_free(wd->selected);
1566 wd->selected = NULL;
1568 if (wd->walking > 0)
1572 EINA_LIST_FOREACH(wd->items, n, it)
1574 if (it->deleted) continue;
1575 it->deleted = EINA_TRUE;
1576 wd->to_delete = eina_list_append(wd->to_delete, it);
1581 evas_object_ref(obj);
1584 EINA_LIST_FREE(wd->items, it)
1586 elm_widget_item_pre_notify_del(it);
1587 _elm_list_item_free(it);
1590 _elm_list_unwalk(wd);
1594 evas_object_unref(obj);
1598 * Starts the list. Call before running show() on the list object.
1600 * @param obj The list object
1605 elm_list_go(Evas_Object *obj)
1607 ELM_CHECK_WIDTYPE(obj, widtype);
1608 Widget_Data *wd = elm_widget_data_get(obj);
1614 * Enables/disables the state of multi-select on the list object.
1616 * @param obj The list object
1617 * @param multi If true, multi-select is enabled
1622 elm_list_multi_select_set(Evas_Object *obj, Eina_Bool multi)
1624 ELM_CHECK_WIDTYPE(obj, widtype);
1625 Widget_Data *wd = elm_widget_data_get(obj);
1631 * Gets the state of multi-select on the list object.
1633 * @param obj The list object
1634 * @return If true, multi-select is enabled
1639 elm_list_multi_select_get(const Evas_Object *obj)
1641 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1642 Widget_Data *wd = elm_widget_data_get(obj);
1643 if (!wd) return EINA_FALSE;
1648 * Set which mode to use for the list with.
1650 * @param obj The list object
1651 * @param mode One of @c ELM_LIST_COMPRESS, @c ELM_LIST_SCROLL, @c
1652 * ELM_LIST_LIMIT or @c ELM_LIST_EXPAND.
1654 * @note Default value is @c ELM_LIST_SCROLL. At this mode, the list
1655 * object won't set any of its size hints to inform how a possible
1656 * container should resize it. Then, if it's not created as a "resize
1657 * object", it might end with zero dimensions. The list will respect
1658 * the container's geometry and, if any of its items won't fit into
1659 * its transverse axis, one will be able to scroll it in that
1660 * direction. @c ELM_LIST_COMPRESS is the same as the previous, except
1661 * that it <b>won't</b> let one scroll in the transverse axis, on
1662 * those cases (large items will get cropped). @c ELM_LIST_LIMIT will
1663 * actually set a minimun size hint on the list object, so that
1664 * containers may respect it (and resize itself to fit the child
1665 * properly). More specifically, a minimum size hint will be set for
1666 * its transverse axis, so that the <b>largest</b> item in that
1667 * direction fits well. @c ELM_LIST_EXPAND, besides setting a minimum
1668 * size on the transverse axis, just like the previous mode, will set
1669 * a minimum size on the longitudinal axis too, trying to reserve
1670 * space to all its children to be visible at a time. The last two
1671 * modes can always have effects bounded by setting the list object's
1672 * maximum size hints, though.
1677 elm_list_mode_set(Evas_Object *obj, Elm_List_Mode mode)
1679 ELM_CHECK_WIDTYPE(obj, widtype);
1683 wd = elm_widget_data_get(obj);
1686 if (wd->mode == mode)
1690 _elm_list_mode_set_internal(wd);
1694 * Get the mode the list is at.
1696 * @param obj The list object
1697 * @return mode One of @c ELM_LIST_COMPRESS, @c ELM_LIST_SCROLL or @c
1698 * ELM_LIST_LIMIT (@c ELM_LIST_LAST on errors).
1700 * @note see elm_list_mode_set() for more information.
1705 elm_list_mode_get(const Evas_Object *obj)
1707 ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
1708 Widget_Data *wd = elm_widget_data_get(obj);
1709 if (!wd) return ELM_LIST_LAST;
1714 * Enables/disables horizontal mode of the list.
1716 * @param obj The list object
1717 * @param mode If true, horizontale mode is enabled
1719 * @note Bounce options for the list will be reset to default values
1720 * with this funcion. Re-call elm_list_bounce_set() once more after
1721 * this one, if you had custom values.
1726 elm_list_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
1728 ELM_CHECK_WIDTYPE(obj, widtype);
1731 Eina_Bool bounce = _elm_config->thumbscroll_bounce_enable;
1733 wd = elm_widget_data_get(obj);
1737 if (wd->h_mode == horizontal)
1740 wd->h_mode = horizontal;
1741 elm_box_horizontal_set(wd->box, horizontal);
1745 evas_object_size_hint_weight_set(wd->box, 0.0, EVAS_HINT_EXPAND);
1746 evas_object_size_hint_align_set(wd->box, 0.0, EVAS_HINT_FILL);
1747 elm_smart_scroller_bounce_allow_set(wd->scr, bounce, EINA_FALSE);
1751 evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND, 0.0);
1752 evas_object_size_hint_align_set(wd->box, EVAS_HINT_FILL, 0.0);
1753 elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE, bounce);
1756 _elm_list_mode_set_internal(wd);
1760 * Retrieve whether horizontal mode is enabled for a list.
1762 * @param obj The list object
1763 * @return @c EINA_TRUE, if horizontal mode is enabled and @c
1764 * EINA_FALSE, otherwise.
1766 * @note see elm_list_horizontal_set() for more information.
1771 elm_list_horizontal_get(const Evas_Object *obj)
1773 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1777 wd = elm_widget_data_get(obj);
1785 * Enables/disables the state of always_select, meaning that
1786 * an item will always be selected.
1788 * @param obj The list object
1789 * @param always_select If true, always_select is enabled
1794 elm_list_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select)
1796 ELM_CHECK_WIDTYPE(obj, widtype);
1797 Widget_Data *wd = elm_widget_data_get(obj);
1799 wd->always_select = always_select;
1803 * Gets the state of always_select.
1804 * See also elm_list_always_select_mode_set()
1806 * @param obj The list object
1807 * @return If true, always_select is enabled
1812 elm_list_always_select_mode_get(const Evas_Object *obj)
1814 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1815 Widget_Data *wd = elm_widget_data_get(obj);
1816 if (!wd) return EINA_FALSE;
1817 return wd->always_select;
1821 * Returns a list of all the list items.
1823 * @param obj The list object
1824 * @return An Eina_List* of the list items, or NULL on failure
1828 EAPI const Eina_List *
1829 elm_list_items_get(const Evas_Object *obj)
1831 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1832 Widget_Data *wd = elm_widget_data_get(obj);
1833 if (!wd) return NULL;
1838 * Returns the currently selected list item.
1840 * @param obj The list object
1841 * @return The selected list item, or NULL on failure
1845 EAPI Elm_List_Item *
1846 elm_list_selected_item_get(const Evas_Object *obj)
1848 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1849 Widget_Data *wd = elm_widget_data_get(obj);
1850 if (!wd) return NULL;
1851 if (wd->selected) return wd->selected->data;
1856 * Returns a list of the currently selected list items.
1858 * @param obj The list object
1859 * @return An Eina_List* of the selected list items, or NULL on failure
1863 EAPI const Eina_List *
1864 elm_list_selected_items_get(const Evas_Object *obj)
1866 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1867 Widget_Data *wd = elm_widget_data_get(obj);
1868 if (!wd) return NULL;
1869 return wd->selected;
1873 * Sets if item is a separator.
1875 * @param it The list item object
1879 elm_list_item_separator_set(Elm_List_Item *it, Eina_Bool setting)
1881 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
1882 it->is_separator = !!setting;
1886 * Returns EINA_TRUE if Elm_List_Item is a separator.
1888 * @param it The list item object
1891 elm_list_item_separator_get(const Elm_List_Item *it)
1893 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, EINA_FALSE);
1894 return it->is_separator;
1899 * Sets the selected state of @p it.
1901 * @param it The list item
1902 * @param selected Enables/disables the selected state
1907 elm_list_item_selected_set(Elm_List_Item *it, Eina_Bool selected)
1909 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
1910 Evas_Object *obj = it->base.widget;
1911 Widget_Data *wd = elm_widget_data_get(obj);
1914 selected = !!selected;
1915 if (it->selected == selected) return;
1917 evas_object_ref(obj);
1924 while (wd->selected)
1925 _item_unselect(wd->selected->data);
1933 _elm_list_unwalk(wd);
1934 evas_object_unref(obj);
1938 * Gets the selected state of @p it.
1940 * @param it The list item
1941 * @return If true, the item is selected
1946 elm_list_item_selected_get(const Elm_List_Item *it)
1948 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, EINA_FALSE);
1949 return it->selected;
1953 * Brings @p it to the center of the list view.
1955 * @param it The list item
1960 elm_list_item_show(Elm_List_Item *it)
1962 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
1963 Widget_Data *wd = elm_widget_data_get(it->base.widget);
1964 Evas_Coord bx, by, bw, bh;
1965 Evas_Coord x, y, w, h;
1967 evas_object_geometry_get(wd->box, &bx, &by, &bw, &bh);
1968 evas_object_geometry_get(it->base.view, &x, &y, &w, &h);
1972 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
1976 * Bring in the given item
1978 * This causes list to jump to the given item @p it and show it (by scrolling),
1979 * if it is not fully visible. This may use animation to do so and take a
1982 * @param it The item
1987 elm_list_item_bring_in(Elm_List_Item *it)
1989 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
1990 Widget_Data *wd = elm_widget_data_get(it->base.widget);
1991 Evas_Coord bx, by, bw, bh;
1992 Evas_Coord x, y, w, h;
1994 evas_object_geometry_get(wd->box, &bx, &by, &bw, &bh);
1995 evas_object_geometry_get(it->base.view, &x, &y, &w, &h);
1999 elm_smart_scroller_region_bring_in(wd->scr, x, y, w, h);
2003 * Deletes item @p it from the list.
2005 * @param it The list item to delete
2010 elm_list_item_del(Elm_List_Item *it)
2012 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
2013 Evas_Object *obj = it->base.widget;
2014 Widget_Data *wd = elm_widget_data_get(obj);
2017 if (it->selected) _item_unselect(it);
2019 if (wd->walking > 0)
2021 if (it->deleted) return;
2022 it->deleted = EINA_TRUE;
2023 wd->to_delete = eina_list_append(wd->to_delete, it);
2027 wd->items = eina_list_remove_list(wd->items, it->node);
2029 evas_object_ref(obj);
2032 elm_widget_item_pre_notify_del(it);
2033 _elm_list_item_free(it);
2035 _elm_list_unwalk(wd);
2036 evas_object_unref(obj);
2040 * Set the function called when a list item is freed.
2042 * @param it The item to set the callback on
2043 * @param func The function called
2048 elm_list_item_del_cb_set(Elm_List_Item *it, Evas_Smart_Cb func)
2050 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
2051 elm_widget_item_del_cb_set(it, func);
2055 * Returns the data associated with the item.
2057 * @param it The list item
2058 * @return The data associated with @p it
2063 elm_list_item_data_get(const Elm_List_Item *it)
2065 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, NULL);
2066 return elm_widget_item_data_get(it);
2070 * Returns the left side icon associated with the item.
2072 * @param it The list item
2073 * @return The left side icon associated with @p it
2078 elm_list_item_icon_get(const Elm_List_Item *it)
2080 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, NULL);
2081 if (it->dummy_icon) return NULL;
2086 * Sets the left side icon associated with the item.
2088 * Once the icon object is set, a previously set one will be deleted.
2089 * You probably don't want, then, to have the <b>same</b> icon object set
2090 * for more than one item of the list.
2092 * @param it The list item
2093 * @param icon The left side icon object to associate with @p it
2098 elm_list_item_icon_set(Elm_List_Item *it, Evas_Object *icon)
2100 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
2101 if (it->icon == icon) return;
2102 if ((it->dummy_icon) && (!icon)) return;
2105 evas_object_del(it->icon);
2106 it->dummy_icon = EINA_FALSE;
2110 icon = evas_object_rectangle_add(evas_object_evas_get(it->base.widget));
2111 evas_object_color_set(icon, 0, 0, 0, 0);
2112 it->dummy_icon = EINA_TRUE;
2116 evas_object_del(it->icon);
2121 edje_object_part_swallow(it->base.view, "elm.swallow.icon", icon);
2125 * Gets the right side icon associated with the item.
2127 * @param it The list item
2128 * @return The right side icon object associated with @p it
2133 elm_list_item_end_get(const Elm_List_Item *it)
2135 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, NULL);
2136 if (it->dummy_end) return NULL;
2141 * Sets the right side icon associated with the item.
2143 * Once the icon object is set, a previously set one will be deleted.
2144 * You probably don't want, then, to have the <b>same</b> icon object set
2145 * for more than one item of the list.
2147 * @param it The list item
2148 * @param icon The right side icon object to associate with @p it
2153 elm_list_item_end_set(Elm_List_Item *it, Evas_Object *end)
2155 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
2156 if (it->end == end) return;
2157 if ((it->dummy_end) && (!end)) return;
2160 evas_object_del(it->end);
2161 it->dummy_icon = EINA_FALSE;
2165 end = evas_object_rectangle_add(evas_object_evas_get(it->base.widget));
2166 evas_object_color_set(end, 0, 0, 0, 0);
2167 it->dummy_end = EINA_TRUE;
2171 evas_object_del(it->end);
2176 edje_object_part_swallow(it->base.view, "elm.swallow.end", end);
2180 * Gets the base object of the item.
2182 * @param it The list item
2183 * @return The base object associated with @p it
2188 elm_list_item_base_get(const Elm_List_Item *it)
2190 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, NULL);
2191 return it->base.view;
2195 * Gets the label of the item.
2197 * @param it The list item
2198 * @return The label of @p it
2203 elm_list_item_label_get(const Elm_List_Item *it)
2205 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, NULL);
2210 * Sets the label of the item.
2212 * @param it The list item
2213 * @param text The label of @p it
2218 elm_list_item_label_set(Elm_List_Item *it, const char *text)
2220 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
2221 if (!eina_stringshare_replace(&it->label, text)) return;
2223 edje_object_part_text_set(it->base.view, "elm.text", it->label);
2227 * Gets the item before @p it in the list.
2229 * @param it The list item
2230 * @return The item before @p it, or NULL on failure
2234 EAPI Elm_List_Item *
2235 elm_list_item_prev(const Elm_List_Item *it)
2237 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, NULL);
2238 if (it->node->prev) return it->node->prev->data;
2243 * Gets the item after @p it in the list.
2245 * @param it The list item
2246 * @return The item after @p it, or NULL on failure
2250 EAPI Elm_List_Item *
2251 elm_list_item_next(const Elm_List_Item *it)
2253 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, NULL);
2254 if (it->node->next) return it->node->next->data;
2259 * Set the text to be shown in the list item.
2261 * @param item Target item
2262 * @param text The text to set in the content
2264 * Setup the text as tooltip to object. The item can have only one tooltip,
2265 * so any previous tooltip data is removed.
2270 elm_list_item_tooltip_text_set(Elm_List_Item *item, const char *text)
2272 ELM_LIST_ITEM_CHECK_DELETED_RETURN(item);
2273 elm_widget_item_tooltip_text_set(item, text);
2277 * Set the content to be shown in the tooltip item
2279 * Setup the tooltip to item. The item can have only one tooltip,
2280 * so any previous tooltip data is removed. @p func(with @p data) will
2281 * be called every time that need show the tooltip and it should
2282 * return a valid Evas_Object. This object is then managed fully by
2283 * tooltip system and is deleted when the tooltip is gone.
2285 * @param item the list item being attached a tooltip.
2286 * @param func the function used to create the tooltip contents.
2287 * @param data what to provide to @a func as callback data/context.
2288 * @param del_cb called when data is not needed anymore, either when
2289 * another callback replaces @func, the tooltip is unset with
2290 * elm_list_item_tooltip_unset() or the owner @a item
2291 * dies. This callback receives as the first parameter the
2292 * given @a data, and @c event_info is the item.
2297 elm_list_item_tooltip_content_cb_set(Elm_List_Item *item, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb)
2299 ELM_LIST_ITEM_CHECK_DELETED_RETURN(item);
2300 elm_widget_item_tooltip_content_cb_set(item, func, data, del_cb);
2304 * Unset tooltip from item
2306 * @param item list item to remove previously set tooltip.
2308 * Remove tooltip from item. The callback provided as del_cb to
2309 * elm_list_item_tooltip_content_cb_set() will be called to notify
2310 * it is not used anymore.
2312 * @see elm_list_item_tooltip_content_cb_set()
2317 elm_list_item_tooltip_unset(Elm_List_Item *item)
2319 ELM_LIST_ITEM_CHECK_DELETED_RETURN(item);
2320 elm_widget_item_tooltip_unset(item);
2324 * Sets a different style for this item tooltip.
2326 * @note before you set a style you should define a tooltip with
2327 * elm_list_item_tooltip_content_cb_set() or
2328 * elm_list_item_tooltip_text_set()
2330 * @param item list item with tooltip already set.
2331 * @param style the theme style to use (default, transparent, ...)
2336 elm_list_item_tooltip_style_set(Elm_List_Item *item, const char *style)
2338 ELM_LIST_ITEM_CHECK_DELETED_RETURN(item);
2339 elm_widget_item_tooltip_style_set(item, style);
2343 * Get the style for this item tooltip.
2345 * @param item list item with tooltip already set.
2346 * @return style the theme style in use, defaults to "default". If the
2347 * object does not have a tooltip set, then NULL is returned.
2352 elm_list_item_tooltip_style_get(const Elm_List_Item *item)
2354 ELM_LIST_ITEM_CHECK_DELETED_RETURN(item, NULL);
2355 return elm_widget_item_tooltip_style_get(item);
2359 * Set the cursor to be shown when mouse is over the list item
2361 * @param item Target item
2362 * @param cursor the cursor name to be used.
2364 * @see elm_object_cursor_set()
2368 elm_list_item_cursor_set(Elm_List_Item *item, const char *cursor)
2370 ELM_LIST_ITEM_CHECK_DELETED_RETURN(item);
2371 elm_widget_item_cursor_set(item, cursor);
2375 * Get the cursor to be shown when mouse is over the list item
2377 * @param item list item with cursor already set.
2378 * @return the cursor name.
2383 elm_list_item_cursor_get(const Elm_List_Item *item)
2385 ELM_LIST_ITEM_CHECK_DELETED_RETURN(item, NULL);
2386 return elm_widget_item_cursor_get(item);
2390 * Unset the cursor to be shown when mouse is over the list item
2392 * @param item Target item
2394 * @see elm_object_cursor_unset()
2398 elm_list_item_cursor_unset(Elm_List_Item *item)
2400 ELM_LIST_ITEM_CHECK_DELETED_RETURN(item);
2401 elm_widget_item_cursor_unset(item);
2405 * Sets a different style for this item cursor.
2407 * @note before you set a style you should define a cursor with
2408 * elm_list_item_cursor_set()
2410 * @param item list item with cursor already set.
2411 * @param style the theme style to use (default, transparent, ...)
2416 elm_list_item_cursor_style_set(Elm_List_Item *item, const char *style)
2418 ELM_LIST_ITEM_CHECK_DELETED_RETURN(item);
2419 elm_widget_item_cursor_style_set(item, style);
2423 * Get the style for this item cursor.
2425 * @param item list item with cursor already set.
2426 * @return style the theme style in use, defaults to "default". If the
2427 * object does not have a cursor set, then NULL is returned.
2432 elm_list_item_cursor_style_get(const Elm_List_Item *item)
2434 ELM_LIST_ITEM_CHECK_DELETED_RETURN(item, NULL);
2435 return elm_widget_item_cursor_style_get(item);
2439 * Set if the cursor set should be searched on the theme or should use
2440 * the provided by the engine, only.
2442 * @note before you set if should look on theme you should define a cursor
2443 * with elm_object_cursor_set(). By default it will only look for cursors
2444 * provided by the engine.
2446 * @param item widget item with cursor already set.
2447 * @param engine_only boolean to define it cursors should be looked only
2448 * between the provided by the engine or searched on widget's theme as well.
2453 elm_list_item_cursor_engine_only_set(Elm_List_Item *item, Eina_Bool engine_only)
2455 ELM_LIST_ITEM_CHECK_DELETED_RETURN(item);
2456 elm_widget_item_cursor_engine_only_set(item, engine_only);
2460 * Get the cursor engine only usage for this item cursor.
2462 * @param item widget item with cursor already set.
2463 * @return engine_only boolean to define it cursors should be looked only
2464 * between the provided by the engine or searched on widget's theme as well. If
2465 * the object does not have a cursor set, then EINA_FALSE is returned.
2470 elm_list_item_cursor_engine_only_get(const Elm_List_Item *item)
2472 ELM_LIST_ITEM_CHECK_DELETED_RETURN(item, EINA_FALSE);
2473 return elm_widget_item_cursor_engine_only_get(item);
2479 * This will enable or disable the scroller bounce mode for the list. See
2480 * elm_scroller_bounce_set() for details
2482 * @param obj The list object
2483 * @param h_bounce Allow bounce horizontally
2484 * @param v_bounce Allow bounce vertically
2489 elm_list_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
2491 ELM_CHECK_WIDTYPE(obj, widtype);
2492 Widget_Data *wd = elm_widget_data_get(obj);
2495 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
2499 * Get the bounce mode
2501 * @param obj The List object
2502 * @param h_bounce Allow bounce horizontally
2503 * @param v_bounce Allow bounce vertically
2508 elm_list_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
2510 ELM_CHECK_WIDTYPE(obj, widtype);
2511 Widget_Data *wd = elm_widget_data_get(obj);
2513 elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce);
2517 * Set the scrollbar policy
2519 * This sets the scrollbar visibility policy for the given list scroller.
2520 * ELM_SMART_SCROLLER_POLICY_AUTO means the scrollber is made visible if it
2521 * is needed, and otherwise kept hidden. ELM_SMART_SCROLLER_POLICY_ON turns
2522 * it on all the time, and ELM_SMART_SCROLLER_POLICY_OFF always keeps it off.
2523 * This applies respectively for the horizontal and vertical scrollbars.
2525 * @param obj The list object
2526 * @param policy_h Horizontal scrollbar policy
2527 * @param policy_v Vertical scrollbar policy
2532 elm_list_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v)
2534 ELM_CHECK_WIDTYPE(obj, widtype);
2535 Widget_Data *wd = elm_widget_data_get(obj);
2537 if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
2538 (policy_v >= ELM_SCROLLER_POLICY_LAST))
2540 elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
2544 elm_list_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v)
2546 ELM_CHECK_WIDTYPE(obj, widtype);
2547 Widget_Data *wd = elm_widget_data_get(obj);
2548 Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
2549 if ((!wd) || (!wd->scr)) return;
2550 elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
2551 if (policy_h) *policy_h = (Elm_Scroller_Policy) s_policy_h;
2552 if (policy_v) *policy_v = (Elm_Scroller_Policy) s_policy_v;
2556 * Sets the disabled/enabled state of a list item.
2558 * A disabled item cannot be selected or unselected. It will also
2559 * change its appearance (generally greyed out). This sets the
2560 * disabled state (@c EINA_TRUE for disabled, @c EINA_FALSE for
2563 * @param it The item
2564 * @param disabled The disabled state
2569 elm_list_item_disabled_set(Elm_List_Item *it, Eina_Bool disabled)
2571 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it);
2573 if (it->disabled == disabled)
2576 it->disabled = !!disabled;
2579 edje_object_signal_emit(it->base.view, "elm,state,disabled", "elm");
2581 edje_object_signal_emit(it->base.view, "elm,state,enabled", "elm");
2585 * Get the disabled/enabled state of a list item
2587 * @param it The item
2588 * @return The disabled state
2590 * See elm_list_item_disabled_set().
2595 elm_list_item_disabled_get(const Elm_List_Item *it)
2597 ELM_LIST_ITEM_CHECK_DELETED_RETURN(it, EINA_FALSE);
2599 return it->disabled;