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_contents, *mode_states, *mode_content_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 if ((it->delete_me) || (!it->highlighted)) return;
710 edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm");
711 if (!it->item->nostacking)
713 if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even) evas_object_lower(VIEW(it));
714 else evas_object_raise(VIEW(it));
716 it->highlighted = EINA_FALSE;
720 _item_block_del(Elm_Gen_Item *it)
723 Item_Block *itb = it->item->block;
725 itb->items = eina_list_remove(itb->items, it);
727 itb->changed = EINA_TRUE;
728 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
729 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
732 il = EINA_INLIST_GET(itb);
733 Item_Block *itbn = (Item_Block *)(il->next);
735 it->parent->item->items = eina_list_remove(it->parent->item->items, it);
737 it->wd->blocks = eina_inlist_remove(it->wd->blocks, il);
739 if (itbn) itbn->changed = EINA_TRUE;
743 if (itb->count < itb->wd->max_items_per_block/2)
745 il = EINA_INLIST_GET(itb);
746 Item_Block *itbp = (Item_Block *)(il->prev);
747 Item_Block *itbn = (Item_Block *)(il->next);
748 if ((itbp) && ((itbp->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
752 EINA_LIST_FREE(itb->items, it2)
754 it2->item->block = itbp;
755 itbp->items = eina_list_append(itbp->items, it2);
757 itbp->changed = EINA_TRUE;
759 it->wd->blocks = eina_inlist_remove(it->wd->blocks,
760 EINA_INLIST_GET(itb));
763 else if ((itbn) && ((itbn->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
767 Eina_List *last = eina_list_last(itb->items);
768 Elm_Gen_Item *it2 = last->data;
770 it2->item->block = itbn;
771 itb->items = eina_list_remove_list(itb->items, last);
772 itbn->items = eina_list_prepend(itbn->items, it2);
774 itbn->changed = EINA_TRUE;
777 eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb));
785 _item_del(Elm_Gen_Item *it)
787 Evas_Object *obj = WIDGET(it);
789 evas_event_freeze(evas_object_evas_get(obj));
790 elm_genlist_item_subitems_clear(it);
791 if (it->wd->show_item == it) it->wd->show_item = NULL;
792 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE);
793 if (it->item->block) _item_block_del(it);
794 if (it->item->queued)
795 it->wd->queue = eina_list_remove(it->wd->queue, it);
796 if (it->wd->anchor_item == it)
798 it->wd->anchor_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
799 if (!it->wd->anchor_item)
800 it->wd->anchor_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
803 it->parent->item->items = eina_list_remove(it->parent->item->items, it);
804 if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
805 elm_gen_item_del_serious(it);
806 evas_event_thaw(evas_object_evas_get(obj));
807 evas_event_thaw_eval(evas_object_evas_get(obj));
811 _clear_cb(Widget_Data *wd)
813 wd->anchor_item = NULL;
816 Item_Block *itb = (Item_Block *)(wd->blocks);
818 wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
819 if (itb->items) eina_list_free(itb->items);
822 if (wd->queue_idle_enterer)
824 ecore_idle_enterer_del(wd->queue_idle_enterer);
825 wd->queue_idle_enterer = NULL;
827 if (wd->must_recalc_idler)
829 ecore_idler_del(wd->must_recalc_idler);
830 wd->must_recalc_idler = NULL;
832 if (wd->queue) wd->queue = eina_list_free(wd->queue);
833 if (wd->reorder_move_animator)
835 ecore_animator_del(wd->reorder_move_animator);
836 wd->reorder_move_animator = NULL;
838 wd->show_item = NULL;
839 wd->reorder_old_pan_y = 0;
843 _item_unselect(Elm_Gen_Item *it)
845 if ((it->delete_me) || (!it->selected)) return;
846 it->selected = EINA_FALSE;
847 it->wd->selected = eina_list_remove(it->wd->selected, it);
848 evas_object_smart_callback_call(WIDGET(it), SIG_UNSELECTED, it);
852 _mouse_move(void *data,
853 Evas *evas __UNUSED__,
857 Elm_Gen_Item *it = data;
858 Evas_Event_Mouse_Move *ev = event_info;
859 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
860 Evas_Coord ox, oy, ow, oh, it_scrl_y, y_pos;
862 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
864 if (!it->wd->on_hold)
866 it->wd->on_hold = EINA_TRUE;
867 if (!it->wd->wasselected)
869 _item_unhighlight(it);
874 if (it->wd->multitouched)
876 it->wd->cur_x = ev->cur.canvas.x;
877 it->wd->cur_y = ev->cur.canvas.y;
880 if ((it->dragging) && (it->down))
882 if (it->wd->movements == SWIPE_MOVES) it->wd->swipe = EINA_TRUE;
885 it->wd->history[it->wd->movements].x = ev->cur.canvas.x;
886 it->wd->history[it->wd->movements].y = ev->cur.canvas.y;
887 if (abs((it->wd->history[it->wd->movements].x -
888 it->wd->history[0].x)) > 40)
889 it->wd->swipe = EINA_TRUE;
895 ecore_timer_del(it->long_timer);
896 it->long_timer = NULL;
898 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG, it);
901 if ((!it->down) /* || (it->wd->on_hold)*/ || (it->wd->longpressed))
905 ecore_timer_del(it->long_timer);
906 it->long_timer = NULL;
908 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
910 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
911 it_scrl_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
913 if (!it->wd->reorder_start_y)
914 it->wd->reorder_start_y = it->item->block->y + it->y;
918 else if (it_scrl_y + it->wd->reorder_it->item->h > oy + oh)
919 y_pos = oy + oh - it->wd->reorder_it->item->h;
923 _item_position(it, VIEW(it), it->item->scrl_x, y_pos);
925 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
926 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
930 if (!it->display_only)
931 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
932 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
933 x = ev->cur.canvas.x - x;
934 y = ev->cur.canvas.y - y;
937 if (adx < 0) adx = -dx;
940 if (ady < 0) ady = -dy;
943 if ((adx > minw) || (ady > minh))
945 it->dragging = EINA_TRUE;
948 ecore_timer_del(it->long_timer);
949 it->long_timer = NULL;
951 if (!it->wd->wasselected)
953 _item_unhighlight(it);
959 evas_object_smart_callback_call(WIDGET(it),
960 SIG_DRAG_START_UP, it);
964 evas_object_smart_callback_call(WIDGET(it),
965 SIG_DRAG_START_LEFT, it);
967 evas_object_smart_callback_call(WIDGET(it),
968 SIG_DRAG_START_RIGHT, it);
974 evas_object_smart_callback_call(WIDGET(it),
975 SIG_DRAG_START_DOWN, it);
979 evas_object_smart_callback_call(WIDGET(it),
980 SIG_DRAG_START_LEFT, it);
982 evas_object_smart_callback_call(WIDGET(it),
983 SIG_DRAG_START_RIGHT, it);
990 _long_press(void *data)
992 Elm_Gen_Item *it = data, *it_tmp;
995 it->long_timer = NULL;
996 if ((it->disabled) || (it->dragging) || (it->display_only))
997 return ECORE_CALLBACK_CANCEL;
998 it->wd->longpressed = EINA_TRUE;
999 evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it);
1000 if ((it->wd->reorder_mode) && (!it->group))
1002 it->wd->reorder_it = it;
1003 it->wd->reorder_start_y = 0;
1005 evas_object_raise(VIEW(it));
1006 elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
1007 elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_FALSE);
1009 list = elm_genlist_realized_items_get(it->wd->obj);
1010 EINA_LIST_FOREACH(list, l, it_tmp)
1012 if (it != it_tmp) _item_unselect(it_tmp);
1014 if (elm_genlist_item_expanded_get(it))
1016 elm_genlist_item_expanded_set(it, EINA_FALSE);
1017 return ECORE_CALLBACK_RENEW;
1019 edje_object_signal_emit(VIEW(it), "elm,state,reorder,enabled", "elm");
1021 return ECORE_CALLBACK_CANCEL;
1025 _swipe(Elm_Gen_Item *it)
1030 if ((it->display_only) || (it->disabled)) return;
1031 it->wd->swipe = EINA_FALSE;
1032 for (i = 0; i < it->wd->movements; i++)
1034 sum += it->wd->history[i].x;
1035 if (abs(it->wd->history[0].y - it->wd->history[i].y) > 10) return;
1038 sum /= it->wd->movements;
1039 if (abs(sum - it->wd->history[0].x) <= 10) return;
1040 evas_object_smart_callback_call(WIDGET(it), SIG_SWIPE, it);
1044 _swipe_cancel(void *data)
1046 Elm_Gen_Item *it = data;
1048 if (!it) return ECORE_CALLBACK_CANCEL;
1049 it->wd->swipe = EINA_FALSE;
1050 it->wd->movements = 0;
1051 return ECORE_CALLBACK_RENEW;
1055 _multi_cancel(void *data)
1057 Widget_Data *wd = data;
1059 if (!wd) return ECORE_CALLBACK_CANCEL;
1060 wd->multi_timeout = EINA_TRUE;
1061 return ECORE_CALLBACK_RENEW;
1065 _multi_touch_gesture_eval(void *data)
1067 Elm_Gen_Item *it = data;
1069 it->wd->multitouched = EINA_FALSE;
1070 if (it->wd->multi_timer)
1072 ecore_timer_del(it->wd->multi_timer);
1073 it->wd->multi_timer = NULL;
1075 if (it->wd->multi_timeout)
1077 it->wd->multi_timeout = EINA_FALSE;
1081 Evas_Coord minw = 0, minh = 0;
1082 Evas_Coord off_x, off_y, off_mx, off_my;
1084 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1085 off_x = abs(it->wd->cur_x - it->wd->prev_x);
1086 off_y = abs(it->wd->cur_y - it->wd->prev_y);
1087 off_mx = abs(it->wd->cur_mx - it->wd->prev_mx);
1088 off_my = abs(it->wd->cur_my - it->wd->prev_my);
1090 if (((off_x > minw) || (off_y > minh)) && ((off_mx > minw) || (off_my > minh)))
1092 if ((off_x + off_mx) > (off_y + off_my))
1094 if ((it->wd->cur_x > it->wd->prev_x) && (it->wd->cur_mx > it->wd->prev_mx))
1095 evas_object_smart_callback_call(WIDGET(it),
1096 SIG_MULTI_SWIPE_RIGHT, it);
1097 else 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_LEFT, it);
1100 else if (abs(it->wd->cur_x - it->wd->cur_mx) > abs(it->wd->prev_x - it->wd->prev_mx))
1101 evas_object_smart_callback_call(WIDGET(it),
1102 SIG_MULTI_PINCH_OUT, it);
1104 evas_object_smart_callback_call(WIDGET(it),
1105 SIG_MULTI_PINCH_IN, it);
1109 if ((it->wd->cur_y > it->wd->prev_y) && (it->wd->cur_my > it->wd->prev_my))
1110 evas_object_smart_callback_call(WIDGET(it),
1111 SIG_MULTI_SWIPE_DOWN, it);
1112 else 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_UP, it);
1115 else if (abs(it->wd->cur_y - it->wd->cur_my) > abs(it->wd->prev_y - it->wd->prev_my))
1116 evas_object_smart_callback_call(WIDGET(it),
1117 SIG_MULTI_PINCH_OUT, it);
1119 evas_object_smart_callback_call(WIDGET(it),
1120 SIG_MULTI_PINCH_IN, it);
1123 it->wd->multi_timeout = EINA_FALSE;
1127 _multi_down(void *data,
1128 Evas *evas __UNUSED__,
1129 Evas_Object *obj __UNUSED__,
1132 Elm_Gen_Item *it = data;
1133 Evas_Event_Multi_Down *ev = event_info;
1135 if ((it->wd->multi_device != 0) || (it->wd->multitouched) || (it->wd->multi_timeout)) return;
1136 it->wd->multi_device = ev->device;
1137 it->wd->multi_down = EINA_TRUE;
1138 it->wd->multitouched = EINA_TRUE;
1139 it->wd->prev_mx = ev->canvas.x;
1140 it->wd->prev_my = ev->canvas.y;
1141 if (!it->wd->wasselected)
1143 _item_unhighlight(it);
1146 it->wd->wasselected = EINA_FALSE;
1147 it->wd->longpressed = EINA_FALSE;
1150 ecore_timer_del(it->long_timer);
1151 it->long_timer = NULL;
1155 it->dragging = EINA_FALSE;
1156 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
1158 if (it->item->swipe_timer)
1160 ecore_timer_del(it->item->swipe_timer);
1161 it->item->swipe_timer = NULL;
1163 if (it->wd->on_hold)
1165 it->wd->swipe = EINA_FALSE;
1166 it->wd->movements = 0;
1167 it->wd->on_hold = EINA_FALSE;
1172 _multi_up(void *data,
1173 Evas *evas __UNUSED__,
1174 Evas_Object *obj __UNUSED__,
1177 Elm_Gen_Item *it = data;
1178 Evas_Event_Multi_Up *ev = event_info;
1180 if (it->wd->multi_device != ev->device) return;
1181 it->wd->multi_device = 0;
1182 it->wd->multi_down = EINA_FALSE;
1183 if (it->wd->mouse_down) return;
1184 _multi_touch_gesture_eval(data);
1188 _multi_move(void *data,
1189 Evas *evas __UNUSED__,
1190 Evas_Object *obj __UNUSED__,
1193 Elm_Gen_Item *it = data;
1194 Evas_Event_Multi_Move *ev = event_info;
1196 if (it->wd->multi_device != ev->device) return;
1197 it->wd->cur_mx = ev->cur.canvas.x;
1198 it->wd->cur_my = ev->cur.canvas.y;
1202 _mouse_down(void *data,
1203 Evas *evas __UNUSED__,
1207 Elm_Gen_Item *it = data;
1208 Evas_Event_Mouse_Down *ev = event_info;
1211 if (ev->button != 1) return;
1212 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1214 it->wd->on_hold = EINA_TRUE;
1217 it->down = EINA_TRUE;
1218 it->dragging = EINA_FALSE;
1219 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1220 it->dx = ev->canvas.x - x;
1221 it->dy = ev->canvas.y - y;
1222 it->wd->mouse_down = EINA_TRUE;
1223 if (!it->wd->multitouched)
1225 it->wd->prev_x = ev->canvas.x;
1226 it->wd->prev_y = ev->canvas.y;
1227 it->wd->multi_timeout = EINA_FALSE;
1228 if (it->wd->multi_timer) ecore_timer_del(it->wd->multi_timer);
1229 it->wd->multi_timer = ecore_timer_add(1, _multi_cancel, it->wd);
1231 it->wd->longpressed = EINA_FALSE;
1232 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1233 else it->wd->on_hold = EINA_FALSE;
1234 if (it->wd->on_hold) return;
1235 it->wd->wasselected = it->selected;
1236 _item_highlight(it);
1237 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
1238 if ((!it->disabled) && (!it->display_only))
1240 evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
1241 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
1243 if (it->long_timer) ecore_timer_del(it->long_timer);
1244 if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
1245 it->item->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
1247 it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press,
1250 it->long_timer = NULL;
1251 it->wd->swipe = EINA_FALSE;
1252 it->wd->movements = 0;
1256 _mouse_up(void *data,
1257 Evas *evas __UNUSED__,
1258 Evas_Object *obj __UNUSED__,
1261 Elm_Gen_Item *it = data;
1262 Evas_Event_Mouse_Up *ev = event_info;
1263 Eina_Bool dragged = EINA_FALSE;
1265 if (ev->button != 1) return;
1266 it->down = EINA_FALSE;
1267 it->wd->mouse_down = EINA_FALSE;
1268 if (it->wd->multitouched)
1270 if ((!it->wd->multi) && (!it->selected) && (it->highlighted)) _item_unhighlight(it);
1271 if (it->wd->multi_down) return;
1272 _multi_touch_gesture_eval(data);
1275 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1276 else it->wd->on_hold = EINA_FALSE;
1279 ecore_timer_del(it->long_timer);
1280 it->long_timer = NULL;
1284 it->dragging = EINA_FALSE;
1285 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
1288 if (it->item->swipe_timer)
1290 ecore_timer_del(it->item->swipe_timer);
1291 it->item->swipe_timer = NULL;
1293 if (it->wd->multi_timer)
1295 ecore_timer_del(it->wd->multi_timer);
1296 it->wd->multi_timer = NULL;
1297 it->wd->multi_timeout = EINA_FALSE;
1299 if (it->wd->on_hold)
1301 if (it->wd->swipe) _swipe(data);
1302 it->wd->longpressed = EINA_FALSE;
1303 it->wd->on_hold = EINA_FALSE;
1306 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
1308 Evas_Coord it_scrl_y = ev->canvas.y - it->wd->reorder_it->dy;
1310 if (it->wd->reorder_rel && (it->wd->reorder_it->parent == it->wd->reorder_rel->parent))
1312 if (it_scrl_y <= it->wd->reorder_rel->item->scrl_y)
1313 _item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
1315 _item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
1319 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1320 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1322 edje_object_signal_emit(VIEW(it), "elm,state,reorder,disabled", "elm");
1323 it->wd->reorder_it = it->wd->reorder_rel = NULL;
1324 elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
1325 elm_smart_scroller_bounce_allow_set(it->wd->scr, it->wd->h_bounce, it->wd->v_bounce);
1327 if (it->wd->longpressed)
1329 it->wd->longpressed = EINA_FALSE;
1330 if (!it->wd->wasselected)
1332 _item_unhighlight(it);
1335 it->wd->wasselected = EINA_FALSE;
1340 if (it->want_unrealize)
1342 elm_gen_item_unrealize(it, EINA_FALSE);
1343 if (it->item->block->want_unrealize)
1344 _item_block_unrealize(it->item->block);
1347 if ((it->disabled) || (dragged) || (it->display_only)) return;
1348 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1353 _item_highlight(it);
1358 _item_unhighlight(it);
1366 Widget_Data *wd = it->wd;
1369 while (wd->selected)
1371 _item_unhighlight(wd->selected->data);
1372 _item_unselect(wd->selected->data);
1378 const Eina_List *l, *l_next;
1381 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
1384 _item_unhighlight(it2);
1385 _item_unselect(it2);
1387 //_item_highlight(it);
1390 _item_highlight(it);
1396 _signal_expand_toggle(void *data,
1397 Evas_Object *obj __UNUSED__,
1398 const char *emission __UNUSED__,
1399 const char *source __UNUSED__)
1401 Elm_Gen_Item *it = data;
1403 if (it->item->expanded)
1404 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it);
1406 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it);
1410 _signal_expand(void *data,
1411 Evas_Object *obj __UNUSED__,
1412 const char *emission __UNUSED__,
1413 const char *source __UNUSED__)
1415 Elm_Gen_Item *it = data;
1417 if (!it->item->expanded)
1418 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it);
1422 _signal_contract(void *data,
1423 Evas_Object *obj __UNUSED__,
1424 const char *emission __UNUSED__,
1425 const char *source __UNUSED__)
1427 Elm_Gen_Item *it = data;
1429 if (it->item->expanded)
1430 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it);
1434 _scr_hold_timer_cb(void *data)
1436 if (!data) return ECORE_CALLBACK_CANCEL;
1437 Widget_Data *wd = data;
1438 elm_smart_scroller_hold_set(wd->scr, EINA_FALSE);
1439 wd->scr_hold_timer = NULL;
1440 return ECORE_CALLBACK_CANCEL;
1444 _mode_finished_signal_cb(void *data,
1446 const char *emission __UNUSED__,
1447 const char *source __UNUSED__)
1451 Elm_Gen_Item *it = data;
1452 if ((it->delete_me) || (!it->realized) || (!it->item->mode_view)) return;
1454 Evas *te = evas_object_evas_get(obj);
1456 evas_event_freeze(te);
1457 it->item->nocache = EINA_FALSE;
1458 _mode_item_unrealize(it);
1459 if (it->item->group_item)
1460 evas_object_raise(it->item->VIEW(group_item));
1461 snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished", it->wd->mode_type);
1462 edje_object_signal_callback_del_full(obj, buf, "elm", _mode_finished_signal_cb, it);
1463 evas_event_thaw(te);
1464 evas_event_thaw_eval(te);
1468 _item_cache_clean(Widget_Data *wd)
1470 evas_event_freeze(evas_object_evas_get(wd->obj));
1471 while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max))
1475 itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache);
1476 wd->item_cache = eina_inlist_remove(wd->item_cache,
1477 wd->item_cache->last);
1478 wd->item_cache_count--;
1479 if (itc->spacer) evas_object_del(itc->spacer);
1480 if (itc->base_view) evas_object_del(itc->base_view);
1481 if (itc->item_style) eina_stringshare_del(itc->item_style);
1484 evas_event_thaw(evas_object_evas_get(wd->obj));
1485 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
1489 _item_cache_zero(Widget_Data *wd)
1491 int pmax = wd->item_cache_max;
1492 wd->item_cache_max = 0;
1493 _item_cache_clean(wd);
1494 wd->item_cache_max = pmax;
1498 _item_cache_add(Elm_Gen_Item *it)
1502 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1503 if (it->wd->item_cache_max <= 0)
1505 evas_object_del(VIEW(it));
1507 evas_object_del(it->spacer);
1509 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1510 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1514 it->wd->item_cache_count++;
1515 itc = calloc(1, sizeof(Item_Cache));
1516 it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache,
1517 EINA_INLIST_GET(itc));
1518 itc->spacer = it->spacer;
1520 itc->base_view = VIEW(it);
1522 evas_object_hide(itc->base_view);
1523 evas_object_move(itc->base_view, -9999, -9999);
1524 itc->item_style = eina_stringshare_add(it->itc->item_style);
1525 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
1526 itc->compress = (it->wd->compress);
1527 itc->selected = it->selected;
1528 itc->disabled = it->disabled;
1529 itc->expanded = it->item->expanded;
1532 ecore_timer_del(it->long_timer);
1533 it->long_timer = NULL;
1535 if (it->item->swipe_timer)
1537 ecore_timer_del(it->item->swipe_timer);
1538 it->item->swipe_timer = NULL;
1540 // FIXME: other callbacks?
1541 edje_object_signal_callback_del_full(itc->base_view,
1542 "elm,action,expand,toggle",
1543 "elm", _signal_expand_toggle, it);
1544 edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand",
1546 _signal_expand, it);
1547 edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract",
1548 "elm", _signal_contract, it);
1549 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_DOWN,
1551 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP,
1553 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_MOVE,
1555 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_DOWN,
1557 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_UP,
1559 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_MOVE,
1561 _item_cache_clean(it->wd);
1562 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1563 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1567 _item_cache_find(Elm_Gen_Item *it)
1572 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
1573 EINA_INLIST_FOREACH(it->wd->item_cache, itc)
1575 if ((itc->selected) || (itc->disabled) || (itc->expanded))
1577 if ((itc->tree == tree) &&
1578 (itc->compress == it->wd->compress) &&
1579 (!strcmp(it->itc->item_style, itc->item_style)))
1581 it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
1582 EINA_INLIST_GET(itc));
1583 it->wd->item_cache_count--;
1591 _elm_genlist_item_odd_even_update(Elm_Gen_Item *it)
1593 if (!it->item->nostacking)
1595 if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even)
1596 evas_object_lower(VIEW(it));
1598 evas_object_raise(VIEW(it));
1601 if (it->item->order_num_in & 0x1)
1602 edje_object_signal_emit(VIEW(it), "elm,state,odd", "elm");
1604 edje_object_signal_emit(VIEW(it), "elm,state,even", "elm");
1608 _elm_genlist_item_state_update(Elm_Gen_Item *it, Item_Cache *itc)
1612 if (it->selected != itc->selected)
1615 edje_object_signal_emit(VIEW(it),
1616 "elm,state,selected", "elm");
1618 if (it->disabled != itc->disabled)
1621 edje_object_signal_emit(VIEW(it),
1622 "elm,state,disabled", "elm");
1624 if (it->item->expanded != itc->expanded)
1626 if (it->item->expanded)
1627 edje_object_signal_emit(VIEW(it),
1628 "elm,state,expanded", "elm");
1634 edje_object_signal_emit(VIEW(it),
1635 "elm,state,selected", "elm");
1637 edje_object_signal_emit(VIEW(it),
1638 "elm,state,disabled", "elm");
1639 if (it->item->expanded)
1640 edje_object_signal_emit(VIEW(it),
1641 "elm,state,expanded", "elm");
1646 _item_cache_free(Item_Cache *itc)
1648 if (itc->spacer) evas_object_del(itc->spacer);
1649 if (itc->base_view) evas_object_del(itc->base_view);
1650 if (itc->item_style) eina_stringshare_del(itc->item_style);
1655 _item_del_hook(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1657 Elm_Gen_Item *it = event_info;
1659 if (it->wd->last_selected_item == it)
1660 it->wd->last_selected_item = NULL;
1664 _item_label_realize(Elm_Gen_Item *it,
1665 Evas_Object *target,
1668 if (it->itc->func.label_get)
1673 *source = elm_widget_stringlist_get(edje_object_data_get(target, "labels"));
1674 EINA_LIST_FOREACH(*source, l, key)
1676 char *s = it->itc->func.label_get
1677 ((void *)it->base.data, WIDGET(it), key);
1681 edje_object_part_text_set(target, key, s);
1686 edje_object_part_text_set(target, key, "");
1693 _item_content_realize(Elm_Gen_Item *it,
1694 Evas_Object *target,
1697 Eina_List *res = NULL;
1699 if (it->itc->func.content_get)
1703 Evas_Object *ic = NULL;
1705 *source = elm_widget_stringlist_get(edje_object_data_get(target, "contents"));
1706 EINA_LIST_FOREACH(*source, l, key)
1708 if (it->itc->func.content_get)
1709 ic = it->itc->func.content_get
1710 ((void *)it->base.data, WIDGET(it), key);
1713 res = eina_list_append(res, ic);
1714 edje_object_part_swallow(target, key, ic);
1715 evas_object_show(ic);
1716 elm_widget_sub_object_add(WIDGET(it), ic);
1718 elm_widget_disabled_set(ic, EINA_TRUE);
1727 _item_state_realize(Elm_Gen_Item *it,
1728 Evas_Object *target,
1731 if (it->itc->func.state_get)
1737 *source = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
1738 EINA_LIST_FOREACH(*source, l, key)
1740 Eina_Bool on = it->itc->func.state_get
1741 ((void *)it->base.data, WIDGET(it), key);
1745 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
1746 edje_object_signal_emit(target, buf, "elm");
1750 snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
1751 edje_object_signal_emit(target, buf, "elm");
1758 _item_realize(Elm_Gen_Item *it,
1763 const char *treesize;
1765 int depth, tsize = 20;
1766 Item_Cache *itc = NULL;
1768 if (it->delete_me) return;
1769 //evas_event_freeze(evas_object_evas_get(it->wd->obj));
1772 if (it->item->order_num_in != in)
1774 it->item->order_num_in = in;
1775 _elm_genlist_item_odd_even_update(it);
1776 _elm_genlist_item_state_update(it, NULL);
1778 //evas_event_thaw(evas_object_evas_get(it->wd->obj));
1779 //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1782 it->item->order_num_in = in;
1784 if (it->item->nocache)
1785 it->item->nocache = EINA_FALSE;
1787 itc = _item_cache_find(it);
1790 VIEW(it) = itc->base_view;
1791 itc->base_view = NULL;
1792 it->spacer = itc->spacer;
1797 const char *stacking_even;
1798 const char *stacking;
1800 VIEW(it) = edje_object_add(evas_object_evas_get(WIDGET(it)));
1801 edje_object_scale_set(VIEW(it),
1802 elm_widget_scale_get(WIDGET(it)) *
1803 _elm_config->scale);
1804 evas_object_smart_member_add(VIEW(it), it->wd->pan_smart);
1805 elm_widget_sub_object_add(WIDGET(it), VIEW(it));
1807 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS)
1808 strncpy(buf, "tree", sizeof(buf));
1809 else strncpy(buf, "item", sizeof(buf));
1810 if (it->wd->compress)
1811 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
1813 strncat(buf, "/", sizeof(buf) - strlen(buf));
1814 strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf));
1816 _elm_theme_object_set(WIDGET(it), VIEW(it), "genlist", buf,
1817 elm_widget_style_get(WIDGET(it)));
1819 stacking_even = edje_object_data_get(VIEW(it), "stacking_even");
1820 if (!stacking_even) stacking_even = "above";
1821 it->item->stacking_even = !!strcmp("above", stacking_even);
1823 stacking = edje_object_data_get(VIEW(it), "stacking");
1824 if (!stacking) stacking = "yes";
1825 it->item->nostacking = !!strcmp("yes", stacking);
1827 edje_object_mirrored_set(VIEW(it),
1828 elm_widget_mirrored_get(WIDGET(it)));
1830 evas_object_rectangle_add(evas_object_evas_get(WIDGET(it)));
1831 evas_object_color_set(it->spacer, 0, 0, 0, 0);
1832 elm_widget_sub_object_add(WIDGET(it), it->spacer);
1835 _elm_genlist_item_odd_even_update(it);
1837 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
1839 if (!it2->parent->group) depth += 1;
1841 it->item->expanded_depth = depth;
1842 treesize = edje_object_data_get(VIEW(it), "treesize");
1843 if (treesize) tsize = atoi(treesize);
1844 evas_object_size_hint_min_set(it->spacer,
1845 (depth * tsize) * _elm_config->scale, 1);
1846 edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer);
1849 edje_object_signal_callback_add(VIEW(it),
1850 "elm,action,expand,toggle",
1851 "elm", _signal_expand_toggle, it);
1852 edje_object_signal_callback_add(VIEW(it), "elm,action,expand",
1853 "elm", _signal_expand, it);
1854 edje_object_signal_callback_add(VIEW(it), "elm,action,contract",
1855 "elm", _signal_contract, it);
1856 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN,
1858 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_UP,
1860 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
1862 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_DOWN,
1864 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_UP,
1866 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_MOVE,
1869 _elm_genlist_item_state_update(it, itc);
1872 if ((calc) && (it->wd->homogeneous) &&
1873 ((it->wd->item_width) ||
1874 ((it->wd->item_width) && (it->wd->group_item_width))))
1876 /* homogenous genlist shortcut */
1877 if (!it->item->mincalcd)
1881 it->item->w = it->item->minw = it->wd->group_item_width;
1882 it->item->h = it->item->minh = it->wd->group_item_height;
1886 it->item->w = it->item->minw = it->wd->item_width;
1887 it->item->h = it->item->minh = it->wd->item_height;
1889 it->item->mincalcd = EINA_TRUE;
1894 /* FIXME: If you see that assert, please notify us and we
1895 will clean our mess */
1896 assert(eina_list_count(it->content_objs) == 0);
1898 _item_label_realize(it, VIEW(it), &it->labels);
1899 it->content_objs = _item_content_realize(it, VIEW(it), &it->contents);
1900 _item_state_realize(it, VIEW(it), &it->states);
1902 if (!it->item->mincalcd)
1904 Evas_Coord mw = -1, mh = -1;
1906 if (!it->display_only)
1907 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1908 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
1909 edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw,
1911 if (!it->display_only)
1912 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1913 it->item->w = it->item->minw = mw;
1914 it->item->h = it->item->minh = mh;
1915 it->item->mincalcd = EINA_TRUE;
1917 if ((!it->wd->group_item_width) && (it->group))
1919 it->wd->group_item_width = mw;
1920 it->wd->group_item_height = mh;
1922 else if ((!it->wd->item_width) && (it->item->flags == ELM_GENLIST_ITEM_NONE))
1924 it->wd->item_width = mw;
1925 it->wd->item_height = mh;
1928 if (!calc) evas_object_show(VIEW(it));
1931 if (it->tooltip.content_cb)
1933 elm_widget_item_tooltip_content_cb_set(it,
1934 it->tooltip.content_cb,
1935 it->tooltip.data, NULL);
1936 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
1937 elm_widget_item_tooltip_size_restrict_disable(it, it->tooltip.free_size);
1940 if (it->mouse_cursor)
1941 elm_widget_item_cursor_set(it, it->mouse_cursor);
1943 it->realized = EINA_TRUE;
1944 it->want_unrealize = EINA_FALSE;
1946 if (itc) _item_cache_free(itc);
1947 //evas_event_thaw(evas_object_evas_get(it->wd->obj));
1948 //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1950 evas_object_smart_callback_call(WIDGET(it), SIG_REALIZED, it);
1951 edje_object_message_signal_process(VIEW(it));
1955 _item_unrealize_cb(Elm_Gen_Item *it)
1957 if (it->item->nocache)
1959 evas_object_del(VIEW(it));
1961 evas_object_del(it->spacer);
1966 edje_object_mirrored_set(VIEW(it),
1967 elm_widget_mirrored_get(WIDGET(it)));
1968 edje_object_scale_set(VIEW(it),
1969 elm_widget_scale_get(WIDGET(it))
1970 * _elm_config->scale);
1971 _item_cache_add(it);
1974 _mode_item_unrealize(it);
1976 it->realized = EINA_FALSE;
1977 it->want_unrealize = EINA_FALSE;
1981 _item_block_recalc(Item_Block *itb,
1987 Evas_Coord minw = 0, minh = 0;
1988 Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE;
1991 //evas_event_freeze(evas_object_evas_get(itb->wd->obj));
1993 EINA_LIST_FOREACH(itb->items, l, it)
1995 if (it->delete_me) continue;
1996 showme |= it->item->showme;
2001 if (!it->item->mincalcd) changed = EINA_TRUE;
2004 _item_realize(it, in, EINA_TRUE);
2005 elm_gen_item_unrealize(it, EINA_TRUE);
2010 _item_realize(it, in, EINA_TRUE);
2011 elm_gen_item_unrealize(it, EINA_TRUE);
2015 _item_realize(it, in, EINA_FALSE);
2016 minh += it->item->minh;
2017 if (minw < it->item->minw) minw = it->item->minw;
2025 itb->changed = EINA_FALSE;
2026 //evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2027 //evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2032 _item_block_realize(Item_Block *itb)
2034 if (itb->realized) return;
2035 itb->realized = EINA_TRUE;
2036 itb->want_unrealize = EINA_FALSE;
2040 _item_block_unrealize(Item_Block *itb)
2044 Eina_Bool dragging = EINA_FALSE;
2046 if (!itb->realized) return;
2047 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2048 EINA_LIST_FOREACH(itb->items, l, it)
2054 dragging = EINA_TRUE;
2055 it->want_unrealize = EINA_TRUE;
2058 elm_gen_item_unrealize(it, EINA_FALSE);
2063 itb->realized = EINA_FALSE;
2064 itb->want_unrealize = EINA_TRUE;
2067 itb->want_unrealize = EINA_FALSE;
2068 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2069 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2073 _get_space_for_reorder_item(Elm_Gen_Item *it)
2075 Evas_Coord rox, roy, row, roh, oy, oh;
2076 Eina_Bool top = EINA_FALSE;
2077 Elm_Gen_Item *reorder_it = it->wd->reorder_it;
2078 if (!reorder_it) return 0;
2080 evas_object_geometry_get(it->wd->pan_smart, NULL, &oy, NULL, &oh);
2081 evas_object_geometry_get(it->wd->VIEW(reorder_it), &rox, &roy, &row, &roh);
2083 if ((it->wd->reorder_start_y < it->item->block->y) &&
2084 (roy - oy + (roh / 2) >= it->item->block->y - it->wd->pan_y))
2086 it->item->block->reorder_offset = it->wd->reorder_it->item->h * -1;
2087 if (it->item->block->count == 1)
2088 it->wd->reorder_rel = it;
2090 else if ((it->wd->reorder_start_y >= it->item->block->y) &&
2091 (roy - oy + (roh / 2) <= it->item->block->y - it->wd->pan_y))
2093 it->item->block->reorder_offset = it->wd->reorder_it->item->h;
2096 it->item->block->reorder_offset = 0;
2098 it->item->scrl_y += it->item->block->reorder_offset;
2100 top = (ELM_RECTS_INTERSECT(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h,
2101 rox, roy + (roh / 2), row, 1));
2104 it->wd->reorder_rel = it;
2105 it->item->scrl_y += it->wd->reorder_it->item->h;
2106 return it->wd->reorder_it->item->h;
2113 _reorder_move_animator_cb(void *data)
2115 Elm_Gen_Item *it = data;
2116 Eina_Bool down = EINA_FALSE;
2118 int y, dy = it->item->h / 10 * _elm_config->scale, diff;
2120 t = ((0.0 > (t = ecore_loop_time_get()-it->wd->start_time)) ? 0.0 : t);
2122 if (t <= REORDER_EFFECT_TIME) y = (1 * sin((t / REORDER_EFFECT_TIME) * (M_PI / 2)) * dy);
2125 diff = abs(it->item->old_scrl_y - it->item->scrl_y);
2126 if (diff > it->item->h) y = diff / 2;
2128 if (it->item->old_scrl_y < it->item->scrl_y)
2130 it->item->old_scrl_y += y;
2133 else if (it->item->old_scrl_y > it->item->scrl_y)
2135 it->item->old_scrl_y -= y;
2138 _item_position(it, VIEW(it), it->item->scrl_x, it->item->old_scrl_y);
2139 _group_items_recalc(it->wd);
2141 if ((it->wd->reorder_pan_move) ||
2142 (down && it->item->old_scrl_y >= it->item->scrl_y) ||
2143 (!down && it->item->old_scrl_y <= it->item->scrl_y))
2145 it->item->old_scrl_y = it->item->scrl_y;
2146 it->item->move_effect_enabled = EINA_FALSE;
2147 it->wd->reorder_move_animator = NULL;
2148 return ECORE_CALLBACK_CANCEL;
2150 return ECORE_CALLBACK_RENEW;
2154 _item_position(Elm_Gen_Item *it,
2162 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2163 evas_object_resize(view, it->item->w, it->item->h);
2164 evas_object_move(view, it_x, it_y);
2165 evas_object_show(view);
2166 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2167 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2171 _item_block_position(Item_Block *itb,
2177 Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2180 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2181 evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh);
2182 evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy,
2184 EINA_LIST_FOREACH(itb->items, l, it)
2186 if (it->delete_me) continue;
2187 else if (it->wd->reorder_it == it) continue;
2190 it->item->w = itb->w;
2191 it->item->scrl_x = itb->x + it->x - it->wd->pan_x + ox;
2192 it->item->scrl_y = itb->y + it->y - it->wd->pan_y + oy;
2194 vis = (ELM_RECTS_INTERSECT(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h,
2195 cvx, cvy, cvw, cvh));
2198 if ((itb->realized) && (!it->realized))
2200 if (vis) _item_realize(it, in, EINA_FALSE);
2206 if (it->wd->reorder_mode)
2207 y += _get_space_for_reorder_item(it);
2208 git = it->item->group_item;
2211 if (git->item->scrl_y < oy)
2212 git->item->scrl_y = oy;
2213 if ((git->item->scrl_y + git->item->h) > (it->item->scrl_y + it->item->h))
2214 git->item->scrl_y = (it->item->scrl_y + it->item->h) - git->item->h;
2215 git->item->want_realize = EINA_TRUE;
2217 if ((it->wd->reorder_it) && (it->item->old_scrl_y != it->item->scrl_y))
2219 if (!it->item->move_effect_enabled)
2221 it->item->move_effect_enabled = EINA_TRUE;
2222 it->wd->reorder_move_animator =
2224 _reorder_move_animator_cb, it);
2227 if (!it->item->move_effect_enabled)
2229 if (it->item->mode_view)
2230 _item_position(it, it->item->mode_view, it->item->scrl_x,
2233 _item_position(it, VIEW(it), it->item->scrl_x,
2235 it->item->old_scrl_y = it->item->scrl_y;
2240 if (!it->dragging) elm_gen_item_unrealize(it, EINA_FALSE);
2247 if (vis) it->item->want_realize = EINA_TRUE;
2251 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2252 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2256 _group_items_recalc(void *data)
2258 Widget_Data *wd = data;
2262 evas_event_freeze(evas_object_evas_get(wd->obj));
2263 EINA_LIST_FOREACH(wd->group_items, l, git)
2265 if (git->item->want_realize)
2268 _item_realize(git, 0, EINA_FALSE);
2269 evas_object_resize(VIEW(git), wd->minw, git->item->h);
2270 evas_object_move(VIEW(git), git->item->scrl_x, git->item->scrl_y);
2271 evas_object_show(VIEW(git));
2272 evas_object_raise(VIEW(git));
2274 else if (!git->item->want_realize && git->realized)
2277 elm_gen_item_unrealize(git, EINA_FALSE);
2280 evas_event_thaw(evas_object_evas_get(wd->obj));
2281 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2285 _must_recalc_idler(void *data)
2287 Widget_Data *wd = data;
2288 if (wd->calc_job) ecore_job_del(wd->calc_job);
2289 wd->calc_job = ecore_job_add(_calc_job, wd);
2290 wd->must_recalc_idler = NULL;
2291 return ECORE_CALLBACK_CANCEL;
2295 _calc_job(void *data)
2297 Widget_Data *wd = data;
2298 Item_Block *itb, *chb = NULL;
2299 Evas_Coord minw = -1, minh = 0, y = 0, ow;
2301 Eina_Bool minw_change = EINA_FALSE;
2302 Eina_Bool did_must_recalc = EINA_FALSE;
2305 evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h);
2309 evas_event_freeze(evas_object_evas_get(wd->obj));
2310 EINA_INLIST_FOREACH(wd->blocks, itb)
2312 Eina_Bool showme = EINA_FALSE;
2315 showme = itb->showme;
2316 itb->showme = EINA_FALSE;
2319 if (itb->realized) _item_block_unrealize(itb);
2321 if ((itb->changed) || ((itb->must_recalc) && (!did_must_recalc)))
2323 if (itb->must_recalc)
2327 EINA_LIST_FOREACH(itb->items, l, it)
2328 if (it->item->mincalcd) it->item->mincalcd = EINA_FALSE;
2329 itb->changed = EINA_TRUE;
2330 if (itb->must_recalc) did_must_recalc = EINA_TRUE;
2331 itb->must_recalc = EINA_FALSE;
2333 if (itb->realized) _item_block_unrealize(itb);
2334 showme = _item_block_recalc(itb, in, EINA_FALSE);
2340 if (minw == -1) minw = itb->minw;
2341 else if ((!itb->must_recalc) && (minw < itb->minw))
2344 minw_change = EINA_TRUE;
2350 if ((showme) && (wd->show_item) && (!wd->show_item->item->queued))
2352 wd->show_item->item->showme = EINA_FALSE;
2354 elm_smart_scroller_region_bring_in(wd->scr,
2356 wd->show_item->item->block->x,
2358 wd->show_item->item->block->y,
2359 wd->show_item->item->block->w,
2360 wd->show_item->item->h);
2362 elm_smart_scroller_child_region_show(wd->scr,
2364 wd->show_item->item->block->x,
2366 wd->show_item->item->block->y,
2367 wd->show_item->item->block->w,
2368 wd->show_item->item->h);
2369 wd->show_item = NULL;
2374 EINA_INLIST_FOREACH(wd->blocks, itb)
2380 if ((chb) && (EINA_INLIST_GET(chb)->next))
2382 EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb)
2384 if (itb->realized) _item_block_unrealize(itb);
2387 wd->realminw = minw;
2388 if (minw < wd->w) minw = wd->w;
2389 if ((minw != wd->minw) || (minh != wd->minh))
2393 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
2394 _sizing_eval(wd->obj);
2395 if ((wd->anchor_item) && (wd->anchor_item->item->block) && (!wd->auto_scroll_enabled))
2400 it = wd->anchor_item;
2401 it_y = wd->anchor_y;
2402 elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x,
2403 it->item->block->y + it->y + it_y);
2404 wd->anchor_item = it;
2405 wd->anchor_y = it_y;
2408 if (did_must_recalc)
2410 if (!wd->must_recalc_idler)
2411 wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd);
2413 wd->calc_job = NULL;
2414 evas_object_smart_changed(wd->pan_smart);
2415 evas_event_thaw(evas_object_evas_get(wd->obj));
2416 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2420 _update_job(void *data)
2422 Widget_Data *wd = data;
2426 Eina_Bool position = EINA_FALSE, recalc = EINA_FALSE;
2428 wd->update_job = NULL;
2431 evas_event_freeze(evas_object_evas_get(wd->obj));
2432 EINA_INLIST_FOREACH(wd->blocks, itb)
2434 Evas_Coord itminw, itminh;
2441 _item_block_position(itb, num);
2445 recalc = EINA_FALSE;
2446 EINA_LIST_FOREACH(itb->items, l2, it)
2448 if (it->item->updateme)
2450 itminw = it->item->minw;
2451 itminh = it->item->minh;
2453 it->item->updateme = EINA_FALSE;
2456 elm_gen_item_unrealize(it, EINA_FALSE);
2457 _item_realize(it, num, EINA_FALSE);
2458 position = EINA_TRUE;
2462 _item_realize(it, num, EINA_TRUE);
2463 elm_gen_item_unrealize(it, EINA_TRUE);
2465 if ((it->item->minw != itminw) || (it->item->minh != itminh))
2470 itb->updateme = EINA_FALSE;
2473 position = EINA_TRUE;
2474 itb->changed = EINA_TRUE;
2475 _item_block_recalc(itb, num0, EINA_FALSE);
2476 _item_block_position(itb, num0);
2481 if (wd->calc_job) ecore_job_del(wd->calc_job);
2482 wd->calc_job = ecore_job_add(_calc_job, wd);
2484 evas_event_thaw(evas_object_evas_get(wd->obj));
2485 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2489 _pan_set(Evas_Object *obj,
2493 Pan *sd = evas_object_smart_data_get(obj);
2497 // Evas_Coord ow, oh;
2498 // evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2499 // ow = sd->wd->minw - ow;
2500 // if (ow < 0) ow = 0;
2501 // oh = sd->wd->minh - oh;
2502 // if (oh < 0) oh = 0;
2503 // if (x < 0) x = 0;
2504 // if (y < 0) y = 0;
2505 // if (x > ow) x = ow;
2506 // if (y > oh) y = oh;
2507 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
2511 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2513 if ((itb->y + itb->h) > y)
2518 EINA_LIST_FOREACH(itb->items, l2, it)
2520 if ((itb->y + it->y) >= y)
2522 sd->wd->anchor_item = it;
2523 sd->wd->anchor_y = -(itb->y + it->y - y);
2530 if (!sd->wd->reorder_move_animator) evas_object_smart_changed(obj);
2534 _pan_get(Evas_Object *obj,
2538 Pan *sd = evas_object_smart_data_get(obj);
2541 if (x) *x = sd->wd->pan_x;
2542 if (y) *y = sd->wd->pan_y;
2546 _pan_max_get(Evas_Object *obj,
2550 Pan *sd = evas_object_smart_data_get(obj);
2554 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2555 ow = sd->wd->minw - ow;
2557 oh = sd->wd->minh - oh;
2564 _pan_min_get(Evas_Object *obj __UNUSED__,
2573 _pan_child_size_get(Evas_Object *obj,
2577 Pan *sd = evas_object_smart_data_get(obj);
2580 if (w) *w = sd->wd->minw;
2581 if (h) *h = sd->wd->minh;
2585 _pan_add(Evas_Object *obj)
2588 Evas_Object_Smart_Clipped_Data *cd;
2591 cd = evas_object_smart_data_get(obj);
2594 sd->__clipped_data = *cd;
2596 evas_object_smart_data_set(obj, sd);
2600 _pan_del(Evas_Object *obj)
2602 Pan *sd = evas_object_smart_data_get(obj);
2607 ecore_job_del(sd->resize_job);
2608 sd->resize_job = NULL;
2614 _pan_resize_job(void *data)
2618 _sizing_eval(sd->wd->obj);
2619 sd->resize_job = NULL;
2623 _pan_resize(Evas_Object *obj,
2627 Pan *sd = evas_object_smart_data_get(obj);
2631 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2632 if ((ow == w) && (oh == h)) return;
2633 if ((sd->wd->height_for_width) && (ow != w))
2636 if (sd->resize_job) ecore_job_del(sd->resize_job);
2637 sd->resize_job = ecore_job_add(_pan_resize_job, sd);
2639 sd->wd->pan_resized = EINA_TRUE;
2640 evas_object_smart_changed(obj);
2641 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2642 sd->wd->calc_job = NULL;
2644 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2645 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2650 _pan_calculate(Evas_Object *obj)
2652 Pan *sd = evas_object_smart_data_get(obj);
2654 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2660 evas_event_freeze(evas_object_evas_get(obj));
2662 if (sd->wd->pan_resized)
2665 sd->wd->pan_resized = EINA_FALSE;
2668 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
2669 evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
2670 EINA_LIST_FOREACH(sd->wd->group_items, l, git)
2672 git->item->want_realize = EINA_FALSE;
2674 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2676 itb->w = sd->wd->minw;
2677 if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox,
2678 itb->y - sd->wd->pan_y + oy,
2680 cvx, cvy, cvw, cvh))
2682 if ((!itb->realized) || (itb->changed))
2683 _item_block_realize(itb);
2684 _item_block_position(itb, in);
2688 if (itb->realized) _item_block_unrealize(itb);
2692 if ((!sd->wd->reorder_it) || (sd->wd->reorder_pan_move))
2693 _group_items_recalc(sd->wd);
2694 if ((sd->wd->reorder_mode) && (sd->wd->reorder_it))
2696 if (sd->wd->pan_y != sd->wd->reorder_old_pan_y)
2697 sd->wd->reorder_pan_move = EINA_TRUE;
2698 else sd->wd->reorder_pan_move = EINA_FALSE;
2699 evas_object_raise(sd->wd->VIEW(reorder_it));
2700 sd->wd->reorder_old_pan_y = sd->wd->pan_y;
2701 sd->wd->start_time = ecore_loop_time_get();
2703 _item_auto_scroll(sd->wd);
2704 evas_event_thaw(evas_object_evas_get(obj));
2705 evas_event_thaw_eval(evas_object_evas_get(obj));
2709 _pan_move(Evas_Object *obj,
2710 Evas_Coord x __UNUSED__,
2711 Evas_Coord y __UNUSED__)
2713 Pan *sd = evas_object_smart_data_get(obj);
2716 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2717 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2721 _hold_on(void *data __UNUSED__,
2723 void *event_info __UNUSED__)
2725 Widget_Data *wd = elm_widget_data_get(obj);
2727 elm_smart_scroller_hold_set(wd->scr, 1);
2731 _hold_off(void *data __UNUSED__,
2733 void *event_info __UNUSED__)
2735 Widget_Data *wd = elm_widget_data_get(obj);
2737 elm_smart_scroller_hold_set(wd->scr, 0);
2741 _freeze_on(void *data __UNUSED__,
2743 void *event_info __UNUSED__)
2745 Widget_Data *wd = elm_widget_data_get(obj);
2747 elm_smart_scroller_freeze_set(wd->scr, 1);
2751 _freeze_off(void *data __UNUSED__,
2753 void *event_info __UNUSED__)
2755 Widget_Data *wd = elm_widget_data_get(obj);
2757 elm_smart_scroller_freeze_set(wd->scr, 0);
2761 _scr_anim_start(void *data,
2762 Evas_Object *obj __UNUSED__,
2763 void *event_info __UNUSED__)
2765 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL);
2769 _scr_anim_stop(void *data,
2770 Evas_Object *obj __UNUSED__,
2771 void *event_info __UNUSED__)
2773 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL);
2777 _scr_drag_start(void *data,
2778 Evas_Object *obj __UNUSED__,
2779 void *event_info __UNUSED__)
2781 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
2785 _scr_drag_stop(void *data,
2786 Evas_Object *obj __UNUSED__,
2787 void *event_info __UNUSED__)
2789 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
2793 _edge_left(void *data,
2794 Evas_Object *scr __UNUSED__,
2795 void *event_info __UNUSED__)
2797 Evas_Object *obj = data;
2798 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_LEFT, NULL);
2799 evas_object_smart_callback_call(obj, SIG_EDGE_LEFT, NULL);
2803 _edge_right(void *data,
2804 Evas_Object *scr __UNUSED__,
2805 void *event_info __UNUSED__)
2807 Evas_Object *obj = data;
2808 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_RIGHT, NULL);
2809 evas_object_smart_callback_call(obj, SIG_EDGE_RIGHT, NULL);
2813 _edge_top(void *data,
2814 Evas_Object *scr __UNUSED__,
2815 void *event_info __UNUSED__)
2817 Evas_Object *obj = data;
2818 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_TOP, NULL);
2819 evas_object_smart_callback_call(obj, SIG_EDGE_TOP, NULL);
2823 _edge_bottom(void *data,
2824 Evas_Object *scr __UNUSED__,
2825 void *event_info __UNUSED__)
2827 Evas_Object *obj = data;
2828 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_BOTTOM, NULL);
2829 evas_object_smart_callback_call(obj, SIG_EDGE_BOTTOM, NULL);
2833 _mode_item_realize(Elm_Gen_Item *it)
2837 if ((it->item->mode_view) || (it->delete_me)) return;
2839 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2840 it->item->mode_view = edje_object_add(evas_object_evas_get(WIDGET(it)));
2841 edje_object_scale_set(it->item->mode_view,
2842 elm_widget_scale_get(WIDGET(it)) *
2843 _elm_config->scale);
2844 evas_object_smart_member_add(it->item->mode_view, it->wd->pan_smart);
2845 elm_widget_sub_object_add(WIDGET(it), it->item->mode_view);
2847 strncpy(buf, "item", sizeof(buf));
2848 if (it->wd->compress)
2849 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
2851 if (it->item->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
2852 strncat(buf, "/", sizeof(buf) - strlen(buf));
2853 strncat(buf, it->wd->mode_item_style, sizeof(buf) - strlen(buf));
2855 _elm_theme_object_set(WIDGET(it), it->item->mode_view, "genlist", buf,
2856 elm_widget_style_get(WIDGET(it)));
2857 edje_object_mirrored_set(it->item->mode_view,
2858 elm_widget_mirrored_get(WIDGET(it)));
2860 /* signal callback add */
2861 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_DOWN,
2863 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_UP,
2865 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_MOVE,
2868 /* label_get, content_get, state_get */
2869 /* FIXME: If you see that assert, please notify us and we
2870 will clean our mess */
2871 assert(eina_list_count(it->item->mode_content_objs) == 0);
2873 _item_label_realize(it, it->item->mode_view, &it->item->mode_labels);
2874 it->item->mode_content_objs = _item_content_realize(it,
2875 it->item->mode_view,
2876 &it->item->mode_contents);
2877 _item_state_realize(it, it->item->mode_view, &it->item->mode_states);
2879 edje_object_part_swallow(it->item->mode_view,
2880 edje_object_data_get(it->item->mode_view, "mode_part"),
2883 it->want_unrealize = EINA_FALSE;
2884 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2885 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2889 _mode_item_unrealize(Elm_Gen_Item *it)
2891 Widget_Data *wd = it->wd;
2892 Evas_Object *content;
2893 if (!it->item->mode_view) return;
2895 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2896 elm_widget_stringlist_free(it->item->mode_labels);
2897 it->item->mode_labels = NULL;
2898 elm_widget_stringlist_free(it->item->mode_contents);
2899 it->item->mode_contents = NULL;
2900 elm_widget_stringlist_free(it->item->mode_states);
2902 EINA_LIST_FREE(it->item->mode_content_objs, content)
2903 evas_object_del(content);
2905 edje_object_part_unswallow(it->item->mode_view, VIEW(it));
2906 evas_object_smart_member_add(VIEW(it), wd->pan_smart);
2907 evas_object_del(it->item->mode_view);
2908 it->item->mode_view = NULL;
2910 if (wd->mode_item == it)
2911 wd->mode_item = NULL;
2912 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2913 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2917 _item_mode_set(Elm_Gen_Item *it)
2920 Widget_Data *wd = it->wd;
2925 it->item->nocache = EINA_TRUE;
2927 if (wd->scr_hold_timer)
2929 ecore_timer_del(wd->scr_hold_timer);
2930 wd->scr_hold_timer = NULL;
2932 elm_smart_scroller_hold_set(wd->scr, EINA_TRUE);
2933 wd->scr_hold_timer = ecore_timer_add(0.1, _scr_hold_timer_cb, wd);
2935 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2936 _mode_item_realize(it);
2937 if (it->item->group_item)
2938 evas_object_raise(it->item->VIEW(group_item));
2939 _item_position(it, it->item->mode_view, it->item->scrl_x, it->item->scrl_y);
2940 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2941 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2943 snprintf(buf, sizeof(buf), "elm,state,%s,active", wd->mode_type);
2944 edje_object_signal_emit(it->item->mode_view, buf, "elm");
2948 _item_mode_unset(Widget_Data *wd)
2951 if (!wd->mode_item) return;
2952 char buf[1024], buf2[1024];
2956 it->item->nocache = EINA_TRUE;
2958 snprintf(buf, sizeof(buf), "elm,state,%s,passive", wd->mode_type);
2959 snprintf(buf2, sizeof(buf2), "elm,state,%s,passive,finished", wd->mode_type);
2961 edje_object_signal_emit(it->item->mode_view, buf, "elm");
2962 edje_object_signal_callback_add(it->item->mode_view, buf2, "elm", _mode_finished_signal_cb, it);
2964 wd->mode_item = NULL;
2968 _item_auto_scroll(Widget_Data *wd)
2973 Evas_Coord ox, oy, ow, oh;
2975 if ((wd->expanded_item) && (wd->auto_scroll_enabled))
2977 evas_object_geometry_get(wd->obj, &ox, &oy, &ow, &oh);
2978 if (wd->expanded_item->item->scrl_y > (oh + oy) / 2)
2980 EINA_LIST_FOREACH(wd->expanded_item->item->items, l, it)
2981 elm_genlist_item_bring_in(it);
2983 wd->auto_scroll_enabled = EINA_FALSE;
2988 elm_genlist_add(Evas_Object *parent)
2993 Evas_Coord minw, minh;
2994 static Evas_Smart *smart = NULL;
2998 static Evas_Smart_Class sc;
3000 evas_object_smart_clipped_smart_set(&_pan_sc);
3002 sc.name = "elm_genlist_pan";
3003 sc.version = EVAS_SMART_CLASS_VERSION;
3006 sc.resize = _pan_resize;
3007 sc.move = _pan_move;
3008 sc.calculate = _pan_calculate;
3009 if (!(smart = evas_smart_class_new(&sc))) return NULL;
3012 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
3014 ELM_SET_WIDTYPE(widtype, "genlist");
3016 elm_widget_type_set(obj, "genlist");
3017 elm_widget_sub_object_add(parent, obj);
3018 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
3019 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
3020 elm_widget_data_set(obj, wd);
3021 elm_widget_del_hook_set(obj, _del_hook);
3022 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
3023 elm_widget_theme_hook_set(obj, _theme_hook);
3024 elm_widget_can_focus_set(obj, EINA_TRUE);
3025 elm_widget_event_hook_set(obj, _event_hook);
3026 elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
3027 elm_widget_translate_hook_set(obj, _translate_hook);
3029 wd->scr = elm_smart_scroller_add(e);
3030 elm_smart_scroller_widget_set(wd->scr, obj);
3031 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
3032 elm_widget_style_get(obj));
3033 elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE,
3034 _elm_config->thumbscroll_bounce_enable);
3035 elm_widget_resize_object_set(obj, wd->scr);
3037 evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj);
3038 evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, obj);
3039 evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj);
3040 evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj);
3041 evas_object_smart_callback_add(wd->scr, "edge,left", _edge_left, obj);
3042 evas_object_smart_callback_add(wd->scr, "edge,right", _edge_right, obj);
3043 evas_object_smart_callback_add(wd->scr, "edge,top", _edge_top, obj);
3044 evas_object_smart_callback_add(wd->scr, "edge,bottom", _edge_bottom, obj);
3047 wd->mode = ELM_LIST_SCROLL;
3048 wd->max_items_per_block = MAX_ITEMS_PER_BLOCK;
3049 wd->item_cache_max = wd->max_items_per_block * 2;
3050 wd->longpress_timeout = _elm_config->longpress_timeout;
3052 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
3053 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
3054 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
3055 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
3057 wd->pan_smart = evas_object_smart_add(e, smart);
3058 wd->pan = evas_object_smart_data_get(wd->pan_smart);
3061 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
3062 _pan_set, _pan_get, _pan_max_get,
3063 _pan_min_get, _pan_child_size_get);
3065 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
3067 evas_object_size_hint_min_set(obj, minw, minh);
3069 evas_object_smart_callbacks_descriptions_set(obj, _signals);
3071 _mirrored_set(obj, elm_widget_mirrored_get(obj));
3076 static Elm_Gen_Item *
3077 _item_new(Widget_Data *wd,
3078 const Elm_Genlist_Item_Class *itc,
3080 Elm_Gen_Item *parent,
3081 Elm_Genlist_Item_Flags flags,
3083 const void *func_data)
3087 it = elm_gen_item_new(wd, itc, data, parent, func, func_data);
3088 if (!it) return NULL;
3089 it->item = ELM_NEW(Elm_Gen_Item_Type);
3090 it->item->flags = flags;
3091 if (flags & ELM_GENLIST_ITEM_GROUP) it->group++;
3092 it->item->expanded_depth = 0;
3093 elm_widget_item_del_cb_set(it, _item_del_hook);
3094 ELM_GEN_ITEM_SETUP(it);
3097 if (it->parent->group)
3098 it->item->group_item = parent;
3099 else if (it->parent->item->group_item)
3100 it->item->group_item = it->parent->item->group_item;
3106 _item_block_add(Widget_Data *wd,
3109 Item_Block *itb = NULL;
3116 itb = calloc(1, sizeof(Item_Block));
3119 if (!it->item->rel->item->block)
3122 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3123 itb->items = eina_list_append(itb->items, it);
3127 if (it->item->before)
3129 wd->blocks = eina_inlist_prepend_relative
3130 (wd->blocks, EINA_INLIST_GET(itb),
3131 EINA_INLIST_GET(it->item->rel->item->block));
3133 eina_list_prepend_relative(itb->items, it, it->item->rel);
3137 wd->blocks = eina_inlist_append_relative
3138 (wd->blocks, EINA_INLIST_GET(itb),
3139 EINA_INLIST_GET(it->item->rel->item->block));
3141 eina_list_append_relative(itb->items, it, it->item->rel);
3147 if (it->item->before)
3151 itb = (Item_Block *)(wd->blocks);
3152 if (itb->count >= wd->max_items_per_block)
3154 itb = calloc(1, sizeof(Item_Block));
3158 eina_inlist_prepend(wd->blocks,
3159 EINA_INLIST_GET(itb));
3164 itb = calloc(1, sizeof(Item_Block));
3168 eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
3170 itb->items = eina_list_prepend(itb->items, it);
3176 itb = (Item_Block *)(wd->blocks->last);
3177 if (itb->count >= wd->max_items_per_block)
3179 itb = calloc(1, sizeof(Item_Block));
3183 eina_inlist_append(wd->blocks,
3184 EINA_INLIST_GET(itb));
3189 itb = calloc(1, sizeof(Item_Block));
3193 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3195 itb->items = eina_list_append(itb->items, it);
3201 itb = it->item->rel->item->block;
3202 if (!itb) goto newblock;
3203 if (it->item->before)
3204 itb->items = eina_list_prepend_relative(itb->items, it, it->item->rel);
3206 itb->items = eina_list_append_relative(itb->items, it, it->item->rel);
3209 itb->changed = EINA_TRUE;
3210 it->item->block = itb;
3211 if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job);
3212 itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd);
3215 it->item->rel->relcount--;
3216 if ((it->item->rel->delete_me) && (!it->item->rel->relcount))
3217 _item_del(it->item->rel);
3218 it->item->rel = NULL;
3220 if (itb->count > itb->wd->max_items_per_block)
3226 newc = itb->count / 2;
3227 itb2 = calloc(1, sizeof(Item_Block));
3231 eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
3232 EINA_INLIST_GET(itb));
3233 itb2->changed = EINA_TRUE;
3234 while ((itb->count > newc) && (itb->items))
3238 l = eina_list_last(itb->items);
3240 itb->items = eina_list_remove_list(itb->items, l);
3243 itb2->items = eina_list_prepend(itb2->items, it2);
3244 it2->item->block = itb2;
3251 _queue_process(Widget_Data *wd)
3254 Eina_Bool showme = EINA_FALSE;
3257 t0 = ecore_time_get();
3258 //evas_event_freeze(evas_object_evas_get(wd->obj));
3259 for (n = 0; (wd->queue) && (n < 128); n++)
3263 it = wd->queue->data;
3264 wd->queue = eina_list_remove_list(wd->queue, wd->queue);
3265 it->item->queued = EINA_FALSE;
3266 _item_block_add(wd, it);
3268 _item_block_realize(it->item->block);
3269 t = ecore_time_get();
3270 if (it->item->block->changed)
3272 showme = _item_block_recalc(it->item->block, it->item->block->num, EINA_TRUE);
3273 it->item->block->changed = 0;
3275 if (showme) it->item->block->showme = EINA_TRUE;
3276 if (eina_inlist_count(wd->blocks) > 1)
3278 if ((t - t0) > (ecore_animator_frametime_get())) break;
3281 //evas_event_thaw(evas_object_evas_get(wd->obj));
3282 //evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3287 _idle_process(void *data, Eina_Bool *wakeup)
3289 Widget_Data *wd = data;
3292 //static double q_start = 0.0;
3293 //if (q_start == 0.0) q_start = ecore_time_get();
3295 if (_queue_process(wd) > 0) *wakeup = EINA_TRUE;
3299 //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start);
3301 return ECORE_CALLBACK_CANCEL;
3303 return ECORE_CALLBACK_RENEW;
3307 _item_idle_enterer(void *data)
3309 Widget_Data *wd = data;
3310 Eina_Bool wakeup = EINA_FALSE;
3311 Eina_Bool ok = _idle_process(data, &wakeup);
3316 if (wd->calc_job) ecore_job_del(wd->calc_job);
3317 wd->calc_job = ecore_job_add(_calc_job, wd);
3319 if (ok == ECORE_CALLBACK_CANCEL) wd->queue_idle_enterer = NULL;
3324 _item_queue(Widget_Data *wd,
3327 if (it->item->queued) return;
3328 it->item->queued = EINA_TRUE;
3329 wd->queue = eina_list_append(wd->queue, it);
3330 // FIXME: why does a freeze then thaw here cause some genlist
3331 // elm_genlist_item_append() to be much much slower?
3332 // evas_event_freeze(evas_object_evas_get(wd->obj));
3333 while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
3335 if (wd->queue_idle_enterer)
3337 ecore_idle_enterer_del(wd->queue_idle_enterer);
3338 wd->queue_idle_enterer = NULL;
3342 // evas_event_thaw(evas_object_evas_get(wd->obj));
3343 // evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3344 if (!wd->queue_idle_enterer)
3345 wd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, wd);
3349 _elm_genlist_item_compare_data(const void *data, const void *data1)
3351 const Elm_Gen_Item *it = data;
3352 const Elm_Gen_Item *item1 = data1;
3354 return _elm_genlist_item_compare_data_cb(it->base.data, item1->base.data);
3358 _elm_genlist_item_compare(const void *data, const void *data1)
3360 const Elm_Gen_Item *it, *item1;
3361 it = ELM_GEN_ITEM_FROM_INLIST(data);
3362 item1 = ELM_GEN_ITEM_FROM_INLIST(data1);
3363 return _elm_genlist_item_compare_cb(it, item1);
3367 _elm_genlist_item_list_compare(const void *data, const void *data1)
3369 const Elm_Gen_Item *it = data;
3370 const Elm_Gen_Item *item1 = data1;
3371 return _elm_genlist_item_compare_cb(it, item1);
3375 _item_move_after(Elm_Gen_Item *it, Elm_Gen_Item *after)
3380 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3381 _item_block_del(it);
3383 it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
3384 it->item->rel = after;
3385 it->item->rel->relcount++;
3386 it->item->before = EINA_FALSE;
3387 if (after->item->group_item) it->item->group_item = after->item->group_item;
3388 _item_queue(it->wd, it);
3390 evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it);
3394 _item_move_before(Elm_Gen_Item *it, Elm_Gen_Item *before)
3397 if (!before) return;
3399 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3400 _item_block_del(it);
3401 it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
3402 it->item->rel = before;
3403 it->item->rel->relcount++;
3404 it->item->before = EINA_TRUE;
3405 if (before->item->group_item) it->item->group_item = before->item->group_item;
3406 _item_queue(it->wd, it);
3408 evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it);
3412 elm_genlist_item_append(Evas_Object *obj,
3413 const Elm_Genlist_Item_Class *itc,
3415 Elm_Gen_Item *parent,
3416 Elm_Genlist_Item_Flags flags,
3418 const void *func_data)
3420 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3421 Widget_Data *wd = elm_widget_data_get(obj);
3422 if (!wd) return NULL;
3423 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3425 if (!it) return NULL;
3429 wd->group_items = eina_list_append(wd->group_items, it);
3430 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
3431 it->item->rel = NULL;
3435 Elm_Gen_Item *it2 = NULL;
3436 Eina_List *ll = eina_list_last(it->parent->item->items);
3437 if (ll) it2 = ll->data;
3438 it->parent->item->items = eina_list_append(it->parent->item->items, it);
3439 if (!it2) it2 = it->parent;
3441 eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3442 EINA_INLIST_GET(it2));
3443 it->item->rel = it2;
3444 it->item->rel->relcount++;
3446 it->item->before = EINA_FALSE;
3447 _item_queue(wd, it);
3452 elm_genlist_item_prepend(Evas_Object *obj,
3453 const Elm_Genlist_Item_Class *itc,
3455 Elm_Gen_Item *parent,
3456 Elm_Genlist_Item_Flags flags,
3458 const void *func_data)
3460 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3461 Widget_Data *wd = elm_widget_data_get(obj);
3462 if (!wd) return NULL;
3463 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3465 if (!it) return NULL;
3469 wd->group_items = eina_list_prepend(wd->group_items, it);
3470 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
3471 it->item->rel = NULL;
3475 Elm_Gen_Item *it2 = NULL;
3476 Eina_List *ll = it->parent->item->items;
3477 if (ll) it2 = ll->data;
3478 it->parent->item->items = eina_list_prepend(it->parent->item->items, it);
3479 if (!it2) it2 = it->parent;
3481 eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3482 EINA_INLIST_GET(it2));
3483 it->item->rel = it2;
3484 it->item->rel->relcount++;
3486 it->item->before = EINA_TRUE;
3487 _item_queue(wd, it);
3492 elm_genlist_item_insert_after(Evas_Object *obj,
3493 const Elm_Genlist_Item_Class *itc,
3495 Elm_Gen_Item *parent,
3496 Elm_Gen_Item *after,
3497 Elm_Genlist_Item_Flags flags,
3499 const void *func_data)
3501 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3502 EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
3503 Widget_Data *wd = elm_widget_data_get(obj);
3504 if (!wd) return NULL;
3505 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3507 if (!it) return NULL;
3508 /* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */
3509 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3515 wd->group_items = eina_list_append_relative(wd->group_items, it,
3520 it->parent->item->items = eina_list_append_relative(it->parent->item->items, it,
3523 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3524 EINA_INLIST_GET(after));
3525 it->item->rel = after;
3526 it->item->rel->relcount++;
3527 it->item->before = EINA_FALSE;
3528 _item_queue(wd, it);
3533 elm_genlist_item_insert_before(Evas_Object *obj,
3534 const Elm_Genlist_Item_Class *itc,
3536 Elm_Gen_Item *parent,
3537 Elm_Gen_Item *before,
3538 Elm_Genlist_Item_Flags flags,
3540 const void *func_data)
3542 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3543 EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
3544 Widget_Data *wd = elm_widget_data_get(obj);
3545 if (!wd) return NULL;
3546 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3548 if (!it) return NULL;
3549 /* It makes no sense to insert before in an empty list with before != NULL, something really bad is happening in your app. */
3550 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3554 if (it->group && before->group)
3555 wd->group_items = eina_list_prepend_relative(wd->group_items, it,
3560 it->parent->item->items = eina_list_prepend_relative(it->parent->item->items, it,
3563 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3564 EINA_INLIST_GET(before));
3565 it->item->rel = before;
3566 it->item->rel->relcount++;
3567 it->item->before = EINA_TRUE;
3568 _item_queue(wd, it);
3573 elm_genlist_item_direct_sorted_insert(Evas_Object *obj,
3574 const Elm_Genlist_Item_Class *itc,
3576 Elm_Gen_Item *parent,
3577 Elm_Genlist_Item_Flags flags,
3578 Eina_Compare_Cb comp,
3580 const void *func_data)
3582 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3583 Widget_Data *wd = elm_widget_data_get(obj);
3584 if (!wd) return NULL;
3585 Elm_Gen_Item *rel = NULL;
3586 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3588 if (!it) return NULL;
3590 _elm_genlist_item_compare_cb = comp;
3597 l = eina_list_search_sorted_near_list(it->parent->item->items,
3598 _elm_genlist_item_list_compare, it,
3601 rel = eina_list_data_get(l);
3605 if (cmp_result >= 0)
3607 it->parent->item->items = eina_list_prepend_relative_list(it->parent->item->items, it, l);
3608 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
3609 it->item->before = EINA_FALSE;
3611 else if (cmp_result < 0)
3613 it->parent->item->items = eina_list_append_relative_list(it->parent->item->items, it, l);
3614 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
3615 it->item->before = EINA_TRUE;
3622 wd->state = eina_inlist_sorted_state_new();
3623 eina_inlist_sorted_state_init(wd->state, wd->items);
3627 wd->group_items = eina_list_append(wd->group_items, it);
3629 wd->items = eina_inlist_sorted_state_insert(wd->items, EINA_INLIST_GET(it),
3630 _elm_genlist_item_compare, wd->state);
3632 if (EINA_INLIST_GET(it)->next)
3634 rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3635 it->item->before = EINA_TRUE;
3637 else if (EINA_INLIST_GET(it)->prev)
3639 rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3640 it->item->before = EINA_FALSE;
3646 it->item->rel = rel;
3647 it->item->rel->relcount++;
3650 _item_queue(wd, it);
3656 elm_genlist_item_sorted_insert(Evas_Object *obj,
3657 const Elm_Genlist_Item_Class *itc,
3659 Elm_Gen_Item *parent,
3660 Elm_Genlist_Item_Flags flags,
3661 Eina_Compare_Cb comp,
3663 const void *func_data)
3665 _elm_genlist_item_compare_data_cb = comp;
3667 return elm_genlist_item_direct_sorted_insert(obj, itc, data, parent, flags,
3668 _elm_genlist_item_compare_data, func, func_data);
3672 elm_genlist_clear(Evas_Object *obj)
3678 elm_genlist_multi_select_set(Evas_Object *obj,
3681 ELM_CHECK_WIDTYPE(obj, widtype);
3682 Widget_Data *wd = elm_widget_data_get(obj);
3688 elm_genlist_multi_select_get(const Evas_Object *obj)
3690 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3691 Widget_Data *wd = elm_widget_data_get(obj);
3692 if (!wd) return EINA_FALSE;
3697 elm_genlist_selected_item_get(const Evas_Object *obj)
3699 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3700 Widget_Data *wd = elm_widget_data_get(obj);
3701 if (!wd) return NULL;
3702 if (wd->selected) return wd->selected->data;
3706 EAPI const Eina_List *
3707 elm_genlist_selected_items_get(const Evas_Object *obj)
3709 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3710 Widget_Data *wd = elm_widget_data_get(obj);
3711 if (!wd) return NULL;
3712 return wd->selected;
3716 elm_genlist_realized_items_get(const Evas_Object *obj)
3718 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3719 Widget_Data *wd = elm_widget_data_get(obj);
3720 Eina_List *list = NULL;
3722 Eina_Bool done = EINA_FALSE;
3723 if (!wd) return NULL;
3724 EINA_INLIST_FOREACH(wd->blocks, itb)
3732 EINA_LIST_FOREACH(itb->items, l, it)
3734 if (it->realized) list = eina_list_append(list, it);
3746 elm_genlist_at_xy_item_get(const Evas_Object *obj,
3751 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3752 Widget_Data *wd = elm_widget_data_get(obj);
3753 Evas_Coord ox, oy, ow, oh;
3756 if (!wd) return NULL;
3757 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
3759 EINA_INLIST_FOREACH(wd->blocks, itb)
3764 if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
3765 oy + itb->y - itb->wd->pan_y,
3766 itb->w, itb->h, x, y, 1, 1))
3768 EINA_LIST_FOREACH(itb->items, l, it)
3770 Evas_Coord itx, ity;
3772 itx = ox + itb->x + it->x - itb->wd->pan_x;
3773 ity = oy + itb->y + it->y - itb->wd->pan_y;
3774 if (ELM_RECTS_INTERSECT(itx, ity, it->item->w, it->item->h, x, y, 1, 1))
3778 if (y <= (ity + (it->item->h / 4))) *posret = -1;
3779 else if (y >= (ity + it->item->h - (it->item->h / 4)))
3785 lasty = ity + it->item->h;
3790 if (y > lasty) *posret = 1;
3797 elm_genlist_first_item_get(const Evas_Object *obj)
3799 return elm_gen_first_item_get(obj);
3803 elm_genlist_last_item_get(const Evas_Object *obj)
3805 return elm_gen_last_item_get(obj);
3809 elm_genlist_item_next_get(const Elm_Gen_Item *it)
3811 return elm_gen_item_next_get(it);
3815 elm_genlist_item_prev_get(const Elm_Gen_Item *it)
3817 return elm_gen_item_prev_get(it);
3821 elm_genlist_item_genlist_get(const Elm_Gen_Item *it)
3823 return elm_gen_item_widget_get(it);
3827 elm_genlist_item_parent_get(const Elm_Gen_Item *it)
3829 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3834 elm_genlist_item_subitems_clear(Elm_Gen_Item *it)
3836 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3837 Eina_List *tl = NULL, *l;
3840 EINA_LIST_FOREACH(it->item->items, l, it2)
3841 tl = eina_list_append(tl, it2);
3842 EINA_LIST_FREE(tl, it2)
3843 elm_genlist_item_del(it2);
3847 elm_genlist_item_selected_set(Elm_Gen_Item *it,
3850 elm_gen_item_selected_set(it, selected);
3854 elm_genlist_item_selected_get(const Elm_Gen_Item *it)
3856 return elm_gen_item_selected_get(it);
3860 elm_genlist_item_expanded_set(Elm_Gen_Item *it,
3863 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3864 if (it->item->expanded == expanded) return;
3865 it->item->expanded = expanded;
3866 it->wd->expanded_item = it;
3867 if (it->item->expanded)
3870 edje_object_signal_emit(VIEW(it), "elm,state,expanded", "elm");
3871 evas_object_smart_callback_call(WIDGET(it), SIG_EXPANDED, it);
3872 it->wd->auto_scroll_enabled = EINA_TRUE;
3877 edje_object_signal_emit(VIEW(it), "elm,state,contracted", "elm");
3878 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACTED, it);
3879 it->wd->auto_scroll_enabled = EINA_FALSE;
3884 elm_genlist_item_expanded_get(const Elm_Gen_Item *it)
3886 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
3887 return it->item->expanded;
3891 elm_genlist_item_expanded_depth_get(const Elm_Gen_Item *it)
3893 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, 0);
3894 return it->item->expanded_depth;
3898 elm_genlist_item_disabled_set(Elm_Gen_Item *it,
3901 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3904 if (it->disabled == disabled) return;
3905 if (it->delete_me) return;
3906 it->disabled = !!disabled;
3908 elm_gen_item_selected_set(it, EINA_FALSE);
3912 edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
3914 edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm");
3915 EINA_LIST_FOREACH(it->content_objs, l, obj)
3916 elm_widget_disabled_set(obj, disabled);
3921 elm_genlist_item_disabled_get(const Elm_Gen_Item *it)
3923 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
3924 if (it->delete_me) return EINA_FALSE;
3925 return it->disabled;
3929 elm_genlist_item_display_only_set(Elm_Gen_Item *it,
3930 Eina_Bool display_only)
3932 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3933 if (it->display_only == display_only) return;
3934 if (it->delete_me) return;
3935 it->display_only = display_only;
3936 it->item->mincalcd = EINA_FALSE;
3937 it->item->updateme = EINA_TRUE;
3938 if (it->item->block) it->item->block->updateme = EINA_TRUE;
3939 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
3940 it->wd->update_job = ecore_job_add(_update_job, it->wd);
3944 elm_genlist_item_display_only_get(const Elm_Gen_Item *it)
3946 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
3947 if (it->delete_me) return EINA_FALSE;
3948 return it->display_only;
3952 elm_genlist_item_show(Elm_Gen_Item *it)
3954 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3955 Evas_Coord gith = 0;
3956 if (it->delete_me) return;
3957 if ((it->item->queued) || (!it->item->mincalcd))
3959 it->wd->show_item = it;
3960 it->wd->bring_in = EINA_TRUE;
3961 it->item->showme = EINA_TRUE;
3964 if (it->wd->show_item)
3966 it->wd->show_item->item->showme = EINA_FALSE;
3967 it->wd->show_item = NULL;
3969 if ((it->item->group_item) && (it->wd->pan_y > (it->y + it->item->block->y)))
3970 gith = it->item->group_item->item->h;
3971 elm_smart_scroller_child_region_show(it->wd->scr,
3972 it->x + it->item->block->x,
3973 it->y + it->item->block->y - gith,
3974 it->item->block->w, it->item->h);
3978 elm_genlist_item_bring_in(Elm_Gen_Item *it)
3980 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3981 Evas_Coord gith = 0;
3982 if (it->delete_me) return;
3983 if ((it->item->queued) || (!it->item->mincalcd))
3985 it->wd->show_item = it;
3986 it->wd->bring_in = EINA_TRUE;
3987 it->item->showme = EINA_TRUE;
3990 if (it->wd->show_item)
3992 it->wd->show_item->item->showme = EINA_FALSE;
3993 it->wd->show_item = NULL;
3995 if ((it->item->group_item) && (it->wd->pan_y > (it->y + it->item->block->y)))
3996 gith = it->item->group_item->item->h;
3997 elm_smart_scroller_region_bring_in(it->wd->scr,
3998 it->x + it->item->block->x,
3999 it->y + it->item->block->y - gith,
4000 it->item->block->w, it->item->h);
4004 elm_genlist_item_top_show(Elm_Gen_Item *it)
4006 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4008 Evas_Coord gith = 0;
4010 if (it->delete_me) return;
4011 if ((it->item->queued) || (!it->item->mincalcd))
4013 it->wd->show_item = it;
4014 it->wd->bring_in = EINA_TRUE;
4015 it->item->showme = EINA_TRUE;
4018 if (it->wd->show_item)
4020 it->wd->show_item->item->showme = EINA_FALSE;
4021 it->wd->show_item = NULL;
4023 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4024 if (it->item->group_item) gith = it->item->group_item->item->h;
4025 elm_smart_scroller_child_region_show(it->wd->scr,
4026 it->x + it->item->block->x,
4027 it->y + it->item->block->y - gith,
4028 it->item->block->w, oh);
4032 elm_genlist_item_top_bring_in(Elm_Gen_Item *it)
4034 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4036 Evas_Coord gith = 0;
4038 if (it->delete_me) return;
4039 if ((it->item->queued) || (!it->item->mincalcd))
4041 it->wd->show_item = it;
4042 it->wd->bring_in = EINA_TRUE;
4043 it->item->showme = EINA_TRUE;
4046 if (it->wd->show_item)
4048 it->wd->show_item->item->showme = EINA_FALSE;
4049 it->wd->show_item = NULL;
4051 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4052 if (it->item->group_item) gith = it->item->group_item->item->h;
4053 elm_smart_scroller_region_bring_in(it->wd->scr,
4054 it->x + it->item->block->x,
4055 it->y + it->item->block->y - gith,
4056 it->item->block->w, oh);
4060 elm_genlist_item_middle_show(Elm_Gen_Item *it)
4062 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4065 if (it->delete_me) return;
4066 if ((it->item->queued) || (!it->item->mincalcd))
4068 it->wd->show_item = it;
4069 it->wd->bring_in = EINA_TRUE;
4070 it->item->showme = EINA_TRUE;
4073 if (it->wd->show_item)
4075 it->wd->show_item->item->showme = EINA_FALSE;
4076 it->wd->show_item = NULL;
4078 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4079 elm_smart_scroller_child_region_show(it->wd->scr,
4080 it->x + it->item->block->x,
4081 it->y + it->item->block->y - oh / 2 +
4082 it->item->h / 2, it->item->block->w, oh);
4086 elm_genlist_item_middle_bring_in(Elm_Gen_Item *it)
4088 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4091 if (it->delete_me) return;
4092 if ((it->item->queued) || (!it->item->mincalcd))
4094 it->wd->show_item = it;
4095 it->wd->bring_in = EINA_TRUE;
4096 it->item->showme = EINA_TRUE;
4099 if (it->wd->show_item)
4101 it->wd->show_item->item->showme = EINA_FALSE;
4102 it->wd->show_item = NULL;
4104 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4105 elm_smart_scroller_region_bring_in(it->wd->scr,
4106 it->x + it->item->block->x,
4107 it->y + it->item->block->y - oh / 2 + it->item->h / 2,
4108 it->item->block->w, oh);
4112 elm_genlist_item_del(Elm_Gen_Item *it)
4114 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4115 if ((it->relcount > 0) || (it->walking > 0))
4117 elm_genlist_item_subitems_clear(it);
4118 if (it->wd->show_item == it) it->wd->show_item = NULL;
4119 elm_gen_item_del_notserious(it);
4120 if (it->item->block)
4122 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE);
4123 it->item->block->changed = EINA_TRUE;
4124 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
4125 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
4133 elm_genlist_item_data_set(Elm_Gen_Item *it,
4136 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4137 elm_widget_item_data_set(it, data);
4141 elm_genlist_item_data_get(const Elm_Gen_Item *it)
4143 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4144 return elm_widget_item_data_get(it);
4148 elm_genlist_item_icons_orphan(Elm_Gen_Item *it)
4150 elm_genlist_item_contents_orphan(it);
4154 elm_genlist_item_contents_orphan(Elm_Gen_Item *it)
4156 Evas_Object *content;
4157 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4158 EINA_LIST_FREE(it->content_objs, content)
4160 elm_widget_sub_object_del(WIDGET(it), content);
4161 evas_object_smart_member_del(content);
4162 evas_object_hide(content);
4166 EAPI const Evas_Object *
4167 elm_genlist_item_object_get(const Elm_Gen_Item *it)
4169 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4174 elm_genlist_item_update(Elm_Gen_Item *it)
4176 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4177 if (!it->item->block) return;
4178 if (it->delete_me) return;
4179 it->item->mincalcd = EINA_FALSE;
4180 it->item->updateme = EINA_TRUE;
4181 it->item->block->updateme = EINA_TRUE;
4182 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4183 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4187 elm_genlist_item_item_class_update(Elm_Gen_Item *it,
4188 const Elm_Genlist_Item_Class *itc)
4190 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4191 if (!it->item->block) return;
4192 EINA_SAFETY_ON_NULL_RETURN(itc);
4193 if (it->delete_me) return;
4195 it->item->nocache = EINA_TRUE;
4196 elm_genlist_item_update(it);
4199 EAPI const Elm_Genlist_Item_Class *
4200 elm_genlist_item_item_class_get(const Elm_Gen_Item *it)
4202 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4203 if (it->delete_me) return NULL;
4207 static Evas_Object *
4208 _elm_genlist_item_label_create(void *data,
4209 Evas_Object *obj __UNUSED__,
4210 Evas_Object *tooltip,
4211 void *it __UNUSED__)
4213 Evas_Object *label = elm_label_add(tooltip);
4216 elm_object_style_set(label, "tooltip");
4217 elm_object_text_set(label, data);
4222 _elm_genlist_item_label_del_cb(void *data,
4223 Evas_Object *obj __UNUSED__,
4224 void *event_info __UNUSED__)
4226 eina_stringshare_del(data);
4230 elm_genlist_item_tooltip_text_set(Elm_Gen_Item *it,
4233 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4234 text = eina_stringshare_add(text);
4235 elm_genlist_item_tooltip_content_cb_set(it, _elm_genlist_item_label_create,
4237 _elm_genlist_item_label_del_cb);
4241 elm_genlist_item_tooltip_content_cb_set(Elm_Gen_Item *it,
4242 Elm_Tooltip_Item_Content_Cb func,
4244 Evas_Smart_Cb del_cb)
4246 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(it, error);
4248 if ((it->tooltip.content_cb == func) && (it->tooltip.data == data))
4251 if (it->tooltip.del_cb)
4252 it->tooltip.del_cb((void *)it->tooltip.data,
4255 it->tooltip.content_cb = func;
4256 it->tooltip.data = data;
4257 it->tooltip.del_cb = del_cb;
4261 elm_widget_item_tooltip_content_cb_set(it,
4262 it->tooltip.content_cb,
4263 it->tooltip.data, NULL);
4264 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
4265 elm_widget_item_tooltip_size_restrict_disable(it, it->tooltip.free_size);
4271 if (del_cb) del_cb((void *)data, NULL, NULL);
4275 elm_genlist_item_tooltip_unset(Elm_Gen_Item *it)
4277 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4278 if ((VIEW(it)) && (it->tooltip.content_cb))
4279 elm_widget_item_tooltip_unset(it);
4281 if (it->tooltip.del_cb)
4282 it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
4283 it->tooltip.del_cb = NULL;
4284 it->tooltip.content_cb = NULL;
4285 it->tooltip.data = NULL;
4286 it->tooltip.free_size = EINA_FALSE;
4287 if (it->tooltip.style)
4288 elm_genlist_item_tooltip_style_set(it, NULL);
4292 elm_genlist_item_tooltip_style_set(Elm_Gen_Item *it,
4295 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4296 eina_stringshare_replace(&it->tooltip.style, style);
4297 if (VIEW(it)) elm_widget_item_tooltip_style_set(it, style);
4301 elm_genlist_item_tooltip_style_get(const Elm_Gen_Item *it)
4303 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4304 return it->tooltip.style;
4308 elm_genlist_item_tooltip_size_restrict_disable(Elm_Gen_Item *it, Eina_Bool disable)
4310 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4311 it->tooltip.free_size = disable;
4312 if (VIEW(it)) return elm_widget_item_tooltip_size_restrict_disable(it, disable);
4317 elm_genlist_item_tooltip_size_restrict_disabled_get(const Elm_Gen_Item *it)
4319 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4320 return it->tooltip.free_size;
4324 elm_genlist_item_cursor_set(Elm_Gen_Item *it,
4327 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4328 eina_stringshare_replace(&it->mouse_cursor, cursor);
4329 if (VIEW(it)) elm_widget_item_cursor_set(it, cursor);
4333 elm_genlist_item_cursor_get(const Elm_Gen_Item *it)
4335 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4336 return elm_widget_item_cursor_get(it);
4340 elm_genlist_item_cursor_unset(Elm_Gen_Item *it)
4342 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4343 if (!it->mouse_cursor)
4347 elm_widget_item_cursor_unset(it);
4349 eina_stringshare_del(it->mouse_cursor);
4350 it->mouse_cursor = NULL;
4354 elm_genlist_item_cursor_style_set(Elm_Gen_Item *it,
4357 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4358 elm_widget_item_cursor_style_set(it, style);
4362 elm_genlist_item_cursor_style_get(const Elm_Gen_Item *it)
4364 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4365 return elm_widget_item_cursor_style_get(it);
4369 elm_genlist_item_cursor_engine_only_set(Elm_Gen_Item *it,
4370 Eina_Bool engine_only)
4372 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4373 elm_widget_item_cursor_engine_only_set(it, engine_only);
4377 elm_genlist_item_cursor_engine_only_get(const Elm_Gen_Item *it)
4379 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4380 return elm_widget_item_cursor_engine_only_get(it);
4384 elm_genlist_horizontal_set(Evas_Object *obj,
4387 ELM_CHECK_WIDTYPE(obj, widtype);
4388 Widget_Data *wd = elm_widget_data_get(obj);
4390 if (wd->mode == mode) return;
4396 elm_genlist_horizontal_mode_set(Evas_Object *obj,
4399 elm_genlist_horizontal_set(obj, mode);
4403 elm_genlist_horizontal_get(const Evas_Object *obj)
4405 ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
4406 Widget_Data *wd = elm_widget_data_get(obj);
4407 if (!wd) return ELM_LIST_LAST;
4412 elm_genlist_horizontal_mode_get(const Evas_Object *obj)
4414 return elm_genlist_horizontal_get(obj);
4418 elm_genlist_always_select_mode_set(Evas_Object *obj,
4419 Eina_Bool always_select)
4421 elm_gen_always_select_mode_set(obj, always_select);
4425 elm_genlist_always_select_mode_get(const Evas_Object *obj)
4427 return elm_gen_always_select_mode_get(obj);
4431 elm_genlist_no_select_mode_set(Evas_Object *obj,
4432 Eina_Bool no_select)
4434 elm_gen_no_select_mode_set(obj, no_select);
4438 elm_genlist_no_select_mode_get(const Evas_Object *obj)
4440 return elm_gen_no_select_mode_get(obj);
4444 elm_genlist_compress_mode_set(Evas_Object *obj,
4447 ELM_CHECK_WIDTYPE(obj, widtype);
4448 Widget_Data *wd = elm_widget_data_get(obj);
4450 wd->compress = compress;
4451 if (!compress) elm_genlist_homogeneous_set(obj, EINA_FALSE);
4455 elm_genlist_compress_mode_get(const Evas_Object *obj)
4457 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4458 Widget_Data *wd = elm_widget_data_get(obj);
4459 if (!wd) return EINA_FALSE;
4460 return wd->compress;
4464 elm_genlist_height_for_width_mode_set(Evas_Object *obj,
4465 Eina_Bool height_for_width)
4467 ELM_CHECK_WIDTYPE(obj, widtype);
4468 Widget_Data *wd = elm_widget_data_get(obj);
4470 wd->height_for_width = !!height_for_width;
4471 if (wd->height_for_width)
4473 elm_genlist_homogeneous_set(obj, EINA_FALSE);
4474 elm_genlist_compress_mode_set(obj, EINA_TRUE);
4479 elm_genlist_height_for_width_mode_get(const Evas_Object *obj)
4481 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4482 Widget_Data *wd = elm_widget_data_get(obj);
4483 if (!wd) return EINA_FALSE;
4484 return wd->height_for_width;
4488 elm_genlist_bounce_set(Evas_Object *obj,
4492 elm_gen_bounce_set(obj, h_bounce, v_bounce);
4496 elm_genlist_bounce_get(const Evas_Object *obj,
4497 Eina_Bool *h_bounce,
4498 Eina_Bool *v_bounce)
4500 elm_gen_bounce_get(obj, h_bounce, v_bounce);
4504 elm_genlist_homogeneous_set(Evas_Object *obj,
4505 Eina_Bool homogeneous)
4507 ELM_CHECK_WIDTYPE(obj, widtype);
4508 Widget_Data *wd = elm_widget_data_get(obj);
4510 if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
4511 wd->homogeneous = homogeneous;
4515 elm_genlist_homogeneous_get(const Evas_Object *obj)
4517 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4518 Widget_Data *wd = elm_widget_data_get(obj);
4519 if (!wd) return EINA_FALSE;
4520 return wd->homogeneous;
4524 elm_genlist_block_count_set(Evas_Object *obj,
4527 ELM_CHECK_WIDTYPE(obj, widtype);
4528 Widget_Data *wd = elm_widget_data_get(obj);
4530 wd->max_items_per_block = n;
4531 wd->item_cache_max = wd->max_items_per_block * 2;
4532 _item_cache_clean(wd);
4536 elm_genlist_block_count_get(const Evas_Object *obj)
4538 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4539 Widget_Data *wd = elm_widget_data_get(obj);
4541 return wd->max_items_per_block;
4545 elm_genlist_longpress_timeout_set(Evas_Object *obj,
4548 ELM_CHECK_WIDTYPE(obj, widtype);
4549 Widget_Data *wd = elm_widget_data_get(obj);
4551 wd->longpress_timeout = timeout;
4555 elm_genlist_longpress_timeout_get(const Evas_Object *obj)
4557 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4558 Widget_Data *wd = elm_widget_data_get(obj);
4560 return wd->longpress_timeout;
4564 elm_genlist_scroller_policy_set(Evas_Object *obj,
4565 Elm_Scroller_Policy policy_h,
4566 Elm_Scroller_Policy policy_v)
4568 ELM_CHECK_WIDTYPE(obj, widtype);
4569 Widget_Data *wd = elm_widget_data_get(obj);
4570 if ((!wd) || (!wd->scr)) return;
4571 if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
4572 (policy_v >= ELM_SCROLLER_POLICY_LAST))
4574 elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
4578 elm_genlist_scroller_policy_get(const Evas_Object *obj,
4579 Elm_Scroller_Policy *policy_h,
4580 Elm_Scroller_Policy *policy_v)
4582 ELM_CHECK_WIDTYPE(obj, widtype);
4583 Widget_Data *wd = elm_widget_data_get(obj);
4584 Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
4585 if ((!wd) || (!wd->scr)) return;
4586 elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
4587 if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
4588 if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
4592 elm_genlist_realized_items_update(Evas_Object *obj)
4594 ELM_CHECK_WIDTYPE(obj, widtype);
4596 Eina_List *list, *l;
4599 list = elm_genlist_realized_items_get(obj);
4600 EINA_LIST_FOREACH(list, l, it)
4601 elm_genlist_item_update(it);
4605 elm_genlist_item_mode_set(Elm_Gen_Item *it,
4606 const char *mode_type,
4609 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4610 Widget_Data *wd = it->wd;
4615 if (!mode_type) return;
4616 if ((it->delete_me) || (it->disabled)) return;
4618 if ((wd->mode_item == it) &&
4619 (!strcmp(mode_type, wd->mode_type)) &&
4622 if (!wd->mode_item_style) return;
4623 it->mode_set = mode_set;
4627 EINA_LIST_FOREACH(wd->selected, l, it2)
4629 elm_gen_item_selected_set(it2, EINA_FALSE);
4633 it2 = elm_genlist_selected_item_get(wd->obj);
4634 if ((it2) && (it2->realized))
4635 elm_gen_item_selected_set(it2, EINA_FALSE);
4638 if (((wd->mode_type) && (strcmp(mode_type, wd->mode_type))) ||
4640 ((it == wd->mode_item) && (!mode_set)))
4641 _item_mode_unset(wd);
4643 eina_stringshare_replace(&wd->mode_type, mode_type);
4644 if (mode_set) _item_mode_set(it);
4649 elm_genlist_mode_item_style_get(const Evas_Object *obj)
4651 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4652 Widget_Data *wd = elm_widget_data_get(obj);
4653 if (!wd) return NULL;
4654 return wd->mode_item_style;
4658 elm_genlist_mode_item_style_set(Evas_Object *obj, const char *style)
4660 ELM_CHECK_WIDTYPE(obj, widtype);
4661 Widget_Data *wd = elm_widget_data_get(obj);
4663 if ((style == wd->mode_item_style) || (style && wd->mode_item_style &&
4664 (!strcmp(style, wd->mode_item_style))))
4666 eina_stringshare_replace(&wd->mode_item_style, style);
4667 elm_genlist_realized_items_update(obj);
4671 elm_genlist_mode_get(const Evas_Object *obj)
4673 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4674 Widget_Data *wd = elm_widget_data_get(obj);
4675 if (!wd) return NULL;
4676 return wd->mode_type;
4679 EAPI const Elm_Gen_Item *
4680 elm_genlist_mode_item_get(const Evas_Object *obj)
4682 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4683 Widget_Data *wd = elm_widget_data_get(obj);
4684 if (!wd) return NULL;
4685 return wd->mode_item;
4689 elm_genlist_reorder_mode_set(Evas_Object *obj,
4690 Eina_Bool reorder_mode)
4692 ELM_CHECK_WIDTYPE(obj, widtype);
4693 Widget_Data *wd = elm_widget_data_get(obj);
4695 wd->reorder_mode = reorder_mode;
4699 elm_genlist_reorder_mode_get(const Evas_Object *obj)
4701 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4702 Widget_Data *wd = elm_widget_data_get(obj);
4703 if (!wd) return EINA_FALSE;
4704 return wd->reorder_mode;