3 #include <Elementary.h>
4 #include <Elementary_Cursor.h>
6 #include "els_scroller.h"
10 #define MAX_ITEMS_PER_BLOCK 32
11 #define REORDER_EFFECT_TIME 0.5
13 #define ELM_GEN_SETUP(wd) \
14 (wd)->calc_cb = (Ecore_Cb)_calc_job; \
15 (wd)->clear_cb = (Ecore_Cb)_clear_cb; \
16 (wd)->sizing_cb = (Ecore_Cb)_sizing_eval
19 #define ELM_GEN_ITEM_SETUP(it) \
20 (it)->del_cb = (Ecore_Cb)_item_del; \
21 (it)->highlight_cb = (Ecore_Cb)_item_highlight; \
22 (it)->unsel_cb = (Ecore_Cb)_item_unselect; \
23 (it)->unhighlight_cb = (Ecore_Cb)_item_unhighlight; \
24 (it)->unrealize_cb = (Ecore_Cb)_item_unrealize_cb
26 typedef struct _Item_Block Item_Block;
27 typedef struct _Item_Cache Item_Cache;
29 struct Elm_Gen_Item_Type
34 Evas_Coord w, h, minw, minh;
35 Elm_Gen_Item *group_item;
36 Elm_Genlist_Item_Flags flags;
37 Eina_List *mode_labels, *mode_contents, *mode_states, *mode_content_objs;
38 Ecore_Timer *swipe_timer;
39 Evas_Coord scrl_x, scrl_y, old_scrl_y;
42 Evas_Object *mode_view;
48 Eina_Bool want_realize : 1;
49 Eina_Bool expanded : 1;
50 Eina_Bool mincalcd : 1;
53 Eina_Bool updateme : 1;
54 Eina_Bool nocache : 1;
55 Eina_Bool stacking_even : 1;
56 Eina_Bool nostacking : 1;
57 Eina_Bool move_effect_enabled : 1;
62 Eina_Inlist_Sorted_State *state;
63 Evas_Object *obj; /* the genlist object */
64 Evas_Object *scr; /* a smart scroller object which is used internally in genlist */
65 Evas_Object *pan_smart; /* "elm_genlist_pan" evas smart object. this is an extern pan of smart scroller(scr). */
67 Eina_List *group_items; /* list of groups index items */
68 Eina_Inlist *items; /* inlist of all items */
69 Elm_Gen_Item *reorder_it; /* item currently being repositioned */
70 Elm_Gen_Item *last_selected_item;
71 Pan *pan; /* pan_smart object's smart data */
74 int item_width, item_height;
75 int group_item_width, group_item_height;
78 Evas_Coord pan_x, pan_y;
79 Eina_Bool reorder_mode : 1;
80 Eina_Bool on_hold : 1;
82 Eina_Bool no_select : 1;
83 Eina_Bool wasselected : 1;
84 Eina_Bool always_select : 1;
85 Eina_Bool clear_me : 1;
86 Eina_Bool h_bounce : 1;
87 Eina_Bool v_bounce : 1;
88 Ecore_Cb del_cb, calc_cb, sizing_cb;
90 ////////////////////////////////////
91 Eina_Inlist *blocks; /* inlist of all blocks. a block consists of a certain number of items. maximum number of items in a block is 'max_items_per_block'. */
92 Evas_Coord reorder_old_pan_y, w, h, realminw, prev_viewport_w;
93 Ecore_Job *update_job;
94 Ecore_Idle_Enterer *queue_idle_enterer;
95 Ecore_Idler *must_recalc_idler;
97 Elm_Gen_Item *show_item, *anchor_item, *mode_item, *reorder_rel, *expanded_item;
98 Eina_Inlist *item_cache; /* an inlist of edje object it cache. */
100 Evas_Coord reorder_start_y; /* reorder it's initial y coordinate in the pan. */
102 Ecore_Timer *multi_timer, *scr_hold_timer;
103 Ecore_Animator *reorder_move_animator;
104 const char *mode_type;
105 const char *mode_item_style;
106 unsigned int start_time;
107 Evas_Coord prev_x, prev_y, prev_mx, prev_my;
108 Evas_Coord cur_x, cur_y, cur_mx, cur_my;
109 Eina_Bool mouse_down : 1;
110 Eina_Bool multi_down : 1;
111 Eina_Bool multi_timeout : 1;
112 Eina_Bool multitouched : 1;
113 Eina_Bool longpressed : 1;
114 Eina_Bool bring_in : 1;
115 Eina_Bool compress : 1;
116 Eina_Bool height_for_width : 1;
117 Eina_Bool homogeneous : 1;
119 Eina_Bool reorder_pan_move : 1;
120 Eina_Bool auto_scroll_enabled : 1;
121 Eina_Bool pan_resized : 1;
125 } history[SWIPE_MOVES];
127 int item_cache_count;
128 int item_cache_max; /* maximum number of cached items */
130 int max_items_per_block; /* maximum number of items per block */
131 double longpress_timeout; /* longpress timeout. this value comes from _elm_config by default. this can be changed by elm_genlist_longpress_timeout_set() */
142 Evas_Coord x, y, w, h, minw, minh;
143 Eina_Bool want_unrealize : 1;
144 Eina_Bool realized : 1;
145 Eina_Bool changed : 1;
146 Eina_Bool updateme : 1;
147 Eina_Bool showme : 1;
148 Eina_Bool must_recalc : 1;
155 Evas_Object *base_view, *spacer;
157 const char *item_style; // it->itc->item_style
158 Eina_Bool tree : 1; // it->group
159 Eina_Bool compress : 1; // it->wd->compress
161 Eina_Bool selected : 1; // it->selected
162 Eina_Bool disabled : 1; // it->disabled
163 Eina_Bool expanded : 1; // it->item->expanded
166 static const char *widtype = NULL;
167 static void _item_cache_zero(Widget_Data *wd);
168 static void _del_hook(Evas_Object *obj);
169 static void _mirrored_set(Evas_Object *obj,
171 static void _theme_hook(Evas_Object *obj);
172 static void _show_region_hook(void *data,
174 static void _sizing_eval(Evas_Object *obj);
175 static void _item_realize(Elm_Gen_Item *it,
178 static void _item_unrealize_cb(Elm_Gen_Item *it);
179 static void _item_block_unrealize(Item_Block *itb);
180 static void _calc_job(void *data);
181 static void _on_focus_hook(void *data,
183 static Eina_Bool _item_multi_select_up(Widget_Data *wd);
184 static Eina_Bool _item_multi_select_down(Widget_Data *wd);
185 static Eina_Bool _item_single_select_up(Widget_Data *wd);
186 static Eina_Bool _item_single_select_down(Widget_Data *wd);
187 static Eina_Bool _event_hook(Evas_Object *obj,
189 Evas_Callback_Type type,
191 static void _signal_emit_hook(Evas_Object *obj,
192 const char *emission,
194 static Eina_Bool _deselect_all_items(Widget_Data *wd);
195 static void _pan_calculate(Evas_Object *obj);
196 static void _pan_max_get(Evas_Object *obj,
199 static void _item_position(Elm_Gen_Item *it,
203 static void _mode_item_realize(Elm_Gen_Item *it);
204 static void _mode_item_unrealize(Elm_Gen_Item *it);
205 static void _item_mode_set(Elm_Gen_Item *it);
206 static void _item_mode_unset(Widget_Data *wd);
207 static void _group_items_recalc(void *data);
208 static void _item_move_after(Elm_Gen_Item *it,
209 Elm_Gen_Item *after);
210 static void _item_move_before(Elm_Gen_Item *it,
211 Elm_Gen_Item *before);
212 static void _item_auto_scroll(Widget_Data *wd);
214 static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
216 static const char SIG_ACTIVATED[] = "activated";
217 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
218 static const char SIG_SELECTED[] = "selected";
219 static const char SIG_UNSELECTED[] = "unselected";
220 static const char SIG_EXPANDED[] = "expanded";
221 static const char SIG_CONTRACTED[] = "contracted";
222 static const char SIG_EXPAND_REQUEST[] = "expand,request";
223 static const char SIG_CONTRACT_REQUEST[] = "contract,request";
224 static const char SIG_REALIZED[] = "realized";
225 static const char SIG_UNREALIZED[] = "unrealized";
226 static const char SIG_DRAG_START_UP[] = "drag,start,up";
227 static const char SIG_DRAG_START_DOWN[] = "drag,start,down";
228 static const char SIG_DRAG_START_LEFT[] = "drag,start,left";
229 static const char SIG_DRAG_START_RIGHT[] = "drag,start,right";
230 static const char SIG_DRAG_STOP[] = "drag,stop";
231 static const char SIG_DRAG[] = "drag";
232 static const char SIG_LONGPRESSED[] = "longpressed";
233 static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
234 static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
235 static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
236 static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
237 static const char SIG_EDGE_TOP[] = "edge,top";
238 static const char SIG_EDGE_BOTTOM[] = "edge,bottom";
239 static const char SIG_EDGE_LEFT[] = "edge,left";
240 static const char SIG_EDGE_RIGHT[] = "edge,right";
241 static const char SIG_MULTI_SWIPE_LEFT[] = "multi,swipe,left";
242 static const char SIG_MULTI_SWIPE_RIGHT[] = "multi,swipe,right";
243 static const char SIG_MULTI_SWIPE_UP[] = "multi,swipe,up";
244 static const char SIG_MULTI_SWIPE_DOWN[] = "multi,swipe,down";
245 static const char SIG_MULTI_PINCH_OUT[] = "multi,pinch,out";
246 static const char SIG_MULTI_PINCH_IN[] = "multi,pinch,in";
247 static const char SIG_SWIPE[] = "swipe";
248 static const char SIG_MOVED[] = "moved";
250 static const Evas_Smart_Cb_Description _signals[] = {
251 {SIG_CLICKED_DOUBLE, ""},
254 {SIG_UNSELECTED, ""},
256 {SIG_CONTRACTED, ""},
257 {SIG_EXPAND_REQUEST, ""},
258 {SIG_CONTRACT_REQUEST, ""},
260 {SIG_UNREALIZED, ""},
261 {SIG_DRAG_START_UP, ""},
262 {SIG_DRAG_START_DOWN, ""},
263 {SIG_DRAG_START_LEFT, ""},
264 {SIG_DRAG_START_RIGHT, ""},
267 {SIG_LONGPRESSED, ""},
268 {SIG_SCROLL_ANIM_START, ""},
269 {SIG_SCROLL_ANIM_STOP, ""},
270 {SIG_SCROLL_DRAG_START, ""},
271 {SIG_SCROLL_DRAG_STOP, ""},
273 {SIG_EDGE_BOTTOM, ""},
275 {SIG_EDGE_RIGHT, ""},
276 {SIG_MULTI_SWIPE_LEFT, ""},
277 {SIG_MULTI_SWIPE_RIGHT, ""},
278 {SIG_MULTI_SWIPE_UP, ""},
279 {SIG_MULTI_SWIPE_DOWN, ""},
280 {SIG_MULTI_PINCH_OUT, ""},
281 {SIG_MULTI_PINCH_IN, ""},
287 static Eina_Compare_Cb _elm_genlist_item_compare_cb;
288 static Eina_Compare_Cb _elm_genlist_item_compare_data_cb;
291 _event_hook(Evas_Object *obj,
292 Evas_Object *src __UNUSED__,
293 Evas_Callback_Type type,
296 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
297 Evas_Event_Key_Down *ev = event_info;
298 Widget_Data *wd = elm_widget_data_get(obj);
299 Evas_Coord pan_max_x = 0, pan_max_y = 0;
300 if (!wd) return EINA_FALSE;
301 if (!wd->items) return EINA_FALSE;
302 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
303 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
305 Elm_Gen_Item *it = NULL;
308 Evas_Coord step_x = 0;
309 Evas_Coord step_y = 0;
312 Evas_Coord page_x = 0;
313 Evas_Coord page_y = 0;
315 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
316 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
317 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
318 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
320 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
324 else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")))
328 else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
330 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
331 (_item_multi_select_up(wd)))
332 || (_item_single_select_up(wd)))
334 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
340 else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
342 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
343 (_item_multi_select_down(wd)))
344 || (_item_single_select_down(wd)))
346 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
352 else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
354 it = elm_gen_first_item_get(obj);
355 elm_genlist_item_bring_in(it);
356 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
359 else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
361 it = elm_gen_last_item_get(obj);
362 elm_genlist_item_bring_in(it);
363 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
366 else if ((!strcmp(ev->keyname, "Prior")) || (!strcmp(ev->keyname, "KP_Prior")))
369 y -= -(page_y * v_h) / 100;
373 else if ((!strcmp(ev->keyname, "Next")) || (!strcmp(ev->keyname, "KP_Next")))
376 y += -(page_y * v_h) / 100;
380 else if (!strcmp(ev->keyname, "Escape"))
382 if (!_deselect_all_items(wd)) return EINA_FALSE;
383 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
386 else if (((!strcmp(ev->keyname, "Return")) ||
387 (!strcmp(ev->keyname, "KP_Enter")) ||
388 (!strcmp(ev->keyname, "space")))
389 && (!wd->multi) && (wd->selected))
391 it = elm_genlist_selected_item_get(obj);
392 elm_genlist_item_expanded_set(it,
393 !elm_genlist_item_expanded_get(it));
394 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
396 else return EINA_FALSE;
398 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
399 _pan_max_get(wd->pan_smart, &pan_max_x, &pan_max_y);
401 if (x > pan_max_x) x = pan_max_x;
403 if (y > pan_max_y) y = pan_max_y;
404 elm_smart_scroller_child_pos_set(wd->scr, x, y);
409 _deselect_all_items(Widget_Data *wd)
411 if (!wd->selected) return EINA_FALSE;
413 elm_gen_item_selected_set(wd->selected->data, EINA_FALSE);
419 _item_multi_select_up(Widget_Data *wd)
421 if (!wd->selected) return EINA_FALSE;
422 if (!wd->multi) return EINA_FALSE;
424 Elm_Gen_Item *prev = elm_gen_item_prev_get(wd->last_selected_item);
425 if (!prev) return EINA_TRUE;
427 if (elm_gen_item_selected_get(prev))
429 elm_gen_item_selected_set(wd->last_selected_item, EINA_FALSE);
430 wd->last_selected_item = prev;
431 elm_genlist_item_show(wd->last_selected_item);
435 elm_gen_item_selected_set(prev, EINA_TRUE);
436 elm_genlist_item_show(prev);
442 _item_multi_select_down(Widget_Data *wd)
444 if (!wd->selected) return EINA_FALSE;
445 if (!wd->multi) return EINA_FALSE;
447 Elm_Gen_Item *next = elm_gen_item_next_get(wd->last_selected_item);
448 if (!next) return EINA_TRUE;
450 if (elm_gen_item_selected_get(next))
452 elm_gen_item_selected_set(wd->last_selected_item, EINA_FALSE);
453 wd->last_selected_item = next;
454 elm_genlist_item_show(wd->last_selected_item);
458 elm_gen_item_selected_set(next, EINA_TRUE);
459 elm_genlist_item_show(next);
465 _item_single_select_up(Widget_Data *wd)
470 prev = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
471 while ((prev) && (prev->delete_me))
472 prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
474 else prev = elm_gen_item_prev_get(wd->last_selected_item);
476 if (!prev) return EINA_FALSE;
478 _deselect_all_items(wd);
480 elm_gen_item_selected_set(prev, EINA_TRUE);
481 elm_genlist_item_show(prev);
486 _item_single_select_down(Widget_Data *wd)
491 next = ELM_GEN_ITEM_FROM_INLIST(wd->items);
492 while ((next) && (next->delete_me))
493 next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
495 else next = elm_gen_item_next_get(wd->last_selected_item);
497 if (!next) return EINA_FALSE;
499 _deselect_all_items(wd);
501 elm_gen_item_selected_set(next, EINA_TRUE);
502 elm_genlist_item_show(next);
507 _on_focus_hook(void *data __UNUSED__,
510 Widget_Data *wd = elm_widget_data_get(obj);
512 if (elm_widget_focus_get(obj))
514 elm_object_signal_emit(wd->obj, "elm,action,focus", "elm");
515 evas_object_focus_set(wd->obj, EINA_TRUE);
516 if ((wd->selected) && (!wd->last_selected_item))
517 wd->last_selected_item = eina_list_data_get(wd->selected);
521 elm_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
522 evas_object_focus_set(wd->obj, EINA_FALSE);
527 _del_hook(Evas_Object *obj)
529 Widget_Data *wd = elm_widget_data_get(obj);
531 _item_cache_zero(wd);
532 if (wd->calc_job) ecore_job_del(wd->calc_job);
533 if (wd->update_job) ecore_job_del(wd->update_job);
534 if (wd->queue_idle_enterer) ecore_idle_enterer_del(wd->queue_idle_enterer);
535 if (wd->must_recalc_idler) ecore_idler_del(wd->must_recalc_idler);
536 if (wd->multi_timer) ecore_timer_del(wd->multi_timer);
537 if (wd->mode_type) eina_stringshare_del(wd->mode_type);
538 if (wd->scr_hold_timer) ecore_timer_del(wd->scr_hold_timer);
543 _del_pre_hook(Evas_Object *obj)
545 Widget_Data *wd = elm_widget_data_get(obj);
548 evas_object_del(wd->pan_smart);
549 wd->pan_smart = NULL;
553 _mirrored_set(Evas_Object *obj,
556 Widget_Data *wd = elm_widget_data_get(obj);
558 _item_cache_zero(wd);
559 elm_smart_scroller_mirrored_set(wd->scr, rtl);
563 _theme_hook(Evas_Object *obj)
565 Widget_Data *wd = elm_widget_data_get(obj);
568 evas_event_freeze(evas_object_evas_get(wd->obj));
569 _item_cache_zero(wd);
570 _elm_widget_mirrored_reload(obj);
571 _mirrored_set(obj, elm_widget_mirrored_get(obj));
572 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
573 elm_widget_style_get(obj));
574 edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
575 wd->item_width = wd->item_height = 0;
576 wd->group_item_width = wd->group_item_height = 0;
577 wd->minw = wd->minh = wd->realminw = 0;
578 EINA_INLIST_FOREACH(wd->blocks, itb)
583 if (itb->realized) _item_block_unrealize(itb);
584 EINA_LIST_FOREACH(itb->items, l, it)
585 it->item->mincalcd = EINA_FALSE;
587 itb->changed = EINA_TRUE;
589 if (wd->calc_job) ecore_job_del(wd->calc_job);
590 wd->calc_job = ecore_job_add(_calc_job, wd);
592 evas_event_thaw(evas_object_evas_get(wd->obj));
593 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
597 _show_region_hook(void *data,
600 Widget_Data *wd = elm_widget_data_get(data);
601 Evas_Coord x, y, w, h;
603 elm_widget_show_region_get(obj, &x, &y, &w, &h);
604 //x & y are screen coordinates, Add with pan coordinates
607 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
611 _translate_hook(Evas_Object *obj)
613 evas_object_smart_callback_call(obj, "language,changed", NULL);
617 _sizing_eval(Evas_Object *obj)
619 Widget_Data *wd = elm_widget_data_get(obj);
620 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
622 evas_object_size_hint_min_get(wd->scr, &minw, &minh);
623 evas_object_size_hint_max_get(wd->scr, &maxw, &maxh);
625 if (wd->height_for_width)
629 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
630 if ((vw != 0) && (vw != wd->prev_viewport_w))
634 wd->prev_viewport_w = vw;
635 EINA_INLIST_FOREACH(wd->blocks, itb)
637 itb->must_recalc = EINA_TRUE;
639 if (wd->calc_job) ecore_job_del(wd->calc_job);
640 wd->calc_job = ecore_job_add(_calc_job, wd);
643 if (wd->mode == ELM_LIST_LIMIT)
649 edje_object_size_min_calc
650 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
657 edje_object_size_min_calc
658 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
662 evas_object_size_hint_min_set(obj, minw, minh);
663 evas_object_size_hint_max_set(obj, maxw, maxh);
667 _signal_emit_hook(Evas_Object *obj,
668 const char *emission,
671 Widget_Data *wd = elm_widget_data_get(obj);
672 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
677 _item_highlight(Elm_Gen_Item *it)
679 const char *selectraise;
680 if ((it->wd->no_select) || (it->delete_me) || (it->highlighted) ||
681 (it->disabled) || (it->display_only) || (it->item->mode_view))
683 edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
684 selectraise = edje_object_data_get(VIEW(it), "selectraise");
685 if ((selectraise) && (!strcmp(selectraise, "on")))
687 evas_object_raise(VIEW(it));
688 if ((it->item->group_item) && (it->item->group_item->realized))
689 evas_object_raise(it->item->VIEW(group_item));
691 it->highlighted = EINA_TRUE;
695 _item_unhighlight(Elm_Gen_Item *it)
697 if ((it->delete_me) || (!it->highlighted)) return;
698 edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm");
699 if (!it->item->nostacking)
701 if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even) evas_object_lower(VIEW(it));
702 else evas_object_raise(VIEW(it));
704 it->highlighted = EINA_FALSE;
708 _item_block_del(Elm_Gen_Item *it)
711 Item_Block *itb = it->item->block;
713 itb->items = eina_list_remove(itb->items, it);
715 itb->changed = EINA_TRUE;
716 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
717 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
720 il = EINA_INLIST_GET(itb);
721 Item_Block *itbn = (Item_Block *)(il->next);
723 it->parent->item->items = eina_list_remove(it->parent->item->items, it);
725 it->wd->blocks = eina_inlist_remove(it->wd->blocks, il);
727 if (itbn) itbn->changed = EINA_TRUE;
731 if (itb->count < itb->wd->max_items_per_block/2)
733 il = EINA_INLIST_GET(itb);
734 Item_Block *itbp = (Item_Block *)(il->prev);
735 Item_Block *itbn = (Item_Block *)(il->next);
736 if ((itbp) && ((itbp->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
740 EINA_LIST_FREE(itb->items, it2)
742 it2->item->block = itbp;
743 itbp->items = eina_list_append(itbp->items, it2);
745 itbp->changed = EINA_TRUE;
747 it->wd->blocks = eina_inlist_remove(it->wd->blocks,
748 EINA_INLIST_GET(itb));
751 else if ((itbn) && ((itbn->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
755 Eina_List *last = eina_list_last(itb->items);
756 Elm_Gen_Item *it2 = last->data;
758 it2->item->block = itbn;
759 itb->items = eina_list_remove_list(itb->items, last);
760 itbn->items = eina_list_prepend(itbn->items, it2);
762 itbn->changed = EINA_TRUE;
765 eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb));
773 _item_del(Elm_Gen_Item *it)
775 Evas_Object *obj = WIDGET(it);
777 evas_event_freeze(evas_object_evas_get(obj));
778 elm_genlist_item_subitems_clear(it);
779 if (it->wd->show_item == it) it->wd->show_item = NULL;
780 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE);
781 if (it->item->block) _item_block_del(it);
782 if (it->item->queued)
783 it->wd->queue = eina_list_remove(it->wd->queue, it);
784 if (it->wd->anchor_item == it)
786 it->wd->anchor_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
787 if (!it->wd->anchor_item)
788 it->wd->anchor_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
791 it->parent->item->items = eina_list_remove(it->parent->item->items, it);
792 if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
793 elm_gen_item_del_serious(it);
794 evas_event_thaw(evas_object_evas_get(obj));
795 evas_event_thaw_eval(evas_object_evas_get(obj));
799 _clear_cb(Widget_Data *wd)
801 wd->anchor_item = NULL;
804 Item_Block *itb = (Item_Block *)(wd->blocks);
806 wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
807 if (itb->items) eina_list_free(itb->items);
810 if (wd->queue_idle_enterer)
812 ecore_idle_enterer_del(wd->queue_idle_enterer);
813 wd->queue_idle_enterer = NULL;
815 if (wd->must_recalc_idler)
817 ecore_idler_del(wd->must_recalc_idler);
818 wd->must_recalc_idler = NULL;
820 if (wd->queue) wd->queue = eina_list_free(wd->queue);
821 if (wd->reorder_move_animator)
823 ecore_animator_del(wd->reorder_move_animator);
824 wd->reorder_move_animator = NULL;
826 wd->show_item = NULL;
827 wd->reorder_old_pan_y = 0;
831 _item_unselect(Elm_Gen_Item *it)
833 if ((it->delete_me) || (!it->selected)) return;
834 it->selected = EINA_FALSE;
835 it->wd->selected = eina_list_remove(it->wd->selected, it);
836 evas_object_smart_callback_call(WIDGET(it), SIG_UNSELECTED, it);
840 _mouse_move(void *data,
841 Evas *evas __UNUSED__,
845 Elm_Gen_Item *it = data;
846 Evas_Event_Mouse_Move *ev = event_info;
847 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
848 Evas_Coord ox, oy, ow, oh, it_scrl_y, y_pos;
850 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
852 if (!it->wd->on_hold)
854 it->wd->on_hold = EINA_TRUE;
855 if (!it->wd->wasselected)
857 _item_unhighlight(it);
862 if (it->wd->multitouched)
864 it->wd->cur_x = ev->cur.canvas.x;
865 it->wd->cur_y = ev->cur.canvas.y;
868 if ((it->dragging) && (it->down))
870 if (it->wd->movements == SWIPE_MOVES) it->wd->swipe = EINA_TRUE;
873 it->wd->history[it->wd->movements].x = ev->cur.canvas.x;
874 it->wd->history[it->wd->movements].y = ev->cur.canvas.y;
875 if (abs((it->wd->history[it->wd->movements].x -
876 it->wd->history[0].x)) > 40)
877 it->wd->swipe = EINA_TRUE;
883 ecore_timer_del(it->long_timer);
884 it->long_timer = NULL;
886 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG, it);
889 if ((!it->down) /* || (it->wd->on_hold)*/ || (it->wd->longpressed))
893 ecore_timer_del(it->long_timer);
894 it->long_timer = NULL;
896 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
898 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
899 it_scrl_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
901 if (!it->wd->reorder_start_y)
902 it->wd->reorder_start_y = it->item->block->y + it->y;
906 else if (it_scrl_y + it->wd->reorder_it->item->h > oy + oh)
907 y_pos = oy + oh - it->wd->reorder_it->item->h;
911 _item_position(it, VIEW(it), it->item->scrl_x, y_pos);
913 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
914 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
918 if (!it->display_only)
919 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
920 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
921 x = ev->cur.canvas.x - x;
922 y = ev->cur.canvas.y - y;
925 if (adx < 0) adx = -dx;
928 if (ady < 0) ady = -dy;
931 if ((adx > minw) || (ady > minh))
933 it->dragging = EINA_TRUE;
936 ecore_timer_del(it->long_timer);
937 it->long_timer = NULL;
939 if (!it->wd->wasselected)
941 _item_unhighlight(it);
947 evas_object_smart_callback_call(WIDGET(it),
948 SIG_DRAG_START_UP, it);
952 evas_object_smart_callback_call(WIDGET(it),
953 SIG_DRAG_START_LEFT, it);
955 evas_object_smart_callback_call(WIDGET(it),
956 SIG_DRAG_START_RIGHT, it);
962 evas_object_smart_callback_call(WIDGET(it),
963 SIG_DRAG_START_DOWN, it);
967 evas_object_smart_callback_call(WIDGET(it),
968 SIG_DRAG_START_LEFT, it);
970 evas_object_smart_callback_call(WIDGET(it),
971 SIG_DRAG_START_RIGHT, it);
978 _long_press(void *data)
980 Elm_Gen_Item *it = data, *it_tmp;
983 it->long_timer = NULL;
984 if ((it->disabled) || (it->dragging) || (it->display_only))
985 return ECORE_CALLBACK_CANCEL;
986 it->wd->longpressed = EINA_TRUE;
987 evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it);
988 if ((it->wd->reorder_mode) && (!it->group))
990 it->wd->reorder_it = it;
991 it->wd->reorder_start_y = 0;
993 evas_object_raise(VIEW(it));
994 elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
995 elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_FALSE);
997 list = elm_genlist_realized_items_get(it->wd->obj);
998 EINA_LIST_FOREACH(list, l, it_tmp)
1000 if (it != it_tmp) _item_unselect(it_tmp);
1002 if (elm_genlist_item_expanded_get(it))
1004 elm_genlist_item_expanded_set(it, EINA_FALSE);
1005 return ECORE_CALLBACK_RENEW;
1007 edje_object_signal_emit(VIEW(it), "elm,state,reorder,enabled", "elm");
1009 return ECORE_CALLBACK_CANCEL;
1013 _swipe(Elm_Gen_Item *it)
1018 if ((it->display_only) || (it->disabled)) return;
1019 it->wd->swipe = EINA_FALSE;
1020 for (i = 0; i < it->wd->movements; i++)
1022 sum += it->wd->history[i].x;
1023 if (abs(it->wd->history[0].y - it->wd->history[i].y) > 10) return;
1026 sum /= it->wd->movements;
1027 if (abs(sum - it->wd->history[0].x) <= 10) return;
1028 evas_object_smart_callback_call(WIDGET(it), SIG_SWIPE, it);
1032 _swipe_cancel(void *data)
1034 Elm_Gen_Item *it = data;
1036 if (!it) return ECORE_CALLBACK_CANCEL;
1037 it->wd->swipe = EINA_FALSE;
1038 it->wd->movements = 0;
1039 return ECORE_CALLBACK_RENEW;
1043 _multi_cancel(void *data)
1045 Widget_Data *wd = data;
1047 if (!wd) return ECORE_CALLBACK_CANCEL;
1048 wd->multi_timeout = EINA_TRUE;
1049 return ECORE_CALLBACK_RENEW;
1053 _multi_touch_gesture_eval(void *data)
1055 Elm_Gen_Item *it = data;
1057 it->wd->multitouched = EINA_FALSE;
1058 if (it->wd->multi_timer)
1060 ecore_timer_del(it->wd->multi_timer);
1061 it->wd->multi_timer = NULL;
1063 if (it->wd->multi_timeout)
1065 it->wd->multi_timeout = EINA_FALSE;
1069 Evas_Coord minw = 0, minh = 0;
1070 Evas_Coord off_x, off_y, off_mx, off_my;
1072 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1073 off_x = abs(it->wd->cur_x - it->wd->prev_x);
1074 off_y = abs(it->wd->cur_y - it->wd->prev_y);
1075 off_mx = abs(it->wd->cur_mx - it->wd->prev_mx);
1076 off_my = abs(it->wd->cur_my - it->wd->prev_my);
1078 if (((off_x > minw) || (off_y > minh)) && ((off_mx > minw) || (off_my > minh)))
1080 if ((off_x + off_mx) > (off_y + off_my))
1082 if ((it->wd->cur_x > it->wd->prev_x) && (it->wd->cur_mx > it->wd->prev_mx))
1083 evas_object_smart_callback_call(WIDGET(it),
1084 SIG_MULTI_SWIPE_RIGHT, it);
1085 else if ((it->wd->cur_x < it->wd->prev_x) && (it->wd->cur_mx < it->wd->prev_mx))
1086 evas_object_smart_callback_call(WIDGET(it),
1087 SIG_MULTI_SWIPE_LEFT, it);
1088 else if (abs(it->wd->cur_x - it->wd->cur_mx) > abs(it->wd->prev_x - it->wd->prev_mx))
1089 evas_object_smart_callback_call(WIDGET(it),
1090 SIG_MULTI_PINCH_OUT, it);
1092 evas_object_smart_callback_call(WIDGET(it),
1093 SIG_MULTI_PINCH_IN, it);
1097 if ((it->wd->cur_y > it->wd->prev_y) && (it->wd->cur_my > it->wd->prev_my))
1098 evas_object_smart_callback_call(WIDGET(it),
1099 SIG_MULTI_SWIPE_DOWN, it);
1100 else if ((it->wd->cur_y < it->wd->prev_y) && (it->wd->cur_my < it->wd->prev_my))
1101 evas_object_smart_callback_call(WIDGET(it),
1102 SIG_MULTI_SWIPE_UP, it);
1103 else if (abs(it->wd->cur_y - it->wd->cur_my) > abs(it->wd->prev_y - it->wd->prev_my))
1104 evas_object_smart_callback_call(WIDGET(it),
1105 SIG_MULTI_PINCH_OUT, it);
1107 evas_object_smart_callback_call(WIDGET(it),
1108 SIG_MULTI_PINCH_IN, it);
1111 it->wd->multi_timeout = EINA_FALSE;
1115 _multi_down(void *data,
1116 Evas *evas __UNUSED__,
1117 Evas_Object *obj __UNUSED__,
1120 Elm_Gen_Item *it = data;
1121 Evas_Event_Multi_Down *ev = event_info;
1123 if ((it->wd->multi_device != 0) || (it->wd->multitouched) || (it->wd->multi_timeout)) return;
1124 it->wd->multi_device = ev->device;
1125 it->wd->multi_down = EINA_TRUE;
1126 it->wd->multitouched = EINA_TRUE;
1127 it->wd->prev_mx = ev->canvas.x;
1128 it->wd->prev_my = ev->canvas.y;
1129 if (!it->wd->wasselected)
1131 _item_unhighlight(it);
1134 it->wd->wasselected = EINA_FALSE;
1135 it->wd->longpressed = EINA_FALSE;
1138 ecore_timer_del(it->long_timer);
1139 it->long_timer = NULL;
1143 it->dragging = EINA_FALSE;
1144 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
1146 if (it->item->swipe_timer)
1148 ecore_timer_del(it->item->swipe_timer);
1149 it->item->swipe_timer = NULL;
1151 if (it->wd->on_hold)
1153 it->wd->swipe = EINA_FALSE;
1154 it->wd->movements = 0;
1155 it->wd->on_hold = EINA_FALSE;
1160 _multi_up(void *data,
1161 Evas *evas __UNUSED__,
1162 Evas_Object *obj __UNUSED__,
1165 Elm_Gen_Item *it = data;
1166 Evas_Event_Multi_Up *ev = event_info;
1168 if (it->wd->multi_device != ev->device) return;
1169 it->wd->multi_device = 0;
1170 it->wd->multi_down = EINA_FALSE;
1171 if (it->wd->mouse_down) return;
1172 _multi_touch_gesture_eval(data);
1176 _multi_move(void *data,
1177 Evas *evas __UNUSED__,
1178 Evas_Object *obj __UNUSED__,
1181 Elm_Gen_Item *it = data;
1182 Evas_Event_Multi_Move *ev = event_info;
1184 if (it->wd->multi_device != ev->device) return;
1185 it->wd->cur_mx = ev->cur.canvas.x;
1186 it->wd->cur_my = ev->cur.canvas.y;
1190 _mouse_down(void *data,
1191 Evas *evas __UNUSED__,
1195 Elm_Gen_Item *it = data;
1196 Evas_Event_Mouse_Down *ev = event_info;
1199 if (ev->button != 1) return;
1200 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1202 it->wd->on_hold = EINA_TRUE;
1205 it->down = EINA_TRUE;
1206 it->dragging = EINA_FALSE;
1207 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1208 it->dx = ev->canvas.x - x;
1209 it->dy = ev->canvas.y - y;
1210 it->wd->mouse_down = EINA_TRUE;
1211 if (!it->wd->multitouched)
1213 it->wd->prev_x = ev->canvas.x;
1214 it->wd->prev_y = ev->canvas.y;
1215 it->wd->multi_timeout = EINA_FALSE;
1216 if (it->wd->multi_timer) ecore_timer_del(it->wd->multi_timer);
1217 it->wd->multi_timer = ecore_timer_add(1, _multi_cancel, it->wd);
1219 it->wd->longpressed = EINA_FALSE;
1220 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1221 else it->wd->on_hold = EINA_FALSE;
1222 if (it->wd->on_hold) return;
1223 it->wd->wasselected = it->selected;
1224 _item_highlight(it);
1225 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
1226 if ((!it->disabled) && (!it->display_only))
1228 evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
1229 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
1231 if (it->long_timer) ecore_timer_del(it->long_timer);
1232 if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
1233 it->item->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
1235 it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press,
1238 it->long_timer = NULL;
1239 it->wd->swipe = EINA_FALSE;
1240 it->wd->movements = 0;
1244 _mouse_up(void *data,
1245 Evas *evas __UNUSED__,
1246 Evas_Object *obj __UNUSED__,
1249 Elm_Gen_Item *it = data;
1250 Evas_Event_Mouse_Up *ev = event_info;
1251 Eina_Bool dragged = EINA_FALSE;
1253 if (ev->button != 1) return;
1254 it->down = EINA_FALSE;
1255 it->wd->mouse_down = EINA_FALSE;
1256 if (it->wd->multitouched)
1258 if ((!it->wd->multi) && (!it->selected) && (it->highlighted)) _item_unhighlight(it);
1259 if (it->wd->multi_down) return;
1260 _multi_touch_gesture_eval(data);
1263 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1264 else it->wd->on_hold = EINA_FALSE;
1267 ecore_timer_del(it->long_timer);
1268 it->long_timer = NULL;
1272 it->dragging = EINA_FALSE;
1273 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
1276 if (it->item->swipe_timer)
1278 ecore_timer_del(it->item->swipe_timer);
1279 it->item->swipe_timer = NULL;
1281 if (it->wd->multi_timer)
1283 ecore_timer_del(it->wd->multi_timer);
1284 it->wd->multi_timer = NULL;
1285 it->wd->multi_timeout = EINA_FALSE;
1287 if (it->wd->on_hold)
1289 if (it->wd->swipe) _swipe(data);
1290 it->wd->longpressed = EINA_FALSE;
1291 it->wd->on_hold = EINA_FALSE;
1294 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
1296 Evas_Coord it_scrl_y = ev->canvas.y - it->wd->reorder_it->dy;
1298 if (it->wd->reorder_rel && (it->wd->reorder_it->parent == it->wd->reorder_rel->parent))
1300 if (it_scrl_y <= it->wd->reorder_rel->item->scrl_y)
1301 _item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
1303 _item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
1307 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1308 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1310 edje_object_signal_emit(VIEW(it), "elm,state,reorder,disabled", "elm");
1311 it->wd->reorder_it = it->wd->reorder_rel = NULL;
1312 elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
1313 elm_smart_scroller_bounce_allow_set(it->wd->scr, it->wd->h_bounce, it->wd->v_bounce);
1315 if (it->wd->longpressed)
1317 it->wd->longpressed = EINA_FALSE;
1318 if (!it->wd->wasselected)
1320 _item_unhighlight(it);
1323 it->wd->wasselected = EINA_FALSE;
1328 if (it->want_unrealize)
1330 elm_gen_item_unrealize(it, EINA_FALSE);
1331 if (it->item->block->want_unrealize)
1332 _item_block_unrealize(it->item->block);
1335 if ((it->disabled) || (dragged) || (it->display_only)) return;
1336 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1341 _item_highlight(it);
1346 _item_unhighlight(it);
1354 Widget_Data *wd = it->wd;
1357 while (wd->selected)
1359 _item_unhighlight(wd->selected->data);
1360 _item_unselect(wd->selected->data);
1366 const Eina_List *l, *l_next;
1369 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
1372 _item_unhighlight(it2);
1373 _item_unselect(it2);
1375 //_item_highlight(it);
1378 _item_highlight(it);
1384 _signal_expand_toggle(void *data,
1385 Evas_Object *obj __UNUSED__,
1386 const char *emission __UNUSED__,
1387 const char *source __UNUSED__)
1389 Elm_Gen_Item *it = data;
1391 if (it->item->expanded)
1392 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it);
1394 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it);
1398 _signal_expand(void *data,
1399 Evas_Object *obj __UNUSED__,
1400 const char *emission __UNUSED__,
1401 const char *source __UNUSED__)
1403 Elm_Gen_Item *it = data;
1405 if (!it->item->expanded)
1406 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it);
1410 _signal_contract(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_CONTRACT_REQUEST, it);
1422 _scr_hold_timer_cb(void *data)
1424 if (!data) return ECORE_CALLBACK_CANCEL;
1425 Widget_Data *wd = data;
1426 elm_smart_scroller_hold_set(wd->scr, EINA_FALSE);
1427 wd->scr_hold_timer = NULL;
1428 return ECORE_CALLBACK_CANCEL;
1432 _mode_finished_signal_cb(void *data,
1434 const char *emission __UNUSED__,
1435 const char *source __UNUSED__)
1439 Elm_Gen_Item *it = data;
1440 if ((it->delete_me) || (!it->realized) || (!it->item->mode_view)) return;
1442 Evas *te = evas_object_evas_get(obj);
1444 evas_event_freeze(te);
1445 it->item->nocache = EINA_FALSE;
1446 _mode_item_unrealize(it);
1447 if (it->item->group_item)
1448 evas_object_raise(it->item->VIEW(group_item));
1449 snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished", it->wd->mode_type);
1450 edje_object_signal_callback_del_full(obj, buf, "elm", _mode_finished_signal_cb, it);
1451 evas_event_thaw(te);
1452 evas_event_thaw_eval(te);
1456 _item_cache_clean(Widget_Data *wd)
1458 evas_event_freeze(evas_object_evas_get(wd->obj));
1459 while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max))
1463 itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache);
1464 wd->item_cache = eina_inlist_remove(wd->item_cache,
1465 wd->item_cache->last);
1466 wd->item_cache_count--;
1467 if (itc->spacer) evas_object_del(itc->spacer);
1468 if (itc->base_view) evas_object_del(itc->base_view);
1469 if (itc->item_style) eina_stringshare_del(itc->item_style);
1472 evas_event_thaw(evas_object_evas_get(wd->obj));
1473 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
1477 _item_cache_zero(Widget_Data *wd)
1479 int pmax = wd->item_cache_max;
1480 wd->item_cache_max = 0;
1481 _item_cache_clean(wd);
1482 wd->item_cache_max = pmax;
1486 _item_cache_add(Elm_Gen_Item *it)
1490 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1491 if (it->wd->item_cache_max <= 0)
1493 evas_object_del(VIEW(it));
1495 evas_object_del(it->spacer);
1497 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1498 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1502 it->wd->item_cache_count++;
1503 itc = calloc(1, sizeof(Item_Cache));
1504 it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache,
1505 EINA_INLIST_GET(itc));
1506 itc->spacer = it->spacer;
1508 itc->base_view = VIEW(it);
1510 evas_object_hide(itc->base_view);
1511 evas_object_move(itc->base_view, -9999, -9999);
1512 itc->item_style = eina_stringshare_add(it->itc->item_style);
1513 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
1514 itc->compress = (it->wd->compress);
1515 itc->selected = it->selected;
1516 itc->disabled = it->disabled;
1517 itc->expanded = it->item->expanded;
1520 ecore_timer_del(it->long_timer);
1521 it->long_timer = NULL;
1523 if (it->item->swipe_timer)
1525 ecore_timer_del(it->item->swipe_timer);
1526 it->item->swipe_timer = NULL;
1528 // FIXME: other callbacks?
1529 edje_object_signal_callback_del_full(itc->base_view,
1530 "elm,action,expand,toggle",
1531 "elm", _signal_expand_toggle, it);
1532 edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand",
1534 _signal_expand, it);
1535 edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract",
1536 "elm", _signal_contract, it);
1537 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_DOWN,
1539 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP,
1541 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_MOVE,
1543 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_DOWN,
1545 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_UP,
1547 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_MOVE,
1549 _item_cache_clean(it->wd);
1550 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1551 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1555 _item_cache_find(Elm_Gen_Item *it)
1560 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
1561 EINA_INLIST_FOREACH(it->wd->item_cache, itc)
1563 if ((itc->selected) || (itc->disabled) || (itc->expanded))
1565 if ((itc->tree == tree) &&
1566 (itc->compress == it->wd->compress) &&
1567 (!strcmp(it->itc->item_style, itc->item_style)))
1569 it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
1570 EINA_INLIST_GET(itc));
1571 it->wd->item_cache_count--;
1579 _elm_genlist_item_odd_even_update(Elm_Gen_Item *it)
1581 if (!it->item->nostacking)
1583 if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even)
1584 evas_object_lower(VIEW(it));
1586 evas_object_raise(VIEW(it));
1589 if (it->item->order_num_in & 0x1)
1590 edje_object_signal_emit(VIEW(it), "elm,state,odd", "elm");
1592 edje_object_signal_emit(VIEW(it), "elm,state,even", "elm");
1596 _elm_genlist_item_state_update(Elm_Gen_Item *it, Item_Cache *itc)
1600 if (it->selected != itc->selected)
1603 edje_object_signal_emit(VIEW(it),
1604 "elm,state,selected", "elm");
1606 if (it->disabled != itc->disabled)
1609 edje_object_signal_emit(VIEW(it),
1610 "elm,state,disabled", "elm");
1612 if (it->item->expanded != itc->expanded)
1614 if (it->item->expanded)
1615 edje_object_signal_emit(VIEW(it),
1616 "elm,state,expanded", "elm");
1622 edje_object_signal_emit(VIEW(it),
1623 "elm,state,selected", "elm");
1625 edje_object_signal_emit(VIEW(it),
1626 "elm,state,disabled", "elm");
1627 if (it->item->expanded)
1628 edje_object_signal_emit(VIEW(it),
1629 "elm,state,expanded", "elm");
1634 _item_cache_free(Item_Cache *itc)
1636 if (itc->spacer) evas_object_del(itc->spacer);
1637 if (itc->base_view) evas_object_del(itc->base_view);
1638 if (itc->item_style) eina_stringshare_del(itc->item_style);
1643 _item_del_hook(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1645 Elm_Gen_Item *it = event_info;
1647 if (it->wd->last_selected_item == it)
1648 it->wd->last_selected_item = NULL;
1652 _item_label_realize(Elm_Gen_Item *it,
1653 Evas_Object *target,
1657 if (it->itc->func.label_get)
1662 *source = elm_widget_stringlist_get(edje_object_data_get(target, "labels"));
1663 EINA_LIST_FOREACH(*source, l, key)
1665 if (parts && fnmatch(parts, key, FNM_PERIOD))
1668 char *s = it->itc->func.label_get
1669 ((void *)it->base.data, WIDGET(it), key);
1673 edje_object_part_text_set(target, key, s);
1678 edje_object_part_text_set(target, key, "");
1685 _item_content_unrealize(Elm_Gen_Item *it,
1686 Evas_Object *target,
1690 Eina_List *res = it->content_objs;
1692 if (it->itc->func.content_get)
1696 Evas_Object *ic = NULL;
1698 EINA_LIST_FOREACH(*source, l, key)
1700 if (parts && fnmatch(parts, key, FNM_PERIOD))
1703 ic = edje_object_part_swallow_get(target, key);
1706 res = eina_list_remove(res, ic);
1707 edje_object_part_unswallow(target, ic);
1708 evas_object_del(ic);
1717 _item_content_realize(Elm_Gen_Item *it,
1718 Evas_Object *target,
1722 Eina_List *res = NULL;
1724 if (it->itc->func.content_get)
1728 Evas_Object *ic = NULL;
1730 *source = elm_widget_stringlist_get(edje_object_data_get(target, "contents"));
1732 if (parts && (eina_list_count(*source) != eina_list_count(it->content_objs)))
1733 res = it->content_objs;
1735 EINA_LIST_FOREACH(*source, l, key)
1737 if (parts && fnmatch(parts, key, FNM_PERIOD))
1740 if (it->itc->func.content_get)
1741 ic = it->itc->func.content_get
1742 ((void *)it->base.data, WIDGET(it), key);
1745 res = eina_list_append(res, ic);
1746 edje_object_part_swallow(target, key, ic);
1747 evas_object_show(ic);
1748 elm_widget_sub_object_add(WIDGET(it), ic);
1750 elm_widget_disabled_set(ic, EINA_TRUE);
1759 _item_state_realize(Elm_Gen_Item *it,
1760 Evas_Object *target,
1764 if (it->itc->func.state_get)
1770 *source = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
1771 EINA_LIST_FOREACH(*source, l, key)
1773 if (parts && fnmatch(parts, key, FNM_PERIOD))
1776 Eina_Bool on = it->itc->func.state_get
1777 ((void *)it->base.data, WIDGET(it), key);
1781 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
1782 edje_object_signal_emit(target, buf, "elm");
1786 snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
1787 edje_object_signal_emit(target, buf, "elm");
1794 _item_realize(Elm_Gen_Item *it,
1799 const char *treesize;
1801 int depth, tsize = 20;
1802 Item_Cache *itc = NULL;
1804 if (it->delete_me) return;
1805 //evas_event_freeze(evas_object_evas_get(it->wd->obj));
1808 if (it->item->order_num_in != in)
1810 it->item->order_num_in = in;
1811 _elm_genlist_item_odd_even_update(it);
1812 _elm_genlist_item_state_update(it, NULL);
1814 //evas_event_thaw(evas_object_evas_get(it->wd->obj));
1815 //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1818 it->item->order_num_in = in;
1820 if (it->item->nocache)
1821 it->item->nocache = EINA_FALSE;
1823 itc = _item_cache_find(it);
1826 VIEW(it) = itc->base_view;
1827 itc->base_view = NULL;
1828 it->spacer = itc->spacer;
1833 const char *stacking_even;
1834 const char *stacking;
1836 VIEW(it) = edje_object_add(evas_object_evas_get(WIDGET(it)));
1837 edje_object_scale_set(VIEW(it),
1838 elm_widget_scale_get(WIDGET(it)) *
1839 _elm_config->scale);
1840 evas_object_smart_member_add(VIEW(it), it->wd->pan_smart);
1841 elm_widget_sub_object_add(WIDGET(it), VIEW(it));
1843 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS)
1844 strncpy(buf, "tree", sizeof(buf));
1845 else strncpy(buf, "item", sizeof(buf));
1846 if (it->wd->compress)
1847 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
1849 strncat(buf, "/", sizeof(buf) - strlen(buf));
1850 strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf));
1852 _elm_theme_object_set(WIDGET(it), VIEW(it), "genlist", buf,
1853 elm_widget_style_get(WIDGET(it)));
1855 stacking_even = edje_object_data_get(VIEW(it), "stacking_even");
1856 if (!stacking_even) stacking_even = "above";
1857 it->item->stacking_even = !!strcmp("above", stacking_even);
1859 stacking = edje_object_data_get(VIEW(it), "stacking");
1860 if (!stacking) stacking = "yes";
1861 it->item->nostacking = !!strcmp("yes", stacking);
1863 edje_object_mirrored_set(VIEW(it),
1864 elm_widget_mirrored_get(WIDGET(it)));
1866 evas_object_rectangle_add(evas_object_evas_get(WIDGET(it)));
1867 evas_object_color_set(it->spacer, 0, 0, 0, 0);
1868 elm_widget_sub_object_add(WIDGET(it), it->spacer);
1871 _elm_genlist_item_odd_even_update(it);
1873 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
1875 if (!it2->parent->group) depth += 1;
1877 it->item->expanded_depth = depth;
1878 treesize = edje_object_data_get(VIEW(it), "treesize");
1879 if (treesize) tsize = atoi(treesize);
1880 evas_object_size_hint_min_set(it->spacer,
1881 (depth * tsize) * _elm_config->scale, 1);
1882 edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer);
1885 edje_object_signal_callback_add(VIEW(it),
1886 "elm,action,expand,toggle",
1887 "elm", _signal_expand_toggle, it);
1888 edje_object_signal_callback_add(VIEW(it), "elm,action,expand",
1889 "elm", _signal_expand, it);
1890 edje_object_signal_callback_add(VIEW(it), "elm,action,contract",
1891 "elm", _signal_contract, it);
1892 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN,
1894 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_UP,
1896 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
1898 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_DOWN,
1900 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_UP,
1902 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_MOVE,
1905 _elm_genlist_item_state_update(it, itc);
1908 if ((calc) && (it->wd->homogeneous) &&
1909 ((it->wd->item_width) ||
1910 ((it->wd->item_width) && (it->wd->group_item_width))))
1912 /* homogenous genlist shortcut */
1913 if (!it->item->mincalcd)
1917 it->item->w = it->item->minw = it->wd->group_item_width;
1918 it->item->h = it->item->minh = it->wd->group_item_height;
1922 it->item->w = it->item->minw = it->wd->item_width;
1923 it->item->h = it->item->minh = it->wd->item_height;
1925 it->item->mincalcd = EINA_TRUE;
1930 /* FIXME: If you see that assert, please notify us and we
1931 will clean our mess */
1932 assert(eina_list_count(it->content_objs) == 0);
1934 _item_label_realize(it, VIEW(it), &it->labels, NULL);
1935 it->content_objs = _item_content_realize(it, VIEW(it), &it->contents, NULL);
1936 _item_state_realize(it, VIEW(it), &it->states, NULL);
1938 if (!it->item->mincalcd)
1940 Evas_Coord mw = -1, mh = -1;
1942 if (!it->display_only)
1943 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1944 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
1945 edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw,
1947 if (!it->display_only)
1948 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1949 it->item->w = it->item->minw = mw;
1950 it->item->h = it->item->minh = mh;
1951 it->item->mincalcd = EINA_TRUE;
1953 if ((!it->wd->group_item_width) && (it->group))
1955 it->wd->group_item_width = mw;
1956 it->wd->group_item_height = mh;
1958 else if ((!it->wd->item_width) && (it->item->flags == ELM_GENLIST_ITEM_NONE))
1960 it->wd->item_width = mw;
1961 it->wd->item_height = mh;
1964 if (!calc) evas_object_show(VIEW(it));
1967 if (it->tooltip.content_cb)
1969 elm_widget_item_tooltip_content_cb_set(it,
1970 it->tooltip.content_cb,
1971 it->tooltip.data, NULL);
1972 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
1973 elm_widget_item_tooltip_size_restrict_disable(it, it->tooltip.free_size);
1976 if (it->mouse_cursor)
1977 elm_widget_item_cursor_set(it, it->mouse_cursor);
1979 it->realized = EINA_TRUE;
1980 it->want_unrealize = EINA_FALSE;
1982 if (itc) _item_cache_free(itc);
1983 //evas_event_thaw(evas_object_evas_get(it->wd->obj));
1984 //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1986 evas_object_smart_callback_call(WIDGET(it), SIG_REALIZED, it);
1987 edje_object_message_signal_process(VIEW(it));
1991 _item_unrealize_cb(Elm_Gen_Item *it)
1993 if (it->item->nocache)
1995 evas_object_del(VIEW(it));
1997 evas_object_del(it->spacer);
2002 edje_object_mirrored_set(VIEW(it),
2003 elm_widget_mirrored_get(WIDGET(it)));
2004 edje_object_scale_set(VIEW(it),
2005 elm_widget_scale_get(WIDGET(it))
2006 * _elm_config->scale);
2007 _item_cache_add(it);
2010 _mode_item_unrealize(it);
2012 it->realized = EINA_FALSE;
2013 it->want_unrealize = EINA_FALSE;
2017 _item_block_recalc(Item_Block *itb,
2023 Evas_Coord minw = 0, minh = 0;
2024 Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE;
2027 //evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2029 EINA_LIST_FOREACH(itb->items, l, it)
2031 if (it->delete_me) continue;
2032 showme |= it->item->showme;
2037 if (!it->item->mincalcd) changed = EINA_TRUE;
2040 _item_realize(it, in, EINA_TRUE);
2041 elm_gen_item_unrealize(it, EINA_TRUE);
2046 _item_realize(it, in, EINA_TRUE);
2047 elm_gen_item_unrealize(it, EINA_TRUE);
2051 _item_realize(it, in, EINA_FALSE);
2052 minh += it->item->minh;
2053 if (minw < it->item->minw) minw = it->item->minw;
2061 itb->changed = EINA_FALSE;
2062 //evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2063 //evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2068 _item_block_realize(Item_Block *itb)
2070 if (itb->realized) return;
2071 itb->realized = EINA_TRUE;
2072 itb->want_unrealize = EINA_FALSE;
2076 _item_block_unrealize(Item_Block *itb)
2080 Eina_Bool dragging = EINA_FALSE;
2082 if (!itb->realized) return;
2083 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2084 EINA_LIST_FOREACH(itb->items, l, it)
2090 dragging = EINA_TRUE;
2091 it->want_unrealize = EINA_TRUE;
2094 elm_gen_item_unrealize(it, EINA_FALSE);
2099 itb->realized = EINA_FALSE;
2100 itb->want_unrealize = EINA_TRUE;
2103 itb->want_unrealize = EINA_FALSE;
2104 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2105 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2109 _get_space_for_reorder_item(Elm_Gen_Item *it)
2111 Evas_Coord rox, roy, row, roh, oy, oh;
2112 Eina_Bool top = EINA_FALSE;
2113 Elm_Gen_Item *reorder_it = it->wd->reorder_it;
2114 if (!reorder_it) return 0;
2116 evas_object_geometry_get(it->wd->pan_smart, NULL, &oy, NULL, &oh);
2117 evas_object_geometry_get(it->wd->VIEW(reorder_it), &rox, &roy, &row, &roh);
2119 if ((it->wd->reorder_start_y < it->item->block->y) &&
2120 (roy - oy + (roh / 2) >= it->item->block->y - it->wd->pan_y))
2122 it->item->block->reorder_offset = it->wd->reorder_it->item->h * -1;
2123 if (it->item->block->count == 1)
2124 it->wd->reorder_rel = it;
2126 else if ((it->wd->reorder_start_y >= it->item->block->y) &&
2127 (roy - oy + (roh / 2) <= it->item->block->y - it->wd->pan_y))
2129 it->item->block->reorder_offset = it->wd->reorder_it->item->h;
2132 it->item->block->reorder_offset = 0;
2134 it->item->scrl_y += it->item->block->reorder_offset;
2136 top = (ELM_RECTS_INTERSECT(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h,
2137 rox, roy + (roh / 2), row, 1));
2140 it->wd->reorder_rel = it;
2141 it->item->scrl_y += it->wd->reorder_it->item->h;
2142 return it->wd->reorder_it->item->h;
2149 _reorder_move_animator_cb(void *data)
2151 Elm_Gen_Item *it = data;
2152 Eina_Bool down = EINA_FALSE;
2154 int y, dy = it->item->h / 10 * _elm_config->scale, diff;
2156 t = ((0.0 > (t = ecore_loop_time_get()-it->wd->start_time)) ? 0.0 : t);
2158 if (t <= REORDER_EFFECT_TIME) y = (1 * sin((t / REORDER_EFFECT_TIME) * (M_PI / 2)) * dy);
2161 diff = abs(it->item->old_scrl_y - it->item->scrl_y);
2162 if (diff > it->item->h) y = diff / 2;
2164 if (it->item->old_scrl_y < it->item->scrl_y)
2166 it->item->old_scrl_y += y;
2169 else if (it->item->old_scrl_y > it->item->scrl_y)
2171 it->item->old_scrl_y -= y;
2174 _item_position(it, VIEW(it), it->item->scrl_x, it->item->old_scrl_y);
2175 _group_items_recalc(it->wd);
2177 if ((it->wd->reorder_pan_move) ||
2178 (down && it->item->old_scrl_y >= it->item->scrl_y) ||
2179 (!down && it->item->old_scrl_y <= it->item->scrl_y))
2181 it->item->old_scrl_y = it->item->scrl_y;
2182 it->item->move_effect_enabled = EINA_FALSE;
2183 it->wd->reorder_move_animator = NULL;
2184 return ECORE_CALLBACK_CANCEL;
2186 return ECORE_CALLBACK_RENEW;
2190 _item_position(Elm_Gen_Item *it,
2198 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2199 evas_object_resize(view, it->item->w, it->item->h);
2200 evas_object_move(view, it_x, it_y);
2201 evas_object_show(view);
2202 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2203 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2207 _item_block_position(Item_Block *itb,
2213 Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2214 Eina_Bool vis = EINA_FALSE;
2216 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2217 evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh);
2218 evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy,
2220 EINA_LIST_FOREACH(itb->items, l, it)
2222 if (it->delete_me) continue;
2223 else if (it->wd->reorder_it == it) continue;
2226 it->item->w = itb->w;
2227 it->item->scrl_x = itb->x + it->x - it->wd->pan_x + ox;
2228 it->item->scrl_y = itb->y + it->y - it->wd->pan_y + oy;
2230 vis = (ELM_RECTS_INTERSECT(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h,
2231 cvx, cvy, cvw, cvh));
2234 if ((itb->realized) && (!it->realized))
2236 if (vis) _item_realize(it, in, EINA_FALSE);
2242 if (it->wd->reorder_mode)
2243 y += _get_space_for_reorder_item(it);
2244 git = it->item->group_item;
2247 if (git->item->scrl_y < oy)
2248 git->item->scrl_y = oy;
2249 if ((git->item->scrl_y + git->item->h) > (it->item->scrl_y + it->item->h))
2250 git->item->scrl_y = (it->item->scrl_y + it->item->h) - git->item->h;
2251 git->item->want_realize = EINA_TRUE;
2253 if ((it->wd->reorder_it) && (it->item->old_scrl_y != it->item->scrl_y))
2255 if (!it->item->move_effect_enabled)
2257 it->item->move_effect_enabled = EINA_TRUE;
2258 it->wd->reorder_move_animator =
2260 _reorder_move_animator_cb, it);
2263 if (!it->item->move_effect_enabled)
2265 if (it->item->mode_view)
2266 _item_position(it, it->item->mode_view, it->item->scrl_x,
2269 _item_position(it, VIEW(it), it->item->scrl_x,
2271 it->item->old_scrl_y = it->item->scrl_y;
2276 if (!it->dragging) elm_gen_item_unrealize(it, EINA_FALSE);
2283 if (vis) it->item->want_realize = EINA_TRUE;
2287 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2288 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2292 _group_items_recalc(void *data)
2294 Widget_Data *wd = data;
2298 evas_event_freeze(evas_object_evas_get(wd->obj));
2299 EINA_LIST_FOREACH(wd->group_items, l, git)
2301 if (git->item->want_realize)
2304 _item_realize(git, 0, EINA_FALSE);
2305 evas_object_resize(VIEW(git), wd->minw, git->item->h);
2306 evas_object_move(VIEW(git), git->item->scrl_x, git->item->scrl_y);
2307 evas_object_show(VIEW(git));
2308 evas_object_raise(VIEW(git));
2310 else if (!git->item->want_realize && git->realized)
2313 elm_gen_item_unrealize(git, EINA_FALSE);
2316 evas_event_thaw(evas_object_evas_get(wd->obj));
2317 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2321 _must_recalc_idler(void *data)
2323 Widget_Data *wd = data;
2324 if (wd->calc_job) ecore_job_del(wd->calc_job);
2325 wd->calc_job = ecore_job_add(_calc_job, wd);
2326 wd->must_recalc_idler = NULL;
2327 return ECORE_CALLBACK_CANCEL;
2331 _calc_job(void *data)
2333 Widget_Data *wd = data;
2334 Item_Block *itb, *chb = NULL;
2335 Evas_Coord minw = -1, minh = 0, y = 0, ow;
2337 Eina_Bool minw_change = EINA_FALSE;
2338 Eina_Bool did_must_recalc = EINA_FALSE;
2341 evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h);
2345 evas_event_freeze(evas_object_evas_get(wd->obj));
2346 EINA_INLIST_FOREACH(wd->blocks, itb)
2348 Eina_Bool showme = EINA_FALSE;
2351 showme = itb->showme;
2352 itb->showme = EINA_FALSE;
2355 if (itb->realized) _item_block_unrealize(itb);
2357 if ((itb->changed) || ((itb->must_recalc) && (!did_must_recalc)))
2359 if (itb->must_recalc)
2363 EINA_LIST_FOREACH(itb->items, l, it)
2364 if (it->item->mincalcd) it->item->mincalcd = EINA_FALSE;
2365 itb->changed = EINA_TRUE;
2366 if (itb->must_recalc) did_must_recalc = EINA_TRUE;
2367 itb->must_recalc = EINA_FALSE;
2369 if (itb->realized) _item_block_unrealize(itb);
2370 showme = _item_block_recalc(itb, in, EINA_FALSE);
2376 if (minw == -1) minw = itb->minw;
2377 else if ((!itb->must_recalc) && (minw < itb->minw))
2380 minw_change = EINA_TRUE;
2386 if ((showme) && (wd->show_item) && (!wd->show_item->item->queued))
2388 wd->show_item->item->showme = EINA_FALSE;
2390 elm_smart_scroller_region_bring_in(wd->scr,
2392 wd->show_item->item->block->x,
2394 wd->show_item->item->block->y,
2395 wd->show_item->item->block->w,
2396 wd->show_item->item->h);
2398 elm_smart_scroller_child_region_show(wd->scr,
2400 wd->show_item->item->block->x,
2402 wd->show_item->item->block->y,
2403 wd->show_item->item->block->w,
2404 wd->show_item->item->h);
2405 wd->show_item = NULL;
2410 EINA_INLIST_FOREACH(wd->blocks, itb)
2416 if ((chb) && (EINA_INLIST_GET(chb)->next))
2418 EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb)
2420 if (itb->realized) _item_block_unrealize(itb);
2423 wd->realminw = minw;
2424 if (minw < wd->w) minw = wd->w;
2425 if ((minw != wd->minw) || (minh != wd->minh))
2429 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
2430 _sizing_eval(wd->obj);
2431 if ((wd->anchor_item) && (wd->anchor_item->item->block) && (!wd->auto_scroll_enabled))
2436 it = wd->anchor_item;
2437 it_y = wd->anchor_y;
2438 elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x,
2439 it->item->block->y + it->y + it_y);
2440 wd->anchor_item = it;
2441 wd->anchor_y = it_y;
2444 if (did_must_recalc)
2446 if (!wd->must_recalc_idler)
2447 wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd);
2449 wd->calc_job = NULL;
2450 evas_object_smart_changed(wd->pan_smart);
2451 evas_event_thaw(evas_object_evas_get(wd->obj));
2452 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2456 _update_job(void *data)
2458 Widget_Data *wd = data;
2462 Eina_Bool position = EINA_FALSE, recalc = EINA_FALSE;
2464 wd->update_job = NULL;
2467 evas_event_freeze(evas_object_evas_get(wd->obj));
2468 EINA_INLIST_FOREACH(wd->blocks, itb)
2470 Evas_Coord itminw, itminh;
2477 _item_block_position(itb, num);
2481 recalc = EINA_FALSE;
2482 EINA_LIST_FOREACH(itb->items, l2, it)
2484 if (it->item->updateme)
2486 itminw = it->item->minw;
2487 itminh = it->item->minh;
2489 it->item->updateme = EINA_FALSE;
2492 elm_gen_item_unrealize(it, EINA_FALSE);
2493 _item_realize(it, num, EINA_FALSE);
2494 position = EINA_TRUE;
2498 _item_realize(it, num, EINA_TRUE);
2499 elm_gen_item_unrealize(it, EINA_TRUE);
2501 if ((it->item->minw != itminw) || (it->item->minh != itminh))
2506 itb->updateme = EINA_FALSE;
2509 position = EINA_TRUE;
2510 itb->changed = EINA_TRUE;
2511 _item_block_recalc(itb, num0, EINA_FALSE);
2512 _item_block_position(itb, num0);
2517 if (wd->calc_job) ecore_job_del(wd->calc_job);
2518 wd->calc_job = ecore_job_add(_calc_job, wd);
2520 evas_event_thaw(evas_object_evas_get(wd->obj));
2521 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2525 _pan_set(Evas_Object *obj,
2529 Pan *sd = evas_object_smart_data_get(obj);
2533 // Evas_Coord ow, oh;
2534 // evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2535 // ow = sd->wd->minw - ow;
2536 // if (ow < 0) ow = 0;
2537 // oh = sd->wd->minh - oh;
2538 // if (oh < 0) oh = 0;
2539 // if (x < 0) x = 0;
2540 // if (y < 0) y = 0;
2541 // if (x > ow) x = ow;
2542 // if (y > oh) y = oh;
2543 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
2547 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2549 if ((itb->y + itb->h) > y)
2554 EINA_LIST_FOREACH(itb->items, l2, it)
2556 if ((itb->y + it->y) >= y)
2558 sd->wd->anchor_item = it;
2559 sd->wd->anchor_y = -(itb->y + it->y - y);
2566 if (!sd->wd->reorder_move_animator) evas_object_smart_changed(obj);
2570 _pan_get(Evas_Object *obj,
2574 Pan *sd = evas_object_smart_data_get(obj);
2577 if (x) *x = sd->wd->pan_x;
2578 if (y) *y = sd->wd->pan_y;
2582 _pan_max_get(Evas_Object *obj,
2586 Pan *sd = evas_object_smart_data_get(obj);
2590 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2591 ow = sd->wd->minw - ow;
2593 oh = sd->wd->minh - oh;
2600 _pan_min_get(Evas_Object *obj __UNUSED__,
2609 _pan_child_size_get(Evas_Object *obj,
2613 Pan *sd = evas_object_smart_data_get(obj);
2616 if (w) *w = sd->wd->minw;
2617 if (h) *h = sd->wd->minh;
2621 _pan_add(Evas_Object *obj)
2624 Evas_Object_Smart_Clipped_Data *cd;
2627 cd = evas_object_smart_data_get(obj);
2630 sd->__clipped_data = *cd;
2632 evas_object_smart_data_set(obj, sd);
2636 _pan_del(Evas_Object *obj)
2638 Pan *sd = evas_object_smart_data_get(obj);
2643 ecore_job_del(sd->resize_job);
2644 sd->resize_job = NULL;
2650 _pan_resize_job(void *data)
2654 _sizing_eval(sd->wd->obj);
2655 sd->resize_job = NULL;
2659 _pan_resize(Evas_Object *obj,
2663 Pan *sd = evas_object_smart_data_get(obj);
2667 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2668 if ((ow == w) && (oh == h)) return;
2669 if ((sd->wd->height_for_width) && (ow != w))
2672 if (sd->resize_job) ecore_job_del(sd->resize_job);
2673 sd->resize_job = ecore_job_add(_pan_resize_job, sd);
2675 sd->wd->pan_resized = EINA_TRUE;
2676 evas_object_smart_changed(obj);
2677 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2678 sd->wd->calc_job = NULL;
2680 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2681 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2686 _pan_calculate(Evas_Object *obj)
2688 Pan *sd = evas_object_smart_data_get(obj);
2690 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2696 evas_event_freeze(evas_object_evas_get(obj));
2698 if (sd->wd->pan_resized)
2701 sd->wd->pan_resized = EINA_FALSE;
2704 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
2705 evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
2706 EINA_LIST_FOREACH(sd->wd->group_items, l, git)
2708 git->item->want_realize = EINA_FALSE;
2710 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2712 itb->w = sd->wd->minw;
2713 if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox,
2714 itb->y - sd->wd->pan_y + oy,
2716 cvx, cvy, cvw, cvh))
2718 if ((!itb->realized) || (itb->changed))
2719 _item_block_realize(itb);
2720 _item_block_position(itb, in);
2724 if (itb->realized) _item_block_unrealize(itb);
2728 if ((!sd->wd->reorder_it) || (sd->wd->reorder_pan_move))
2729 _group_items_recalc(sd->wd);
2730 if ((sd->wd->reorder_mode) && (sd->wd->reorder_it))
2732 if (sd->wd->pan_y != sd->wd->reorder_old_pan_y)
2733 sd->wd->reorder_pan_move = EINA_TRUE;
2734 else sd->wd->reorder_pan_move = EINA_FALSE;
2735 evas_object_raise(sd->wd->VIEW(reorder_it));
2736 sd->wd->reorder_old_pan_y = sd->wd->pan_y;
2737 sd->wd->start_time = ecore_loop_time_get();
2739 _item_auto_scroll(sd->wd);
2740 evas_event_thaw(evas_object_evas_get(obj));
2741 evas_event_thaw_eval(evas_object_evas_get(obj));
2745 _pan_move(Evas_Object *obj,
2746 Evas_Coord x __UNUSED__,
2747 Evas_Coord y __UNUSED__)
2749 Pan *sd = evas_object_smart_data_get(obj);
2752 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2753 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2757 _hold_on(void *data __UNUSED__,
2759 void *event_info __UNUSED__)
2761 Widget_Data *wd = elm_widget_data_get(obj);
2763 elm_smart_scroller_hold_set(wd->scr, 1);
2767 _hold_off(void *data __UNUSED__,
2769 void *event_info __UNUSED__)
2771 Widget_Data *wd = elm_widget_data_get(obj);
2773 elm_smart_scroller_hold_set(wd->scr, 0);
2777 _freeze_on(void *data __UNUSED__,
2779 void *event_info __UNUSED__)
2781 Widget_Data *wd = elm_widget_data_get(obj);
2783 elm_smart_scroller_freeze_set(wd->scr, 1);
2787 _freeze_off(void *data __UNUSED__,
2789 void *event_info __UNUSED__)
2791 Widget_Data *wd = elm_widget_data_get(obj);
2793 elm_smart_scroller_freeze_set(wd->scr, 0);
2797 _scr_anim_start(void *data,
2798 Evas_Object *obj __UNUSED__,
2799 void *event_info __UNUSED__)
2801 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL);
2805 _scr_anim_stop(void *data,
2806 Evas_Object *obj __UNUSED__,
2807 void *event_info __UNUSED__)
2809 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL);
2813 _scr_drag_start(void *data,
2814 Evas_Object *obj __UNUSED__,
2815 void *event_info __UNUSED__)
2817 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
2821 _scr_drag_stop(void *data,
2822 Evas_Object *obj __UNUSED__,
2823 void *event_info __UNUSED__)
2825 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
2829 _edge_left(void *data,
2830 Evas_Object *scr __UNUSED__,
2831 void *event_info __UNUSED__)
2833 Evas_Object *obj = data;
2834 evas_object_smart_callback_call(obj, SIG_EDGE_LEFT, NULL);
2838 _edge_right(void *data,
2839 Evas_Object *scr __UNUSED__,
2840 void *event_info __UNUSED__)
2842 Evas_Object *obj = data;
2843 evas_object_smart_callback_call(obj, SIG_EDGE_RIGHT, NULL);
2847 _edge_top(void *data,
2848 Evas_Object *scr __UNUSED__,
2849 void *event_info __UNUSED__)
2851 Evas_Object *obj = data;
2852 evas_object_smart_callback_call(obj, SIG_EDGE_TOP, NULL);
2856 _edge_bottom(void *data,
2857 Evas_Object *scr __UNUSED__,
2858 void *event_info __UNUSED__)
2860 Evas_Object *obj = data;
2861 evas_object_smart_callback_call(obj, SIG_EDGE_BOTTOM, NULL);
2865 _mode_item_realize(Elm_Gen_Item *it)
2869 if ((it->item->mode_view) || (it->delete_me)) return;
2871 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2872 it->item->mode_view = edje_object_add(evas_object_evas_get(WIDGET(it)));
2873 edje_object_scale_set(it->item->mode_view,
2874 elm_widget_scale_get(WIDGET(it)) *
2875 _elm_config->scale);
2876 evas_object_smart_member_add(it->item->mode_view, it->wd->pan_smart);
2877 elm_widget_sub_object_add(WIDGET(it), it->item->mode_view);
2879 strncpy(buf, "item", sizeof(buf));
2880 if (it->wd->compress)
2881 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
2883 if (it->item->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
2884 strncat(buf, "/", sizeof(buf) - strlen(buf));
2885 strncat(buf, it->wd->mode_item_style, sizeof(buf) - strlen(buf));
2887 _elm_theme_object_set(WIDGET(it), it->item->mode_view, "genlist", buf,
2888 elm_widget_style_get(WIDGET(it)));
2889 edje_object_mirrored_set(it->item->mode_view,
2890 elm_widget_mirrored_get(WIDGET(it)));
2892 /* signal callback add */
2893 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_DOWN,
2895 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_UP,
2897 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_MOVE,
2900 /* label_get, content_get, state_get */
2901 /* FIXME: If you see that assert, please notify us and we
2902 will clean our mess */
2903 assert(eina_list_count(it->item->mode_content_objs) == 0);
2905 _item_label_realize(it, it->item->mode_view, &it->item->mode_labels, NULL);
2906 it->item->mode_content_objs =
2907 _item_content_realize(it, it->item->mode_view,
2908 &it->item->mode_contents, NULL);
2909 _item_state_realize(it, it->item->mode_view, &it->item->mode_states, NULL);
2911 edje_object_part_swallow(it->item->mode_view,
2912 edje_object_data_get(it->item->mode_view, "mode_part"),
2915 it->want_unrealize = EINA_FALSE;
2916 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2917 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2921 _mode_item_unrealize(Elm_Gen_Item *it)
2923 Widget_Data *wd = it->wd;
2924 Evas_Object *content;
2925 if (!it->item->mode_view) return;
2927 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2928 elm_widget_stringlist_free(it->item->mode_labels);
2929 it->item->mode_labels = NULL;
2930 elm_widget_stringlist_free(it->item->mode_contents);
2931 it->item->mode_contents = NULL;
2932 elm_widget_stringlist_free(it->item->mode_states);
2934 EINA_LIST_FREE(it->item->mode_content_objs, content)
2935 evas_object_del(content);
2937 edje_object_part_unswallow(it->item->mode_view, VIEW(it));
2938 evas_object_smart_member_add(VIEW(it), wd->pan_smart);
2939 evas_object_del(it->item->mode_view);
2940 it->item->mode_view = NULL;
2942 if (wd->mode_item == it)
2943 wd->mode_item = NULL;
2944 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2945 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2949 _item_mode_set(Elm_Gen_Item *it)
2952 Widget_Data *wd = it->wd;
2957 it->item->nocache = EINA_TRUE;
2959 if (wd->scr_hold_timer)
2961 ecore_timer_del(wd->scr_hold_timer);
2962 wd->scr_hold_timer = NULL;
2964 elm_smart_scroller_hold_set(wd->scr, EINA_TRUE);
2965 wd->scr_hold_timer = ecore_timer_add(0.1, _scr_hold_timer_cb, wd);
2967 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2968 _mode_item_realize(it);
2969 if (it->item->group_item)
2970 evas_object_raise(it->item->VIEW(group_item));
2971 _item_position(it, it->item->mode_view, it->item->scrl_x, it->item->scrl_y);
2972 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2973 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2975 snprintf(buf, sizeof(buf), "elm,state,%s,active", wd->mode_type);
2976 edje_object_signal_emit(it->item->mode_view, buf, "elm");
2980 _item_mode_unset(Widget_Data *wd)
2983 if (!wd->mode_item) return;
2984 char buf[1024], buf2[1024];
2988 it->item->nocache = EINA_TRUE;
2990 snprintf(buf, sizeof(buf), "elm,state,%s,passive", wd->mode_type);
2991 snprintf(buf2, sizeof(buf2), "elm,state,%s,passive,finished", wd->mode_type);
2993 edje_object_signal_emit(it->item->mode_view, buf, "elm");
2994 edje_object_signal_callback_add(it->item->mode_view, buf2, "elm", _mode_finished_signal_cb, it);
2996 wd->mode_item = NULL;
3000 _item_auto_scroll(Widget_Data *wd)
3005 Evas_Coord ox, oy, ow, oh;
3007 if ((wd->expanded_item) && (wd->auto_scroll_enabled))
3009 evas_object_geometry_get(wd->obj, &ox, &oy, &ow, &oh);
3010 if (wd->expanded_item->item->scrl_y > (oh + oy) / 2)
3012 EINA_LIST_FOREACH(wd->expanded_item->item->items, l, it)
3013 elm_genlist_item_bring_in(it);
3015 wd->auto_scroll_enabled = EINA_FALSE;
3020 elm_genlist_add(Evas_Object *parent)
3025 Evas_Coord minw, minh;
3026 static Evas_Smart *smart = NULL;
3030 static Evas_Smart_Class sc;
3032 evas_object_smart_clipped_smart_set(&_pan_sc);
3034 sc.name = "elm_genlist_pan";
3035 sc.version = EVAS_SMART_CLASS_VERSION;
3038 sc.resize = _pan_resize;
3039 sc.move = _pan_move;
3040 sc.calculate = _pan_calculate;
3041 if (!(smart = evas_smart_class_new(&sc))) return NULL;
3044 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
3046 ELM_SET_WIDTYPE(widtype, "genlist");
3048 elm_widget_type_set(obj, "genlist");
3049 elm_widget_sub_object_add(parent, obj);
3050 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
3051 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
3052 elm_widget_data_set(obj, wd);
3053 elm_widget_del_hook_set(obj, _del_hook);
3054 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
3055 elm_widget_theme_hook_set(obj, _theme_hook);
3056 elm_widget_can_focus_set(obj, EINA_TRUE);
3057 elm_widget_event_hook_set(obj, _event_hook);
3058 elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
3059 elm_widget_translate_hook_set(obj, _translate_hook);
3061 wd->scr = elm_smart_scroller_add(e);
3062 elm_smart_scroller_widget_set(wd->scr, obj);
3063 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
3064 elm_widget_style_get(obj));
3065 elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE,
3066 _elm_config->thumbscroll_bounce_enable);
3067 elm_widget_resize_object_set(obj, wd->scr);
3069 evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj);
3070 evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, obj);
3071 evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj);
3072 evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj);
3073 evas_object_smart_callback_add(wd->scr, "edge,left", _edge_left, obj);
3074 evas_object_smart_callback_add(wd->scr, "edge,right", _edge_right, obj);
3075 evas_object_smart_callback_add(wd->scr, "edge,top", _edge_top, obj);
3076 evas_object_smart_callback_add(wd->scr, "edge,bottom", _edge_bottom, obj);
3079 wd->mode = ELM_LIST_SCROLL;
3080 wd->max_items_per_block = MAX_ITEMS_PER_BLOCK;
3081 wd->item_cache_max = wd->max_items_per_block * 2;
3082 wd->longpress_timeout = _elm_config->longpress_timeout;
3084 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
3085 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
3086 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
3087 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
3089 wd->pan_smart = evas_object_smart_add(e, smart);
3090 wd->pan = evas_object_smart_data_get(wd->pan_smart);
3093 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
3094 _pan_set, _pan_get, _pan_max_get,
3095 _pan_min_get, _pan_child_size_get);
3097 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
3099 evas_object_size_hint_min_set(obj, minw, minh);
3101 evas_object_smart_callbacks_descriptions_set(obj, _signals);
3103 _mirrored_set(obj, elm_widget_mirrored_get(obj));
3108 static Elm_Gen_Item *
3109 _item_new(Widget_Data *wd,
3110 const Elm_Genlist_Item_Class *itc,
3112 Elm_Gen_Item *parent,
3113 Elm_Genlist_Item_Flags flags,
3115 const void *func_data)
3119 it = elm_gen_item_new(wd, itc, data, parent, func, func_data);
3120 if (!it) return NULL;
3121 it->item = ELM_NEW(Elm_Gen_Item_Type);
3122 it->item->flags = flags;
3123 if (flags & ELM_GENLIST_ITEM_GROUP) it->group++;
3124 it->item->expanded_depth = 0;
3125 elm_widget_item_del_cb_set(it, _item_del_hook);
3126 ELM_GEN_ITEM_SETUP(it);
3129 if (it->parent->group)
3130 it->item->group_item = parent;
3131 else if (it->parent->item->group_item)
3132 it->item->group_item = it->parent->item->group_item;
3138 _item_block_add(Widget_Data *wd,
3141 Item_Block *itb = NULL;
3148 itb = calloc(1, sizeof(Item_Block));
3151 if (!it->item->rel->item->block)
3154 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3155 itb->items = eina_list_append(itb->items, it);
3159 if (it->item->before)
3161 wd->blocks = eina_inlist_prepend_relative
3162 (wd->blocks, EINA_INLIST_GET(itb),
3163 EINA_INLIST_GET(it->item->rel->item->block));
3165 eina_list_prepend_relative(itb->items, it, it->item->rel);
3169 wd->blocks = eina_inlist_append_relative
3170 (wd->blocks, EINA_INLIST_GET(itb),
3171 EINA_INLIST_GET(it->item->rel->item->block));
3173 eina_list_append_relative(itb->items, it, it->item->rel);
3179 if (it->item->before)
3183 itb = (Item_Block *)(wd->blocks);
3184 if (itb->count >= wd->max_items_per_block)
3186 itb = calloc(1, sizeof(Item_Block));
3190 eina_inlist_prepend(wd->blocks,
3191 EINA_INLIST_GET(itb));
3196 itb = calloc(1, sizeof(Item_Block));
3200 eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
3202 itb->items = eina_list_prepend(itb->items, it);
3208 itb = (Item_Block *)(wd->blocks->last);
3209 if (itb->count >= wd->max_items_per_block)
3211 itb = calloc(1, sizeof(Item_Block));
3215 eina_inlist_append(wd->blocks,
3216 EINA_INLIST_GET(itb));
3221 itb = calloc(1, sizeof(Item_Block));
3225 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3227 itb->items = eina_list_append(itb->items, it);
3233 itb = it->item->rel->item->block;
3234 if (!itb) goto newblock;
3235 if (it->item->before)
3236 itb->items = eina_list_prepend_relative(itb->items, it, it->item->rel);
3238 itb->items = eina_list_append_relative(itb->items, it, it->item->rel);
3241 itb->changed = EINA_TRUE;
3242 it->item->block = itb;
3243 if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job);
3244 itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd);
3247 it->item->rel->relcount--;
3248 if ((it->item->rel->delete_me) && (!it->item->rel->relcount))
3249 _item_del(it->item->rel);
3250 it->item->rel = NULL;
3252 if (itb->count > itb->wd->max_items_per_block)
3258 newc = itb->count / 2;
3259 itb2 = calloc(1, sizeof(Item_Block));
3263 eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
3264 EINA_INLIST_GET(itb));
3265 itb2->changed = EINA_TRUE;
3266 while ((itb->count > newc) && (itb->items))
3270 l = eina_list_last(itb->items);
3272 itb->items = eina_list_remove_list(itb->items, l);
3275 itb2->items = eina_list_prepend(itb2->items, it2);
3276 it2->item->block = itb2;
3283 _queue_process(Widget_Data *wd)
3286 Eina_Bool showme = EINA_FALSE;
3289 t0 = ecore_time_get();
3290 //evas_event_freeze(evas_object_evas_get(wd->obj));
3291 for (n = 0; (wd->queue) && (n < 128); n++)
3295 it = wd->queue->data;
3296 wd->queue = eina_list_remove_list(wd->queue, wd->queue);
3297 it->item->queued = EINA_FALSE;
3298 _item_block_add(wd, it);
3300 _item_block_realize(it->item->block);
3301 t = ecore_time_get();
3302 if (it->item->block->changed)
3304 showme = _item_block_recalc(it->item->block, it->item->block->num, EINA_TRUE);
3305 it->item->block->changed = 0;
3307 if (showme) it->item->block->showme = EINA_TRUE;
3308 if (eina_inlist_count(wd->blocks) > 1)
3310 if ((t - t0) > (ecore_animator_frametime_get())) break;
3313 //evas_event_thaw(evas_object_evas_get(wd->obj));
3314 //evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3319 _idle_process(void *data, Eina_Bool *wakeup)
3321 Widget_Data *wd = data;
3324 //static double q_start = 0.0;
3325 //if (q_start == 0.0) q_start = ecore_time_get();
3327 if (_queue_process(wd) > 0) *wakeup = EINA_TRUE;
3331 //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start);
3333 return ECORE_CALLBACK_CANCEL;
3335 return ECORE_CALLBACK_RENEW;
3339 _item_idle_enterer(void *data)
3341 Widget_Data *wd = data;
3342 Eina_Bool wakeup = EINA_FALSE;
3343 Eina_Bool ok = _idle_process(data, &wakeup);
3348 if (wd->calc_job) ecore_job_del(wd->calc_job);
3349 wd->calc_job = ecore_job_add(_calc_job, wd);
3351 if (ok == ECORE_CALLBACK_CANCEL) wd->queue_idle_enterer = NULL;
3356 _item_queue(Widget_Data *wd,
3359 if (it->item->queued) return;
3360 it->item->queued = EINA_TRUE;
3361 wd->queue = eina_list_append(wd->queue, it);
3362 // FIXME: why does a freeze then thaw here cause some genlist
3363 // elm_genlist_item_append() to be much much slower?
3364 // evas_event_freeze(evas_object_evas_get(wd->obj));
3365 while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
3367 if (wd->queue_idle_enterer)
3369 ecore_idle_enterer_del(wd->queue_idle_enterer);
3370 wd->queue_idle_enterer = NULL;
3374 // evas_event_thaw(evas_object_evas_get(wd->obj));
3375 // evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3376 if (!wd->queue_idle_enterer)
3377 wd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, wd);
3381 _elm_genlist_item_compare_data(const void *data, const void *data1)
3383 const Elm_Gen_Item *it = data;
3384 const Elm_Gen_Item *item1 = data1;
3386 return _elm_genlist_item_compare_data_cb(it->base.data, item1->base.data);
3390 _elm_genlist_item_compare(const void *data, const void *data1)
3392 const Elm_Gen_Item *it, *item1;
3393 it = ELM_GEN_ITEM_FROM_INLIST(data);
3394 item1 = ELM_GEN_ITEM_FROM_INLIST(data1);
3395 return _elm_genlist_item_compare_cb(it, item1);
3399 _elm_genlist_item_list_compare(const void *data, const void *data1)
3401 const Elm_Gen_Item *it = data;
3402 const Elm_Gen_Item *item1 = data1;
3403 return _elm_genlist_item_compare_cb(it, item1);
3407 _item_move_after(Elm_Gen_Item *it, Elm_Gen_Item *after)
3412 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3413 _item_block_del(it);
3415 it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
3416 it->item->rel = after;
3417 it->item->rel->relcount++;
3418 it->item->before = EINA_FALSE;
3419 if (after->item->group_item) it->item->group_item = after->item->group_item;
3420 _item_queue(it->wd, it);
3422 evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it);
3426 _item_move_before(Elm_Gen_Item *it, Elm_Gen_Item *before)
3429 if (!before) return;
3431 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3432 _item_block_del(it);
3433 it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
3434 it->item->rel = before;
3435 it->item->rel->relcount++;
3436 it->item->before = EINA_TRUE;
3437 if (before->item->group_item) it->item->group_item = before->item->group_item;
3438 _item_queue(it->wd, it);
3440 evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it);
3444 elm_genlist_item_append(Evas_Object *obj,
3445 const Elm_Genlist_Item_Class *itc,
3447 Elm_Gen_Item *parent,
3448 Elm_Genlist_Item_Flags flags,
3450 const void *func_data)
3452 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3453 Widget_Data *wd = elm_widget_data_get(obj);
3454 if (!wd) return NULL;
3455 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3457 if (!it) return NULL;
3461 wd->group_items = eina_list_append(wd->group_items, it);
3462 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
3463 it->item->rel = NULL;
3467 Elm_Gen_Item *it2 = NULL;
3468 Eina_List *ll = eina_list_last(it->parent->item->items);
3469 if (ll) it2 = ll->data;
3470 it->parent->item->items = eina_list_append(it->parent->item->items, it);
3471 if (!it2) it2 = it->parent;
3473 eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3474 EINA_INLIST_GET(it2));
3475 it->item->rel = it2;
3476 it->item->rel->relcount++;
3478 it->item->before = EINA_FALSE;
3479 _item_queue(wd, it);
3484 elm_genlist_item_prepend(Evas_Object *obj,
3485 const Elm_Genlist_Item_Class *itc,
3487 Elm_Gen_Item *parent,
3488 Elm_Genlist_Item_Flags flags,
3490 const void *func_data)
3492 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3493 Widget_Data *wd = elm_widget_data_get(obj);
3494 if (!wd) return NULL;
3495 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3497 if (!it) return NULL;
3501 wd->group_items = eina_list_prepend(wd->group_items, it);
3502 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
3503 it->item->rel = NULL;
3507 Elm_Gen_Item *it2 = NULL;
3508 Eina_List *ll = it->parent->item->items;
3509 if (ll) it2 = ll->data;
3510 it->parent->item->items = eina_list_prepend(it->parent->item->items, it);
3511 if (!it2) it2 = it->parent;
3513 eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3514 EINA_INLIST_GET(it2));
3515 it->item->rel = it2;
3516 it->item->rel->relcount++;
3518 it->item->before = EINA_TRUE;
3519 _item_queue(wd, it);
3524 elm_genlist_item_insert_after(Evas_Object *obj,
3525 const Elm_Genlist_Item_Class *itc,
3527 Elm_Gen_Item *parent,
3528 Elm_Gen_Item *after,
3529 Elm_Genlist_Item_Flags flags,
3531 const void *func_data)
3533 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3534 EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
3535 Widget_Data *wd = elm_widget_data_get(obj);
3536 if (!wd) return NULL;
3537 /* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */
3538 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3540 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3542 if (!it) return NULL;
3547 wd->group_items = eina_list_append_relative(wd->group_items, it,
3552 it->parent->item->items = eina_list_append_relative(it->parent->item->items, it,
3555 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3556 EINA_INLIST_GET(after));
3557 it->item->rel = after;
3558 it->item->rel->relcount++;
3559 it->item->before = EINA_FALSE;
3560 _item_queue(wd, it);
3565 elm_genlist_item_insert_before(Evas_Object *obj,
3566 const Elm_Genlist_Item_Class *itc,
3568 Elm_Gen_Item *parent,
3569 Elm_Gen_Item *before,
3570 Elm_Genlist_Item_Flags flags,
3572 const void *func_data)
3574 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3575 EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
3576 Widget_Data *wd = elm_widget_data_get(obj);
3577 if (!wd) return NULL;
3578 /* It makes no sense to insert before in an empty list with before != NULL, something really bad is happening in your app. */
3579 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3581 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3583 if (!it) return NULL;
3586 if (it->group && before->group)
3587 wd->group_items = eina_list_prepend_relative(wd->group_items, it,
3592 it->parent->item->items = eina_list_prepend_relative(it->parent->item->items, it,
3595 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3596 EINA_INLIST_GET(before));
3597 it->item->rel = before;
3598 it->item->rel->relcount++;
3599 it->item->before = EINA_TRUE;
3600 _item_queue(wd, it);
3605 elm_genlist_item_direct_sorted_insert(Evas_Object *obj,
3606 const Elm_Genlist_Item_Class *itc,
3608 Elm_Gen_Item *parent,
3609 Elm_Genlist_Item_Flags flags,
3610 Eina_Compare_Cb comp,
3612 const void *func_data)
3614 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3615 Widget_Data *wd = elm_widget_data_get(obj);
3616 if (!wd) return NULL;
3617 Elm_Gen_Item *rel = NULL;
3618 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3620 if (!it) return NULL;
3622 _elm_genlist_item_compare_cb = comp;
3629 l = eina_list_search_sorted_near_list(it->parent->item->items,
3630 _elm_genlist_item_list_compare, it,
3633 rel = eina_list_data_get(l);
3637 if (cmp_result >= 0)
3639 it->parent->item->items = eina_list_prepend_relative_list(it->parent->item->items, it, l);
3640 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
3641 it->item->before = EINA_FALSE;
3643 else if (cmp_result < 0)
3645 it->parent->item->items = eina_list_append_relative_list(it->parent->item->items, it, l);
3646 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
3647 it->item->before = EINA_TRUE;
3654 wd->state = eina_inlist_sorted_state_new();
3655 eina_inlist_sorted_state_init(wd->state, wd->items);
3659 wd->group_items = eina_list_append(wd->group_items, it);
3661 wd->items = eina_inlist_sorted_state_insert(wd->items, EINA_INLIST_GET(it),
3662 _elm_genlist_item_compare, wd->state);
3664 if (EINA_INLIST_GET(it)->next)
3666 rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3667 it->item->before = EINA_TRUE;
3669 else if (EINA_INLIST_GET(it)->prev)
3671 rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3672 it->item->before = EINA_FALSE;
3678 it->item->rel = rel;
3679 it->item->rel->relcount++;
3682 _item_queue(wd, it);
3688 elm_genlist_item_sorted_insert(Evas_Object *obj,
3689 const Elm_Genlist_Item_Class *itc,
3691 Elm_Gen_Item *parent,
3692 Elm_Genlist_Item_Flags flags,
3693 Eina_Compare_Cb comp,
3695 const void *func_data)
3697 _elm_genlist_item_compare_data_cb = comp;
3699 return elm_genlist_item_direct_sorted_insert(obj, itc, data, parent, flags,
3700 _elm_genlist_item_compare_data, func, func_data);
3704 elm_genlist_clear(Evas_Object *obj)
3710 elm_genlist_multi_select_set(Evas_Object *obj,
3713 ELM_CHECK_WIDTYPE(obj, widtype);
3714 Widget_Data *wd = elm_widget_data_get(obj);
3720 elm_genlist_multi_select_get(const Evas_Object *obj)
3722 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3723 Widget_Data *wd = elm_widget_data_get(obj);
3724 if (!wd) return EINA_FALSE;
3729 elm_genlist_selected_item_get(const Evas_Object *obj)
3731 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3732 Widget_Data *wd = elm_widget_data_get(obj);
3733 if (!wd) return NULL;
3734 if (wd->selected) return wd->selected->data;
3738 EAPI const Eina_List *
3739 elm_genlist_selected_items_get(const Evas_Object *obj)
3741 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3742 Widget_Data *wd = elm_widget_data_get(obj);
3743 if (!wd) return NULL;
3744 return wd->selected;
3748 elm_genlist_realized_items_get(const Evas_Object *obj)
3750 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3751 Widget_Data *wd = elm_widget_data_get(obj);
3752 Eina_List *list = NULL;
3754 Eina_Bool done = EINA_FALSE;
3755 if (!wd) return NULL;
3756 EINA_INLIST_FOREACH(wd->blocks, itb)
3764 EINA_LIST_FOREACH(itb->items, l, it)
3766 if (it->realized) list = eina_list_append(list, it);
3778 elm_genlist_at_xy_item_get(const Evas_Object *obj,
3783 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3784 Widget_Data *wd = elm_widget_data_get(obj);
3785 Evas_Coord ox, oy, ow, oh;
3788 if (!wd) return NULL;
3789 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
3791 EINA_INLIST_FOREACH(wd->blocks, itb)
3796 if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
3797 oy + itb->y - itb->wd->pan_y,
3798 itb->w, itb->h, x, y, 1, 1))
3800 EINA_LIST_FOREACH(itb->items, l, it)
3802 Evas_Coord itx, ity;
3804 itx = ox + itb->x + it->x - itb->wd->pan_x;
3805 ity = oy + itb->y + it->y - itb->wd->pan_y;
3806 if (ELM_RECTS_INTERSECT(itx, ity, it->item->w, it->item->h, x, y, 1, 1))
3810 if (y <= (ity + (it->item->h / 4))) *posret = -1;
3811 else if (y >= (ity + it->item->h - (it->item->h / 4)))
3817 lasty = ity + it->item->h;
3822 if (y > lasty) *posret = 1;
3829 elm_genlist_first_item_get(const Evas_Object *obj)
3831 return elm_gen_first_item_get(obj);
3835 elm_genlist_last_item_get(const Evas_Object *obj)
3837 return elm_gen_last_item_get(obj);
3841 elm_genlist_item_next_get(const Elm_Gen_Item *it)
3843 return elm_gen_item_next_get(it);
3847 elm_genlist_item_prev_get(const Elm_Gen_Item *it)
3849 return elm_gen_item_prev_get(it);
3853 elm_genlist_item_genlist_get(const Elm_Gen_Item *it)
3855 return elm_gen_item_widget_get(it);
3859 elm_genlist_item_parent_get(const Elm_Gen_Item *it)
3861 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3866 elm_genlist_item_subitems_clear(Elm_Gen_Item *it)
3868 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3869 Eina_List *tl = NULL, *l;
3872 EINA_LIST_FOREACH(it->item->items, l, it2)
3873 tl = eina_list_append(tl, it2);
3874 EINA_LIST_FREE(tl, it2)
3875 elm_genlist_item_del(it2);
3879 elm_genlist_item_selected_set(Elm_Gen_Item *it,
3882 elm_gen_item_selected_set(it, selected);
3886 elm_genlist_item_selected_get(const Elm_Gen_Item *it)
3888 return elm_gen_item_selected_get(it);
3892 elm_genlist_item_expanded_set(Elm_Gen_Item *it,
3895 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3896 if (it->item->expanded == expanded) return;
3897 it->item->expanded = expanded;
3898 it->wd->expanded_item = it;
3899 if (it->item->expanded)
3902 edje_object_signal_emit(VIEW(it), "elm,state,expanded", "elm");
3903 evas_object_smart_callback_call(WIDGET(it), SIG_EXPANDED, it);
3904 it->wd->auto_scroll_enabled = EINA_TRUE;
3909 edje_object_signal_emit(VIEW(it), "elm,state,contracted", "elm");
3910 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACTED, it);
3911 it->wd->auto_scroll_enabled = EINA_FALSE;
3916 elm_genlist_item_expanded_get(const Elm_Gen_Item *it)
3918 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
3919 return it->item->expanded;
3923 elm_genlist_item_expanded_depth_get(const Elm_Gen_Item *it)
3925 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, 0);
3926 return it->item->expanded_depth;
3930 elm_genlist_item_disabled_set(Elm_Gen_Item *it,
3933 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3936 if (it->disabled == disabled) return;
3937 if (it->delete_me) return;
3938 it->disabled = !!disabled;
3940 elm_gen_item_selected_set(it, EINA_FALSE);
3944 edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
3946 edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm");
3947 EINA_LIST_FOREACH(it->content_objs, l, obj)
3948 elm_widget_disabled_set(obj, disabled);
3953 elm_genlist_item_disabled_get(const Elm_Gen_Item *it)
3955 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
3956 if (it->delete_me) return EINA_FALSE;
3957 return it->disabled;
3961 elm_genlist_item_display_only_set(Elm_Gen_Item *it,
3962 Eina_Bool display_only)
3964 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3965 if (it->display_only == display_only) return;
3966 if (it->delete_me) return;
3967 it->display_only = display_only;
3968 it->item->mincalcd = EINA_FALSE;
3969 it->item->updateme = EINA_TRUE;
3970 if (it->item->block) it->item->block->updateme = EINA_TRUE;
3971 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
3972 it->wd->update_job = ecore_job_add(_update_job, it->wd);
3976 elm_genlist_item_display_only_get(const Elm_Gen_Item *it)
3978 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
3979 if (it->delete_me) return EINA_FALSE;
3980 return it->display_only;
3984 elm_genlist_item_show(Elm_Gen_Item *it)
3986 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3987 Evas_Coord gith = 0;
3988 if (it->delete_me) return;
3989 if ((it->item->queued) || (!it->item->mincalcd))
3991 it->wd->show_item = it;
3992 it->wd->bring_in = EINA_TRUE;
3993 it->item->showme = EINA_TRUE;
3996 if (it->wd->show_item)
3998 it->wd->show_item->item->showme = EINA_FALSE;
3999 it->wd->show_item = NULL;
4001 if ((it->item->group_item) && (it->wd->pan_y > (it->y + it->item->block->y)))
4002 gith = it->item->group_item->item->h;
4003 elm_smart_scroller_child_region_show(it->wd->scr,
4004 it->x + it->item->block->x,
4005 it->y + it->item->block->y - gith,
4006 it->item->block->w, it->item->h);
4010 elm_genlist_item_promote(Elm_Gen_Item *it)
4012 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4013 if (it->delete_me) return;
4014 _item_move_before(it, elm_gen_first_item_get(WIDGET(it)));
4018 elm_genlist_item_demote(Elm_Gen_Item *it)
4020 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4021 if (it->delete_me) return;
4022 _item_move_after(it, elm_gen_last_item_get(WIDGET(it)));
4026 elm_genlist_item_bring_in(Elm_Gen_Item *it)
4028 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4029 Evas_Coord gith = 0;
4030 if (it->delete_me) return;
4031 if ((it->item->queued) || (!it->item->mincalcd))
4033 it->wd->show_item = it;
4034 it->wd->bring_in = EINA_TRUE;
4035 it->item->showme = EINA_TRUE;
4038 if (it->wd->show_item)
4040 it->wd->show_item->item->showme = EINA_FALSE;
4041 it->wd->show_item = NULL;
4043 if ((it->item->group_item) && (it->wd->pan_y > (it->y + it->item->block->y)))
4044 gith = it->item->group_item->item->h;
4045 elm_smart_scroller_region_bring_in(it->wd->scr,
4046 it->x + it->item->block->x,
4047 it->y + it->item->block->y - gith,
4048 it->item->block->w, it->item->h);
4052 elm_genlist_item_top_show(Elm_Gen_Item *it)
4054 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4056 Evas_Coord gith = 0;
4058 if (it->delete_me) return;
4059 if ((it->item->queued) || (!it->item->mincalcd))
4061 it->wd->show_item = it;
4062 it->wd->bring_in = EINA_TRUE;
4063 it->item->showme = EINA_TRUE;
4066 if (it->wd->show_item)
4068 it->wd->show_item->item->showme = EINA_FALSE;
4069 it->wd->show_item = NULL;
4071 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4072 if (it->item->group_item) gith = it->item->group_item->item->h;
4073 elm_smart_scroller_child_region_show(it->wd->scr,
4074 it->x + it->item->block->x,
4075 it->y + it->item->block->y - gith,
4076 it->item->block->w, oh);
4080 elm_genlist_item_top_bring_in(Elm_Gen_Item *it)
4082 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4084 Evas_Coord gith = 0;
4086 if (it->delete_me) return;
4087 if ((it->item->queued) || (!it->item->mincalcd))
4089 it->wd->show_item = it;
4090 it->wd->bring_in = EINA_TRUE;
4091 it->item->showme = EINA_TRUE;
4094 if (it->wd->show_item)
4096 it->wd->show_item->item->showme = EINA_FALSE;
4097 it->wd->show_item = NULL;
4099 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4100 if (it->item->group_item) gith = it->item->group_item->item->h;
4101 elm_smart_scroller_region_bring_in(it->wd->scr,
4102 it->x + it->item->block->x,
4103 it->y + it->item->block->y - gith,
4104 it->item->block->w, oh);
4108 elm_genlist_item_middle_show(Elm_Gen_Item *it)
4110 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4113 if (it->delete_me) return;
4114 if ((it->item->queued) || (!it->item->mincalcd))
4116 it->wd->show_item = it;
4117 it->wd->bring_in = EINA_TRUE;
4118 it->item->showme = EINA_TRUE;
4121 if (it->wd->show_item)
4123 it->wd->show_item->item->showme = EINA_FALSE;
4124 it->wd->show_item = NULL;
4126 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4127 elm_smart_scroller_child_region_show(it->wd->scr,
4128 it->x + it->item->block->x,
4129 it->y + it->item->block->y - oh / 2 +
4130 it->item->h / 2, it->item->block->w, oh);
4134 elm_genlist_item_middle_bring_in(Elm_Gen_Item *it)
4136 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4139 if (it->delete_me) return;
4140 if ((it->item->queued) || (!it->item->mincalcd))
4142 it->wd->show_item = it;
4143 it->wd->bring_in = EINA_TRUE;
4144 it->item->showme = EINA_TRUE;
4147 if (it->wd->show_item)
4149 it->wd->show_item->item->showme = EINA_FALSE;
4150 it->wd->show_item = NULL;
4152 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4153 elm_smart_scroller_region_bring_in(it->wd->scr,
4154 it->x + it->item->block->x,
4155 it->y + it->item->block->y - oh / 2 + it->item->h / 2,
4156 it->item->block->w, oh);
4160 elm_genlist_item_del(Elm_Gen_Item *it)
4162 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4163 if ((it->relcount > 0) || (it->walking > 0))
4165 elm_genlist_item_subitems_clear(it);
4166 if (it->wd->show_item == it) it->wd->show_item = NULL;
4167 elm_gen_item_del_notserious(it);
4168 if (it->item->block)
4170 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE);
4171 it->item->block->changed = EINA_TRUE;
4172 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
4173 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
4181 elm_genlist_item_data_set(Elm_Gen_Item *it,
4184 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4185 elm_widget_item_data_set(it, data);
4189 elm_genlist_item_data_get(const Elm_Gen_Item *it)
4191 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4192 return elm_widget_item_data_get(it);
4196 elm_genlist_item_icons_orphan(Elm_Gen_Item *it)
4198 elm_genlist_item_contents_orphan(it);
4202 elm_genlist_item_contents_orphan(Elm_Gen_Item *it)
4204 Evas_Object *content;
4205 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4206 EINA_LIST_FREE(it->content_objs, content)
4208 elm_widget_sub_object_del(WIDGET(it), content);
4209 evas_object_smart_member_del(content);
4210 evas_object_hide(content);
4214 EAPI const Evas_Object *
4215 elm_genlist_item_object_get(const Elm_Gen_Item *it)
4217 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4222 elm_genlist_item_update(Elm_Gen_Item *it)
4224 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4225 if (!it->item->block) return;
4226 if (it->delete_me) return;
4227 it->item->mincalcd = EINA_FALSE;
4228 it->item->updateme = EINA_TRUE;
4229 it->item->block->updateme = EINA_TRUE;
4230 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4231 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4235 elm_genlist_item_fields_update(Elm_Genlist_Item *it,
4237 Elm_Genlist_Item_Field_Flags itf)
4239 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4240 if (!it->item->block) return;
4241 if (it->delete_me) return;
4243 if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_LABEL))
4244 _item_label_realize(it, it->base.view, &it->labels, parts);
4245 if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_CONTENT))
4247 it->content_objs = _item_content_unrealize(it, it->base.view,
4248 &it->contents, parts);
4249 it->content_objs = _item_content_realize(it, it->base.view,
4250 &it->contents, parts);
4252 if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_STATE))
4253 _item_state_realize(it, it->base.view, &it->states, parts);
4257 elm_genlist_item_item_class_update(Elm_Gen_Item *it,
4258 const Elm_Genlist_Item_Class *itc)
4260 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4261 if (!it->item->block) return;
4262 EINA_SAFETY_ON_NULL_RETURN(itc);
4263 if (it->delete_me) return;
4265 it->item->nocache = EINA_TRUE;
4266 elm_genlist_item_update(it);
4269 EAPI const Elm_Genlist_Item_Class *
4270 elm_genlist_item_item_class_get(const Elm_Gen_Item *it)
4272 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4273 if (it->delete_me) return NULL;
4277 static Evas_Object *
4278 _elm_genlist_item_label_create(void *data,
4279 Evas_Object *obj __UNUSED__,
4280 Evas_Object *tooltip,
4281 void *it __UNUSED__)
4283 Evas_Object *label = elm_label_add(tooltip);
4286 elm_object_style_set(label, "tooltip");
4287 elm_object_text_set(label, data);
4292 _elm_genlist_item_label_del_cb(void *data,
4293 Evas_Object *obj __UNUSED__,
4294 void *event_info __UNUSED__)
4296 eina_stringshare_del(data);
4300 elm_genlist_item_tooltip_text_set(Elm_Gen_Item *it,
4303 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4304 text = eina_stringshare_add(text);
4305 elm_genlist_item_tooltip_content_cb_set(it, _elm_genlist_item_label_create,
4307 _elm_genlist_item_label_del_cb);
4311 elm_genlist_item_tooltip_content_cb_set(Elm_Gen_Item *it,
4312 Elm_Tooltip_Item_Content_Cb func,
4314 Evas_Smart_Cb del_cb)
4316 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(it, error);
4318 if ((it->tooltip.content_cb == func) && (it->tooltip.data == data))
4321 if (it->tooltip.del_cb)
4322 it->tooltip.del_cb((void *)it->tooltip.data,
4325 it->tooltip.content_cb = func;
4326 it->tooltip.data = data;
4327 it->tooltip.del_cb = del_cb;
4331 elm_widget_item_tooltip_content_cb_set(it,
4332 it->tooltip.content_cb,
4333 it->tooltip.data, NULL);
4334 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
4335 elm_widget_item_tooltip_size_restrict_disable(it, it->tooltip.free_size);
4341 if (del_cb) del_cb((void *)data, NULL, NULL);
4345 elm_genlist_item_tooltip_unset(Elm_Gen_Item *it)
4347 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4348 if ((VIEW(it)) && (it->tooltip.content_cb))
4349 elm_widget_item_tooltip_unset(it);
4351 if (it->tooltip.del_cb)
4352 it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
4353 it->tooltip.del_cb = NULL;
4354 it->tooltip.content_cb = NULL;
4355 it->tooltip.data = NULL;
4356 it->tooltip.free_size = EINA_FALSE;
4357 if (it->tooltip.style)
4358 elm_genlist_item_tooltip_style_set(it, NULL);
4362 elm_genlist_item_tooltip_style_set(Elm_Gen_Item *it,
4365 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4366 eina_stringshare_replace(&it->tooltip.style, style);
4367 if (VIEW(it)) elm_widget_item_tooltip_style_set(it, style);
4371 elm_genlist_item_tooltip_style_get(const Elm_Gen_Item *it)
4373 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4374 return it->tooltip.style;
4378 elm_genlist_item_tooltip_size_restrict_disable(Elm_Gen_Item *it, Eina_Bool disable)
4380 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4381 it->tooltip.free_size = disable;
4382 if (VIEW(it)) return elm_widget_item_tooltip_size_restrict_disable(it, disable);
4387 elm_genlist_item_tooltip_size_restrict_disabled_get(const Elm_Gen_Item *it)
4389 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4390 return it->tooltip.free_size;
4394 elm_genlist_item_cursor_set(Elm_Gen_Item *it,
4397 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4398 eina_stringshare_replace(&it->mouse_cursor, cursor);
4399 if (VIEW(it)) elm_widget_item_cursor_set(it, cursor);
4403 elm_genlist_item_cursor_get(const Elm_Gen_Item *it)
4405 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4406 return elm_widget_item_cursor_get(it);
4410 elm_genlist_item_cursor_unset(Elm_Gen_Item *it)
4412 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4413 if (!it->mouse_cursor)
4417 elm_widget_item_cursor_unset(it);
4419 eina_stringshare_del(it->mouse_cursor);
4420 it->mouse_cursor = NULL;
4424 elm_genlist_item_cursor_style_set(Elm_Gen_Item *it,
4427 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4428 elm_widget_item_cursor_style_set(it, style);
4432 elm_genlist_item_cursor_style_get(const Elm_Gen_Item *it)
4434 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4435 return elm_widget_item_cursor_style_get(it);
4439 elm_genlist_item_cursor_engine_only_set(Elm_Gen_Item *it,
4440 Eina_Bool engine_only)
4442 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4443 elm_widget_item_cursor_engine_only_set(it, engine_only);
4447 elm_genlist_item_cursor_engine_only_get(const Elm_Gen_Item *it)
4449 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4450 return elm_widget_item_cursor_engine_only_get(it);
4454 elm_genlist_horizontal_set(Evas_Object *obj,
4457 ELM_CHECK_WIDTYPE(obj, widtype);
4458 Widget_Data *wd = elm_widget_data_get(obj);
4460 if (wd->mode == mode) return;
4466 elm_genlist_horizontal_mode_set(Evas_Object *obj,
4469 elm_genlist_horizontal_set(obj, mode);
4473 elm_genlist_horizontal_get(const Evas_Object *obj)
4475 ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
4476 Widget_Data *wd = elm_widget_data_get(obj);
4477 if (!wd) return ELM_LIST_LAST;
4482 elm_genlist_horizontal_mode_get(const Evas_Object *obj)
4484 return elm_genlist_horizontal_get(obj);
4488 elm_genlist_always_select_mode_set(Evas_Object *obj,
4489 Eina_Bool always_select)
4491 elm_gen_always_select_mode_set(obj, always_select);
4495 elm_genlist_always_select_mode_get(const Evas_Object *obj)
4497 return elm_gen_always_select_mode_get(obj);
4501 elm_genlist_no_select_mode_set(Evas_Object *obj,
4502 Eina_Bool no_select)
4504 elm_gen_no_select_mode_set(obj, no_select);
4508 elm_genlist_no_select_mode_get(const Evas_Object *obj)
4510 return elm_gen_no_select_mode_get(obj);
4514 elm_genlist_compress_mode_set(Evas_Object *obj,
4517 ELM_CHECK_WIDTYPE(obj, widtype);
4518 Widget_Data *wd = elm_widget_data_get(obj);
4520 wd->compress = compress;
4521 if (!compress) elm_genlist_homogeneous_set(obj, EINA_FALSE);
4525 elm_genlist_compress_mode_get(const Evas_Object *obj)
4527 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4528 Widget_Data *wd = elm_widget_data_get(obj);
4529 if (!wd) return EINA_FALSE;
4530 return wd->compress;
4534 elm_genlist_height_for_width_mode_set(Evas_Object *obj,
4535 Eina_Bool height_for_width)
4537 ELM_CHECK_WIDTYPE(obj, widtype);
4538 Widget_Data *wd = elm_widget_data_get(obj);
4540 wd->height_for_width = !!height_for_width;
4541 if (wd->height_for_width)
4543 elm_genlist_homogeneous_set(obj, EINA_FALSE);
4544 elm_genlist_compress_mode_set(obj, EINA_TRUE);
4549 elm_genlist_height_for_width_mode_get(const Evas_Object *obj)
4551 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4552 Widget_Data *wd = elm_widget_data_get(obj);
4553 if (!wd) return EINA_FALSE;
4554 return wd->height_for_width;
4558 elm_genlist_bounce_set(Evas_Object *obj,
4562 elm_gen_bounce_set(obj, h_bounce, v_bounce);
4566 elm_genlist_bounce_get(const Evas_Object *obj,
4567 Eina_Bool *h_bounce,
4568 Eina_Bool *v_bounce)
4570 elm_gen_bounce_get(obj, h_bounce, v_bounce);
4574 elm_genlist_homogeneous_set(Evas_Object *obj,
4575 Eina_Bool homogeneous)
4577 ELM_CHECK_WIDTYPE(obj, widtype);
4578 Widget_Data *wd = elm_widget_data_get(obj);
4580 if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
4581 wd->homogeneous = homogeneous;
4585 elm_genlist_homogeneous_get(const Evas_Object *obj)
4587 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4588 Widget_Data *wd = elm_widget_data_get(obj);
4589 if (!wd) return EINA_FALSE;
4590 return wd->homogeneous;
4594 elm_genlist_block_count_set(Evas_Object *obj,
4597 ELM_CHECK_WIDTYPE(obj, widtype);
4598 Widget_Data *wd = elm_widget_data_get(obj);
4600 wd->max_items_per_block = n;
4601 wd->item_cache_max = wd->max_items_per_block * 2;
4602 _item_cache_clean(wd);
4606 elm_genlist_block_count_get(const Evas_Object *obj)
4608 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4609 Widget_Data *wd = elm_widget_data_get(obj);
4611 return wd->max_items_per_block;
4615 elm_genlist_longpress_timeout_set(Evas_Object *obj,
4618 ELM_CHECK_WIDTYPE(obj, widtype);
4619 Widget_Data *wd = elm_widget_data_get(obj);
4621 wd->longpress_timeout = timeout;
4625 elm_genlist_longpress_timeout_get(const Evas_Object *obj)
4627 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4628 Widget_Data *wd = elm_widget_data_get(obj);
4630 return wd->longpress_timeout;
4634 elm_genlist_scroller_policy_set(Evas_Object *obj,
4635 Elm_Scroller_Policy policy_h,
4636 Elm_Scroller_Policy policy_v)
4638 ELM_CHECK_WIDTYPE(obj, widtype);
4639 Widget_Data *wd = elm_widget_data_get(obj);
4640 if ((!wd) || (!wd->scr)) return;
4641 if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
4642 (policy_v >= ELM_SCROLLER_POLICY_LAST))
4644 elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
4648 elm_genlist_scroller_policy_get(const Evas_Object *obj,
4649 Elm_Scroller_Policy *policy_h,
4650 Elm_Scroller_Policy *policy_v)
4652 ELM_CHECK_WIDTYPE(obj, widtype);
4653 Widget_Data *wd = elm_widget_data_get(obj);
4654 Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
4655 if ((!wd) || (!wd->scr)) return;
4656 elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
4657 if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
4658 if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
4662 elm_genlist_realized_items_update(Evas_Object *obj)
4664 ELM_CHECK_WIDTYPE(obj, widtype);
4666 Eina_List *list, *l;
4669 list = elm_genlist_realized_items_get(obj);
4670 EINA_LIST_FOREACH(list, l, it)
4671 elm_genlist_item_update(it);
4675 elm_genlist_item_mode_set(Elm_Gen_Item *it,
4676 const char *mode_type,
4679 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4680 Widget_Data *wd = it->wd;
4685 if (!mode_type) return;
4686 if ((it->delete_me) || (it->disabled)) return;
4688 if ((wd->mode_item == it) &&
4689 (!strcmp(mode_type, wd->mode_type)) &&
4692 if (!wd->mode_item_style) return;
4693 it->mode_set = mode_set;
4697 EINA_LIST_FOREACH(wd->selected, l, it2)
4699 elm_gen_item_selected_set(it2, EINA_FALSE);
4703 it2 = elm_genlist_selected_item_get(wd->obj);
4704 if ((it2) && (it2->realized))
4705 elm_gen_item_selected_set(it2, EINA_FALSE);
4708 if (((wd->mode_type) && (strcmp(mode_type, wd->mode_type))) ||
4710 ((it == wd->mode_item) && (!mode_set)))
4711 _item_mode_unset(wd);
4713 eina_stringshare_replace(&wd->mode_type, mode_type);
4714 if (mode_set) _item_mode_set(it);
4719 elm_genlist_mode_item_style_get(const Evas_Object *obj)
4721 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4722 Widget_Data *wd = elm_widget_data_get(obj);
4723 if (!wd) return NULL;
4724 return wd->mode_item_style;
4728 elm_genlist_mode_item_style_set(Evas_Object *obj, const char *style)
4730 ELM_CHECK_WIDTYPE(obj, widtype);
4731 Widget_Data *wd = elm_widget_data_get(obj);
4733 if ((style == wd->mode_item_style) || (style && wd->mode_item_style &&
4734 (!strcmp(style, wd->mode_item_style))))
4736 eina_stringshare_replace(&wd->mode_item_style, style);
4737 elm_genlist_realized_items_update(obj);
4741 elm_genlist_mode_get(const Evas_Object *obj)
4743 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4744 Widget_Data *wd = elm_widget_data_get(obj);
4745 if (!wd) return NULL;
4746 return wd->mode_type;
4749 EAPI const Elm_Gen_Item *
4750 elm_genlist_mode_item_get(const Evas_Object *obj)
4752 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4753 Widget_Data *wd = elm_widget_data_get(obj);
4754 if (!wd) return NULL;
4755 return wd->mode_item;
4759 elm_genlist_reorder_mode_set(Evas_Object *obj,
4760 Eina_Bool reorder_mode)
4762 ELM_CHECK_WIDTYPE(obj, widtype);
4763 Widget_Data *wd = elm_widget_data_get(obj);
4765 wd->reorder_mode = reorder_mode;
4769 elm_genlist_reorder_mode_get(const Evas_Object *obj)
4771 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4772 Widget_Data *wd = elm_widget_data_get(obj);
4773 if (!wd) return EINA_FALSE;
4774 return wd->reorder_mode;