3 #include <Elementary.h>
4 #include <Elementary_Cursor.h>
6 #include "els_scroller.h"
10 #define MAX_ITEMS_PER_BLOCK 32
11 #define REORDER_EFFECT_TIME 0.5
13 #define ELM_GEN_SETUP(wd) \
14 (wd)->calc_cb = (Ecore_Cb)_calc_job; \
15 (wd)->clear_cb = (Ecore_Cb)_clear_cb; \
16 (wd)->sizing_cb = (Ecore_Cb)_sizing_eval
19 #define ELM_GEN_ITEM_SETUP(it) \
20 (it)->del_cb = (Ecore_Cb)_item_del; \
21 (it)->highlight_cb = (Ecore_Cb)_item_highlight; \
22 (it)->unsel_cb = (Ecore_Cb)_item_unselect; \
23 (it)->unhighlight_cb = (Ecore_Cb)_item_unhighlight; \
24 (it)->unrealize_cb = (Ecore_Cb)_item_unrealize_cb
26 typedef struct _Item_Block Item_Block;
27 typedef struct _Item_Cache Item_Cache;
29 struct Elm_Gen_Item_Type
34 Evas_Coord w, h, minw, minh;
35 Elm_Gen_Item *group_item;
36 Elm_Genlist_Item_Flags flags;
37 Eina_List *mode_labels, *mode_icons, *mode_states, *mode_icon_objs;
38 Ecore_Timer *swipe_timer;
39 Evas_Coord scrl_x, scrl_y, old_scrl_y;
42 Evas_Object *mode_view;
48 Eina_Bool want_realize : 1;
49 Eina_Bool expanded : 1;
50 Eina_Bool mincalcd : 1;
53 Eina_Bool updateme : 1;
54 Eina_Bool nocache : 1;
55 Eina_Bool stacking_even : 1;
56 Eina_Bool nostacking : 1;
57 Eina_Bool move_effect_enabled : 1;
62 Eina_Inlist_Sorted_State *state;
63 Evas_Object *obj; /* the genlist object */
64 Evas_Object *scr; /* a smart scroller object which is used internally in genlist */
65 Evas_Object *pan_smart; /* "elm_genlist_pan" evas smart object. this is an extern pan of smart scroller(scr). */
67 Eina_List *group_items; /* list of groups index items */
68 Eina_Inlist *items; /* inlist of all items */
69 Elm_Gen_Item *reorder_it; /* item currently being repositioned */
70 Elm_Gen_Item *last_selected_item;
71 Pan *pan; /* pan_smart object's smart data */
74 int item_width, item_height;
75 int group_item_width, group_item_height;
78 Evas_Coord pan_x, pan_y;
79 Eina_Bool reorder_mode : 1;
80 Eina_Bool on_hold : 1;
82 Eina_Bool no_select : 1;
83 Eina_Bool wasselected : 1;
84 Eina_Bool always_select : 1;
85 Eina_Bool clear_me : 1;
86 Eina_Bool h_bounce : 1;
87 Eina_Bool v_bounce : 1;
88 Ecore_Cb del_cb, calc_cb, sizing_cb;
90 ////////////////////////////////////
91 Eina_Inlist *blocks; /* inlist of all blocks. a block consists of a certain number of items. maximum number of items in a block is 'max_items_per_block'. */
92 Evas_Coord reorder_old_pan_y, w, h, realminw, prev_viewport_w;
93 Ecore_Job *update_job;
94 Ecore_Idle_Enterer *queue_idle_enterer;
95 Ecore_Idler *must_recalc_idler;
97 Elm_Gen_Item *show_item, *anchor_item, *mode_item, *reorder_rel, *expanded_item;
98 Eina_Inlist *item_cache; /* an inlist of edje object it cache. */
100 Evas_Coord reorder_start_y; /* reorder it's initial y coordinate in the pan. */
102 Ecore_Timer *multi_timer, *scr_hold_timer;
103 Ecore_Animator *reorder_move_animator;
104 const char *mode_type;
105 const char *mode_item_style;
106 unsigned int start_time;
107 Evas_Coord prev_x, prev_y, prev_mx, prev_my;
108 Evas_Coord cur_x, cur_y, cur_mx, cur_my;
109 Eina_Bool mouse_down : 1;
110 Eina_Bool multi_down : 1;
111 Eina_Bool multi_timeout : 1;
112 Eina_Bool multitouched : 1;
113 Eina_Bool longpressed : 1;
114 Eina_Bool bring_in : 1;
115 Eina_Bool compress : 1;
116 Eina_Bool height_for_width : 1;
117 Eina_Bool homogeneous : 1;
119 Eina_Bool reorder_pan_move : 1;
120 Eina_Bool auto_scroll_enabled : 1;
121 Eina_Bool pan_resized : 1;
125 } history[SWIPE_MOVES];
127 int item_cache_count;
128 int item_cache_max; /* maximum number of cached items */
130 int max_items_per_block; /* maximum number of items per block */
131 double longpress_timeout; /* longpress timeout. this value comes from _elm_config by default. this can be changed by elm_genlist_longpress_timeout_set() */
142 Evas_Coord x, y, w, h, minw, minh;
143 Eina_Bool want_unrealize : 1;
144 Eina_Bool realized : 1;
145 Eina_Bool changed : 1;
146 Eina_Bool updateme : 1;
147 Eina_Bool showme : 1;
148 Eina_Bool must_recalc : 1;
155 Evas_Object *base_view, *spacer;
157 const char *item_style; // it->itc->item_style
158 Eina_Bool tree : 1; // it->group
159 Eina_Bool compress : 1; // it->wd->compress
161 Eina_Bool selected : 1; // it->selected
162 Eina_Bool disabled : 1; // it->disabled
163 Eina_Bool expanded : 1; // it->item->expanded
166 static const char *widtype = NULL;
167 static void _item_cache_zero(Widget_Data *wd);
168 static void _del_hook(Evas_Object *obj);
169 static void _mirrored_set(Evas_Object *obj,
171 static void _theme_hook(Evas_Object *obj);
172 static void _show_region_hook(void *data,
174 static void _sizing_eval(Evas_Object *obj);
175 static void _item_realize(Elm_Gen_Item *it,
178 static void _item_unrealize_cb(Elm_Gen_Item *it);
179 static void _item_block_unrealize(Item_Block *itb);
180 static void _calc_job(void *data);
181 static void _on_focus_hook(void *data,
183 static Eina_Bool _item_multi_select_up(Widget_Data *wd);
184 static Eina_Bool _item_multi_select_down(Widget_Data *wd);
185 static Eina_Bool _item_single_select_up(Widget_Data *wd);
186 static Eina_Bool _item_single_select_down(Widget_Data *wd);
187 static Eina_Bool _event_hook(Evas_Object *obj,
189 Evas_Callback_Type type,
191 static void _signal_emit_hook(Evas_Object *obj,
192 const char *emission,
194 static Eina_Bool _deselect_all_items(Widget_Data *wd);
195 static void _pan_calculate(Evas_Object *obj);
196 static void _pan_max_get(Evas_Object *obj,
199 static void _item_position(Elm_Gen_Item *it,
203 static void _mode_item_realize(Elm_Gen_Item *it);
204 static void _mode_item_unrealize(Elm_Gen_Item *it);
205 static void _item_mode_set(Elm_Gen_Item *it);
206 static void _item_mode_unset(Widget_Data *wd);
207 static void _group_items_recalc(void *data);
208 static void _item_move_after(Elm_Gen_Item *it,
209 Elm_Gen_Item *after);
210 static void _item_move_before(Elm_Gen_Item *it,
211 Elm_Gen_Item *before);
212 static void _item_auto_scroll(Widget_Data *wd);
214 static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
216 static const char SIG_ACTIVATED[] = "activated";
217 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
218 static const char SIG_SELECTED[] = "selected";
219 static const char SIG_UNSELECTED[] = "unselected";
220 static const char SIG_EXPANDED[] = "expanded";
221 static const char SIG_CONTRACTED[] = "contracted";
222 static const char SIG_EXPAND_REQUEST[] = "expand,request";
223 static const char SIG_CONTRACT_REQUEST[] = "contract,request";
224 static const char SIG_REALIZED[] = "realized";
225 static const char SIG_UNREALIZED[] = "unrealized";
226 static const char SIG_DRAG_START_UP[] = "drag,start,up";
227 static const char SIG_DRAG_START_DOWN[] = "drag,start,down";
228 static const char SIG_DRAG_START_LEFT[] = "drag,start,left";
229 static const char SIG_DRAG_START_RIGHT[] = "drag,start,right";
230 static const char SIG_DRAG_STOP[] = "drag,stop";
231 static const char SIG_DRAG[] = "drag";
232 static const char SIG_LONGPRESSED[] = "longpressed";
233 static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
234 static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
235 static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
236 static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
237 static const char SIG_SCROLL_EDGE_TOP[] = "scroll,edge,top"; // TODO : remove this
238 static const char SIG_SCROLL_EDGE_BOTTOM[] = "scroll,edge,bottom"; // TODO : remove this
239 static const char SIG_SCROLL_EDGE_LEFT[] = "scroll,edge,left"; // TODO : remove this
240 static const char SIG_SCROLL_EDGE_RIGHT[] = "scroll,edge,right"; // TODO : remove this
241 static const char SIG_EDGE_TOP[] = "edge,top";
242 static const char SIG_EDGE_BOTTOM[] = "edge,bottom";
243 static const char SIG_EDGE_LEFT[] = "edge,left";
244 static const char SIG_EDGE_RIGHT[] = "edge,right";
245 static const char SIG_MULTI_SWIPE_LEFT[] = "multi,swipe,left";
246 static const char SIG_MULTI_SWIPE_RIGHT[] = "multi,swipe,right";
247 static const char SIG_MULTI_SWIPE_UP[] = "multi,swipe,up";
248 static const char SIG_MULTI_SWIPE_DOWN[] = "multi,swipe,down";
249 static const char SIG_MULTI_PINCH_OUT[] = "multi,pinch,out";
250 static const char SIG_MULTI_PINCH_IN[] = "multi,pinch,in";
251 static const char SIG_SWIPE[] = "swipe";
252 static const char SIG_MOVED[] = "moved";
254 static const Evas_Smart_Cb_Description _signals[] = {
255 {SIG_CLICKED_DOUBLE, ""},
258 {SIG_UNSELECTED, ""},
260 {SIG_CONTRACTED, ""},
261 {SIG_EXPAND_REQUEST, ""},
262 {SIG_CONTRACT_REQUEST, ""},
264 {SIG_UNREALIZED, ""},
265 {SIG_DRAG_START_UP, ""},
266 {SIG_DRAG_START_DOWN, ""},
267 {SIG_DRAG_START_LEFT, ""},
268 {SIG_DRAG_START_RIGHT, ""},
271 {SIG_LONGPRESSED, ""},
272 {SIG_SCROLL_ANIM_START, ""},
273 {SIG_SCROLL_ANIM_STOP, ""},
274 {SIG_SCROLL_DRAG_START, ""},
275 {SIG_SCROLL_DRAG_STOP, ""},
276 {SIG_SCROLL_EDGE_TOP, ""},
277 {SIG_SCROLL_EDGE_BOTTOM, ""},
278 {SIG_SCROLL_EDGE_LEFT, ""},
279 {SIG_SCROLL_EDGE_RIGHT, ""},
281 {SIG_EDGE_BOTTOM, ""},
283 {SIG_EDGE_RIGHT, ""},
284 {SIG_MULTI_SWIPE_LEFT, ""},
285 {SIG_MULTI_SWIPE_RIGHT, ""},
286 {SIG_MULTI_SWIPE_UP, ""},
287 {SIG_MULTI_SWIPE_DOWN, ""},
288 {SIG_MULTI_PINCH_OUT, ""},
289 {SIG_MULTI_PINCH_IN, ""},
295 static Eina_Compare_Cb _elm_genlist_item_compare_cb;
296 static Eina_Compare_Cb _elm_genlist_item_compare_data_cb;
299 _event_hook(Evas_Object *obj,
300 Evas_Object *src __UNUSED__,
301 Evas_Callback_Type type,
304 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
305 Evas_Event_Key_Down *ev = event_info;
306 Widget_Data *wd = elm_widget_data_get(obj);
307 Evas_Coord pan_max_x = 0, pan_max_y = 0;
308 if (!wd) return EINA_FALSE;
309 if (!wd->items) return EINA_FALSE;
310 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
311 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
313 Elm_Gen_Item *it = NULL;
316 Evas_Coord step_x = 0;
317 Evas_Coord step_y = 0;
320 Evas_Coord page_x = 0;
321 Evas_Coord page_y = 0;
323 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
324 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
325 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
326 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
328 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
332 else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")))
336 else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
338 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
339 (_item_multi_select_up(wd)))
340 || (_item_single_select_up(wd)))
342 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
348 else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
350 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
351 (_item_multi_select_down(wd)))
352 || (_item_single_select_down(wd)))
354 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
360 else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
362 it = elm_gen_first_item_get(obj);
363 elm_genlist_item_bring_in(it);
364 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
367 else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
369 it = elm_gen_last_item_get(obj);
370 elm_genlist_item_bring_in(it);
371 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
374 else if ((!strcmp(ev->keyname, "Prior")) || (!strcmp(ev->keyname, "KP_Prior")))
377 y -= -(page_y * v_h) / 100;
381 else if ((!strcmp(ev->keyname, "Next")) || (!strcmp(ev->keyname, "KP_Next")))
384 y += -(page_y * v_h) / 100;
388 else if (!strcmp(ev->keyname, "Escape"))
390 if (!_deselect_all_items(wd)) return EINA_FALSE;
391 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
394 else if (((!strcmp(ev->keyname, "Return")) ||
395 (!strcmp(ev->keyname, "KP_Enter")) ||
396 (!strcmp(ev->keyname, "space")))
397 && (!wd->multi) && (wd->selected))
399 it = elm_genlist_selected_item_get(obj);
400 elm_genlist_item_expanded_set(it,
401 !elm_genlist_item_expanded_get(it));
402 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
404 else return EINA_FALSE;
406 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
407 _pan_max_get(wd->pan_smart, &pan_max_x, &pan_max_y);
409 if (x > pan_max_x) x = pan_max_x;
411 if (y > pan_max_y) y = pan_max_y;
412 elm_smart_scroller_child_pos_set(wd->scr, x, y);
417 _deselect_all_items(Widget_Data *wd)
419 if (!wd->selected) return EINA_FALSE;
421 elm_gen_item_selected_set(wd->selected->data, EINA_FALSE);
427 _item_multi_select_up(Widget_Data *wd)
429 if (!wd->selected) return EINA_FALSE;
430 if (!wd->multi) return EINA_FALSE;
432 Elm_Gen_Item *prev = elm_gen_item_prev_get(wd->last_selected_item);
433 if (!prev) return EINA_TRUE;
435 if (elm_gen_item_selected_get(prev))
437 elm_gen_item_selected_set(wd->last_selected_item, EINA_FALSE);
438 wd->last_selected_item = prev;
439 elm_genlist_item_show(wd->last_selected_item);
443 elm_gen_item_selected_set(prev, EINA_TRUE);
444 elm_genlist_item_show(prev);
450 _item_multi_select_down(Widget_Data *wd)
452 if (!wd->selected) return EINA_FALSE;
453 if (!wd->multi) return EINA_FALSE;
455 Elm_Gen_Item *next = elm_gen_item_next_get(wd->last_selected_item);
456 if (!next) return EINA_TRUE;
458 if (elm_gen_item_selected_get(next))
460 elm_gen_item_selected_set(wd->last_selected_item, EINA_FALSE);
461 wd->last_selected_item = next;
462 elm_genlist_item_show(wd->last_selected_item);
466 elm_gen_item_selected_set(next, EINA_TRUE);
467 elm_genlist_item_show(next);
473 _item_single_select_up(Widget_Data *wd)
478 prev = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
479 while ((prev) && (prev->delete_me))
480 prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
482 else prev = elm_gen_item_prev_get(wd->last_selected_item);
484 if (!prev) return EINA_FALSE;
486 _deselect_all_items(wd);
488 elm_gen_item_selected_set(prev, EINA_TRUE);
489 elm_genlist_item_show(prev);
494 _item_single_select_down(Widget_Data *wd)
499 next = ELM_GEN_ITEM_FROM_INLIST(wd->items);
500 while ((next) && (next->delete_me))
501 next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
503 else next = elm_gen_item_next_get(wd->last_selected_item);
505 if (!next) return EINA_FALSE;
507 _deselect_all_items(wd);
509 elm_gen_item_selected_set(next, EINA_TRUE);
510 elm_genlist_item_show(next);
515 _on_focus_hook(void *data __UNUSED__,
518 Widget_Data *wd = elm_widget_data_get(obj);
520 if (elm_widget_focus_get(obj))
522 elm_object_signal_emit(wd->obj, "elm,action,focus", "elm");
523 evas_object_focus_set(wd->obj, EINA_TRUE);
524 if ((wd->selected) && (!wd->last_selected_item))
525 wd->last_selected_item = eina_list_data_get(wd->selected);
529 elm_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
530 evas_object_focus_set(wd->obj, EINA_FALSE);
535 _del_hook(Evas_Object *obj)
537 Widget_Data *wd = elm_widget_data_get(obj);
539 _item_cache_zero(wd);
540 if (wd->calc_job) ecore_job_del(wd->calc_job);
541 if (wd->update_job) ecore_job_del(wd->update_job);
542 if (wd->queue_idle_enterer) ecore_idle_enterer_del(wd->queue_idle_enterer);
543 if (wd->must_recalc_idler) ecore_idler_del(wd->must_recalc_idler);
544 if (wd->multi_timer) ecore_timer_del(wd->multi_timer);
545 if (wd->mode_type) eina_stringshare_del(wd->mode_type);
546 if (wd->scr_hold_timer) ecore_timer_del(wd->scr_hold_timer);
551 _del_pre_hook(Evas_Object *obj)
553 Widget_Data *wd = elm_widget_data_get(obj);
556 evas_object_del(wd->pan_smart);
557 wd->pan_smart = NULL;
561 _mirrored_set(Evas_Object *obj,
564 Widget_Data *wd = elm_widget_data_get(obj);
566 _item_cache_zero(wd);
567 elm_smart_scroller_mirrored_set(wd->scr, rtl);
571 _theme_hook(Evas_Object *obj)
573 Widget_Data *wd = elm_widget_data_get(obj);
576 evas_event_freeze(evas_object_evas_get(wd->obj));
577 _item_cache_zero(wd);
578 _elm_widget_mirrored_reload(obj);
579 _mirrored_set(obj, elm_widget_mirrored_get(obj));
580 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
581 elm_widget_style_get(obj));
582 edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
583 wd->item_width = wd->item_height = 0;
584 wd->group_item_width = wd->group_item_height = 0;
585 wd->minw = wd->minh = wd->realminw = 0;
586 EINA_INLIST_FOREACH(wd->blocks, itb)
591 if (itb->realized) _item_block_unrealize(itb);
592 EINA_LIST_FOREACH(itb->items, l, it)
593 it->item->mincalcd = EINA_FALSE;
595 itb->changed = EINA_TRUE;
597 if (wd->calc_job) ecore_job_del(wd->calc_job);
598 wd->calc_job = ecore_job_add(_calc_job, wd);
600 evas_event_thaw(evas_object_evas_get(wd->obj));
601 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
605 _show_region_hook(void *data,
608 Widget_Data *wd = elm_widget_data_get(data);
609 Evas_Coord x, y, w, h;
611 elm_widget_show_region_get(obj, &x, &y, &w, &h);
612 //x & y are screen coordinates, Add with pan coordinates
615 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
619 _translate_hook(Evas_Object *obj)
621 evas_object_smart_callback_call(obj, "language,changed", NULL);
625 _sizing_eval(Evas_Object *obj)
627 Widget_Data *wd = elm_widget_data_get(obj);
628 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
630 evas_object_size_hint_min_get(wd->scr, &minw, &minh);
631 evas_object_size_hint_max_get(wd->scr, &maxw, &maxh);
633 if (wd->height_for_width)
637 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
638 if ((vw != 0) && (vw != wd->prev_viewport_w))
642 wd->prev_viewport_w = vw;
643 EINA_INLIST_FOREACH(wd->blocks, itb)
645 itb->must_recalc = EINA_TRUE;
647 if (wd->calc_job) ecore_job_del(wd->calc_job);
648 wd->calc_job = ecore_job_add(_calc_job, wd);
651 if (wd->mode == ELM_LIST_LIMIT)
653 Evas_Coord vmw, vmh, vw, vh;
657 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
658 if ((minw > 0) && (vw < minw)) vw = minw;
659 else if ((maxw > 0) && (vw > maxw))
661 edje_object_size_min_calc
662 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
669 edje_object_size_min_calc
670 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
674 evas_object_size_hint_min_set(obj, minw, minh);
675 evas_object_size_hint_max_set(obj, maxw, maxh);
679 _signal_emit_hook(Evas_Object *obj,
680 const char *emission,
683 Widget_Data *wd = elm_widget_data_get(obj);
684 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
689 _item_highlight(Elm_Gen_Item *it)
691 const char *selectraise;
692 if ((it->wd->no_select) || (it->delete_me) || (it->highlighted) ||
693 (it->disabled) || (it->display_only) || (it->item->mode_view))
695 edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
696 selectraise = edje_object_data_get(VIEW(it), "selectraise");
697 if ((selectraise) && (!strcmp(selectraise, "on")))
699 evas_object_raise(VIEW(it));
700 if ((it->item->group_item) && (it->item->group_item->realized))
701 evas_object_raise(it->item->VIEW(group_item));
703 it->highlighted = EINA_TRUE;
707 _item_unhighlight(Elm_Gen_Item *it)
709 const char *stacking, *selectraise;
710 if ((it->delete_me) || (!it->highlighted)) return;
711 edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm");
712 stacking = edje_object_data_get(VIEW(it), "stacking");
713 selectraise = edje_object_data_get(VIEW(it), "selectraise");
714 if (!it->item->nostacking)
716 if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even) evas_object_lower(VIEW(it));
717 else evas_object_raise(VIEW(it));
719 it->highlighted = EINA_FALSE;
723 _item_block_del(Elm_Gen_Item *it)
726 Item_Block *itb = it->item->block;
728 itb->items = eina_list_remove(itb->items, it);
730 itb->changed = EINA_TRUE;
731 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
732 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
735 il = EINA_INLIST_GET(itb);
736 Item_Block *itbn = (Item_Block *)(il->next);
738 it->parent->item->items = eina_list_remove(it->parent->item->items, it);
740 it->wd->blocks = eina_inlist_remove(it->wd->blocks, il);
742 if (itbn) itbn->changed = EINA_TRUE;
746 if (itb->count < itb->wd->max_items_per_block/2)
748 il = EINA_INLIST_GET(itb);
749 Item_Block *itbp = (Item_Block *)(il->prev);
750 Item_Block *itbn = (Item_Block *)(il->next);
751 if ((itbp) && ((itbp->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
755 EINA_LIST_FREE(itb->items, it2)
757 it2->item->block = itbp;
758 itbp->items = eina_list_append(itbp->items, it2);
760 itbp->changed = EINA_TRUE;
762 it->wd->blocks = eina_inlist_remove(it->wd->blocks,
763 EINA_INLIST_GET(itb));
766 else if ((itbn) && ((itbn->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
770 Eina_List *last = eina_list_last(itb->items);
771 Elm_Gen_Item *it2 = last->data;
773 it2->item->block = itbn;
774 itb->items = eina_list_remove_list(itb->items, last);
775 itbn->items = eina_list_prepend(itbn->items, it2);
777 itbn->changed = EINA_TRUE;
780 eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb));
788 _item_del(Elm_Gen_Item *it)
790 Evas_Object *obj = WIDGET(it);
792 evas_event_freeze(evas_object_evas_get(obj));
793 elm_genlist_item_subitems_clear(it);
794 if (it->wd->show_item == it) it->wd->show_item = NULL;
795 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE);
796 if (it->item->block) _item_block_del(it);
797 if (it->item->queued)
798 it->wd->queue = eina_list_remove(it->wd->queue, it);
799 if (it->wd->anchor_item == it)
801 it->wd->anchor_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
802 if (!it->wd->anchor_item)
803 it->wd->anchor_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
806 it->parent->item->items = eina_list_remove(it->parent->item->items, it);
807 if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
808 elm_gen_item_del_serious(it);
809 evas_event_thaw(evas_object_evas_get(obj));
810 evas_event_thaw_eval(evas_object_evas_get(obj));
814 _clear_cb(Widget_Data *wd)
816 wd->anchor_item = NULL;
819 Item_Block *itb = (Item_Block *)(wd->blocks);
821 wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
822 if (itb->items) eina_list_free(itb->items);
825 if (wd->queue_idle_enterer)
827 ecore_idle_enterer_del(wd->queue_idle_enterer);
828 wd->queue_idle_enterer = NULL;
830 if (wd->must_recalc_idler)
832 ecore_idler_del(wd->must_recalc_idler);
833 wd->must_recalc_idler = NULL;
835 if (wd->queue) wd->queue = eina_list_free(wd->queue);
836 if (wd->reorder_move_animator)
838 ecore_animator_del(wd->reorder_move_animator);
839 wd->reorder_move_animator = NULL;
841 wd->show_item = NULL;
842 wd->reorder_old_pan_y = 0;
846 _item_unselect(Elm_Gen_Item *it)
848 if ((it->delete_me) || (!it->selected)) return;
849 it->selected = EINA_FALSE;
850 it->wd->selected = eina_list_remove(it->wd->selected, it);
851 evas_object_smart_callback_call(WIDGET(it), SIG_UNSELECTED, it);
855 _mouse_move(void *data,
856 Evas *evas __UNUSED__,
860 Elm_Gen_Item *it = data;
861 Evas_Event_Mouse_Move *ev = event_info;
862 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
863 Evas_Coord ox, oy, ow, oh, it_scrl_y, y_pos;
865 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
867 if (!it->wd->on_hold)
869 it->wd->on_hold = EINA_TRUE;
870 if (!it->wd->wasselected)
872 _item_unhighlight(it);
877 if (it->wd->multitouched)
879 it->wd->cur_x = ev->cur.canvas.x;
880 it->wd->cur_y = ev->cur.canvas.y;
883 if ((it->dragging) && (it->down))
885 if (it->wd->movements == SWIPE_MOVES) it->wd->swipe = EINA_TRUE;
888 it->wd->history[it->wd->movements].x = ev->cur.canvas.x;
889 it->wd->history[it->wd->movements].y = ev->cur.canvas.y;
890 if (abs((it->wd->history[it->wd->movements].x -
891 it->wd->history[0].x)) > 40)
892 it->wd->swipe = EINA_TRUE;
898 ecore_timer_del(it->long_timer);
899 it->long_timer = NULL;
901 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG, it);
904 if ((!it->down) /* || (it->wd->on_hold)*/ || (it->wd->longpressed))
908 ecore_timer_del(it->long_timer);
909 it->long_timer = NULL;
911 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
913 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
914 it_scrl_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
916 if (!it->wd->reorder_start_y)
917 it->wd->reorder_start_y = it->item->block->y + it->y;
921 else if (it_scrl_y + it->wd->reorder_it->item->h > oy + oh)
922 y_pos = oy + oh - it->wd->reorder_it->item->h;
926 _item_position(it, VIEW(it), it->item->scrl_x, y_pos);
928 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
929 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
933 if (!it->display_only)
934 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
935 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
936 x = ev->cur.canvas.x - x;
937 y = ev->cur.canvas.y - y;
940 if (adx < 0) adx = -dx;
943 if (ady < 0) ady = -dy;
946 if ((adx > minw) || (ady > minh))
948 it->dragging = EINA_TRUE;
951 ecore_timer_del(it->long_timer);
952 it->long_timer = NULL;
954 if (!it->wd->wasselected)
956 _item_unhighlight(it);
962 evas_object_smart_callback_call(WIDGET(it),
963 SIG_DRAG_START_UP, it);
967 evas_object_smart_callback_call(WIDGET(it),
968 SIG_DRAG_START_LEFT, it);
970 evas_object_smart_callback_call(WIDGET(it),
971 SIG_DRAG_START_RIGHT, it);
977 evas_object_smart_callback_call(WIDGET(it),
978 SIG_DRAG_START_DOWN, it);
982 evas_object_smart_callback_call(WIDGET(it),
983 SIG_DRAG_START_LEFT, it);
985 evas_object_smart_callback_call(WIDGET(it),
986 SIG_DRAG_START_RIGHT, it);
993 _long_press(void *data)
995 Elm_Gen_Item *it = data, *it_tmp;
998 it->long_timer = NULL;
999 if ((it->disabled) || (it->dragging) || (it->display_only))
1000 return ECORE_CALLBACK_CANCEL;
1001 it->wd->longpressed = EINA_TRUE;
1002 evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it);
1003 if ((it->wd->reorder_mode) && (it->item->flags != ELM_GENLIST_ITEM_GROUP))
1005 it->wd->reorder_it = it;
1006 it->wd->reorder_start_y = 0;
1008 evas_object_raise(VIEW(it));
1009 elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
1010 elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_FALSE);
1012 list = elm_genlist_realized_items_get(it->wd->obj);
1013 EINA_LIST_FOREACH(list, l, it_tmp)
1015 if (it != it_tmp) _item_unselect(it_tmp);
1017 if (elm_genlist_item_expanded_get(it))
1019 elm_genlist_item_expanded_set(it, EINA_FALSE);
1020 return ECORE_CALLBACK_RENEW;
1022 edje_object_signal_emit(VIEW(it), "elm,state,reorder,enabled", "elm");
1024 return ECORE_CALLBACK_CANCEL;
1028 _swipe(Elm_Gen_Item *it)
1033 if ((it->display_only) || (it->disabled)) return;
1034 it->wd->swipe = EINA_FALSE;
1035 for (i = 0; i < it->wd->movements; i++)
1037 sum += it->wd->history[i].x;
1038 if (abs(it->wd->history[0].y - it->wd->history[i].y) > 10) return;
1041 sum /= it->wd->movements;
1042 if (abs(sum - it->wd->history[0].x) <= 10) return;
1043 evas_object_smart_callback_call(WIDGET(it), SIG_SWIPE, it);
1047 _swipe_cancel(void *data)
1049 Elm_Gen_Item *it = data;
1051 if (!it) return ECORE_CALLBACK_CANCEL;
1052 it->wd->swipe = EINA_FALSE;
1053 it->wd->movements = 0;
1054 return ECORE_CALLBACK_RENEW;
1058 _multi_cancel(void *data)
1060 Widget_Data *wd = data;
1062 if (!wd) return ECORE_CALLBACK_CANCEL;
1063 wd->multi_timeout = EINA_TRUE;
1064 return ECORE_CALLBACK_RENEW;
1068 _multi_touch_gesture_eval(void *data)
1070 Elm_Gen_Item *it = data;
1072 it->wd->multitouched = EINA_FALSE;
1073 if (it->wd->multi_timer)
1075 ecore_timer_del(it->wd->multi_timer);
1076 it->wd->multi_timer = NULL;
1078 if (it->wd->multi_timeout)
1080 it->wd->multi_timeout = EINA_FALSE;
1084 Evas_Coord minw = 0, minh = 0;
1085 Evas_Coord off_x, off_y, off_mx, off_my;
1087 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1088 off_x = abs(it->wd->cur_x - it->wd->prev_x);
1089 off_y = abs(it->wd->cur_y - it->wd->prev_y);
1090 off_mx = abs(it->wd->cur_mx - it->wd->prev_mx);
1091 off_my = abs(it->wd->cur_my - it->wd->prev_my);
1093 if (((off_x > minw) || (off_y > minh)) && ((off_mx > minw) || (off_my > minh)))
1095 if ((off_x + off_mx) > (off_y + off_my))
1097 if ((it->wd->cur_x > it->wd->prev_x) && (it->wd->cur_mx > it->wd->prev_mx))
1098 evas_object_smart_callback_call(WIDGET(it),
1099 SIG_MULTI_SWIPE_RIGHT, it);
1100 else if ((it->wd->cur_x < it->wd->prev_x) && (it->wd->cur_mx < it->wd->prev_mx))
1101 evas_object_smart_callback_call(WIDGET(it),
1102 SIG_MULTI_SWIPE_LEFT, it);
1103 else if (abs(it->wd->cur_x - it->wd->cur_mx) > abs(it->wd->prev_x - it->wd->prev_mx))
1104 evas_object_smart_callback_call(WIDGET(it),
1105 SIG_MULTI_PINCH_OUT, it);
1107 evas_object_smart_callback_call(WIDGET(it),
1108 SIG_MULTI_PINCH_IN, it);
1112 if ((it->wd->cur_y > it->wd->prev_y) && (it->wd->cur_my > it->wd->prev_my))
1113 evas_object_smart_callback_call(WIDGET(it),
1114 SIG_MULTI_SWIPE_DOWN, it);
1115 else if ((it->wd->cur_y < it->wd->prev_y) && (it->wd->cur_my < it->wd->prev_my))
1116 evas_object_smart_callback_call(WIDGET(it),
1117 SIG_MULTI_SWIPE_UP, it);
1118 else if (abs(it->wd->cur_y - it->wd->cur_my) > abs(it->wd->prev_y - it->wd->prev_my))
1119 evas_object_smart_callback_call(WIDGET(it),
1120 SIG_MULTI_PINCH_OUT, it);
1122 evas_object_smart_callback_call(WIDGET(it),
1123 SIG_MULTI_PINCH_IN, it);
1126 it->wd->multi_timeout = EINA_FALSE;
1130 _multi_down(void *data,
1131 Evas *evas __UNUSED__,
1132 Evas_Object *obj __UNUSED__,
1135 Elm_Gen_Item *it = data;
1136 Evas_Event_Multi_Down *ev = event_info;
1138 if ((it->wd->multi_device != 0) || (it->wd->multitouched) || (it->wd->multi_timeout)) return;
1139 it->wd->multi_device = ev->device;
1140 it->wd->multi_down = EINA_TRUE;
1141 it->wd->multitouched = EINA_TRUE;
1142 it->wd->prev_mx = ev->canvas.x;
1143 it->wd->prev_my = ev->canvas.y;
1144 if (!it->wd->wasselected)
1146 _item_unhighlight(it);
1149 it->wd->wasselected = EINA_FALSE;
1150 it->wd->longpressed = EINA_FALSE;
1153 ecore_timer_del(it->long_timer);
1154 it->long_timer = NULL;
1158 it->dragging = EINA_FALSE;
1159 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
1161 if (it->item->swipe_timer)
1163 ecore_timer_del(it->item->swipe_timer);
1164 it->item->swipe_timer = NULL;
1166 if (it->wd->on_hold)
1168 it->wd->swipe = EINA_FALSE;
1169 it->wd->movements = 0;
1170 it->wd->on_hold = EINA_FALSE;
1175 _multi_up(void *data,
1176 Evas *evas __UNUSED__,
1177 Evas_Object *obj __UNUSED__,
1180 Elm_Gen_Item *it = data;
1181 Evas_Event_Multi_Up *ev = event_info;
1183 if (it->wd->multi_device != ev->device) return;
1184 it->wd->multi_device = 0;
1185 it->wd->multi_down = EINA_FALSE;
1186 if (it->wd->mouse_down) return;
1187 _multi_touch_gesture_eval(data);
1191 _multi_move(void *data,
1192 Evas *evas __UNUSED__,
1193 Evas_Object *obj __UNUSED__,
1196 Elm_Gen_Item *it = data;
1197 Evas_Event_Multi_Move *ev = event_info;
1199 if (it->wd->multi_device != ev->device) return;
1200 it->wd->cur_mx = ev->cur.canvas.x;
1201 it->wd->cur_my = ev->cur.canvas.y;
1205 _mouse_down(void *data,
1206 Evas *evas __UNUSED__,
1210 Elm_Gen_Item *it = data;
1211 Evas_Event_Mouse_Down *ev = event_info;
1214 if (ev->button != 1) return;
1215 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1217 it->wd->on_hold = EINA_TRUE;
1220 it->down = EINA_TRUE;
1221 it->dragging = EINA_FALSE;
1222 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1223 it->dx = ev->canvas.x - x;
1224 it->dy = ev->canvas.y - y;
1225 it->wd->mouse_down = EINA_TRUE;
1226 if (!it->wd->multitouched)
1228 it->wd->prev_x = ev->canvas.x;
1229 it->wd->prev_y = ev->canvas.y;
1230 it->wd->multi_timeout = EINA_FALSE;
1231 if (it->wd->multi_timer) ecore_timer_del(it->wd->multi_timer);
1232 it->wd->multi_timer = ecore_timer_add(1, _multi_cancel, it->wd);
1234 it->wd->longpressed = EINA_FALSE;
1235 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1236 else it->wd->on_hold = EINA_FALSE;
1237 if (it->wd->on_hold) return;
1238 it->wd->wasselected = it->selected;
1239 _item_highlight(it);
1240 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
1241 if ((!it->disabled) && (!it->display_only))
1243 evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
1244 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
1246 if (it->long_timer) ecore_timer_del(it->long_timer);
1247 if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
1248 it->item->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
1250 it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press,
1253 it->long_timer = NULL;
1254 it->wd->swipe = EINA_FALSE;
1255 it->wd->movements = 0;
1259 _mouse_up(void *data,
1260 Evas *evas __UNUSED__,
1261 Evas_Object *obj __UNUSED__,
1264 Elm_Gen_Item *it = data;
1265 Evas_Event_Mouse_Up *ev = event_info;
1266 Eina_Bool dragged = EINA_FALSE;
1268 if (ev->button != 1) return;
1269 it->down = EINA_FALSE;
1270 it->wd->mouse_down = EINA_FALSE;
1271 if (it->wd->multitouched)
1273 if ((!it->wd->multi) && (!it->selected) && (it->highlighted)) _item_unhighlight(it);
1274 if (it->wd->multi_down) return;
1275 _multi_touch_gesture_eval(data);
1278 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1279 else it->wd->on_hold = EINA_FALSE;
1282 ecore_timer_del(it->long_timer);
1283 it->long_timer = NULL;
1287 it->dragging = EINA_FALSE;
1288 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
1291 if (it->item->swipe_timer)
1293 ecore_timer_del(it->item->swipe_timer);
1294 it->item->swipe_timer = NULL;
1296 if (it->wd->multi_timer)
1298 ecore_timer_del(it->wd->multi_timer);
1299 it->wd->multi_timer = NULL;
1300 it->wd->multi_timeout = EINA_FALSE;
1302 if (it->wd->on_hold)
1304 if (it->wd->swipe) _swipe(data);
1305 it->wd->longpressed = EINA_FALSE;
1306 it->wd->on_hold = EINA_FALSE;
1309 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
1311 Evas_Coord it_scrl_y = ev->canvas.y - it->wd->reorder_it->dy;
1313 if (it->wd->reorder_rel && (it->wd->reorder_it->parent == it->wd->reorder_rel->parent))
1315 if (it_scrl_y <= it->wd->reorder_rel->item->scrl_y)
1316 _item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
1318 _item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
1322 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1323 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1325 edje_object_signal_emit(VIEW(it), "elm,state,reorder,disabled", "elm");
1326 it->wd->reorder_it = it->wd->reorder_rel = NULL;
1327 elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
1328 elm_smart_scroller_bounce_allow_set(it->wd->scr, it->wd->h_bounce, it->wd->v_bounce);
1330 if (it->wd->longpressed)
1332 it->wd->longpressed = EINA_FALSE;
1333 if (!it->wd->wasselected)
1335 _item_unhighlight(it);
1338 it->wd->wasselected = EINA_FALSE;
1343 if (it->want_unrealize)
1345 elm_gen_item_unrealize(it, EINA_FALSE);
1346 if (it->item->block->want_unrealize)
1347 _item_block_unrealize(it->item->block);
1350 if ((it->disabled) || (dragged) || (it->display_only)) return;
1351 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1356 _item_highlight(it);
1361 _item_unhighlight(it);
1369 Widget_Data *wd = it->wd;
1372 while (wd->selected)
1374 _item_unhighlight(wd->selected->data);
1375 _item_unselect(wd->selected->data);
1381 const Eina_List *l, *l_next;
1384 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
1387 _item_unhighlight(it2);
1388 _item_unselect(it2);
1390 //_item_highlight(it);
1393 _item_highlight(it);
1399 _signal_expand_toggle(void *data,
1400 Evas_Object *obj __UNUSED__,
1401 const char *emission __UNUSED__,
1402 const char *source __UNUSED__)
1404 Elm_Gen_Item *it = data;
1406 if (it->item->expanded)
1407 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it);
1409 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it);
1413 _signal_expand(void *data,
1414 Evas_Object *obj __UNUSED__,
1415 const char *emission __UNUSED__,
1416 const char *source __UNUSED__)
1418 Elm_Gen_Item *it = data;
1420 if (!it->item->expanded)
1421 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it);
1425 _signal_contract(void *data,
1426 Evas_Object *obj __UNUSED__,
1427 const char *emission __UNUSED__,
1428 const char *source __UNUSED__)
1430 Elm_Gen_Item *it = data;
1432 if (it->item->expanded)
1433 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it);
1437 _scr_hold_timer_cb(void *data)
1439 if (!data) return ECORE_CALLBACK_CANCEL;
1440 Widget_Data *wd = data;
1441 elm_smart_scroller_hold_set(wd->scr, EINA_FALSE);
1442 wd->scr_hold_timer = NULL;
1443 return ECORE_CALLBACK_CANCEL;
1447 _mode_finished_signal_cb(void *data,
1449 const char *emission __UNUSED__,
1450 const char *source __UNUSED__)
1454 Elm_Gen_Item *it = data;
1455 if ((it->delete_me) || (!it->realized) || (!it->item->mode_view)) return;
1457 Evas *te = evas_object_evas_get(obj);
1459 evas_event_freeze(te);
1460 it->item->nocache = EINA_FALSE;
1461 _mode_item_unrealize(it);
1462 if (it->item->group_item)
1463 evas_object_raise(it->item->VIEW(group_item));
1464 snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished", it->wd->mode_type);
1465 edje_object_signal_callback_del_full(obj, buf, "elm", _mode_finished_signal_cb, it);
1466 evas_event_thaw(te);
1467 evas_event_thaw_eval(te);
1471 _item_cache_clean(Widget_Data *wd)
1473 evas_event_freeze(evas_object_evas_get(wd->obj));
1474 while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max))
1478 itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache);
1479 wd->item_cache = eina_inlist_remove(wd->item_cache,
1480 wd->item_cache->last);
1481 wd->item_cache_count--;
1482 if (itc->spacer) evas_object_del(itc->spacer);
1483 if (itc->base_view) evas_object_del(itc->base_view);
1484 if (itc->item_style) eina_stringshare_del(itc->item_style);
1487 evas_event_thaw(evas_object_evas_get(wd->obj));
1488 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
1492 _item_cache_zero(Widget_Data *wd)
1494 int pmax = wd->item_cache_max;
1495 wd->item_cache_max = 0;
1496 _item_cache_clean(wd);
1497 wd->item_cache_max = pmax;
1501 _item_cache_add(Elm_Gen_Item *it)
1505 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1506 if (it->wd->item_cache_max <= 0)
1508 evas_object_del(VIEW(it));
1510 evas_object_del(it->spacer);
1512 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1513 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1517 it->wd->item_cache_count++;
1518 itc = calloc(1, sizeof(Item_Cache));
1519 it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache,
1520 EINA_INLIST_GET(itc));
1521 itc->spacer = it->spacer;
1523 itc->base_view = VIEW(it);
1525 evas_object_hide(itc->base_view);
1526 evas_object_move(itc->base_view, -9999, -9999);
1527 itc->item_style = eina_stringshare_add(it->itc->item_style);
1528 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
1529 itc->compress = (it->wd->compress);
1530 itc->selected = it->selected;
1531 itc->disabled = it->disabled;
1532 itc->expanded = it->item->expanded;
1535 ecore_timer_del(it->long_timer);
1536 it->long_timer = NULL;
1538 if (it->item->swipe_timer)
1540 ecore_timer_del(it->item->swipe_timer);
1541 it->item->swipe_timer = NULL;
1543 // FIXME: other callbacks?
1544 edje_object_signal_callback_del_full(itc->base_view,
1545 "elm,action,expand,toggle",
1546 "elm", _signal_expand_toggle, it);
1547 edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand",
1549 _signal_expand, it);
1550 edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract",
1551 "elm", _signal_contract, it);
1552 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_DOWN,
1554 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP,
1556 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_MOVE,
1558 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_DOWN,
1560 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_UP,
1562 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_MOVE,
1564 _item_cache_clean(it->wd);
1565 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1566 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1570 _item_cache_find(Elm_Gen_Item *it)
1575 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
1576 EINA_INLIST_FOREACH(it->wd->item_cache, itc)
1578 if ((itc->selected) || (itc->disabled) || (itc->expanded))
1580 if ((itc->tree == tree) &&
1581 (itc->compress == it->wd->compress) &&
1582 (!strcmp(it->itc->item_style, itc->item_style)))
1584 it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
1585 EINA_INLIST_GET(itc));
1586 it->wd->item_cache_count--;
1594 _elm_genlist_item_odd_even_update(Elm_Gen_Item *it)
1596 if (!it->item->nostacking)
1598 if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even)
1599 evas_object_lower(VIEW(it));
1601 evas_object_raise(VIEW(it));
1604 if (it->item->order_num_in & 0x1)
1605 edje_object_signal_emit(VIEW(it), "elm,state,odd", "elm");
1607 edje_object_signal_emit(VIEW(it), "elm,state,even", "elm");
1611 _elm_genlist_item_state_update(Elm_Gen_Item *it, Item_Cache *itc)
1615 if (it->selected != itc->selected)
1618 edje_object_signal_emit(VIEW(it),
1619 "elm,state,selected", "elm");
1621 if (it->disabled != itc->disabled)
1624 edje_object_signal_emit(VIEW(it),
1625 "elm,state,disabled", "elm");
1627 if (it->item->expanded != itc->expanded)
1629 if (it->item->expanded)
1630 edje_object_signal_emit(VIEW(it),
1631 "elm,state,expanded", "elm");
1637 edje_object_signal_emit(VIEW(it),
1638 "elm,state,selected", "elm");
1640 edje_object_signal_emit(VIEW(it),
1641 "elm,state,disabled", "elm");
1642 if (it->item->expanded)
1643 edje_object_signal_emit(VIEW(it),
1644 "elm,state,expanded", "elm");
1649 _item_cache_free(Item_Cache *itc)
1651 if (itc->spacer) evas_object_del(itc->spacer);
1652 if (itc->base_view) evas_object_del(itc->base_view);
1653 if (itc->item_style) eina_stringshare_del(itc->item_style);
1658 _item_del_hook(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1660 Elm_Gen_Item *it = event_info;
1662 if (it->wd->last_selected_item == it)
1663 it->wd->last_selected_item = NULL;
1667 _item_label_realize(Elm_Gen_Item *it,
1668 Evas_Object *target,
1671 if (it->itc->func.label_get)
1676 *source = elm_widget_stringlist_get(edje_object_data_get(target, "labels"));
1677 EINA_LIST_FOREACH(*source, l, key)
1679 char *s = it->itc->func.label_get
1680 ((void *)it->base.data, WIDGET(it), key);
1684 edje_object_part_text_set(target, key, s);
1689 edje_object_part_text_set(target, key, "");
1696 _item_icon_realize(Elm_Gen_Item *it,
1697 Evas_Object *target,
1700 Eina_List *res = NULL;
1702 if (it->itc->func.icon_get)
1707 *source = elm_widget_stringlist_get(edje_object_data_get(target, "icons"));
1708 EINA_LIST_FOREACH(*source, l, key)
1710 Evas_Object *ic = it->itc->func.icon_get
1711 ((void *)it->base.data, WIDGET(it), key);
1715 res = eina_list_append(res, ic);
1716 edje_object_part_swallow(target, key, ic);
1717 evas_object_show(ic);
1718 elm_widget_sub_object_add(WIDGET(it), ic);
1720 elm_widget_disabled_set(ic, EINA_TRUE);
1729 _item_state_realize(Elm_Gen_Item *it,
1730 Evas_Object *target,
1733 if (it->itc->func.state_get)
1739 *source = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
1740 EINA_LIST_FOREACH(*source, l, key)
1742 Eina_Bool on = it->itc->func.state_get
1743 ((void *)it->base.data, WIDGET(it), key);
1747 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
1748 edje_object_signal_emit(target, buf, "elm");
1752 snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
1753 edje_object_signal_emit(target, buf, "elm");
1760 _item_realize(Elm_Gen_Item *it,
1765 const char *treesize;
1767 int depth, tsize = 20;
1768 Item_Cache *itc = NULL;
1770 if (it->delete_me) return;
1771 //evas_event_freeze(evas_object_evas_get(it->wd->obj));
1774 if (it->item->order_num_in != in)
1776 it->item->order_num_in = in;
1777 _elm_genlist_item_odd_even_update(it);
1778 _elm_genlist_item_state_update(it, NULL);
1780 //evas_event_thaw(evas_object_evas_get(it->wd->obj));
1781 //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1784 it->item->order_num_in = in;
1786 if (it->item->nocache)
1787 it->item->nocache = EINA_FALSE;
1789 itc = _item_cache_find(it);
1792 VIEW(it) = itc->base_view;
1793 itc->base_view = NULL;
1794 it->spacer = itc->spacer;
1799 const char *stacking_even;
1800 const char *stacking;
1802 VIEW(it) = edje_object_add(evas_object_evas_get(WIDGET(it)));
1803 edje_object_scale_set(VIEW(it),
1804 elm_widget_scale_get(WIDGET(it)) *
1805 _elm_config->scale);
1806 evas_object_smart_member_add(VIEW(it), it->wd->pan_smart);
1807 elm_widget_sub_object_add(WIDGET(it), VIEW(it));
1809 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS)
1810 strncpy(buf, "tree", sizeof(buf));
1811 else strncpy(buf, "item", sizeof(buf));
1812 if (it->wd->compress)
1813 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
1815 strncat(buf, "/", sizeof(buf) - strlen(buf));
1816 strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf));
1818 _elm_theme_object_set(WIDGET(it), VIEW(it), "genlist", buf,
1819 elm_widget_style_get(WIDGET(it)));
1821 stacking_even = edje_object_data_get(VIEW(it), "stacking_even");
1822 if (!stacking_even) stacking_even = "above";
1823 it->item->stacking_even = !!strcmp("above", stacking_even);
1825 stacking = edje_object_data_get(VIEW(it), "stacking");
1826 if (!stacking) stacking = "yes";
1827 it->item->nostacking = !!strcmp("yes", stacking);
1829 edje_object_mirrored_set(VIEW(it),
1830 elm_widget_mirrored_get(WIDGET(it)));
1832 evas_object_rectangle_add(evas_object_evas_get(WIDGET(it)));
1833 evas_object_color_set(it->spacer, 0, 0, 0, 0);
1834 elm_widget_sub_object_add(WIDGET(it), it->spacer);
1837 _elm_genlist_item_odd_even_update(it);
1839 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
1841 if (it2->parent->item->flags != ELM_GENLIST_ITEM_GROUP) depth += 1;
1843 it->item->expanded_depth = depth;
1844 treesize = edje_object_data_get(VIEW(it), "treesize");
1845 if (treesize) tsize = atoi(treesize);
1846 evas_object_size_hint_min_set(it->spacer,
1847 (depth * tsize) * _elm_config->scale, 1);
1848 edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer);
1851 edje_object_signal_callback_add(VIEW(it),
1852 "elm,action,expand,toggle",
1853 "elm", _signal_expand_toggle, it);
1854 edje_object_signal_callback_add(VIEW(it), "elm,action,expand",
1855 "elm", _signal_expand, it);
1856 edje_object_signal_callback_add(VIEW(it), "elm,action,contract",
1857 "elm", _signal_contract, it);
1858 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN,
1860 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_UP,
1862 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
1864 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_DOWN,
1866 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_UP,
1868 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_MOVE,
1871 _elm_genlist_item_state_update(it, itc);
1874 if ((calc) && (it->wd->homogeneous) &&
1875 ((it->wd->item_width) ||
1876 ((it->wd->item_width) && (it->wd->group_item_width))))
1878 /* homogenous genlist shortcut */
1879 if (!it->item->mincalcd)
1881 if (it->item->flags & ELM_GENLIST_ITEM_GROUP)
1883 it->item->w = it->item->minw = it->wd->group_item_width;
1884 it->item->h = it->item->minh = it->wd->group_item_height;
1888 it->item->w = it->item->minw = it->wd->item_width;
1889 it->item->h = it->item->minh = it->wd->item_height;
1891 it->item->mincalcd = EINA_TRUE;
1896 /* FIXME: If you see that assert, please notify us and we
1897 will clean our mess */
1898 assert(eina_list_count(it->icon_objs) == 0);
1900 _item_label_realize(it, VIEW(it), &it->labels);
1901 it->icon_objs = _item_icon_realize(it, VIEW(it), &it->icons);
1902 _item_state_realize(it, VIEW(it), &it->states);
1904 if (!it->item->mincalcd)
1906 Evas_Coord mw = -1, mh = -1;
1908 if (!it->display_only)
1909 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1910 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
1911 edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw,
1913 if (!it->display_only)
1914 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1915 it->item->w = it->item->minw = mw;
1916 it->item->h = it->item->minh = mh;
1917 it->item->mincalcd = EINA_TRUE;
1919 if ((!it->wd->group_item_width) && (it->item->flags == ELM_GENLIST_ITEM_GROUP))
1921 it->wd->group_item_width = mw;
1922 it->wd->group_item_height = mh;
1924 else if ((!it->wd->item_width) && (it->item->flags == ELM_GENLIST_ITEM_NONE))
1926 it->wd->item_width = mw;
1927 it->wd->item_height = mh;
1930 if (!calc) evas_object_show(VIEW(it));
1933 if (it->tooltip.content_cb)
1935 elm_widget_item_tooltip_content_cb_set(it,
1936 it->tooltip.content_cb,
1937 it->tooltip.data, NULL);
1938 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
1939 elm_widget_item_tooltip_size_restrict_disable(it, it->tooltip.free_size);
1942 if (it->mouse_cursor)
1943 elm_widget_item_cursor_set(it, it->mouse_cursor);
1945 it->realized = EINA_TRUE;
1946 it->want_unrealize = EINA_FALSE;
1948 if (itc) _item_cache_free(itc);
1949 //evas_event_thaw(evas_object_evas_get(it->wd->obj));
1950 //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1952 evas_object_smart_callback_call(WIDGET(it), SIG_REALIZED, it);
1953 edje_object_message_signal_process(VIEW(it));
1957 _item_unrealize_cb(Elm_Gen_Item *it)
1959 if (it->item->nocache)
1961 evas_object_del(VIEW(it));
1963 evas_object_del(it->spacer);
1968 edje_object_mirrored_set(VIEW(it),
1969 elm_widget_mirrored_get(WIDGET(it)));
1970 edje_object_scale_set(VIEW(it),
1971 elm_widget_scale_get(WIDGET(it))
1972 * _elm_config->scale);
1973 _item_cache_add(it);
1976 _mode_item_unrealize(it);
1978 it->realized = EINA_FALSE;
1979 it->want_unrealize = EINA_FALSE;
1983 _item_block_recalc(Item_Block *itb,
1989 Evas_Coord minw = 0, minh = 0;
1990 Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE;
1993 //evas_event_freeze(evas_object_evas_get(itb->wd->obj));
1995 EINA_LIST_FOREACH(itb->items, l, it)
1997 if (it->delete_me) continue;
1998 showme |= it->item->showme;
2003 if (!it->item->mincalcd) changed = EINA_TRUE;
2006 _item_realize(it, in, EINA_TRUE);
2007 elm_gen_item_unrealize(it, EINA_TRUE);
2012 _item_realize(it, in, EINA_TRUE);
2013 elm_gen_item_unrealize(it, EINA_TRUE);
2017 _item_realize(it, in, EINA_FALSE);
2018 minh += it->item->minh;
2019 if (minw < it->item->minw) minw = it->item->minw;
2027 itb->changed = EINA_FALSE;
2028 //evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2029 //evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2034 _item_block_realize(Item_Block *itb)
2036 if (itb->realized) return;
2037 itb->realized = EINA_TRUE;
2038 itb->want_unrealize = EINA_FALSE;
2042 _item_block_unrealize(Item_Block *itb)
2046 Eina_Bool dragging = EINA_FALSE;
2048 if (!itb->realized) return;
2049 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2050 EINA_LIST_FOREACH(itb->items, l, it)
2052 if (it->item->flags != ELM_GENLIST_ITEM_GROUP)
2056 dragging = EINA_TRUE;
2057 it->want_unrealize = EINA_TRUE;
2060 elm_gen_item_unrealize(it, EINA_FALSE);
2065 itb->realized = EINA_FALSE;
2066 itb->want_unrealize = EINA_TRUE;
2069 itb->want_unrealize = EINA_FALSE;
2070 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2071 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2075 _get_space_for_reorder_item(Elm_Gen_Item *it)
2077 Evas_Coord rox, roy, row, roh, oy, oh;
2078 Eina_Bool top = EINA_FALSE;
2079 Elm_Gen_Item *reorder_it = it->wd->reorder_it;
2080 if (!reorder_it) return 0;
2082 evas_object_geometry_get(it->wd->pan_smart, NULL, &oy, NULL, &oh);
2083 evas_object_geometry_get(it->wd->VIEW(reorder_it), &rox, &roy, &row, &roh);
2085 if ((it->wd->reorder_start_y < it->item->block->y) &&
2086 (roy - oy + (roh / 2) >= it->item->block->y - it->wd->pan_y))
2088 it->item->block->reorder_offset = it->wd->reorder_it->item->h * -1;
2089 if (it->item->block->count == 1)
2090 it->wd->reorder_rel = it;
2092 else if ((it->wd->reorder_start_y >= it->item->block->y) &&
2093 (roy - oy + (roh / 2) <= it->item->block->y - it->wd->pan_y))
2095 it->item->block->reorder_offset = it->wd->reorder_it->item->h;
2098 it->item->block->reorder_offset = 0;
2100 it->item->scrl_y += it->item->block->reorder_offset;
2102 top = (ELM_RECTS_INTERSECT(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h,
2103 rox, roy + (roh / 2), row, 1));
2106 it->wd->reorder_rel = it;
2107 it->item->scrl_y += it->wd->reorder_it->item->h;
2108 return it->wd->reorder_it->item->h;
2115 _reorder_move_animator_cb(void *data)
2117 Elm_Gen_Item *it = data;
2118 Eina_Bool down = EINA_FALSE;
2120 int y, dy = it->item->h / 10 * _elm_config->scale, diff;
2122 t = ((0.0 > (t = ecore_loop_time_get()-it->wd->start_time)) ? 0.0 : t);
2124 if (t <= REORDER_EFFECT_TIME) y = (1 * sin((t / REORDER_EFFECT_TIME) * (M_PI / 2)) * dy);
2127 diff = abs(it->item->old_scrl_y - it->item->scrl_y);
2128 if (diff > it->item->h) y = diff / 2;
2130 if (it->item->old_scrl_y < it->item->scrl_y)
2132 it->item->old_scrl_y += y;
2135 else if (it->item->old_scrl_y > it->item->scrl_y)
2137 it->item->old_scrl_y -= y;
2140 _item_position(it, VIEW(it), it->item->scrl_x, it->item->old_scrl_y);
2141 _group_items_recalc(it->wd);
2143 if ((it->wd->reorder_pan_move) ||
2144 (down && it->item->old_scrl_y >= it->item->scrl_y) ||
2145 (!down && it->item->old_scrl_y <= it->item->scrl_y))
2147 it->item->old_scrl_y = it->item->scrl_y;
2148 it->item->move_effect_enabled = EINA_FALSE;
2149 it->wd->reorder_move_animator = NULL;
2150 return ECORE_CALLBACK_CANCEL;
2152 return ECORE_CALLBACK_RENEW;
2156 _item_position(Elm_Gen_Item *it,
2164 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2165 evas_object_resize(view, it->item->w, it->item->h);
2166 evas_object_move(view, it_x, it_y);
2167 evas_object_show(view);
2168 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2169 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2173 _item_block_position(Item_Block *itb,
2179 Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2182 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2183 evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh);
2184 evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy,
2186 EINA_LIST_FOREACH(itb->items, l, it)
2188 if (it->delete_me) continue;
2189 else if (it->wd->reorder_it == it) continue;
2192 it->item->w = itb->w;
2193 it->item->scrl_x = itb->x + it->x - it->wd->pan_x + ox;
2194 it->item->scrl_y = itb->y + it->y - it->wd->pan_y + oy;
2196 vis = (ELM_RECTS_INTERSECT(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h,
2197 cvx, cvy, cvw, cvh));
2198 if (it->item->flags != ELM_GENLIST_ITEM_GROUP)
2200 if ((itb->realized) && (!it->realized))
2202 if (vis) _item_realize(it, in, EINA_FALSE);
2208 if (it->wd->reorder_mode)
2209 y += _get_space_for_reorder_item(it);
2210 git = it->item->group_item;
2213 if (git->item->scrl_y < oy)
2214 git->item->scrl_y = oy;
2215 if ((git->item->scrl_y + git->item->h) > (it->item->scrl_y + it->item->h))
2216 git->item->scrl_y = (it->item->scrl_y + it->item->h) - git->item->h;
2217 git->item->want_realize = EINA_TRUE;
2219 if ((it->wd->reorder_it) && (it->item->old_scrl_y != it->item->scrl_y))
2221 if (!it->item->move_effect_enabled)
2223 it->item->move_effect_enabled = EINA_TRUE;
2224 it->wd->reorder_move_animator =
2226 _reorder_move_animator_cb, it);
2229 if (!it->item->move_effect_enabled)
2231 if (it->item->mode_view)
2232 _item_position(it, it->item->mode_view, it->item->scrl_x,
2235 _item_position(it, VIEW(it), it->item->scrl_x,
2237 it->item->old_scrl_y = it->item->scrl_y;
2242 if (!it->dragging) elm_gen_item_unrealize(it, EINA_FALSE);
2249 if (vis) it->item->want_realize = EINA_TRUE;
2253 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2254 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2258 _group_items_recalc(void *data)
2260 Widget_Data *wd = data;
2264 evas_event_freeze(evas_object_evas_get(wd->obj));
2265 EINA_LIST_FOREACH(wd->group_items, l, git)
2267 if (git->item->want_realize)
2270 _item_realize(git, 0, EINA_FALSE);
2271 evas_object_resize(VIEW(git), wd->minw, git->item->h);
2272 evas_object_move(VIEW(git), git->item->scrl_x, git->item->scrl_y);
2273 evas_object_show(VIEW(git));
2274 evas_object_raise(VIEW(git));
2276 else if (!git->item->want_realize && git->realized)
2279 elm_gen_item_unrealize(git, EINA_FALSE);
2282 evas_event_thaw(evas_object_evas_get(wd->obj));
2283 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2287 _must_recalc_idler(void *data)
2289 Widget_Data *wd = data;
2290 if (wd->calc_job) ecore_job_del(wd->calc_job);
2291 wd->calc_job = ecore_job_add(_calc_job, wd);
2292 wd->must_recalc_idler = NULL;
2293 return ECORE_CALLBACK_CANCEL;
2297 _calc_job(void *data)
2299 Widget_Data *wd = data;
2300 Item_Block *itb, *chb = NULL;
2301 Evas_Coord minw = -1, minh = 0, y = 0, ow;
2304 Eina_Bool minw_change = EINA_FALSE;
2305 Eina_Bool did_must_recalc = EINA_FALSE;
2308 t0 = ecore_time_get();
2309 evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h);
2313 evas_event_freeze(evas_object_evas_get(wd->obj));
2314 EINA_INLIST_FOREACH(wd->blocks, itb)
2316 Eina_Bool showme = EINA_FALSE;
2319 showme = itb->showme;
2320 itb->showme = EINA_FALSE;
2323 if (itb->realized) _item_block_unrealize(itb);
2325 if ((itb->changed) || ((itb->must_recalc) && (!did_must_recalc)))
2327 if (itb->must_recalc)
2331 EINA_LIST_FOREACH(itb->items, l, it)
2332 if (it->item->mincalcd) it->item->mincalcd = EINA_FALSE;
2333 itb->changed = EINA_TRUE;
2334 if (itb->must_recalc) did_must_recalc = EINA_TRUE;
2335 itb->must_recalc = EINA_FALSE;
2337 if (itb->realized) _item_block_unrealize(itb);
2338 showme = _item_block_recalc(itb, in, EINA_FALSE);
2344 if (minw == -1) minw = itb->minw;
2345 else if ((!itb->must_recalc) && (minw < itb->minw))
2348 minw_change = EINA_TRUE;
2354 if ((showme) && (wd->show_item) && (!wd->show_item->item->queued))
2356 wd->show_item->item->showme = EINA_FALSE;
2358 elm_smart_scroller_region_bring_in(wd->scr,
2360 wd->show_item->item->block->x,
2362 wd->show_item->item->block->y,
2363 wd->show_item->item->block->w,
2364 wd->show_item->item->h);
2366 elm_smart_scroller_child_region_show(wd->scr,
2368 wd->show_item->item->block->x,
2370 wd->show_item->item->block->y,
2371 wd->show_item->item->block->w,
2372 wd->show_item->item->h);
2373 wd->show_item = NULL;
2378 EINA_INLIST_FOREACH(wd->blocks, itb)
2384 if ((chb) && (EINA_INLIST_GET(chb)->next))
2386 EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb)
2388 if (itb->realized) _item_block_unrealize(itb);
2391 wd->realminw = minw;
2392 if (minw < wd->w) minw = wd->w;
2393 if ((minw != wd->minw) || (minh != wd->minh))
2397 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
2398 _sizing_eval(wd->obj);
2399 if ((wd->anchor_item) && (wd->anchor_item->item->block) && (!wd->auto_scroll_enabled))
2404 it = wd->anchor_item;
2405 it_y = wd->anchor_y;
2406 elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x,
2407 it->item->block->y + it->y + it_y);
2408 wd->anchor_item = it;
2409 wd->anchor_y = it_y;
2412 t = ecore_time_get();
2413 if (did_must_recalc)
2415 if (!wd->must_recalc_idler)
2416 wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd);
2418 wd->calc_job = NULL;
2419 evas_object_smart_changed(wd->pan_smart);
2420 evas_event_thaw(evas_object_evas_get(wd->obj));
2421 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2425 _update_job(void *data)
2427 Widget_Data *wd = data;
2431 Eina_Bool position = EINA_FALSE, recalc = EINA_FALSE;
2433 wd->update_job = NULL;
2436 evas_event_freeze(evas_object_evas_get(wd->obj));
2437 EINA_INLIST_FOREACH(wd->blocks, itb)
2439 Evas_Coord itminw, itminh;
2446 _item_block_position(itb, num);
2450 recalc = EINA_FALSE;
2451 EINA_LIST_FOREACH(itb->items, l2, it)
2453 if (it->item->updateme)
2455 itminw = it->item->minw;
2456 itminh = it->item->minh;
2458 it->item->updateme = EINA_FALSE;
2461 elm_gen_item_unrealize(it, EINA_FALSE);
2462 _item_realize(it, num, EINA_FALSE);
2463 position = EINA_TRUE;
2467 _item_realize(it, num, EINA_TRUE);
2468 elm_gen_item_unrealize(it, EINA_TRUE);
2470 if ((it->item->minw != itminw) || (it->item->minh != itminh))
2475 itb->updateme = EINA_FALSE;
2478 position = EINA_TRUE;
2479 itb->changed = EINA_TRUE;
2480 _item_block_recalc(itb, num0, EINA_FALSE);
2481 _item_block_position(itb, num0);
2486 if (wd->calc_job) ecore_job_del(wd->calc_job);
2487 wd->calc_job = ecore_job_add(_calc_job, wd);
2489 evas_event_thaw(evas_object_evas_get(wd->obj));
2490 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2494 _pan_set(Evas_Object *obj,
2498 Pan *sd = evas_object_smart_data_get(obj);
2502 // Evas_Coord ow, oh;
2503 // evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2504 // ow = sd->wd->minw - ow;
2505 // if (ow < 0) ow = 0;
2506 // oh = sd->wd->minh - oh;
2507 // if (oh < 0) oh = 0;
2508 // if (x < 0) x = 0;
2509 // if (y < 0) y = 0;
2510 // if (x > ow) x = ow;
2511 // if (y > oh) y = oh;
2512 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
2516 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2518 if ((itb->y + itb->h) > y)
2523 EINA_LIST_FOREACH(itb->items, l2, it)
2525 if ((itb->y + it->y) >= y)
2527 sd->wd->anchor_item = it;
2528 sd->wd->anchor_y = -(itb->y + it->y - y);
2535 if (!sd->wd->reorder_move_animator) evas_object_smart_changed(obj);
2539 _pan_get(Evas_Object *obj,
2543 Pan *sd = evas_object_smart_data_get(obj);
2546 if (x) *x = sd->wd->pan_x;
2547 if (y) *y = sd->wd->pan_y;
2551 _pan_max_get(Evas_Object *obj,
2555 Pan *sd = evas_object_smart_data_get(obj);
2559 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2560 ow = sd->wd->minw - ow;
2562 oh = sd->wd->minh - oh;
2569 _pan_min_get(Evas_Object *obj __UNUSED__,
2578 _pan_child_size_get(Evas_Object *obj,
2582 Pan *sd = evas_object_smart_data_get(obj);
2585 if (w) *w = sd->wd->minw;
2586 if (h) *h = sd->wd->minh;
2590 _pan_add(Evas_Object *obj)
2593 Evas_Object_Smart_Clipped_Data *cd;
2596 cd = evas_object_smart_data_get(obj);
2599 sd->__clipped_data = *cd;
2601 evas_object_smart_data_set(obj, sd);
2605 _pan_del(Evas_Object *obj)
2607 Pan *sd = evas_object_smart_data_get(obj);
2612 ecore_job_del(sd->resize_job);
2613 sd->resize_job = NULL;
2619 _pan_resize_job(void *data)
2623 _sizing_eval(sd->wd->obj);
2624 sd->resize_job = NULL;
2628 _pan_resize(Evas_Object *obj,
2632 Pan *sd = evas_object_smart_data_get(obj);
2636 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2637 if ((ow == w) && (oh == h)) return;
2638 if ((sd->wd->height_for_width) && (ow != w))
2641 if (sd->resize_job) ecore_job_del(sd->resize_job);
2642 sd->resize_job = ecore_job_add(_pan_resize_job, sd);
2644 sd->wd->pan_resized = EINA_TRUE;
2645 evas_object_smart_changed(obj);
2646 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2647 sd->wd->calc_job = NULL;
2649 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2650 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2655 _pan_calculate(Evas_Object *obj)
2657 Pan *sd = evas_object_smart_data_get(obj);
2659 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2665 evas_event_freeze(evas_object_evas_get(obj));
2667 if (sd->wd->pan_resized)
2670 sd->wd->pan_resized = EINA_FALSE;
2673 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
2674 evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
2675 EINA_LIST_FOREACH(sd->wd->group_items, l, git)
2677 git->item->want_realize = EINA_FALSE;
2679 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2681 itb->w = sd->wd->minw;
2682 if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox,
2683 itb->y - sd->wd->pan_y + oy,
2685 cvx, cvy, cvw, cvh))
2687 if ((!itb->realized) || (itb->changed))
2688 _item_block_realize(itb);
2689 _item_block_position(itb, in);
2693 if (itb->realized) _item_block_unrealize(itb);
2697 if ((!sd->wd->reorder_it) || (sd->wd->reorder_pan_move))
2698 _group_items_recalc(sd->wd);
2699 if ((sd->wd->reorder_mode) && (sd->wd->reorder_it))
2701 if (sd->wd->pan_y != sd->wd->reorder_old_pan_y)
2702 sd->wd->reorder_pan_move = EINA_TRUE;
2703 else sd->wd->reorder_pan_move = EINA_FALSE;
2704 evas_object_raise(sd->wd->VIEW(reorder_it));
2705 sd->wd->reorder_old_pan_y = sd->wd->pan_y;
2706 sd->wd->start_time = ecore_loop_time_get();
2708 _item_auto_scroll(sd->wd);
2709 evas_event_thaw(evas_object_evas_get(obj));
2710 evas_event_thaw_eval(evas_object_evas_get(obj));
2714 _pan_move(Evas_Object *obj,
2715 Evas_Coord x __UNUSED__,
2716 Evas_Coord y __UNUSED__)
2718 Pan *sd = evas_object_smart_data_get(obj);
2721 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2722 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2726 _hold_on(void *data __UNUSED__,
2728 void *event_info __UNUSED__)
2730 Widget_Data *wd = elm_widget_data_get(obj);
2732 elm_smart_scroller_hold_set(wd->scr, 1);
2736 _hold_off(void *data __UNUSED__,
2738 void *event_info __UNUSED__)
2740 Widget_Data *wd = elm_widget_data_get(obj);
2742 elm_smart_scroller_hold_set(wd->scr, 0);
2746 _freeze_on(void *data __UNUSED__,
2748 void *event_info __UNUSED__)
2750 Widget_Data *wd = elm_widget_data_get(obj);
2752 elm_smart_scroller_freeze_set(wd->scr, 1);
2756 _freeze_off(void *data __UNUSED__,
2758 void *event_info __UNUSED__)
2760 Widget_Data *wd = elm_widget_data_get(obj);
2762 elm_smart_scroller_freeze_set(wd->scr, 0);
2766 _scr_anim_start(void *data,
2767 Evas_Object *obj __UNUSED__,
2768 void *event_info __UNUSED__)
2770 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL);
2774 _scr_anim_stop(void *data,
2775 Evas_Object *obj __UNUSED__,
2776 void *event_info __UNUSED__)
2778 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL);
2782 _scr_drag_start(void *data,
2783 Evas_Object *obj __UNUSED__,
2784 void *event_info __UNUSED__)
2786 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
2790 _scr_drag_stop(void *data,
2791 Evas_Object *obj __UNUSED__,
2792 void *event_info __UNUSED__)
2794 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
2798 _edge_left(void *data,
2799 Evas_Object *scr __UNUSED__,
2800 void *event_info __UNUSED__)
2802 Evas_Object *obj = data;
2803 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_LEFT, NULL);
2804 evas_object_smart_callback_call(obj, SIG_EDGE_LEFT, NULL);
2808 _edge_right(void *data,
2809 Evas_Object *scr __UNUSED__,
2810 void *event_info __UNUSED__)
2812 Evas_Object *obj = data;
2813 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_RIGHT, NULL);
2814 evas_object_smart_callback_call(obj, SIG_EDGE_RIGHT, NULL);
2818 _edge_top(void *data,
2819 Evas_Object *scr __UNUSED__,
2820 void *event_info __UNUSED__)
2822 Evas_Object *obj = data;
2823 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_TOP, NULL);
2824 evas_object_smart_callback_call(obj, SIG_EDGE_TOP, NULL);
2828 _edge_bottom(void *data,
2829 Evas_Object *scr __UNUSED__,
2830 void *event_info __UNUSED__)
2832 Evas_Object *obj = data;
2833 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_BOTTOM, NULL);
2834 evas_object_smart_callback_call(obj, SIG_EDGE_BOTTOM, NULL);
2838 _mode_item_realize(Elm_Gen_Item *it)
2842 if ((it->item->mode_view) || (it->delete_me)) return;
2844 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2845 it->item->mode_view = edje_object_add(evas_object_evas_get(WIDGET(it)));
2846 edje_object_scale_set(it->item->mode_view,
2847 elm_widget_scale_get(WIDGET(it)) *
2848 _elm_config->scale);
2849 evas_object_smart_member_add(it->item->mode_view, it->wd->pan_smart);
2850 elm_widget_sub_object_add(WIDGET(it), it->item->mode_view);
2852 strncpy(buf, "item", sizeof(buf));
2853 if (it->wd->compress)
2854 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
2856 if (it->item->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
2857 strncat(buf, "/", sizeof(buf) - strlen(buf));
2858 strncat(buf, it->wd->mode_item_style, sizeof(buf) - strlen(buf));
2860 _elm_theme_object_set(WIDGET(it), it->item->mode_view, "genlist", buf,
2861 elm_widget_style_get(WIDGET(it)));
2862 edje_object_mirrored_set(it->item->mode_view,
2863 elm_widget_mirrored_get(WIDGET(it)));
2865 /* signal callback add */
2866 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_DOWN,
2868 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_UP,
2870 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_MOVE,
2873 /* label_get, icon_get, state_get */
2874 /* FIXME: If you see that assert, please notify us and we
2875 will clean our mess */
2876 assert(eina_list_count(it->item->mode_icon_objs) == 0);
2878 _item_label_realize(it, it->item->mode_view, &it->item->mode_labels);
2879 it->item->mode_icon_objs = _item_icon_realize(it,
2880 it->item->mode_view,
2881 &it->item->mode_icons);
2882 _item_state_realize(it, it->item->mode_view, &it->item->mode_states);
2884 edje_object_part_swallow(it->item->mode_view,
2885 edje_object_data_get(it->item->mode_view, "mode_part"),
2888 it->want_unrealize = EINA_FALSE;
2889 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2890 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2894 _mode_item_unrealize(Elm_Gen_Item *it)
2896 Widget_Data *wd = it->wd;
2898 if (!it->item->mode_view) return;
2900 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2901 elm_widget_stringlist_free(it->item->mode_labels);
2902 it->item->mode_labels = NULL;
2903 elm_widget_stringlist_free(it->item->mode_icons);
2904 it->item->mode_icons = NULL;
2905 elm_widget_stringlist_free(it->item->mode_states);
2907 EINA_LIST_FREE(it->item->mode_icon_objs, icon)
2908 evas_object_del(icon);
2910 edje_object_part_unswallow(it->item->mode_view, VIEW(it));
2911 evas_object_smart_member_add(VIEW(it), wd->pan_smart);
2912 evas_object_del(it->item->mode_view);
2913 it->item->mode_view = NULL;
2915 if (wd->mode_item == it)
2916 wd->mode_item = NULL;
2917 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2918 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2922 _item_mode_set(Elm_Gen_Item *it)
2925 Widget_Data *wd = it->wd;
2930 it->item->nocache = EINA_TRUE;
2932 if (wd->scr_hold_timer)
2934 ecore_timer_del(wd->scr_hold_timer);
2935 wd->scr_hold_timer = NULL;
2937 elm_smart_scroller_hold_set(wd->scr, EINA_TRUE);
2938 wd->scr_hold_timer = ecore_timer_add(0.1, _scr_hold_timer_cb, wd);
2940 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2941 _mode_item_realize(it);
2942 if (it->item->group_item)
2943 evas_object_raise(it->item->VIEW(group_item));
2944 _item_position(it, it->item->mode_view, it->item->scrl_x, it->item->scrl_y);
2945 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2946 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2948 snprintf(buf, sizeof(buf), "elm,state,%s,active", wd->mode_type);
2949 edje_object_signal_emit(it->item->mode_view, buf, "elm");
2953 _item_mode_unset(Widget_Data *wd)
2956 if (!wd->mode_item) return;
2957 char buf[1024], buf2[1024];
2961 it->item->nocache = EINA_TRUE;
2963 snprintf(buf, sizeof(buf), "elm,state,%s,passive", wd->mode_type);
2964 snprintf(buf2, sizeof(buf2), "elm,state,%s,passive,finished", wd->mode_type);
2966 edje_object_signal_emit(it->item->mode_view, buf, "elm");
2967 edje_object_signal_callback_add(it->item->mode_view, buf2, "elm", _mode_finished_signal_cb, it);
2969 wd->mode_item = NULL;
2973 _item_auto_scroll(Widget_Data *wd)
2978 Evas_Coord ox, oy, ow, oh;
2980 if ((wd->expanded_item) && (wd->auto_scroll_enabled))
2982 evas_object_geometry_get(wd->obj, &ox, &oy, &ow, &oh);
2983 if (wd->expanded_item->item->scrl_y > (oh + oy) / 2)
2985 EINA_LIST_FOREACH(wd->expanded_item->item->items, l, it)
2986 elm_genlist_item_bring_in(it);
2988 wd->auto_scroll_enabled = EINA_FALSE;
2993 elm_genlist_add(Evas_Object *parent)
2998 Evas_Coord minw, minh;
2999 static Evas_Smart *smart = NULL;
3003 static Evas_Smart_Class sc;
3005 evas_object_smart_clipped_smart_set(&_pan_sc);
3007 sc.name = "elm_genlist_pan";
3008 sc.version = EVAS_SMART_CLASS_VERSION;
3011 sc.resize = _pan_resize;
3012 sc.move = _pan_move;
3013 sc.calculate = _pan_calculate;
3014 if (!(smart = evas_smart_class_new(&sc))) return NULL;
3017 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
3019 ELM_SET_WIDTYPE(widtype, "genlist");
3021 elm_widget_type_set(obj, "genlist");
3022 elm_widget_sub_object_add(parent, obj);
3023 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
3024 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
3025 elm_widget_data_set(obj, wd);
3026 elm_widget_del_hook_set(obj, _del_hook);
3027 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
3028 elm_widget_theme_hook_set(obj, _theme_hook);
3029 elm_widget_can_focus_set(obj, EINA_TRUE);
3030 elm_widget_event_hook_set(obj, _event_hook);
3031 elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
3032 elm_widget_translate_hook_set(obj, _translate_hook);
3034 wd->scr = elm_smart_scroller_add(e);
3035 elm_smart_scroller_widget_set(wd->scr, obj);
3036 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
3037 elm_widget_style_get(obj));
3038 elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE,
3039 _elm_config->thumbscroll_bounce_enable);
3040 elm_widget_resize_object_set(obj, wd->scr);
3042 evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj);
3043 evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, obj);
3044 evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj);
3045 evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj);
3046 evas_object_smart_callback_add(wd->scr, "edge,left", _edge_left, obj);
3047 evas_object_smart_callback_add(wd->scr, "edge,right", _edge_right, obj);
3048 evas_object_smart_callback_add(wd->scr, "edge,top", _edge_top, obj);
3049 evas_object_smart_callback_add(wd->scr, "edge,bottom", _edge_bottom, obj);
3052 wd->mode = ELM_LIST_SCROLL;
3053 wd->max_items_per_block = MAX_ITEMS_PER_BLOCK;
3054 wd->item_cache_max = wd->max_items_per_block * 2;
3055 wd->longpress_timeout = _elm_config->longpress_timeout;
3057 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
3058 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
3059 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
3060 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
3062 wd->pan_smart = evas_object_smart_add(e, smart);
3063 wd->pan = evas_object_smart_data_get(wd->pan_smart);
3066 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
3067 _pan_set, _pan_get, _pan_max_get,
3068 _pan_min_get, _pan_child_size_get);
3070 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
3072 evas_object_size_hint_min_set(obj, minw, minh);
3074 evas_object_smart_callbacks_descriptions_set(obj, _signals);
3076 _mirrored_set(obj, elm_widget_mirrored_get(obj));
3081 static Elm_Gen_Item *
3082 _item_new(Widget_Data *wd,
3083 const Elm_Genlist_Item_Class *itc,
3085 Elm_Gen_Item *parent,
3086 Elm_Genlist_Item_Flags flags,
3088 const void *func_data)
3092 it = elm_gen_item_new(wd, itc, data, parent, func, func_data);
3093 if (!it) return NULL;
3094 it->item = ELM_NEW(Elm_Gen_Item_Type);
3095 it->item->flags = flags;
3096 if (flags & ELM_GENLIST_ITEM_GROUP) it->group++;
3097 it->item->expanded_depth = 0;
3098 elm_widget_item_del_cb_set(it, _item_del_hook);
3099 ELM_GEN_ITEM_SETUP(it);
3102 if (it->parent->group)
3103 it->item->group_item = parent;
3104 else if (it->parent->item->group_item)
3105 it->item->group_item = it->parent->item->group_item;
3111 _item_block_add(Widget_Data *wd,
3114 Item_Block *itb = NULL;
3121 itb = calloc(1, sizeof(Item_Block));
3124 if (!it->item->rel->item->block)
3127 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3128 itb->items = eina_list_append(itb->items, it);
3132 if (it->item->before)
3134 wd->blocks = eina_inlist_prepend_relative
3135 (wd->blocks, EINA_INLIST_GET(itb),
3136 EINA_INLIST_GET(it->item->rel->item->block));
3138 eina_list_prepend_relative(itb->items, it, it->item->rel);
3142 wd->blocks = eina_inlist_append_relative
3143 (wd->blocks, EINA_INLIST_GET(itb),
3144 EINA_INLIST_GET(it->item->rel->item->block));
3146 eina_list_append_relative(itb->items, it, it->item->rel);
3152 if (it->item->before)
3156 itb = (Item_Block *)(wd->blocks);
3157 if (itb->count >= wd->max_items_per_block)
3159 itb = calloc(1, sizeof(Item_Block));
3163 eina_inlist_prepend(wd->blocks,
3164 EINA_INLIST_GET(itb));
3169 itb = calloc(1, sizeof(Item_Block));
3173 eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
3175 itb->items = eina_list_prepend(itb->items, it);
3181 itb = (Item_Block *)(wd->blocks->last);
3182 if (itb->count >= wd->max_items_per_block)
3184 itb = calloc(1, sizeof(Item_Block));
3188 eina_inlist_append(wd->blocks,
3189 EINA_INLIST_GET(itb));
3194 itb = calloc(1, sizeof(Item_Block));
3198 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3200 itb->items = eina_list_append(itb->items, it);
3206 itb = it->item->rel->item->block;
3207 if (!itb) goto newblock;
3208 if (it->item->before)
3209 itb->items = eina_list_prepend_relative(itb->items, it, it->item->rel);
3211 itb->items = eina_list_append_relative(itb->items, it, it->item->rel);
3214 itb->changed = EINA_TRUE;
3215 it->item->block = itb;
3216 if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job);
3217 itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd);
3220 it->item->rel->relcount--;
3221 if ((it->item->rel->delete_me) && (!it->item->rel->relcount))
3222 _item_del(it->item->rel);
3223 it->item->rel = NULL;
3225 if (itb->count > itb->wd->max_items_per_block)
3231 newc = itb->count / 2;
3232 itb2 = calloc(1, sizeof(Item_Block));
3236 eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
3237 EINA_INLIST_GET(itb));
3238 itb2->changed = EINA_TRUE;
3239 while ((itb->count > newc) && (itb->items))
3243 l = eina_list_last(itb->items);
3245 itb->items = eina_list_remove_list(itb->items, l);
3248 itb2->items = eina_list_prepend(itb2->items, it2);
3249 it2->item->block = itb2;
3256 _queue_process(Widget_Data *wd)
3259 Eina_Bool showme = EINA_FALSE;
3262 t0 = ecore_time_get();
3263 //evas_event_freeze(evas_object_evas_get(wd->obj));
3264 for (n = 0; (wd->queue) && (n < 128); n++)
3268 it = wd->queue->data;
3269 wd->queue = eina_list_remove_list(wd->queue, wd->queue);
3270 it->item->queued = EINA_FALSE;
3271 _item_block_add(wd, it);
3272 t = ecore_time_get();
3273 if (it->item->block->changed)
3275 showme = _item_block_recalc(it->item->block, it->item->block->num, EINA_TRUE);
3276 it->item->block->changed = 0;
3278 if (showme) it->item->block->showme = EINA_TRUE;
3279 if (eina_inlist_count(wd->blocks) > 1)
3281 if ((t - t0) > (ecore_animator_frametime_get())) break;
3284 //evas_event_thaw(evas_object_evas_get(wd->obj));
3285 //evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3290 _idle_process(void *data, Eina_Bool *wakeup)
3292 Widget_Data *wd = data;
3295 //static double q_start = 0.0;
3296 //if (q_start == 0.0) q_start = ecore_time_get();
3298 if (_queue_process(wd) > 0) *wakeup = EINA_TRUE;
3302 //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start);
3304 return ECORE_CALLBACK_CANCEL;
3306 return ECORE_CALLBACK_RENEW;
3310 _item_idle_enterer(void *data)
3312 Widget_Data *wd = data;
3313 Eina_Bool wakeup = EINA_FALSE;
3314 Eina_Bool ok = _idle_process(data, &wakeup);
3319 if (wd->calc_job) ecore_job_del(wd->calc_job);
3320 wd->calc_job = ecore_job_add(_calc_job, wd);
3322 if (ok == ECORE_CALLBACK_CANCEL) wd->queue_idle_enterer = NULL;
3327 _item_queue(Widget_Data *wd,
3330 if (it->item->queued) return;
3331 it->item->queued = EINA_TRUE;
3332 wd->queue = eina_list_append(wd->queue, it);
3333 // FIXME: why does a freeze then thaw here cause some genlist
3334 // elm_genlist_item_append() to be much much slower?
3335 // evas_event_freeze(evas_object_evas_get(wd->obj));
3336 while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
3338 if (wd->queue_idle_enterer)
3340 ecore_idle_enterer_del(wd->queue_idle_enterer);
3341 wd->queue_idle_enterer = NULL;
3345 // evas_event_thaw(evas_object_evas_get(wd->obj));
3346 // evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3347 if (!wd->queue_idle_enterer)
3348 wd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, wd);
3352 _elm_genlist_item_compare_data(const void *data, const void *data1)
3354 const Elm_Gen_Item *it = data;
3355 const Elm_Gen_Item *item1 = data1;
3357 return _elm_genlist_item_compare_data_cb(it->base.data, item1->base.data);
3361 _elm_genlist_item_compare(const void *data, const void *data1)
3363 const Elm_Gen_Item *it, *item1;
3364 it = ELM_GEN_ITEM_FROM_INLIST(data);
3365 item1 = ELM_GEN_ITEM_FROM_INLIST(data1);
3366 return _elm_genlist_item_compare_cb(it, item1);
3370 _elm_genlist_item_list_compare(const void *data, const void *data1)
3372 const Elm_Gen_Item *it = data;
3373 const Elm_Gen_Item *item1 = data1;
3374 return _elm_genlist_item_compare_cb(it, item1);
3378 _item_move_after(Elm_Gen_Item *it, Elm_Gen_Item *after)
3383 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3384 _item_block_del(it);
3386 it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
3387 it->item->rel = after;
3388 it->item->rel->relcount++;
3389 it->item->before = EINA_FALSE;
3390 if (after->item->group_item) it->item->group_item = after->item->group_item;
3391 _item_queue(it->wd, it);
3393 evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it);
3397 _item_move_before(Elm_Gen_Item *it, Elm_Gen_Item *before)
3400 if (!before) return;
3402 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3403 _item_block_del(it);
3404 it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
3405 it->item->rel = before;
3406 it->item->rel->relcount++;
3407 it->item->before = EINA_TRUE;
3408 if (before->item->group_item) it->item->group_item = before->item->group_item;
3409 _item_queue(it->wd, it);
3411 evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it);
3415 elm_genlist_item_append(Evas_Object *obj,
3416 const Elm_Genlist_Item_Class *itc,
3418 Elm_Gen_Item *parent,
3419 Elm_Genlist_Item_Flags flags,
3421 const void *func_data)
3423 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3424 Widget_Data *wd = elm_widget_data_get(obj);
3425 if (!wd) return NULL;
3426 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3428 if (!it) return NULL;
3431 if (flags & ELM_GENLIST_ITEM_GROUP)
3432 wd->group_items = eina_list_append(wd->group_items, it);
3433 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
3434 it->item->rel = NULL;
3438 Elm_Gen_Item *it2 = NULL;
3439 Eina_List *ll = eina_list_last(it->parent->item->items);
3440 if (ll) it2 = ll->data;
3441 it->parent->item->items = eina_list_append(it->parent->item->items, it);
3442 if (!it2) it2 = it->parent;
3444 eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3445 EINA_INLIST_GET(it2));
3446 it->item->rel = it2;
3447 it->item->rel->relcount++;
3449 it->item->before = EINA_FALSE;
3450 _item_queue(wd, it);
3455 elm_genlist_item_prepend(Evas_Object *obj,
3456 const Elm_Genlist_Item_Class *itc,
3458 Elm_Gen_Item *parent,
3459 Elm_Genlist_Item_Flags flags,
3461 const void *func_data)
3463 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3464 Widget_Data *wd = elm_widget_data_get(obj);
3465 if (!wd) return NULL;
3466 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3468 if (!it) return NULL;
3471 if (flags & ELM_GENLIST_ITEM_GROUP)
3472 wd->group_items = eina_list_prepend(wd->group_items, it);
3473 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
3474 it->item->rel = NULL;
3478 Elm_Gen_Item *it2 = NULL;
3479 Eina_List *ll = it->parent->item->items;
3480 if (ll) it2 = ll->data;
3481 it->parent->item->items = eina_list_prepend(it->parent->item->items, it);
3482 if (!it2) it2 = it->parent;
3484 eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3485 EINA_INLIST_GET(it2));
3486 it->item->rel = it2;
3487 it->item->rel->relcount++;
3489 it->item->before = EINA_TRUE;
3490 _item_queue(wd, it);
3495 elm_genlist_item_insert_after(Evas_Object *obj,
3496 const Elm_Genlist_Item_Class *itc,
3498 Elm_Gen_Item *parent,
3499 Elm_Gen_Item *after,
3500 Elm_Genlist_Item_Flags flags,
3502 const void *func_data)
3504 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3505 EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
3506 Widget_Data *wd = elm_widget_data_get(obj);
3507 if (!wd) return NULL;
3508 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3510 if (!it) return NULL;
3511 /* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */
3512 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3516 if ((flags & ELM_GENLIST_ITEM_GROUP) &&
3517 (after->item->flags & ELM_GENLIST_ITEM_GROUP))
3518 wd->group_items = eina_list_append_relative(wd->group_items, it,
3523 it->parent->item->items = eina_list_append_relative(it->parent->item->items, it,
3526 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3527 EINA_INLIST_GET(after));
3528 it->item->rel = after;
3529 it->item->rel->relcount++;
3530 it->item->before = EINA_FALSE;
3531 _item_queue(wd, it);
3536 elm_genlist_item_insert_before(Evas_Object *obj,
3537 const Elm_Genlist_Item_Class *itc,
3539 Elm_Gen_Item *parent,
3540 Elm_Gen_Item *before,
3541 Elm_Genlist_Item_Flags flags,
3543 const void *func_data)
3545 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3546 EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
3547 Widget_Data *wd = elm_widget_data_get(obj);
3548 if (!wd) return NULL;
3549 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3551 if (!it) return NULL;
3552 /* It makes no sense to insert before in an empty list with before != NULL, something really bad is happening in your app. */
3553 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3557 if ((flags & ELM_GENLIST_ITEM_GROUP) &&
3558 (before->item->flags & ELM_GENLIST_ITEM_GROUP))
3559 wd->group_items = eina_list_prepend_relative(wd->group_items, it,
3564 it->parent->item->items = eina_list_prepend_relative(it->parent->item->items, it,
3567 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3568 EINA_INLIST_GET(before));
3569 it->item->rel = before;
3570 it->item->rel->relcount++;
3571 it->item->before = EINA_TRUE;
3572 _item_queue(wd, it);
3577 elm_genlist_item_direct_sorted_insert(Evas_Object *obj,
3578 const Elm_Genlist_Item_Class *itc,
3580 Elm_Gen_Item *parent,
3581 Elm_Genlist_Item_Flags flags,
3582 Eina_Compare_Cb comp,
3584 const void *func_data)
3586 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3587 Widget_Data *wd = elm_widget_data_get(obj);
3588 if (!wd) return NULL;
3589 Elm_Gen_Item *rel = NULL;
3590 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3592 if (!it) return NULL;
3594 _elm_genlist_item_compare_cb = comp;
3601 l = eina_list_search_sorted_near_list(it->parent->item->items,
3602 _elm_genlist_item_list_compare, it,
3605 rel = eina_list_data_get(l);
3609 if (cmp_result >= 0)
3611 it->parent->item->items = eina_list_prepend_relative_list(it->parent->item->items, it, l);
3612 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
3613 it->item->before = EINA_FALSE;
3615 else if (cmp_result < 0)
3617 it->parent->item->items = eina_list_append_relative_list(it->parent->item->items, it, l);
3618 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
3619 it->item->before = EINA_TRUE;
3626 wd->state = eina_inlist_sorted_state_new();
3629 if (flags & ELM_GENLIST_ITEM_GROUP)
3630 wd->group_items = eina_list_append(wd->group_items, it);
3632 wd->items = eina_inlist_sorted_state_insert(wd->items, EINA_INLIST_GET(it),
3633 _elm_genlist_item_compare, wd->state);
3635 if (EINA_INLIST_GET(it)->next)
3637 rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3638 it->item->before = EINA_TRUE;
3640 else if (EINA_INLIST_GET(it)->prev)
3642 rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3643 it->item->before = EINA_FALSE;
3649 it->item->rel = rel;
3650 it->item->rel->relcount++;
3653 _item_queue(wd, it);
3659 elm_genlist_item_sorted_insert(Evas_Object *obj,
3660 const Elm_Genlist_Item_Class *itc,
3662 Elm_Gen_Item *parent,
3663 Elm_Genlist_Item_Flags flags,
3664 Eina_Compare_Cb comp,
3666 const void *func_data)
3668 _elm_genlist_item_compare_data_cb = comp;
3670 return elm_genlist_item_direct_sorted_insert(obj, itc, data, parent, flags,
3671 _elm_genlist_item_compare_data, func, func_data);
3675 elm_genlist_clear(Evas_Object *obj)
3681 elm_genlist_multi_select_set(Evas_Object *obj,
3684 ELM_CHECK_WIDTYPE(obj, widtype);
3685 Widget_Data *wd = elm_widget_data_get(obj);
3691 elm_genlist_multi_select_get(const Evas_Object *obj)
3693 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3694 Widget_Data *wd = elm_widget_data_get(obj);
3695 if (!wd) return EINA_FALSE;
3700 elm_genlist_selected_item_get(const Evas_Object *obj)
3702 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3703 Widget_Data *wd = elm_widget_data_get(obj);
3704 if (!wd) return NULL;
3705 if (wd->selected) return wd->selected->data;
3709 EAPI const Eina_List *
3710 elm_genlist_selected_items_get(const Evas_Object *obj)
3712 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3713 Widget_Data *wd = elm_widget_data_get(obj);
3714 if (!wd) return NULL;
3715 return wd->selected;
3719 elm_genlist_realized_items_get(const Evas_Object *obj)
3721 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3722 Widget_Data *wd = elm_widget_data_get(obj);
3723 Eina_List *list = NULL;
3725 Eina_Bool done = EINA_FALSE;
3726 if (!wd) return NULL;
3727 EINA_INLIST_FOREACH(wd->blocks, itb)
3735 EINA_LIST_FOREACH(itb->items, l, it)
3737 if (it->realized) list = eina_list_append(list, it);
3749 elm_genlist_at_xy_item_get(const Evas_Object *obj,
3754 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3755 Widget_Data *wd = elm_widget_data_get(obj);
3756 Evas_Coord ox, oy, ow, oh;
3759 if (!wd) return NULL;
3760 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
3762 EINA_INLIST_FOREACH(wd->blocks, itb)
3767 if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
3768 oy + itb->y - itb->wd->pan_y,
3769 itb->w, itb->h, x, y, 1, 1))
3771 EINA_LIST_FOREACH(itb->items, l, it)
3773 Evas_Coord itx, ity;
3775 itx = ox + itb->x + it->x - itb->wd->pan_x;
3776 ity = oy + itb->y + it->y - itb->wd->pan_y;
3777 if (ELM_RECTS_INTERSECT(itx, ity, it->item->w, it->item->h, x, y, 1, 1))
3781 if (y <= (ity + (it->item->h / 4))) *posret = -1;
3782 else if (y >= (ity + it->item->h - (it->item->h / 4)))
3788 lasty = ity + it->item->h;
3793 if (y > lasty) *posret = 1;
3800 elm_genlist_first_item_get(const Evas_Object *obj)
3802 return elm_gen_first_item_get(obj);
3806 elm_genlist_last_item_get(const Evas_Object *obj)
3808 return elm_gen_last_item_get(obj);
3812 elm_genlist_item_next_get(const Elm_Gen_Item *it)
3814 return elm_gen_item_next_get(it);
3818 elm_genlist_item_prev_get(const Elm_Gen_Item *it)
3820 return elm_gen_item_prev_get(it);
3824 elm_genlist_item_genlist_get(const Elm_Gen_Item *it)
3826 return elm_gen_item_widget_get(it);
3830 elm_genlist_item_parent_get(const Elm_Gen_Item *it)
3832 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3837 elm_genlist_item_subitems_clear(Elm_Gen_Item *it)
3839 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3840 Eina_List *tl = NULL, *l;
3843 EINA_LIST_FOREACH(it->item->items, l, it2)
3844 tl = eina_list_append(tl, it2);
3845 EINA_LIST_FREE(tl, it2)
3846 elm_genlist_item_del(it2);
3850 elm_genlist_item_selected_set(Elm_Gen_Item *it,
3853 elm_gen_item_selected_set(it, selected);
3857 elm_genlist_item_selected_get(const Elm_Gen_Item *it)
3859 return elm_gen_item_selected_get(it);
3863 elm_genlist_item_expanded_set(Elm_Gen_Item *it,
3866 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3867 if (it->item->expanded == expanded) return;
3868 it->item->expanded = expanded;
3869 it->wd->expanded_item = it;
3870 if (it->item->expanded)
3873 edje_object_signal_emit(VIEW(it), "elm,state,expanded", "elm");
3874 evas_object_smart_callback_call(WIDGET(it), SIG_EXPANDED, it);
3875 it->wd->auto_scroll_enabled = EINA_TRUE;
3880 edje_object_signal_emit(VIEW(it), "elm,state,contracted", "elm");
3881 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACTED, it);
3882 it->wd->auto_scroll_enabled = EINA_FALSE;
3887 elm_genlist_item_expanded_get(const Elm_Gen_Item *it)
3889 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
3890 return it->item->expanded;
3894 elm_genlist_item_expanded_depth_get(const Elm_Gen_Item *it)
3896 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, 0);
3897 return it->item->expanded_depth;
3901 elm_genlist_item_disabled_set(Elm_Gen_Item *it,
3904 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3907 if (it->disabled == disabled) return;
3908 if (it->delete_me) return;
3909 it->disabled = !!disabled;
3911 elm_gen_item_selected_set(it, EINA_FALSE);
3915 edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
3917 edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm");
3918 EINA_LIST_FOREACH(it->icon_objs, l, obj)
3919 elm_widget_disabled_set(obj, disabled);
3924 elm_genlist_item_disabled_get(const Elm_Gen_Item *it)
3926 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
3927 if (it->delete_me) return EINA_FALSE;
3928 return it->disabled;
3932 elm_genlist_item_display_only_set(Elm_Gen_Item *it,
3933 Eina_Bool display_only)
3935 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3936 if (it->display_only == display_only) return;
3937 if (it->delete_me) return;
3938 it->display_only = display_only;
3939 it->item->mincalcd = EINA_FALSE;
3940 it->item->updateme = EINA_TRUE;
3941 if (it->item->block) it->item->block->updateme = EINA_TRUE;
3942 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
3943 it->wd->update_job = ecore_job_add(_update_job, it->wd);
3947 elm_genlist_item_display_only_get(const Elm_Gen_Item *it)
3949 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
3950 if (it->delete_me) return EINA_FALSE;
3951 return it->display_only;
3955 elm_genlist_item_show(Elm_Gen_Item *it)
3957 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3958 Evas_Coord gith = 0;
3959 if (it->delete_me) return;
3960 if ((it->item->queued) || (!it->item->mincalcd))
3962 it->wd->show_item = it;
3963 it->wd->bring_in = EINA_TRUE;
3964 it->item->showme = EINA_TRUE;
3967 if (it->wd->show_item)
3969 it->wd->show_item->item->showme = EINA_FALSE;
3970 it->wd->show_item = NULL;
3972 if ((it->item->group_item) && (it->wd->pan_y > (it->y + it->item->block->y)))
3973 gith = it->item->group_item->item->h;
3974 elm_smart_scroller_child_region_show(it->wd->scr,
3975 it->x + it->item->block->x,
3976 it->y + it->item->block->y - gith,
3977 it->item->block->w, it->item->h);
3981 elm_genlist_item_bring_in(Elm_Gen_Item *it)
3983 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3984 Evas_Coord gith = 0;
3985 if (it->delete_me) return;
3986 if ((it->item->queued) || (!it->item->mincalcd))
3988 it->wd->show_item = it;
3989 it->wd->bring_in = EINA_TRUE;
3990 it->item->showme = EINA_TRUE;
3993 if (it->wd->show_item)
3995 it->wd->show_item->item->showme = EINA_FALSE;
3996 it->wd->show_item = NULL;
3998 if ((it->item->group_item) && (it->wd->pan_y > (it->y + it->item->block->y)))
3999 gith = it->item->group_item->item->h;
4000 elm_smart_scroller_region_bring_in(it->wd->scr,
4001 it->x + it->item->block->x,
4002 it->y + it->item->block->y - gith,
4003 it->item->block->w, it->item->h);
4007 elm_genlist_item_top_show(Elm_Gen_Item *it)
4009 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4011 Evas_Coord gith = 0;
4013 if (it->delete_me) return;
4014 if ((it->item->queued) || (!it->item->mincalcd))
4016 it->wd->show_item = it;
4017 it->wd->bring_in = EINA_TRUE;
4018 it->item->showme = EINA_TRUE;
4021 if (it->wd->show_item)
4023 it->wd->show_item->item->showme = EINA_FALSE;
4024 it->wd->show_item = NULL;
4026 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4027 if (it->item->group_item) gith = it->item->group_item->item->h;
4028 elm_smart_scroller_child_region_show(it->wd->scr,
4029 it->x + it->item->block->x,
4030 it->y + it->item->block->y - gith,
4031 it->item->block->w, oh);
4035 elm_genlist_item_top_bring_in(Elm_Gen_Item *it)
4037 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4039 Evas_Coord gith = 0;
4041 if (it->delete_me) return;
4042 if ((it->item->queued) || (!it->item->mincalcd))
4044 it->wd->show_item = it;
4045 it->wd->bring_in = EINA_TRUE;
4046 it->item->showme = EINA_TRUE;
4049 if (it->wd->show_item)
4051 it->wd->show_item->item->showme = EINA_FALSE;
4052 it->wd->show_item = NULL;
4054 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4055 if (it->item->group_item) gith = it->item->group_item->item->h;
4056 elm_smart_scroller_region_bring_in(it->wd->scr,
4057 it->x + it->item->block->x,
4058 it->y + it->item->block->y - gith,
4059 it->item->block->w, oh);
4063 elm_genlist_item_middle_show(Elm_Gen_Item *it)
4065 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4068 if (it->delete_me) return;
4069 if ((it->item->queued) || (!it->item->mincalcd))
4071 it->wd->show_item = it;
4072 it->wd->bring_in = EINA_TRUE;
4073 it->item->showme = EINA_TRUE;
4076 if (it->wd->show_item)
4078 it->wd->show_item->item->showme = EINA_FALSE;
4079 it->wd->show_item = NULL;
4081 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4082 elm_smart_scroller_child_region_show(it->wd->scr,
4083 it->x + it->item->block->x,
4084 it->y + it->item->block->y - oh / 2 +
4085 it->item->h / 2, it->item->block->w, oh);
4089 elm_genlist_item_middle_bring_in(Elm_Gen_Item *it)
4091 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4094 if (it->delete_me) return;
4095 if ((it->item->queued) || (!it->item->mincalcd))
4097 it->wd->show_item = it;
4098 it->wd->bring_in = EINA_TRUE;
4099 it->item->showme = EINA_TRUE;
4102 if (it->wd->show_item)
4104 it->wd->show_item->item->showme = EINA_FALSE;
4105 it->wd->show_item = NULL;
4107 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4108 elm_smart_scroller_region_bring_in(it->wd->scr,
4109 it->x + it->item->block->x,
4110 it->y + it->item->block->y - oh / 2 + it->item->h / 2,
4111 it->item->block->w, oh);
4115 elm_genlist_item_del(Elm_Gen_Item *it)
4117 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4118 if ((it->relcount > 0) || (it->walking > 0))
4120 elm_genlist_item_subitems_clear(it);
4121 if (it->wd->show_item == it) it->wd->show_item = NULL;
4122 elm_gen_item_del_notserious(it);
4123 if (it->item->block)
4125 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE);
4126 it->item->block->changed = EINA_TRUE;
4127 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
4128 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
4136 elm_genlist_item_data_set(Elm_Gen_Item *it,
4139 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4140 elm_widget_item_data_set(it, data);
4144 elm_genlist_item_data_get(const Elm_Gen_Item *it)
4146 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4147 return elm_widget_item_data_get(it);
4151 elm_genlist_item_icons_orphan(Elm_Gen_Item *it)
4154 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4155 EINA_LIST_FREE(it->icon_objs, icon)
4157 elm_widget_sub_object_del(WIDGET(it), icon);
4158 evas_object_smart_member_del(icon);
4159 evas_object_hide(icon);
4163 EAPI const Evas_Object *
4164 elm_genlist_item_object_get(const Elm_Gen_Item *it)
4166 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4171 elm_genlist_item_update(Elm_Gen_Item *it)
4173 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4174 if (!it->item->block) return;
4175 if (it->delete_me) return;
4176 it->item->mincalcd = EINA_FALSE;
4177 it->item->updateme = EINA_TRUE;
4178 it->item->block->updateme = EINA_TRUE;
4179 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4180 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4184 elm_genlist_item_item_class_update(Elm_Gen_Item *it,
4185 const Elm_Genlist_Item_Class *itc)
4187 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4188 if (!it->item->block) return;
4189 EINA_SAFETY_ON_NULL_RETURN(itc);
4190 if (it->delete_me) return;
4192 it->item->nocache = EINA_TRUE;
4193 elm_genlist_item_update(it);
4196 EAPI const Elm_Genlist_Item_Class *
4197 elm_genlist_item_item_class_get(const Elm_Gen_Item *it)
4199 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4200 if (it->delete_me) return NULL;
4204 static Evas_Object *
4205 _elm_genlist_item_label_create(void *data,
4206 Evas_Object *obj __UNUSED__,
4207 Evas_Object *tooltip,
4208 void *it __UNUSED__)
4210 Evas_Object *label = elm_label_add(tooltip);
4213 elm_object_style_set(label, "tooltip");
4214 elm_object_text_set(label, data);
4219 _elm_genlist_item_label_del_cb(void *data,
4220 Evas_Object *obj __UNUSED__,
4221 void *event_info __UNUSED__)
4223 eina_stringshare_del(data);
4227 elm_genlist_item_tooltip_text_set(Elm_Gen_Item *it,
4230 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4231 text = eina_stringshare_add(text);
4232 elm_genlist_item_tooltip_content_cb_set(it, _elm_genlist_item_label_create,
4234 _elm_genlist_item_label_del_cb);
4238 elm_genlist_item_tooltip_content_cb_set(Elm_Gen_Item *it,
4239 Elm_Tooltip_Item_Content_Cb func,
4241 Evas_Smart_Cb del_cb)
4243 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(it, error);
4245 if ((it->tooltip.content_cb == func) && (it->tooltip.data == data))
4248 if (it->tooltip.del_cb)
4249 it->tooltip.del_cb((void *)it->tooltip.data,
4252 it->tooltip.content_cb = func;
4253 it->tooltip.data = data;
4254 it->tooltip.del_cb = del_cb;
4258 elm_widget_item_tooltip_content_cb_set(it,
4259 it->tooltip.content_cb,
4260 it->tooltip.data, NULL);
4261 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
4262 elm_widget_item_tooltip_size_restrict_disable(it, it->tooltip.free_size);
4268 if (del_cb) del_cb((void *)data, NULL, NULL);
4272 elm_genlist_item_tooltip_unset(Elm_Gen_Item *it)
4274 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4275 if ((VIEW(it)) && (it->tooltip.content_cb))
4276 elm_widget_item_tooltip_unset(it);
4278 if (it->tooltip.del_cb)
4279 it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
4280 it->tooltip.del_cb = NULL;
4281 it->tooltip.content_cb = NULL;
4282 it->tooltip.data = NULL;
4283 it->tooltip.free_size = EINA_FALSE;
4284 if (it->tooltip.style)
4285 elm_genlist_item_tooltip_style_set(it, NULL);
4289 elm_genlist_item_tooltip_style_set(Elm_Gen_Item *it,
4292 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4293 eina_stringshare_replace(&it->tooltip.style, style);
4294 if (VIEW(it)) elm_widget_item_tooltip_style_set(it, style);
4298 elm_genlist_item_tooltip_style_get(const Elm_Gen_Item *it)
4300 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4301 return it->tooltip.style;
4305 elm_genlist_item_tooltip_size_restrict_disable(Elm_Gen_Item *it, Eina_Bool disable)
4307 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4308 it->tooltip.free_size = disable;
4309 if (VIEW(it)) return elm_widget_item_tooltip_size_restrict_disable(it, disable);
4314 elm_genlist_item_tooltip_size_restrict_disabled_get(const Elm_Gen_Item *it)
4316 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4317 return it->tooltip.free_size;
4321 elm_genlist_item_cursor_set(Elm_Gen_Item *it,
4324 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4325 eina_stringshare_replace(&it->mouse_cursor, cursor);
4326 if (VIEW(it)) elm_widget_item_cursor_set(it, cursor);
4330 elm_genlist_item_cursor_get(const Elm_Gen_Item *it)
4332 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4333 return elm_widget_item_cursor_get(it);
4337 elm_genlist_item_cursor_unset(Elm_Gen_Item *it)
4339 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4340 if (!it->mouse_cursor)
4344 elm_widget_item_cursor_unset(it);
4346 eina_stringshare_del(it->mouse_cursor);
4347 it->mouse_cursor = NULL;
4351 elm_genlist_item_cursor_style_set(Elm_Gen_Item *it,
4354 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4355 elm_widget_item_cursor_style_set(it, style);
4359 elm_genlist_item_cursor_style_get(const Elm_Gen_Item *it)
4361 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4362 return elm_widget_item_cursor_style_get(it);
4366 elm_genlist_item_cursor_engine_only_set(Elm_Gen_Item *it,
4367 Eina_Bool engine_only)
4369 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4370 elm_widget_item_cursor_engine_only_set(it, engine_only);
4374 elm_genlist_item_cursor_engine_only_get(const Elm_Gen_Item *it)
4376 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4377 return elm_widget_item_cursor_engine_only_get(it);
4381 elm_genlist_horizontal_set(Evas_Object *obj,
4384 ELM_CHECK_WIDTYPE(obj, widtype);
4385 Widget_Data *wd = elm_widget_data_get(obj);
4387 if (wd->mode == mode) return;
4393 elm_genlist_horizontal_mode_set(Evas_Object *obj,
4396 elm_genlist_horizontal_set(obj, mode);
4400 elm_genlist_horizontal_get(const Evas_Object *obj)
4402 ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
4403 Widget_Data *wd = elm_widget_data_get(obj);
4404 if (!wd) return ELM_LIST_LAST;
4409 elm_genlist_horizontal_mode_get(const Evas_Object *obj)
4411 return elm_genlist_horizontal_get(obj);
4415 elm_genlist_always_select_mode_set(Evas_Object *obj,
4416 Eina_Bool always_select)
4418 elm_gen_always_select_mode_set(obj, always_select);
4422 elm_genlist_always_select_mode_get(const Evas_Object *obj)
4424 return elm_gen_always_select_mode_get(obj);
4428 elm_genlist_no_select_mode_set(Evas_Object *obj,
4429 Eina_Bool no_select)
4431 elm_gen_no_select_mode_set(obj, no_select);
4435 elm_genlist_no_select_mode_get(const Evas_Object *obj)
4437 return elm_gen_no_select_mode_get(obj);
4441 elm_genlist_compress_mode_set(Evas_Object *obj,
4444 ELM_CHECK_WIDTYPE(obj, widtype);
4445 Widget_Data *wd = elm_widget_data_get(obj);
4447 wd->compress = compress;
4448 if (!compress) elm_genlist_homogeneous_set(obj, EINA_FALSE);
4452 elm_genlist_compress_mode_get(const Evas_Object *obj)
4454 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4455 Widget_Data *wd = elm_widget_data_get(obj);
4456 if (!wd) return EINA_FALSE;
4457 return wd->compress;
4461 elm_genlist_height_for_width_mode_set(Evas_Object *obj,
4462 Eina_Bool height_for_width)
4464 ELM_CHECK_WIDTYPE(obj, widtype);
4465 Widget_Data *wd = elm_widget_data_get(obj);
4467 wd->height_for_width = !!height_for_width;
4468 if (wd->height_for_width)
4470 elm_genlist_homogeneous_set(obj, EINA_FALSE);
4471 elm_genlist_compress_mode_set(obj, EINA_TRUE);
4476 elm_genlist_height_for_width_mode_get(const Evas_Object *obj)
4478 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4479 Widget_Data *wd = elm_widget_data_get(obj);
4480 if (!wd) return EINA_FALSE;
4481 return wd->height_for_width;
4485 elm_genlist_bounce_set(Evas_Object *obj,
4489 elm_gen_bounce_set(obj, h_bounce, v_bounce);
4493 elm_genlist_bounce_get(const Evas_Object *obj,
4494 Eina_Bool *h_bounce,
4495 Eina_Bool *v_bounce)
4497 elm_gen_bounce_get(obj, h_bounce, v_bounce);
4501 elm_genlist_homogeneous_set(Evas_Object *obj,
4502 Eina_Bool homogeneous)
4504 ELM_CHECK_WIDTYPE(obj, widtype);
4505 Widget_Data *wd = elm_widget_data_get(obj);
4507 if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
4508 wd->homogeneous = homogeneous;
4512 elm_genlist_homogeneous_get(const Evas_Object *obj)
4514 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4515 Widget_Data *wd = elm_widget_data_get(obj);
4516 if (!wd) return EINA_FALSE;
4517 return wd->homogeneous;
4521 elm_genlist_block_count_set(Evas_Object *obj,
4524 ELM_CHECK_WIDTYPE(obj, widtype);
4525 Widget_Data *wd = elm_widget_data_get(obj);
4527 wd->max_items_per_block = n;
4528 wd->item_cache_max = wd->max_items_per_block * 2;
4529 _item_cache_clean(wd);
4533 elm_genlist_block_count_get(const Evas_Object *obj)
4535 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4536 Widget_Data *wd = elm_widget_data_get(obj);
4538 return wd->max_items_per_block;
4542 elm_genlist_longpress_timeout_set(Evas_Object *obj,
4545 ELM_CHECK_WIDTYPE(obj, widtype);
4546 Widget_Data *wd = elm_widget_data_get(obj);
4548 wd->longpress_timeout = timeout;
4552 elm_genlist_longpress_timeout_get(const Evas_Object *obj)
4554 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4555 Widget_Data *wd = elm_widget_data_get(obj);
4557 return wd->longpress_timeout;
4561 elm_genlist_scroller_policy_set(Evas_Object *obj,
4562 Elm_Scroller_Policy policy_h,
4563 Elm_Scroller_Policy policy_v)
4565 ELM_CHECK_WIDTYPE(obj, widtype);
4566 Widget_Data *wd = elm_widget_data_get(obj);
4567 if ((!wd) || (!wd->scr)) return;
4568 if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
4569 (policy_v >= ELM_SCROLLER_POLICY_LAST))
4571 elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
4575 elm_genlist_scroller_policy_get(const Evas_Object *obj,
4576 Elm_Scroller_Policy *policy_h,
4577 Elm_Scroller_Policy *policy_v)
4579 ELM_CHECK_WIDTYPE(obj, widtype);
4580 Widget_Data *wd = elm_widget_data_get(obj);
4581 Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
4582 if ((!wd) || (!wd->scr)) return;
4583 elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
4584 if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
4585 if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
4589 elm_genlist_realized_items_update(Evas_Object *obj)
4591 ELM_CHECK_WIDTYPE(obj, widtype);
4593 Eina_List *list, *l;
4596 list = elm_genlist_realized_items_get(obj);
4597 EINA_LIST_FOREACH(list, l, it)
4598 elm_genlist_item_update(it);
4602 elm_genlist_item_mode_set(Elm_Gen_Item *it,
4603 const char *mode_type,
4606 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4607 Widget_Data *wd = it->wd;
4612 if (!mode_type) return;
4613 if ((it->delete_me) || (it->disabled)) return;
4615 if ((wd->mode_item == it) &&
4616 (!strcmp(mode_type, wd->mode_type)) &&
4619 if (!wd->mode_item_style) return;
4620 it->mode_set = mode_set;
4624 EINA_LIST_FOREACH(wd->selected, l, it2)
4626 elm_gen_item_selected_set(it2, EINA_FALSE);
4630 it2 = elm_genlist_selected_item_get(wd->obj);
4631 if ((it2) && (it2->realized))
4632 elm_gen_item_selected_set(it2, EINA_FALSE);
4635 if (((wd->mode_type) && (strcmp(mode_type, wd->mode_type))) ||
4637 ((it == wd->mode_item) && (!mode_set)))
4638 _item_mode_unset(wd);
4640 eina_stringshare_replace(&wd->mode_type, mode_type);
4641 if (mode_set) _item_mode_set(it);
4646 elm_genlist_mode_item_style_get(const Evas_Object *obj)
4648 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4649 Widget_Data *wd = elm_widget_data_get(obj);
4650 if (!wd) return NULL;
4651 return wd->mode_item_style;
4655 elm_genlist_mode_item_style_set(Evas_Object *obj, const char *style)
4657 ELM_CHECK_WIDTYPE(obj, widtype);
4658 Widget_Data *wd = elm_widget_data_get(obj);
4660 if ((style == wd->mode_item_style) || (style && wd->mode_item_style &&
4661 (!strcmp(style, wd->mode_item_style))))
4663 eina_stringshare_replace(&wd->mode_item_style, style);
4664 elm_genlist_realized_items_update(obj);
4668 elm_genlist_mode_get(const Evas_Object *obj)
4670 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4671 Widget_Data *wd = elm_widget_data_get(obj);
4672 if (!wd) return NULL;
4673 return wd->mode_type;
4676 EAPI const Elm_Gen_Item *
4677 elm_genlist_mode_item_get(const Evas_Object *obj)
4679 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4680 Widget_Data *wd = elm_widget_data_get(obj);
4681 if (!wd) return NULL;
4682 return wd->mode_item;
4686 elm_genlist_reorder_mode_set(Evas_Object *obj,
4687 Eina_Bool reorder_mode)
4689 ELM_CHECK_WIDTYPE(obj, widtype);
4690 Widget_Data *wd = elm_widget_data_get(obj);
4692 wd->reorder_mode = reorder_mode;
4696 elm_genlist_reorder_mode_get(const Evas_Object *obj)
4698 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4699 Widget_Data *wd = elm_widget_data_get(obj);
4700 if (!wd) return EINA_FALSE;
4701 return wd->reorder_mode;