3 #include <Elementary.h>
4 #include <Elementary_Cursor.h>
6 #include "els_scroller.h"
10 #define MAX_ITEMS_PER_BLOCK 32
11 #define REORDER_EFFECT_TIME 0.5
13 #define ELM_GEN_SETUP(wd) \
14 (wd)->calc_cb = (Ecore_Cb)_calc_job; \
15 (wd)->clear_cb = (Ecore_Cb)_clear_cb; \
16 (wd)->sizing_cb = (Ecore_Cb)_sizing_eval
19 #define ELM_GEN_ITEM_SETUP(it) \
20 (it)->del_cb = (Ecore_Cb)_item_del; \
21 (it)->highlight_cb = (Ecore_Cb)_item_highlight; \
22 (it)->unsel_cb = (Ecore_Cb)_item_unselect; \
23 (it)->unhighlight_cb = (Ecore_Cb)_item_unhighlight; \
24 (it)->unrealize_cb = (Ecore_Cb)_item_unrealize_cb
26 typedef struct _Item_Block Item_Block;
27 typedef struct _Item_Cache Item_Cache;
29 struct Elm_Gen_Item_Type
34 Evas_Coord w, h, minw, minh;
35 Elm_Gen_Item *group_item;
36 Elm_Genlist_Item_Flags flags;
37 Eina_List *mode_labels, *mode_icons, *mode_states, *mode_icon_objs;
38 Ecore_Timer *swipe_timer;
39 Evas_Coord scrl_x, scrl_y, old_scrl_y;
42 Evas_Object *mode_view;
48 Eina_Bool want_realize : 1;
49 Eina_Bool expanded : 1;
50 Eina_Bool mincalcd : 1;
53 Eina_Bool updateme : 1;
54 Eina_Bool nocache : 1;
55 Eina_Bool stacking_even : 1;
56 Eina_Bool nostacking : 1;
57 Eina_Bool move_effect_enabled : 1;
62 Eina_Inlist_Sorted_State *state;
63 Evas_Object *obj; /* the genlist object */
64 Evas_Object *scr; /* a smart scroller object which is used internally in genlist */
65 Evas_Object *pan_smart; /* "elm_genlist_pan" evas smart object. this is an extern pan of smart scroller(scr). */
67 Eina_List *group_items; /* list of groups index items */
68 Eina_Inlist *items; /* inlist of all items */
69 Elm_Gen_Item *reorder_it; /* item currently being repositioned */
70 Elm_Gen_Item *last_selected_item;
71 Pan *pan; /* pan_smart object's smart data */
74 int item_width, item_height;
75 int group_item_width, group_item_height;
78 Evas_Coord pan_x, pan_y;
79 Eina_Bool reorder_mode : 1;
80 Eina_Bool on_hold : 1;
82 Eina_Bool no_select : 1;
83 Eina_Bool wasselected : 1;
84 Eina_Bool always_select : 1;
85 Eina_Bool clear_me : 1;
86 Eina_Bool h_bounce : 1;
87 Eina_Bool v_bounce : 1;
88 Ecore_Cb del_cb, calc_cb, sizing_cb;
90 ////////////////////////////////////
91 Eina_Inlist *blocks; /* inlist of all blocks. a block consists of a certain number of items. maximum number of items in a block is 'max_items_per_block'. */
92 Evas_Coord reorder_old_pan_y, w, h, realminw, prev_viewport_w;
93 Ecore_Job *update_job;
94 Ecore_Idle_Enterer *queue_idle_enterer;
95 Ecore_Idler *must_recalc_idler;
97 Elm_Gen_Item *show_item, *anchor_item, *mode_item, *reorder_rel, *expanded_item;
98 Eina_Inlist *item_cache; /* an inlist of edje object it cache. */
100 Evas_Coord reorder_start_y; /* reorder it's initial y coordinate in the pan. */
102 Ecore_Timer *multi_timer, *scr_hold_timer;
103 Ecore_Animator *reorder_move_animator;
104 const char *mode_type;
105 const char *mode_item_style;
106 unsigned int start_time;
107 Evas_Coord prev_x, prev_y, prev_mx, prev_my;
108 Evas_Coord cur_x, cur_y, cur_mx, cur_my;
109 Eina_Bool mouse_down : 1;
110 Eina_Bool multi_down : 1;
111 Eina_Bool multi_timeout : 1;
112 Eina_Bool multitouched : 1;
113 Eina_Bool longpressed : 1;
114 Eina_Bool bring_in : 1;
115 Eina_Bool compress : 1;
116 Eina_Bool height_for_width : 1;
117 Eina_Bool homogeneous : 1;
119 Eina_Bool reorder_pan_move : 1;
120 Eina_Bool auto_scroll_enabled : 1;
121 Eina_Bool pan_resized : 1;
125 } history[SWIPE_MOVES];
127 int item_cache_count;
128 int item_cache_max; /* maximum number of cached items */
130 int max_items_per_block; /* maximum number of items per block */
131 double longpress_timeout; /* longpress timeout. this value comes from _elm_config by default. this can be changed by elm_genlist_longpress_timeout_set() */
142 Evas_Coord x, y, w, h, minw, minh;
143 Eina_Bool want_unrealize : 1;
144 Eina_Bool realized : 1;
145 Eina_Bool changed : 1;
146 Eina_Bool updateme : 1;
147 Eina_Bool showme : 1;
148 Eina_Bool must_recalc : 1;
155 Evas_Object *base_view, *spacer;
157 const char *item_style; // it->itc->item_style
158 Eina_Bool tree : 1; // it->group
159 Eina_Bool compress : 1; // it->wd->compress
161 Eina_Bool selected : 1; // it->selected
162 Eina_Bool disabled : 1; // it->disabled
163 Eina_Bool expanded : 1; // it->item->expanded
166 static const char *widtype = NULL;
167 static void _item_cache_zero(Widget_Data *wd);
168 static void _del_hook(Evas_Object *obj);
169 static void _mirrored_set(Evas_Object *obj,
171 static void _theme_hook(Evas_Object *obj);
172 static void _show_region_hook(void *data,
174 static void _sizing_eval(Evas_Object *obj);
175 static void _item_realize(Elm_Gen_Item *it,
178 static void _item_unrealize_cb(Elm_Gen_Item *it);
179 static void _item_block_unrealize(Item_Block *itb);
180 static void _calc_job(void *data);
181 static void _on_focus_hook(void *data,
183 static Eina_Bool _item_multi_select_up(Widget_Data *wd);
184 static Eina_Bool _item_multi_select_down(Widget_Data *wd);
185 static Eina_Bool _item_single_select_up(Widget_Data *wd);
186 static Eina_Bool _item_single_select_down(Widget_Data *wd);
187 static Eina_Bool _event_hook(Evas_Object *obj,
189 Evas_Callback_Type type,
191 static void _signal_emit_hook(Evas_Object *obj,
192 const char *emission,
194 static Eina_Bool _deselect_all_items(Widget_Data *wd);
195 static void _pan_calculate(Evas_Object *obj);
196 static void _pan_max_get(Evas_Object *obj,
199 static void _item_position(Elm_Gen_Item *it,
203 static void _mode_item_realize(Elm_Gen_Item *it);
204 static void _mode_item_unrealize(Elm_Gen_Item *it);
205 static void _item_mode_set(Elm_Gen_Item *it);
206 static void _item_mode_unset(Widget_Data *wd);
207 static void _group_items_recalc(void *data);
208 static void _item_move_after(Elm_Gen_Item *it,
209 Elm_Gen_Item *after);
210 static void _item_move_before(Elm_Gen_Item *it,
211 Elm_Gen_Item *before);
212 static void _item_auto_scroll(Widget_Data *wd);
214 static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
216 static const char SIG_ACTIVATED[] = "activated";
217 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
218 static const char SIG_SELECTED[] = "selected";
219 static const char SIG_UNSELECTED[] = "unselected";
220 static const char SIG_EXPANDED[] = "expanded";
221 static const char SIG_CONTRACTED[] = "contracted";
222 static const char SIG_EXPAND_REQUEST[] = "expand,request";
223 static const char SIG_CONTRACT_REQUEST[] = "contract,request";
224 static const char SIG_REALIZED[] = "realized";
225 static const char SIG_UNREALIZED[] = "unrealized";
226 static const char SIG_DRAG_START_UP[] = "drag,start,up";
227 static const char SIG_DRAG_START_DOWN[] = "drag,start,down";
228 static const char SIG_DRAG_START_LEFT[] = "drag,start,left";
229 static const char SIG_DRAG_START_RIGHT[] = "drag,start,right";
230 static const char SIG_DRAG_STOP[] = "drag,stop";
231 static const char SIG_DRAG[] = "drag";
232 static const char SIG_LONGPRESSED[] = "longpressed";
233 static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
234 static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
235 static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
236 static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
237 static const char SIG_SCROLL_EDGE_TOP[] = "scroll,edge,top"; // TODO : remove this
238 static const char SIG_SCROLL_EDGE_BOTTOM[] = "scroll,edge,bottom"; // TODO : remove this
239 static const char SIG_SCROLL_EDGE_LEFT[] = "scroll,edge,left"; // TODO : remove this
240 static const char SIG_SCROLL_EDGE_RIGHT[] = "scroll,edge,right"; // TODO : remove this
241 static const char SIG_EDGE_TOP[] = "edge,top";
242 static const char SIG_EDGE_BOTTOM[] = "edge,bottom";
243 static const char SIG_EDGE_LEFT[] = "edge,left";
244 static const char SIG_EDGE_RIGHT[] = "edge,right";
245 static const char SIG_MULTI_SWIPE_LEFT[] = "multi,swipe,left";
246 static const char SIG_MULTI_SWIPE_RIGHT[] = "multi,swipe,right";
247 static const char SIG_MULTI_SWIPE_UP[] = "multi,swipe,up";
248 static const char SIG_MULTI_SWIPE_DOWN[] = "multi,swipe,down";
249 static const char SIG_MULTI_PINCH_OUT[] = "multi,pinch,out";
250 static const char SIG_MULTI_PINCH_IN[] = "multi,pinch,in";
251 static const char SIG_SWIPE[] = "swipe";
252 static const char SIG_MOVED[] = "moved";
254 static const Evas_Smart_Cb_Description _signals[] = {
255 {SIG_CLICKED_DOUBLE, ""},
258 {SIG_UNSELECTED, ""},
260 {SIG_CONTRACTED, ""},
261 {SIG_EXPAND_REQUEST, ""},
262 {SIG_CONTRACT_REQUEST, ""},
264 {SIG_UNREALIZED, ""},
265 {SIG_DRAG_START_UP, ""},
266 {SIG_DRAG_START_DOWN, ""},
267 {SIG_DRAG_START_LEFT, ""},
268 {SIG_DRAG_START_RIGHT, ""},
271 {SIG_LONGPRESSED, ""},
272 {SIG_SCROLL_ANIM_START, ""},
273 {SIG_SCROLL_ANIM_STOP, ""},
274 {SIG_SCROLL_DRAG_START, ""},
275 {SIG_SCROLL_DRAG_STOP, ""},
276 {SIG_SCROLL_EDGE_TOP, ""},
277 {SIG_SCROLL_EDGE_BOTTOM, ""},
278 {SIG_SCROLL_EDGE_LEFT, ""},
279 {SIG_SCROLL_EDGE_RIGHT, ""},
281 {SIG_EDGE_BOTTOM, ""},
283 {SIG_EDGE_RIGHT, ""},
284 {SIG_MULTI_SWIPE_LEFT, ""},
285 {SIG_MULTI_SWIPE_RIGHT, ""},
286 {SIG_MULTI_SWIPE_UP, ""},
287 {SIG_MULTI_SWIPE_DOWN, ""},
288 {SIG_MULTI_PINCH_OUT, ""},
289 {SIG_MULTI_PINCH_IN, ""},
295 static Eina_Compare_Cb _elm_genlist_item_compare_cb;
296 static Eina_Compare_Cb _elm_genlist_item_compare_data_cb;
299 _event_hook(Evas_Object *obj,
300 Evas_Object *src __UNUSED__,
301 Evas_Callback_Type type,
304 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
305 Evas_Event_Key_Down *ev = event_info;
306 Widget_Data *wd = elm_widget_data_get(obj);
307 Evas_Coord pan_max_x = 0, pan_max_y = 0;
308 if (!wd) return EINA_FALSE;
309 if (!wd->items) return EINA_FALSE;
310 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
311 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
313 Elm_Gen_Item *it = NULL;
316 Evas_Coord step_x = 0;
317 Evas_Coord step_y = 0;
320 Evas_Coord page_x = 0;
321 Evas_Coord page_y = 0;
323 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
324 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
325 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
326 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
328 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
332 else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")))
336 else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
338 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
339 (_item_multi_select_up(wd)))
340 || (_item_single_select_up(wd)))
342 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
348 else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
350 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
351 (_item_multi_select_down(wd)))
352 || (_item_single_select_down(wd)))
354 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
360 else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
362 it = elm_gen_first_item_get(obj);
363 elm_genlist_item_bring_in(it);
364 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
367 else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
369 it = elm_gen_last_item_get(obj);
370 elm_genlist_item_bring_in(it);
371 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
374 else if ((!strcmp(ev->keyname, "Prior")) || (!strcmp(ev->keyname, "KP_Prior")))
377 y -= -(page_y * v_h) / 100;
381 else if ((!strcmp(ev->keyname, "Next")) || (!strcmp(ev->keyname, "KP_Next")))
384 y += -(page_y * v_h) / 100;
388 else if (!strcmp(ev->keyname, "Escape"))
390 if (!_deselect_all_items(wd)) return EINA_FALSE;
391 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
394 else if (((!strcmp(ev->keyname, "Return")) ||
395 (!strcmp(ev->keyname, "KP_Enter")) ||
396 (!strcmp(ev->keyname, "space")))
397 && (!wd->multi) && (wd->selected))
399 it = elm_genlist_selected_item_get(obj);
400 elm_genlist_item_expanded_set(it,
401 !elm_genlist_item_expanded_get(it));
402 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
404 else return EINA_FALSE;
406 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
407 _pan_max_get(wd->pan_smart, &pan_max_x, &pan_max_y);
409 if (x > pan_max_x) x = pan_max_x;
411 if (y > pan_max_y) y = pan_max_y;
412 elm_smart_scroller_child_pos_set(wd->scr, x, y);
417 _deselect_all_items(Widget_Data *wd)
419 if (!wd->selected) return EINA_FALSE;
421 elm_gen_item_selected_set(wd->selected->data, EINA_FALSE);
427 _item_multi_select_up(Widget_Data *wd)
429 if (!wd->selected) return EINA_FALSE;
430 if (!wd->multi) return EINA_FALSE;
432 Elm_Gen_Item *prev = elm_gen_item_prev_get(wd->last_selected_item);
433 if (!prev) return EINA_TRUE;
435 if (elm_gen_item_selected_get(prev))
437 elm_gen_item_selected_set(wd->last_selected_item, EINA_FALSE);
438 wd->last_selected_item = prev;
439 elm_genlist_item_show(wd->last_selected_item);
443 elm_gen_item_selected_set(prev, EINA_TRUE);
444 elm_genlist_item_show(prev);
450 _item_multi_select_down(Widget_Data *wd)
452 if (!wd->selected) return EINA_FALSE;
453 if (!wd->multi) return EINA_FALSE;
455 Elm_Gen_Item *next = elm_gen_item_next_get(wd->last_selected_item);
456 if (!next) return EINA_TRUE;
458 if (elm_gen_item_selected_get(next))
460 elm_gen_item_selected_set(wd->last_selected_item, EINA_FALSE);
461 wd->last_selected_item = next;
462 elm_genlist_item_show(wd->last_selected_item);
466 elm_gen_item_selected_set(next, EINA_TRUE);
467 elm_genlist_item_show(next);
473 _item_single_select_up(Widget_Data *wd)
478 prev = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
479 while ((prev) && (prev->delete_me))
480 prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
482 else prev = elm_gen_item_prev_get(wd->last_selected_item);
484 if (!prev) return EINA_FALSE;
486 _deselect_all_items(wd);
488 elm_gen_item_selected_set(prev, EINA_TRUE);
489 elm_genlist_item_show(prev);
494 _item_single_select_down(Widget_Data *wd)
499 next = ELM_GEN_ITEM_FROM_INLIST(wd->items);
500 while ((next) && (next->delete_me))
501 next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
503 else next = elm_gen_item_next_get(wd->last_selected_item);
505 if (!next) return EINA_FALSE;
507 _deselect_all_items(wd);
509 elm_gen_item_selected_set(next, EINA_TRUE);
510 elm_genlist_item_show(next);
515 _on_focus_hook(void *data __UNUSED__,
518 Widget_Data *wd = elm_widget_data_get(obj);
520 if (elm_widget_focus_get(obj))
522 elm_object_signal_emit(wd->obj, "elm,action,focus", "elm");
523 evas_object_focus_set(wd->obj, EINA_TRUE);
524 if ((wd->selected) && (!wd->last_selected_item))
525 wd->last_selected_item = eina_list_data_get(wd->selected);
529 elm_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
530 evas_object_focus_set(wd->obj, EINA_FALSE);
535 _del_hook(Evas_Object *obj)
537 Widget_Data *wd = elm_widget_data_get(obj);
539 _item_cache_zero(wd);
540 if (wd->calc_job) ecore_job_del(wd->calc_job);
541 if (wd->update_job) ecore_job_del(wd->update_job);
542 if (wd->queue_idle_enterer) ecore_idle_enterer_del(wd->queue_idle_enterer);
543 if (wd->must_recalc_idler) ecore_idler_del(wd->must_recalc_idler);
544 if (wd->multi_timer) ecore_timer_del(wd->multi_timer);
545 if (wd->mode_type) eina_stringshare_del(wd->mode_type);
546 if (wd->scr_hold_timer) ecore_timer_del(wd->scr_hold_timer);
551 _del_pre_hook(Evas_Object *obj)
553 Widget_Data *wd = elm_widget_data_get(obj);
556 evas_object_del(wd->pan_smart);
557 wd->pan_smart = NULL;
561 _mirrored_set(Evas_Object *obj,
564 Widget_Data *wd = elm_widget_data_get(obj);
566 _item_cache_zero(wd);
567 elm_smart_scroller_mirrored_set(wd->scr, rtl);
571 _theme_hook(Evas_Object *obj)
573 Widget_Data *wd = elm_widget_data_get(obj);
576 evas_event_freeze(evas_object_evas_get(wd->obj));
577 _item_cache_zero(wd);
578 _elm_widget_mirrored_reload(obj);
579 _mirrored_set(obj, elm_widget_mirrored_get(obj));
580 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
581 elm_widget_style_get(obj));
582 edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
583 wd->item_width = wd->item_height = 0;
584 wd->group_item_width = wd->group_item_height = 0;
585 wd->minw = wd->minh = wd->realminw = 0;
586 EINA_INLIST_FOREACH(wd->blocks, itb)
591 if (itb->realized) _item_block_unrealize(itb);
592 EINA_LIST_FOREACH(itb->items, l, it)
593 it->item->mincalcd = EINA_FALSE;
595 itb->changed = EINA_TRUE;
597 if (wd->calc_job) ecore_job_del(wd->calc_job);
598 wd->calc_job = ecore_job_add(_calc_job, wd);
600 evas_event_thaw(evas_object_evas_get(wd->obj));
601 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
605 _show_region_hook(void *data,
608 Widget_Data *wd = elm_widget_data_get(data);
609 Evas_Coord x, y, w, h;
611 elm_widget_show_region_get(obj, &x, &y, &w, &h);
612 //x & y are screen coordinates, Add with pan coordinates
615 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
619 _translate_hook(Evas_Object *obj)
621 evas_object_smart_callback_call(obj, "language,changed", NULL);
625 _sizing_eval(Evas_Object *obj)
627 Widget_Data *wd = elm_widget_data_get(obj);
628 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
630 evas_object_size_hint_min_get(wd->scr, &minw, &minh);
631 evas_object_size_hint_max_get(wd->scr, &maxw, &maxh);
633 if (wd->height_for_width)
637 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
638 if ((vw != 0) && (vw != wd->prev_viewport_w))
642 wd->prev_viewport_w = vw;
643 EINA_INLIST_FOREACH(wd->blocks, itb)
645 itb->must_recalc = EINA_TRUE;
647 if (wd->calc_job) ecore_job_del(wd->calc_job);
648 wd->calc_job = ecore_job_add(_calc_job, wd);
651 if (wd->mode == ELM_LIST_LIMIT)
653 Evas_Coord vmw, vmh, vw, vh;
657 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
658 if ((minw > 0) && (vw < minw)) vw = minw;
659 else if ((maxw > 0) && (vw > maxw))
661 edje_object_size_min_calc
662 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
669 edje_object_size_min_calc
670 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
674 evas_object_size_hint_min_set(obj, minw, minh);
675 evas_object_size_hint_max_set(obj, maxw, maxh);
679 _signal_emit_hook(Evas_Object *obj,
680 const char *emission,
683 Widget_Data *wd = elm_widget_data_get(obj);
684 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
689 _item_highlight(Elm_Gen_Item *it)
691 const char *selectraise;
692 if ((it->wd->no_select) || (it->delete_me) || (it->highlighted) ||
693 (it->disabled) || (it->display_only) || (it->item->mode_view))
695 edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
696 selectraise = edje_object_data_get(VIEW(it), "selectraise");
697 if ((selectraise) && (!strcmp(selectraise, "on")))
699 evas_object_raise(VIEW(it));
700 if ((it->item->group_item) && (it->item->group_item->realized))
701 evas_object_raise(it->item->VIEW(group_item));
703 it->highlighted = EINA_TRUE;
707 _item_unhighlight(Elm_Gen_Item *it)
709 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->item->flags != ELM_GENLIST_ITEM_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_icon_realize(Elm_Gen_Item *it,
1694 Evas_Object *target,
1697 Eina_List *res = NULL;
1699 if (it->itc->func.icon_get)
1704 *source = elm_widget_stringlist_get(edje_object_data_get(target, "icons"));
1705 EINA_LIST_FOREACH(*source, l, key)
1707 Evas_Object *ic = it->itc->func.icon_get
1708 ((void *)it->base.data, WIDGET(it), key);
1712 res = eina_list_append(res, ic);
1713 edje_object_part_swallow(target, key, ic);
1714 evas_object_show(ic);
1715 elm_widget_sub_object_add(WIDGET(it), ic);
1717 elm_widget_disabled_set(ic, EINA_TRUE);
1726 _item_state_realize(Elm_Gen_Item *it,
1727 Evas_Object *target,
1730 if (it->itc->func.state_get)
1736 *source = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
1737 EINA_LIST_FOREACH(*source, l, key)
1739 Eina_Bool on = it->itc->func.state_get
1740 ((void *)it->base.data, WIDGET(it), key);
1744 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
1745 edje_object_signal_emit(target, buf, "elm");
1749 snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
1750 edje_object_signal_emit(target, buf, "elm");
1757 _item_realize(Elm_Gen_Item *it,
1762 const char *treesize;
1764 int depth, tsize = 20;
1765 Item_Cache *itc = NULL;
1767 if (it->delete_me) return;
1768 //evas_event_freeze(evas_object_evas_get(it->wd->obj));
1771 if (it->item->order_num_in != in)
1773 it->item->order_num_in = in;
1774 _elm_genlist_item_odd_even_update(it);
1775 _elm_genlist_item_state_update(it, NULL);
1777 //evas_event_thaw(evas_object_evas_get(it->wd->obj));
1778 //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1781 it->item->order_num_in = in;
1783 if (it->item->nocache)
1784 it->item->nocache = EINA_FALSE;
1786 itc = _item_cache_find(it);
1789 VIEW(it) = itc->base_view;
1790 itc->base_view = NULL;
1791 it->spacer = itc->spacer;
1796 const char *stacking_even;
1797 const char *stacking;
1799 VIEW(it) = edje_object_add(evas_object_evas_get(WIDGET(it)));
1800 edje_object_scale_set(VIEW(it),
1801 elm_widget_scale_get(WIDGET(it)) *
1802 _elm_config->scale);
1803 evas_object_smart_member_add(VIEW(it), it->wd->pan_smart);
1804 elm_widget_sub_object_add(WIDGET(it), VIEW(it));
1806 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS)
1807 strncpy(buf, "tree", sizeof(buf));
1808 else strncpy(buf, "item", sizeof(buf));
1809 if (it->wd->compress)
1810 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
1812 strncat(buf, "/", sizeof(buf) - strlen(buf));
1813 strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf));
1815 _elm_theme_object_set(WIDGET(it), VIEW(it), "genlist", buf,
1816 elm_widget_style_get(WIDGET(it)));
1818 stacking_even = edje_object_data_get(VIEW(it), "stacking_even");
1819 if (!stacking_even) stacking_even = "above";
1820 it->item->stacking_even = !!strcmp("above", stacking_even);
1822 stacking = edje_object_data_get(VIEW(it), "stacking");
1823 if (!stacking) stacking = "yes";
1824 it->item->nostacking = !!strcmp("yes", stacking);
1826 edje_object_mirrored_set(VIEW(it),
1827 elm_widget_mirrored_get(WIDGET(it)));
1829 evas_object_rectangle_add(evas_object_evas_get(WIDGET(it)));
1830 evas_object_color_set(it->spacer, 0, 0, 0, 0);
1831 elm_widget_sub_object_add(WIDGET(it), it->spacer);
1834 _elm_genlist_item_odd_even_update(it);
1836 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
1838 if (it2->parent->item->flags != ELM_GENLIST_ITEM_GROUP) depth += 1;
1840 it->item->expanded_depth = depth;
1841 treesize = edje_object_data_get(VIEW(it), "treesize");
1842 if (treesize) tsize = atoi(treesize);
1843 evas_object_size_hint_min_set(it->spacer,
1844 (depth * tsize) * _elm_config->scale, 1);
1845 edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer);
1848 edje_object_signal_callback_add(VIEW(it),
1849 "elm,action,expand,toggle",
1850 "elm", _signal_expand_toggle, it);
1851 edje_object_signal_callback_add(VIEW(it), "elm,action,expand",
1852 "elm", _signal_expand, it);
1853 edje_object_signal_callback_add(VIEW(it), "elm,action,contract",
1854 "elm", _signal_contract, it);
1855 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN,
1857 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_UP,
1859 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
1861 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_DOWN,
1863 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_UP,
1865 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_MOVE,
1868 _elm_genlist_item_state_update(it, itc);
1871 if ((calc) && (it->wd->homogeneous) &&
1872 ((it->wd->item_width) ||
1873 ((it->wd->item_width) && (it->wd->group_item_width))))
1875 /* homogenous genlist shortcut */
1876 if (!it->item->mincalcd)
1878 if (it->item->flags & ELM_GENLIST_ITEM_GROUP)
1880 it->item->w = it->item->minw = it->wd->group_item_width;
1881 it->item->h = it->item->minh = it->wd->group_item_height;
1885 it->item->w = it->item->minw = it->wd->item_width;
1886 it->item->h = it->item->minh = it->wd->item_height;
1888 it->item->mincalcd = EINA_TRUE;
1893 /* FIXME: If you see that assert, please notify us and we
1894 will clean our mess */
1895 assert(eina_list_count(it->icon_objs) == 0);
1897 _item_label_realize(it, VIEW(it), &it->labels);
1898 it->icon_objs = _item_icon_realize(it, VIEW(it), &it->icons);
1899 _item_state_realize(it, VIEW(it), &it->states);
1901 if (!it->item->mincalcd)
1903 Evas_Coord mw = -1, mh = -1;
1905 if (!it->display_only)
1906 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1907 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
1908 edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw,
1910 if (!it->display_only)
1911 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1912 it->item->w = it->item->minw = mw;
1913 it->item->h = it->item->minh = mh;
1914 it->item->mincalcd = EINA_TRUE;
1916 if ((!it->wd->group_item_width) && (it->item->flags == ELM_GENLIST_ITEM_GROUP))
1918 it->wd->group_item_width = mw;
1919 it->wd->group_item_height = mh;
1921 else if ((!it->wd->item_width) && (it->item->flags == ELM_GENLIST_ITEM_NONE))
1923 it->wd->item_width = mw;
1924 it->wd->item_height = mh;
1927 if (!calc) evas_object_show(VIEW(it));
1930 if (it->tooltip.content_cb)
1932 elm_widget_item_tooltip_content_cb_set(it,
1933 it->tooltip.content_cb,
1934 it->tooltip.data, NULL);
1935 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
1936 elm_widget_item_tooltip_size_restrict_disable(it, it->tooltip.free_size);
1939 if (it->mouse_cursor)
1940 elm_widget_item_cursor_set(it, it->mouse_cursor);
1942 it->realized = EINA_TRUE;
1943 it->want_unrealize = EINA_FALSE;
1945 if (itc) _item_cache_free(itc);
1946 //evas_event_thaw(evas_object_evas_get(it->wd->obj));
1947 //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1949 evas_object_smart_callback_call(WIDGET(it), SIG_REALIZED, it);
1950 edje_object_message_signal_process(VIEW(it));
1954 _item_unrealize_cb(Elm_Gen_Item *it)
1956 if (it->item->nocache)
1958 evas_object_del(VIEW(it));
1960 evas_object_del(it->spacer);
1965 edje_object_mirrored_set(VIEW(it),
1966 elm_widget_mirrored_get(WIDGET(it)));
1967 edje_object_scale_set(VIEW(it),
1968 elm_widget_scale_get(WIDGET(it))
1969 * _elm_config->scale);
1970 _item_cache_add(it);
1973 _mode_item_unrealize(it);
1975 it->realized = EINA_FALSE;
1976 it->want_unrealize = EINA_FALSE;
1980 _item_block_recalc(Item_Block *itb,
1986 Evas_Coord minw = 0, minh = 0;
1987 Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE;
1990 //evas_event_freeze(evas_object_evas_get(itb->wd->obj));
1992 EINA_LIST_FOREACH(itb->items, l, it)
1994 if (it->delete_me) continue;
1995 showme |= it->item->showme;
2000 if (!it->item->mincalcd) changed = EINA_TRUE;
2003 _item_realize(it, in, EINA_TRUE);
2004 elm_gen_item_unrealize(it, EINA_TRUE);
2009 _item_realize(it, in, EINA_TRUE);
2010 elm_gen_item_unrealize(it, EINA_TRUE);
2014 _item_realize(it, in, EINA_FALSE);
2015 minh += it->item->minh;
2016 if (minw < it->item->minw) minw = it->item->minw;
2024 itb->changed = EINA_FALSE;
2025 //evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2026 //evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2031 _item_block_realize(Item_Block *itb)
2033 if (itb->realized) return;
2034 itb->realized = EINA_TRUE;
2035 itb->want_unrealize = EINA_FALSE;
2039 _item_block_unrealize(Item_Block *itb)
2043 Eina_Bool dragging = EINA_FALSE;
2045 if (!itb->realized) return;
2046 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2047 EINA_LIST_FOREACH(itb->items, l, it)
2049 if (it->item->flags != ELM_GENLIST_ITEM_GROUP)
2053 dragging = EINA_TRUE;
2054 it->want_unrealize = EINA_TRUE;
2057 elm_gen_item_unrealize(it, EINA_FALSE);
2062 itb->realized = EINA_FALSE;
2063 itb->want_unrealize = EINA_TRUE;
2066 itb->want_unrealize = EINA_FALSE;
2067 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2068 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2072 _get_space_for_reorder_item(Elm_Gen_Item *it)
2074 Evas_Coord rox, roy, row, roh, oy, oh;
2075 Eina_Bool top = EINA_FALSE;
2076 Elm_Gen_Item *reorder_it = it->wd->reorder_it;
2077 if (!reorder_it) return 0;
2079 evas_object_geometry_get(it->wd->pan_smart, NULL, &oy, NULL, &oh);
2080 evas_object_geometry_get(it->wd->VIEW(reorder_it), &rox, &roy, &row, &roh);
2082 if ((it->wd->reorder_start_y < it->item->block->y) &&
2083 (roy - oy + (roh / 2) >= it->item->block->y - it->wd->pan_y))
2085 it->item->block->reorder_offset = it->wd->reorder_it->item->h * -1;
2086 if (it->item->block->count == 1)
2087 it->wd->reorder_rel = it;
2089 else if ((it->wd->reorder_start_y >= it->item->block->y) &&
2090 (roy - oy + (roh / 2) <= it->item->block->y - it->wd->pan_y))
2092 it->item->block->reorder_offset = it->wd->reorder_it->item->h;
2095 it->item->block->reorder_offset = 0;
2097 it->item->scrl_y += it->item->block->reorder_offset;
2099 top = (ELM_RECTS_INTERSECT(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h,
2100 rox, roy + (roh / 2), row, 1));
2103 it->wd->reorder_rel = it;
2104 it->item->scrl_y += it->wd->reorder_it->item->h;
2105 return it->wd->reorder_it->item->h;
2112 _reorder_move_animator_cb(void *data)
2114 Elm_Gen_Item *it = data;
2115 Eina_Bool down = EINA_FALSE;
2117 int y, dy = it->item->h / 10 * _elm_config->scale, diff;
2119 t = ((0.0 > (t = ecore_loop_time_get()-it->wd->start_time)) ? 0.0 : t);
2121 if (t <= REORDER_EFFECT_TIME) y = (1 * sin((t / REORDER_EFFECT_TIME) * (M_PI / 2)) * dy);
2124 diff = abs(it->item->old_scrl_y - it->item->scrl_y);
2125 if (diff > it->item->h) y = diff / 2;
2127 if (it->item->old_scrl_y < it->item->scrl_y)
2129 it->item->old_scrl_y += y;
2132 else if (it->item->old_scrl_y > it->item->scrl_y)
2134 it->item->old_scrl_y -= y;
2137 _item_position(it, VIEW(it), it->item->scrl_x, it->item->old_scrl_y);
2138 _group_items_recalc(it->wd);
2140 if ((it->wd->reorder_pan_move) ||
2141 (down && it->item->old_scrl_y >= it->item->scrl_y) ||
2142 (!down && it->item->old_scrl_y <= it->item->scrl_y))
2144 it->item->old_scrl_y = it->item->scrl_y;
2145 it->item->move_effect_enabled = EINA_FALSE;
2146 it->wd->reorder_move_animator = NULL;
2147 return ECORE_CALLBACK_CANCEL;
2149 return ECORE_CALLBACK_RENEW;
2153 _item_position(Elm_Gen_Item *it,
2161 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2162 evas_object_resize(view, it->item->w, it->item->h);
2163 evas_object_move(view, it_x, it_y);
2164 evas_object_show(view);
2165 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2166 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2170 _item_block_position(Item_Block *itb,
2176 Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2179 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2180 evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh);
2181 evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy,
2183 EINA_LIST_FOREACH(itb->items, l, it)
2185 if (it->delete_me) continue;
2186 else if (it->wd->reorder_it == it) continue;
2189 it->item->w = itb->w;
2190 it->item->scrl_x = itb->x + it->x - it->wd->pan_x + ox;
2191 it->item->scrl_y = itb->y + it->y - it->wd->pan_y + oy;
2193 vis = (ELM_RECTS_INTERSECT(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h,
2194 cvx, cvy, cvw, cvh));
2195 if (it->item->flags != ELM_GENLIST_ITEM_GROUP)
2197 if ((itb->realized) && (!it->realized))
2199 if (vis) _item_realize(it, in, EINA_FALSE);
2205 if (it->wd->reorder_mode)
2206 y += _get_space_for_reorder_item(it);
2207 git = it->item->group_item;
2210 if (git->item->scrl_y < oy)
2211 git->item->scrl_y = oy;
2212 if ((git->item->scrl_y + git->item->h) > (it->item->scrl_y + it->item->h))
2213 git->item->scrl_y = (it->item->scrl_y + it->item->h) - git->item->h;
2214 git->item->want_realize = EINA_TRUE;
2216 if ((it->wd->reorder_it) && (it->item->old_scrl_y != it->item->scrl_y))
2218 if (!it->item->move_effect_enabled)
2220 it->item->move_effect_enabled = EINA_TRUE;
2221 it->wd->reorder_move_animator =
2223 _reorder_move_animator_cb, it);
2226 if (!it->item->move_effect_enabled)
2228 if (it->item->mode_view)
2229 _item_position(it, it->item->mode_view, it->item->scrl_x,
2232 _item_position(it, VIEW(it), it->item->scrl_x,
2234 it->item->old_scrl_y = it->item->scrl_y;
2239 if (!it->dragging) elm_gen_item_unrealize(it, EINA_FALSE);
2246 if (vis) it->item->want_realize = EINA_TRUE;
2250 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2251 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2255 _group_items_recalc(void *data)
2257 Widget_Data *wd = data;
2261 evas_event_freeze(evas_object_evas_get(wd->obj));
2262 EINA_LIST_FOREACH(wd->group_items, l, git)
2264 if (git->item->want_realize)
2267 _item_realize(git, 0, EINA_FALSE);
2268 evas_object_resize(VIEW(git), wd->minw, git->item->h);
2269 evas_object_move(VIEW(git), git->item->scrl_x, git->item->scrl_y);
2270 evas_object_show(VIEW(git));
2271 evas_object_raise(VIEW(git));
2273 else if (!git->item->want_realize && git->realized)
2276 elm_gen_item_unrealize(git, EINA_FALSE);
2279 evas_event_thaw(evas_object_evas_get(wd->obj));
2280 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2284 _must_recalc_idler(void *data)
2286 Widget_Data *wd = data;
2287 if (wd->calc_job) ecore_job_del(wd->calc_job);
2288 wd->calc_job = ecore_job_add(_calc_job, wd);
2289 wd->must_recalc_idler = NULL;
2290 return ECORE_CALLBACK_CANCEL;
2294 _calc_job(void *data)
2296 Widget_Data *wd = data;
2297 Item_Block *itb, *chb = NULL;
2298 Evas_Coord minw = -1, minh = 0, y = 0, ow;
2300 Eina_Bool minw_change = EINA_FALSE;
2301 Eina_Bool did_must_recalc = EINA_FALSE;
2304 evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h);
2308 evas_event_freeze(evas_object_evas_get(wd->obj));
2309 EINA_INLIST_FOREACH(wd->blocks, itb)
2311 Eina_Bool showme = EINA_FALSE;
2314 showme = itb->showme;
2315 itb->showme = EINA_FALSE;
2318 if (itb->realized) _item_block_unrealize(itb);
2320 if ((itb->changed) || ((itb->must_recalc) && (!did_must_recalc)))
2322 if (itb->must_recalc)
2326 EINA_LIST_FOREACH(itb->items, l, it)
2327 if (it->item->mincalcd) it->item->mincalcd = EINA_FALSE;
2328 itb->changed = EINA_TRUE;
2329 if (itb->must_recalc) did_must_recalc = EINA_TRUE;
2330 itb->must_recalc = EINA_FALSE;
2332 if (itb->realized) _item_block_unrealize(itb);
2333 showme = _item_block_recalc(itb, in, EINA_FALSE);
2339 if (minw == -1) minw = itb->minw;
2340 else if ((!itb->must_recalc) && (minw < itb->minw))
2343 minw_change = EINA_TRUE;
2349 if ((showme) && (wd->show_item) && (!wd->show_item->item->queued))
2351 wd->show_item->item->showme = EINA_FALSE;
2353 elm_smart_scroller_region_bring_in(wd->scr,
2355 wd->show_item->item->block->x,
2357 wd->show_item->item->block->y,
2358 wd->show_item->item->block->w,
2359 wd->show_item->item->h);
2361 elm_smart_scroller_child_region_show(wd->scr,
2363 wd->show_item->item->block->x,
2365 wd->show_item->item->block->y,
2366 wd->show_item->item->block->w,
2367 wd->show_item->item->h);
2368 wd->show_item = NULL;
2373 EINA_INLIST_FOREACH(wd->blocks, itb)
2379 if ((chb) && (EINA_INLIST_GET(chb)->next))
2381 EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb)
2383 if (itb->realized) _item_block_unrealize(itb);
2386 wd->realminw = minw;
2387 if (minw < wd->w) minw = wd->w;
2388 if ((minw != wd->minw) || (minh != wd->minh))
2392 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
2393 _sizing_eval(wd->obj);
2394 if ((wd->anchor_item) && (wd->anchor_item->item->block) && (!wd->auto_scroll_enabled))
2399 it = wd->anchor_item;
2400 it_y = wd->anchor_y;
2401 elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x,
2402 it->item->block->y + it->y + it_y);
2403 wd->anchor_item = it;
2404 wd->anchor_y = it_y;
2407 if (did_must_recalc)
2409 if (!wd->must_recalc_idler)
2410 wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd);
2412 wd->calc_job = NULL;
2413 evas_object_smart_changed(wd->pan_smart);
2414 evas_event_thaw(evas_object_evas_get(wd->obj));
2415 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2419 _update_job(void *data)
2421 Widget_Data *wd = data;
2425 Eina_Bool position = EINA_FALSE, recalc = EINA_FALSE;
2427 wd->update_job = NULL;
2430 evas_event_freeze(evas_object_evas_get(wd->obj));
2431 EINA_INLIST_FOREACH(wd->blocks, itb)
2433 Evas_Coord itminw, itminh;
2440 _item_block_position(itb, num);
2444 recalc = EINA_FALSE;
2445 EINA_LIST_FOREACH(itb->items, l2, it)
2447 if (it->item->updateme)
2449 itminw = it->item->minw;
2450 itminh = it->item->minh;
2452 it->item->updateme = EINA_FALSE;
2455 elm_gen_item_unrealize(it, EINA_FALSE);
2456 _item_realize(it, num, EINA_FALSE);
2457 position = EINA_TRUE;
2461 _item_realize(it, num, EINA_TRUE);
2462 elm_gen_item_unrealize(it, EINA_TRUE);
2464 if ((it->item->minw != itminw) || (it->item->minh != itminh))
2469 itb->updateme = EINA_FALSE;
2472 position = EINA_TRUE;
2473 itb->changed = EINA_TRUE;
2474 _item_block_recalc(itb, num0, EINA_FALSE);
2475 _item_block_position(itb, num0);
2480 if (wd->calc_job) ecore_job_del(wd->calc_job);
2481 wd->calc_job = ecore_job_add(_calc_job, wd);
2483 evas_event_thaw(evas_object_evas_get(wd->obj));
2484 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2488 _pan_set(Evas_Object *obj,
2492 Pan *sd = evas_object_smart_data_get(obj);
2496 // Evas_Coord ow, oh;
2497 // evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2498 // ow = sd->wd->minw - ow;
2499 // if (ow < 0) ow = 0;
2500 // oh = sd->wd->minh - oh;
2501 // if (oh < 0) oh = 0;
2502 // if (x < 0) x = 0;
2503 // if (y < 0) y = 0;
2504 // if (x > ow) x = ow;
2505 // if (y > oh) y = oh;
2506 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
2510 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2512 if ((itb->y + itb->h) > y)
2517 EINA_LIST_FOREACH(itb->items, l2, it)
2519 if ((itb->y + it->y) >= y)
2521 sd->wd->anchor_item = it;
2522 sd->wd->anchor_y = -(itb->y + it->y - y);
2529 if (!sd->wd->reorder_move_animator) evas_object_smart_changed(obj);
2533 _pan_get(Evas_Object *obj,
2537 Pan *sd = evas_object_smart_data_get(obj);
2540 if (x) *x = sd->wd->pan_x;
2541 if (y) *y = sd->wd->pan_y;
2545 _pan_max_get(Evas_Object *obj,
2549 Pan *sd = evas_object_smart_data_get(obj);
2553 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2554 ow = sd->wd->minw - ow;
2556 oh = sd->wd->minh - oh;
2563 _pan_min_get(Evas_Object *obj __UNUSED__,
2572 _pan_child_size_get(Evas_Object *obj,
2576 Pan *sd = evas_object_smart_data_get(obj);
2579 if (w) *w = sd->wd->minw;
2580 if (h) *h = sd->wd->minh;
2584 _pan_add(Evas_Object *obj)
2587 Evas_Object_Smart_Clipped_Data *cd;
2590 cd = evas_object_smart_data_get(obj);
2593 sd->__clipped_data = *cd;
2595 evas_object_smart_data_set(obj, sd);
2599 _pan_del(Evas_Object *obj)
2601 Pan *sd = evas_object_smart_data_get(obj);
2606 ecore_job_del(sd->resize_job);
2607 sd->resize_job = NULL;
2613 _pan_resize_job(void *data)
2617 _sizing_eval(sd->wd->obj);
2618 sd->resize_job = NULL;
2622 _pan_resize(Evas_Object *obj,
2626 Pan *sd = evas_object_smart_data_get(obj);
2630 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2631 if ((ow == w) && (oh == h)) return;
2632 if ((sd->wd->height_for_width) && (ow != w))
2635 if (sd->resize_job) ecore_job_del(sd->resize_job);
2636 sd->resize_job = ecore_job_add(_pan_resize_job, sd);
2638 sd->wd->pan_resized = EINA_TRUE;
2639 evas_object_smart_changed(obj);
2640 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2641 sd->wd->calc_job = NULL;
2643 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2644 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2649 _pan_calculate(Evas_Object *obj)
2651 Pan *sd = evas_object_smart_data_get(obj);
2653 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2659 evas_event_freeze(evas_object_evas_get(obj));
2661 if (sd->wd->pan_resized)
2664 sd->wd->pan_resized = EINA_FALSE;
2667 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
2668 evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
2669 EINA_LIST_FOREACH(sd->wd->group_items, l, git)
2671 git->item->want_realize = EINA_FALSE;
2673 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2675 itb->w = sd->wd->minw;
2676 if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox,
2677 itb->y - sd->wd->pan_y + oy,
2679 cvx, cvy, cvw, cvh))
2681 if ((!itb->realized) || (itb->changed))
2682 _item_block_realize(itb);
2683 _item_block_position(itb, in);
2687 if (itb->realized) _item_block_unrealize(itb);
2691 if ((!sd->wd->reorder_it) || (sd->wd->reorder_pan_move))
2692 _group_items_recalc(sd->wd);
2693 if ((sd->wd->reorder_mode) && (sd->wd->reorder_it))
2695 if (sd->wd->pan_y != sd->wd->reorder_old_pan_y)
2696 sd->wd->reorder_pan_move = EINA_TRUE;
2697 else sd->wd->reorder_pan_move = EINA_FALSE;
2698 evas_object_raise(sd->wd->VIEW(reorder_it));
2699 sd->wd->reorder_old_pan_y = sd->wd->pan_y;
2700 sd->wd->start_time = ecore_loop_time_get();
2702 _item_auto_scroll(sd->wd);
2703 evas_event_thaw(evas_object_evas_get(obj));
2704 evas_event_thaw_eval(evas_object_evas_get(obj));
2708 _pan_move(Evas_Object *obj,
2709 Evas_Coord x __UNUSED__,
2710 Evas_Coord y __UNUSED__)
2712 Pan *sd = evas_object_smart_data_get(obj);
2715 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2716 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2720 _hold_on(void *data __UNUSED__,
2722 void *event_info __UNUSED__)
2724 Widget_Data *wd = elm_widget_data_get(obj);
2726 elm_smart_scroller_hold_set(wd->scr, 1);
2730 _hold_off(void *data __UNUSED__,
2732 void *event_info __UNUSED__)
2734 Widget_Data *wd = elm_widget_data_get(obj);
2736 elm_smart_scroller_hold_set(wd->scr, 0);
2740 _freeze_on(void *data __UNUSED__,
2742 void *event_info __UNUSED__)
2744 Widget_Data *wd = elm_widget_data_get(obj);
2746 elm_smart_scroller_freeze_set(wd->scr, 1);
2750 _freeze_off(void *data __UNUSED__,
2752 void *event_info __UNUSED__)
2754 Widget_Data *wd = elm_widget_data_get(obj);
2756 elm_smart_scroller_freeze_set(wd->scr, 0);
2760 _scr_anim_start(void *data,
2761 Evas_Object *obj __UNUSED__,
2762 void *event_info __UNUSED__)
2764 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL);
2768 _scr_anim_stop(void *data,
2769 Evas_Object *obj __UNUSED__,
2770 void *event_info __UNUSED__)
2772 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL);
2776 _scr_drag_start(void *data,
2777 Evas_Object *obj __UNUSED__,
2778 void *event_info __UNUSED__)
2780 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
2784 _scr_drag_stop(void *data,
2785 Evas_Object *obj __UNUSED__,
2786 void *event_info __UNUSED__)
2788 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
2792 _edge_left(void *data,
2793 Evas_Object *scr __UNUSED__,
2794 void *event_info __UNUSED__)
2796 Evas_Object *obj = data;
2797 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_LEFT, NULL);
2798 evas_object_smart_callback_call(obj, SIG_EDGE_LEFT, NULL);
2802 _edge_right(void *data,
2803 Evas_Object *scr __UNUSED__,
2804 void *event_info __UNUSED__)
2806 Evas_Object *obj = data;
2807 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_RIGHT, NULL);
2808 evas_object_smart_callback_call(obj, SIG_EDGE_RIGHT, NULL);
2812 _edge_top(void *data,
2813 Evas_Object *scr __UNUSED__,
2814 void *event_info __UNUSED__)
2816 Evas_Object *obj = data;
2817 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_TOP, NULL);
2818 evas_object_smart_callback_call(obj, SIG_EDGE_TOP, NULL);
2822 _edge_bottom(void *data,
2823 Evas_Object *scr __UNUSED__,
2824 void *event_info __UNUSED__)
2826 Evas_Object *obj = data;
2827 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_BOTTOM, NULL);
2828 evas_object_smart_callback_call(obj, SIG_EDGE_BOTTOM, NULL);
2832 _mode_item_realize(Elm_Gen_Item *it)
2836 if ((it->item->mode_view) || (it->delete_me)) return;
2838 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2839 it->item->mode_view = edje_object_add(evas_object_evas_get(WIDGET(it)));
2840 edje_object_scale_set(it->item->mode_view,
2841 elm_widget_scale_get(WIDGET(it)) *
2842 _elm_config->scale);
2843 evas_object_smart_member_add(it->item->mode_view, it->wd->pan_smart);
2844 elm_widget_sub_object_add(WIDGET(it), it->item->mode_view);
2846 strncpy(buf, "item", sizeof(buf));
2847 if (it->wd->compress)
2848 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
2850 if (it->item->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
2851 strncat(buf, "/", sizeof(buf) - strlen(buf));
2852 strncat(buf, it->wd->mode_item_style, sizeof(buf) - strlen(buf));
2854 _elm_theme_object_set(WIDGET(it), it->item->mode_view, "genlist", buf,
2855 elm_widget_style_get(WIDGET(it)));
2856 edje_object_mirrored_set(it->item->mode_view,
2857 elm_widget_mirrored_get(WIDGET(it)));
2859 /* signal callback add */
2860 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_DOWN,
2862 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_UP,
2864 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_MOVE,
2867 /* label_get, icon_get, state_get */
2868 /* FIXME: If you see that assert, please notify us and we
2869 will clean our mess */
2870 assert(eina_list_count(it->item->mode_icon_objs) == 0);
2872 _item_label_realize(it, it->item->mode_view, &it->item->mode_labels);
2873 it->item->mode_icon_objs = _item_icon_realize(it,
2874 it->item->mode_view,
2875 &it->item->mode_icons);
2876 _item_state_realize(it, it->item->mode_view, &it->item->mode_states);
2878 edje_object_part_swallow(it->item->mode_view,
2879 edje_object_data_get(it->item->mode_view, "mode_part"),
2882 it->want_unrealize = EINA_FALSE;
2883 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2884 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2888 _mode_item_unrealize(Elm_Gen_Item *it)
2890 Widget_Data *wd = it->wd;
2892 if (!it->item->mode_view) return;
2894 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2895 elm_widget_stringlist_free(it->item->mode_labels);
2896 it->item->mode_labels = NULL;
2897 elm_widget_stringlist_free(it->item->mode_icons);
2898 it->item->mode_icons = NULL;
2899 elm_widget_stringlist_free(it->item->mode_states);
2901 EINA_LIST_FREE(it->item->mode_icon_objs, icon)
2902 evas_object_del(icon);
2904 edje_object_part_unswallow(it->item->mode_view, VIEW(it));
2905 evas_object_smart_member_add(VIEW(it), wd->pan_smart);
2906 evas_object_del(it->item->mode_view);
2907 it->item->mode_view = NULL;
2909 if (wd->mode_item == it)
2910 wd->mode_item = NULL;
2911 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2912 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2916 _item_mode_set(Elm_Gen_Item *it)
2919 Widget_Data *wd = it->wd;
2924 it->item->nocache = EINA_TRUE;
2926 if (wd->scr_hold_timer)
2928 ecore_timer_del(wd->scr_hold_timer);
2929 wd->scr_hold_timer = NULL;
2931 elm_smart_scroller_hold_set(wd->scr, EINA_TRUE);
2932 wd->scr_hold_timer = ecore_timer_add(0.1, _scr_hold_timer_cb, wd);
2934 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2935 _mode_item_realize(it);
2936 if (it->item->group_item)
2937 evas_object_raise(it->item->VIEW(group_item));
2938 _item_position(it, it->item->mode_view, it->item->scrl_x, it->item->scrl_y);
2939 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2940 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2942 snprintf(buf, sizeof(buf), "elm,state,%s,active", wd->mode_type);
2943 edje_object_signal_emit(it->item->mode_view, buf, "elm");
2947 _item_mode_unset(Widget_Data *wd)
2950 if (!wd->mode_item) return;
2951 char buf[1024], buf2[1024];
2955 it->item->nocache = EINA_TRUE;
2957 snprintf(buf, sizeof(buf), "elm,state,%s,passive", wd->mode_type);
2958 snprintf(buf2, sizeof(buf2), "elm,state,%s,passive,finished", wd->mode_type);
2960 edje_object_signal_emit(it->item->mode_view, buf, "elm");
2961 edje_object_signal_callback_add(it->item->mode_view, buf2, "elm", _mode_finished_signal_cb, it);
2963 wd->mode_item = NULL;
2967 _item_auto_scroll(Widget_Data *wd)
2972 Evas_Coord ox, oy, ow, oh;
2974 if ((wd->expanded_item) && (wd->auto_scroll_enabled))
2976 evas_object_geometry_get(wd->obj, &ox, &oy, &ow, &oh);
2977 if (wd->expanded_item->item->scrl_y > (oh + oy) / 2)
2979 EINA_LIST_FOREACH(wd->expanded_item->item->items, l, it)
2980 elm_genlist_item_bring_in(it);
2982 wd->auto_scroll_enabled = EINA_FALSE;
2987 elm_genlist_add(Evas_Object *parent)
2992 Evas_Coord minw, minh;
2993 static Evas_Smart *smart = NULL;
2997 static Evas_Smart_Class sc;
2999 evas_object_smart_clipped_smart_set(&_pan_sc);
3001 sc.name = "elm_genlist_pan";
3002 sc.version = EVAS_SMART_CLASS_VERSION;
3005 sc.resize = _pan_resize;
3006 sc.move = _pan_move;
3007 sc.calculate = _pan_calculate;
3008 if (!(smart = evas_smart_class_new(&sc))) return NULL;
3011 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
3013 ELM_SET_WIDTYPE(widtype, "genlist");
3015 elm_widget_type_set(obj, "genlist");
3016 elm_widget_sub_object_add(parent, obj);
3017 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
3018 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
3019 elm_widget_data_set(obj, wd);
3020 elm_widget_del_hook_set(obj, _del_hook);
3021 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
3022 elm_widget_theme_hook_set(obj, _theme_hook);
3023 elm_widget_can_focus_set(obj, EINA_TRUE);
3024 elm_widget_event_hook_set(obj, _event_hook);
3025 elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
3026 elm_widget_translate_hook_set(obj, _translate_hook);
3028 wd->scr = elm_smart_scroller_add(e);
3029 elm_smart_scroller_widget_set(wd->scr, obj);
3030 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
3031 elm_widget_style_get(obj));
3032 elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE,
3033 _elm_config->thumbscroll_bounce_enable);
3034 elm_widget_resize_object_set(obj, wd->scr);
3036 evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj);
3037 evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, obj);
3038 evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj);
3039 evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj);
3040 evas_object_smart_callback_add(wd->scr, "edge,left", _edge_left, obj);
3041 evas_object_smart_callback_add(wd->scr, "edge,right", _edge_right, obj);
3042 evas_object_smart_callback_add(wd->scr, "edge,top", _edge_top, obj);
3043 evas_object_smart_callback_add(wd->scr, "edge,bottom", _edge_bottom, obj);
3046 wd->mode = ELM_LIST_SCROLL;
3047 wd->max_items_per_block = MAX_ITEMS_PER_BLOCK;
3048 wd->item_cache_max = wd->max_items_per_block * 2;
3049 wd->longpress_timeout = _elm_config->longpress_timeout;
3051 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
3052 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
3053 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
3054 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
3056 wd->pan_smart = evas_object_smart_add(e, smart);
3057 wd->pan = evas_object_smart_data_get(wd->pan_smart);
3060 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
3061 _pan_set, _pan_get, _pan_max_get,
3062 _pan_min_get, _pan_child_size_get);
3064 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
3066 evas_object_size_hint_min_set(obj, minw, minh);
3068 evas_object_smart_callbacks_descriptions_set(obj, _signals);
3070 _mirrored_set(obj, elm_widget_mirrored_get(obj));
3075 static Elm_Gen_Item *
3076 _item_new(Widget_Data *wd,
3077 const Elm_Genlist_Item_Class *itc,
3079 Elm_Gen_Item *parent,
3080 Elm_Genlist_Item_Flags flags,
3082 const void *func_data)
3086 it = elm_gen_item_new(wd, itc, data, parent, func, func_data);
3087 if (!it) return NULL;
3088 it->item = ELM_NEW(Elm_Gen_Item_Type);
3089 it->item->flags = flags;
3090 if (flags & ELM_GENLIST_ITEM_GROUP) it->group++;
3091 it->item->expanded_depth = 0;
3092 elm_widget_item_del_cb_set(it, _item_del_hook);
3093 ELM_GEN_ITEM_SETUP(it);
3096 if (it->parent->group)
3097 it->item->group_item = parent;
3098 else if (it->parent->item->group_item)
3099 it->item->group_item = it->parent->item->group_item;
3105 _item_block_add(Widget_Data *wd,
3108 Item_Block *itb = NULL;
3115 itb = calloc(1, sizeof(Item_Block));
3118 if (!it->item->rel->item->block)
3121 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3122 itb->items = eina_list_append(itb->items, it);
3126 if (it->item->before)
3128 wd->blocks = eina_inlist_prepend_relative
3129 (wd->blocks, EINA_INLIST_GET(itb),
3130 EINA_INLIST_GET(it->item->rel->item->block));
3132 eina_list_prepend_relative(itb->items, it, it->item->rel);
3136 wd->blocks = eina_inlist_append_relative
3137 (wd->blocks, EINA_INLIST_GET(itb),
3138 EINA_INLIST_GET(it->item->rel->item->block));
3140 eina_list_append_relative(itb->items, it, it->item->rel);
3146 if (it->item->before)
3150 itb = (Item_Block *)(wd->blocks);
3151 if (itb->count >= wd->max_items_per_block)
3153 itb = calloc(1, sizeof(Item_Block));
3157 eina_inlist_prepend(wd->blocks,
3158 EINA_INLIST_GET(itb));
3163 itb = calloc(1, sizeof(Item_Block));
3167 eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
3169 itb->items = eina_list_prepend(itb->items, it);
3175 itb = (Item_Block *)(wd->blocks->last);
3176 if (itb->count >= wd->max_items_per_block)
3178 itb = calloc(1, sizeof(Item_Block));
3182 eina_inlist_append(wd->blocks,
3183 EINA_INLIST_GET(itb));
3188 itb = calloc(1, sizeof(Item_Block));
3192 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3194 itb->items = eina_list_append(itb->items, it);
3200 itb = it->item->rel->item->block;
3201 if (!itb) goto newblock;
3202 if (it->item->before)
3203 itb->items = eina_list_prepend_relative(itb->items, it, it->item->rel);
3205 itb->items = eina_list_append_relative(itb->items, it, it->item->rel);
3208 itb->changed = EINA_TRUE;
3209 it->item->block = itb;
3210 if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job);
3211 itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd);
3214 it->item->rel->relcount--;
3215 if ((it->item->rel->delete_me) && (!it->item->rel->relcount))
3216 _item_del(it->item->rel);
3217 it->item->rel = NULL;
3219 if (itb->count > itb->wd->max_items_per_block)
3225 newc = itb->count / 2;
3226 itb2 = calloc(1, sizeof(Item_Block));
3230 eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
3231 EINA_INLIST_GET(itb));
3232 itb2->changed = EINA_TRUE;
3233 while ((itb->count > newc) && (itb->items))
3237 l = eina_list_last(itb->items);
3239 itb->items = eina_list_remove_list(itb->items, l);
3242 itb2->items = eina_list_prepend(itb2->items, it2);
3243 it2->item->block = itb2;
3250 _queue_process(Widget_Data *wd)
3253 Eina_Bool showme = EINA_FALSE;
3256 t0 = ecore_time_get();
3257 //evas_event_freeze(evas_object_evas_get(wd->obj));
3258 for (n = 0; (wd->queue) && (n < 128); n++)
3262 it = wd->queue->data;
3263 wd->queue = eina_list_remove_list(wd->queue, wd->queue);
3264 it->item->queued = EINA_FALSE;
3265 _item_block_add(wd, it);
3266 t = ecore_time_get();
3267 if (it->item->block->changed)
3269 showme = _item_block_recalc(it->item->block, it->item->block->num, EINA_TRUE);
3270 it->item->block->changed = 0;
3272 if (showme) it->item->block->showme = EINA_TRUE;
3273 if (eina_inlist_count(wd->blocks) > 1)
3275 if ((t - t0) > (ecore_animator_frametime_get())) break;
3278 //evas_event_thaw(evas_object_evas_get(wd->obj));
3279 //evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3284 _idle_process(void *data, Eina_Bool *wakeup)
3286 Widget_Data *wd = data;
3289 //static double q_start = 0.0;
3290 //if (q_start == 0.0) q_start = ecore_time_get();
3292 if (_queue_process(wd) > 0) *wakeup = EINA_TRUE;
3296 //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start);
3298 return ECORE_CALLBACK_CANCEL;
3300 return ECORE_CALLBACK_RENEW;
3304 _item_idle_enterer(void *data)
3306 Widget_Data *wd = data;
3307 Eina_Bool wakeup = EINA_FALSE;
3308 Eina_Bool ok = _idle_process(data, &wakeup);
3313 if (wd->calc_job) ecore_job_del(wd->calc_job);
3314 wd->calc_job = ecore_job_add(_calc_job, wd);
3316 if (ok == ECORE_CALLBACK_CANCEL) wd->queue_idle_enterer = NULL;
3321 _item_queue(Widget_Data *wd,
3324 if (it->item->queued) return;
3325 it->item->queued = EINA_TRUE;
3326 wd->queue = eina_list_append(wd->queue, it);
3327 // FIXME: why does a freeze then thaw here cause some genlist
3328 // elm_genlist_item_append() to be much much slower?
3329 // evas_event_freeze(evas_object_evas_get(wd->obj));
3330 while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
3332 if (wd->queue_idle_enterer)
3334 ecore_idle_enterer_del(wd->queue_idle_enterer);
3335 wd->queue_idle_enterer = NULL;
3339 // evas_event_thaw(evas_object_evas_get(wd->obj));
3340 // evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3341 if (!wd->queue_idle_enterer)
3342 wd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, wd);
3346 _elm_genlist_item_compare_data(const void *data, const void *data1)
3348 const Elm_Gen_Item *it = data;
3349 const Elm_Gen_Item *item1 = data1;
3351 return _elm_genlist_item_compare_data_cb(it->base.data, item1->base.data);
3355 _elm_genlist_item_compare(const void *data, const void *data1)
3357 const Elm_Gen_Item *it, *item1;
3358 it = ELM_GEN_ITEM_FROM_INLIST(data);
3359 item1 = ELM_GEN_ITEM_FROM_INLIST(data1);
3360 return _elm_genlist_item_compare_cb(it, item1);
3364 _elm_genlist_item_list_compare(const void *data, const void *data1)
3366 const Elm_Gen_Item *it = data;
3367 const Elm_Gen_Item *item1 = data1;
3368 return _elm_genlist_item_compare_cb(it, item1);
3372 _item_move_after(Elm_Gen_Item *it, Elm_Gen_Item *after)
3377 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3378 _item_block_del(it);
3380 it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
3381 it->item->rel = after;
3382 it->item->rel->relcount++;
3383 it->item->before = EINA_FALSE;
3384 if (after->item->group_item) it->item->group_item = after->item->group_item;
3385 _item_queue(it->wd, it);
3387 evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it);
3391 _item_move_before(Elm_Gen_Item *it, Elm_Gen_Item *before)
3394 if (!before) return;
3396 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3397 _item_block_del(it);
3398 it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
3399 it->item->rel = before;
3400 it->item->rel->relcount++;
3401 it->item->before = EINA_TRUE;
3402 if (before->item->group_item) it->item->group_item = before->item->group_item;
3403 _item_queue(it->wd, it);
3405 evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it);
3409 elm_genlist_item_append(Evas_Object *obj,
3410 const Elm_Genlist_Item_Class *itc,
3412 Elm_Gen_Item *parent,
3413 Elm_Genlist_Item_Flags flags,
3415 const void *func_data)
3417 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3418 Widget_Data *wd = elm_widget_data_get(obj);
3419 if (!wd) return NULL;
3420 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3422 if (!it) return NULL;
3425 if (flags & ELM_GENLIST_ITEM_GROUP)
3426 wd->group_items = eina_list_append(wd->group_items, it);
3427 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
3428 it->item->rel = NULL;
3432 Elm_Gen_Item *it2 = NULL;
3433 Eina_List *ll = eina_list_last(it->parent->item->items);
3434 if (ll) it2 = ll->data;
3435 it->parent->item->items = eina_list_append(it->parent->item->items, it);
3436 if (!it2) it2 = it->parent;
3438 eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3439 EINA_INLIST_GET(it2));
3440 it->item->rel = it2;
3441 it->item->rel->relcount++;
3443 it->item->before = EINA_FALSE;
3444 _item_queue(wd, it);
3449 elm_genlist_item_prepend(Evas_Object *obj,
3450 const Elm_Genlist_Item_Class *itc,
3452 Elm_Gen_Item *parent,
3453 Elm_Genlist_Item_Flags flags,
3455 const void *func_data)
3457 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3458 Widget_Data *wd = elm_widget_data_get(obj);
3459 if (!wd) return NULL;
3460 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3462 if (!it) return NULL;
3465 if (flags & ELM_GENLIST_ITEM_GROUP)
3466 wd->group_items = eina_list_prepend(wd->group_items, it);
3467 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
3468 it->item->rel = NULL;
3472 Elm_Gen_Item *it2 = NULL;
3473 Eina_List *ll = it->parent->item->items;
3474 if (ll) it2 = ll->data;
3475 it->parent->item->items = eina_list_prepend(it->parent->item->items, it);
3476 if (!it2) it2 = it->parent;
3478 eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3479 EINA_INLIST_GET(it2));
3480 it->item->rel = it2;
3481 it->item->rel->relcount++;
3483 it->item->before = EINA_TRUE;
3484 _item_queue(wd, it);
3489 elm_genlist_item_insert_after(Evas_Object *obj,
3490 const Elm_Genlist_Item_Class *itc,
3492 Elm_Gen_Item *parent,
3493 Elm_Gen_Item *after,
3494 Elm_Genlist_Item_Flags flags,
3496 const void *func_data)
3498 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3499 EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
3500 Widget_Data *wd = elm_widget_data_get(obj);
3501 if (!wd) return NULL;
3502 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3504 if (!it) return NULL;
3505 /* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */
3506 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3510 if ((flags & ELM_GENLIST_ITEM_GROUP) &&
3511 (after->item->flags & ELM_GENLIST_ITEM_GROUP))
3512 wd->group_items = eina_list_append_relative(wd->group_items, it,
3517 it->parent->item->items = eina_list_append_relative(it->parent->item->items, it,
3520 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3521 EINA_INLIST_GET(after));
3522 it->item->rel = after;
3523 it->item->rel->relcount++;
3524 it->item->before = EINA_FALSE;
3525 _item_queue(wd, it);
3530 elm_genlist_item_insert_before(Evas_Object *obj,
3531 const Elm_Genlist_Item_Class *itc,
3533 Elm_Gen_Item *parent,
3534 Elm_Gen_Item *before,
3535 Elm_Genlist_Item_Flags flags,
3537 const void *func_data)
3539 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3540 EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
3541 Widget_Data *wd = elm_widget_data_get(obj);
3542 if (!wd) return NULL;
3543 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3545 if (!it) return NULL;
3546 /* It makes no sense to insert before in an empty list with before != NULL, something really bad is happening in your app. */
3547 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3551 if ((flags & ELM_GENLIST_ITEM_GROUP) &&
3552 (before->item->flags & ELM_GENLIST_ITEM_GROUP))
3553 wd->group_items = eina_list_prepend_relative(wd->group_items, it,
3558 it->parent->item->items = eina_list_prepend_relative(it->parent->item->items, it,
3561 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3562 EINA_INLIST_GET(before));
3563 it->item->rel = before;
3564 it->item->rel->relcount++;
3565 it->item->before = EINA_TRUE;
3566 _item_queue(wd, it);
3571 elm_genlist_item_direct_sorted_insert(Evas_Object *obj,
3572 const Elm_Genlist_Item_Class *itc,
3574 Elm_Gen_Item *parent,
3575 Elm_Genlist_Item_Flags flags,
3576 Eina_Compare_Cb comp,
3578 const void *func_data)
3580 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3581 Widget_Data *wd = elm_widget_data_get(obj);
3582 if (!wd) return NULL;
3583 Elm_Gen_Item *rel = NULL;
3584 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3586 if (!it) return NULL;
3588 _elm_genlist_item_compare_cb = comp;
3595 l = eina_list_search_sorted_near_list(it->parent->item->items,
3596 _elm_genlist_item_list_compare, it,
3599 rel = eina_list_data_get(l);
3603 if (cmp_result >= 0)
3605 it->parent->item->items = eina_list_prepend_relative_list(it->parent->item->items, it, l);
3606 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
3607 it->item->before = EINA_FALSE;
3609 else if (cmp_result < 0)
3611 it->parent->item->items = eina_list_append_relative_list(it->parent->item->items, it, l);
3612 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
3613 it->item->before = EINA_TRUE;
3620 wd->state = eina_inlist_sorted_state_new();
3623 if (flags & ELM_GENLIST_ITEM_GROUP)
3624 wd->group_items = eina_list_append(wd->group_items, it);
3626 wd->items = eina_inlist_sorted_state_insert(wd->items, EINA_INLIST_GET(it),
3627 _elm_genlist_item_compare, wd->state);
3629 if (EINA_INLIST_GET(it)->next)
3631 rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3632 it->item->before = EINA_TRUE;
3634 else if (EINA_INLIST_GET(it)->prev)
3636 rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3637 it->item->before = EINA_FALSE;
3643 it->item->rel = rel;
3644 it->item->rel->relcount++;
3647 _item_queue(wd, it);
3653 elm_genlist_item_sorted_insert(Evas_Object *obj,
3654 const Elm_Genlist_Item_Class *itc,
3656 Elm_Gen_Item *parent,
3657 Elm_Genlist_Item_Flags flags,
3658 Eina_Compare_Cb comp,
3660 const void *func_data)
3662 _elm_genlist_item_compare_data_cb = comp;
3664 return elm_genlist_item_direct_sorted_insert(obj, itc, data, parent, flags,
3665 _elm_genlist_item_compare_data, func, func_data);
3669 elm_genlist_clear(Evas_Object *obj)
3675 elm_genlist_multi_select_set(Evas_Object *obj,
3678 ELM_CHECK_WIDTYPE(obj, widtype);
3679 Widget_Data *wd = elm_widget_data_get(obj);
3685 elm_genlist_multi_select_get(const Evas_Object *obj)
3687 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3688 Widget_Data *wd = elm_widget_data_get(obj);
3689 if (!wd) return EINA_FALSE;
3694 elm_genlist_selected_item_get(const Evas_Object *obj)
3696 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3697 Widget_Data *wd = elm_widget_data_get(obj);
3698 if (!wd) return NULL;
3699 if (wd->selected) return wd->selected->data;
3703 EAPI const Eina_List *
3704 elm_genlist_selected_items_get(const Evas_Object *obj)
3706 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3707 Widget_Data *wd = elm_widget_data_get(obj);
3708 if (!wd) return NULL;
3709 return wd->selected;
3713 elm_genlist_realized_items_get(const Evas_Object *obj)
3715 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3716 Widget_Data *wd = elm_widget_data_get(obj);
3717 Eina_List *list = NULL;
3719 Eina_Bool done = EINA_FALSE;
3720 if (!wd) return NULL;
3721 EINA_INLIST_FOREACH(wd->blocks, itb)
3729 EINA_LIST_FOREACH(itb->items, l, it)
3731 if (it->realized) list = eina_list_append(list, it);
3743 elm_genlist_at_xy_item_get(const Evas_Object *obj,
3748 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3749 Widget_Data *wd = elm_widget_data_get(obj);
3750 Evas_Coord ox, oy, ow, oh;
3753 if (!wd) return NULL;
3754 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
3756 EINA_INLIST_FOREACH(wd->blocks, itb)
3761 if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
3762 oy + itb->y - itb->wd->pan_y,
3763 itb->w, itb->h, x, y, 1, 1))
3765 EINA_LIST_FOREACH(itb->items, l, it)
3767 Evas_Coord itx, ity;
3769 itx = ox + itb->x + it->x - itb->wd->pan_x;
3770 ity = oy + itb->y + it->y - itb->wd->pan_y;
3771 if (ELM_RECTS_INTERSECT(itx, ity, it->item->w, it->item->h, x, y, 1, 1))
3775 if (y <= (ity + (it->item->h / 4))) *posret = -1;
3776 else if (y >= (ity + it->item->h - (it->item->h / 4)))
3782 lasty = ity + it->item->h;
3787 if (y > lasty) *posret = 1;
3794 elm_genlist_first_item_get(const Evas_Object *obj)
3796 return elm_gen_first_item_get(obj);
3800 elm_genlist_last_item_get(const Evas_Object *obj)
3802 return elm_gen_last_item_get(obj);
3806 elm_genlist_item_next_get(const Elm_Gen_Item *it)
3808 return elm_gen_item_next_get(it);
3812 elm_genlist_item_prev_get(const Elm_Gen_Item *it)
3814 return elm_gen_item_prev_get(it);
3818 elm_genlist_item_genlist_get(const Elm_Gen_Item *it)
3820 return elm_gen_item_widget_get(it);
3824 elm_genlist_item_parent_get(const Elm_Gen_Item *it)
3826 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3831 elm_genlist_item_subitems_clear(Elm_Gen_Item *it)
3833 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3834 Eina_List *tl = NULL, *l;
3837 EINA_LIST_FOREACH(it->item->items, l, it2)
3838 tl = eina_list_append(tl, it2);
3839 EINA_LIST_FREE(tl, it2)
3840 elm_genlist_item_del(it2);
3844 elm_genlist_item_selected_set(Elm_Gen_Item *it,
3847 elm_gen_item_selected_set(it, selected);
3851 elm_genlist_item_selected_get(const Elm_Gen_Item *it)
3853 return elm_gen_item_selected_get(it);
3857 elm_genlist_item_expanded_set(Elm_Gen_Item *it,
3860 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3861 if (it->item->expanded == expanded) return;
3862 it->item->expanded = expanded;
3863 it->wd->expanded_item = it;
3864 if (it->item->expanded)
3867 edje_object_signal_emit(VIEW(it), "elm,state,expanded", "elm");
3868 evas_object_smart_callback_call(WIDGET(it), SIG_EXPANDED, it);
3869 it->wd->auto_scroll_enabled = EINA_TRUE;
3874 edje_object_signal_emit(VIEW(it), "elm,state,contracted", "elm");
3875 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACTED, it);
3876 it->wd->auto_scroll_enabled = EINA_FALSE;
3881 elm_genlist_item_expanded_get(const Elm_Gen_Item *it)
3883 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
3884 return it->item->expanded;
3888 elm_genlist_item_expanded_depth_get(const Elm_Gen_Item *it)
3890 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, 0);
3891 return it->item->expanded_depth;
3895 elm_genlist_item_disabled_set(Elm_Gen_Item *it,
3898 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3901 if (it->disabled == disabled) return;
3902 if (it->delete_me) return;
3903 it->disabled = !!disabled;
3905 elm_gen_item_selected_set(it, EINA_FALSE);
3909 edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
3911 edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm");
3912 EINA_LIST_FOREACH(it->icon_objs, l, obj)
3913 elm_widget_disabled_set(obj, disabled);
3918 elm_genlist_item_disabled_get(const Elm_Gen_Item *it)
3920 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
3921 if (it->delete_me) return EINA_FALSE;
3922 return it->disabled;
3926 elm_genlist_item_display_only_set(Elm_Gen_Item *it,
3927 Eina_Bool display_only)
3929 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3930 if (it->display_only == display_only) return;
3931 if (it->delete_me) return;
3932 it->display_only = display_only;
3933 it->item->mincalcd = EINA_FALSE;
3934 it->item->updateme = EINA_TRUE;
3935 if (it->item->block) it->item->block->updateme = EINA_TRUE;
3936 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
3937 it->wd->update_job = ecore_job_add(_update_job, it->wd);
3941 elm_genlist_item_display_only_get(const Elm_Gen_Item *it)
3943 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
3944 if (it->delete_me) return EINA_FALSE;
3945 return it->display_only;
3949 elm_genlist_item_show(Elm_Gen_Item *it)
3951 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3952 Evas_Coord gith = 0;
3953 if (it->delete_me) return;
3954 if ((it->item->queued) || (!it->item->mincalcd))
3956 it->wd->show_item = it;
3957 it->wd->bring_in = EINA_TRUE;
3958 it->item->showme = EINA_TRUE;
3961 if (it->wd->show_item)
3963 it->wd->show_item->item->showme = EINA_FALSE;
3964 it->wd->show_item = NULL;
3966 if ((it->item->group_item) && (it->wd->pan_y > (it->y + it->item->block->y)))
3967 gith = it->item->group_item->item->h;
3968 elm_smart_scroller_child_region_show(it->wd->scr,
3969 it->x + it->item->block->x,
3970 it->y + it->item->block->y - gith,
3971 it->item->block->w, it->item->h);
3975 elm_genlist_item_bring_in(Elm_Gen_Item *it)
3977 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3978 Evas_Coord gith = 0;
3979 if (it->delete_me) return;
3980 if ((it->item->queued) || (!it->item->mincalcd))
3982 it->wd->show_item = it;
3983 it->wd->bring_in = EINA_TRUE;
3984 it->item->showme = EINA_TRUE;
3987 if (it->wd->show_item)
3989 it->wd->show_item->item->showme = EINA_FALSE;
3990 it->wd->show_item = NULL;
3992 if ((it->item->group_item) && (it->wd->pan_y > (it->y + it->item->block->y)))
3993 gith = it->item->group_item->item->h;
3994 elm_smart_scroller_region_bring_in(it->wd->scr,
3995 it->x + it->item->block->x,
3996 it->y + it->item->block->y - gith,
3997 it->item->block->w, it->item->h);
4001 elm_genlist_item_top_show(Elm_Gen_Item *it)
4003 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4005 Evas_Coord gith = 0;
4007 if (it->delete_me) return;
4008 if ((it->item->queued) || (!it->item->mincalcd))
4010 it->wd->show_item = it;
4011 it->wd->bring_in = EINA_TRUE;
4012 it->item->showme = EINA_TRUE;
4015 if (it->wd->show_item)
4017 it->wd->show_item->item->showme = EINA_FALSE;
4018 it->wd->show_item = NULL;
4020 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4021 if (it->item->group_item) gith = it->item->group_item->item->h;
4022 elm_smart_scroller_child_region_show(it->wd->scr,
4023 it->x + it->item->block->x,
4024 it->y + it->item->block->y - gith,
4025 it->item->block->w, oh);
4029 elm_genlist_item_top_bring_in(Elm_Gen_Item *it)
4031 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4033 Evas_Coord gith = 0;
4035 if (it->delete_me) return;
4036 if ((it->item->queued) || (!it->item->mincalcd))
4038 it->wd->show_item = it;
4039 it->wd->bring_in = EINA_TRUE;
4040 it->item->showme = EINA_TRUE;
4043 if (it->wd->show_item)
4045 it->wd->show_item->item->showme = EINA_FALSE;
4046 it->wd->show_item = NULL;
4048 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4049 if (it->item->group_item) gith = it->item->group_item->item->h;
4050 elm_smart_scroller_region_bring_in(it->wd->scr,
4051 it->x + it->item->block->x,
4052 it->y + it->item->block->y - gith,
4053 it->item->block->w, oh);
4057 elm_genlist_item_middle_show(Elm_Gen_Item *it)
4059 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4062 if (it->delete_me) return;
4063 if ((it->item->queued) || (!it->item->mincalcd))
4065 it->wd->show_item = it;
4066 it->wd->bring_in = EINA_TRUE;
4067 it->item->showme = EINA_TRUE;
4070 if (it->wd->show_item)
4072 it->wd->show_item->item->showme = EINA_FALSE;
4073 it->wd->show_item = NULL;
4075 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4076 elm_smart_scroller_child_region_show(it->wd->scr,
4077 it->x + it->item->block->x,
4078 it->y + it->item->block->y - oh / 2 +
4079 it->item->h / 2, it->item->block->w, oh);
4083 elm_genlist_item_middle_bring_in(Elm_Gen_Item *it)
4085 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4088 if (it->delete_me) return;
4089 if ((it->item->queued) || (!it->item->mincalcd))
4091 it->wd->show_item = it;
4092 it->wd->bring_in = EINA_TRUE;
4093 it->item->showme = EINA_TRUE;
4096 if (it->wd->show_item)
4098 it->wd->show_item->item->showme = EINA_FALSE;
4099 it->wd->show_item = NULL;
4101 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4102 elm_smart_scroller_region_bring_in(it->wd->scr,
4103 it->x + it->item->block->x,
4104 it->y + it->item->block->y - oh / 2 + it->item->h / 2,
4105 it->item->block->w, oh);
4109 elm_genlist_item_del(Elm_Gen_Item *it)
4111 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4112 if ((it->relcount > 0) || (it->walking > 0))
4114 elm_genlist_item_subitems_clear(it);
4115 if (it->wd->show_item == it) it->wd->show_item = NULL;
4116 elm_gen_item_del_notserious(it);
4117 if (it->item->block)
4119 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE);
4120 it->item->block->changed = EINA_TRUE;
4121 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
4122 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
4130 elm_genlist_item_data_set(Elm_Gen_Item *it,
4133 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4134 elm_widget_item_data_set(it, data);
4138 elm_genlist_item_data_get(const Elm_Gen_Item *it)
4140 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4141 return elm_widget_item_data_get(it);
4145 elm_genlist_item_icons_orphan(Elm_Gen_Item *it)
4148 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4149 EINA_LIST_FREE(it->icon_objs, icon)
4151 elm_widget_sub_object_del(WIDGET(it), icon);
4152 evas_object_smart_member_del(icon);
4153 evas_object_hide(icon);
4157 EAPI const Evas_Object *
4158 elm_genlist_item_object_get(const Elm_Gen_Item *it)
4160 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4165 elm_genlist_item_update(Elm_Gen_Item *it)
4167 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4168 if (!it->item->block) return;
4169 if (it->delete_me) return;
4170 it->item->mincalcd = EINA_FALSE;
4171 it->item->updateme = EINA_TRUE;
4172 it->item->block->updateme = EINA_TRUE;
4173 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4174 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4178 elm_genlist_item_item_class_update(Elm_Gen_Item *it,
4179 const Elm_Genlist_Item_Class *itc)
4181 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4182 if (!it->item->block) return;
4183 EINA_SAFETY_ON_NULL_RETURN(itc);
4184 if (it->delete_me) return;
4186 it->item->nocache = EINA_TRUE;
4187 elm_genlist_item_update(it);
4190 EAPI const Elm_Genlist_Item_Class *
4191 elm_genlist_item_item_class_get(const Elm_Gen_Item *it)
4193 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4194 if (it->delete_me) return NULL;
4198 static Evas_Object *
4199 _elm_genlist_item_label_create(void *data,
4200 Evas_Object *obj __UNUSED__,
4201 Evas_Object *tooltip,
4202 void *it __UNUSED__)
4204 Evas_Object *label = elm_label_add(tooltip);
4207 elm_object_style_set(label, "tooltip");
4208 elm_object_text_set(label, data);
4213 _elm_genlist_item_label_del_cb(void *data,
4214 Evas_Object *obj __UNUSED__,
4215 void *event_info __UNUSED__)
4217 eina_stringshare_del(data);
4221 elm_genlist_item_tooltip_text_set(Elm_Gen_Item *it,
4224 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4225 text = eina_stringshare_add(text);
4226 elm_genlist_item_tooltip_content_cb_set(it, _elm_genlist_item_label_create,
4228 _elm_genlist_item_label_del_cb);
4232 elm_genlist_item_tooltip_content_cb_set(Elm_Gen_Item *it,
4233 Elm_Tooltip_Item_Content_Cb func,
4235 Evas_Smart_Cb del_cb)
4237 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(it, error);
4239 if ((it->tooltip.content_cb == func) && (it->tooltip.data == data))
4242 if (it->tooltip.del_cb)
4243 it->tooltip.del_cb((void *)it->tooltip.data,
4246 it->tooltip.content_cb = func;
4247 it->tooltip.data = data;
4248 it->tooltip.del_cb = del_cb;
4252 elm_widget_item_tooltip_content_cb_set(it,
4253 it->tooltip.content_cb,
4254 it->tooltip.data, NULL);
4255 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
4256 elm_widget_item_tooltip_size_restrict_disable(it, it->tooltip.free_size);
4262 if (del_cb) del_cb((void *)data, NULL, NULL);
4266 elm_genlist_item_tooltip_unset(Elm_Gen_Item *it)
4268 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4269 if ((VIEW(it)) && (it->tooltip.content_cb))
4270 elm_widget_item_tooltip_unset(it);
4272 if (it->tooltip.del_cb)
4273 it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
4274 it->tooltip.del_cb = NULL;
4275 it->tooltip.content_cb = NULL;
4276 it->tooltip.data = NULL;
4277 it->tooltip.free_size = EINA_FALSE;
4278 if (it->tooltip.style)
4279 elm_genlist_item_tooltip_style_set(it, NULL);
4283 elm_genlist_item_tooltip_style_set(Elm_Gen_Item *it,
4286 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4287 eina_stringshare_replace(&it->tooltip.style, style);
4288 if (VIEW(it)) elm_widget_item_tooltip_style_set(it, style);
4292 elm_genlist_item_tooltip_style_get(const Elm_Gen_Item *it)
4294 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4295 return it->tooltip.style;
4299 elm_genlist_item_tooltip_size_restrict_disable(Elm_Gen_Item *it, Eina_Bool disable)
4301 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4302 it->tooltip.free_size = disable;
4303 if (VIEW(it)) return elm_widget_item_tooltip_size_restrict_disable(it, disable);
4308 elm_genlist_item_tooltip_size_restrict_disabled_get(const Elm_Gen_Item *it)
4310 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4311 return it->tooltip.free_size;
4315 elm_genlist_item_cursor_set(Elm_Gen_Item *it,
4318 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4319 eina_stringshare_replace(&it->mouse_cursor, cursor);
4320 if (VIEW(it)) elm_widget_item_cursor_set(it, cursor);
4324 elm_genlist_item_cursor_get(const Elm_Gen_Item *it)
4326 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4327 return elm_widget_item_cursor_get(it);
4331 elm_genlist_item_cursor_unset(Elm_Gen_Item *it)
4333 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4334 if (!it->mouse_cursor)
4338 elm_widget_item_cursor_unset(it);
4340 eina_stringshare_del(it->mouse_cursor);
4341 it->mouse_cursor = NULL;
4345 elm_genlist_item_cursor_style_set(Elm_Gen_Item *it,
4348 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4349 elm_widget_item_cursor_style_set(it, style);
4353 elm_genlist_item_cursor_style_get(const Elm_Gen_Item *it)
4355 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4356 return elm_widget_item_cursor_style_get(it);
4360 elm_genlist_item_cursor_engine_only_set(Elm_Gen_Item *it,
4361 Eina_Bool engine_only)
4363 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4364 elm_widget_item_cursor_engine_only_set(it, engine_only);
4368 elm_genlist_item_cursor_engine_only_get(const Elm_Gen_Item *it)
4370 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4371 return elm_widget_item_cursor_engine_only_get(it);
4375 elm_genlist_horizontal_set(Evas_Object *obj,
4378 ELM_CHECK_WIDTYPE(obj, widtype);
4379 Widget_Data *wd = elm_widget_data_get(obj);
4381 if (wd->mode == mode) return;
4387 elm_genlist_horizontal_mode_set(Evas_Object *obj,
4390 elm_genlist_horizontal_set(obj, mode);
4394 elm_genlist_horizontal_get(const Evas_Object *obj)
4396 ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
4397 Widget_Data *wd = elm_widget_data_get(obj);
4398 if (!wd) return ELM_LIST_LAST;
4403 elm_genlist_horizontal_mode_get(const Evas_Object *obj)
4405 return elm_genlist_horizontal_get(obj);
4409 elm_genlist_always_select_mode_set(Evas_Object *obj,
4410 Eina_Bool always_select)
4412 elm_gen_always_select_mode_set(obj, always_select);
4416 elm_genlist_always_select_mode_get(const Evas_Object *obj)
4418 return elm_gen_always_select_mode_get(obj);
4422 elm_genlist_no_select_mode_set(Evas_Object *obj,
4423 Eina_Bool no_select)
4425 elm_gen_no_select_mode_set(obj, no_select);
4429 elm_genlist_no_select_mode_get(const Evas_Object *obj)
4431 return elm_gen_no_select_mode_get(obj);
4435 elm_genlist_compress_mode_set(Evas_Object *obj,
4438 ELM_CHECK_WIDTYPE(obj, widtype);
4439 Widget_Data *wd = elm_widget_data_get(obj);
4441 wd->compress = compress;
4442 if (!compress) elm_genlist_homogeneous_set(obj, EINA_FALSE);
4446 elm_genlist_compress_mode_get(const Evas_Object *obj)
4448 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4449 Widget_Data *wd = elm_widget_data_get(obj);
4450 if (!wd) return EINA_FALSE;
4451 return wd->compress;
4455 elm_genlist_height_for_width_mode_set(Evas_Object *obj,
4456 Eina_Bool height_for_width)
4458 ELM_CHECK_WIDTYPE(obj, widtype);
4459 Widget_Data *wd = elm_widget_data_get(obj);
4461 wd->height_for_width = !!height_for_width;
4462 if (wd->height_for_width)
4464 elm_genlist_homogeneous_set(obj, EINA_FALSE);
4465 elm_genlist_compress_mode_set(obj, EINA_TRUE);
4470 elm_genlist_height_for_width_mode_get(const Evas_Object *obj)
4472 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4473 Widget_Data *wd = elm_widget_data_get(obj);
4474 if (!wd) return EINA_FALSE;
4475 return wd->height_for_width;
4479 elm_genlist_bounce_set(Evas_Object *obj,
4483 elm_gen_bounce_set(obj, h_bounce, v_bounce);
4487 elm_genlist_bounce_get(const Evas_Object *obj,
4488 Eina_Bool *h_bounce,
4489 Eina_Bool *v_bounce)
4491 elm_gen_bounce_get(obj, h_bounce, v_bounce);
4495 elm_genlist_homogeneous_set(Evas_Object *obj,
4496 Eina_Bool homogeneous)
4498 ELM_CHECK_WIDTYPE(obj, widtype);
4499 Widget_Data *wd = elm_widget_data_get(obj);
4501 if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
4502 wd->homogeneous = homogeneous;
4506 elm_genlist_homogeneous_get(const Evas_Object *obj)
4508 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4509 Widget_Data *wd = elm_widget_data_get(obj);
4510 if (!wd) return EINA_FALSE;
4511 return wd->homogeneous;
4515 elm_genlist_block_count_set(Evas_Object *obj,
4518 ELM_CHECK_WIDTYPE(obj, widtype);
4519 Widget_Data *wd = elm_widget_data_get(obj);
4521 wd->max_items_per_block = n;
4522 wd->item_cache_max = wd->max_items_per_block * 2;
4523 _item_cache_clean(wd);
4527 elm_genlist_block_count_get(const Evas_Object *obj)
4529 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4530 Widget_Data *wd = elm_widget_data_get(obj);
4532 return wd->max_items_per_block;
4536 elm_genlist_longpress_timeout_set(Evas_Object *obj,
4539 ELM_CHECK_WIDTYPE(obj, widtype);
4540 Widget_Data *wd = elm_widget_data_get(obj);
4542 wd->longpress_timeout = timeout;
4546 elm_genlist_longpress_timeout_get(const Evas_Object *obj)
4548 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4549 Widget_Data *wd = elm_widget_data_get(obj);
4551 return wd->longpress_timeout;
4555 elm_genlist_scroller_policy_set(Evas_Object *obj,
4556 Elm_Scroller_Policy policy_h,
4557 Elm_Scroller_Policy policy_v)
4559 ELM_CHECK_WIDTYPE(obj, widtype);
4560 Widget_Data *wd = elm_widget_data_get(obj);
4561 if ((!wd) || (!wd->scr)) return;
4562 if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
4563 (policy_v >= ELM_SCROLLER_POLICY_LAST))
4565 elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
4569 elm_genlist_scroller_policy_get(const Evas_Object *obj,
4570 Elm_Scroller_Policy *policy_h,
4571 Elm_Scroller_Policy *policy_v)
4573 ELM_CHECK_WIDTYPE(obj, widtype);
4574 Widget_Data *wd = elm_widget_data_get(obj);
4575 Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
4576 if ((!wd) || (!wd->scr)) return;
4577 elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
4578 if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
4579 if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
4583 elm_genlist_realized_items_update(Evas_Object *obj)
4585 ELM_CHECK_WIDTYPE(obj, widtype);
4587 Eina_List *list, *l;
4590 list = elm_genlist_realized_items_get(obj);
4591 EINA_LIST_FOREACH(list, l, it)
4592 elm_genlist_item_update(it);
4596 elm_genlist_item_mode_set(Elm_Gen_Item *it,
4597 const char *mode_type,
4600 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4601 Widget_Data *wd = it->wd;
4606 if (!mode_type) return;
4607 if ((it->delete_me) || (it->disabled)) return;
4609 if ((wd->mode_item == it) &&
4610 (!strcmp(mode_type, wd->mode_type)) &&
4613 if (!wd->mode_item_style) return;
4614 it->mode_set = mode_set;
4618 EINA_LIST_FOREACH(wd->selected, l, it2)
4620 elm_gen_item_selected_set(it2, EINA_FALSE);
4624 it2 = elm_genlist_selected_item_get(wd->obj);
4625 if ((it2) && (it2->realized))
4626 elm_gen_item_selected_set(it2, EINA_FALSE);
4629 if (((wd->mode_type) && (strcmp(mode_type, wd->mode_type))) ||
4631 ((it == wd->mode_item) && (!mode_set)))
4632 _item_mode_unset(wd);
4634 eina_stringshare_replace(&wd->mode_type, mode_type);
4635 if (mode_set) _item_mode_set(it);
4640 elm_genlist_mode_item_style_get(const Evas_Object *obj)
4642 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4643 Widget_Data *wd = elm_widget_data_get(obj);
4644 if (!wd) return NULL;
4645 return wd->mode_item_style;
4649 elm_genlist_mode_item_style_set(Evas_Object *obj, const char *style)
4651 ELM_CHECK_WIDTYPE(obj, widtype);
4652 Widget_Data *wd = elm_widget_data_get(obj);
4654 if ((style == wd->mode_item_style) || (style && wd->mode_item_style &&
4655 (!strcmp(style, wd->mode_item_style))))
4657 eina_stringshare_replace(&wd->mode_item_style, style);
4658 elm_genlist_realized_items_update(obj);
4662 elm_genlist_mode_get(const Evas_Object *obj)
4664 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4665 Widget_Data *wd = elm_widget_data_get(obj);
4666 if (!wd) return NULL;
4667 return wd->mode_type;
4670 EAPI const Elm_Gen_Item *
4671 elm_genlist_mode_item_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_item;
4680 elm_genlist_reorder_mode_set(Evas_Object *obj,
4681 Eina_Bool reorder_mode)
4683 ELM_CHECK_WIDTYPE(obj, widtype);
4684 Widget_Data *wd = elm_widget_data_get(obj);
4686 wd->reorder_mode = reorder_mode;
4690 elm_genlist_reorder_mode_get(const Evas_Object *obj)
4692 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4693 Widget_Data *wd = elm_widget_data_get(obj);
4694 if (!wd) return EINA_FALSE;
4695 return wd->reorder_mode;