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((Elm_Object_Item *) wd->last_selected_item);
396 if (!prev) return EINA_TRUE;
398 if (elm_genlist_item_selected_get(prev))
400 elm_genlist_item_selected_set((Elm_Object_Item *) wd->last_selected_item, EINA_FALSE);
401 wd->last_selected_item = (Elm_Gen_Item *) prev;
402 elm_genlist_item_show((Elm_Object_Item *) 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((Elm_Object_Item *) wd->last_selected_item);
420 if (!next) return EINA_TRUE;
422 if (elm_genlist_item_selected_get(next))
424 elm_genlist_item_selected_set((Elm_Object_Item *) wd->last_selected_item, EINA_FALSE);
425 wd->last_selected_item = (Elm_Gen_Item *) next;
426 elm_genlist_item_show((Elm_Object_Item *) 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((Elm_Object_Item *) 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((Elm_Object_Item *) 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))
3205 if (!it->relcount) it->del_cb(it);
3208 it->wd->last_selected_item = it;
3212 static Evas_Object *
3213 _item_content_get_hook(Elm_Gen_Item *it, const char *part)
3215 return edje_object_part_swallow_get(VIEW(it), part);
3219 _item_content_set_hook(Elm_Gen_Item *it, const char *part, Evas_Object *content)
3221 edje_object_part_swallow(VIEW(it), part, content);
3224 static Evas_Object *
3225 _item_content_unset_hook(Elm_Gen_Item *it, const char *part)
3229 obj = edje_object_part_swallow_get(VIEW(it), part);
3230 if (!obj) return NULL;
3231 edje_object_part_unswallow(VIEW(it), obj);
3236 _item_text_hook(Elm_Gen_Item *it, const char *part)
3238 if (!it->itc->func.text_get) return NULL;
3239 return edje_object_part_text_get(VIEW(it), part);
3243 _item_disable_hook(Elm_Object_Item *it)
3245 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
3248 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
3250 if (_it->generation < _it->wd->generation) return;
3253 elm_genlist_item_selected_set(it, EINA_FALSE);
3257 if (elm_widget_item_disabled_get(it))
3258 edje_object_signal_emit(VIEW(_it), "elm,state,disabled", "elm");
3260 edje_object_signal_emit(VIEW(_it), "elm,state,enabled", "elm");
3261 EINA_LIST_FOREACH(_it->content_objs, l, obj)
3262 elm_widget_disabled_set(obj, elm_widget_item_disabled_get(_it));
3267 _elm_genlist_item_new(Widget_Data *wd,
3268 const Elm_Gen_Item_Class *itc,
3270 Elm_Gen_Item *parent,
3272 const void *func_data)
3276 it = elm_widget_item_new(wd->obj, Elm_Gen_Item);
3277 if (!it) return NULL;
3279 it->generation = wd->generation;
3281 it->base.data = data;
3282 it->parent = parent;
3283 it->func.func = func;
3284 it->func.data = func_data;
3285 elm_widget_item_content_get_hook_set(it, _item_content_get_hook);
3286 elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
3287 elm_widget_item_content_unset_hook_set(it, _item_content_unset_hook);
3288 elm_widget_item_disable_hook_set(it, _item_disable_hook);
3290 it->sel_cb = (Ecore_Cb)_item_select;
3292 elm_widget_item_text_get_hook_set(it, _item_text_hook);
3296 static Elm_Gen_Item *
3297 _item_new(Widget_Data *wd,
3298 const Elm_Genlist_Item_Class *itc,
3300 Elm_Gen_Item *parent,
3301 Elm_Genlist_Item_Flags flags,
3303 const void *func_data)
3305 Elm_Gen_Item *it, *it2;
3308 it = _elm_genlist_item_new(wd, itc, data, parent, func, func_data);
3309 if (!it) return NULL;
3310 it->item = ELM_NEW(Elm_Gen_Item_Type);
3311 it->item->flags = flags;
3312 if (flags & ELM_GENLIST_ITEM_GROUP) it->group++;
3313 it->item->expanded_depth = 0;
3314 ELM_GEN_ITEM_SETUP(it);
3317 if (it->parent->group)
3318 it->item->group_item = parent;
3319 else if (it->parent->item->group_item)
3320 it->item->group_item = it->parent->item->group_item;
3322 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
3324 if (!it2->parent->group) depth += 1;
3326 it->item->expanded_depth = depth;
3331 _item_block_new(Widget_Data *wd, Eina_Bool prepend)
3335 itb = calloc(1, sizeof(Item_Block));
3336 if (!itb) return NULL;
3340 wd->blocks = eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
3341 _item_block_position_update(wd->blocks, 0);
3345 wd->blocks = eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3346 itb->position_update = EINA_TRUE;
3347 if (wd->blocks != EINA_INLIST_GET(itb))
3349 itb->position = ((Item_Block *) (EINA_INLIST_GET(itb)->prev))->position + 1;
3360 _item_block_add(Widget_Data *wd,
3363 Item_Block *itb = NULL;
3370 itb = calloc(1, sizeof(Item_Block));
3371 if (!itb) return EINA_FALSE;
3373 if (!it->item->rel->item->block)
3376 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3377 itb->items = eina_list_append(itb->items, it);
3378 itb->position_update = EINA_TRUE;
3379 it->position = eina_list_count(itb->items);
3380 it->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 tmp = eina_list_data_find_list(itb->items, it->item->rel);
3396 if (it->item->before)
3398 wd->blocks = eina_inlist_prepend_relative
3399 (wd->blocks, EINA_INLIST_GET(itb),
3400 EINA_INLIST_GET(it->item->rel->item->block));
3402 eina_list_prepend_relative_list(itb->items, it, tmp);
3404 /* Update index from where we prepended */
3405 _item_position_update(eina_list_prev(tmp), it->item->rel->position);
3406 _item_block_position_update(EINA_INLIST_GET(itb),
3407 it->item->rel->item->block->position);
3411 wd->blocks = eina_inlist_append_relative
3412 (wd->blocks, EINA_INLIST_GET(itb),
3413 EINA_INLIST_GET(it->item->rel->item->block));
3415 eina_list_append_relative_list(itb->items, it, tmp);
3417 /* Update block index from where we appended */
3418 _item_position_update(eina_list_next(tmp), it->item->rel->position + 1);
3419 _item_block_position_update(EINA_INLIST_GET(itb),
3420 it->item->rel->item->block->position + 1);
3426 if (it->item->before)
3430 itb = (Item_Block *)(wd->blocks);
3431 if (itb->count >= wd->max_items_per_block)
3433 itb = _item_block_new(wd, EINA_TRUE);
3434 if (!itb) return EINA_FALSE;
3439 itb = _item_block_new(wd, EINA_TRUE);
3440 if (!itb) return EINA_FALSE;
3442 itb->items = eina_list_prepend(itb->items, it);
3444 _item_position_update(itb->items, 0);
3450 itb = (Item_Block *)(wd->blocks->last);
3451 if (itb->count >= wd->max_items_per_block)
3453 itb = _item_block_new(wd, EINA_FALSE);
3454 if (!itb) return EINA_FALSE;
3459 itb = _item_block_new(wd, EINA_FALSE);
3460 if (!itb) return EINA_FALSE;
3462 itb->items = eina_list_append(itb->items, it);
3463 it->position = eina_list_count(itb->items);
3471 if (it->item->rel->item->queued)
3473 /* NOTE: for a strange reason eina_list and eina_inlist don't have the same property
3474 on sorted insertion order, so the queue is not always ordered like the item list.
3475 This lead to issue where we depend on an item that is not yet created. As a quick
3476 work around, we reschedule the calc of the item and stop reordering the list to
3477 prevent any nasty issue to show up here.
3479 wd->queue = eina_list_append(wd->queue, it);
3480 wd->requeued = EINA_TRUE;
3481 it->item->queued = EINA_TRUE;
3484 itb = it->item->rel->item->block;
3485 if (!itb) goto newblock;
3486 tmp = eina_list_data_find_list(itb->items, it->item->rel);
3487 if (it->item->before)
3489 itb->items = eina_list_prepend_relative_list(itb->items, it, tmp);
3490 _item_position_update(eina_list_prev(tmp), it->item->rel->position);
3494 itb->items = eina_list_append_relative_list(itb->items, it, tmp);
3495 _item_position_update(eina_list_next(tmp), it->item->rel->position + 1);
3499 itb->changed = EINA_TRUE;
3500 it->item->block = itb;
3501 if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job);
3502 itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd);
3505 it->item->rel->relcount--;
3506 if ((it->item->rel->generation < it->wd->generation) && (!it->item->rel->relcount))
3507 _item_del(it->item->rel);
3508 it->item->rel = NULL;
3510 if (itb->count > itb->wd->max_items_per_block)
3515 Eina_Bool done = EINA_FALSE;
3517 newc = itb->count / 2;
3519 if (EINA_INLIST_GET(itb)->prev)
3521 Item_Block *itbp = (Item_Block *)(EINA_INLIST_GET(itb)->prev);
3523 if (itbp->count + newc < wd->max_items_per_block / 2)
3525 /* moving items to previous block */
3526 while ((itb->count > newc) && (itb->items))
3528 it2 = eina_list_data_get(itb->items);
3529 itb->items = eina_list_remove_list(itb->items, itb->items);
3532 itbp->items = eina_list_append(itbp->items, it2);
3533 it2->item->block = itbp;
3541 if (!done && EINA_INLIST_GET(itb)->next)
3543 Item_Block *itbn = (Item_Block *)(EINA_INLIST_GET(itb)->next);
3545 if (itbn->count + newc < wd->max_items_per_block / 2)
3547 /* moving items to next block */
3548 while ((itb->count > newc) && (itb->items))
3552 l = eina_list_last(itb->items);
3553 it2 = eina_list_data_get(l);
3554 itb->items = eina_list_remove_list(itb->items, l);
3557 itbn->items = eina_list_prepend(itbn->items, it2);
3558 it2->item->block = itbn;
3568 /* moving items to new block */
3569 itb2 = calloc(1, sizeof(Item_Block));
3570 if (!itb2) return EINA_FALSE;
3573 eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
3574 EINA_INLIST_GET(itb));
3575 itb2->changed = EINA_TRUE;
3576 while ((itb->count > newc) && (itb->items))
3580 l = eina_list_last(itb->items);
3582 itb->items = eina_list_remove_list(itb->items, l);
3585 itb2->items = eina_list_prepend(itb2->items, it2);
3586 it2->item->block = itb2;
3596 _queue_process(Widget_Data *wd)
3599 Eina_Bool showme = EINA_FALSE;
3602 t0 = ecore_loop_time_get();
3603 //evas_event_freeze(evas_object_evas_get(wd->obj));
3604 for (n = 0; (wd->queue) && (n < 128); n++)
3608 it = eina_list_data_get(wd->queue);
3609 wd->queue = eina_list_remove_list(wd->queue, wd->queue);
3610 it->item->queued = EINA_FALSE;
3611 if (!_item_block_add(wd, it)) continue;
3613 _item_block_realize(it->item->block);
3614 t = ecore_time_get();
3615 if (it->item->block->changed)
3617 showme = _item_block_recalc(it->item->block, it->item->block->num, EINA_TRUE);
3618 it->item->block->changed = 0;
3619 if (wd->pan_changed)
3621 if (wd->calc_job) ecore_job_del(wd->calc_job);
3622 wd->calc_job = NULL;
3624 wd->pan_changed = EINA_FALSE;
3627 if (showme) it->item->block->showme = EINA_TRUE;
3628 /* same as eina_inlist_count > 1 */
3629 if (wd->blocks && wd->blocks->next)
3631 if ((t - t0) > (ecore_animator_frametime_get())) break;
3634 //evas_event_thaw(evas_object_evas_get(wd->obj));
3635 //evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3640 _idle_process(void *data, Eina_Bool *wakeup)
3642 Widget_Data *wd = data;
3645 //static double q_start = 0.0;
3646 //if (q_start == 0.0) q_start = ecore_time_get();
3648 if (_queue_process(wd) > 0) *wakeup = EINA_TRUE;
3652 //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start);
3654 return ECORE_CALLBACK_CANCEL;
3656 return ECORE_CALLBACK_RENEW;
3660 _item_idle_enterer(void *data)
3662 Widget_Data *wd = data;
3663 Eina_Bool wakeup = EINA_FALSE;
3664 Eina_Bool ok = _idle_process(data, &wakeup);
3669 if (wd->calc_job) ecore_job_del(wd->calc_job);
3670 wd->calc_job = ecore_job_add(_calc_job, wd);
3672 if (ok == ECORE_CALLBACK_CANCEL) wd->queue_idle_enterer = NULL;
3677 _item_queue(Widget_Data *wd,
3681 if (it->item->queued) return;
3682 it->item->queued = EINA_TRUE;
3683 if (cb && !wd->requeued)
3684 wd->queue = eina_list_sorted_insert(wd->queue, cb, it);
3686 wd->queue = eina_list_append(wd->queue, it);
3687 // FIXME: why does a freeze then thaw here cause some genlist
3688 // elm_genlist_item_append() to be much much slower?
3689 // evas_event_freeze(evas_object_evas_get(wd->obj));
3690 while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
3692 if (wd->queue_idle_enterer)
3694 ecore_idle_enterer_del(wd->queue_idle_enterer);
3695 wd->queue_idle_enterer = NULL;
3699 // evas_event_thaw(evas_object_evas_get(wd->obj));
3700 // evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3701 if (!wd->queue_idle_enterer)
3702 wd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, wd);
3706 _elm_genlist_item_compare_data(const void *data, const void *data1)
3708 const Elm_Gen_Item *it = data;
3709 const Elm_Gen_Item *item1 = data1;
3711 return it->wd->item_compare_data_cb(it->base.data, item1->base.data);
3715 _elm_genlist_item_compare(const void *data, const void *data1)
3717 const Elm_Gen_Item *it, *item1;
3718 it = ELM_GEN_ITEM_FROM_INLIST(data);
3719 item1 = ELM_GEN_ITEM_FROM_INLIST(data1);
3720 return it->wd->item_compare_cb(it, item1);
3724 _elm_genlist_item_list_compare(const void *data, const void *data1)
3726 const Elm_Gen_Item *it = data;
3727 const Elm_Gen_Item *item1 = data1;
3728 return it->wd->item_compare_cb(it, item1);
3732 _item_move_after(Elm_Gen_Item *it, Elm_Gen_Item *after)
3737 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3738 _item_block_del(it);
3740 it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
3741 it->item->rel = after;
3742 it->item->rel->relcount++;
3743 it->item->before = EINA_FALSE;
3744 if (after->item->group_item) it->item->group_item = after->item->group_item;
3745 _item_queue(it->wd, it, NULL);
3747 evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it);
3751 _item_move_before(Elm_Gen_Item *it, Elm_Gen_Item *before)
3754 if (!before) return;
3756 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3757 _item_block_del(it);
3758 it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
3759 it->item->rel = before;
3760 it->item->rel->relcount++;
3761 it->item->before = EINA_TRUE;
3762 if (before->item->group_item) it->item->group_item = before->item->group_item;
3763 _item_queue(it->wd, it, NULL);
3765 evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it);
3768 EAPI Elm_Object_Item *
3769 elm_genlist_item_append(Evas_Object *obj,
3770 const Elm_Genlist_Item_Class *itc,
3772 Elm_Object_Item *parent,
3773 Elm_Genlist_Item_Flags flags,
3775 const void *func_data)
3777 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3778 Widget_Data *wd = elm_widget_data_get(obj);
3779 if (!wd) return NULL;
3780 Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, flags,
3782 if (!it) return NULL;
3786 wd->group_items = eina_list_append(wd->group_items, it);
3787 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
3788 it->item->rel = NULL;
3792 Elm_Gen_Item *it2 = NULL;
3793 Eina_List *ll = eina_list_last(it->parent->item->items);
3794 if (ll) it2 = ll->data;
3795 it->parent->item->items = eina_list_append(it->parent->item->items, it);
3796 if (!it2) it2 = it->parent;
3798 eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3799 EINA_INLIST_GET(it2));
3800 it->item->rel = it2;
3801 it->item->rel->relcount++;
3803 it->item->before = EINA_FALSE;
3804 _item_queue(wd, it, NULL);
3805 return (Elm_Object_Item *) it;
3808 EAPI Elm_Object_Item *
3809 elm_genlist_item_prepend(Evas_Object *obj,
3810 const Elm_Genlist_Item_Class *itc,
3812 Elm_Object_Item *parent,
3813 Elm_Genlist_Item_Flags flags,
3815 const void *func_data)
3817 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3818 Widget_Data *wd = elm_widget_data_get(obj);
3819 if (!wd) return NULL;
3820 Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, flags,
3822 if (!it) return NULL;
3826 wd->group_items = eina_list_prepend(wd->group_items, it);
3827 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
3828 it->item->rel = NULL;
3832 Elm_Gen_Item *it2 = NULL;
3833 Eina_List *ll = it->parent->item->items;
3834 if (ll) it2 = ll->data;
3835 it->parent->item->items = eina_list_prepend(it->parent->item->items, it);
3836 if (!it2) it2 = it->parent;
3838 eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3839 EINA_INLIST_GET(it2));
3840 it->item->rel = it2;
3841 it->item->rel->relcount++;
3843 it->item->before = EINA_TRUE;
3844 _item_queue(wd, it, NULL);
3845 return (Elm_Object_Item *) it;
3848 EAPI Elm_Object_Item *
3849 elm_genlist_item_insert_after(Evas_Object *obj,
3850 const Elm_Genlist_Item_Class *itc,
3852 Elm_Object_Item *parent,
3853 Elm_Object_Item *after,
3854 Elm_Genlist_Item_Flags flags,
3856 const void *func_data)
3858 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3859 ELM_OBJ_ITEM_CHECK_OR_RETURN(after, NULL);
3860 Widget_Data *wd = elm_widget_data_get(obj);
3861 Elm_Gen_Item *_after = (Elm_Gen_Item *) after;
3862 if (!wd) return NULL;
3863 /* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */
3864 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3866 Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, flags,
3868 if (!it) return NULL;
3871 if ((it->group) && (_after->group))
3872 wd->group_items = eina_list_append_relative(wd->group_items, it,
3877 it->parent->item->items =
3878 eina_list_append_relative(it->parent->item->items, it, _after);
3880 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3881 EINA_INLIST_GET(_after));
3882 it->item->rel = _after;
3883 it->item->rel->relcount++;
3884 it->item->before = EINA_FALSE;
3885 _item_queue(wd, it, NULL);
3886 return (Elm_Object_Item *) it;
3889 EAPI Elm_Object_Item *
3890 elm_genlist_item_insert_before(Evas_Object *obj,
3891 const Elm_Genlist_Item_Class *itc,
3893 Elm_Object_Item *parent,
3894 Elm_Object_Item *before,
3895 Elm_Genlist_Item_Flags flags,
3897 const void *func_data)
3899 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3900 ELM_OBJ_ITEM_CHECK_OR_RETURN(before, NULL);
3901 Widget_Data *wd = elm_widget_data_get(obj);
3902 Elm_Gen_Item *_before = (Elm_Gen_Item *) before;
3903 if (!wd) return NULL;
3904 /* It makes no sense to insert before in an empty list with before != NULL, something really bad is happening in your app. */
3905 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3907 Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, flags,
3909 if (!it) return NULL;
3912 if (it->group && _before->group)
3913 wd->group_items = eina_list_prepend_relative(wd->group_items, it,
3918 it->parent->item->items =
3919 eina_list_prepend_relative(it->parent->item->items, it, _before);
3921 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3922 EINA_INLIST_GET(_before));
3923 it->item->rel = _before;
3924 it->item->rel->relcount++;
3925 it->item->before = EINA_TRUE;
3926 _item_queue(wd, it, NULL);
3927 return (Elm_Object_Item *) it;
3930 EAPI Elm_Object_Item *
3931 elm_genlist_item_direct_sorted_insert(Evas_Object *obj,
3932 const Elm_Genlist_Item_Class *itc,
3934 Elm_Object_Item *parent,
3935 Elm_Genlist_Item_Flags flags,
3936 Eina_Compare_Cb comp,
3938 const void *func_data)
3940 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3941 Widget_Data *wd = elm_widget_data_get(obj);
3942 if (!wd) return NULL;
3943 Elm_Gen_Item *rel = NULL;
3944 Elm_Gen_Item *it = _item_new(wd, itc, data, (Elm_Gen_Item *) parent, flags,
3946 if (!it) return NULL;
3948 wd->item_compare_cb = comp;
3955 l = eina_list_search_sorted_near_list(it->parent->item->items,
3956 _elm_genlist_item_list_compare, it,
3959 rel = eina_list_data_get(l);
3963 if (cmp_result >= 0)
3965 it->parent->item->items = eina_list_prepend_relative_list(it->parent->item->items, it, l);
3966 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
3967 it->item->before = EINA_FALSE;
3969 else if (cmp_result < 0)
3971 it->parent->item->items = eina_list_append_relative_list(it->parent->item->items, it, l);
3972 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
3973 it->item->before = EINA_TRUE;
3980 wd->state = eina_inlist_sorted_state_new();
3981 eina_inlist_sorted_state_init(wd->state, wd->items);
3982 wd->requeued = EINA_FALSE;
3986 wd->group_items = eina_list_append(wd->group_items, it);
3988 wd->items = eina_inlist_sorted_state_insert(wd->items, EINA_INLIST_GET(it),
3989 _elm_genlist_item_compare, wd->state);
3991 if (EINA_INLIST_GET(it)->next)
3993 rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3994 it->item->before = EINA_TRUE;
3996 else if (EINA_INLIST_GET(it)->prev)
3998 rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3999 it->item->before = EINA_FALSE;
4005 it->item->rel = rel;
4006 it->item->rel->relcount++;
4009 _item_queue(wd, it, _elm_genlist_item_list_compare);
4011 return (Elm_Object_Item *) it;
4014 EAPI Elm_Object_Item *
4015 elm_genlist_item_sorted_insert(Evas_Object *obj,
4016 const Elm_Genlist_Item_Class *itc,
4018 Elm_Object_Item *parent,
4019 Elm_Genlist_Item_Flags flags,
4020 Eina_Compare_Cb comp,
4022 const void *func_data)
4024 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4025 Widget_Data *wd = elm_widget_data_get(obj);
4026 wd->item_compare_data_cb = comp;
4027 return elm_genlist_item_direct_sorted_insert(obj, itc, data, parent, flags,
4028 _elm_genlist_item_compare_data,
4033 _elm_genlist_clear(Evas_Object *obj, Eina_Bool standby)
4035 Eina_Inlist *next, *l;
4037 ELM_CHECK_WIDTYPE(obj, widtype);
4038 Widget_Data *wd = elm_widget_data_get(obj);
4041 if (!standby) wd->generation++;
4045 eina_inlist_sorted_state_free(wd->state);
4049 if (wd->walking > 0)
4054 evas_event_freeze(evas_object_evas_get(wd->obj));
4055 for (l = wd->items, next = l ? l->next : NULL;
4057 l = next, next = next ? next->next : NULL)
4059 Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(l);
4061 if (it->generation < wd->generation)
4063 Elm_Gen_Item *itn = NULL;
4065 if (next) itn = ELM_GEN_ITEM_FROM_INLIST(next);
4066 if (itn) itn->walking++; /* prevent early death of subitem */
4068 if (itn) itn->walking--;
4072 wd->pan_changed = EINA_TRUE;
4075 ecore_job_del(wd->calc_job);
4076 wd->calc_job = NULL;
4078 if (wd->selected) wd->selected = eina_list_free(wd->selected);
4079 if (wd->clear_cb) wd->clear_cb(wd);
4087 evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
4088 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
4090 if (wd->sizing_cb) wd->sizing_cb(wd->obj);
4091 elm_smart_scroller_child_region_show(wd->scr, 0, 0, 0, 0);
4092 evas_event_thaw(evas_object_evas_get(wd->obj));
4093 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
4097 elm_genlist_clear(Evas_Object *obj)
4099 _elm_genlist_clear(obj, EINA_FALSE);
4103 elm_genlist_multi_select_set(Evas_Object *obj,
4106 ELM_CHECK_WIDTYPE(obj, widtype);
4107 Widget_Data *wd = elm_widget_data_get(obj);
4113 elm_genlist_multi_select_get(const Evas_Object *obj)
4115 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4116 Widget_Data *wd = elm_widget_data_get(obj);
4117 if (!wd) return EINA_FALSE;
4121 EAPI Elm_Object_Item *
4122 elm_genlist_selected_item_get(const Evas_Object *obj)
4124 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4125 Widget_Data *wd = elm_widget_data_get(obj);
4126 if (!wd) return NULL;
4127 if (wd->selected) return wd->selected->data;
4131 EAPI const Eina_List *
4132 elm_genlist_selected_items_get(const Evas_Object *obj)
4134 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4135 Widget_Data *wd = elm_widget_data_get(obj);
4136 if (!wd) return NULL;
4137 return wd->selected;
4141 elm_genlist_realized_items_get(const Evas_Object *obj)
4143 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4144 Widget_Data *wd = elm_widget_data_get(obj);
4145 Eina_List *list = NULL;
4147 Eina_Bool done = EINA_FALSE;
4148 if (!wd) return NULL;
4149 EINA_INLIST_FOREACH(wd->blocks, itb)
4157 EINA_LIST_FOREACH(itb->items, l, it)
4159 if (it->realized) list = eina_list_append(list, it);
4170 EAPI Elm_Object_Item *
4171 elm_genlist_at_xy_item_get(const Evas_Object *obj,
4176 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4177 Widget_Data *wd = elm_widget_data_get(obj);
4178 Evas_Coord ox, oy, ow, oh;
4181 if (!wd) return NULL;
4182 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
4184 EINA_INLIST_FOREACH(wd->blocks, itb)
4189 if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
4190 oy + itb->y - itb->wd->pan_y,
4191 itb->w, itb->h, x, y, 1, 1))
4193 EINA_LIST_FOREACH(itb->items, l, it)
4195 Evas_Coord itx, ity;
4197 itx = ox + itb->x + it->x - itb->wd->pan_x;
4198 ity = oy + itb->y + it->y - itb->wd->pan_y;
4199 if (ELM_RECTS_INTERSECT(itx, ity, it->item->w, it->item->h, x, y, 1, 1))
4203 if (y <= (ity + (it->item->h / 4))) *posret = -1;
4204 else if (y >= (ity + it->item->h - (it->item->h / 4)))
4208 return (Elm_Object_Item *) it;
4210 lasty = ity + it->item->h;
4215 if (y > lasty) *posret = 1;
4221 EAPI Elm_Object_Item *
4222 elm_genlist_first_item_get(const Evas_Object *obj)
4224 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4225 Widget_Data *wd = elm_widget_data_get(obj);
4226 if (!wd) return NULL;
4227 if (!wd->items) return NULL;
4228 Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items);
4229 while ((it) && (it->generation < wd->generation))
4230 it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
4231 return (Elm_Object_Item *) it;
4234 EAPI Elm_Object_Item *
4235 elm_genlist_last_item_get(const Evas_Object *obj)
4237 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4238 Widget_Data *wd = elm_widget_data_get(obj);
4239 if (!wd) return NULL;
4240 if (!wd->items) return NULL;
4241 Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
4242 while ((it) && (it->generation < wd->generation))
4243 it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
4244 return (Elm_Object_Item *) it;
4247 EAPI Elm_Object_Item *
4248 elm_genlist_item_next_get(const Elm_Object_Item *it)
4250 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
4251 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4254 _it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(_it)->next);
4255 if ((_it) && (_it->generation == _it->wd->generation)) break;
4257 return (Elm_Object_Item *) _it;
4260 EAPI Elm_Object_Item *
4261 elm_genlist_item_prev_get(const Elm_Object_Item *it)
4263 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
4264 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4267 _it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(_it)->prev);
4268 if ((_it) && (_it->generation == _it->wd->generation)) break;
4270 return (Elm_Object_Item *) _it;
4274 elm_genlist_item_genlist_get(const Elm_Object_Item *it)
4276 return elm_object_item_widget_get(it);
4279 EAPI Elm_Object_Item *
4280 elm_genlist_item_parent_get(const Elm_Object_Item *it)
4282 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
4283 return (Elm_Object_Item *) ((Elm_Gen_Item *) it)->parent;
4287 elm_genlist_item_subitems_clear(Elm_Object_Item *it)
4289 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4290 Eina_List *tl = NULL, *l;
4292 Elm_Object_Item *it2;
4293 _it = (Elm_Gen_Item *) it;
4295 EINA_LIST_FOREACH(_it->item->items, l, it2)
4296 tl = eina_list_append(tl, it2);
4297 EINA_LIST_FREE(tl, it2)
4298 elm_genlist_item_del(it2);
4302 elm_genlist_item_selected_set(Elm_Object_Item *it,
4305 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4306 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4307 Widget_Data *wd = _it->wd;
4309 if ((_it->generation < wd->generation) || elm_widget_item_disabled_get(_it))
4311 selected = !!selected;
4312 if (_it->selected == selected) return;
4318 while (wd->selected)
4320 if (_it->unhighlight_cb) _it->unhighlight_cb(wd->selected->data);
4321 _it->unsel_cb(wd->selected->data);
4324 _it->highlight_cb(_it);
4328 if (_it->unhighlight_cb) _it->unhighlight_cb(_it);
4333 elm_genlist_item_selected_get(const Elm_Object_Item *it)
4335 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
4336 return ((Elm_Gen_Item *) it)->selected;
4340 elm_genlist_item_expanded_set(Elm_Object_Item *it,
4343 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4344 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4345 if (_it->item->expanded == expanded) return;
4346 _it->item->expanded = expanded;
4347 _it->wd->expanded_item = _it;
4348 if (_it->item->expanded)
4351 edje_object_signal_emit(VIEW(_it), "elm,state,expanded", "elm");
4352 evas_object_smart_callback_call(WIDGET(_it), SIG_EXPANDED, _it);
4353 _it->wd->auto_scroll_enabled = EINA_TRUE;
4358 edje_object_signal_emit(VIEW(_it), "elm,state,contracted", "elm");
4359 evas_object_smart_callback_call(WIDGET(_it), SIG_CONTRACTED, _it);
4360 _it->wd->auto_scroll_enabled = EINA_FALSE;
4365 elm_genlist_item_expanded_get(const Elm_Object_Item *it)
4367 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
4368 return ((Elm_Gen_Item *) it)->item->expanded;
4372 elm_genlist_item_expanded_depth_get(const Elm_Object_Item *it)
4374 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, 0);
4375 return ((Elm_Gen_Item *) it)->item->expanded_depth;
4379 elm_genlist_item_disabled_set(Elm_Object_Item *it,
4382 elm_object_item_disabled_set(it, disabled);
4386 elm_genlist_item_disabled_get(const Elm_Object_Item *it)
4388 return elm_object_item_disabled_get(it);
4392 elm_genlist_item_display_only_set(Elm_Object_Item *it,
4393 Eina_Bool display_only)
4395 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4396 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4397 display_only = !!display_only;
4398 if (_it->display_only == display_only) return;
4399 if (_it->generation < _it->wd->generation) return;
4400 _it->display_only = display_only;
4401 _it->item->mincalcd = EINA_FALSE;
4402 _it->item->updateme = EINA_TRUE;
4403 if (_it->item->block) _it->item->block->updateme = EINA_TRUE;
4404 if (_it->wd->update_job) ecore_job_del(_it->wd->update_job);
4405 _it->wd->update_job = ecore_job_add(_update_job, _it->wd);
4409 elm_genlist_item_display_only_get(const Elm_Object_Item *it)
4411 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
4412 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4413 if (_it->generation < _it->wd->generation) return EINA_FALSE;
4414 return _it->display_only;
4418 elm_genlist_item_show(Elm_Object_Item *it)
4420 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4421 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4422 Evas_Coord gith = 0;
4423 if (_it->generation < _it->wd->generation) return;
4424 if ((_it->item->queued) || (!_it->item->mincalcd))
4426 _it->wd->show_item = _it;
4427 _it->wd->bring_in = EINA_FALSE;
4428 _it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN;
4429 _it->item->showme = EINA_TRUE;
4432 if (_it->wd->show_item)
4434 _it->wd->show_item->item->showme = EINA_FALSE;
4435 _it->wd->show_item = NULL;
4437 if ((_it->item->group_item) &&
4438 (_it->wd->pan_y > (_it->y + _it->item->block->y)))
4439 gith = _it->item->group_item->item->h;
4440 elm_smart_scroller_child_region_show(_it->wd->scr,
4441 _it->x + _it->item->block->x,
4442 _it->y + _it->item->block->y - gith,
4443 _it->item->block->w, _it->item->h);
4447 elm_genlist_item_promote(Elm_Object_Item *it)
4449 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4450 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4451 if (_it->generation < _it->wd->generation) return;
4452 _item_move_before(_it,
4453 (Elm_Gen_Item *) elm_genlist_first_item_get(WIDGET(_it)));
4457 elm_genlist_item_demote(Elm_Object_Item *it)
4459 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4460 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4461 if (_it->generation < _it->wd->generation) return;
4462 _item_move_after(_it,
4463 (Elm_Gen_Item *) elm_genlist_last_item_get(WIDGET(_it)));
4467 elm_genlist_item_bring_in(Elm_Object_Item *it)
4469 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4470 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4471 Evas_Coord gith = 0;
4472 if (_it->generation < _it->wd->generation) return;
4473 if ((_it->item->queued) || (!_it->item->mincalcd))
4475 _it->wd->show_item = _it;
4476 _it->wd->bring_in = EINA_TRUE;
4477 _it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN;
4478 _it->item->showme = EINA_TRUE;
4481 if (_it->wd->show_item)
4483 _it->wd->show_item->item->showme = EINA_FALSE;
4484 _it->wd->show_item = NULL;
4486 if ((_it->item->group_item) &&
4487 (_it->wd->pan_y > (_it->y + _it->item->block->y)))
4488 gith = _it->item->group_item->item->h;
4489 elm_smart_scroller_region_bring_in(_it->wd->scr,
4490 _it->x + _it->item->block->x,
4491 _it->y + _it->item->block->y - gith,
4492 _it->item->block->w, _it->item->h);
4496 elm_genlist_item_top_show(Elm_Object_Item *it)
4498 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4499 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4501 Evas_Coord gith = 0;
4503 if (_it->generation < _it->wd->generation) return;
4504 if ((_it->item->queued) || (!_it->item->mincalcd))
4506 _it->wd->show_item = _it;
4507 _it->wd->bring_in = EINA_FALSE;
4508 _it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_TOP;
4509 _it->item->showme = EINA_TRUE;
4512 if (_it->wd->show_item)
4514 _it->wd->show_item->item->showme = EINA_FALSE;
4515 _it->wd->show_item = NULL;
4517 evas_object_geometry_get(_it->wd->pan_smart, NULL, NULL, &ow, &oh);
4518 if (_it->item->group_item) gith = _it->item->group_item->item->h;
4519 elm_smart_scroller_child_region_show(_it->wd->scr,
4520 _it->x + _it->item->block->x,
4521 _it->y + _it->item->block->y - gith,
4522 _it->item->block->w, oh);
4526 elm_genlist_item_top_bring_in(Elm_Object_Item *it)
4528 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4529 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4531 Evas_Coord gith = 0;
4533 if (_it->generation < _it->wd->generation) return;
4534 if ((_it->item->queued) || (!_it->item->mincalcd))
4536 _it->wd->show_item = _it;
4537 _it->wd->bring_in = EINA_TRUE;
4538 _it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_TOP;
4539 _it->item->showme = EINA_TRUE;
4542 if (_it->wd->show_item)
4544 _it->wd->show_item->item->showme = EINA_FALSE;
4545 _it->wd->show_item = NULL;
4547 evas_object_geometry_get(_it->wd->pan_smart, NULL, NULL, &ow, &oh);
4548 if (_it->item->group_item) gith = _it->item->group_item->item->h;
4549 elm_smart_scroller_region_bring_in(_it->wd->scr,
4550 _it->x + _it->item->block->x,
4551 _it->y + _it->item->block->y - gith,
4552 _it->item->block->w, oh);
4556 elm_genlist_item_middle_show(Elm_Object_Item *it)
4558 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4559 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4562 if (_it->generation < _it->wd->generation) return;
4563 if ((_it->item->queued) || (!_it->item->mincalcd))
4565 _it->wd->show_item = _it;
4566 _it->wd->bring_in = EINA_FALSE;
4567 _it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_MIDDLE;
4568 _it->item->showme = EINA_TRUE;
4571 if (_it->wd->show_item)
4573 _it->wd->show_item->item->showme = EINA_FALSE;
4574 _it->wd->show_item = NULL;
4576 evas_object_geometry_get(_it->wd->pan_smart, NULL, NULL, &ow, &oh);
4577 elm_smart_scroller_child_region_show(_it->wd->scr,
4578 _it->x + _it->item->block->x,
4579 _it->y + _it->item->block->y - oh / 2 +
4580 _it->item->h / 2, _it->item->block->w,
4585 elm_genlist_item_middle_bring_in(Elm_Object_Item *it)
4587 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4588 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4591 if (_it->generation < _it->wd->generation) return;
4592 if ((_it->item->queued) || (!_it->item->mincalcd))
4594 _it->wd->show_item = _it;
4595 _it->wd->bring_in = EINA_TRUE;
4596 _it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_MIDDLE;
4597 _it->item->showme = EINA_TRUE;
4600 if (_it->wd->show_item)
4602 _it->wd->show_item->item->showme = EINA_FALSE;
4603 _it->wd->show_item = NULL;
4605 evas_object_geometry_get(_it->wd->pan_smart, NULL, NULL, &ow, &oh);
4606 elm_smart_scroller_region_bring_in(_it->wd->scr,
4607 _it->x + _it->item->block->x,
4608 _it->y + _it->item->block->y - oh / 2 +
4609 _it->item->h / 2, _it->item->block->w,
4614 elm_genlist_item_del(Elm_Object_Item *it)
4616 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4617 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4619 if ((_it->relcount > 0) || (_it->walking > 0))
4621 elm_genlist_item_subitems_clear(it);
4622 if (_it->wd->show_item == _it) _it->wd->show_item = NULL;
4623 _elm_genlist_item_del_notserious(_it);
4624 if (_it->item->block)
4626 if (_it->realized) _elm_genlist_item_unrealize(_it, EINA_FALSE);
4627 _it->item->block->changed = EINA_TRUE;
4628 if (_it->wd->calc_job) ecore_job_del(_it->wd->calc_job);
4629 _it->wd->calc_job = ecore_job_add(_calc_job, _it->wd);
4633 _it->parent->item->items =
4634 eina_list_remove(_it->parent->item->items, it);
4643 elm_genlist_item_data_set(Elm_Object_Item *it,
4646 elm_object_item_data_set(it, (void *) data);
4650 elm_genlist_item_data_get(const Elm_Object_Item *it)
4652 return elm_object_item_data_get(it);
4656 elm_genlist_item_icons_orphan(Elm_Object_Item *it)
4658 elm_genlist_item_contents_orphan(it);
4662 elm_genlist_item_contents_orphan(Elm_Object_Item *it)
4664 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4666 Evas_Object *content;
4667 EINA_LIST_FREE(((Elm_Gen_Item *) it)->content_objs, content)
4669 elm_widget_sub_object_del(WIDGET(it), content);
4670 evas_object_smart_member_del(content);
4671 evas_object_hide(content);
4675 EAPI const Evas_Object *
4676 elm_genlist_item_object_get(const Elm_Object_Item *it)
4678 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
4683 elm_genlist_item_update(Elm_Object_Item *it)
4685 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4686 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4688 if (!_it->item->block) return;
4689 if (_it->generation < _it->wd->generation) return;
4690 _it->item->mincalcd = EINA_FALSE;
4691 _it->item->updateme = EINA_TRUE;
4692 _it->item->block->updateme = EINA_TRUE;
4693 if (_it->wd->update_job) ecore_job_del(_it->wd->update_job);
4694 _it->wd->update_job = ecore_job_add(_update_job, _it->wd);
4698 elm_genlist_item_fields_update(Elm_Object_Item *it,
4700 Elm_Genlist_Item_Field_Flags itf)
4702 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4703 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4705 if (!_it->item->block) return;
4706 if (_it->generation < _it->wd->generation) return;
4708 if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_LABEL))
4709 _item_text_realize(_it, _it->base.view, &_it->texts, parts);
4710 if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_CONTENT))
4712 _it->content_objs = _item_content_unrealize(_it, _it->base.view,
4713 &_it->contents, parts);
4714 _it->content_objs = _item_content_realize(_it, _it->base.view,
4715 &_it->contents, parts);
4717 if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_STATE))
4718 _item_state_realize(_it, _it->base.view, &_it->states, parts);
4722 elm_genlist_item_item_class_update(Elm_Object_Item *it,
4723 const Elm_Genlist_Item_Class *itc)
4725 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4726 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4728 if (!_it->item->block) return;
4729 EINA_SAFETY_ON_NULL_RETURN(itc);
4730 if (_it->generation < _it->wd->generation) return;
4732 _it->item->nocache = EINA_TRUE;
4733 elm_genlist_item_update(it);
4736 EAPI const Elm_Genlist_Item_Class *
4737 elm_genlist_item_item_class_get(const Elm_Object_Item *it)
4739 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
4740 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4741 if (_it->generation < _it->wd->generation) return NULL;
4745 static Evas_Object *
4746 _elm_genlist_item_label_create(void *data,
4747 Evas_Object *obj __UNUSED__,
4748 Evas_Object *tooltip,
4749 void *it __UNUSED__)
4751 Evas_Object *label = elm_label_add(tooltip);
4754 elm_object_style_set(label, "tooltip");
4755 elm_object_text_set(label, data);
4760 _elm_genlist_item_label_del_cb(void *data,
4761 Evas_Object *obj __UNUSED__,
4762 void *event_info __UNUSED__)
4764 eina_stringshare_del(data);
4768 elm_genlist_item_tooltip_text_set(Elm_Object_Item *it,
4771 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4772 text = eina_stringshare_add(text);
4773 elm_genlist_item_tooltip_content_cb_set(it, _elm_genlist_item_label_create,
4775 _elm_genlist_item_label_del_cb);
4779 elm_genlist_item_tooltip_content_cb_set(Elm_Object_Item *it,
4780 Elm_Tooltip_Item_Content_Cb func,
4782 Evas_Smart_Cb del_cb)
4784 ELM_OBJ_ITEM_CHECK_OR_GOTO(it, error);
4785 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4787 if ((_it->tooltip.content_cb == func) && (_it->tooltip.data == data))
4790 if (_it->tooltip.del_cb)
4791 _it->tooltip.del_cb((void *) _it->tooltip.data, WIDGET(it), it);
4793 _it->tooltip.content_cb = func;
4794 _it->tooltip.data = data;
4795 _it->tooltip.del_cb = del_cb;
4799 elm_widget_item_tooltip_content_cb_set(_it,
4800 _it->tooltip.content_cb,
4801 _it->tooltip.data, NULL);
4802 elm_widget_item_tooltip_style_set(_it, _it->tooltip.style);
4803 elm_widget_item_tooltip_window_mode_set(_it, _it->tooltip.free_size);
4809 if (del_cb) del_cb((void *)data, NULL, NULL);
4813 elm_genlist_item_tooltip_unset(Elm_Object_Item *it)
4815 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4816 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4818 if ((VIEW(_it)) && (_it->tooltip.content_cb))
4819 elm_widget_item_tooltip_unset(_it);
4821 if (_it->tooltip.del_cb)
4822 _it->tooltip.del_cb((void *) _it->tooltip.data, WIDGET(_it), _it);
4823 _it->tooltip.del_cb = NULL;
4824 _it->tooltip.content_cb = NULL;
4825 _it->tooltip.data = NULL;
4826 _it->tooltip.free_size = EINA_FALSE;
4827 if (_it->tooltip.style)
4828 elm_genlist_item_tooltip_style_set(it, NULL);
4832 elm_genlist_item_tooltip_style_set(Elm_Object_Item *it,
4835 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4836 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4838 eina_stringshare_replace(&_it->tooltip.style, style);
4839 if (VIEW(_it)) elm_widget_item_tooltip_style_set(_it, style);
4843 elm_genlist_item_tooltip_style_get(const Elm_Object_Item *it)
4845 return elm_object_item_tooltip_style_get(it);
4849 elm_genlist_item_tooltip_window_mode_set(Elm_Object_Item *it,
4852 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
4853 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4855 _it->tooltip.free_size = disable;
4856 if (VIEW(_it)) return elm_widget_item_tooltip_window_mode_set(_it, disable);
4861 elm_genlist_item_tooltip_window_mode_get(const Elm_Object_Item *it)
4863 return elm_object_tooltip_window_mode_get(VIEW(it));
4867 elm_genlist_item_cursor_set(Elm_Object_Item *it,
4870 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4871 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4872 eina_stringshare_replace(&_it->mouse_cursor, cursor);
4873 if (VIEW(_it)) elm_widget_item_cursor_set(_it, cursor);
4877 elm_genlist_item_cursor_get(const Elm_Object_Item *it)
4879 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
4880 return elm_widget_item_cursor_get(it);
4884 elm_genlist_item_cursor_unset(Elm_Object_Item *it)
4886 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4887 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4889 if (!_it->mouse_cursor) return;
4891 if (VIEW(_it)) elm_widget_item_cursor_unset(_it);
4893 eina_stringshare_del(_it->mouse_cursor);
4894 _it->mouse_cursor = NULL;
4898 elm_genlist_item_cursor_style_set(Elm_Object_Item *it,
4901 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4902 elm_widget_item_cursor_style_set(it, style);
4906 elm_genlist_item_cursor_style_get(const Elm_Object_Item *it)
4908 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
4909 return elm_widget_item_cursor_style_get(it);
4913 elm_genlist_item_cursor_engine_only_set(Elm_Object_Item *it,
4914 Eina_Bool engine_only)
4916 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
4917 elm_widget_item_cursor_engine_only_set(it, engine_only);
4921 elm_genlist_item_cursor_engine_only_get(const Elm_Object_Item *it)
4923 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
4924 return elm_widget_item_cursor_engine_only_get(it);
4928 elm_genlist_item_index_get(Elm_Object_Item *it)
4930 ELM_OBJ_ITEM_CHECK_OR_RETURN(it, -1);
4931 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
4933 if (_it->item->block)
4934 return _it->position + _it->item->block->position;
4939 elm_genlist_mode_set(Evas_Object *obj,
4942 ELM_CHECK_WIDTYPE(obj, widtype);
4943 Widget_Data *wd = elm_widget_data_get(obj);
4945 if (wd->mode == mode) return;
4951 elm_genlist_horizontal_set(Evas_Object *obj,
4954 elm_genlist_mode_set(obj, mode);
4958 elm_genlist_horizontal_mode_set(Evas_Object *obj,
4961 elm_genlist_mode_set(obj, mode);
4965 elm_genlist_mode_get(const Evas_Object *obj)
4967 ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
4968 Widget_Data *wd = elm_widget_data_get(obj);
4969 if (!wd) return ELM_LIST_LAST;
4974 elm_genlist_horizontal_get(const Evas_Object *obj)
4976 return elm_genlist_mode_get(obj);
4980 elm_genlist_horizontal_mode_get(const Evas_Object *obj)
4982 return elm_genlist_mode_get(obj);
4986 elm_genlist_always_select_mode_set(Evas_Object *obj,
4987 Eina_Bool always_select)
4989 ELM_CHECK_WIDTYPE(obj, widtype);
4990 Widget_Data *wd = elm_widget_data_get(obj);
4992 wd->always_select = always_select;
4996 elm_genlist_always_select_mode_get(const Evas_Object *obj)
4998 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4999 Widget_Data *wd = elm_widget_data_get(obj);
5000 if (!wd) return EINA_FALSE;
5001 return wd->always_select;
5005 elm_genlist_no_select_mode_set(Evas_Object *obj,
5006 Eina_Bool no_select)
5008 ELM_CHECK_WIDTYPE(obj, widtype);
5009 Widget_Data *wd = elm_widget_data_get(obj);
5011 wd->no_select = no_select;
5015 elm_genlist_no_select_mode_get(const Evas_Object *obj)
5017 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5018 Widget_Data *wd = elm_widget_data_get(obj);
5019 if (!wd) return EINA_FALSE;
5020 return wd->no_select;
5024 elm_genlist_compress_mode_set(Evas_Object *obj,
5027 ELM_CHECK_WIDTYPE(obj, widtype);
5028 Widget_Data *wd = elm_widget_data_get(obj);
5030 wd->compress = compress;
5031 if (!compress) elm_genlist_homogeneous_set(obj, EINA_FALSE);
5035 elm_genlist_compress_mode_get(const Evas_Object *obj)
5037 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5038 Widget_Data *wd = elm_widget_data_get(obj);
5039 if (!wd) return EINA_FALSE;
5040 return wd->compress;
5044 elm_genlist_height_for_width_mode_set(Evas_Object *obj,
5045 Eina_Bool height_for_width)
5047 ELM_CHECK_WIDTYPE(obj, widtype);
5048 Widget_Data *wd = elm_widget_data_get(obj);
5050 wd->height_for_width = !!height_for_width;
5051 if (wd->height_for_width)
5053 elm_genlist_homogeneous_set(obj, EINA_FALSE);
5054 elm_genlist_compress_mode_set(obj, EINA_TRUE);
5059 elm_genlist_height_for_width_mode_get(const Evas_Object *obj)
5061 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5062 Widget_Data *wd = elm_widget_data_get(obj);
5063 if (!wd) return EINA_FALSE;
5064 return wd->height_for_width;
5068 elm_genlist_bounce_set(Evas_Object *obj,
5072 ELM_CHECK_WIDTYPE(obj, widtype);
5073 Widget_Data *wd = elm_widget_data_get(obj);
5075 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
5076 wd->h_bounce = h_bounce;
5077 wd->v_bounce = v_bounce;
5081 elm_genlist_bounce_get(const Evas_Object *obj,
5082 Eina_Bool *h_bounce,
5083 Eina_Bool *v_bounce)
5085 ELM_CHECK_WIDTYPE(obj, widtype);
5086 Widget_Data *wd = elm_widget_data_get(obj);
5088 if (h_bounce) *h_bounce = wd->h_bounce;
5089 if (v_bounce) *v_bounce = wd->v_bounce;
5093 elm_genlist_homogeneous_set(Evas_Object *obj,
5094 Eina_Bool homogeneous)
5096 ELM_CHECK_WIDTYPE(obj, widtype);
5097 Widget_Data *wd = elm_widget_data_get(obj);
5099 if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
5100 wd->homogeneous = homogeneous;
5104 elm_genlist_homogeneous_get(const Evas_Object *obj)
5106 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5107 Widget_Data *wd = elm_widget_data_get(obj);
5108 if (!wd) return EINA_FALSE;
5109 return wd->homogeneous;
5113 elm_genlist_block_count_set(Evas_Object *obj,
5116 ELM_CHECK_WIDTYPE(obj, widtype);
5117 Widget_Data *wd = elm_widget_data_get(obj);
5119 wd->max_items_per_block = n;
5120 wd->item_cache_max = wd->max_items_per_block * 2;
5121 _item_cache_clean(wd);
5125 elm_genlist_block_count_get(const Evas_Object *obj)
5127 ELM_CHECK_WIDTYPE(obj, widtype) 0;
5128 Widget_Data *wd = elm_widget_data_get(obj);
5130 return wd->max_items_per_block;
5134 elm_genlist_longpress_timeout_set(Evas_Object *obj,
5137 ELM_CHECK_WIDTYPE(obj, widtype);
5138 Widget_Data *wd = elm_widget_data_get(obj);
5140 wd->longpress_timeout = timeout;
5144 elm_genlist_longpress_timeout_get(const Evas_Object *obj)
5146 ELM_CHECK_WIDTYPE(obj, widtype) 0;
5147 Widget_Data *wd = elm_widget_data_get(obj);
5149 return wd->longpress_timeout;
5153 elm_genlist_scroller_policy_set(Evas_Object *obj,
5154 Elm_Scroller_Policy policy_h,
5155 Elm_Scroller_Policy policy_v)
5157 ELM_CHECK_WIDTYPE(obj, widtype);
5158 Widget_Data *wd = elm_widget_data_get(obj);
5159 if ((!wd) || (!wd->scr)) return;
5160 if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
5161 (policy_v >= ELM_SCROLLER_POLICY_LAST))
5163 elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
5167 elm_genlist_scroller_policy_get(const Evas_Object *obj,
5168 Elm_Scroller_Policy *policy_h,
5169 Elm_Scroller_Policy *policy_v)
5171 ELM_CHECK_WIDTYPE(obj, widtype);
5172 Widget_Data *wd = elm_widget_data_get(obj);
5173 Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
5174 if ((!wd) || (!wd->scr)) return;
5175 elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
5176 if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
5177 if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
5181 elm_genlist_realized_items_update(Evas_Object *obj)
5183 ELM_CHECK_WIDTYPE(obj, widtype);
5185 Eina_List *list, *l;
5186 Elm_Object_Item *it;
5188 list = elm_genlist_realized_items_get(obj);
5189 EINA_LIST_FOREACH(list, l, it)
5190 elm_genlist_item_update(it);
5194 elm_genlist_item_mode_set(Elm_Object_Item *it,
5195 const char *mode_type,
5198 ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
5199 Elm_Gen_Item *_it = (Elm_Gen_Item *) it;
5201 Widget_Data *wd = _it->wd;
5203 Elm_Object_Item *it2;
5206 if (!mode_type) return;
5207 if ((_it->generation < _it->wd->generation) ||
5208 elm_widget_item_disabled_get(_it)) return;
5210 if ((wd->mode_item == _it) &&
5211 (!strcmp(mode_type, wd->mode_type)) &&
5214 if (!wd->mode_item_style) return;
5215 _it->mode_set = mode_set;
5219 EINA_LIST_FOREACH(wd->selected, l, it2)
5220 if (((Elm_Gen_Item *) it2)->realized)
5221 elm_genlist_item_selected_set(it2, EINA_FALSE);
5225 it2 = elm_genlist_selected_item_get(wd->obj);
5226 if ((it2) && (((Elm_Gen_Item *) it2)->realized))
5227 elm_genlist_item_selected_set(it2, EINA_FALSE);
5230 if (((wd->mode_type) && (strcmp(mode_type, wd->mode_type))) ||
5232 ((_it == wd->mode_item) && (!mode_set)))
5233 _item_mode_unset(wd);
5235 eina_stringshare_replace(&wd->mode_type, mode_type);
5236 if (mode_set) _item_mode_set(_it);
5241 elm_genlist_mode_item_style_get(const Evas_Object *obj)
5243 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5244 Widget_Data *wd = elm_widget_data_get(obj);
5245 if (!wd) return NULL;
5246 return wd->mode_item_style;
5250 elm_genlist_mode_item_style_set(Evas_Object *obj, const char *style)
5252 ELM_CHECK_WIDTYPE(obj, widtype);
5253 Widget_Data *wd = elm_widget_data_get(obj);
5255 if ((style == wd->mode_item_style) || (style && wd->mode_item_style &&
5256 (!strcmp(style, wd->mode_item_style))))
5258 eina_stringshare_replace(&wd->mode_item_style, style);
5259 elm_genlist_realized_items_update(obj);
5263 elm_genlist_mode_type_get(const Evas_Object *obj)
5265 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5266 Widget_Data *wd = elm_widget_data_get(obj);
5267 if (!wd) return NULL;
5268 return wd->mode_type;
5271 EAPI const Elm_Object_Item *
5272 elm_genlist_mode_item_get(const Evas_Object *obj)
5274 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5275 Widget_Data *wd = elm_widget_data_get(obj);
5276 if (!wd) return NULL;
5277 return (Elm_Object_Item *) wd->mode_item;
5281 elm_genlist_reorder_mode_set(Evas_Object *obj,
5282 Eina_Bool reorder_mode)
5284 ELM_CHECK_WIDTYPE(obj, widtype);
5285 Widget_Data *wd = elm_widget_data_get(obj);
5287 wd->reorder_mode = reorder_mode;
5291 elm_genlist_reorder_mode_get(const Evas_Object *obj)
5293 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5294 Widget_Data *wd = elm_widget_data_get(obj);
5295 if (!wd) return EINA_FALSE;
5296 return wd->reorder_mode;
5299 /* for gengrid as of now */
5301 _elm_genlist_page_relative_set(Evas_Object *obj,
5305 Evas_Coord pagesize_h;
5306 Evas_Coord pagesize_v;
5308 ELM_CHECK_WIDTYPE(obj, widtype);
5309 Widget_Data *wd = elm_widget_data_get(obj);
5312 elm_smart_scroller_paging_get(wd->scr, NULL, NULL, &pagesize_h, &pagesize_v);
5313 elm_smart_scroller_paging_set(wd->scr, h_pagerel, v_pagerel, pagesize_h,
5317 /* for gengrid as of now */
5319 _elm_genlist_page_relative_get(const Evas_Object *obj,
5323 ELM_CHECK_WIDTYPE(obj, widtype);
5324 Widget_Data *wd = elm_widget_data_get(obj);
5327 elm_smart_scroller_paging_get(wd->scr, h_pagerel, v_pagerel, NULL, NULL);
5330 /* for gengrid as of now */
5332 _elm_genlist_page_size_set(Evas_Object *obj,
5333 Evas_Coord h_pagesize,
5334 Evas_Coord v_pagesize)
5339 ELM_CHECK_WIDTYPE(obj, widtype);
5340 Widget_Data *wd = elm_widget_data_get(obj);
5342 elm_smart_scroller_paging_get(wd->scr, &pagerel_h, &pagerel_v, NULL, NULL);
5343 elm_smart_scroller_paging_set(wd->scr, pagerel_h, pagerel_v, h_pagesize,
5347 /* for gengrid as of now */
5349 _elm_genlist_current_page_get(const Evas_Object *obj,
5353 ELM_CHECK_WIDTYPE(obj, widtype);
5354 Widget_Data *wd = elm_widget_data_get(obj);
5357 elm_smart_scroller_current_page_get(wd->scr, h_pagenumber, v_pagenumber);
5360 /* for gengrid as of now */
5362 _elm_genlist_last_page_get(const Evas_Object *obj,
5366 ELM_CHECK_WIDTYPE(obj, widtype);
5367 Widget_Data *wd = elm_widget_data_get(obj);
5370 elm_smart_scroller_last_page_get(wd->scr, h_pagenumber, v_pagenumber);
5373 /* for gengrid as of now */
5375 _elm_genlist_page_show(const Evas_Object *obj,
5379 ELM_CHECK_WIDTYPE(obj, widtype);
5380 Widget_Data *wd = elm_widget_data_get(obj);
5383 elm_smart_scroller_page_show(wd->scr, h_pagenumber, v_pagenumber);
5386 /* for gengrid as of now */
5388 _elm_genlist_page_bring_in(const Evas_Object *obj,
5392 ELM_CHECK_WIDTYPE(obj, widtype);
5393 Widget_Data *wd = elm_widget_data_get(obj);
5396 elm_smart_scroller_page_bring_in(wd->scr, h_pagenumber, v_pagenumber);
5400 _elm_genlist_item_widget_get(const Elm_Gen_Item *it)
5402 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
5407 _elm_genlist_item_unrealize(Elm_Gen_Item *it,
5410 Evas_Object *content;
5412 if (!it->realized) return;
5413 if (it->wd->reorder_it == it) return;
5414 evas_event_freeze(evas_object_evas_get(WIDGET(it)));
5416 evas_object_smart_callback_call(WIDGET(it), SIG_UNREALIZED, it);
5419 ecore_timer_del(it->long_timer);
5420 it->long_timer = NULL;
5423 elm_widget_stringlist_free(it->texts);
5425 elm_widget_stringlist_free(it->contents);
5426 it->contents = NULL;
5427 elm_widget_stringlist_free(it->states);
5430 EINA_LIST_FREE(it->content_objs, content)
5431 evas_object_del(content);
5433 it->unrealize_cb(it);
5435 it->realized = EINA_FALSE;
5436 it->want_unrealize = EINA_FALSE;
5437 evas_event_thaw(evas_object_evas_get(WIDGET(it)));
5438 evas_event_thaw_eval(evas_object_evas_get(WIDGET(it)));
5442 _elm_genlist_item_del_notserious(Elm_Gen_Item *it)
5444 elm_widget_item_pre_notify_del(it);
5445 it->generation = it->wd->generation - 1; /* This means that the item is deleted */
5446 if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it);
5448 if (it->itc->func.del)
5449 it->itc->func.del((void *)it->base.data, WIDGET(it));
5453 _elm_genlist_item_del_serious(Elm_Gen_Item *it)
5455 _elm_genlist_item_del_notserious(it);
5456 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
5457 if (it->tooltip.del_cb)
5458 it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
5459 it->wd->walking -= it->walking;
5460 if (it->long_timer) ecore_timer_del(it->long_timer);
5462 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
5466 eina_inlist_sorted_state_free(it->wd->state);
5467 it->wd->state = NULL;
5469 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
5470 it->wd->calc_job = ecore_job_add(it->wd->calc_cb, it->wd);
5474 if (it->wd->last_selected_item == it)
5475 it->wd->last_selected_item = NULL;
5476 elm_widget_item_del(it);