3 #include <Elementary.h>
4 #include <Elementary_Cursor.h>
6 #include "els_scroller.h"
7 #include "elm_gen_common.h"
9 #define MAX_ITEMS_PER_BLOCK 32
10 #define REORDER_EFFECT_TIME 0.5
12 #define ELM_GEN_SETUP(wd) \
13 (wd)->calc_cb = (Ecore_Cb)_calc_job; \
14 (wd)->clear_cb = (Ecore_Cb)_clear_cb; \
15 (wd)->sizing_cb = (Ecore_Cb)_sizing_eval
17 #define ELM_GEN_ITEM_SETUP(it) \
18 (it)->del_cb = (Ecore_Cb)_item_del; \
19 (it)->highlight_cb = (Ecore_Cb)_item_highlight; \
20 (it)->unsel_cb = (Ecore_Cb)_item_unselect; \
21 (it)->unhighlight_cb = (Ecore_Cb)_item_unhighlight; \
22 (it)->unrealize_cb = (Ecore_Cb)_item_unrealize_cb
24 typedef struct _Item_Block Item_Block;
25 typedef struct _Item_Cache Item_Cache;
27 struct Elm_Gen_Item_Type
32 Evas_Coord w, h, minw, minh;
33 Elm_Gen_Item *group_item;
34 Elm_Genlist_Item_Flags flags;
35 Eina_List *mode_texts, *mode_contents, *mode_states, *mode_content_objs;
36 Ecore_Timer *swipe_timer;
37 Evas_Coord scrl_x, scrl_y, old_scrl_y;
40 Evas_Object *mode_view;
46 Eina_Bool want_realize : 1;
47 Eina_Bool expanded : 1;
48 Eina_Bool mincalcd : 1;
51 Eina_Bool updateme : 1;
52 Eina_Bool nocache : 1;
53 Eina_Bool stacking_even : 1;
54 Eina_Bool nostacking : 1;
55 Eina_Bool move_effect_enabled : 1;
66 Evas_Coord x, y, w, h, minw, minh;
68 int item_position_stamp;
70 Eina_Bool position_update : 1;
71 Eina_Bool want_unrealize : 1;
72 Eina_Bool realized : 1;
73 Eina_Bool changed : 1;
74 Eina_Bool updateme : 1;
76 Eina_Bool must_recalc : 1;
83 Evas_Object *base_view, *spacer;
85 const char *item_style; // it->itc->item_style
86 Eina_Bool tree : 1; // it->group
87 Eina_Bool compress : 1; // it->wd->compress
89 Eina_Bool selected : 1; // it->selected
90 Eina_Bool disabled : 1; // it->disabled
91 Eina_Bool expanded : 1; // it->item->expanded
94 static const char *widtype = NULL;
95 static void _item_cache_zero(Widget_Data *wd);
96 static void _del_hook(Evas_Object *obj);
97 static void _mirrored_set(Evas_Object *obj,
99 static void _theme_hook(Evas_Object *obj);
100 static void _show_region_hook(void *data,
102 static void _sizing_eval(Evas_Object *obj);
103 static void _item_realize(Elm_Gen_Item *it,
106 static void _item_unrealize_cb(Elm_Gen_Item *it);
107 static void _item_block_unrealize(Item_Block *itb);
108 static void _calc_job(void *data);
109 static void _on_focus_hook(void *data,
111 static Eina_Bool _item_multi_select_up(Widget_Data *wd);
112 static Eina_Bool _item_multi_select_down(Widget_Data *wd);
113 static Eina_Bool _item_single_select_up(Widget_Data *wd);
114 static Eina_Bool _item_single_select_down(Widget_Data *wd);
115 static Eina_Bool _event_hook(Evas_Object *obj,
117 Evas_Callback_Type type,
119 static void _signal_emit_hook(Evas_Object *obj,
120 const char *emission,
122 static Eina_Bool _deselect_all_items(Widget_Data *wd);
123 static void _pan_calculate(Evas_Object *obj);
124 static void _pan_max_get(Evas_Object *obj,
127 static void _item_position(Elm_Gen_Item *it,
131 static void _mode_item_realize(Elm_Gen_Item *it);
132 static void _mode_item_unrealize(Elm_Gen_Item *it);
133 static void _item_mode_set(Elm_Gen_Item *it);
134 static void _item_mode_unset(Widget_Data *wd);
135 static void _group_items_recalc(void *data);
136 static void _item_move_after(Elm_Gen_Item *it,
137 Elm_Gen_Item *after);
138 static void _item_move_before(Elm_Gen_Item *it,
139 Elm_Gen_Item *before);
140 static void _item_auto_scroll(Widget_Data *wd);
141 static void _elm_genlist_clear(Evas_Object *obj,
143 static void _pan_child_size_get(Evas_Object *obj,
147 static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
149 static const char SIG_ACTIVATED[] = "activated";
150 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
151 static const char SIG_SELECTED[] = "selected";
152 static const char SIG_UNSELECTED[] = "unselected";
153 static const char SIG_EXPANDED[] = "expanded";
154 static const char SIG_CONTRACTED[] = "contracted";
155 static const char SIG_EXPAND_REQUEST[] = "expand,request";
156 static const char SIG_CONTRACT_REQUEST[] = "contract,request";
157 static const char SIG_REALIZED[] = "realized";
158 static const char SIG_UNREALIZED[] = "unrealized";
159 static const char SIG_DRAG_START_UP[] = "drag,start,up";
160 static const char SIG_DRAG_START_DOWN[] = "drag,start,down";
161 static const char SIG_DRAG_START_LEFT[] = "drag,start,left";
162 static const char SIG_DRAG_START_RIGHT[] = "drag,start,right";
163 static const char SIG_DRAG_STOP[] = "drag,stop";
164 static const char SIG_DRAG[] = "drag";
165 static const char SIG_LONGPRESSED[] = "longpressed";
166 static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
167 static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
168 static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
169 static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
170 static const char SIG_EDGE_TOP[] = "edge,top";
171 static const char SIG_EDGE_BOTTOM[] = "edge,bottom";
172 static const char SIG_EDGE_LEFT[] = "edge,left";
173 static const char SIG_EDGE_RIGHT[] = "edge,right";
174 static const char SIG_MULTI_SWIPE_LEFT[] = "multi,swipe,left";
175 static const char SIG_MULTI_SWIPE_RIGHT[] = "multi,swipe,right";
176 static const char SIG_MULTI_SWIPE_UP[] = "multi,swipe,up";
177 static const char SIG_MULTI_SWIPE_DOWN[] = "multi,swipe,down";
178 static const char SIG_MULTI_PINCH_OUT[] = "multi,pinch,out";
179 static const char SIG_MULTI_PINCH_IN[] = "multi,pinch,in";
180 static const char SIG_SWIPE[] = "swipe";
181 static const char SIG_MOVED[] = "moved";
182 static const char SIG_INDEX_UPDATE[] = "index,update";
184 static const Evas_Smart_Cb_Description _signals[] = {
185 {SIG_CLICKED_DOUBLE, ""},
188 {SIG_UNSELECTED, ""},
190 {SIG_CONTRACTED, ""},
191 {SIG_EXPAND_REQUEST, ""},
192 {SIG_CONTRACT_REQUEST, ""},
194 {SIG_UNREALIZED, ""},
195 {SIG_DRAG_START_UP, ""},
196 {SIG_DRAG_START_DOWN, ""},
197 {SIG_DRAG_START_LEFT, ""},
198 {SIG_DRAG_START_RIGHT, ""},
201 {SIG_LONGPRESSED, ""},
202 {SIG_SCROLL_ANIM_START, ""},
203 {SIG_SCROLL_ANIM_STOP, ""},
204 {SIG_SCROLL_DRAG_START, ""},
205 {SIG_SCROLL_DRAG_STOP, ""},
207 {SIG_EDGE_BOTTOM, ""},
209 {SIG_EDGE_RIGHT, ""},
210 {SIG_MULTI_SWIPE_LEFT, ""},
211 {SIG_MULTI_SWIPE_RIGHT, ""},
212 {SIG_MULTI_SWIPE_UP, ""},
213 {SIG_MULTI_SWIPE_DOWN, ""},
214 {SIG_MULTI_PINCH_OUT, ""},
215 {SIG_MULTI_PINCH_IN, ""},
222 #undef ELM_CHECK_WIDTYPE
223 #define ELM_CHECK_WIDTYPE(obj, widtype) \
224 if ((!obj) || (!elm_genlist_type_check((obj), __func__))) return
225 #undef ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN
226 #define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, ...) \
227 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
228 ELM_CHECK_WIDTYPE(WIDGET((it)), widtype) __VA_ARGS__;
230 static const char *_gengrid = NULL;
231 static const char *_genlist = NULL;
233 /* THIS FUNCTION IS HACKY AND TEMPORARY!!! */
235 elm_genlist_type_check(const Evas_Object *obj,
238 const char *provided, *expected = "(unknown)";
239 static int abort_on_warn = -1;
240 provided = elm_widget_type_get(obj);
241 if (!_genlist) _genlist = eina_stringshare_add("genlist");
242 if (!_gengrid) _gengrid = eina_stringshare_add("gengrid");
243 if (EINA_LIKELY(provided == _genlist) || EINA_LIKELY(provided == _gengrid))
245 if ((!provided) || (!provided[0]))
247 provided = evas_object_type_get(obj);
248 if ((!provided) || (!provided[0]))
249 provided = "(unknown)";
251 ERR("Passing Object: %p in function: %s, of type: '%s' when expecting type: '%s'", obj, func, provided, expected);
252 if (abort_on_warn == -1)
254 if (getenv("ELM_ERROR_ABORT")) abort_on_warn = 1;
255 else abort_on_warn = 0;
257 if (abort_on_warn == 1) abort();
262 _event_hook(Evas_Object *obj,
263 Evas_Object *src __UNUSED__,
264 Evas_Callback_Type type,
267 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
268 Evas_Event_Key_Down *ev = event_info;
269 Widget_Data *wd = elm_widget_data_get(obj);
270 Evas_Coord pan_max_x = 0, pan_max_y = 0;
271 if (!wd) return EINA_FALSE;
272 if (!wd->items) return EINA_FALSE;
273 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
274 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
276 Elm_Object_Item *it = NULL;
279 Evas_Coord step_x = 0;
280 Evas_Coord step_y = 0;
283 Evas_Coord page_x = 0;
284 Evas_Coord page_y = 0;
286 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
287 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
288 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
289 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
291 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
295 else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")))
299 else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
301 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
302 (_item_multi_select_up(wd)))
303 || (_item_single_select_up(wd)))
305 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
311 else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
313 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
314 (_item_multi_select_down(wd)))
315 || (_item_single_select_down(wd)))
317 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
323 else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
325 it = elm_genlist_first_item_get(obj);
326 elm_genlist_item_bring_in(it);
327 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
330 else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
332 it = elm_genlist_last_item_get(obj);
333 elm_genlist_item_bring_in(it);
334 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
337 else if ((!strcmp(ev->keyname, "Prior")) || (!strcmp(ev->keyname, "KP_Prior")))
340 y -= -(page_y * v_h) / 100;
344 else if ((!strcmp(ev->keyname, "Next")) || (!strcmp(ev->keyname, "KP_Next")))
347 y += -(page_y * v_h) / 100;
351 else if (!strcmp(ev->keyname, "Escape"))
353 if (!_deselect_all_items(wd)) return EINA_FALSE;
354 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
357 else if (((!strcmp(ev->keyname, "Return")) ||
358 (!strcmp(ev->keyname, "KP_Enter")) ||
359 (!strcmp(ev->keyname, "space")))
360 && (!wd->multi) && (wd->selected))
362 it = elm_genlist_selected_item_get(obj);
363 elm_genlist_item_expanded_set(it,
364 !elm_genlist_item_expanded_get(it));
365 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
367 else return EINA_FALSE;
369 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
370 _pan_max_get(wd->pan_smart, &pan_max_x, &pan_max_y);
372 if (x > pan_max_x) x = pan_max_x;
374 if (y > pan_max_y) y = pan_max_y;
375 elm_smart_scroller_child_pos_set(wd->scr, x, y);
380 _deselect_all_items(Widget_Data *wd)
382 if (!wd->selected) return EINA_FALSE;
384 elm_genlist_item_selected_set(wd->selected->data, EINA_FALSE);
390 _item_multi_select_up(Widget_Data *wd)
392 if (!wd->selected) return EINA_FALSE;
393 if (!wd->multi) return EINA_FALSE;
395 Elm_Object_Item *prev = elm_genlist_item_prev_get(wd->last_selected_item);
396 if (!prev) return EINA_TRUE;
398 if (elm_genlist_item_selected_get(prev))
400 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
401 wd->last_selected_item = prev;
402 elm_genlist_item_show(wd->last_selected_item);
406 elm_genlist_item_selected_set(prev, EINA_TRUE);
407 elm_genlist_item_show(prev);
413 _item_multi_select_down(Widget_Data *wd)
415 if (!wd->selected) return EINA_FALSE;
416 if (!wd->multi) return EINA_FALSE;
418 Elm_Object_Item *next;
419 next = elm_genlist_item_next_get(wd->last_selected_item);
420 if (!next) return EINA_TRUE;
422 if (elm_genlist_item_selected_get(next))
424 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
425 wd->last_selected_item = next;
426 elm_genlist_item_show(wd->last_selected_item);
430 elm_genlist_item_selected_set(next, EINA_TRUE);
431 elm_genlist_item_show(next);
437 _item_single_select_up(Widget_Data *wd)
442 prev = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
443 while ((prev) && (prev->generation < wd->generation))
444 prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
446 else prev = (Elm_Gen_Item *) elm_genlist_item_prev_get(wd->last_selected_item);
448 if (!prev) return EINA_FALSE;
450 _deselect_all_items(wd);
452 elm_genlist_item_selected_set((Elm_Object_Item *) prev, EINA_TRUE);
453 elm_genlist_item_show((Elm_Object_Item *) prev);
458 _item_single_select_down(Widget_Data *wd)
463 next = ELM_GEN_ITEM_FROM_INLIST(wd->items);
464 while ((next) && (next->generation < wd->generation))
465 next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
467 else next = (Elm_Gen_Item *) elm_genlist_item_next_get(wd->last_selected_item);
469 if (!next) return EINA_FALSE;
471 _deselect_all_items(wd);
473 elm_genlist_item_selected_set((Elm_Object_Item *) next, EINA_TRUE);
474 elm_genlist_item_show((Elm_Object_Item *) next);
479 _on_focus_hook(void *data __UNUSED__,
482 Widget_Data *wd = elm_widget_data_get(obj);
484 if (elm_widget_focus_get(obj))
486 elm_object_signal_emit(wd->obj, "elm,action,focus", "elm");
487 evas_object_focus_set(wd->obj, EINA_TRUE);
488 if ((wd->selected) && (!wd->last_selected_item))
489 wd->last_selected_item = eina_list_data_get(wd->selected);
493 elm_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
494 evas_object_focus_set(wd->obj, EINA_FALSE);
499 _del_hook(Evas_Object *obj)
501 Widget_Data *wd = elm_widget_data_get(obj);
503 _item_cache_zero(wd);
504 if (wd->calc_job) ecore_job_del(wd->calc_job);
505 if (wd->update_job) ecore_job_del(wd->update_job);
506 if (wd->queue_idle_enterer) ecore_idle_enterer_del(wd->queue_idle_enterer);
507 if (wd->must_recalc_idler) ecore_idler_del(wd->must_recalc_idler);
508 if (wd->multi_timer) ecore_timer_del(wd->multi_timer);
509 if (wd->mode_type) eina_stringshare_del(wd->mode_type);
510 if (wd->scr_hold_timer) ecore_timer_del(wd->scr_hold_timer);
515 _del_pre_hook(Evas_Object *obj)
517 Widget_Data *wd = elm_widget_data_get(obj);
519 elm_genlist_clear(obj);
520 evas_object_del(wd->pan_smart);
521 wd->pan_smart = NULL;
525 _mirrored_set(Evas_Object *obj,
528 Widget_Data *wd = elm_widget_data_get(obj);
530 _item_cache_zero(wd);
531 elm_smart_scroller_mirrored_set(wd->scr, rtl);
535 _theme_hook(Evas_Object *obj)
537 Widget_Data *wd = elm_widget_data_get(obj);
540 evas_event_freeze(evas_object_evas_get(wd->obj));
541 _item_cache_zero(wd);
542 _elm_widget_mirrored_reload(obj);
543 _mirrored_set(obj, elm_widget_mirrored_get(obj));
544 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
545 elm_widget_style_get(obj));
546 edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
547 wd->item_width = wd->item_height = 0;
548 wd->group_item_width = wd->group_item_height = 0;
549 wd->minw = wd->minh = wd->realminw = 0;
550 EINA_INLIST_FOREACH(wd->blocks, itb)
555 if (itb->realized) _item_block_unrealize(itb);
556 EINA_LIST_FOREACH(itb->items, l, it)
557 it->item->mincalcd = EINA_FALSE;
559 itb->changed = EINA_TRUE;
561 if (wd->calc_job) ecore_job_del(wd->calc_job);
562 wd->calc_job = ecore_job_add(_calc_job, wd);
564 evas_event_thaw(evas_object_evas_get(wd->obj));
565 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
569 _show_region_hook(void *data,
572 Widget_Data *wd = elm_widget_data_get(data);
573 Evas_Coord x, y, w, h;
575 elm_widget_show_region_get(obj, &x, &y, &w, &h);
576 //x & y are screen coordinates, Add with pan coordinates
579 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
583 _translate_hook(Evas_Object *obj)
585 evas_object_smart_callback_call(obj, "language,changed", NULL);
589 _sizing_eval(Evas_Object *obj)
591 Widget_Data *wd = elm_widget_data_get(obj);
592 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
594 evas_object_size_hint_min_get(wd->scr, &minw, &minh);
595 evas_object_size_hint_max_get(wd->scr, &maxw, &maxh);
597 if (wd->height_for_width)
601 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
602 if ((vw != 0) && (vw != wd->prev_viewport_w))
606 wd->prev_viewport_w = vw;
607 EINA_INLIST_FOREACH(wd->blocks, itb)
609 itb->must_recalc = EINA_TRUE;
611 if (wd->calc_job) ecore_job_del(wd->calc_job);
612 wd->calc_job = ecore_job_add(_calc_job, wd);
615 if (wd->mode == ELM_LIST_LIMIT)
621 edje_object_size_min_calc
622 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
629 edje_object_size_min_calc
630 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
634 evas_object_size_hint_min_set(obj, minw, minh);
635 evas_object_size_hint_max_set(obj, maxw, maxh);
639 _signal_emit_hook(Evas_Object *obj,
640 const char *emission,
643 Widget_Data *wd = elm_widget_data_get(obj);
644 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
649 _item_highlight(Elm_Gen_Item *it)
651 const char *selectraise;
652 if ((it->wd->no_select) || (it->generation < it->wd->generation) ||
653 (it->highlighted) || elm_widget_item_disabled_get(it) ||
654 (it->display_only) || (it->item->mode_view))
656 edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
657 selectraise = edje_object_data_get(VIEW(it), "selectraise");
658 if ((selectraise) && (!strcmp(selectraise, "on")))
660 evas_object_raise(VIEW(it));
661 if ((it->item->group_item) && (it->item->group_item->realized))
662 evas_object_raise(it->item->VIEW(group_item));
664 it->highlighted = EINA_TRUE;
668 _item_unhighlight(Elm_Gen_Item *it)
670 if ((it->generation < it->wd->generation) || (!it->highlighted)) return;
671 edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm");
672 if (!it->item->nostacking)
674 if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even) evas_object_lower(VIEW(it));
675 else evas_object_raise(VIEW(it));
677 it->highlighted = EINA_FALSE;
681 _item_block_position_update(Eina_Inlist *list, int idx)
685 EINA_INLIST_FOREACH(list, tmp)
687 tmp->position = idx++;
688 tmp->position_update = EINA_TRUE;
693 _item_position_update(Eina_List *list, int idx)
698 EINA_LIST_FOREACH(list, l, it)
700 it->position = idx++;
701 it->position_update = EINA_TRUE;
706 _item_block_del(Elm_Gen_Item *it)
709 Item_Block *itb = it->item->block;
711 itb->items = eina_list_remove(itb->items, it);
713 itb->changed = EINA_TRUE;
714 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
715 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
718 il = EINA_INLIST_GET(itb);
719 Item_Block *itbn = (Item_Block *)(il->next);
721 it->parent->item->items = eina_list_remove(it->parent->item->items, it);
724 _item_block_position_update(il->next, itb->position);
725 it->wd->blocks = eina_inlist_remove(it->wd->blocks, il);
728 if (itbn) itbn->changed = EINA_TRUE;
732 if (itb->count < itb->wd->max_items_per_block/2)
734 il = EINA_INLIST_GET(itb);
735 Item_Block *itbp = (Item_Block *)(il->prev);
736 Item_Block *itbn = (Item_Block *)(il->next);
737 if ((itbp) && ((itbp->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
741 EINA_LIST_FREE(itb->items, it2)
743 it2->item->block = itbp;
744 itbp->items = eina_list_append(itbp->items, it2);
746 itbp->changed = EINA_TRUE;
748 _item_block_position_update(EINA_INLIST_GET(itb)->next,
750 it->wd->blocks = eina_inlist_remove(it->wd->blocks,
751 EINA_INLIST_GET(itb));
754 else if ((itbn) && ((itbn->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
758 Eina_List *last = eina_list_last(itb->items);
759 Elm_Gen_Item *it2 = last->data;
761 it2->item->block = itbn;
762 itb->items = eina_list_remove_list(itb->items, last);
763 itbn->items = eina_list_prepend(itbn->items, it2);
765 itbn->changed = EINA_TRUE;
767 _item_block_position_update(EINA_INLIST_GET(itb)->next,
770 eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb));
778 _item_del(Elm_Gen_Item *it)
780 Evas_Object *obj = WIDGET(it);
782 evas_event_freeze(evas_object_evas_get(obj));
783 elm_genlist_item_subitems_clear((Elm_Object_Item *) it);
784 if (it->wd->show_item == it) it->wd->show_item = NULL;
785 if (it->realized) _elm_genlist_item_unrealize(it, EINA_FALSE);
786 if (it->item->block) _item_block_del(it);
787 if (it->item->queued)
788 it->wd->queue = eina_list_remove(it->wd->queue, it);
789 if (it->wd->anchor_item == it)
791 it->wd->anchor_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
792 if (!it->wd->anchor_item)
793 it->wd->anchor_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
796 it->parent->item->items = eina_list_remove(it->parent->item->items, it);
797 if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
798 _elm_genlist_item_del_serious(it);
799 evas_event_thaw(evas_object_evas_get(obj));
800 evas_event_thaw_eval(evas_object_evas_get(obj));
804 _clear_cb(Widget_Data *wd)
806 wd->anchor_item = NULL;
809 Item_Block *itb = (Item_Block *)(wd->blocks);
811 wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
812 if (itb->items) eina_list_free(itb->items);
815 if (wd->queue_idle_enterer)
817 ecore_idle_enterer_del(wd->queue_idle_enterer);
818 wd->queue_idle_enterer = NULL;
820 if (wd->must_recalc_idler)
822 ecore_idler_del(wd->must_recalc_idler);
823 wd->must_recalc_idler = NULL;
825 if (wd->queue) wd->queue = eina_list_free(wd->queue);
826 if (wd->reorder_move_animator)
828 ecore_animator_del(wd->reorder_move_animator);
829 wd->reorder_move_animator = NULL;
831 wd->show_item = NULL;
832 wd->reorder_old_pan_y = 0;
836 _item_unselect(Elm_Gen_Item *it)
838 if ((it->generation < it->wd->generation) || (!it->selected)) return;
839 it->selected = EINA_FALSE;
840 it->wd->selected = eina_list_remove(it->wd->selected, it);
841 evas_object_smart_callback_call(WIDGET(it), SIG_UNSELECTED, it);
845 _mouse_move(void *data,
846 Evas *evas __UNUSED__,
850 Elm_Gen_Item *it = data;
851 Evas_Event_Mouse_Move *ev = event_info;
852 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
853 Evas_Coord ox, oy, ow, oh, it_scrl_y, y_pos;
855 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
857 if (!it->wd->on_hold)
859 it->wd->on_hold = EINA_TRUE;
860 if (!it->wd->wasselected)
862 _item_unhighlight(it);
867 if (it->wd->multitouched)
869 it->wd->cur_x = ev->cur.canvas.x;
870 it->wd->cur_y = ev->cur.canvas.y;
873 if ((it->dragging) && (it->down))
875 if (it->wd->movements == SWIPE_MOVES) it->wd->swipe = EINA_TRUE;
878 it->wd->history[it->wd->movements].x = ev->cur.canvas.x;
879 it->wd->history[it->wd->movements].y = ev->cur.canvas.y;
880 if (abs((it->wd->history[it->wd->movements].x -
881 it->wd->history[0].x)) > 40)
882 it->wd->swipe = EINA_TRUE;
888 ecore_timer_del(it->long_timer);
889 it->long_timer = NULL;
891 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG, it);
894 if ((!it->down) /* || (it->wd->on_hold)*/ || (it->wd->longpressed))
898 ecore_timer_del(it->long_timer);
899 it->long_timer = NULL;
901 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
903 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
904 it_scrl_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
906 if (!it->wd->reorder_start_y)
907 it->wd->reorder_start_y = it->item->block->y + it->y;
911 else if (it_scrl_y + it->wd->reorder_it->item->h > oy + oh)
912 y_pos = oy + oh - it->wd->reorder_it->item->h;
916 _item_position(it, VIEW(it), it->item->scrl_x, y_pos);
918 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
919 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
923 if (!it->display_only)
924 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
925 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
926 x = ev->cur.canvas.x - x;
927 y = ev->cur.canvas.y - y;
930 if (adx < 0) adx = -dx;
933 if (ady < 0) ady = -dy;
936 if ((adx > minw) || (ady > minh))
938 it->dragging = EINA_TRUE;
941 ecore_timer_del(it->long_timer);
942 it->long_timer = NULL;
944 if (!it->wd->wasselected)
946 _item_unhighlight(it);
952 evas_object_smart_callback_call(WIDGET(it),
953 SIG_DRAG_START_UP, it);
957 evas_object_smart_callback_call(WIDGET(it),
958 SIG_DRAG_START_LEFT, it);
960 evas_object_smart_callback_call(WIDGET(it),
961 SIG_DRAG_START_RIGHT, it);
967 evas_object_smart_callback_call(WIDGET(it),
968 SIG_DRAG_START_DOWN, it);
972 evas_object_smart_callback_call(WIDGET(it),
973 SIG_DRAG_START_LEFT, it);
975 evas_object_smart_callback_call(WIDGET(it),
976 SIG_DRAG_START_RIGHT, it);
983 _long_press(void *data)
985 Elm_Gen_Item *it = data, *it_tmp;
988 it->long_timer = NULL;
989 if (elm_widget_item_disabled_get(it) || (it->dragging) || (it->display_only))
990 return ECORE_CALLBACK_CANCEL;
991 it->wd->longpressed = EINA_TRUE;
992 evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it);
993 if ((it->wd->reorder_mode) && (!it->group))
995 it->wd->reorder_it = it;
996 it->wd->reorder_start_y = 0;
998 evas_object_raise(VIEW(it));
999 elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
1000 elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_FALSE);
1002 list = elm_genlist_realized_items_get(it->wd->obj);
1003 EINA_LIST_FOREACH(list, l, it_tmp)
1005 if (it != it_tmp) _item_unselect(it_tmp);
1007 if (elm_genlist_item_expanded_get((Elm_Object_Item *) it))
1009 elm_genlist_item_expanded_set((Elm_Object_Item *) it, EINA_FALSE);
1010 return ECORE_CALLBACK_RENEW;
1012 edje_object_signal_emit(VIEW(it), "elm,state,reorder,enabled", "elm");
1014 return ECORE_CALLBACK_CANCEL;
1018 _swipe(Elm_Gen_Item *it)
1023 if ((it->display_only) || elm_widget_item_disabled_get(it)) return;
1024 it->wd->swipe = EINA_FALSE;
1025 for (i = 0; i < it->wd->movements; i++)
1027 sum += it->wd->history[i].x;
1028 if (abs(it->wd->history[0].y - it->wd->history[i].y) > 10) return;
1031 sum /= it->wd->movements;
1032 if (abs(sum - it->wd->history[0].x) <= 10) return;
1033 evas_object_smart_callback_call(WIDGET(it), SIG_SWIPE, it);
1037 _swipe_cancel(void *data)
1039 Elm_Gen_Item *it = data;
1041 if (!it) return ECORE_CALLBACK_CANCEL;
1042 it->wd->swipe = EINA_FALSE;
1043 it->wd->movements = 0;
1044 return ECORE_CALLBACK_RENEW;
1048 _multi_cancel(void *data)
1050 Widget_Data *wd = data;
1052 if (!wd) return ECORE_CALLBACK_CANCEL;
1053 wd->multi_timeout = EINA_TRUE;
1054 return ECORE_CALLBACK_RENEW;
1058 _multi_touch_gesture_eval(void *data)
1060 Elm_Gen_Item *it = data;
1062 it->wd->multitouched = EINA_FALSE;
1063 if (it->wd->multi_timer)
1065 ecore_timer_del(it->wd->multi_timer);
1066 it->wd->multi_timer = NULL;
1068 if (it->wd->multi_timeout)
1070 it->wd->multi_timeout = EINA_FALSE;
1074 Evas_Coord minw = 0, minh = 0;
1075 Evas_Coord off_x, off_y, off_mx, off_my;
1077 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1078 off_x = abs(it->wd->cur_x - it->wd->prev_x);
1079 off_y = abs(it->wd->cur_y - it->wd->prev_y);
1080 off_mx = abs(it->wd->cur_mx - it->wd->prev_mx);
1081 off_my = abs(it->wd->cur_my - it->wd->prev_my);
1083 if (((off_x > minw) || (off_y > minh)) && ((off_mx > minw) || (off_my > minh)))
1085 if ((off_x + off_mx) > (off_y + off_my))
1087 if ((it->wd->cur_x > it->wd->prev_x) && (it->wd->cur_mx > it->wd->prev_mx))
1088 evas_object_smart_callback_call(WIDGET(it),
1089 SIG_MULTI_SWIPE_RIGHT, it);
1090 else if ((it->wd->cur_x < it->wd->prev_x) && (it->wd->cur_mx < it->wd->prev_mx))
1091 evas_object_smart_callback_call(WIDGET(it),
1092 SIG_MULTI_SWIPE_LEFT, it);
1093 else if (abs(it->wd->cur_x - it->wd->cur_mx) > abs(it->wd->prev_x - it->wd->prev_mx))
1094 evas_object_smart_callback_call(WIDGET(it),
1095 SIG_MULTI_PINCH_OUT, it);
1097 evas_object_smart_callback_call(WIDGET(it),
1098 SIG_MULTI_PINCH_IN, it);
1102 if ((it->wd->cur_y > it->wd->prev_y) && (it->wd->cur_my > it->wd->prev_my))
1103 evas_object_smart_callback_call(WIDGET(it),
1104 SIG_MULTI_SWIPE_DOWN, it);
1105 else if ((it->wd->cur_y < it->wd->prev_y) && (it->wd->cur_my < it->wd->prev_my))
1106 evas_object_smart_callback_call(WIDGET(it),
1107 SIG_MULTI_SWIPE_UP, it);
1108 else if (abs(it->wd->cur_y - it->wd->cur_my) > abs(it->wd->prev_y - it->wd->prev_my))
1109 evas_object_smart_callback_call(WIDGET(it),
1110 SIG_MULTI_PINCH_OUT, it);
1112 evas_object_smart_callback_call(WIDGET(it),
1113 SIG_MULTI_PINCH_IN, it);
1116 it->wd->multi_timeout = EINA_FALSE;
1120 _multi_down(void *data,
1121 Evas *evas __UNUSED__,
1122 Evas_Object *obj __UNUSED__,
1125 Elm_Gen_Item *it = data;
1126 Evas_Event_Multi_Down *ev = event_info;
1128 if ((it->wd->multi_device != 0) || (it->wd->multitouched) || (it->wd->multi_timeout)) return;
1129 it->wd->multi_device = ev->device;
1130 it->wd->multi_down = EINA_TRUE;
1131 it->wd->multitouched = EINA_TRUE;
1132 it->wd->prev_mx = ev->canvas.x;
1133 it->wd->prev_my = ev->canvas.y;
1134 if (!it->wd->wasselected)
1136 _item_unhighlight(it);
1139 it->wd->wasselected = EINA_FALSE;
1140 it->wd->longpressed = EINA_FALSE;
1143 ecore_timer_del(it->long_timer);
1144 it->long_timer = NULL;
1148 it->dragging = EINA_FALSE;
1149 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
1151 if (it->item->swipe_timer)
1153 ecore_timer_del(it->item->swipe_timer);
1154 it->item->swipe_timer = NULL;
1156 if (it->wd->on_hold)
1158 it->wd->swipe = EINA_FALSE;
1159 it->wd->movements = 0;
1160 it->wd->on_hold = EINA_FALSE;
1165 _multi_up(void *data,
1166 Evas *evas __UNUSED__,
1167 Evas_Object *obj __UNUSED__,
1170 Elm_Gen_Item *it = data;
1171 Evas_Event_Multi_Up *ev = event_info;
1173 if (it->wd->multi_device != ev->device) return;
1174 it->wd->multi_device = 0;
1175 it->wd->multi_down = EINA_FALSE;
1176 if (it->wd->mouse_down) return;
1177 _multi_touch_gesture_eval(data);
1181 _multi_move(void *data,
1182 Evas *evas __UNUSED__,
1183 Evas_Object *obj __UNUSED__,
1186 Elm_Gen_Item *it = data;
1187 Evas_Event_Multi_Move *ev = event_info;
1189 if (it->wd->multi_device != ev->device) return;
1190 it->wd->cur_mx = ev->cur.canvas.x;
1191 it->wd->cur_my = ev->cur.canvas.y;
1195 _mouse_down(void *data,
1196 Evas *evas __UNUSED__,
1200 Elm_Gen_Item *it = data;
1201 Evas_Event_Mouse_Down *ev = event_info;
1204 if (ev->button != 1) return;
1205 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1207 it->wd->on_hold = EINA_TRUE;
1210 it->down = EINA_TRUE;
1211 it->dragging = EINA_FALSE;
1212 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1213 it->dx = ev->canvas.x - x;
1214 it->dy = ev->canvas.y - y;
1215 it->wd->mouse_down = EINA_TRUE;
1216 if (!it->wd->multitouched)
1218 it->wd->prev_x = ev->canvas.x;
1219 it->wd->prev_y = ev->canvas.y;
1220 it->wd->multi_timeout = EINA_FALSE;
1221 if (it->wd->multi_timer) ecore_timer_del(it->wd->multi_timer);
1222 it->wd->multi_timer = ecore_timer_add(1, _multi_cancel, it->wd);
1224 it->wd->longpressed = EINA_FALSE;
1225 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1226 else it->wd->on_hold = EINA_FALSE;
1227 if (it->wd->on_hold) return;
1228 it->wd->wasselected = it->selected;
1229 _item_highlight(it);
1230 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
1231 if ((!elm_widget_item_disabled_get(it)) && (!it->display_only))
1233 evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
1234 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
1236 if (it->long_timer) ecore_timer_del(it->long_timer);
1237 if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
1238 it->item->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
1240 it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press,
1243 it->long_timer = NULL;
1244 it->wd->swipe = EINA_FALSE;
1245 it->wd->movements = 0;
1249 _mouse_up(void *data,
1250 Evas *evas __UNUSED__,
1251 Evas_Object *obj __UNUSED__,
1254 Elm_Gen_Item *it = data;
1255 Evas_Event_Mouse_Up *ev = event_info;
1256 Eina_Bool dragged = EINA_FALSE;
1258 if (ev->button != 1) return;
1259 it->down = EINA_FALSE;
1260 it->wd->mouse_down = EINA_FALSE;
1261 if (it->wd->multitouched)
1263 if ((!it->wd->multi) && (!it->selected) && (it->highlighted)) _item_unhighlight(it);
1264 if (it->wd->multi_down) return;
1265 _multi_touch_gesture_eval(data);
1268 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1269 else it->wd->on_hold = EINA_FALSE;
1272 ecore_timer_del(it->long_timer);
1273 it->long_timer = NULL;
1277 it->dragging = EINA_FALSE;
1278 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
1281 if (it->item->swipe_timer)
1283 ecore_timer_del(it->item->swipe_timer);
1284 it->item->swipe_timer = NULL;
1286 if (it->wd->multi_timer)
1288 ecore_timer_del(it->wd->multi_timer);
1289 it->wd->multi_timer = NULL;
1290 it->wd->multi_timeout = EINA_FALSE;
1292 if (it->wd->on_hold)
1294 if (it->wd->swipe) _swipe(data);
1295 it->wd->longpressed = EINA_FALSE;
1296 it->wd->on_hold = EINA_FALSE;
1299 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
1301 Evas_Coord it_scrl_y = ev->canvas.y - it->wd->reorder_it->dy;
1303 if (it->wd->reorder_rel && (it->wd->reorder_it->parent == it->wd->reorder_rel->parent))
1305 if (it_scrl_y <= it->wd->reorder_rel->item->scrl_y)
1306 _item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
1308 _item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
1312 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1313 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1315 edje_object_signal_emit(VIEW(it), "elm,state,reorder,disabled", "elm");
1316 it->wd->reorder_it = it->wd->reorder_rel = NULL;
1317 elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
1318 elm_smart_scroller_bounce_allow_set(it->wd->scr, it->wd->h_bounce, it->wd->v_bounce);
1320 if (it->wd->longpressed)
1322 it->wd->longpressed = EINA_FALSE;
1323 if (!it->wd->wasselected)
1325 _item_unhighlight(it);
1328 it->wd->wasselected = EINA_FALSE;
1333 if (it->want_unrealize)
1335 _elm_genlist_item_unrealize(it, EINA_FALSE);
1336 if (it->item->block->want_unrealize)
1337 _item_block_unrealize(it->item->block);
1340 if (elm_widget_item_disabled_get(it) || (dragged) || (it->display_only))
1342 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1347 _item_highlight(it);
1352 _item_unhighlight(it);
1360 Widget_Data *wd = it->wd;
1363 while (wd->selected)
1365 _item_unhighlight(wd->selected->data);
1366 _item_unselect(wd->selected->data);
1372 const Eina_List *l, *l_next;
1375 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
1378 _item_unhighlight(it2);
1379 _item_unselect(it2);
1381 //_item_highlight(it);
1384 _item_highlight(it);
1390 _signal_expand_toggle(void *data,
1391 Evas_Object *obj __UNUSED__,
1392 const char *emission __UNUSED__,
1393 const char *source __UNUSED__)
1395 Elm_Gen_Item *it = data;
1397 if (it->item->expanded)
1398 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it);
1400 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it);
1404 _signal_expand(void *data,
1405 Evas_Object *obj __UNUSED__,
1406 const char *emission __UNUSED__,
1407 const char *source __UNUSED__)
1409 Elm_Gen_Item *it = data;
1411 if (!it->item->expanded)
1412 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it);
1416 _signal_contract(void *data,
1417 Evas_Object *obj __UNUSED__,
1418 const char *emission __UNUSED__,
1419 const char *source __UNUSED__)
1421 Elm_Gen_Item *it = data;
1423 if (it->item->expanded)
1424 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it);
1428 _scr_hold_timer_cb(void *data)
1430 if (!data) return ECORE_CALLBACK_CANCEL;
1431 Widget_Data *wd = data;
1432 elm_smart_scroller_hold_set(wd->scr, EINA_FALSE);
1433 wd->scr_hold_timer = NULL;
1434 return ECORE_CALLBACK_CANCEL;
1438 _mode_finished_signal_cb(void *data,
1440 const char *emission __UNUSED__,
1441 const char *source __UNUSED__)
1445 Elm_Gen_Item *it = data;
1446 if ((it->generation < it->wd->generation) || (!it->realized) || (!it->item->mode_view)) return;
1448 Evas *te = evas_object_evas_get(obj);
1450 evas_event_freeze(te);
1451 it->item->nocache = EINA_FALSE;
1452 _mode_item_unrealize(it);
1453 if (it->item->group_item)
1454 evas_object_raise(it->item->VIEW(group_item));
1455 snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished", it->wd->mode_type);
1456 edje_object_signal_callback_del_full(obj, buf, "elm", _mode_finished_signal_cb, it);
1457 evas_event_thaw(te);
1458 evas_event_thaw_eval(te);
1462 _item_cache_clean(Widget_Data *wd)
1464 evas_event_freeze(evas_object_evas_get(wd->obj));
1465 while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max))
1469 itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache);
1470 wd->item_cache = eina_inlist_remove(wd->item_cache,
1471 wd->item_cache->last);
1472 wd->item_cache_count--;
1473 if (itc->spacer) evas_object_del(itc->spacer);
1474 if (itc->base_view) evas_object_del(itc->base_view);
1475 if (itc->item_style) eina_stringshare_del(itc->item_style);
1478 evas_event_thaw(evas_object_evas_get(wd->obj));
1479 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
1483 _item_cache_zero(Widget_Data *wd)
1485 int pmax = wd->item_cache_max;
1486 wd->item_cache_max = 0;
1487 _item_cache_clean(wd);
1488 wd->item_cache_max = pmax;
1492 _item_cache_add(Elm_Gen_Item *it)
1496 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1497 if (it->wd->item_cache_max <= 0)
1499 evas_object_del(VIEW(it));
1501 evas_object_del(it->spacer);
1503 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1504 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1508 it->wd->item_cache_count++;
1509 itc = calloc(1, sizeof(Item_Cache));
1510 it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache,
1511 EINA_INLIST_GET(itc));
1512 itc->spacer = it->spacer;
1514 itc->base_view = VIEW(it);
1516 evas_object_hide(itc->base_view);
1517 evas_object_move(itc->base_view, -9999, -9999);
1518 itc->item_style = eina_stringshare_add(it->itc->item_style);
1519 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
1520 itc->compress = (it->wd->compress);
1521 itc->selected = it->selected;
1522 itc->disabled = elm_widget_item_disabled_get(it);
1523 itc->expanded = it->item->expanded;
1526 ecore_timer_del(it->long_timer);
1527 it->long_timer = NULL;
1529 if (it->item->swipe_timer)
1531 ecore_timer_del(it->item->swipe_timer);
1532 it->item->swipe_timer = NULL;
1534 // FIXME: other callbacks?
1535 edje_object_signal_callback_del_full(itc->base_view,
1536 "elm,action,expand,toggle",
1537 "elm", _signal_expand_toggle, it);
1538 edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand",
1540 _signal_expand, it);
1541 edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract",
1542 "elm", _signal_contract, it);
1543 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_DOWN,
1545 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP,
1547 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_MOVE,
1549 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_DOWN,
1551 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_UP,
1553 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_MOVE,
1555 _item_cache_clean(it->wd);
1556 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1557 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1561 _item_cache_find(Elm_Gen_Item *it)
1566 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
1567 EINA_INLIST_FOREACH(it->wd->item_cache, itc)
1569 if ((itc->selected) || (itc->disabled) || (itc->expanded))
1571 if ((itc->tree == tree) &&
1572 (itc->compress == it->wd->compress) &&
1573 (!strcmp(it->itc->item_style, itc->item_style)))
1575 it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
1576 EINA_INLIST_GET(itc));
1577 it->wd->item_cache_count--;
1585 _elm_genlist_item_index_update(Elm_Gen_Item *it)
1587 if (it->position_update || it->item->block->position_update)
1589 evas_object_smart_callback_call(WIDGET(it), SIG_INDEX_UPDATE, it);
1590 it->position_update = EINA_FALSE;
1595 _elm_genlist_item_odd_even_update(Elm_Gen_Item *it)
1597 if (!it->item->nostacking)
1599 if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even)
1600 evas_object_lower(VIEW(it));
1602 evas_object_raise(VIEW(it));
1605 if (it->item->order_num_in & 0x1)
1606 edje_object_signal_emit(VIEW(it), "elm,state,odd", "elm");
1608 edje_object_signal_emit(VIEW(it), "elm,state,even", "elm");
1612 _elm_genlist_item_state_update(Elm_Gen_Item *it, Item_Cache *itc)
1616 if (it->selected != itc->selected)
1619 edje_object_signal_emit(VIEW(it),
1620 "elm,state,selected", "elm");
1622 if (elm_widget_item_disabled_get(it) != itc->disabled)
1624 if (elm_widget_item_disabled_get(it))
1625 edje_object_signal_emit(VIEW(it),
1626 "elm,state,disabled", "elm");
1628 if (it->item->expanded != itc->expanded)
1630 if (it->item->expanded)
1631 edje_object_signal_emit(VIEW(it),
1632 "elm,state,expanded", "elm");
1638 edje_object_signal_emit(VIEW(it),
1639 "elm,state,selected", "elm");
1640 if (elm_widget_item_disabled_get(it))
1641 edje_object_signal_emit(VIEW(it),
1642 "elm,state,disabled", "elm");
1643 if (it->item->expanded)
1644 edje_object_signal_emit(VIEW(it),
1645 "elm,state,expanded", "elm");
1650 _item_cache_free(Item_Cache *itc)
1652 if (itc->spacer) evas_object_del(itc->spacer);
1653 if (itc->base_view) evas_object_del(itc->base_view);
1654 if (itc->item_style) eina_stringshare_del(itc->item_style);
1659 _item_text_realize(Elm_Gen_Item *it,
1660 Evas_Object *target,
1664 if (it->itc->func.text_get)
1669 *source = elm_widget_stringlist_get(edje_object_data_get(target, "texts"));
1670 EINA_LIST_FOREACH(*source, l, key)
1672 if (parts && fnmatch(parts, key, FNM_PERIOD))
1675 char *s = it->itc->func.text_get
1676 ((void *)it->base.data, WIDGET(it), key);
1680 edje_object_part_text_set(target, key, s);
1685 edje_object_part_text_set(target, key, "");
1692 _item_content_unrealize(Elm_Gen_Item *it,
1693 Evas_Object *target,
1697 Eina_List *res = it->content_objs;
1699 if (it->itc->func.content_get)
1703 Evas_Object *ic = NULL;
1705 EINA_LIST_FOREACH(*source, l, key)
1707 if (parts && fnmatch(parts, key, FNM_PERIOD))
1710 ic = edje_object_part_swallow_get(target, key);
1713 res = eina_list_remove(res, ic);
1714 edje_object_part_unswallow(target, ic);
1715 evas_object_del(ic);
1724 _item_content_realize(Elm_Gen_Item *it,
1725 Evas_Object *target,
1729 Eina_List *res = NULL;
1731 if (it->itc->func.content_get)
1735 Evas_Object *ic = NULL;
1737 *source = elm_widget_stringlist_get(edje_object_data_get(target, "contents"));
1739 if (parts && (eina_list_count(*source) != eina_list_count(it->content_objs)))
1740 res = it->content_objs;
1742 EINA_LIST_FOREACH(*source, l, key)
1744 if (parts && fnmatch(parts, key, FNM_PERIOD))
1747 if (it->itc->func.content_get)
1748 ic = it->itc->func.content_get
1749 ((void *)it->base.data, WIDGET(it), key);
1752 res = eina_list_append(res, ic);
1753 edje_object_part_swallow(target, key, ic);
1754 evas_object_show(ic);
1755 elm_widget_sub_object_add(WIDGET(it), ic);
1756 if (elm_widget_item_disabled_get(it))
1757 elm_widget_disabled_set(ic, EINA_TRUE);
1766 _item_state_realize(Elm_Gen_Item *it,
1767 Evas_Object *target,
1771 if (it->itc->func.state_get)
1777 *source = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
1778 EINA_LIST_FOREACH(*source, l, key)
1780 if (parts && fnmatch(parts, key, FNM_PERIOD))
1783 Eina_Bool on = it->itc->func.state_get
1784 ((void *)it->base.data, WIDGET(it), key);
1788 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
1789 edje_object_signal_emit(target, buf, "elm");
1793 snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
1794 edje_object_signal_emit(target, buf, "elm");
1801 _item_realize(Elm_Gen_Item *it,
1805 const char *treesize;
1808 Item_Cache *itc = NULL;
1810 if (it->generation < it->wd->generation) return;
1811 //evas_event_freeze(evas_object_evas_get(it->wd->obj));
1814 if (it->item->order_num_in != in)
1816 it->item->order_num_in = in;
1817 _elm_genlist_item_odd_even_update(it);
1818 _elm_genlist_item_state_update(it, NULL);
1819 _elm_genlist_item_index_update(it);
1821 //evas_event_thaw(evas_object_evas_get(it->wd->obj));
1822 //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1825 it->item->order_num_in = in;
1827 if (it->item->nocache)
1828 it->item->nocache = EINA_FALSE;
1830 itc = _item_cache_find(it);
1833 VIEW(it) = itc->base_view;
1834 itc->base_view = NULL;
1835 it->spacer = itc->spacer;
1840 const char *stacking_even;
1841 const char *stacking;
1843 VIEW(it) = edje_object_add(evas_object_evas_get(WIDGET(it)));
1844 edje_object_scale_set(VIEW(it),
1845 elm_widget_scale_get(WIDGET(it)) *
1846 _elm_config->scale);
1847 evas_object_smart_member_add(VIEW(it), it->wd->pan_smart);
1848 elm_widget_sub_object_add(WIDGET(it), VIEW(it));
1850 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS)
1851 strncpy(buf, "tree", sizeof(buf));
1852 else strncpy(buf, "item", sizeof(buf));
1853 if (it->wd->compress)
1854 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
1856 strncat(buf, "/", sizeof(buf) - strlen(buf));
1857 strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf));
1859 _elm_theme_object_set(WIDGET(it), VIEW(it), "genlist", buf,
1860 elm_widget_style_get(WIDGET(it)));
1862 stacking_even = edje_object_data_get(VIEW(it), "stacking_even");
1863 if (!stacking_even) stacking_even = "above";
1864 it->item->stacking_even = !!strcmp("above", stacking_even);
1866 stacking = edje_object_data_get(VIEW(it), "stacking");
1867 if (!stacking) stacking = "yes";
1868 it->item->nostacking = !!strcmp("yes", stacking);
1870 edje_object_mirrored_set(VIEW(it),
1871 elm_widget_mirrored_get(WIDGET(it)));
1873 evas_object_rectangle_add(evas_object_evas_get(WIDGET(it)));
1874 evas_object_color_set(it->spacer, 0, 0, 0, 0);
1875 elm_widget_sub_object_add(WIDGET(it), it->spacer);
1878 _elm_genlist_item_odd_even_update(it);
1880 treesize = edje_object_data_get(VIEW(it), "treesize");
1881 if (treesize) tsize = atoi(treesize);
1882 evas_object_size_hint_min_set(it->spacer,
1883 (it->item->expanded_depth * tsize) * _elm_config->scale, 1);
1884 edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer);
1887 edje_object_signal_callback_add(VIEW(it),
1888 "elm,action,expand,toggle",
1889 "elm", _signal_expand_toggle, it);
1890 edje_object_signal_callback_add(VIEW(it), "elm,action,expand",
1891 "elm", _signal_expand, it);
1892 edje_object_signal_callback_add(VIEW(it), "elm,action,contract",
1893 "elm", _signal_contract, it);
1894 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN,
1896 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_UP,
1898 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
1900 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_DOWN,
1902 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_UP,
1904 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_MOVE,
1907 _elm_genlist_item_state_update(it, itc);
1908 _elm_genlist_item_index_update(it);
1911 if ((calc) && (it->wd->homogeneous) &&
1912 ((it->wd->item_width) ||
1913 ((it->wd->item_width) && (it->wd->group_item_width))))
1915 /* homogenous genlist shortcut */
1916 if (!it->item->mincalcd)
1920 it->item->w = it->item->minw = it->wd->group_item_width;
1921 it->item->h = it->item->minh = it->wd->group_item_height;
1925 it->item->w = it->item->minw = it->wd->item_width;
1926 it->item->h = it->item->minh = it->wd->item_height;
1928 it->item->mincalcd = EINA_TRUE;
1933 /* FIXME: If you see that assert, please notify us and we
1934 will clean our mess */
1935 assert(eina_list_count(it->content_objs) == 0);
1937 _item_text_realize(it, VIEW(it), &it->texts, NULL);
1938 it->content_objs = _item_content_realize(it, VIEW(it), &it->contents, NULL);
1939 _item_state_realize(it, VIEW(it), &it->states, NULL);
1941 if (!it->item->mincalcd)
1943 Evas_Coord mw = -1, mh = -1;
1945 if (!it->display_only)
1946 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1947 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
1948 edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw,
1950 if (!it->display_only)
1951 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1952 it->item->w = it->item->minw = mw;
1953 it->item->h = it->item->minh = mh;
1954 it->item->mincalcd = EINA_TRUE;
1956 if ((!it->wd->group_item_width) && (it->group))
1958 it->wd->group_item_width = mw;
1959 it->wd->group_item_height = mh;
1961 else if ((!it->wd->item_width) && (it->item->flags == ELM_GENLIST_ITEM_NONE))
1963 it->wd->item_width = mw;
1964 it->wd->item_height = mh;
1967 if (!calc) evas_object_show(VIEW(it));
1970 if (it->tooltip.content_cb)
1972 elm_widget_item_tooltip_content_cb_set(it,
1973 it->tooltip.content_cb,
1974 it->tooltip.data, NULL);
1975 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
1976 elm_widget_item_tooltip_window_mode_set(it, it->tooltip.free_size);
1979 if (it->mouse_cursor)
1980 elm_widget_item_cursor_set(it, it->mouse_cursor);
1982 it->realized = EINA_TRUE;
1983 it->want_unrealize = EINA_FALSE;
1985 if (itc) _item_cache_free(itc);
1986 //evas_event_thaw(evas_object_evas_get(it->wd->obj));
1987 //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1989 evas_object_smart_callback_call(WIDGET(it), SIG_REALIZED, it);
1990 edje_object_message_signal_process(VIEW(it));
1994 _item_unrealize_cb(Elm_Gen_Item *it)
1996 if (it->item->nocache)
1998 evas_object_del(VIEW(it));
2000 evas_object_del(it->spacer);
2005 edje_object_mirrored_set(VIEW(it),
2006 elm_widget_mirrored_get(WIDGET(it)));
2007 edje_object_scale_set(VIEW(it),
2008 elm_widget_scale_get(WIDGET(it))
2009 * _elm_config->scale);
2010 _item_cache_add(it);
2013 _mode_item_unrealize(it);
2015 it->realized = EINA_FALSE;
2016 it->want_unrealize = EINA_FALSE;
2020 _item_block_recalc(Item_Block *itb,
2026 Evas_Coord minw = 0, minh = 0;
2027 Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE;
2030 //evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2032 EINA_LIST_FOREACH(itb->items, l, it)
2034 if (it->generation < it->wd->generation) continue;
2035 showme |= it->item->showme;
2040 if (!it->item->mincalcd) changed = EINA_TRUE;
2043 _item_realize(it, in, EINA_TRUE);
2044 _elm_genlist_item_unrealize(it, EINA_TRUE);
2049 _item_realize(it, in, EINA_TRUE);
2050 _elm_genlist_item_unrealize(it, EINA_TRUE);
2054 _item_realize(it, in, EINA_FALSE);
2055 minh += it->item->minh;
2056 if (minw < it->item->minw) minw = it->item->minw;
2064 itb->changed = EINA_FALSE;
2065 itb->position_update = EINA_FALSE;
2066 //evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2067 //evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2072 _item_block_realize(Item_Block *itb)
2074 if (itb->realized) return;
2075 itb->realized = EINA_TRUE;
2076 itb->want_unrealize = EINA_FALSE;
2080 _item_block_unrealize(Item_Block *itb)
2084 Eina_Bool dragging = EINA_FALSE;
2086 if (!itb->realized) return;
2087 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2088 EINA_LIST_FOREACH(itb->items, l, it)
2090 if (itb->must_recalc || !it->group)
2094 dragging = EINA_TRUE;
2095 it->want_unrealize = EINA_TRUE;
2098 _elm_genlist_item_unrealize(it, EINA_FALSE);
2103 itb->realized = EINA_FALSE;
2104 itb->want_unrealize = EINA_TRUE;
2107 itb->want_unrealize = EINA_FALSE;
2108 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2109 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2113 _get_space_for_reorder_item(Elm_Gen_Item *it)
2115 Evas_Coord rox, roy, row, roh, oy, oh;
2116 Eina_Bool top = EINA_FALSE;
2117 Elm_Gen_Item *reorder_it = it->wd->reorder_it;
2118 if (!reorder_it) return 0;
2120 evas_object_geometry_get(it->wd->pan_smart, NULL, &oy, NULL, &oh);
2121 evas_object_geometry_get(it->wd->VIEW(reorder_it), &rox, &roy, &row, &roh);
2123 if ((it->wd->reorder_start_y < it->item->block->y) &&
2124 (roy - oy + (roh / 2) >= it->item->block->y - it->wd->pan_y))
2126 it->item->block->reorder_offset = it->wd->reorder_it->item->h * -1;
2127 if (it->item->block->count == 1)
2128 it->wd->reorder_rel = it;
2130 else if ((it->wd->reorder_start_y >= it->item->block->y) &&
2131 (roy - oy + (roh / 2) <= it->item->block->y - it->wd->pan_y))
2133 it->item->block->reorder_offset = it->wd->reorder_it->item->h;
2136 it->item->block->reorder_offset = 0;
2138 it->item->scrl_y += it->item->block->reorder_offset;
2140 top = (ELM_RECTS_INTERSECT(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h,
2141 rox, roy + (roh / 2), row, 1));
2144 it->wd->reorder_rel = it;
2145 it->item->scrl_y += it->wd->reorder_it->item->h;
2146 return it->wd->reorder_it->item->h;
2153 _reorder_move_animator_cb(void *data)
2155 Elm_Gen_Item *it = data;
2156 Eina_Bool down = EINA_FALSE;
2158 int y, dy = it->item->h / 10 * _elm_config->scale, diff;
2160 t = ((0.0 > (t = ecore_loop_time_get()-it->wd->start_time)) ? 0.0 : t);
2162 if (t <= REORDER_EFFECT_TIME) y = (1 * sin((t / REORDER_EFFECT_TIME) * (M_PI / 2)) * dy);
2165 diff = abs(it->item->old_scrl_y - it->item->scrl_y);
2166 if (diff > it->item->h) y = diff / 2;
2168 if (it->item->old_scrl_y < it->item->scrl_y)
2170 it->item->old_scrl_y += y;
2173 else if (it->item->old_scrl_y > it->item->scrl_y)
2175 it->item->old_scrl_y -= y;
2178 _item_position(it, VIEW(it), it->item->scrl_x, it->item->old_scrl_y);
2179 _group_items_recalc(it->wd);
2181 if ((it->wd->reorder_pan_move) ||
2182 (down && it->item->old_scrl_y >= it->item->scrl_y) ||
2183 (!down && it->item->old_scrl_y <= it->item->scrl_y))
2185 it->item->old_scrl_y = it->item->scrl_y;
2186 it->item->move_effect_enabled = EINA_FALSE;
2187 it->wd->reorder_move_animator = NULL;
2188 return ECORE_CALLBACK_CANCEL;
2190 return ECORE_CALLBACK_RENEW;
2194 _item_position(Elm_Gen_Item *it,
2202 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2203 evas_object_resize(view, it->item->w, it->item->h);
2204 evas_object_move(view, it_x, it_y);
2205 evas_object_show(view);
2206 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2207 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2211 _item_block_position(Item_Block *itb,
2217 Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2218 Eina_Bool vis = EINA_FALSE;
2220 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2221 evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh);
2222 evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy,
2224 EINA_LIST_FOREACH(itb->items, l, it)
2226 if (it->generation < it->wd->generation) continue;
2227 else if (it->wd->reorder_it == it) continue;
2230 it->item->w = itb->w;
2231 it->item->scrl_x = itb->x + it->x - it->wd->pan_x + ox;
2232 it->item->scrl_y = itb->y + it->y - it->wd->pan_y + oy;
2234 vis = (ELM_RECTS_INTERSECT(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h,
2235 cvx, cvy, cvw, cvh));
2238 if ((itb->realized) && (!it->realized))
2240 if (vis) _item_realize(it, in, EINA_FALSE);
2246 if (it->wd->reorder_mode)
2247 y += _get_space_for_reorder_item(it);
2248 git = it->item->group_item;
2251 if (git->item->scrl_y < oy)
2252 git->item->scrl_y = oy;
2253 if ((git->item->scrl_y + git->item->h) > (it->item->scrl_y + it->item->h))
2254 git->item->scrl_y = (it->item->scrl_y + it->item->h) - git->item->h;
2255 git->item->want_realize = EINA_TRUE;
2257 if ((it->wd->reorder_it) && (it->item->old_scrl_y != it->item->scrl_y))
2259 if (!it->item->move_effect_enabled)
2261 it->item->move_effect_enabled = EINA_TRUE;
2262 it->wd->reorder_move_animator =
2264 _reorder_move_animator_cb, it);
2267 if (!it->item->move_effect_enabled)
2269 if (it->item->mode_view)
2270 _item_position(it, it->item->mode_view, it->item->scrl_x,
2273 _item_position(it, VIEW(it), it->item->scrl_x,
2275 it->item->old_scrl_y = it->item->scrl_y;
2280 if (!it->dragging) _elm_genlist_item_unrealize(it, EINA_FALSE);
2287 if (vis) it->item->want_realize = EINA_TRUE;
2291 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2292 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2296 _group_items_recalc(void *data)
2298 Widget_Data *wd = data;
2302 evas_event_freeze(evas_object_evas_get(wd->obj));
2303 EINA_LIST_FOREACH(wd->group_items, l, git)
2305 if (git->item->want_realize)
2308 _item_realize(git, 0, EINA_FALSE);
2309 evas_object_resize(VIEW(git), wd->minw, git->item->h);
2310 evas_object_move(VIEW(git), git->item->scrl_x, git->item->scrl_y);
2311 evas_object_show(VIEW(git));
2312 evas_object_raise(VIEW(git));
2314 else if (!git->item->want_realize && git->realized)
2317 _elm_genlist_item_unrealize(git, EINA_FALSE);
2320 evas_event_thaw(evas_object_evas_get(wd->obj));
2321 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2325 _must_recalc_idler(void *data)
2327 Widget_Data *wd = data;
2328 if (wd->calc_job) ecore_job_del(wd->calc_job);
2329 wd->calc_job = ecore_job_add(_calc_job, wd);
2330 wd->must_recalc_idler = NULL;
2331 return ECORE_CALLBACK_CANCEL;
2335 _scroll_item(Widget_Data *wd)
2337 Elm_Gen_Item *it = NULL;
2338 Evas_Coord gith = 0;
2339 Evas_Coord ow, oh, dx = 0, dy = 0, dw = 0, dh = 0;
2341 evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &oh);
2343 dx = it->x + it->item->block->x;
2344 dy = it->y + it->item->block->y;
2345 dw = it->item->block->w;
2347 switch (wd->scrollto_type)
2349 case ELM_GENLIST_ITEM_SCROLLTO_TOP:
2350 if (it->item->group_item) gith = it->item->group_item->item->h;
2353 case ELM_GENLIST_ITEM_SCROLLTO_MIDDLE:
2354 dy += (it->item->h / 2 - oh / 2);
2356 case ELM_GENLIST_ITEM_SCROLLTO_IN:
2358 if ((wd->expanded_item) &&
2359 ((wd->show_item->y + wd->show_item->item->block->y + wd->show_item->item->h)
2360 - (wd->expanded_item->y + wd->expanded_item->item->block->y) > oh))
2362 it = wd->expanded_item;
2363 if (it->item->group_item) gith = it->item->group_item->item->h;
2364 dx = it->x + it->item->block->x;
2365 dy = it->y + it->item->block->y - gith;
2366 dw = it->item->block->w;
2370 if ((it->item->group_item) && (wd->pan_y > (it->y + it->item->block->y)))
2371 gith = it->item->group_item->item->h;
2378 elm_smart_scroller_region_bring_in(wd->scr, dx, dy, dw, dh);
2380 elm_smart_scroller_child_region_show(wd->scr, dx, dy, dw, dh);
2382 it->item->showme = EINA_FALSE;
2383 wd->show_item = NULL;
2384 wd->auto_scroll_enabled = EINA_FALSE;
2385 wd->check_scroll = EINA_FALSE;
2389 _calc_job(void *data)
2391 Widget_Data *wd = data;
2392 Item_Block *itb, *chb = NULL;
2393 Evas_Coord minw = -1, minh = 0, y = 0, ow, dy = 0;
2394 Evas_Coord pan_w = 0, pan_h = 0;
2396 Eina_Bool minw_change = EINA_FALSE;
2397 Eina_Bool did_must_recalc = EINA_FALSE;
2400 evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h);
2404 evas_event_freeze(evas_object_evas_get(wd->obj));
2405 EINA_INLIST_FOREACH(wd->blocks, itb)
2407 Eina_Bool showme = EINA_FALSE;
2410 showme = itb->showme;
2411 itb->showme = EINA_FALSE;
2414 if (itb->realized) _item_block_unrealize(itb);
2416 if ((itb->changed) || ((itb->must_recalc) && (!did_must_recalc)))
2418 if (itb->must_recalc)
2422 EINA_LIST_FOREACH(itb->items, l, it)
2423 if (it->item->mincalcd) it->item->mincalcd = EINA_FALSE;
2424 itb->changed = EINA_TRUE;
2425 if (itb->must_recalc) did_must_recalc = EINA_TRUE;
2426 if (itb->realized) _item_block_unrealize(itb);
2427 itb->must_recalc = EINA_FALSE;
2429 showme = _item_block_recalc(itb, in, EINA_FALSE);
2435 if (minw == -1) minw = itb->minw;
2436 else if ((!itb->must_recalc) && (minw < itb->minw))
2439 minw_change = EINA_TRUE;
2445 if ((showme) && (wd->show_item) && (!wd->show_item->item->queued))
2446 wd->check_scroll = EINA_TRUE;
2450 EINA_INLIST_FOREACH(wd->blocks, itb)
2456 if ((chb) && (EINA_INLIST_GET(chb)->next))
2458 EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb)
2460 if (itb->realized) _item_block_unrealize(itb);
2463 wd->realminw = minw;
2464 if (minw < wd->w) minw = wd->w;
2465 if ((minw != wd->minw) || (minh != wd->minh))
2469 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
2470 _sizing_eval(wd->obj);
2471 if ((wd->anchor_item) && (wd->anchor_item->item->block) && (!wd->auto_scroll_enabled))
2476 it = wd->anchor_item;
2477 it_y = wd->anchor_y;
2478 elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x,
2479 it->item->block->y + it->y + it_y);
2480 wd->anchor_item = it;
2481 wd->anchor_y = it_y;
2484 if (did_must_recalc)
2486 if (!wd->must_recalc_idler)
2487 wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd);
2489 if (wd->check_scroll)
2491 _pan_child_size_get(wd->pan_smart, &pan_w, &pan_h);
2492 if (EINA_INLIST_GET(wd->show_item) == wd->items->last)
2493 wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN;
2494 switch (wd->scrollto_type)
2496 case ELM_GENLIST_ITEM_SCROLLTO_TOP:
2499 case ELM_GENLIST_ITEM_SCROLLTO_MIDDLE:
2502 case ELM_GENLIST_ITEM_SCROLLTO_IN:
2507 if ((pan_w > (wd->show_item->x + wd->show_item->item->block->x)) &&
2508 (pan_h > (wd->show_item->y + wd->show_item->item->block->y + dy)))
2513 wd->calc_job = NULL;
2514 evas_object_smart_changed(wd->pan_smart);
2515 evas_event_thaw(evas_object_evas_get(wd->obj));
2516 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2520 _update_job(void *data)
2522 Widget_Data *wd = data;
2526 Eina_Bool position = EINA_FALSE, recalc = EINA_FALSE;
2528 wd->update_job = NULL;
2531 evas_event_freeze(evas_object_evas_get(wd->obj));
2532 EINA_INLIST_FOREACH(wd->blocks, itb)
2534 Evas_Coord itminw, itminh;
2541 _item_block_position(itb, num);
2545 recalc = EINA_FALSE;
2546 EINA_LIST_FOREACH(itb->items, l2, it)
2548 if (it->item->updateme)
2550 itminw = it->item->minw;
2551 itminh = it->item->minh;
2553 it->item->updateme = EINA_FALSE;
2556 _elm_genlist_item_unrealize(it, EINA_FALSE);
2557 _item_realize(it, num, EINA_FALSE);
2558 position = EINA_TRUE;
2562 _item_realize(it, num, EINA_TRUE);
2563 _elm_genlist_item_unrealize(it, EINA_TRUE);
2565 if ((it->item->minw != itminw) || (it->item->minh != itminh))
2570 itb->updateme = EINA_FALSE;
2573 position = EINA_TRUE;
2574 itb->changed = EINA_TRUE;
2575 _item_block_recalc(itb, num0, EINA_FALSE);
2576 _item_block_position(itb, num0);
2581 if (wd->calc_job) ecore_job_del(wd->calc_job);
2582 wd->calc_job = ecore_job_add(_calc_job, wd);
2584 evas_event_thaw(evas_object_evas_get(wd->obj));
2585 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2589 _pan_set(Evas_Object *obj,
2593 Pan *sd = evas_object_smart_data_get(obj);
2597 // Evas_Coord ow, oh;
2598 // evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2599 // ow = sd->wd->minw - ow;
2600 // if (ow < 0) ow = 0;
2601 // oh = sd->wd->minh - oh;
2602 // if (oh < 0) oh = 0;
2603 // if (x < 0) x = 0;
2604 // if (y < 0) y = 0;
2605 // if (x > ow) x = ow;
2606 // if (y > oh) y = oh;
2607 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
2611 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2613 if ((itb->y + itb->h) > y)
2618 EINA_LIST_FOREACH(itb->items, l2, it)
2620 if ((itb->y + it->y) >= y)
2622 sd->wd->anchor_item = it;
2623 sd->wd->anchor_y = -(itb->y + it->y - y);
2630 if (!sd->wd->reorder_move_animator) evas_object_smart_changed(obj);
2634 _pan_get(Evas_Object *obj,
2638 Pan *sd = evas_object_smart_data_get(obj);
2641 if (x) *x = sd->wd->pan_x;
2642 if (y) *y = sd->wd->pan_y;
2646 _pan_max_get(Evas_Object *obj,
2650 Pan *sd = evas_object_smart_data_get(obj);
2654 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2655 ow = sd->wd->minw - ow;
2657 oh = sd->wd->minh - oh;
2664 _pan_min_get(Evas_Object *obj __UNUSED__,
2673 _pan_child_size_get(Evas_Object *obj,
2677 Pan *sd = evas_object_smart_data_get(obj);
2680 if (w) *w = sd->wd->minw;
2681 if (h) *h = sd->wd->minh;
2685 _pan_add(Evas_Object *obj)
2688 Evas_Object_Smart_Clipped_Data *cd;
2691 cd = evas_object_smart_data_get(obj);
2694 sd->__clipped_data = *cd;
2696 evas_object_smart_data_set(obj, sd);
2700 _pan_del(Evas_Object *obj)
2702 Pan *sd = evas_object_smart_data_get(obj);
2707 ecore_job_del(sd->resize_job);
2708 sd->resize_job = NULL;
2714 _pan_resize_job(void *data)
2718 _sizing_eval(sd->wd->obj);
2719 sd->resize_job = NULL;
2723 _pan_resize(Evas_Object *obj,
2727 Pan *sd = evas_object_smart_data_get(obj);
2731 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2732 if ((ow == w) && (oh == h)) return;
2733 if ((sd->wd->height_for_width) && (ow != w))
2736 if (sd->resize_job) ecore_job_del(sd->resize_job);
2737 sd->resize_job = ecore_job_add(_pan_resize_job, sd);
2739 sd->wd->pan_changed = EINA_TRUE;
2740 evas_object_smart_changed(obj);
2741 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2742 sd->wd->calc_job = NULL;
2744 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2745 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2750 _pan_calculate(Evas_Object *obj)
2752 Pan *sd = evas_object_smart_data_get(obj);
2754 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2760 evas_event_freeze(evas_object_evas_get(obj));
2762 if (sd->wd->pan_changed)
2765 sd->wd->pan_changed = EINA_FALSE;
2768 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
2769 evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
2770 EINA_LIST_FOREACH(sd->wd->group_items, l, git)
2772 git->item->want_realize = EINA_FALSE;
2774 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2776 itb->w = sd->wd->minw;
2777 if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox,
2778 itb->y - sd->wd->pan_y + oy,
2780 cvx, cvy, cvw, cvh))
2782 if ((!itb->realized) || (itb->changed))
2783 _item_block_realize(itb);
2784 _item_block_position(itb, in);
2788 if (itb->realized) _item_block_unrealize(itb);
2792 if ((!sd->wd->reorder_it) || (sd->wd->reorder_pan_move))
2793 _group_items_recalc(sd->wd);
2794 if ((sd->wd->reorder_mode) && (sd->wd->reorder_it))
2796 if (sd->wd->pan_y != sd->wd->reorder_old_pan_y)
2797 sd->wd->reorder_pan_move = EINA_TRUE;
2798 else sd->wd->reorder_pan_move = EINA_FALSE;
2799 evas_object_raise(sd->wd->VIEW(reorder_it));
2800 sd->wd->reorder_old_pan_y = sd->wd->pan_y;
2801 sd->wd->start_time = ecore_loop_time_get();
2803 _item_auto_scroll(sd->wd);
2804 evas_event_thaw(evas_object_evas_get(obj));
2805 evas_event_thaw_eval(evas_object_evas_get(obj));
2809 _pan_move(Evas_Object *obj,
2810 Evas_Coord x __UNUSED__,
2811 Evas_Coord y __UNUSED__)
2813 Pan *sd = evas_object_smart_data_get(obj);
2817 sd->wd->pan_changed = EINA_TRUE;
2818 evas_object_smart_changed(obj);
2819 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2820 sd->wd->calc_job = NULL;
2824 _hold_on(void *data __UNUSED__,
2826 void *event_info __UNUSED__)
2828 Widget_Data *wd = elm_widget_data_get(obj);
2830 elm_smart_scroller_hold_set(wd->scr, 1);
2834 _hold_off(void *data __UNUSED__,
2836 void *event_info __UNUSED__)
2838 Widget_Data *wd = elm_widget_data_get(obj);
2840 elm_smart_scroller_hold_set(wd->scr, 0);
2844 _freeze_on(void *data __UNUSED__,
2846 void *event_info __UNUSED__)
2848 Widget_Data *wd = elm_widget_data_get(obj);
2850 elm_smart_scroller_freeze_set(wd->scr, 1);
2854 _freeze_off(void *data __UNUSED__,
2856 void *event_info __UNUSED__)
2858 Widget_Data *wd = elm_widget_data_get(obj);
2860 elm_smart_scroller_freeze_set(wd->scr, 0);
2864 _scr_anim_start(void *data,
2865 Evas_Object *obj __UNUSED__,
2866 void *event_info __UNUSED__)
2868 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL);
2872 _scr_anim_stop(void *data,
2873 Evas_Object *obj __UNUSED__,
2874 void *event_info __UNUSED__)
2876 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL);
2880 _scr_drag_start(void *data,
2881 Evas_Object *obj __UNUSED__,
2882 void *event_info __UNUSED__)
2884 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
2888 _scr_drag_stop(void *data,
2889 Evas_Object *obj __UNUSED__,
2890 void *event_info __UNUSED__)
2892 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
2896 _edge_left(void *data,
2897 Evas_Object *scr __UNUSED__,
2898 void *event_info __UNUSED__)
2900 Evas_Object *obj = data;
2901 evas_object_smart_callback_call(obj, SIG_EDGE_LEFT, NULL);
2905 _edge_right(void *data,
2906 Evas_Object *scr __UNUSED__,
2907 void *event_info __UNUSED__)
2909 Evas_Object *obj = data;
2910 evas_object_smart_callback_call(obj, SIG_EDGE_RIGHT, NULL);
2914 _edge_top(void *data,
2915 Evas_Object *scr __UNUSED__,
2916 void *event_info __UNUSED__)
2918 Evas_Object *obj = data;
2919 evas_object_smart_callback_call(obj, SIG_EDGE_TOP, NULL);
2923 _edge_bottom(void *data,
2924 Evas_Object *scr __UNUSED__,
2925 void *event_info __UNUSED__)
2927 Evas_Object *obj = data;
2928 evas_object_smart_callback_call(obj, SIG_EDGE_BOTTOM, NULL);
2932 _mode_item_realize(Elm_Gen_Item *it)
2936 if ((it->item->mode_view) || (it->generation < it->wd->generation)) return;
2938 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2939 it->item->mode_view = edje_object_add(evas_object_evas_get(WIDGET(it)));
2940 edje_object_scale_set(it->item->mode_view,
2941 elm_widget_scale_get(WIDGET(it)) *
2942 _elm_config->scale);
2943 evas_object_smart_member_add(it->item->mode_view, it->wd->pan_smart);
2944 elm_widget_sub_object_add(WIDGET(it), it->item->mode_view);
2946 strncpy(buf, "item", sizeof(buf));
2947 if (it->wd->compress)
2948 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
2950 if (it->item->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
2951 strncat(buf, "/", sizeof(buf) - strlen(buf));
2952 strncat(buf, it->wd->mode_item_style, sizeof(buf) - strlen(buf));
2954 _elm_theme_object_set(WIDGET(it), it->item->mode_view, "genlist", buf,
2955 elm_widget_style_get(WIDGET(it)));
2956 edje_object_mirrored_set(it->item->mode_view,
2957 elm_widget_mirrored_get(WIDGET(it)));
2959 /* signal callback add */
2960 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_DOWN,
2962 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_UP,
2964 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_MOVE,
2967 /* text_get, content_get, state_get */
2968 /* FIXME: If you see that assert, please notify us and we
2969 will clean our mess */
2970 assert(eina_list_count(it->item->mode_content_objs) == 0);
2972 _item_text_realize(it, it->item->mode_view, &it->item->mode_texts, NULL);
2973 it->item->mode_content_objs =
2974 _item_content_realize(it, it->item->mode_view,
2975 &it->item->mode_contents, NULL);
2976 _item_state_realize(it, it->item->mode_view, &it->item->mode_states, NULL);
2978 edje_object_part_swallow(it->item->mode_view,
2979 edje_object_data_get(it->item->mode_view, "mode_part"),
2982 it->want_unrealize = EINA_FALSE;
2983 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2984 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2988 _mode_item_unrealize(Elm_Gen_Item *it)
2990 Widget_Data *wd = it->wd;
2991 Evas_Object *content;
2992 if (!it->item->mode_view) return;
2994 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2995 elm_widget_stringlist_free(it->item->mode_texts);
2996 it->item->mode_texts = NULL;
2997 elm_widget_stringlist_free(it->item->mode_contents);
2998 it->item->mode_contents = NULL;
2999 elm_widget_stringlist_free(it->item->mode_states);
3001 EINA_LIST_FREE(it->item->mode_content_objs, content)
3002 evas_object_del(content);
3004 edje_object_part_unswallow(it->item->mode_view, VIEW(it));
3005 evas_object_smart_member_add(VIEW(it), wd->pan_smart);
3006 evas_object_del(it->item->mode_view);
3007 it->item->mode_view = NULL;
3009 if (wd->mode_item == it)
3010 wd->mode_item = NULL;
3011 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3012 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3016 _item_mode_set(Elm_Gen_Item *it)
3019 Widget_Data *wd = it->wd;
3024 it->item->nocache = EINA_TRUE;
3026 if (wd->scr_hold_timer)
3028 ecore_timer_del(wd->scr_hold_timer);
3029 wd->scr_hold_timer = NULL;
3031 elm_smart_scroller_hold_set(wd->scr, EINA_TRUE);
3032 wd->scr_hold_timer = ecore_timer_add(0.1, _scr_hold_timer_cb, wd);
3034 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3035 _mode_item_realize(it);
3036 if (it->item->group_item)
3037 evas_object_raise(it->item->VIEW(group_item));
3038 _item_position(it, it->item->mode_view, it->item->scrl_x, it->item->scrl_y);
3039 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3040 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3042 snprintf(buf, sizeof(buf), "elm,state,%s,active", wd->mode_type);
3043 edje_object_signal_emit(it->item->mode_view, buf, "elm");
3047 _item_mode_unset(Widget_Data *wd)
3050 if (!wd->mode_item) return;
3051 char buf[1024], buf2[1024];
3055 it->item->nocache = EINA_TRUE;
3057 snprintf(buf, sizeof(buf), "elm,state,%s,passive", wd->mode_type);
3058 snprintf(buf2, sizeof(buf2), "elm,state,%s,passive,finished", wd->mode_type);
3060 edje_object_signal_emit(it->item->mode_view, buf, "elm");
3061 edje_object_signal_callback_add(it->item->mode_view, buf2, "elm", _mode_finished_signal_cb, it);
3063 wd->mode_item = NULL;
3067 _item_auto_scroll(Widget_Data *wd)
3070 Elm_Gen_Item *tmp_item = NULL;
3072 if ((wd->expanded_item) && (wd->auto_scroll_enabled))
3074 tmp_item = eina_list_data_get(eina_list_last(wd->expanded_item->item->items));
3075 if (!tmp_item) return;
3076 wd->show_item = tmp_item;
3077 wd->bring_in = EINA_TRUE;
3078 wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN;
3079 if ((wd->show_item->item->queued) || (!wd->show_item->item->mincalcd))
3081 wd->show_item->item->showme = EINA_TRUE;
3082 wd->auto_scroll_enabled = EINA_FALSE;
3090 elm_genlist_add(Evas_Object *parent)
3095 Evas_Coord minw, minh;
3096 static Evas_Smart *smart = NULL;
3100 static Evas_Smart_Class sc;
3102 evas_object_smart_clipped_smart_set(&_pan_sc);
3104 sc.name = "elm_genlist_pan";
3105 sc.version = EVAS_SMART_CLASS_VERSION;
3108 sc.resize = _pan_resize;
3109 sc.move = _pan_move;
3110 sc.calculate = _pan_calculate;
3111 if (!(smart = evas_smart_class_new(&sc))) return NULL;
3114 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
3116 ELM_SET_WIDTYPE(widtype, "genlist");
3118 elm_widget_type_set(obj, "genlist");
3119 elm_widget_sub_object_add(parent, obj);
3120 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
3121 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
3122 elm_widget_data_set(obj, wd);
3123 elm_widget_del_hook_set(obj, _del_hook);
3124 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
3125 elm_widget_theme_hook_set(obj, _theme_hook);
3126 elm_widget_can_focus_set(obj, EINA_TRUE);
3127 elm_widget_event_hook_set(obj, _event_hook);
3128 elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
3129 elm_widget_translate_hook_set(obj, _translate_hook);
3132 wd->scr = elm_smart_scroller_add(e);
3133 elm_smart_scroller_widget_set(wd->scr, obj);
3134 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
3135 elm_widget_style_get(obj));
3136 elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE,
3137 _elm_config->thumbscroll_bounce_enable);
3138 elm_widget_resize_object_set(obj, wd->scr);
3140 evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj);
3141 evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, obj);
3142 evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj);
3143 evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj);
3144 evas_object_smart_callback_add(wd->scr, "edge,left", _edge_left, obj);
3145 evas_object_smart_callback_add(wd->scr, "edge,right", _edge_right, obj);
3146 evas_object_smart_callback_add(wd->scr, "edge,top", _edge_top, obj);
3147 evas_object_smart_callback_add(wd->scr, "edge,bottom", _edge_bottom, obj);
3150 wd->mode = ELM_LIST_SCROLL;
3151 wd->max_items_per_block = MAX_ITEMS_PER_BLOCK;
3152 wd->item_cache_max = wd->max_items_per_block * 2;
3153 wd->longpress_timeout = _elm_config->longpress_timeout;
3155 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
3156 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
3157 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
3158 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
3160 wd->pan_smart = evas_object_smart_add(e, smart);
3161 wd->pan = evas_object_smart_data_get(wd->pan_smart);
3164 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
3165 _pan_set, _pan_get, _pan_max_get,
3166 _pan_min_get, _pan_child_size_get);
3168 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
3170 evas_object_size_hint_min_set(obj, minw, minh);
3172 evas_object_smart_callbacks_descriptions_set(obj, _signals);
3174 _mirrored_set(obj, elm_widget_mirrored_get(obj));
3180 _item_select(Elm_Gen_Item *it)
3182 if ((it->wd->no_select) || (it->generation < it->wd->generation) || (it->mode_set)) return;
3185 it->selected = EINA_TRUE;
3186 it->wd->selected = eina_list_append(it->wd->selected, it);
3188 else if (!it->wd->always_select) return;
3190 evas_object_ref(WIDGET(it));
3193 if (it->func.func) it->func.func((void *)it->func.data, WIDGET(it), it);
3194 if (it->generation == it->wd->generation)
3195 evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, it);
3198 evas_object_unref(WIDGET(it));
3199 if ((it->wd->clear_me) && (!it->wd->walking))
3200 _elm_genlist_clear(WIDGET(it), EINA_TRUE);
3203 if ((!it->walking) && (it->generation < it->wd->generation))
3208 elm_widget_item_free(it);
3212 it->wd->last_selected_item = (Elm_Object_Item *) it;
3216 static Evas_Object *
3217 _item_content_get_hook(Elm_Gen_Item *it, const char *part)
3219 return edje_object_part_swallow_get(VIEW(it), part);
3223 _item_content_set_hook(Elm_Gen_Item *it, const char *part, Evas_Object *content)
3225 edje_object_part_swallow(VIEW(it), part, content);
3228 static Evas_Object *
3229 _item_content_unset_hook(Elm_Gen_Item *it, const char *part)
3233 obj = edje_object_part_swallow_get(VIEW(it), part);
3234 if (!obj) return NULL;
3235 edje_object_part_unswallow(VIEW(it), obj);
3240 _item_text_hook(Elm_Gen_Item *it, const char *part)
3242 if (!it->itc->func.text_get) return NULL;
3243 return edje_object_part_text_get(VIEW(it), part);
3247 _item_disable_hook(Elm_Object_Item *it)
3249 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
3252 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
3254 if (_it->generation < _it->wd->generation) return;
3257 elm_genlist_item_selected_set(it, EINA_FALSE);
3261 if (elm_widget_item_disabled_get(it))
3262 edje_object_signal_emit(VIEW(_it), "elm,state,disabled", "elm");
3264 edje_object_signal_emit(VIEW(_it), "elm,state,enabled", "elm");
3265 EINA_LIST_FOREACH(_it->content_objs, l, obj)
3266 elm_widget_disabled_set(obj, elm_widget_item_disabled_get(_it));
3271 _item_del_pre_hook(Elm_Object_Item *it)
3273 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
3274 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
3276 if ((_it->relcount > 0) || (_it->walking > 0))
3278 elm_genlist_item_subitems_clear(it);
3279 if (_it->wd->show_item == _it) _it->wd->show_item = NULL;
3280 _elm_genlist_item_del_notserious(_it);
3281 if (_it->item->block)
3283 if (_it->realized) _elm_genlist_item_unrealize(_it, EINA_FALSE);
3284 _it->item->block->changed = EINA_TRUE;
3285 if (_it->wd->calc_job) ecore_job_del(_it->wd->calc_job);
3286 _it->wd->calc_job = ecore_job_add(_calc_job, _it->wd);
3290 _it->parent->item->items =
3291 eina_list_remove(_it->parent->item->items, it);
3301 _elm_genlist_item_new(Widget_Data *wd,
3302 const Elm_Gen_Item_Class *itc,
3304 Elm_Gen_Item *parent,
3306 const void *func_data)
3310 it = elm_widget_item_new(wd->obj, Elm_Gen_Item);
3311 if (!it) return NULL;
3313 it->generation = wd->generation;
3315 it->base.data = data;
3316 it->parent = parent;
3317 it->func.func = func;
3318 it->func.data = func_data;
3319 elm_widget_item_content_get_hook_set(it, _item_content_get_hook);
3320 elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
3321 elm_widget_item_content_unset_hook_set(it, _item_content_unset_hook);
3322 elm_widget_item_disable_hook_set(it, _item_disable_hook);
3323 elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
3325 it->sel_cb = (Ecore_Cb)_item_select;
3327 elm_widget_item_text_get_hook_set(it, _item_text_hook);
3331 static Elm_Gen_Item *
3332 _item_new(Widget_Data *wd,
3333 const Elm_Genlist_Item_Class *itc,
3335 Elm_Gen_Item *parent,
3336 Elm_Genlist_Item_Flags flags,
3338 const void *func_data)
3340 Elm_Gen_Item *it, *it2;
3343 it = _elm_genlist_item_new(wd, itc, data, parent, func, func_data);
3344 if (!it) return NULL;
3345 it->item = ELM_NEW(Elm_Gen_Item_Type);
3346 it->item->flags = flags;
3347 if (flags & ELM_GENLIST_ITEM_GROUP) it->group++;
3348 it->item->expanded_depth = 0;
3349 ELM_GEN_ITEM_SETUP(it);
3352 if (it->parent->group)
3353 it->item->group_item = parent;
3354 else if (it->parent->item->group_item)
3355 it->item->group_item = it->parent->item->group_item;
3357 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
3359 if (!it2->parent->group) depth += 1;
3361 it->item->expanded_depth = depth;
3366 _item_block_new(Widget_Data *wd, Eina_Bool prepend)
3370 itb = calloc(1, sizeof(Item_Block));
3371 if (!itb) return NULL;
3375 wd->blocks = eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
3376 _item_block_position_update(wd->blocks, 0);
3380 wd->blocks = eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3381 itb->position_update = EINA_TRUE;
3382 if (wd->blocks != EINA_INLIST_GET(itb))
3384 itb->position = ((Item_Block *) (EINA_INLIST_GET(itb)->prev))->position + 1;
3395 _item_block_add(Widget_Data *wd,
3398 Item_Block *itb = NULL;
3405 itb = calloc(1, sizeof(Item_Block));
3406 if (!itb) return EINA_FALSE;
3408 if (!it->item->rel->item->block)
3411 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3412 itb->items = eina_list_append(itb->items, it);
3413 itb->position_update = EINA_TRUE;
3414 it->position = eina_list_count(itb->items);
3415 it->position_update = EINA_TRUE;
3417 if (wd->blocks != EINA_INLIST_GET(itb))
3419 itb->position = ((Item_Block *) (EINA_INLIST_GET(itb)->prev))->position + 1;
3430 tmp = eina_list_data_find_list(itb->items, it->item->rel);
3431 if (it->item->before)
3433 wd->blocks = eina_inlist_prepend_relative
3434 (wd->blocks, EINA_INLIST_GET(itb),
3435 EINA_INLIST_GET(it->item->rel->item->block));
3437 eina_list_prepend_relative_list(itb->items, it, tmp);
3439 /* Update index from where we prepended */
3440 _item_position_update(eina_list_prev(tmp), it->item->rel->position);
3441 _item_block_position_update(EINA_INLIST_GET(itb),
3442 it->item->rel->item->block->position);
3446 wd->blocks = eina_inlist_append_relative
3447 (wd->blocks, EINA_INLIST_GET(itb),
3448 EINA_INLIST_GET(it->item->rel->item->block));
3450 eina_list_append_relative_list(itb->items, it, tmp);
3452 /* Update block index from where we appended */
3453 _item_position_update(eina_list_next(tmp), it->item->rel->position + 1);
3454 _item_block_position_update(EINA_INLIST_GET(itb),
3455 it->item->rel->item->block->position + 1);
3461 if (it->item->before)
3465 itb = (Item_Block *)(wd->blocks);
3466 if (itb->count >= wd->max_items_per_block)
3468 itb = _item_block_new(wd, EINA_TRUE);
3469 if (!itb) return EINA_FALSE;
3474 itb = _item_block_new(wd, EINA_TRUE);
3475 if (!itb) return EINA_FALSE;
3477 itb->items = eina_list_prepend(itb->items, it);
3479 _item_position_update(itb->items, 0);
3485 itb = (Item_Block *)(wd->blocks->last);
3486 if (itb->count >= wd->max_items_per_block)
3488 itb = _item_block_new(wd, EINA_FALSE);
3489 if (!itb) return EINA_FALSE;
3494 itb = _item_block_new(wd, EINA_FALSE);
3495 if (!itb) return EINA_FALSE;
3497 itb->items = eina_list_append(itb->items, it);
3498 it->position = eina_list_count(itb->items);
3506 if (it->item->rel->item->queued)
3508 /* NOTE: for a strange reason eina_list and eina_inlist don't have the same property
3509 on sorted insertion order, so the queue is not always ordered like the item list.
3510 This lead to issue where we depend on an item that is not yet created. As a quick
3511 work around, we reschedule the calc of the item and stop reordering the list to
3512 prevent any nasty issue to show up here.
3514 wd->queue = eina_list_append(wd->queue, it);
3515 wd->requeued = EINA_TRUE;
3516 it->item->queued = EINA_TRUE;
3519 itb = it->item->rel->item->block;
3520 if (!itb) goto newblock;
3521 tmp = eina_list_data_find_list(itb->items, it->item->rel);
3522 if (it->item->before)
3524 itb->items = eina_list_prepend_relative_list(itb->items, it, tmp);
3525 _item_position_update(eina_list_prev(tmp), it->item->rel->position);
3529 itb->items = eina_list_append_relative_list(itb->items, it, tmp);
3530 _item_position_update(eina_list_next(tmp), it->item->rel->position + 1);
3534 itb->changed = EINA_TRUE;
3535 it->item->block = itb;
3536 if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job);
3537 itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd);
3540 it->item->rel->relcount--;
3541 if ((it->item->rel->generation < it->wd->generation) && (!it->item->rel->relcount))
3543 _item_del(it->item->rel);
3544 elm_widget_item_free(it->item->rel);
3546 it->item->rel = NULL;
3548 if (itb->count > itb->wd->max_items_per_block)
3553 Eina_Bool done = EINA_FALSE;
3555 newc = itb->count / 2;
3557 if (EINA_INLIST_GET(itb)->prev)
3559 Item_Block *itbp = (Item_Block *)(EINA_INLIST_GET(itb)->prev);
3561 if (itbp->count + newc < wd->max_items_per_block / 2)
3563 /* moving items to previous block */
3564 while ((itb->count > newc) && (itb->items))
3566 it2 = eina_list_data_get(itb->items);
3567 itb->items = eina_list_remove_list(itb->items, itb->items);
3570 itbp->items = eina_list_append(itbp->items, it2);
3571 it2->item->block = itbp;
3579 if (!done && EINA_INLIST_GET(itb)->next)
3581 Item_Block *itbn = (Item_Block *)(EINA_INLIST_GET(itb)->next);
3583 if (itbn->count + newc < wd->max_items_per_block / 2)
3585 /* moving items to next block */
3586 while ((itb->count > newc) && (itb->items))
3590 l = eina_list_last(itb->items);
3591 it2 = eina_list_data_get(l);
3592 itb->items = eina_list_remove_list(itb->items, l);
3595 itbn->items = eina_list_prepend(itbn->items, it2);
3596 it2->item->block = itbn;
3606 /* moving items to new block */
3607 itb2 = calloc(1, sizeof(Item_Block));
3608 if (!itb2) return EINA_FALSE;
3611 eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
3612 EINA_INLIST_GET(itb));
3613 itb2->changed = EINA_TRUE;
3614 while ((itb->count > newc) && (itb->items))
3618 l = eina_list_last(itb->items);
3620 itb->items = eina_list_remove_list(itb->items, l);
3623 itb2->items = eina_list_prepend(itb2->items, it2);
3624 it2->item->block = itb2;
3634 _queue_process(Widget_Data *wd)
3637 Eina_Bool showme = EINA_FALSE;
3640 t0 = ecore_loop_time_get();
3641 //evas_event_freeze(evas_object_evas_get(wd->obj));
3642 for (n = 0; (wd->queue) && (n < 128); n++)
3646 it = eina_list_data_get(wd->queue);
3647 wd->queue = eina_list_remove_list(wd->queue, wd->queue);
3648 it->item->queued = EINA_FALSE;
3649 if (!_item_block_add(wd, it)) continue;
3651 _item_block_realize(it->item->block);
3652 t = ecore_time_get();
3653 if (it->item->block->changed)
3655 showme = _item_block_recalc(it->item->block, it->item->block->num, EINA_TRUE);
3656 it->item->block->changed = 0;
3657 if (wd->pan_changed)
3659 if (wd->calc_job) ecore_job_del(wd->calc_job);
3660 wd->calc_job = NULL;
3662 wd->pan_changed = EINA_FALSE;
3665 if (showme) it->item->block->showme = EINA_TRUE;
3666 /* same as eina_inlist_count > 1 */
3667 if (wd->blocks && wd->blocks->next)
3669 if ((t - t0) > (ecore_animator_frametime_get())) break;
3672 //evas_event_thaw(evas_object_evas_get(wd->obj));
3673 //evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3678 _idle_process(void *data, Eina_Bool *wakeup)
3680 Widget_Data *wd = data;
3683 //static double q_start = 0.0;
3684 //if (q_start == 0.0) q_start = ecore_time_get();
3686 if (_queue_process(wd) > 0) *wakeup = EINA_TRUE;
3690 //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start);
3692 return ECORE_CALLBACK_CANCEL;
3694 return ECORE_CALLBACK_RENEW;
3698 _item_idle_enterer(void *data)
3700 Widget_Data *wd = data;
3701 Eina_Bool wakeup = EINA_FALSE;
3702 Eina_Bool ok = _idle_process(data, &wakeup);
3707 if (wd->calc_job) ecore_job_del(wd->calc_job);
3708 wd->calc_job = ecore_job_add(_calc_job, wd);
3710 if (ok == ECORE_CALLBACK_CANCEL) wd->queue_idle_enterer = NULL;
3715 _item_queue(Widget_Data *wd,
3719 if (it->item->queued) return;
3720 it->item->queued = EINA_TRUE;
3721 if (cb && !wd->requeued)
3722 wd->queue = eina_list_sorted_insert(wd->queue, cb, it);
3724 wd->queue = eina_list_append(wd->queue, it);
3725 // FIXME: why does a freeze then thaw here cause some genlist
3726 // elm_genlist_item_append() to be much much slower?
3727 // evas_event_freeze(evas_object_evas_get(wd->obj));
3728 while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
3730 if (wd->queue_idle_enterer)
3732 ecore_idle_enterer_del(wd->queue_idle_enterer);
3733 wd->queue_idle_enterer = NULL;
3737 // evas_event_thaw(evas_object_evas_get(wd->obj));
3738 // evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3739 if (!wd->queue_idle_enterer)
3740 wd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, wd);
3744 _elm_genlist_item_compare_data(const void *data, const void *data1)
3746 const Elm_Gen_Item *it = data;
3747 const Elm_Gen_Item *item1 = data1;
3749 return it->wd->item_compare_data_cb(it->base.data, item1->base.data);
3753 _elm_genlist_item_compare(const void *data, const void *data1)
3755 const Elm_Gen_Item *it, *item1;
3756 it = ELM_GEN_ITEM_FROM_INLIST(data);
3757 item1 = ELM_GEN_ITEM_FROM_INLIST(data1);
3758 return it->wd->item_compare_cb(it, item1);
3762 _elm_genlist_item_list_compare(const void *data, const void *data1)
3764 const Elm_Gen_Item *it = data;
3765 const Elm_Gen_Item *item1 = data1;
3766 return it->wd->item_compare_cb(it, item1);
3770 _item_move_after(Elm_Gen_Item *it, Elm_Gen_Item *after)
3775 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3776 _item_block_del(it);
3778 it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
3779 it->item->rel = after;
3780 it->item->rel->relcount++;
3781 it->item->before = EINA_FALSE;
3782 if (after->item->group_item) it->item->group_item = after->item->group_item;
3783 _item_queue(it->wd, it, NULL);
3785 evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it);
3789 _item_move_before(Elm_Gen_Item *it, Elm_Gen_Item *before)
3792 if (!before) return;
3794 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3795 _item_block_del(it);
3796 it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
3797 it->item->rel = before;
3798 it->item->rel->relcount++;
3799 it->item->before = EINA_TRUE;
3800 if (before->item->group_item) it->item->group_item = before->item->group_item;
3801 _item_queue(it->wd, it, NULL);
3803 evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it);
3806 EAPI Elm_Object_Item *
3807 elm_genlist_item_append(Evas_Object *obj,
3808 const Elm_Genlist_Item_Class *itc,
3810 Elm_Object_Item *parent,
3811 Elm_Genlist_Item_Flags flags,
3813 const void *func_data)
3815 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3816 Widget_Data *wd = elm_widget_data_get(obj);
3817 if (!wd) return NULL;
3818 Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, flags,
3820 if (!it) return NULL;
3824 wd->group_items = eina_list_append(wd->group_items, it);
3825 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
3826 it->item->rel = NULL;
3830 Elm_Gen_Item *it2 = NULL;
3831 Eina_List *ll = eina_list_last(it->parent->item->items);
3832 if (ll) it2 = ll->data;
3833 it->parent->item->items = eina_list_append(it->parent->item->items, it);
3834 if (!it2) it2 = it->parent;
3836 eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3837 EINA_INLIST_GET(it2));
3838 it->item->rel = it2;
3839 it->item->rel->relcount++;
3841 it->item->before = EINA_FALSE;
3842 _item_queue(wd, it, NULL);
3843 return (Elm_Object_Item *) it;
3846 EAPI Elm_Object_Item *
3847 elm_genlist_item_prepend(Evas_Object *obj,
3848 const Elm_Genlist_Item_Class *itc,
3850 Elm_Object_Item *parent,
3851 Elm_Genlist_Item_Flags flags,
3853 const void *func_data)
3855 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3856 Widget_Data *wd = elm_widget_data_get(obj);
3857 if (!wd) return NULL;
3858 Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, flags,
3860 if (!it) return NULL;
3864 wd->group_items = eina_list_prepend(wd->group_items, it);
3865 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
3866 it->item->rel = NULL;
3870 Elm_Gen_Item *it2 = NULL;
3871 Eina_List *ll = it->parent->item->items;
3872 if (ll) it2 = ll->data;
3873 it->parent->item->items = eina_list_prepend(it->parent->item->items, it);
3874 if (!it2) it2 = it->parent;
3876 eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3877 EINA_INLIST_GET(it2));
3878 it->item->rel = it2;
3879 it->item->rel->relcount++;
3881 it->item->before = EINA_TRUE;
3882 _item_queue(wd, it, NULL);
3883 return (Elm_Object_Item *) it;
3886 EAPI Elm_Object_Item *
3887 elm_genlist_item_insert_after(Evas_Object *obj,
3888 const Elm_Genlist_Item_Class *itc,
3890 Elm_Object_Item *parent,
3891 Elm_Object_Item *after,
3892 Elm_Genlist_Item_Flags flags,
3894 const void *func_data)
3896 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3897 ELM_OBJ_ITEM_CHECK_OR_RETURN(after, NULL);
3898 Widget_Data *wd = elm_widget_data_get(obj);
3899 Elm_Gen_Item *_after = (Elm_Gen_Item *) after;
3900 if (!wd) return NULL;
3901 /* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */
3902 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3904 Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, flags,
3906 if (!it) return NULL;
3909 if ((it->group) && (_after->group))
3910 wd->group_items = eina_list_append_relative(wd->group_items, it,
3915 it->parent->item->items =
3916 eina_list_append_relative(it->parent->item->items, it, _after);
3918 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3919 EINA_INLIST_GET(_after));
3920 it->item->rel = _after;
3921 it->item->rel->relcount++;
3922 it->item->before = EINA_FALSE;
3923 _item_queue(wd, it, NULL);
3924 return (Elm_Object_Item *) it;
3927 EAPI Elm_Object_Item *
3928 elm_genlist_item_insert_before(Evas_Object *obj,
3929 const Elm_Genlist_Item_Class *itc,
3931 Elm_Object_Item *parent,
3932 Elm_Object_Item *before,
3933 Elm_Genlist_Item_Flags flags,
3935 const void *func_data)
3937 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3938 ELM_OBJ_ITEM_CHECK_OR_RETURN(before, NULL);
3939 Widget_Data *wd = elm_widget_data_get(obj);
3940 Elm_Gen_Item *_before = (Elm_Gen_Item *) before;
3941 if (!wd) return NULL;
3942 /* It makes no sense to insert before in an empty list with before != NULL, something really bad is happening in your app. */
3943 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3945 Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, flags,
3947 if (!it) return NULL;
3950 if (it->group && _before->group)
3951 wd->group_items = eina_list_prepend_relative(wd->group_items, it,
3956 it->parent->item->items =
3957 eina_list_prepend_relative(it->parent->item->items, it, _before);
3959 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3960 EINA_INLIST_GET(_before));
3961 it->item->rel = _before;
3962 it->item->rel->relcount++;
3963 it->item->before = EINA_TRUE;
3964 _item_queue(wd, it, NULL);
3965 return (Elm_Object_Item *) it;
3968 EAPI Elm_Object_Item *
3969 elm_genlist_item_direct_sorted_insert(Evas_Object *obj,
3970 const Elm_Genlist_Item_Class *itc,
3972 Elm_Object_Item *parent,
3973 Elm_Genlist_Item_Flags flags,
3974 Eina_Compare_Cb comp,
3976 const void *func_data)
3978 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3979 Widget_Data *wd = elm_widget_data_get(obj);
3980 if (!wd) return NULL;
3981 Elm_Gen_Item *rel = NULL;
3982 Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, flags,
3984 if (!it) return NULL;
3986 wd->item_compare_cb = comp;
3993 l = eina_list_search_sorted_near_list(it->parent->item->items,
3994 _elm_genlist_item_list_compare, it,
3997 rel = eina_list_data_get(l);
4001 if (cmp_result >= 0)
4003 it->parent->item->items = eina_list_prepend_relative_list(it->parent->item->items, it, l);
4004 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
4005 it->item->before = EINA_FALSE;
4007 else if (cmp_result < 0)
4009 it->parent->item->items = eina_list_append_relative_list(it->parent->item->items, it, l);
4010 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
4011 it->item->before = EINA_TRUE;
4018 wd->state = eina_inlist_sorted_state_new();
4019 eina_inlist_sorted_state_init(wd->state, wd->items);
4020 wd->requeued = EINA_FALSE;
4024 wd->group_items = eina_list_append(wd->group_items, it);
4026 wd->items = eina_inlist_sorted_state_insert(wd->items, EINA_INLIST_GET(it),
4027 _elm_genlist_item_compare, wd->state);
4029 if (EINA_INLIST_GET(it)->next)
4031 rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
4032 it->item->before = EINA_TRUE;
4034 else if (EINA_INLIST_GET(it)->prev)
4036 rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
4037 it->item->before = EINA_FALSE;
4043 it->item->rel = rel;
4044 it->item->rel->relcount++;
4047 _item_queue(wd, it, _elm_genlist_item_list_compare);
4049 return (Elm_Object_Item *) it;
4052 EAPI Elm_Object_Item *
4053 elm_genlist_item_sorted_insert(Evas_Object *obj,
4054 const Elm_Genlist_Item_Class *itc,
4056 Elm_Object_Item *parent,
4057 Elm_Genlist_Item_Flags flags,
4058 Eina_Compare_Cb comp,
4060 const void *func_data)
4062 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4063 Widget_Data *wd = elm_widget_data_get(obj);
4064 wd->item_compare_data_cb = comp;
4065 return elm_genlist_item_direct_sorted_insert(obj, itc, data, parent, flags,
4066 _elm_genlist_item_compare_data,
4071 _elm_genlist_clear(Evas_Object *obj, Eina_Bool standby)
4073 Eina_Inlist *next, *l;
4075 ELM_CHECK_WIDTYPE(obj, widtype);
4076 Widget_Data *wd = elm_widget_data_get(obj);
4079 if (!standby) wd->generation++;
4083 eina_inlist_sorted_state_free(wd->state);
4087 if (wd->walking > 0)
4092 evas_event_freeze(evas_object_evas_get(wd->obj));
4093 for (l = wd->items, next = l ? l->next : NULL;
4095 l = next, next = next ? next->next : NULL)
4097 Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(l);
4099 if (it->generation < wd->generation)
4101 Elm_Gen_Item *itn = NULL;
4103 if (next) itn = ELM_GEN_ITEM_FROM_INLIST(next);
4104 if (itn) itn->walking++; /* prevent early death of subitem */
4106 elm_widget_item_free(it);
4107 if (itn) itn->walking--;
4111 wd->pan_changed = EINA_TRUE;
4114 ecore_job_del(wd->calc_job);
4115 wd->calc_job = NULL;
4117 if (wd->selected) wd->selected = eina_list_free(wd->selected);
4118 if (wd->clear_cb) wd->clear_cb(wd);
4126 evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
4127 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
4129 if (wd->sizing_cb) wd->sizing_cb(wd->obj);
4130 elm_smart_scroller_child_region_show(wd->scr, 0, 0, 0, 0);
4131 evas_event_thaw(evas_object_evas_get(wd->obj));
4132 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
4136 elm_genlist_clear(Evas_Object *obj)
4138 _elm_genlist_clear(obj, EINA_FALSE);
4142 elm_genlist_multi_select_set(Evas_Object *obj,
4145 ELM_CHECK_WIDTYPE(obj, widtype);
4146 Widget_Data *wd = elm_widget_data_get(obj);
4152 elm_genlist_multi_select_get(const Evas_Object *obj)
4154 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4155 Widget_Data *wd = elm_widget_data_get(obj);
4156 if (!wd) return EINA_FALSE;
4160 EAPI Elm_Object_Item *
4161 elm_genlist_selected_item_get(const Evas_Object *obj)
4163 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4164 Widget_Data *wd = elm_widget_data_get(obj);
4165 if (!wd) return NULL;
4166 if (wd->selected) return wd->selected->data;
4170 EAPI const Eina_List *
4171 elm_genlist_selected_items_get(const Evas_Object *obj)
4173 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4174 Widget_Data *wd = elm_widget_data_get(obj);
4175 if (!wd) return NULL;
4176 return wd->selected;
4180 elm_genlist_realized_items_get(const Evas_Object *obj)
4182 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4183 Widget_Data *wd = elm_widget_data_get(obj);
4184 Eina_List *list = NULL;
4186 Eina_Bool done = EINA_FALSE;
4187 if (!wd) return NULL;
4188 EINA_INLIST_FOREACH(wd->blocks, itb)
4196 EINA_LIST_FOREACH(itb->items, l, it)
4198 if (it->realized) list = eina_list_append(list, it);
4209 EAPI Elm_Object_Item *
4210 elm_genlist_at_xy_item_get(const Evas_Object *obj,
4215 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4216 Widget_Data *wd = elm_widget_data_get(obj);
4217 Evas_Coord ox, oy, ow, oh;
4220 if (!wd) return NULL;
4221 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
4223 EINA_INLIST_FOREACH(wd->blocks, itb)
4228 if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
4229 oy + itb->y - itb->wd->pan_y,
4230 itb->w, itb->h, x, y, 1, 1))
4232 EINA_LIST_FOREACH(itb->items, l, it)
4234 Evas_Coord itx, ity;
4236 itx = ox + itb->x + it->x - itb->wd->pan_x;
4237 ity = oy + itb->y + it->y - itb->wd->pan_y;
4238 if (ELM_RECTS_INTERSECT(itx, ity, it->item->w, it->item->h, x, y, 1, 1))
4242 if (y <= (ity + (it->item->h / 4))) *posret = -1;
4243 else if (y >= (ity + it->item->h - (it->item->h / 4)))
4247 return (Elm_Object_Item *) it;
4249 lasty = ity + it->item->h;
4254 if (y > lasty) *posret = 1;
4260 EAPI Elm_Object_Item *
4261 elm_genlist_first_item_get(const Evas_Object *obj)
4263 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4264 Widget_Data *wd = elm_widget_data_get(obj);
4265 if (!wd) return NULL;
4266 if (!wd->items) return NULL;
4267 Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items);
4268 while ((it) && (it->generation < wd->generation))
4269 it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
4270 return (Elm_Object_Item *) it;
4273 EAPI Elm_Object_Item *
4274 elm_genlist_last_item_get(const Evas_Object *obj)
4276 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4277 Widget_Data *wd = elm_widget_data_get(obj);
4278 if (!wd) return NULL;
4279 if (!wd->items) return NULL;
4280 Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
4281 while ((it) && (it->generation < wd->generation))
4282 it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
4283 return (Elm_Object_Item *) it;
4286 EAPI Elm_Object_Item *
4287 elm_genlist_item_next_get(const Elm_Object_Item *it)
4289 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
4290 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4293 _it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(_it)->next);
4294 if ((_it) && (_it->generation == _it->wd->generation)) break;
4296 return (Elm_Object_Item *) _it;
4299 EAPI Elm_Object_Item *
4300 elm_genlist_item_prev_get(const Elm_Object_Item *it)
4302 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
4303 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4306 _it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(_it)->prev);
4307 if ((_it) && (_it->generation == _it->wd->generation)) break;
4309 return (Elm_Object_Item *) _it;
4313 elm_genlist_item_genlist_get(const Elm_Object_Item *it)
4315 return elm_object_item_widget_get(it);
4318 EAPI Elm_Object_Item *
4319 elm_genlist_item_parent_get(const Elm_Object_Item *it)
4321 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
4322 return (Elm_Object_Item *) ((Elm_Gen_Item *) it)->parent;
4326 elm_genlist_item_subitems_clear(Elm_Object_Item *it)
4328 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4329 Eina_List *tl = NULL, *l;
4331 Elm_Object_Item *it2;
4332 _it = (Elm_Gen_Item *) it;
4334 EINA_LIST_FOREACH(_it->item->items, l, it2)
4335 tl = eina_list_append(tl, it2);
4336 EINA_LIST_FREE(tl, it2)
4337 elm_object_item_del(it2);
4341 elm_genlist_item_selected_set(Elm_Object_Item *it,
4344 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4345 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4346 Widget_Data *wd = _it->wd;
4348 if ((_it->generation < wd->generation) || elm_widget_item_disabled_get(_it))
4350 selected = !!selected;
4351 if (_it->selected == selected) return;
4357 while (wd->selected)
4359 if (_it->unhighlight_cb) _it->unhighlight_cb(wd->selected->data);
4360 _it->unsel_cb(wd->selected->data);
4363 _it->highlight_cb(_it);
4367 if (_it->unhighlight_cb) _it->unhighlight_cb(_it);
4372 elm_genlist_item_selected_get(const Elm_Object_Item *it)
4374 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
4375 return ((Elm_Gen_Item *) it)->selected;
4379 elm_genlist_item_expanded_set(Elm_Object_Item *it,
4382 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4383 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4384 if (_it->item->expanded == expanded) return;
4385 _it->item->expanded = expanded;
4386 _it->wd->expanded_item = _it;
4387 if (_it->item->expanded)
4390 edje_object_signal_emit(VIEW(_it), "elm,state,expanded", "elm");
4391 evas_object_smart_callback_call(WIDGET(_it), SIG_EXPANDED, _it);
4392 _it->wd->auto_scroll_enabled = EINA_TRUE;
4397 edje_object_signal_emit(VIEW(_it), "elm,state,contracted", "elm");
4398 evas_object_smart_callback_call(WIDGET(_it), SIG_CONTRACTED, _it);
4399 _it->wd->auto_scroll_enabled = EINA_FALSE;
4404 elm_genlist_item_expanded_get(const Elm_Object_Item *it)
4406 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
4407 return ((Elm_Gen_Item *) it)->item->expanded;
4411 elm_genlist_item_expanded_depth_get(const Elm_Object_Item *it)
4413 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, 0);
4414 return ((Elm_Gen_Item *) it)->item->expanded_depth;
4418 elm_genlist_item_disabled_set(Elm_Object_Item *it,
4421 elm_object_item_disabled_set(it, disabled);
4425 elm_genlist_item_disabled_get(const Elm_Object_Item *it)
4427 return elm_object_item_disabled_get(it);
4431 elm_genlist_item_display_only_set(Elm_Object_Item *it,
4432 Eina_Bool display_only)
4434 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4435 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4436 display_only = !!display_only;
4437 if (_it->display_only == display_only) return;
4438 if (_it->generation < _it->wd->generation) return;
4439 _it->display_only = display_only;
4440 _it->item->mincalcd = EINA_FALSE;
4441 _it->item->updateme = EINA_TRUE;
4442 if (_it->item->block) _it->item->block->updateme = EINA_TRUE;
4443 if (_it->wd->update_job) ecore_job_del(_it->wd->update_job);
4444 _it->wd->update_job = ecore_job_add(_update_job, _it->wd);
4448 elm_genlist_item_display_only_get(const Elm_Object_Item *it)
4450 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
4451 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4452 if (_it->generation < _it->wd->generation) return EINA_FALSE;
4453 return _it->display_only;
4457 elm_genlist_item_show(Elm_Object_Item *it)
4459 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4460 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4461 Evas_Coord gith = 0;
4462 if (_it->generation < _it->wd->generation) return;
4463 if ((_it->item->queued) || (!_it->item->mincalcd))
4465 _it->wd->show_item = _it;
4466 _it->wd->bring_in = EINA_FALSE;
4467 _it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN;
4468 _it->item->showme = EINA_TRUE;
4471 if (_it->wd->show_item)
4473 _it->wd->show_item->item->showme = EINA_FALSE;
4474 _it->wd->show_item = NULL;
4476 if ((_it->item->group_item) &&
4477 (_it->wd->pan_y > (_it->y + _it->item->block->y)))
4478 gith = _it->item->group_item->item->h;
4479 elm_smart_scroller_child_region_show(_it->wd->scr,
4480 _it->x + _it->item->block->x,
4481 _it->y + _it->item->block->y - gith,
4482 _it->item->block->w, _it->item->h);
4486 elm_genlist_item_promote(Elm_Object_Item *it)
4488 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4489 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4490 if (_it->generation < _it->wd->generation) return;
4491 _item_move_before(_it,
4492 (Elm_Gen_Item *) elm_genlist_first_item_get(WIDGET(_it)));
4496 elm_genlist_item_demote(Elm_Object_Item *it)
4498 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4499 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4500 if (_it->generation < _it->wd->generation) return;
4501 _item_move_after(_it,
4502 (Elm_Gen_Item *) elm_genlist_last_item_get(WIDGET(_it)));
4506 elm_genlist_item_bring_in(Elm_Object_Item *it)
4508 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4509 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4510 Evas_Coord gith = 0;
4511 if (_it->generation < _it->wd->generation) return;
4512 if ((_it->item->queued) || (!_it->item->mincalcd))
4514 _it->wd->show_item = _it;
4515 _it->wd->bring_in = EINA_TRUE;
4516 _it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN;
4517 _it->item->showme = EINA_TRUE;
4520 if (_it->wd->show_item)
4522 _it->wd->show_item->item->showme = EINA_FALSE;
4523 _it->wd->show_item = NULL;
4525 if ((_it->item->group_item) &&
4526 (_it->wd->pan_y > (_it->y + _it->item->block->y)))
4527 gith = _it->item->group_item->item->h;
4528 elm_smart_scroller_region_bring_in(_it->wd->scr,
4529 _it->x + _it->item->block->x,
4530 _it->y + _it->item->block->y - gith,
4531 _it->item->block->w, _it->item->h);
4535 elm_genlist_item_top_show(Elm_Object_Item *it)
4537 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4538 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4540 Evas_Coord gith = 0;
4542 if (_it->generation < _it->wd->generation) return;
4543 if ((_it->item->queued) || (!_it->item->mincalcd))
4545 _it->wd->show_item = _it;
4546 _it->wd->bring_in = EINA_FALSE;
4547 _it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_TOP;
4548 _it->item->showme = EINA_TRUE;
4551 if (_it->wd->show_item)
4553 _it->wd->show_item->item->showme = EINA_FALSE;
4554 _it->wd->show_item = NULL;
4556 evas_object_geometry_get(_it->wd->pan_smart, NULL, NULL, &ow, &oh);
4557 if (_it->item->group_item) gith = _it->item->group_item->item->h;
4558 elm_smart_scroller_child_region_show(_it->wd->scr,
4559 _it->x + _it->item->block->x,
4560 _it->y + _it->item->block->y - gith,
4561 _it->item->block->w, oh);
4565 elm_genlist_item_top_bring_in(Elm_Object_Item *it)
4567 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4568 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4570 Evas_Coord gith = 0;
4572 if (_it->generation < _it->wd->generation) return;
4573 if ((_it->item->queued) || (!_it->item->mincalcd))
4575 _it->wd->show_item = _it;
4576 _it->wd->bring_in = EINA_TRUE;
4577 _it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_TOP;
4578 _it->item->showme = EINA_TRUE;
4581 if (_it->wd->show_item)
4583 _it->wd->show_item->item->showme = EINA_FALSE;
4584 _it->wd->show_item = NULL;
4586 evas_object_geometry_get(_it->wd->pan_smart, NULL, NULL, &ow, &oh);
4587 if (_it->item->group_item) gith = _it->item->group_item->item->h;
4588 elm_smart_scroller_region_bring_in(_it->wd->scr,
4589 _it->x + _it->item->block->x,
4590 _it->y + _it->item->block->y - gith,
4591 _it->item->block->w, oh);
4595 elm_genlist_item_middle_show(Elm_Object_Item *it)
4597 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4598 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4601 if (_it->generation < _it->wd->generation) return;
4602 if ((_it->item->queued) || (!_it->item->mincalcd))
4604 _it->wd->show_item = _it;
4605 _it->wd->bring_in = EINA_FALSE;
4606 _it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_MIDDLE;
4607 _it->item->showme = EINA_TRUE;
4610 if (_it->wd->show_item)
4612 _it->wd->show_item->item->showme = EINA_FALSE;
4613 _it->wd->show_item = NULL;
4615 evas_object_geometry_get(_it->wd->pan_smart, NULL, NULL, &ow, &oh);
4616 elm_smart_scroller_child_region_show(_it->wd->scr,
4617 _it->x + _it->item->block->x,
4618 _it->y + _it->item->block->y - oh / 2 +
4619 _it->item->h / 2, _it->item->block->w,
4624 elm_genlist_item_middle_bring_in(Elm_Object_Item *it)
4626 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4627 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4630 if (_it->generation < _it->wd->generation) return;
4631 if ((_it->item->queued) || (!_it->item->mincalcd))
4633 _it->wd->show_item = _it;
4634 _it->wd->bring_in = EINA_TRUE;
4635 _it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_MIDDLE;
4636 _it->item->showme = EINA_TRUE;
4639 if (_it->wd->show_item)
4641 _it->wd->show_item->item->showme = EINA_FALSE;
4642 _it->wd->show_item = NULL;
4644 evas_object_geometry_get(_it->wd->pan_smart, NULL, NULL, &ow, &oh);
4645 elm_smart_scroller_region_bring_in(_it->wd->scr,
4646 _it->x + _it->item->block->x,
4647 _it->y + _it->item->block->y - oh / 2 +
4648 _it->item->h / 2, _it->item->block->w,
4653 elm_genlist_item_del(Elm_Object_Item *it)
4655 elm_object_item_del(it);
4659 elm_genlist_item_data_set(Elm_Object_Item *it,
4662 elm_object_item_data_set(it, (void *) data);
4666 elm_genlist_item_data_get(const Elm_Object_Item *it)
4668 return elm_object_item_data_get(it);
4672 elm_genlist_item_icons_orphan(Elm_Object_Item *it)
4674 elm_genlist_item_contents_orphan(it);
4678 elm_genlist_item_contents_orphan(Elm_Object_Item *it)
4680 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4682 Evas_Object *content;
4683 EINA_LIST_FREE(((Elm_Gen_Item *) it)->content_objs, content)
4685 elm_widget_sub_object_del(WIDGET(it), content);
4686 evas_object_smart_member_del(content);
4687 evas_object_hide(content);
4691 EAPI const Evas_Object *
4692 elm_genlist_item_object_get(const Elm_Object_Item *it)
4694 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
4699 elm_genlist_item_update(Elm_Object_Item *it)
4701 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4702 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4704 if (!_it->item->block) return;
4705 if (_it->generation < _it->wd->generation) return;
4706 _it->item->mincalcd = EINA_FALSE;
4707 _it->item->updateme = EINA_TRUE;
4708 _it->item->block->updateme = EINA_TRUE;
4709 if (_it->wd->update_job) ecore_job_del(_it->wd->update_job);
4710 _it->wd->update_job = ecore_job_add(_update_job, _it->wd);
4714 elm_genlist_item_fields_update(Elm_Object_Item *it,
4716 Elm_Genlist_Item_Field_Flags itf)
4718 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4719 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4721 if (!_it->item->block) return;
4722 if (_it->generation < _it->wd->generation) return;
4724 if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_LABEL))
4725 _item_text_realize(_it, _it->base.view, &_it->texts, parts);
4726 if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_CONTENT))
4728 _it->content_objs = _item_content_unrealize(_it, _it->base.view,
4729 &_it->contents, parts);
4730 _it->content_objs = _item_content_realize(_it, _it->base.view,
4731 &_it->contents, parts);
4733 if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_STATE))
4734 _item_state_realize(_it, _it->base.view, &_it->states, parts);
4738 elm_genlist_item_item_class_update(Elm_Object_Item *it,
4739 const Elm_Genlist_Item_Class *itc)
4741 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4742 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4744 if (!_it->item->block) return;
4745 EINA_SAFETY_ON_NULL_RETURN(itc);
4746 if (_it->generation < _it->wd->generation) return;
4748 _it->item->nocache = EINA_TRUE;
4749 elm_genlist_item_update(it);
4752 EAPI const Elm_Genlist_Item_Class *
4753 elm_genlist_item_item_class_get(const Elm_Object_Item *it)
4755 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
4756 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4757 if (_it->generation < _it->wd->generation) return NULL;
4761 static Evas_Object *
4762 _elm_genlist_item_label_create(void *data,
4763 Evas_Object *obj __UNUSED__,
4764 Evas_Object *tooltip,
4765 void *it __UNUSED__)
4767 Evas_Object *label = elm_label_add(tooltip);
4770 elm_object_style_set(label, "tooltip");
4771 elm_object_text_set(label, data);
4776 _elm_genlist_item_label_del_cb(void *data,
4777 Evas_Object *obj __UNUSED__,
4778 void *event_info __UNUSED__)
4780 eina_stringshare_del(data);
4784 elm_genlist_item_tooltip_text_set(Elm_Object_Item *it,
4787 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4788 text = eina_stringshare_add(text);
4789 elm_genlist_item_tooltip_content_cb_set(it, _elm_genlist_item_label_create,
4791 _elm_genlist_item_label_del_cb);
4795 elm_genlist_item_tooltip_content_cb_set(Elm_Object_Item *it,
4796 Elm_Tooltip_Item_Content_Cb func,
4798 Evas_Smart_Cb del_cb)
4800 ELM_OBJ_ITEM_CHECK_OR_GOTO(it, error);
4801 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4803 if ((_it->tooltip.content_cb == func) && (_it->tooltip.data == data))
4806 if (_it->tooltip.del_cb)
4807 _it->tooltip.del_cb((void *) _it->tooltip.data, WIDGET(it), it);
4809 _it->tooltip.content_cb = func;
4810 _it->tooltip.data = data;
4811 _it->tooltip.del_cb = del_cb;
4815 elm_widget_item_tooltip_content_cb_set(_it,
4816 _it->tooltip.content_cb,
4817 _it->tooltip.data, NULL);
4818 elm_widget_item_tooltip_style_set(_it, _it->tooltip.style);
4819 elm_widget_item_tooltip_window_mode_set(_it, _it->tooltip.free_size);
4825 if (del_cb) del_cb((void *)data, NULL, NULL);
4829 elm_genlist_item_tooltip_unset(Elm_Object_Item *it)
4831 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4832 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4834 if ((VIEW(_it)) && (_it->tooltip.content_cb))
4835 elm_widget_item_tooltip_unset(_it);
4837 if (_it->tooltip.del_cb)
4838 _it->tooltip.del_cb((void *) _it->tooltip.data, WIDGET(_it), _it);
4839 _it->tooltip.del_cb = NULL;
4840 _it->tooltip.content_cb = NULL;
4841 _it->tooltip.data = NULL;
4842 _it->tooltip.free_size = EINA_FALSE;
4843 if (_it->tooltip.style)
4844 elm_genlist_item_tooltip_style_set(it, NULL);
4848 elm_genlist_item_tooltip_style_set(Elm_Object_Item *it,
4851 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4852 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4854 eina_stringshare_replace(&_it->tooltip.style, style);
4855 if (VIEW(_it)) elm_widget_item_tooltip_style_set(_it, style);
4859 elm_genlist_item_tooltip_style_get(const Elm_Object_Item *it)
4861 return elm_object_item_tooltip_style_get(it);
4865 elm_genlist_item_tooltip_window_mode_set(Elm_Object_Item *it,
4868 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
4869 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4871 _it->tooltip.free_size = disable;
4872 if (VIEW(_it)) return elm_widget_item_tooltip_window_mode_set(_it, disable);
4877 elm_genlist_item_tooltip_window_mode_get(const Elm_Object_Item *it)
4879 return elm_object_tooltip_window_mode_get(VIEW(it));
4883 elm_genlist_item_cursor_set(Elm_Object_Item *it,
4886 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4887 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4888 eina_stringshare_replace(&_it->mouse_cursor, cursor);
4889 if (VIEW(_it)) elm_widget_item_cursor_set(_it, cursor);
4893 elm_genlist_item_cursor_get(const Elm_Object_Item *it)
4895 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
4896 return elm_widget_item_cursor_get(it);
4900 elm_genlist_item_cursor_unset(Elm_Object_Item *it)
4902 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4903 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4905 if (!_it->mouse_cursor) return;
4907 if (VIEW(_it)) elm_widget_item_cursor_unset(_it);
4909 eina_stringshare_del(_it->mouse_cursor);
4910 _it->mouse_cursor = NULL;
4914 elm_genlist_item_cursor_style_set(Elm_Object_Item *it,
4917 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4918 elm_widget_item_cursor_style_set(it, style);
4922 elm_genlist_item_cursor_style_get(const Elm_Object_Item *it)
4924 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
4925 return elm_widget_item_cursor_style_get(it);
4929 elm_genlist_item_cursor_engine_only_set(Elm_Object_Item *it,
4930 Eina_Bool engine_only)
4932 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4933 elm_widget_item_cursor_engine_only_set(it, engine_only);
4937 elm_genlist_item_cursor_engine_only_get(const Elm_Object_Item *it)
4939 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
4940 return elm_widget_item_cursor_engine_only_get(it);
4944 elm_genlist_item_index_get(Elm_Object_Item *it)
4946 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, -1);
4947 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4949 if (_it->item->block)
4950 return _it->position + _it->item->block->position;
4955 elm_genlist_mode_set(Evas_Object *obj,
4958 ELM_CHECK_WIDTYPE(obj, widtype);
4959 Widget_Data *wd = elm_widget_data_get(obj);
4961 if (wd->mode == mode) return;
4967 elm_genlist_horizontal_set(Evas_Object *obj,
4970 elm_genlist_mode_set(obj, mode);
4974 elm_genlist_horizontal_mode_set(Evas_Object *obj,
4977 elm_genlist_mode_set(obj, mode);
4981 elm_genlist_mode_get(const Evas_Object *obj)
4983 ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
4984 Widget_Data *wd = elm_widget_data_get(obj);
4985 if (!wd) return ELM_LIST_LAST;
4990 elm_genlist_horizontal_get(const Evas_Object *obj)
4992 return elm_genlist_mode_get(obj);
4996 elm_genlist_horizontal_mode_get(const Evas_Object *obj)
4998 return elm_genlist_mode_get(obj);
5002 elm_genlist_always_select_mode_set(Evas_Object *obj,
5003 Eina_Bool always_select)
5005 ELM_CHECK_WIDTYPE(obj, widtype);
5006 Widget_Data *wd = elm_widget_data_get(obj);
5008 wd->always_select = always_select;
5012 elm_genlist_always_select_mode_get(const Evas_Object *obj)
5014 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5015 Widget_Data *wd = elm_widget_data_get(obj);
5016 if (!wd) return EINA_FALSE;
5017 return wd->always_select;
5021 elm_genlist_no_select_mode_set(Evas_Object *obj,
5022 Eina_Bool no_select)
5024 ELM_CHECK_WIDTYPE(obj, widtype);
5025 Widget_Data *wd = elm_widget_data_get(obj);
5027 wd->no_select = no_select;
5031 elm_genlist_no_select_mode_get(const Evas_Object *obj)
5033 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5034 Widget_Data *wd = elm_widget_data_get(obj);
5035 if (!wd) return EINA_FALSE;
5036 return wd->no_select;
5040 elm_genlist_compress_mode_set(Evas_Object *obj,
5043 ELM_CHECK_WIDTYPE(obj, widtype);
5044 Widget_Data *wd = elm_widget_data_get(obj);
5046 wd->compress = compress;
5047 if (!compress) elm_genlist_homogeneous_set(obj, EINA_FALSE);
5051 elm_genlist_compress_mode_get(const Evas_Object *obj)
5053 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5054 Widget_Data *wd = elm_widget_data_get(obj);
5055 if (!wd) return EINA_FALSE;
5056 return wd->compress;
5060 elm_genlist_height_for_width_mode_set(Evas_Object *obj,
5061 Eina_Bool height_for_width)
5063 ELM_CHECK_WIDTYPE(obj, widtype);
5064 Widget_Data *wd = elm_widget_data_get(obj);
5066 wd->height_for_width = !!height_for_width;
5067 if (wd->height_for_width)
5069 elm_genlist_homogeneous_set(obj, EINA_FALSE);
5070 elm_genlist_compress_mode_set(obj, EINA_TRUE);
5075 elm_genlist_height_for_width_mode_get(const Evas_Object *obj)
5077 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5078 Widget_Data *wd = elm_widget_data_get(obj);
5079 if (!wd) return EINA_FALSE;
5080 return wd->height_for_width;
5084 elm_genlist_bounce_set(Evas_Object *obj,
5088 ELM_CHECK_WIDTYPE(obj, widtype);
5089 Widget_Data *wd = elm_widget_data_get(obj);
5091 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
5092 wd->h_bounce = h_bounce;
5093 wd->v_bounce = v_bounce;
5097 elm_genlist_bounce_get(const Evas_Object *obj,
5098 Eina_Bool *h_bounce,
5099 Eina_Bool *v_bounce)
5101 ELM_CHECK_WIDTYPE(obj, widtype);
5102 Widget_Data *wd = elm_widget_data_get(obj);
5104 if (h_bounce) *h_bounce = wd->h_bounce;
5105 if (v_bounce) *v_bounce = wd->v_bounce;
5109 elm_genlist_homogeneous_set(Evas_Object *obj,
5110 Eina_Bool homogeneous)
5112 ELM_CHECK_WIDTYPE(obj, widtype);
5113 Widget_Data *wd = elm_widget_data_get(obj);
5115 if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
5116 wd->homogeneous = homogeneous;
5120 elm_genlist_homogeneous_get(const Evas_Object *obj)
5122 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5123 Widget_Data *wd = elm_widget_data_get(obj);
5124 if (!wd) return EINA_FALSE;
5125 return wd->homogeneous;
5129 elm_genlist_block_count_set(Evas_Object *obj,
5132 ELM_CHECK_WIDTYPE(obj, widtype);
5133 Widget_Data *wd = elm_widget_data_get(obj);
5135 wd->max_items_per_block = n;
5136 wd->item_cache_max = wd->max_items_per_block * 2;
5137 _item_cache_clean(wd);
5141 elm_genlist_block_count_get(const Evas_Object *obj)
5143 ELM_CHECK_WIDTYPE(obj, widtype) 0;
5144 Widget_Data *wd = elm_widget_data_get(obj);
5146 return wd->max_items_per_block;
5150 elm_genlist_longpress_timeout_set(Evas_Object *obj,
5153 ELM_CHECK_WIDTYPE(obj, widtype);
5154 Widget_Data *wd = elm_widget_data_get(obj);
5156 wd->longpress_timeout = timeout;
5160 elm_genlist_longpress_timeout_get(const Evas_Object *obj)
5162 ELM_CHECK_WIDTYPE(obj, widtype) 0;
5163 Widget_Data *wd = elm_widget_data_get(obj);
5165 return wd->longpress_timeout;
5169 elm_genlist_scroller_policy_set(Evas_Object *obj,
5170 Elm_Scroller_Policy policy_h,
5171 Elm_Scroller_Policy policy_v)
5173 ELM_CHECK_WIDTYPE(obj, widtype);
5174 Widget_Data *wd = elm_widget_data_get(obj);
5175 if ((!wd) || (!wd->scr)) return;
5176 if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
5177 (policy_v >= ELM_SCROLLER_POLICY_LAST))
5179 elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
5183 elm_genlist_scroller_policy_get(const Evas_Object *obj,
5184 Elm_Scroller_Policy *policy_h,
5185 Elm_Scroller_Policy *policy_v)
5187 ELM_CHECK_WIDTYPE(obj, widtype);
5188 Widget_Data *wd = elm_widget_data_get(obj);
5189 Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
5190 if ((!wd) || (!wd->scr)) return;
5191 elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
5192 if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
5193 if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
5197 elm_genlist_realized_items_update(Evas_Object *obj)
5199 ELM_CHECK_WIDTYPE(obj, widtype);
5201 Eina_List *list, *l;
5202 Elm_Object_Item *it;
5204 list = elm_genlist_realized_items_get(obj);
5205 EINA_LIST_FOREACH(list, l, it)
5206 elm_genlist_item_update(it);
5210 elm_genlist_item_mode_set(Elm_Object_Item *it,
5211 const char *mode_type,
5214 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
5215 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
5217 Widget_Data *wd = _it->wd;
5219 Elm_Object_Item *it2;
5222 if (!mode_type) return;
5223 if ((_it->generation < _it->wd->generation) ||
5224 elm_widget_item_disabled_get(_it)) return;
5226 if ((wd->mode_item == _it) &&
5227 (!strcmp(mode_type, wd->mode_type)) &&
5230 if (!wd->mode_item_style) return;
5231 _it->mode_set = mode_set;
5235 EINA_LIST_FOREACH(wd->selected, l, it2)
5236 if (((Elm_Gen_Item *) it2)->realized)
5237 elm_genlist_item_selected_set(it2, EINA_FALSE);
5241 it2 = elm_genlist_selected_item_get(wd->obj);
5242 if ((it2) && (((Elm_Gen_Item *) it2)->realized))
5243 elm_genlist_item_selected_set(it2, EINA_FALSE);
5246 if (((wd->mode_type) && (strcmp(mode_type, wd->mode_type))) ||
5248 ((_it == wd->mode_item) && (!mode_set)))
5249 _item_mode_unset(wd);
5251 eina_stringshare_replace(&wd->mode_type, mode_type);
5252 if (mode_set) _item_mode_set(_it);
5257 elm_genlist_mode_item_style_get(const Evas_Object *obj)
5259 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5260 Widget_Data *wd = elm_widget_data_get(obj);
5261 if (!wd) return NULL;
5262 return wd->mode_item_style;
5266 elm_genlist_mode_item_style_set(Evas_Object *obj, const char *style)
5268 ELM_CHECK_WIDTYPE(obj, widtype);
5269 Widget_Data *wd = elm_widget_data_get(obj);
5271 if ((style == wd->mode_item_style) || (style && wd->mode_item_style &&
5272 (!strcmp(style, wd->mode_item_style))))
5274 eina_stringshare_replace(&wd->mode_item_style, style);
5275 elm_genlist_realized_items_update(obj);
5279 elm_genlist_mode_type_get(const Evas_Object *obj)
5281 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5282 Widget_Data *wd = elm_widget_data_get(obj);
5283 if (!wd) return NULL;
5284 return wd->mode_type;
5287 EAPI const Elm_Object_Item *
5288 elm_genlist_mode_item_get(const Evas_Object *obj)
5290 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5291 Widget_Data *wd = elm_widget_data_get(obj);
5292 if (!wd) return NULL;
5293 return (Elm_Object_Item *) wd->mode_item;
5297 elm_genlist_reorder_mode_set(Evas_Object *obj,
5298 Eina_Bool reorder_mode)
5300 ELM_CHECK_WIDTYPE(obj, widtype);
5301 Widget_Data *wd = elm_widget_data_get(obj);
5303 wd->reorder_mode = reorder_mode;
5307 elm_genlist_reorder_mode_get(const Evas_Object *obj)
5309 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5310 Widget_Data *wd = elm_widget_data_get(obj);
5311 if (!wd) return EINA_FALSE;
5312 return wd->reorder_mode;
5315 /* for gengrid as of now */
5317 _elm_genlist_page_relative_set(Evas_Object *obj,
5321 Evas_Coord pagesize_h;
5322 Evas_Coord pagesize_v;
5324 ELM_CHECK_WIDTYPE(obj, widtype);
5325 Widget_Data *wd = elm_widget_data_get(obj);
5328 elm_smart_scroller_paging_get(wd->scr, NULL, NULL, &pagesize_h, &pagesize_v);
5329 elm_smart_scroller_paging_set(wd->scr, h_pagerel, v_pagerel, pagesize_h,
5333 /* for gengrid as of now */
5335 _elm_genlist_page_relative_get(const Evas_Object *obj,
5339 ELM_CHECK_WIDTYPE(obj, widtype);
5340 Widget_Data *wd = elm_widget_data_get(obj);
5343 elm_smart_scroller_paging_get(wd->scr, h_pagerel, v_pagerel, NULL, NULL);
5346 /* for gengrid as of now */
5348 _elm_genlist_page_size_set(Evas_Object *obj,
5349 Evas_Coord h_pagesize,
5350 Evas_Coord v_pagesize)
5355 ELM_CHECK_WIDTYPE(obj, widtype);
5356 Widget_Data *wd = elm_widget_data_get(obj);
5358 elm_smart_scroller_paging_get(wd->scr, &pagerel_h, &pagerel_v, NULL, NULL);
5359 elm_smart_scroller_paging_set(wd->scr, pagerel_h, pagerel_v, h_pagesize,
5363 /* for gengrid as of now */
5365 _elm_genlist_current_page_get(const Evas_Object *obj,
5369 ELM_CHECK_WIDTYPE(obj, widtype);
5370 Widget_Data *wd = elm_widget_data_get(obj);
5373 elm_smart_scroller_current_page_get(wd->scr, h_pagenumber, v_pagenumber);
5376 /* for gengrid as of now */
5378 _elm_genlist_last_page_get(const Evas_Object *obj,
5382 ELM_CHECK_WIDTYPE(obj, widtype);
5383 Widget_Data *wd = elm_widget_data_get(obj);
5386 elm_smart_scroller_last_page_get(wd->scr, h_pagenumber, v_pagenumber);
5389 /* for gengrid as of now */
5391 _elm_genlist_page_show(const Evas_Object *obj,
5395 ELM_CHECK_WIDTYPE(obj, widtype);
5396 Widget_Data *wd = elm_widget_data_get(obj);
5399 elm_smart_scroller_page_show(wd->scr, h_pagenumber, v_pagenumber);
5402 /* for gengrid as of now */
5404 _elm_genlist_page_bring_in(const Evas_Object *obj,
5408 ELM_CHECK_WIDTYPE(obj, widtype);
5409 Widget_Data *wd = elm_widget_data_get(obj);
5412 elm_smart_scroller_page_bring_in(wd->scr, h_pagenumber, v_pagenumber);
5416 _elm_genlist_item_unrealize(Elm_Gen_Item *it,
5419 Evas_Object *content;
5421 if (!it->realized) return;
5422 if (it->wd->reorder_it == it) return;
5423 evas_event_freeze(evas_object_evas_get(WIDGET(it)));
5425 evas_object_smart_callback_call(WIDGET(it), SIG_UNREALIZED, it);
5428 ecore_timer_del(it->long_timer);
5429 it->long_timer = NULL;
5432 elm_widget_stringlist_free(it->texts);
5434 elm_widget_stringlist_free(it->contents);
5435 it->contents = NULL;
5436 elm_widget_stringlist_free(it->states);
5439 EINA_LIST_FREE(it->content_objs, content)
5440 evas_object_del(content);
5442 it->unrealize_cb(it);
5444 it->realized = EINA_FALSE;
5445 it->want_unrealize = EINA_FALSE;
5446 evas_event_thaw(evas_object_evas_get(WIDGET(it)));
5447 evas_event_thaw_eval(evas_object_evas_get(WIDGET(it)));
5451 _elm_genlist_item_del_notserious(Elm_Gen_Item *it)
5453 elm_widget_item_pre_notify_del(it);
5454 it->generation = it->wd->generation - 1; /* This means that the item is deleted */
5455 if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it);
5457 if (it->itc->func.del)
5458 it->itc->func.del((void *)it->base.data, WIDGET(it));
5462 _elm_genlist_item_del_serious(Elm_Gen_Item *it)
5464 _elm_genlist_item_del_notserious(it);
5465 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
5466 if (it->tooltip.del_cb)
5467 it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
5468 it->wd->walking -= it->walking;
5469 if (it->long_timer) ecore_timer_del(it->long_timer);
5471 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
5475 eina_inlist_sorted_state_free(it->wd->state);
5476 it->wd->state = NULL;
5478 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
5479 it->wd->calc_job = ecore_job_add(it->wd->calc_cb, it->wd);
5483 if (it->wd->last_selected_item == (Elm_Object_Item *) it)
5484 it->wd->last_selected_item = NULL;