3 #include <Elementary.h>
4 #include <Elementary_Cursor.h>
6 #include "els_scroller.h"
10 #define MAX_ITEMS_PER_BLOCK 32
11 #define REORDER_EFFECT_TIME 0.5
13 #define ELM_GEN_SETUP(wd) \
14 (wd)->calc_cb = (Ecore_Cb)_calc_job; \
15 (wd)->clear_cb = (Ecore_Cb)_clear_cb; \
16 (wd)->sizing_cb = (Ecore_Cb)_sizing_eval
19 #define ELM_GEN_ITEM_SETUP(it) \
20 (it)->del_cb = (Ecore_Cb)_item_del; \
21 (it)->highlight_cb = (Ecore_Cb)_item_highlight; \
22 (it)->unsel_cb = (Ecore_Cb)_item_unselect; \
23 (it)->unhighlight_cb = (Ecore_Cb)_item_unhighlight; \
24 (it)->unrealize_cb = (Ecore_Cb)_item_unrealize_cb
26 typedef struct _Item_Block Item_Block;
27 typedef struct _Item_Cache Item_Cache;
29 struct Elm_Gen_Item_Type
34 Evas_Coord w, h, minw, minh;
35 Elm_Gen_Item *group_item;
36 Elm_Genlist_Item_Flags flags;
37 Eina_List *mode_labels, *mode_icons, *mode_states, *mode_icon_objs;
38 Ecore_Timer *swipe_timer;
39 Evas_Coord scrl_x, scrl_y, old_scrl_y;
42 Evas_Object *mode_view;
48 Eina_Bool want_realize : 1;
49 Eina_Bool expanded : 1;
50 Eina_Bool mincalcd : 1;
53 Eina_Bool updateme : 1;
54 Eina_Bool nocache : 1;
55 Eina_Bool stacking_even : 1;
56 Eina_Bool nostacking : 1;
57 Eina_Bool move_effect_enabled : 1;
62 Eina_Inlist_Sorted_State *state;
63 Evas_Object *obj; /* the genlist object */
64 Evas_Object *scr; /* a smart scroller object which is used internally in genlist */
65 Evas_Object *pan_smart; /* "elm_genlist_pan" evas smart object. this is an extern pan of smart scroller(scr). */
67 Eina_List *group_items; /* list of groups index items */
68 Eina_Inlist *items; /* inlist of all items */
69 Elm_Gen_Item *reorder_it; /* item currently being repositioned */
70 Elm_Gen_Item *last_selected_item;
71 Pan *pan; /* pan_smart object's smart data */
74 int item_width, item_height;
75 int group_item_width, group_item_height;
78 Evas_Coord pan_x, pan_y;
79 Eina_Bool reorder_mode : 1;
80 Eina_Bool on_hold : 1;
82 Eina_Bool no_select : 1;
83 Eina_Bool wasselected : 1;
84 Eina_Bool always_select : 1;
85 Eina_Bool clear_me : 1;
86 Ecore_Cb del_cb, calc_cb, sizing_cb;
88 ////////////////////////////////////
89 Eina_Inlist *blocks; /* inlist of all blocks. a block consists of a certain number of items. maximum number of items in a block is 'max_items_per_block'. */
90 Evas_Coord reorder_old_pan_y, w, h, realminw, prev_viewport_w;
91 Ecore_Job *update_job;
92 Ecore_Idle_Enterer *queue_idle_enterer;
93 Ecore_Idler *must_recalc_idler;
95 Elm_Gen_Item *show_item, *anchor_item, *mode_item, *reorder_rel, *expanded_item;
96 Eina_Inlist *item_cache; /* an inlist of edje object it cache. */
98 Evas_Coord reorder_start_y; /* reorder it's initial y coordinate in the pan. */
100 Ecore_Timer *multi_timer, *scr_hold_timer;
101 Ecore_Animator *reorder_move_animator;
102 const char *mode_type;
103 const char *mode_item_style;
104 unsigned int start_time;
105 Evas_Coord prev_x, prev_y, prev_mx, prev_my;
106 Evas_Coord cur_x, cur_y, cur_mx, cur_my;
107 Eina_Bool mouse_down : 1;
108 Eina_Bool multi_down : 1;
109 Eina_Bool multi_timeout : 1;
110 Eina_Bool multitouched : 1;
111 Eina_Bool longpressed : 1;
112 Eina_Bool bring_in : 1;
113 Eina_Bool compress : 1;
114 Eina_Bool height_for_width : 1;
115 Eina_Bool homogeneous : 1;
117 Eina_Bool reorder_pan_move : 1;
118 Eina_Bool auto_scroll_enabled : 1;
119 Eina_Bool pan_resized : 1;
123 } history[SWIPE_MOVES];
125 int item_cache_count;
126 int item_cache_max; /* maximum number of cached items */
128 int max_items_per_block; /* maximum number of items per block */
129 double longpress_timeout; /* longpress timeout. this value comes from _elm_config by default. this can be changed by elm_genlist_longpress_timeout_set() */
140 Evas_Coord x, y, w, h, minw, minh;
141 Eina_Bool want_unrealize : 1;
142 Eina_Bool realized : 1;
143 Eina_Bool changed : 1;
144 Eina_Bool updateme : 1;
145 Eina_Bool showme : 1;
146 Eina_Bool must_recalc : 1;
153 Evas_Object *base_view, *spacer;
155 const char *item_style; // it->itc->item_style
156 Eina_Bool tree : 1; // it->group
157 Eina_Bool compress : 1; // it->wd->compress
159 Eina_Bool selected : 1; // it->selected
160 Eina_Bool disabled : 1; // it->disabled
161 Eina_Bool expanded : 1; // it->item->expanded
164 static const char *widtype = NULL;
165 static void _item_cache_zero(Widget_Data *wd);
166 static void _del_hook(Evas_Object *obj);
167 static void _mirrored_set(Evas_Object *obj,
169 static void _theme_hook(Evas_Object *obj);
170 static void _show_region_hook(void *data,
172 static void _sizing_eval(Evas_Object *obj);
173 static void _item_realize(Elm_Gen_Item *it,
176 static void _item_unrealize_cb(Elm_Gen_Item *it);
177 static void _item_block_unrealize(Item_Block *itb);
178 static void _calc_job(void *data);
179 static void _on_focus_hook(void *data,
181 static Eina_Bool _item_multi_select_up(Widget_Data *wd);
182 static Eina_Bool _item_multi_select_down(Widget_Data *wd);
183 static Eina_Bool _item_single_select_up(Widget_Data *wd);
184 static Eina_Bool _item_single_select_down(Widget_Data *wd);
185 static Eina_Bool _event_hook(Evas_Object *obj,
187 Evas_Callback_Type type,
189 static void _signal_emit_hook(Evas_Object *obj,
190 const char *emission,
192 static Eina_Bool _deselect_all_items(Widget_Data *wd);
193 static void _pan_calculate(Evas_Object *obj);
194 static void _pan_max_get(Evas_Object *obj,
197 static void _item_position(Elm_Gen_Item *it,
201 static void _mode_item_realize(Elm_Gen_Item *it);
202 static void _mode_item_unrealize(Elm_Gen_Item *it);
203 static void _item_mode_set(Elm_Gen_Item *it);
204 static void _item_mode_unset(Widget_Data *wd);
205 static void _group_items_recalc(void *data);
206 static void _item_move_after(Elm_Gen_Item *it,
207 Elm_Gen_Item *after);
208 static void _item_move_before(Elm_Gen_Item *it,
209 Elm_Gen_Item *before);
210 static void _item_auto_scroll(Widget_Data *wd);
212 static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
214 static const char SIG_ACTIVATED[] = "activated";
215 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
216 static const char SIG_SELECTED[] = "selected";
217 static const char SIG_UNSELECTED[] = "unselected";
218 static const char SIG_EXPANDED[] = "expanded";
219 static const char SIG_CONTRACTED[] = "contracted";
220 static const char SIG_EXPAND_REQUEST[] = "expand,request";
221 static const char SIG_CONTRACT_REQUEST[] = "contract,request";
222 static const char SIG_REALIZED[] = "realized";
223 static const char SIG_UNREALIZED[] = "unrealized";
224 static const char SIG_DRAG_START_UP[] = "drag,start,up";
225 static const char SIG_DRAG_START_DOWN[] = "drag,start,down";
226 static const char SIG_DRAG_START_LEFT[] = "drag,start,left";
227 static const char SIG_DRAG_START_RIGHT[] = "drag,start,right";
228 static const char SIG_DRAG_STOP[] = "drag,stop";
229 static const char SIG_DRAG[] = "drag";
230 static const char SIG_LONGPRESSED[] = "longpressed";
231 static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
232 static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
233 static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
234 static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
235 static const char SIG_SCROLL_EDGE_TOP[] = "scroll,edge,top"; // TODO : remove this
236 static const char SIG_SCROLL_EDGE_BOTTOM[] = "scroll,edge,bottom"; // TODO : remove this
237 static const char SIG_SCROLL_EDGE_LEFT[] = "scroll,edge,left"; // TODO : remove this
238 static const char SIG_SCROLL_EDGE_RIGHT[] = "scroll,edge,right"; // TODO : remove this
239 static const char SIG_EDGE_TOP[] = "edge,top";
240 static const char SIG_EDGE_BOTTOM[] = "edge,bottom";
241 static const char SIG_EDGE_LEFT[] = "edge,left";
242 static const char SIG_EDGE_RIGHT[] = "edge,right";
243 static const char SIG_MULTI_SWIPE_LEFT[] = "multi,swipe,left";
244 static const char SIG_MULTI_SWIPE_RIGHT[] = "multi,swipe,right";
245 static const char SIG_MULTI_SWIPE_UP[] = "multi,swipe,up";
246 static const char SIG_MULTI_SWIPE_DOWN[] = "multi,swipe,down";
247 static const char SIG_MULTI_PINCH_OUT[] = "multi,pinch,out";
248 static const char SIG_MULTI_PINCH_IN[] = "multi,pinch,in";
249 static const char SIG_SWIPE[] = "swipe";
250 static const char SIG_MOVED[] = "moved";
252 static const Evas_Smart_Cb_Description _signals[] = {
253 {SIG_CLICKED_DOUBLE, ""},
256 {SIG_UNSELECTED, ""},
258 {SIG_CONTRACTED, ""},
259 {SIG_EXPAND_REQUEST, ""},
260 {SIG_CONTRACT_REQUEST, ""},
262 {SIG_UNREALIZED, ""},
263 {SIG_DRAG_START_UP, ""},
264 {SIG_DRAG_START_DOWN, ""},
265 {SIG_DRAG_START_LEFT, ""},
266 {SIG_DRAG_START_RIGHT, ""},
269 {SIG_LONGPRESSED, ""},
270 {SIG_SCROLL_ANIM_START, ""},
271 {SIG_SCROLL_ANIM_STOP, ""},
272 {SIG_SCROLL_DRAG_START, ""},
273 {SIG_SCROLL_DRAG_STOP, ""},
274 {SIG_SCROLL_EDGE_TOP, ""},
275 {SIG_SCROLL_EDGE_BOTTOM, ""},
276 {SIG_SCROLL_EDGE_LEFT, ""},
277 {SIG_SCROLL_EDGE_RIGHT, ""},
279 {SIG_EDGE_BOTTOM, ""},
281 {SIG_EDGE_RIGHT, ""},
282 {SIG_MULTI_SWIPE_LEFT, ""},
283 {SIG_MULTI_SWIPE_RIGHT, ""},
284 {SIG_MULTI_SWIPE_UP, ""},
285 {SIG_MULTI_SWIPE_DOWN, ""},
286 {SIG_MULTI_PINCH_OUT, ""},
287 {SIG_MULTI_PINCH_IN, ""},
293 static Eina_Compare_Cb _elm_genlist_item_compare_cb;
294 static Eina_Compare_Cb _elm_genlist_item_compare_data_cb;
297 _event_hook(Evas_Object *obj,
298 Evas_Object *src __UNUSED__,
299 Evas_Callback_Type type,
302 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
303 Evas_Event_Key_Down *ev = event_info;
304 Widget_Data *wd = elm_widget_data_get(obj);
305 Evas_Coord pan_max_x = 0, pan_max_y = 0;
306 if (!wd) return EINA_FALSE;
307 if (!wd->items) return EINA_FALSE;
308 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
309 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
311 Elm_Gen_Item *it = NULL;
314 Evas_Coord step_x = 0;
315 Evas_Coord step_y = 0;
318 Evas_Coord page_x = 0;
319 Evas_Coord page_y = 0;
321 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
322 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
323 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
324 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
326 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
330 else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")))
334 else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
336 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
337 (_item_multi_select_up(wd)))
338 || (_item_single_select_up(wd)))
340 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
346 else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
348 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
349 (_item_multi_select_down(wd)))
350 || (_item_single_select_down(wd)))
352 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
358 else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
360 it = elm_genlist_first_item_get(obj);
361 elm_genlist_item_bring_in(it);
362 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
365 else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
367 it = elm_genlist_last_item_get(obj);
368 elm_genlist_item_bring_in(it);
369 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
372 else if ((!strcmp(ev->keyname, "Prior")) || (!strcmp(ev->keyname, "KP_Prior")))
375 y -= -(page_y * v_h) / 100;
379 else if ((!strcmp(ev->keyname, "Next")) || (!strcmp(ev->keyname, "KP_Next")))
382 y += -(page_y * v_h) / 100;
386 else if (!strcmp(ev->keyname, "Escape"))
388 if (!_deselect_all_items(wd)) return EINA_FALSE;
389 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
392 else if (((!strcmp(ev->keyname, "Return")) ||
393 (!strcmp(ev->keyname, "KP_Enter")) ||
394 (!strcmp(ev->keyname, "space")))
395 && (!wd->multi) && (wd->selected))
397 it = elm_genlist_selected_item_get(obj);
398 elm_genlist_item_expanded_set(it,
399 !elm_genlist_item_expanded_get(it));
400 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
402 else return EINA_FALSE;
404 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
405 _pan_max_get(wd->pan_smart, &pan_max_x, &pan_max_y);
407 if (x > pan_max_x) x = pan_max_x;
409 if (y > pan_max_y) y = pan_max_y;
410 elm_smart_scroller_child_pos_set(wd->scr, x, y);
415 _deselect_all_items(Widget_Data *wd)
417 if (!wd->selected) return EINA_FALSE;
419 elm_genlist_item_selected_set(wd->selected->data, EINA_FALSE);
425 _item_multi_select_up(Widget_Data *wd)
427 if (!wd->selected) return EINA_FALSE;
428 if (!wd->multi) return EINA_FALSE;
430 Elm_Gen_Item *prev = elm_genlist_item_prev_get(wd->last_selected_item);
431 if (!prev) return EINA_TRUE;
433 if (elm_genlist_item_selected_get(prev))
435 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
436 wd->last_selected_item = prev;
437 elm_genlist_item_show(wd->last_selected_item);
441 elm_genlist_item_selected_set(prev, EINA_TRUE);
442 elm_genlist_item_show(prev);
448 _item_multi_select_down(Widget_Data *wd)
450 if (!wd->selected) return EINA_FALSE;
451 if (!wd->multi) return EINA_FALSE;
453 Elm_Gen_Item *next = elm_genlist_item_next_get(wd->last_selected_item);
454 if (!next) return EINA_TRUE;
456 if (elm_genlist_item_selected_get(next))
458 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
459 wd->last_selected_item = next;
460 elm_genlist_item_show(wd->last_selected_item);
464 elm_genlist_item_selected_set(next, EINA_TRUE);
465 elm_genlist_item_show(next);
471 _item_single_select_up(Widget_Data *wd)
476 prev = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
477 while ((prev) && (prev->delete_me))
478 prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
480 else prev = elm_genlist_item_prev_get(wd->last_selected_item);
482 if (!prev) return EINA_FALSE;
484 _deselect_all_items(wd);
486 elm_genlist_item_selected_set(prev, EINA_TRUE);
487 elm_genlist_item_show(prev);
492 _item_single_select_down(Widget_Data *wd)
497 next = ELM_GEN_ITEM_FROM_INLIST(wd->items);
498 while ((next) && (next->delete_me))
499 next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
501 else next = elm_genlist_item_next_get(wd->last_selected_item);
503 if (!next) return EINA_FALSE;
505 _deselect_all_items(wd);
507 elm_genlist_item_selected_set(next, EINA_TRUE);
508 elm_genlist_item_show(next);
513 _on_focus_hook(void *data __UNUSED__,
516 Widget_Data *wd = elm_widget_data_get(obj);
518 if (elm_widget_focus_get(obj))
520 elm_object_signal_emit(wd->obj, "elm,action,focus", "elm");
521 evas_object_focus_set(wd->obj, EINA_TRUE);
522 if ((wd->selected) && (!wd->last_selected_item))
523 wd->last_selected_item = eina_list_data_get(wd->selected);
527 elm_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
528 evas_object_focus_set(wd->obj, EINA_FALSE);
533 _del_hook(Evas_Object *obj)
535 Widget_Data *wd = elm_widget_data_get(obj);
537 _item_cache_zero(wd);
538 if (wd->calc_job) ecore_job_del(wd->calc_job);
539 if (wd->update_job) ecore_job_del(wd->update_job);
540 if (wd->queue_idle_enterer) ecore_idle_enterer_del(wd->queue_idle_enterer);
541 if (wd->must_recalc_idler) ecore_idler_del(wd->must_recalc_idler);
542 if (wd->multi_timer) ecore_timer_del(wd->multi_timer);
543 if (wd->mode_type) eina_stringshare_del(wd->mode_type);
544 if (wd->scr_hold_timer) ecore_timer_del(wd->scr_hold_timer);
549 _del_pre_hook(Evas_Object *obj)
551 Widget_Data *wd = elm_widget_data_get(obj);
553 elm_genlist_clear(obj);
554 evas_object_del(wd->pan_smart);
555 wd->pan_smart = NULL;
559 _mirrored_set(Evas_Object *obj,
562 Widget_Data *wd = elm_widget_data_get(obj);
564 _item_cache_zero(wd);
565 elm_smart_scroller_mirrored_set(wd->scr, rtl);
569 _theme_hook(Evas_Object *obj)
571 Widget_Data *wd = elm_widget_data_get(obj);
574 evas_event_freeze(evas_object_evas_get(wd->obj));
575 _item_cache_zero(wd);
576 _elm_widget_mirrored_reload(obj);
577 _mirrored_set(obj, elm_widget_mirrored_get(obj));
578 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
579 elm_widget_style_get(obj));
580 edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
581 wd->item_width = wd->item_height = 0;
582 wd->group_item_width = wd->group_item_height = 0;
583 wd->minw = wd->minh = wd->realminw = 0;
584 EINA_INLIST_FOREACH(wd->blocks, itb)
589 if (itb->realized) _item_block_unrealize(itb);
590 EINA_LIST_FOREACH(itb->items, l, it)
591 it->item->mincalcd = EINA_FALSE;
593 itb->changed = EINA_TRUE;
595 if (wd->calc_job) ecore_job_del(wd->calc_job);
596 wd->calc_job = ecore_job_add(_calc_job, wd);
598 evas_event_thaw(evas_object_evas_get(wd->obj));
599 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
603 _show_region_hook(void *data,
606 Widget_Data *wd = elm_widget_data_get(data);
607 Evas_Coord x, y, w, h;
609 elm_widget_show_region_get(obj, &x, &y, &w, &h);
610 //x & y are screen coordinates, Add with pan coordinates
613 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
617 _translate_hook(Evas_Object *obj)
619 evas_object_smart_callback_call(obj, "language,changed", NULL);
623 _sizing_eval(Evas_Object *obj)
625 Widget_Data *wd = elm_widget_data_get(obj);
626 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
628 evas_object_size_hint_min_get(wd->scr, &minw, &minh);
629 evas_object_size_hint_max_get(wd->scr, &maxw, &maxh);
631 if (wd->height_for_width)
635 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
636 if ((vw != 0) && (vw != wd->prev_viewport_w))
640 wd->prev_viewport_w = vw;
641 EINA_INLIST_FOREACH(wd->blocks, itb)
643 itb->must_recalc = EINA_TRUE;
645 if (wd->calc_job) ecore_job_del(wd->calc_job);
646 wd->calc_job = ecore_job_add(_calc_job, wd);
649 if (wd->mode == ELM_LIST_LIMIT)
651 Evas_Coord vmw, vmh, vw, vh;
655 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
656 if ((minw > 0) && (vw < minw)) vw = minw;
657 else if ((maxw > 0) && (vw > maxw))
659 edje_object_size_min_calc
660 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
667 edje_object_size_min_calc
668 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
672 evas_object_size_hint_min_set(obj, minw, minh);
673 evas_object_size_hint_max_set(obj, maxw, maxh);
677 _signal_emit_hook(Evas_Object *obj,
678 const char *emission,
681 Widget_Data *wd = elm_widget_data_get(obj);
682 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
687 _item_highlight(Elm_Gen_Item *it)
689 const char *selectraise;
690 if ((it->wd->no_select) || (it->delete_me) || (it->highlighted) ||
691 (it->disabled) || (it->display_only) || (it->item->mode_view))
693 edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
694 selectraise = edje_object_data_get(VIEW(it), "selectraise");
695 if ((selectraise) && (!strcmp(selectraise, "on")))
697 evas_object_raise(VIEW(it));
698 if ((it->item->group_item) && (it->item->group_item->realized))
699 evas_object_raise(it->item->VIEW(group_item));
701 it->highlighted = EINA_TRUE;
705 _item_unhighlight(Elm_Gen_Item *it)
707 const char *stacking, *selectraise;
708 if ((it->delete_me) || (!it->highlighted)) return;
709 edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm");
710 stacking = edje_object_data_get(VIEW(it), "stacking");
711 selectraise = edje_object_data_get(VIEW(it), "selectraise");
712 if (!it->item->nostacking)
714 if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even) evas_object_lower(VIEW(it));
715 else evas_object_raise(VIEW(it));
717 it->highlighted = EINA_FALSE;
721 _item_block_del(Elm_Gen_Item *it)
724 Item_Block *itb = it->item->block;
726 itb->items = eina_list_remove(itb->items, it);
728 itb->changed = EINA_TRUE;
729 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
730 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
733 il = EINA_INLIST_GET(itb);
734 Item_Block *itbn = (Item_Block *)(il->next);
736 it->parent->item->items = eina_list_remove(it->parent->item->items, it);
738 it->wd->blocks = eina_inlist_remove(it->wd->blocks, il);
740 if (itbn) itbn->changed = EINA_TRUE;
744 if (itb->count < itb->wd->max_items_per_block/2)
746 il = EINA_INLIST_GET(itb);
747 Item_Block *itbp = (Item_Block *)(il->prev);
748 Item_Block *itbn = (Item_Block *)(il->next);
749 if ((itbp) && ((itbp->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
753 EINA_LIST_FREE(itb->items, it2)
755 it2->item->block = itbp;
756 itbp->items = eina_list_append(itbp->items, it2);
758 itbp->changed = EINA_TRUE;
760 it->wd->blocks = eina_inlist_remove(it->wd->blocks,
761 EINA_INLIST_GET(itb));
764 else if ((itbn) && ((itbn->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
768 Eina_List *last = eina_list_last(itb->items);
769 Elm_Gen_Item *it2 = last->data;
771 it2->item->block = itbn;
772 itb->items = eina_list_remove_list(itb->items, last);
773 itbn->items = eina_list_prepend(itbn->items, it2);
775 itbn->changed = EINA_TRUE;
778 eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb));
786 _item_del(Elm_Gen_Item *it)
788 Evas_Object *obj = WIDGET(it);
790 evas_event_freeze(evas_object_evas_get(obj));
791 elm_genlist_item_subitems_clear(it);
792 if (it->wd->show_item == it) it->wd->show_item = NULL;
793 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE);
794 if (it->item->block) _item_block_del(it);
795 if (it->item->queued)
796 it->wd->queue = eina_list_remove(it->wd->queue, it);
797 if (it->wd->anchor_item == it)
799 it->wd->anchor_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
800 if (!it->wd->anchor_item)
801 it->wd->anchor_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
804 it->parent->item->items = eina_list_remove(it->parent->item->items, it);
805 if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
806 elm_gen_item_del_serious(it);
807 evas_event_thaw(evas_object_evas_get(obj));
808 evas_event_thaw_eval(evas_object_evas_get(obj));
812 _clear_cb(Widget_Data *wd)
814 wd->anchor_item = NULL;
817 Item_Block *itb = (Item_Block *)(wd->blocks);
819 wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
820 if (itb->items) eina_list_free(itb->items);
823 if (wd->queue_idle_enterer)
825 ecore_idle_enterer_del(wd->queue_idle_enterer);
826 wd->queue_idle_enterer = NULL;
828 if (wd->must_recalc_idler)
830 ecore_idler_del(wd->must_recalc_idler);
831 wd->must_recalc_idler = NULL;
833 if (wd->queue) wd->queue = eina_list_free(wd->queue);
834 if (wd->reorder_move_animator)
836 ecore_animator_del(wd->reorder_move_animator);
837 wd->reorder_move_animator = NULL;
839 wd->show_item = NULL;
840 wd->reorder_old_pan_y = 0;
844 _item_unselect(Elm_Gen_Item *it)
846 if ((it->delete_me) || (!it->selected)) return;
847 it->selected = EINA_FALSE;
848 it->wd->selected = eina_list_remove(it->wd->selected, it);
849 evas_object_smart_callback_call(WIDGET(it), SIG_UNSELECTED, it);
853 _mouse_move(void *data,
854 Evas *evas __UNUSED__,
858 Elm_Gen_Item *it = data;
859 Evas_Event_Mouse_Move *ev = event_info;
860 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
861 Evas_Coord ox, oy, ow, oh, it_scrl_y, y_pos;
863 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
865 if (!it->wd->on_hold)
867 it->wd->on_hold = EINA_TRUE;
868 if (!it->wd->wasselected)
870 _item_unhighlight(it);
875 if (it->wd->multitouched)
877 it->wd->cur_x = ev->cur.canvas.x;
878 it->wd->cur_y = ev->cur.canvas.y;
881 if ((it->dragging) && (it->down))
883 if (it->wd->movements == SWIPE_MOVES) it->wd->swipe = EINA_TRUE;
886 it->wd->history[it->wd->movements].x = ev->cur.canvas.x;
887 it->wd->history[it->wd->movements].y = ev->cur.canvas.y;
888 if (abs((it->wd->history[it->wd->movements].x -
889 it->wd->history[0].x)) > 40)
890 it->wd->swipe = EINA_TRUE;
896 ecore_timer_del(it->long_timer);
897 it->long_timer = NULL;
899 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG, it);
902 if ((!it->down) /* || (it->wd->on_hold)*/ || (it->wd->longpressed))
906 ecore_timer_del(it->long_timer);
907 it->long_timer = NULL;
909 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
911 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
912 it_scrl_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
914 if (!it->wd->reorder_start_y)
915 it->wd->reorder_start_y = it->item->block->y + it->y;
919 else if (it_scrl_y + it->wd->reorder_it->item->h > oy + oh)
920 y_pos = oy + oh - it->wd->reorder_it->item->h;
924 _item_position(it, VIEW(it), it->item->scrl_x, y_pos);
926 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
927 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
931 if (!it->display_only)
932 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
933 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
934 x = ev->cur.canvas.x - x;
935 y = ev->cur.canvas.y - y;
938 if (adx < 0) adx = -dx;
941 if (ady < 0) ady = -dy;
944 if ((adx > minw) || (ady > minh))
946 it->dragging = EINA_TRUE;
949 ecore_timer_del(it->long_timer);
950 it->long_timer = NULL;
952 if (!it->wd->wasselected)
954 _item_unhighlight(it);
960 evas_object_smart_callback_call(WIDGET(it),
961 SIG_DRAG_START_UP, it);
965 evas_object_smart_callback_call(WIDGET(it),
966 SIG_DRAG_START_LEFT, it);
968 evas_object_smart_callback_call(WIDGET(it),
969 SIG_DRAG_START_RIGHT, it);
975 evas_object_smart_callback_call(WIDGET(it),
976 SIG_DRAG_START_DOWN, it);
980 evas_object_smart_callback_call(WIDGET(it),
981 SIG_DRAG_START_LEFT, it);
983 evas_object_smart_callback_call(WIDGET(it),
984 SIG_DRAG_START_RIGHT, it);
991 _long_press(void *data)
993 Elm_Gen_Item *it = data, *it_tmp;
996 it->long_timer = NULL;
997 if ((it->disabled) || (it->dragging) || (it->display_only))
998 return ECORE_CALLBACK_CANCEL;
999 it->wd->longpressed = EINA_TRUE;
1000 evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it);
1001 if ((it->wd->reorder_mode) && (it->item->flags != ELM_GENLIST_ITEM_GROUP))
1003 it->wd->reorder_it = it;
1004 it->wd->reorder_start_y = 0;
1006 evas_object_raise(VIEW(it));
1007 elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
1008 elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_FALSE);
1010 list = elm_genlist_realized_items_get(it->wd->obj);
1011 EINA_LIST_FOREACH(list, l, it_tmp)
1013 if (it != it_tmp) _item_unselect(it_tmp);
1015 if (elm_genlist_item_expanded_get(it))
1017 elm_genlist_item_expanded_set(it, EINA_FALSE);
1018 return ECORE_CALLBACK_RENEW;
1020 edje_object_signal_emit(VIEW(it), "elm,state,reorder,enabled", "elm");
1022 return ECORE_CALLBACK_CANCEL;
1026 _swipe(Elm_Gen_Item *it)
1031 if ((it->display_only) || (it->disabled)) return;
1032 it->wd->swipe = EINA_FALSE;
1033 for (i = 0; i < it->wd->movements; i++)
1035 sum += it->wd->history[i].x;
1036 if (abs(it->wd->history[0].y - it->wd->history[i].y) > 10) return;
1039 sum /= it->wd->movements;
1040 if (abs(sum - it->wd->history[0].x) <= 10) return;
1041 evas_object_smart_callback_call(WIDGET(it), SIG_SWIPE, it);
1045 _swipe_cancel(void *data)
1047 Elm_Gen_Item *it = data;
1049 if (!it) return ECORE_CALLBACK_CANCEL;
1050 it->wd->swipe = EINA_FALSE;
1051 it->wd->movements = 0;
1052 return ECORE_CALLBACK_RENEW;
1056 _multi_cancel(void *data)
1058 Widget_Data *wd = data;
1060 if (!wd) return ECORE_CALLBACK_CANCEL;
1061 wd->multi_timeout = EINA_TRUE;
1062 return ECORE_CALLBACK_RENEW;
1066 _multi_touch_gesture_eval(void *data)
1068 Elm_Gen_Item *it = data;
1070 it->wd->multitouched = EINA_FALSE;
1071 if (it->wd->multi_timer)
1073 ecore_timer_del(it->wd->multi_timer);
1074 it->wd->multi_timer = NULL;
1076 if (it->wd->multi_timeout)
1078 it->wd->multi_timeout = EINA_FALSE;
1082 Evas_Coord minw = 0, minh = 0;
1083 Evas_Coord off_x, off_y, off_mx, off_my;
1085 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1086 off_x = abs(it->wd->cur_x - it->wd->prev_x);
1087 off_y = abs(it->wd->cur_y - it->wd->prev_y);
1088 off_mx = abs(it->wd->cur_mx - it->wd->prev_mx);
1089 off_my = abs(it->wd->cur_my - it->wd->prev_my);
1091 if (((off_x > minw) || (off_y > minh)) && ((off_mx > minw) || (off_my > minh)))
1093 if ((off_x + off_mx) > (off_y + off_my))
1095 if ((it->wd->cur_x > it->wd->prev_x) && (it->wd->cur_mx > it->wd->prev_mx))
1096 evas_object_smart_callback_call(WIDGET(it),
1097 SIG_MULTI_SWIPE_RIGHT, it);
1098 else if ((it->wd->cur_x < it->wd->prev_x) && (it->wd->cur_mx < it->wd->prev_mx))
1099 evas_object_smart_callback_call(WIDGET(it),
1100 SIG_MULTI_SWIPE_LEFT, it);
1101 else if (abs(it->wd->cur_x - it->wd->cur_mx) > abs(it->wd->prev_x - it->wd->prev_mx))
1102 evas_object_smart_callback_call(WIDGET(it),
1103 SIG_MULTI_PINCH_OUT, it);
1105 evas_object_smart_callback_call(WIDGET(it),
1106 SIG_MULTI_PINCH_IN, it);
1110 if ((it->wd->cur_y > it->wd->prev_y) && (it->wd->cur_my > it->wd->prev_my))
1111 evas_object_smart_callback_call(WIDGET(it),
1112 SIG_MULTI_SWIPE_DOWN, it);
1113 else if ((it->wd->cur_y < it->wd->prev_y) && (it->wd->cur_my < it->wd->prev_my))
1114 evas_object_smart_callback_call(WIDGET(it),
1115 SIG_MULTI_SWIPE_UP, it);
1116 else if (abs(it->wd->cur_y - it->wd->cur_my) > abs(it->wd->prev_y - it->wd->prev_my))
1117 evas_object_smart_callback_call(WIDGET(it),
1118 SIG_MULTI_PINCH_OUT, it);
1120 evas_object_smart_callback_call(WIDGET(it),
1121 SIG_MULTI_PINCH_IN, it);
1124 it->wd->multi_timeout = EINA_FALSE;
1128 _multi_down(void *data,
1129 Evas *evas __UNUSED__,
1130 Evas_Object *obj __UNUSED__,
1133 Elm_Gen_Item *it = data;
1134 Evas_Event_Multi_Down *ev = event_info;
1136 if ((it->wd->multi_device != 0) || (it->wd->multitouched) || (it->wd->multi_timeout)) return;
1137 it->wd->multi_device = ev->device;
1138 it->wd->multi_down = EINA_TRUE;
1139 it->wd->multitouched = EINA_TRUE;
1140 it->wd->prev_mx = ev->canvas.x;
1141 it->wd->prev_my = ev->canvas.y;
1142 if (!it->wd->wasselected)
1144 _item_unhighlight(it);
1147 it->wd->wasselected = EINA_FALSE;
1148 it->wd->longpressed = EINA_FALSE;
1151 ecore_timer_del(it->long_timer);
1152 it->long_timer = NULL;
1156 it->dragging = EINA_FALSE;
1157 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
1159 if (it->item->swipe_timer)
1161 ecore_timer_del(it->item->swipe_timer);
1162 it->item->swipe_timer = NULL;
1164 if (it->wd->on_hold)
1166 it->wd->swipe = EINA_FALSE;
1167 it->wd->movements = 0;
1168 it->wd->on_hold = EINA_FALSE;
1173 _multi_up(void *data,
1174 Evas *evas __UNUSED__,
1175 Evas_Object *obj __UNUSED__,
1178 Elm_Gen_Item *it = data;
1179 Evas_Event_Multi_Up *ev = event_info;
1181 if (it->wd->multi_device != ev->device) return;
1182 it->wd->multi_device = 0;
1183 it->wd->multi_down = EINA_FALSE;
1184 if (it->wd->mouse_down) return;
1185 _multi_touch_gesture_eval(data);
1189 _multi_move(void *data,
1190 Evas *evas __UNUSED__,
1191 Evas_Object *obj __UNUSED__,
1194 Elm_Gen_Item *it = data;
1195 Evas_Event_Multi_Move *ev = event_info;
1197 if (it->wd->multi_device != ev->device) return;
1198 it->wd->cur_mx = ev->cur.canvas.x;
1199 it->wd->cur_my = ev->cur.canvas.y;
1203 _mouse_down(void *data,
1204 Evas *evas __UNUSED__,
1208 Elm_Gen_Item *it = data;
1209 Evas_Event_Mouse_Down *ev = event_info;
1212 if (ev->button != 1) return;
1213 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1215 it->wd->on_hold = EINA_TRUE;
1218 it->down = EINA_TRUE;
1219 it->dragging = EINA_FALSE;
1220 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1221 it->dx = ev->canvas.x - x;
1222 it->dy = ev->canvas.y - y;
1223 it->wd->mouse_down = EINA_TRUE;
1224 if (!it->wd->multitouched)
1226 it->wd->prev_x = ev->canvas.x;
1227 it->wd->prev_y = ev->canvas.y;
1228 it->wd->multi_timeout = EINA_FALSE;
1229 if (it->wd->multi_timer) ecore_timer_del(it->wd->multi_timer);
1230 it->wd->multi_timer = ecore_timer_add(1, _multi_cancel, it->wd);
1232 it->wd->longpressed = EINA_FALSE;
1233 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1234 else it->wd->on_hold = EINA_FALSE;
1235 if (it->wd->on_hold) return;
1236 it->wd->wasselected = it->selected;
1237 _item_highlight(it);
1238 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
1239 if ((!it->disabled) && (!it->display_only))
1241 evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
1242 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
1244 if (it->long_timer) ecore_timer_del(it->long_timer);
1245 if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
1246 it->item->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
1248 it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press,
1251 it->long_timer = NULL;
1252 it->wd->swipe = EINA_FALSE;
1253 it->wd->movements = 0;
1257 _mouse_up(void *data,
1258 Evas *evas __UNUSED__,
1259 Evas_Object *obj __UNUSED__,
1262 Elm_Gen_Item *it = data;
1263 Evas_Event_Mouse_Up *ev = event_info;
1264 Eina_Bool dragged = EINA_FALSE;
1266 if (ev->button != 1) return;
1267 it->down = EINA_FALSE;
1268 it->wd->mouse_down = EINA_FALSE;
1269 if (it->wd->multitouched)
1271 if ((!it->wd->multi) && (!it->selected) && (it->highlighted)) _item_unhighlight(it);
1272 if (it->wd->multi_down) return;
1273 _multi_touch_gesture_eval(data);
1276 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1277 else it->wd->on_hold = EINA_FALSE;
1280 ecore_timer_del(it->long_timer);
1281 it->long_timer = NULL;
1285 it->dragging = EINA_FALSE;
1286 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
1289 if (it->item->swipe_timer)
1291 ecore_timer_del(it->item->swipe_timer);
1292 it->item->swipe_timer = NULL;
1294 if (it->wd->multi_timer)
1296 ecore_timer_del(it->wd->multi_timer);
1297 it->wd->multi_timer = NULL;
1298 it->wd->multi_timeout = EINA_FALSE;
1300 if (it->wd->on_hold)
1302 if (it->wd->swipe) _swipe(data);
1303 it->wd->longpressed = EINA_FALSE;
1304 it->wd->on_hold = EINA_FALSE;
1307 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
1309 Evas_Coord it_scrl_y = ev->canvas.y - it->wd->reorder_it->dy;
1311 if (it->wd->reorder_rel && (it->wd->reorder_it->parent == it->wd->reorder_rel->parent))
1313 if (it_scrl_y <= it->wd->reorder_rel->item->scrl_y)
1314 _item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
1316 _item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
1320 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1321 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1323 edje_object_signal_emit(VIEW(it), "elm,state,reorder,disabled", "elm");
1324 it->wd->reorder_it = it->wd->reorder_rel = NULL;
1325 elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
1326 elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_TRUE);
1328 if (it->wd->longpressed)
1330 it->wd->longpressed = EINA_FALSE;
1331 if (!it->wd->wasselected)
1333 _item_unhighlight(it);
1336 it->wd->wasselected = EINA_FALSE;
1341 if (it->want_unrealize)
1343 elm_gen_item_unrealize(it, EINA_FALSE);
1344 if (it->item->block->want_unrealize)
1345 _item_block_unrealize(it->item->block);
1348 if ((it->disabled) || (dragged) || (it->display_only)) return;
1349 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1354 _item_highlight(it);
1359 _item_unhighlight(it);
1367 Widget_Data *wd = it->wd;
1370 while (wd->selected)
1372 _item_unhighlight(wd->selected->data);
1373 _item_unselect(wd->selected->data);
1379 const Eina_List *l, *l_next;
1382 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
1385 _item_unhighlight(it2);
1386 _item_unselect(it2);
1388 //_item_highlight(it);
1391 _item_highlight(it);
1397 _signal_expand_toggle(void *data,
1398 Evas_Object *obj __UNUSED__,
1399 const char *emission __UNUSED__,
1400 const char *source __UNUSED__)
1402 Elm_Gen_Item *it = data;
1404 if (it->item->expanded)
1405 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it);
1407 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it);
1411 _signal_expand(void *data,
1412 Evas_Object *obj __UNUSED__,
1413 const char *emission __UNUSED__,
1414 const char *source __UNUSED__)
1416 Elm_Gen_Item *it = data;
1418 if (!it->item->expanded)
1419 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it);
1423 _signal_contract(void *data,
1424 Evas_Object *obj __UNUSED__,
1425 const char *emission __UNUSED__,
1426 const char *source __UNUSED__)
1428 Elm_Gen_Item *it = data;
1430 if (it->item->expanded)
1431 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it);
1435 _scr_hold_timer_cb(void *data)
1437 if (!data) return ECORE_CALLBACK_CANCEL;
1438 Widget_Data *wd = data;
1439 elm_smart_scroller_hold_set(wd->scr, EINA_FALSE);
1440 wd->scr_hold_timer = NULL;
1441 return ECORE_CALLBACK_CANCEL;
1445 _mode_finished_signal_cb(void *data,
1447 const char *emission __UNUSED__,
1448 const char *source __UNUSED__)
1452 Elm_Gen_Item *it = data;
1453 if ((it->delete_me) || (!it->realized) || (!it->item->mode_view)) return;
1455 Evas *te = evas_object_evas_get(obj);
1457 evas_event_freeze(te);
1458 it->item->nocache = EINA_FALSE;
1459 _mode_item_unrealize(it);
1460 if (it->item->group_item)
1461 evas_object_raise(it->item->VIEW(group_item));
1462 snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished", it->wd->mode_type);
1463 edje_object_signal_callback_del_full(obj, buf, "elm", _mode_finished_signal_cb, it);
1464 evas_event_thaw(te);
1465 evas_event_thaw_eval(te);
1469 _item_cache_clean(Widget_Data *wd)
1471 evas_event_freeze(evas_object_evas_get(wd->obj));
1472 while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max))
1476 itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache);
1477 wd->item_cache = eina_inlist_remove(wd->item_cache,
1478 wd->item_cache->last);
1479 wd->item_cache_count--;
1480 if (itc->spacer) evas_object_del(itc->spacer);
1481 if (itc->base_view) evas_object_del(itc->base_view);
1482 if (itc->item_style) eina_stringshare_del(itc->item_style);
1485 evas_event_thaw(evas_object_evas_get(wd->obj));
1486 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
1490 _item_cache_zero(Widget_Data *wd)
1492 int pmax = wd->item_cache_max;
1493 wd->item_cache_max = 0;
1494 _item_cache_clean(wd);
1495 wd->item_cache_max = pmax;
1499 _item_cache_add(Elm_Gen_Item *it)
1503 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1504 if (it->wd->item_cache_max <= 0)
1506 evas_object_del(VIEW(it));
1508 evas_object_del(it->spacer);
1510 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1511 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1515 it->wd->item_cache_count++;
1516 itc = calloc(1, sizeof(Item_Cache));
1517 it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache,
1518 EINA_INLIST_GET(itc));
1519 itc->spacer = it->spacer;
1521 itc->base_view = VIEW(it);
1523 evas_object_hide(itc->base_view);
1524 evas_object_move(itc->base_view, -9999, -9999);
1525 itc->item_style = eina_stringshare_add(it->itc->item_style);
1526 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
1527 itc->compress = (it->wd->compress);
1528 itc->selected = it->selected;
1529 itc->disabled = it->disabled;
1530 itc->expanded = it->item->expanded;
1533 ecore_timer_del(it->long_timer);
1534 it->long_timer = NULL;
1536 if (it->item->swipe_timer)
1538 ecore_timer_del(it->item->swipe_timer);
1539 it->item->swipe_timer = NULL;
1541 // FIXME: other callbacks?
1542 edje_object_signal_callback_del_full(itc->base_view,
1543 "elm,action,expand,toggle",
1544 "elm", _signal_expand_toggle, it);
1545 edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand",
1547 _signal_expand, it);
1548 edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract",
1549 "elm", _signal_contract, it);
1550 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_DOWN,
1552 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP,
1554 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_MOVE,
1556 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_DOWN,
1558 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_UP,
1560 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_MOVE,
1562 _item_cache_clean(it->wd);
1563 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1564 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1568 _item_cache_find(Elm_Gen_Item *it)
1573 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
1574 EINA_INLIST_FOREACH(it->wd->item_cache, itc)
1576 if ((itc->selected) || (itc->disabled) || (itc->expanded))
1578 if ((itc->tree == tree) &&
1579 (itc->compress == it->wd->compress) &&
1580 (!strcmp(it->itc->item_style, itc->item_style)))
1582 it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
1583 EINA_INLIST_GET(itc));
1584 it->wd->item_cache_count--;
1592 _elm_genlist_item_odd_even_update(Elm_Gen_Item *it)
1594 if (!it->item->nostacking)
1596 if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even)
1597 evas_object_lower(VIEW(it));
1599 evas_object_raise(VIEW(it));
1602 if (it->item->order_num_in & 0x1)
1603 edje_object_signal_emit(VIEW(it), "elm,state,odd", "elm");
1605 edje_object_signal_emit(VIEW(it), "elm,state,even", "elm");
1609 _elm_genlist_item_state_update(Elm_Gen_Item *it, Item_Cache *itc)
1613 if (it->selected != itc->selected)
1616 edje_object_signal_emit(VIEW(it),
1617 "elm,state,selected", "elm");
1619 if (it->disabled != itc->disabled)
1622 edje_object_signal_emit(VIEW(it),
1623 "elm,state,disabled", "elm");
1625 if (it->item->expanded != itc->expanded)
1627 if (it->item->expanded)
1628 edje_object_signal_emit(VIEW(it),
1629 "elm,state,expanded", "elm");
1635 edje_object_signal_emit(VIEW(it),
1636 "elm,state,selected", "elm");
1638 edje_object_signal_emit(VIEW(it),
1639 "elm,state,disabled", "elm");
1640 if (it->item->expanded)
1641 edje_object_signal_emit(VIEW(it),
1642 "elm,state,expanded", "elm");
1647 _item_cache_free(Item_Cache *itc)
1649 if (itc->spacer) evas_object_del(itc->spacer);
1650 if (itc->base_view) evas_object_del(itc->base_view);
1651 if (itc->item_style) eina_stringshare_del(itc->item_style);
1656 _item_del_hook(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1658 Elm_Gen_Item *it = event_info;
1660 if (it->wd->last_selected_item == it)
1661 it->wd->last_selected_item = NULL;
1665 _item_label_realize(Elm_Gen_Item *it,
1666 Evas_Object *target,
1669 if (it->itc->func.label_get)
1674 *source = elm_widget_stringlist_get(edje_object_data_get(target, "labels"));
1675 EINA_LIST_FOREACH(*source, l, key)
1677 char *s = it->itc->func.label_get
1678 ((void *)it->base.data, WIDGET(it), key);
1682 edje_object_part_text_set(target, key, s);
1687 edje_object_part_text_set(target, key, "");
1694 _item_icon_realize(Elm_Gen_Item *it,
1695 Evas_Object *target,
1698 Eina_List *res = NULL;
1700 if (it->itc->func.icon_get)
1705 *source = elm_widget_stringlist_get(edje_object_data_get(target, "icons"));
1706 EINA_LIST_FOREACH(*source, l, key)
1708 Evas_Object *ic = it->itc->func.icon_get
1709 ((void *)it->base.data, WIDGET(it), key);
1713 res = eina_list_append(res, ic);
1714 edje_object_part_swallow(target, key, ic);
1715 evas_object_show(ic);
1716 elm_widget_sub_object_add(WIDGET(it), ic);
1718 elm_widget_disabled_set(ic, EINA_TRUE);
1727 _item_state_realize(Elm_Gen_Item *it,
1728 Evas_Object *target,
1731 if (it->itc->func.state_get)
1737 *source = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
1738 EINA_LIST_FOREACH(*source, l, key)
1740 Eina_Bool on = it->itc->func.state_get
1741 ((void *)it->base.data, WIDGET(it), key);
1745 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
1746 edje_object_signal_emit(target, buf, "elm");
1750 snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
1751 edje_object_signal_emit(target, buf, "elm");
1758 _item_realize(Elm_Gen_Item *it,
1763 const char *treesize;
1765 int depth, tsize = 20;
1766 Item_Cache *itc = NULL;
1768 if (it->delete_me) return;
1769 //evas_event_freeze(evas_object_evas_get(it->wd->obj));
1772 if (it->item->order_num_in != in)
1774 it->item->order_num_in = in;
1775 _elm_genlist_item_odd_even_update(it);
1776 _elm_genlist_item_state_update(it, NULL);
1778 //evas_event_thaw(evas_object_evas_get(it->wd->obj));
1779 //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1782 it->item->order_num_in = in;
1784 if (it->item->nocache)
1785 it->item->nocache = EINA_FALSE;
1787 itc = _item_cache_find(it);
1790 VIEW(it) = itc->base_view;
1791 itc->base_view = NULL;
1792 it->spacer = itc->spacer;
1797 const char *stacking_even;
1798 const char *stacking;
1800 VIEW(it) = edje_object_add(evas_object_evas_get(WIDGET(it)));
1801 edje_object_scale_set(VIEW(it),
1802 elm_widget_scale_get(WIDGET(it)) *
1803 _elm_config->scale);
1804 evas_object_smart_member_add(VIEW(it), it->wd->pan_smart);
1805 elm_widget_sub_object_add(WIDGET(it), VIEW(it));
1807 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS)
1808 strncpy(buf, "tree", sizeof(buf));
1809 else strncpy(buf, "item", sizeof(buf));
1810 if (it->wd->compress)
1811 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
1813 strncat(buf, "/", sizeof(buf) - strlen(buf));
1814 strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf));
1816 _elm_theme_object_set(WIDGET(it), VIEW(it), "genlist", buf,
1817 elm_widget_style_get(WIDGET(it)));
1819 stacking_even = edje_object_data_get(VIEW(it), "stacking_even");
1820 if (!stacking_even) stacking_even = "above";
1821 it->item->stacking_even = !!strcmp("above", stacking_even);
1823 stacking = edje_object_data_get(VIEW(it), "stacking");
1824 if (!stacking) stacking = "yes";
1825 it->item->nostacking = !!strcmp("yes", stacking);
1827 edje_object_mirrored_set(VIEW(it),
1828 elm_widget_mirrored_get(WIDGET(it)));
1830 evas_object_rectangle_add(evas_object_evas_get(WIDGET(it)));
1831 evas_object_color_set(it->spacer, 0, 0, 0, 0);
1832 elm_widget_sub_object_add(WIDGET(it), it->spacer);
1835 _elm_genlist_item_odd_even_update(it);
1837 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
1839 if (it2->parent->item->flags != ELM_GENLIST_ITEM_GROUP) depth += 1;
1841 it->item->expanded_depth = depth;
1842 treesize = edje_object_data_get(VIEW(it), "treesize");
1843 if (treesize) tsize = atoi(treesize);
1844 evas_object_size_hint_min_set(it->spacer,
1845 (depth * tsize) * _elm_config->scale, 1);
1846 edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer);
1849 edje_object_signal_callback_add(VIEW(it),
1850 "elm,action,expand,toggle",
1851 "elm", _signal_expand_toggle, it);
1852 edje_object_signal_callback_add(VIEW(it), "elm,action,expand",
1853 "elm", _signal_expand, it);
1854 edje_object_signal_callback_add(VIEW(it), "elm,action,contract",
1855 "elm", _signal_contract, it);
1856 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN,
1858 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_UP,
1860 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
1862 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_DOWN,
1864 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_UP,
1866 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_MOVE,
1869 _elm_genlist_item_state_update(it, itc);
1872 if ((calc) && (it->wd->homogeneous) &&
1873 ((it->wd->item_width) ||
1874 ((it->wd->item_width) && (it->wd->group_item_width))))
1876 /* homogenous genlist shortcut */
1877 if (!it->item->mincalcd)
1879 if (it->item->flags & ELM_GENLIST_ITEM_GROUP)
1881 it->item->w = it->item->minw = it->wd->group_item_width;
1882 it->item->h = it->item->minh = it->wd->group_item_height;
1886 it->item->w = it->item->minw = it->wd->item_width;
1887 it->item->h = it->item->minh = it->wd->item_height;
1889 it->item->mincalcd = EINA_TRUE;
1894 /* FIXME: If you see that assert, please notify us and we
1895 will clean our mess */
1896 assert(eina_list_count(it->icon_objs) == 0);
1898 _item_label_realize(it, VIEW(it), &it->labels);
1899 it->icon_objs = _item_icon_realize(it, VIEW(it), &it->icons);
1900 _item_state_realize(it, VIEW(it), &it->states);
1902 if (!it->item->mincalcd)
1904 Evas_Coord mw = -1, mh = -1;
1906 if (!it->display_only)
1907 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1908 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
1909 edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw,
1911 if (!it->display_only)
1912 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1913 it->item->w = it->item->minw = mw;
1914 it->item->h = it->item->minh = mh;
1915 it->item->mincalcd = EINA_TRUE;
1917 if ((!it->wd->group_item_width) && (it->item->flags == ELM_GENLIST_ITEM_GROUP))
1919 it->wd->group_item_width = mw;
1920 it->wd->group_item_height = mh;
1922 else if ((!it->wd->item_width) && (it->item->flags == ELM_GENLIST_ITEM_NONE))
1924 it->wd->item_width = mw;
1925 it->wd->item_height = mh;
1928 if (!calc) evas_object_show(VIEW(it));
1931 if (it->tooltip.content_cb)
1933 elm_widget_item_tooltip_content_cb_set(it,
1934 it->tooltip.content_cb,
1935 it->tooltip.data, NULL);
1936 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
1937 elm_widget_item_tooltip_size_restrict_disable(it, it->tooltip.free_size);
1940 if (it->mouse_cursor)
1941 elm_widget_item_cursor_set(it, it->mouse_cursor);
1943 it->realized = EINA_TRUE;
1944 it->want_unrealize = EINA_FALSE;
1946 if (itc) _item_cache_free(itc);
1947 //evas_event_thaw(evas_object_evas_get(it->wd->obj));
1948 //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1950 evas_object_smart_callback_call(WIDGET(it), SIG_REALIZED, it);
1951 edje_object_message_signal_process(VIEW(it));
1955 _item_unrealize_cb(Elm_Gen_Item *it)
1957 if (it->item->nocache)
1959 evas_object_del(VIEW(it));
1961 evas_object_del(it->spacer);
1966 edje_object_mirrored_set(VIEW(it),
1967 elm_widget_mirrored_get(WIDGET(it)));
1968 edje_object_scale_set(VIEW(it),
1969 elm_widget_scale_get(WIDGET(it))
1970 * _elm_config->scale);
1971 _item_cache_add(it);
1974 _mode_item_unrealize(it);
1976 it->realized = EINA_FALSE;
1977 it->want_unrealize = EINA_FALSE;
1981 _item_block_recalc(Item_Block *itb,
1987 Evas_Coord minw = 0, minh = 0;
1988 Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE;
1991 //evas_event_freeze(evas_object_evas_get(itb->wd->obj));
1993 EINA_LIST_FOREACH(itb->items, l, it)
1995 if (it->delete_me) continue;
1996 showme |= it->item->showme;
2001 if (!it->item->mincalcd) changed = EINA_TRUE;
2004 _item_realize(it, in, EINA_TRUE);
2005 elm_gen_item_unrealize(it, EINA_TRUE);
2010 _item_realize(it, in, EINA_TRUE);
2011 elm_gen_item_unrealize(it, EINA_TRUE);
2015 _item_realize(it, in, EINA_FALSE);
2016 minh += it->item->minh;
2017 if (minw < it->item->minw) minw = it->item->minw;
2025 itb->changed = EINA_FALSE;
2026 //evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2027 //evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2032 _item_block_realize(Item_Block *itb)
2034 if (itb->realized) return;
2035 itb->realized = EINA_TRUE;
2036 itb->want_unrealize = EINA_FALSE;
2040 _item_block_unrealize(Item_Block *itb)
2044 Eina_Bool dragging = EINA_FALSE;
2046 if (!itb->realized) return;
2047 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2048 EINA_LIST_FOREACH(itb->items, l, it)
2050 if (it->item->flags != ELM_GENLIST_ITEM_GROUP)
2054 dragging = EINA_TRUE;
2055 it->want_unrealize = EINA_TRUE;
2058 elm_gen_item_unrealize(it, EINA_FALSE);
2063 itb->realized = EINA_FALSE;
2064 itb->want_unrealize = EINA_TRUE;
2067 itb->want_unrealize = EINA_FALSE;
2068 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2069 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2073 _get_space_for_reorder_item(Elm_Gen_Item *it)
2075 Evas_Coord rox, roy, row, roh, oy, oh;
2076 Eina_Bool top = EINA_FALSE;
2077 Elm_Gen_Item *reorder_it = it->wd->reorder_it;
2078 if (!reorder_it) return 0;
2080 evas_object_geometry_get(it->wd->pan_smart, NULL, &oy, NULL, &oh);
2081 evas_object_geometry_get(it->wd->VIEW(reorder_it), &rox, &roy, &row, &roh);
2083 if ((it->wd->reorder_start_y < it->item->block->y) &&
2084 (roy - oy + (roh / 2) >= it->item->block->y - it->wd->pan_y))
2086 it->item->block->reorder_offset = it->wd->reorder_it->item->h * -1;
2087 if (it->item->block->count == 1)
2088 it->wd->reorder_rel = it;
2090 else if ((it->wd->reorder_start_y >= it->item->block->y) &&
2091 (roy - oy + (roh / 2) <= it->item->block->y - it->wd->pan_y))
2093 it->item->block->reorder_offset = it->wd->reorder_it->item->h;
2096 it->item->block->reorder_offset = 0;
2098 it->item->scrl_y += it->item->block->reorder_offset;
2100 top = (ELM_RECTS_INTERSECT(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h,
2101 rox, roy + (roh / 2), row, 1));
2104 it->wd->reorder_rel = it;
2105 it->item->scrl_y += it->wd->reorder_it->item->h;
2106 return it->wd->reorder_it->item->h;
2113 _reorder_move_animator_cb(void *data)
2115 Elm_Gen_Item *it = data;
2116 Eina_Bool down = EINA_FALSE;
2118 int y, dy = it->item->h / 10 * _elm_config->scale, diff;
2120 t = ((0.0 > (t = ecore_loop_time_get()-it->wd->start_time)) ? 0.0 : t);
2122 if (t <= REORDER_EFFECT_TIME) y = (1 * sin((t / REORDER_EFFECT_TIME) * (M_PI / 2)) * dy);
2125 diff = abs(it->item->old_scrl_y - it->item->scrl_y);
2126 if (diff > it->item->h) y = diff / 2;
2128 if (it->item->old_scrl_y < it->item->scrl_y)
2130 it->item->old_scrl_y += y;
2133 else if (it->item->old_scrl_y > it->item->scrl_y)
2135 it->item->old_scrl_y -= y;
2138 _item_position(it, VIEW(it), it->item->scrl_x, it->item->old_scrl_y);
2139 _group_items_recalc(it->wd);
2141 if ((it->wd->reorder_pan_move) ||
2142 (down && it->item->old_scrl_y >= it->item->scrl_y) ||
2143 (!down && it->item->old_scrl_y <= it->item->scrl_y))
2145 it->item->old_scrl_y = it->item->scrl_y;
2146 it->item->move_effect_enabled = EINA_FALSE;
2147 it->wd->reorder_move_animator = NULL;
2148 return ECORE_CALLBACK_CANCEL;
2150 return ECORE_CALLBACK_RENEW;
2154 _item_position(Elm_Gen_Item *it,
2162 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2163 evas_object_resize(view, it->item->w, it->item->h);
2164 evas_object_move(view, it_x, it_y);
2165 evas_object_show(view);
2166 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2167 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2171 _item_block_position(Item_Block *itb,
2177 Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2180 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2181 evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh);
2182 evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy,
2184 EINA_LIST_FOREACH(itb->items, l, it)
2186 if (it->delete_me) continue;
2187 else if (it->wd->reorder_it == it) continue;
2190 it->item->w = itb->w;
2191 it->item->scrl_x = itb->x + it->x - it->wd->pan_x + ox;
2192 it->item->scrl_y = itb->y + it->y - it->wd->pan_y + oy;
2194 vis = (ELM_RECTS_INTERSECT(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h,
2195 cvx, cvy, cvw, cvh));
2196 if (it->item->flags != ELM_GENLIST_ITEM_GROUP)
2198 if ((itb->realized) && (!it->realized))
2200 if (vis) _item_realize(it, in, EINA_FALSE);
2206 if (it->wd->reorder_mode)
2207 y += _get_space_for_reorder_item(it);
2208 git = it->item->group_item;
2211 if (git->item->scrl_y < oy)
2212 git->item->scrl_y = oy;
2213 if ((git->item->scrl_y + git->item->h) > (it->item->scrl_y + it->item->h))
2214 git->item->scrl_y = (it->item->scrl_y + it->item->h) - git->item->h;
2215 git->item->want_realize = EINA_TRUE;
2217 if ((it->wd->reorder_it) && (it->item->old_scrl_y != it->item->scrl_y))
2219 if (!it->item->move_effect_enabled)
2221 it->item->move_effect_enabled = EINA_TRUE;
2222 it->wd->reorder_move_animator =
2224 _reorder_move_animator_cb, it);
2227 if (!it->item->move_effect_enabled)
2229 if (it->item->mode_view)
2230 _item_position(it, it->item->mode_view, it->item->scrl_x,
2233 _item_position(it, VIEW(it), it->item->scrl_x,
2235 it->item->old_scrl_y = it->item->scrl_y;
2240 if (!it->dragging) elm_gen_item_unrealize(it, EINA_FALSE);
2247 if (vis) it->item->want_realize = EINA_TRUE;
2251 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2252 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2256 _group_items_recalc(void *data)
2258 Widget_Data *wd = data;
2262 evas_event_freeze(evas_object_evas_get(wd->obj));
2263 EINA_LIST_FOREACH(wd->group_items, l, git)
2265 if (git->item->want_realize)
2268 _item_realize(git, 0, EINA_FALSE);
2269 evas_object_resize(VIEW(git), wd->minw, git->item->h);
2270 evas_object_move(VIEW(git), git->item->scrl_x, git->item->scrl_y);
2271 evas_object_show(VIEW(git));
2272 evas_object_raise(VIEW(git));
2274 else if (!git->item->want_realize && git->realized)
2277 elm_gen_item_unrealize(git, EINA_FALSE);
2280 evas_event_thaw(evas_object_evas_get(wd->obj));
2281 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2285 _must_recalc_idler(void *data)
2287 Widget_Data *wd = data;
2288 if (wd->calc_job) ecore_job_del(wd->calc_job);
2289 wd->calc_job = ecore_job_add(_calc_job, wd);
2290 wd->must_recalc_idler = NULL;
2291 return ECORE_CALLBACK_CANCEL;
2295 _calc_job(void *data)
2297 Widget_Data *wd = data;
2298 Item_Block *itb, *chb = NULL;
2299 Evas_Coord minw = -1, minh = 0, y = 0, ow;
2302 Eina_Bool minw_change = EINA_FALSE;
2303 Eina_Bool did_must_recalc = EINA_FALSE;
2306 t0 = ecore_time_get();
2307 evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h);
2311 evas_event_freeze(evas_object_evas_get(wd->obj));
2312 EINA_INLIST_FOREACH(wd->blocks, itb)
2314 Eina_Bool showme = EINA_FALSE;
2317 showme = itb->showme;
2318 itb->showme = EINA_FALSE;
2321 if (itb->realized) _item_block_unrealize(itb);
2323 if ((itb->changed) || ((itb->must_recalc) && (!did_must_recalc)))
2325 if (itb->must_recalc)
2329 EINA_LIST_FOREACH(itb->items, l, it)
2330 if (it->item->mincalcd) it->item->mincalcd = EINA_FALSE;
2331 itb->changed = EINA_TRUE;
2332 if (itb->must_recalc) did_must_recalc = EINA_TRUE;
2333 itb->must_recalc = EINA_FALSE;
2335 if (itb->realized) _item_block_unrealize(itb);
2336 showme = _item_block_recalc(itb, in, EINA_FALSE);
2342 if (minw == -1) minw = itb->minw;
2343 else if ((!itb->must_recalc) && (minw < itb->minw))
2346 minw_change = EINA_TRUE;
2352 if ((showme) && (wd->show_item) && (!wd->show_item->item->queued))
2354 wd->show_item->item->showme = EINA_FALSE;
2356 elm_smart_scroller_region_bring_in(wd->scr,
2358 wd->show_item->item->block->x,
2360 wd->show_item->item->block->y,
2361 wd->show_item->item->block->w,
2362 wd->show_item->item->h);
2364 elm_smart_scroller_child_region_show(wd->scr,
2366 wd->show_item->item->block->x,
2368 wd->show_item->item->block->y,
2369 wd->show_item->item->block->w,
2370 wd->show_item->item->h);
2371 wd->show_item = NULL;
2376 EINA_INLIST_FOREACH(wd->blocks, itb)
2382 if ((chb) && (EINA_INLIST_GET(chb)->next))
2384 EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb)
2386 if (itb->realized) _item_block_unrealize(itb);
2389 wd->realminw = minw;
2390 if (minw < wd->w) minw = wd->w;
2391 if ((minw != wd->minw) || (minh != wd->minh))
2395 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
2396 _sizing_eval(wd->obj);
2397 if ((wd->anchor_item) && (wd->anchor_item->item->block) && (!wd->auto_scroll_enabled))
2402 it = wd->anchor_item;
2403 it_y = wd->anchor_y;
2404 elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x,
2405 it->item->block->y + it->y + it_y);
2406 wd->anchor_item = it;
2407 wd->anchor_y = it_y;
2410 t = ecore_time_get();
2411 if (did_must_recalc)
2413 if (!wd->must_recalc_idler)
2414 wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd);
2416 wd->calc_job = NULL;
2417 evas_object_smart_changed(wd->pan_smart);
2418 evas_event_thaw(evas_object_evas_get(wd->obj));
2419 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2423 _update_job(void *data)
2425 Widget_Data *wd = data;
2429 Eina_Bool position = EINA_FALSE, recalc = EINA_FALSE;
2431 wd->update_job = NULL;
2434 evas_event_freeze(evas_object_evas_get(wd->obj));
2435 EINA_INLIST_FOREACH(wd->blocks, itb)
2437 Evas_Coord itminw, itminh;
2444 _item_block_position(itb, num);
2448 recalc = EINA_FALSE;
2449 EINA_LIST_FOREACH(itb->items, l2, it)
2451 if (it->item->updateme)
2453 itminw = it->item->minw;
2454 itminh = it->item->minh;
2456 it->item->updateme = EINA_FALSE;
2459 elm_gen_item_unrealize(it, EINA_FALSE);
2460 _item_realize(it, num, EINA_FALSE);
2461 position = EINA_TRUE;
2465 _item_realize(it, num, EINA_TRUE);
2466 elm_gen_item_unrealize(it, EINA_TRUE);
2468 if ((it->item->minw != itminw) || (it->item->minh != itminh))
2473 itb->updateme = EINA_FALSE;
2476 position = EINA_TRUE;
2477 itb->changed = EINA_TRUE;
2478 _item_block_recalc(itb, num0, EINA_FALSE);
2479 _item_block_position(itb, num0);
2484 if (wd->calc_job) ecore_job_del(wd->calc_job);
2485 wd->calc_job = ecore_job_add(_calc_job, wd);
2487 evas_event_thaw(evas_object_evas_get(wd->obj));
2488 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2492 _pan_set(Evas_Object *obj,
2496 Pan *sd = evas_object_smart_data_get(obj);
2500 // Evas_Coord ow, oh;
2501 // evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2502 // ow = sd->wd->minw - ow;
2503 // if (ow < 0) ow = 0;
2504 // oh = sd->wd->minh - oh;
2505 // if (oh < 0) oh = 0;
2506 // if (x < 0) x = 0;
2507 // if (y < 0) y = 0;
2508 // if (x > ow) x = ow;
2509 // if (y > oh) y = oh;
2510 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
2514 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2516 if ((itb->y + itb->h) > y)
2521 EINA_LIST_FOREACH(itb->items, l2, it)
2523 if ((itb->y + it->y) >= y)
2525 sd->wd->anchor_item = it;
2526 sd->wd->anchor_y = -(itb->y + it->y - y);
2533 if (!sd->wd->reorder_move_animator) evas_object_smart_changed(obj);
2537 _pan_get(Evas_Object *obj,
2541 Pan *sd = evas_object_smart_data_get(obj);
2544 if (x) *x = sd->wd->pan_x;
2545 if (y) *y = sd->wd->pan_y;
2549 _pan_max_get(Evas_Object *obj,
2553 Pan *sd = evas_object_smart_data_get(obj);
2557 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2558 ow = sd->wd->minw - ow;
2560 oh = sd->wd->minh - oh;
2567 _pan_min_get(Evas_Object *obj __UNUSED__,
2576 _pan_child_size_get(Evas_Object *obj,
2580 Pan *sd = evas_object_smart_data_get(obj);
2583 if (w) *w = sd->wd->minw;
2584 if (h) *h = sd->wd->minh;
2588 _pan_add(Evas_Object *obj)
2591 Evas_Object_Smart_Clipped_Data *cd;
2594 cd = evas_object_smart_data_get(obj);
2597 sd->__clipped_data = *cd;
2599 evas_object_smart_data_set(obj, sd);
2603 _pan_del(Evas_Object *obj)
2605 Pan *sd = evas_object_smart_data_get(obj);
2610 ecore_job_del(sd->resize_job);
2611 sd->resize_job = NULL;
2617 _pan_resize_job(void *data)
2621 _sizing_eval(sd->wd->obj);
2622 sd->resize_job = NULL;
2626 _pan_resize(Evas_Object *obj,
2630 Pan *sd = evas_object_smart_data_get(obj);
2634 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2635 if ((ow == w) && (oh == h)) return;
2636 if ((sd->wd->height_for_width) && (ow != w))
2639 if (sd->resize_job) ecore_job_del(sd->resize_job);
2640 sd->resize_job = ecore_job_add(_pan_resize_job, sd);
2642 sd->wd->pan_resized = EINA_TRUE;
2643 evas_object_smart_changed(obj);
2644 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2645 sd->wd->calc_job = NULL;
2647 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2648 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2653 _pan_calculate(Evas_Object *obj)
2655 Pan *sd = evas_object_smart_data_get(obj);
2657 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2663 evas_event_freeze(evas_object_evas_get(obj));
2665 if (sd->wd->pan_resized)
2668 sd->wd->pan_resized = EINA_FALSE;
2671 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
2672 evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
2673 EINA_LIST_FOREACH(sd->wd->group_items, l, git)
2675 git->item->want_realize = EINA_FALSE;
2677 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2679 itb->w = sd->wd->minw;
2680 if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox,
2681 itb->y - sd->wd->pan_y + oy,
2683 cvx, cvy, cvw, cvh))
2685 if ((!itb->realized) || (itb->changed))
2686 _item_block_realize(itb);
2687 _item_block_position(itb, in);
2691 if (itb->realized) _item_block_unrealize(itb);
2695 if ((!sd->wd->reorder_it) || (sd->wd->reorder_pan_move))
2696 _group_items_recalc(sd->wd);
2697 if ((sd->wd->reorder_mode) && (sd->wd->reorder_it))
2699 if (sd->wd->pan_y != sd->wd->reorder_old_pan_y)
2700 sd->wd->reorder_pan_move = EINA_TRUE;
2701 else sd->wd->reorder_pan_move = EINA_FALSE;
2702 evas_object_raise(sd->wd->VIEW(reorder_it));
2703 sd->wd->reorder_old_pan_y = sd->wd->pan_y;
2704 sd->wd->start_time = ecore_loop_time_get();
2706 _item_auto_scroll(sd->wd);
2707 evas_event_thaw(evas_object_evas_get(obj));
2708 evas_event_thaw_eval(evas_object_evas_get(obj));
2712 _pan_move(Evas_Object *obj,
2713 Evas_Coord x __UNUSED__,
2714 Evas_Coord y __UNUSED__)
2716 Pan *sd = evas_object_smart_data_get(obj);
2719 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2720 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2724 _hold_on(void *data __UNUSED__,
2726 void *event_info __UNUSED__)
2728 Widget_Data *wd = elm_widget_data_get(obj);
2730 elm_smart_scroller_hold_set(wd->scr, 1);
2734 _hold_off(void *data __UNUSED__,
2736 void *event_info __UNUSED__)
2738 Widget_Data *wd = elm_widget_data_get(obj);
2740 elm_smart_scroller_hold_set(wd->scr, 0);
2744 _freeze_on(void *data __UNUSED__,
2746 void *event_info __UNUSED__)
2748 Widget_Data *wd = elm_widget_data_get(obj);
2750 elm_smart_scroller_freeze_set(wd->scr, 1);
2754 _freeze_off(void *data __UNUSED__,
2756 void *event_info __UNUSED__)
2758 Widget_Data *wd = elm_widget_data_get(obj);
2760 elm_smart_scroller_freeze_set(wd->scr, 0);
2764 _scr_anim_start(void *data,
2765 Evas_Object *obj __UNUSED__,
2766 void *event_info __UNUSED__)
2768 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL);
2772 _scr_anim_stop(void *data,
2773 Evas_Object *obj __UNUSED__,
2774 void *event_info __UNUSED__)
2776 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL);
2780 _scr_drag_start(void *data,
2781 Evas_Object *obj __UNUSED__,
2782 void *event_info __UNUSED__)
2784 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
2788 _scr_drag_stop(void *data,
2789 Evas_Object *obj __UNUSED__,
2790 void *event_info __UNUSED__)
2792 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
2796 _edge_left(void *data,
2797 Evas_Object *scr __UNUSED__,
2798 void *event_info __UNUSED__)
2800 Evas_Object *obj = data;
2801 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_LEFT, NULL);
2802 evas_object_smart_callback_call(obj, SIG_EDGE_LEFT, NULL);
2806 _edge_right(void *data,
2807 Evas_Object *scr __UNUSED__,
2808 void *event_info __UNUSED__)
2810 Evas_Object *obj = data;
2811 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_RIGHT, NULL);
2812 evas_object_smart_callback_call(obj, SIG_EDGE_RIGHT, NULL);
2816 _edge_top(void *data,
2817 Evas_Object *scr __UNUSED__,
2818 void *event_info __UNUSED__)
2820 Evas_Object *obj = data;
2821 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_TOP, NULL);
2822 evas_object_smart_callback_call(obj, SIG_EDGE_TOP, NULL);
2826 _edge_bottom(void *data,
2827 Evas_Object *scr __UNUSED__,
2828 void *event_info __UNUSED__)
2830 Evas_Object *obj = data;
2831 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_BOTTOM, NULL);
2832 evas_object_smart_callback_call(obj, SIG_EDGE_BOTTOM, NULL);
2836 _mode_item_realize(Elm_Gen_Item *it)
2840 if ((it->item->mode_view) || (it->delete_me)) return;
2842 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2843 it->item->mode_view = edje_object_add(evas_object_evas_get(WIDGET(it)));
2844 edje_object_scale_set(it->item->mode_view,
2845 elm_widget_scale_get(WIDGET(it)) *
2846 _elm_config->scale);
2847 evas_object_smart_member_add(it->item->mode_view, it->wd->pan_smart);
2848 elm_widget_sub_object_add(WIDGET(it), it->item->mode_view);
2850 strncpy(buf, "item", sizeof(buf));
2851 if (it->wd->compress)
2852 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
2854 if (it->item->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
2855 strncat(buf, "/", sizeof(buf) - strlen(buf));
2856 strncat(buf, it->wd->mode_item_style, sizeof(buf) - strlen(buf));
2858 _elm_theme_object_set(WIDGET(it), it->item->mode_view, "genlist", buf,
2859 elm_widget_style_get(WIDGET(it)));
2860 edje_object_mirrored_set(it->item->mode_view,
2861 elm_widget_mirrored_get(WIDGET(it)));
2863 /* signal callback add */
2864 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_DOWN,
2866 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_UP,
2868 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_MOVE,
2871 /* label_get, icon_get, state_get */
2872 /* FIXME: If you see that assert, please notify us and we
2873 will clean our mess */
2874 assert(eina_list_count(it->item->mode_icon_objs) == 0);
2876 _item_label_realize(it, it->item->mode_view, &it->item->mode_labels);
2877 it->item->mode_icon_objs = _item_icon_realize(it,
2878 it->item->mode_view,
2879 &it->item->mode_icons);
2880 _item_state_realize(it, it->item->mode_view, &it->item->mode_states);
2882 edje_object_part_swallow(it->item->mode_view,
2883 edje_object_data_get(it->item->mode_view, "mode_part"),
2886 it->want_unrealize = EINA_FALSE;
2887 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2888 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2892 _mode_item_unrealize(Elm_Gen_Item *it)
2894 Widget_Data *wd = it->wd;
2896 if (!it->item->mode_view) return;
2898 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2899 elm_widget_stringlist_free(it->item->mode_labels);
2900 it->item->mode_labels = NULL;
2901 elm_widget_stringlist_free(it->item->mode_icons);
2902 it->item->mode_icons = NULL;
2903 elm_widget_stringlist_free(it->item->mode_states);
2905 EINA_LIST_FREE(it->item->mode_icon_objs, icon)
2906 evas_object_del(icon);
2908 edje_object_part_unswallow(it->item->mode_view, VIEW(it));
2909 evas_object_smart_member_add(VIEW(it), wd->pan_smart);
2910 evas_object_del(it->item->mode_view);
2911 it->item->mode_view = NULL;
2913 if (wd->mode_item == it)
2914 wd->mode_item = NULL;
2915 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2916 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2920 _item_mode_set(Elm_Gen_Item *it)
2923 Widget_Data *wd = it->wd;
2928 it->item->nocache = EINA_TRUE;
2930 if (wd->scr_hold_timer)
2932 ecore_timer_del(wd->scr_hold_timer);
2933 wd->scr_hold_timer = NULL;
2935 elm_smart_scroller_hold_set(wd->scr, EINA_TRUE);
2936 wd->scr_hold_timer = ecore_timer_add(0.1, _scr_hold_timer_cb, wd);
2938 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2939 _mode_item_realize(it);
2940 if (it->item->group_item)
2941 evas_object_raise(it->item->VIEW(group_item));
2942 _item_position(it, it->item->mode_view, it->item->scrl_x, it->item->scrl_y);
2943 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2944 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2946 snprintf(buf, sizeof(buf), "elm,state,%s,active", wd->mode_type);
2947 edje_object_signal_emit(it->item->mode_view, buf, "elm");
2951 _item_mode_unset(Widget_Data *wd)
2954 if (!wd->mode_item) return;
2955 char buf[1024], buf2[1024];
2959 it->item->nocache = EINA_TRUE;
2961 snprintf(buf, sizeof(buf), "elm,state,%s,passive", wd->mode_type);
2962 snprintf(buf2, sizeof(buf2), "elm,state,%s,passive,finished", wd->mode_type);
2964 edje_object_signal_emit(it->item->mode_view, buf, "elm");
2965 edje_object_signal_callback_add(it->item->mode_view, buf2, "elm", _mode_finished_signal_cb, it);
2967 wd->mode_item = NULL;
2971 _item_auto_scroll(Widget_Data *wd)
2976 Evas_Coord ox, oy, ow, oh;
2978 if ((wd->expanded_item) && (wd->auto_scroll_enabled))
2980 evas_object_geometry_get(wd->obj, &ox, &oy, &ow, &oh);
2981 if (wd->expanded_item->item->scrl_y > (oh + oy) / 2)
2983 EINA_LIST_FOREACH(wd->expanded_item->item->items, l, it)
2984 elm_genlist_item_bring_in(it);
2986 wd->auto_scroll_enabled = EINA_FALSE;
2991 elm_genlist_add(Evas_Object *parent)
2996 Evas_Coord minw, minh;
2997 static Evas_Smart *smart = NULL;
3001 static Evas_Smart_Class sc;
3003 evas_object_smart_clipped_smart_set(&_pan_sc);
3005 sc.name = "elm_genlist_pan";
3006 sc.version = EVAS_SMART_CLASS_VERSION;
3009 sc.resize = _pan_resize;
3010 sc.move = _pan_move;
3011 sc.calculate = _pan_calculate;
3012 if (!(smart = evas_smart_class_new(&sc))) return NULL;
3015 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
3017 ELM_SET_WIDTYPE(widtype, "genlist");
3019 elm_widget_type_set(obj, "genlist");
3020 elm_widget_sub_object_add(parent, obj);
3021 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
3022 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
3023 elm_widget_data_set(obj, wd);
3024 elm_widget_del_hook_set(obj, _del_hook);
3025 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
3026 elm_widget_theme_hook_set(obj, _theme_hook);
3027 elm_widget_can_focus_set(obj, EINA_TRUE);
3028 elm_widget_event_hook_set(obj, _event_hook);
3029 elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
3030 elm_widget_translate_hook_set(obj, _translate_hook);
3032 wd->scr = elm_smart_scroller_add(e);
3033 elm_smart_scroller_widget_set(wd->scr, obj);
3034 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
3035 elm_widget_style_get(obj));
3036 elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE,
3037 _elm_config->thumbscroll_bounce_enable);
3038 elm_widget_resize_object_set(obj, wd->scr);
3040 evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj);
3041 evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, obj);
3042 evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj);
3043 evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj);
3044 evas_object_smart_callback_add(wd->scr, "edge,left", _edge_left, obj);
3045 evas_object_smart_callback_add(wd->scr, "edge,right", _edge_right, obj);
3046 evas_object_smart_callback_add(wd->scr, "edge,top", _edge_top, obj);
3047 evas_object_smart_callback_add(wd->scr, "edge,bottom", _edge_bottom, obj);
3050 wd->mode = ELM_LIST_SCROLL;
3051 wd->max_items_per_block = MAX_ITEMS_PER_BLOCK;
3052 wd->item_cache_max = wd->max_items_per_block * 2;
3053 wd->longpress_timeout = _elm_config->longpress_timeout;
3055 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
3056 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
3057 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
3058 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
3060 wd->pan_smart = evas_object_smart_add(e, smart);
3061 wd->pan = evas_object_smart_data_get(wd->pan_smart);
3064 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
3065 _pan_set, _pan_get, _pan_max_get,
3066 _pan_min_get, _pan_child_size_get);
3068 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
3070 evas_object_size_hint_min_set(obj, minw, minh);
3072 evas_object_smart_callbacks_descriptions_set(obj, _signals);
3074 _mirrored_set(obj, elm_widget_mirrored_get(obj));
3079 static Elm_Gen_Item *
3080 _item_new(Widget_Data *wd,
3081 const Elm_Genlist_Item_Class *itc,
3083 Elm_Gen_Item *parent,
3084 Elm_Genlist_Item_Flags flags,
3086 const void *func_data)
3090 it = elm_gen_item_new(wd, itc, data, parent, func, func_data);
3091 if (!it) return NULL;
3092 it->item = ELM_NEW(Elm_Gen_Item_Type);
3093 it->item->flags = flags;
3094 if (flags & ELM_GENLIST_ITEM_GROUP) it->group++;
3095 it->item->expanded_depth = 0;
3096 elm_widget_item_del_cb_set(it, _item_del_hook);
3097 ELM_GEN_ITEM_SETUP(it);
3100 if (it->parent->group)
3101 it->item->group_item = parent;
3102 else if (it->parent->item->group_item)
3103 it->item->group_item = it->parent->item->group_item;
3109 _item_block_add(Widget_Data *wd,
3112 Item_Block *itb = NULL;
3119 itb = calloc(1, sizeof(Item_Block));
3122 if (!it->item->rel->item->block)
3125 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3126 itb->items = eina_list_append(itb->items, it);
3130 if (it->item->before)
3132 wd->blocks = eina_inlist_prepend_relative
3133 (wd->blocks, EINA_INLIST_GET(itb),
3134 EINA_INLIST_GET(it->item->rel->item->block));
3136 eina_list_prepend_relative(itb->items, it, it->item->rel);
3140 wd->blocks = eina_inlist_append_relative
3141 (wd->blocks, EINA_INLIST_GET(itb),
3142 EINA_INLIST_GET(it->item->rel->item->block));
3144 eina_list_append_relative(itb->items, it, it->item->rel);
3150 if (it->item->before)
3154 itb = (Item_Block *)(wd->blocks);
3155 if (itb->count >= wd->max_items_per_block)
3157 itb = calloc(1, sizeof(Item_Block));
3161 eina_inlist_prepend(wd->blocks,
3162 EINA_INLIST_GET(itb));
3167 itb = calloc(1, sizeof(Item_Block));
3171 eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
3173 itb->items = eina_list_prepend(itb->items, it);
3179 itb = (Item_Block *)(wd->blocks->last);
3180 if (itb->count >= wd->max_items_per_block)
3182 itb = calloc(1, sizeof(Item_Block));
3186 eina_inlist_append(wd->blocks,
3187 EINA_INLIST_GET(itb));
3192 itb = calloc(1, sizeof(Item_Block));
3196 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3198 itb->items = eina_list_append(itb->items, it);
3204 itb = it->item->rel->item->block;
3205 if (!itb) goto newblock;
3206 if (it->item->before)
3207 itb->items = eina_list_prepend_relative(itb->items, it, it->item->rel);
3209 itb->items = eina_list_append_relative(itb->items, it, it->item->rel);
3212 itb->changed = EINA_TRUE;
3213 it->item->block = itb;
3214 if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job);
3215 itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd);
3218 it->item->rel->relcount--;
3219 if ((it->item->rel->delete_me) && (!it->item->rel->relcount))
3220 _item_del(it->item->rel);
3221 it->item->rel = NULL;
3223 if (itb->count > itb->wd->max_items_per_block)
3229 newc = itb->count / 2;
3230 itb2 = calloc(1, sizeof(Item_Block));
3234 eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
3235 EINA_INLIST_GET(itb));
3236 itb2->changed = EINA_TRUE;
3237 while ((itb->count > newc) && (itb->items))
3241 l = eina_list_last(itb->items);
3243 itb->items = eina_list_remove_list(itb->items, l);
3246 itb2->items = eina_list_prepend(itb2->items, it2);
3247 it2->item->block = itb2;
3254 _queue_process(Widget_Data *wd)
3257 Eina_Bool showme = EINA_FALSE;
3260 t0 = ecore_time_get();
3261 //evas_event_freeze(evas_object_evas_get(wd->obj));
3262 for (n = 0; (wd->queue) && (n < 128); n++)
3266 it = wd->queue->data;
3267 wd->queue = eina_list_remove_list(wd->queue, wd->queue);
3268 it->item->queued = EINA_FALSE;
3269 _item_block_add(wd, it);
3270 t = ecore_time_get();
3271 if (it->item->block->changed)
3273 showme = _item_block_recalc(it->item->block, it->item->block->num, EINA_TRUE);
3274 it->item->block->changed = 0;
3276 if (showme) it->item->block->showme = EINA_TRUE;
3277 if (eina_inlist_count(wd->blocks) > 1)
3279 if ((t - t0) > (ecore_animator_frametime_get())) break;
3282 //evas_event_thaw(evas_object_evas_get(wd->obj));
3283 //evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3288 _idle_process(void *data, Eina_Bool *wakeup)
3290 Widget_Data *wd = data;
3293 //static double q_start = 0.0;
3294 //if (q_start == 0.0) q_start = ecore_time_get();
3296 if (_queue_process(wd) > 0) *wakeup = EINA_TRUE;
3300 //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start);
3302 return ECORE_CALLBACK_CANCEL;
3304 return ECORE_CALLBACK_RENEW;
3308 _item_idle_enterer(void *data)
3310 Widget_Data *wd = data;
3311 Eina_Bool wakeup = EINA_FALSE;
3312 Eina_Bool ok = _idle_process(data, &wakeup);
3317 if (wd->calc_job) ecore_job_del(wd->calc_job);
3318 wd->calc_job = ecore_job_add(_calc_job, wd);
3320 if (ok == ECORE_CALLBACK_CANCEL) wd->queue_idle_enterer = NULL;
3325 _item_queue(Widget_Data *wd,
3328 if (it->item->queued) return;
3329 it->item->queued = EINA_TRUE;
3330 wd->queue = eina_list_append(wd->queue, it);
3331 // FIXME: why does a freeze then thaw here cause some genlist
3332 // elm_genlist_item_append() to be much much slower?
3333 // evas_event_freeze(evas_object_evas_get(wd->obj));
3334 while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
3336 if (wd->queue_idle_enterer)
3338 ecore_idle_enterer_del(wd->queue_idle_enterer);
3339 wd->queue_idle_enterer = NULL;
3343 // evas_event_thaw(evas_object_evas_get(wd->obj));
3344 // evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3345 if (!wd->queue_idle_enterer)
3346 wd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, wd);
3350 _elm_genlist_item_compare_data(const void *data, const void *data1)
3352 const Elm_Gen_Item *it = data;
3353 const Elm_Gen_Item *item1 = data1;
3355 return _elm_genlist_item_compare_data_cb(it->base.data, item1->base.data);
3359 _elm_genlist_item_compare(const void *data, const void *data1)
3361 const Elm_Gen_Item *it, *item1;
3362 it = ELM_GEN_ITEM_FROM_INLIST(data);
3363 item1 = ELM_GEN_ITEM_FROM_INLIST(data1);
3364 return _elm_genlist_item_compare_cb(it, item1);
3368 _elm_genlist_item_list_compare(const void *data, const void *data1)
3370 const Elm_Gen_Item *it = data;
3371 const Elm_Gen_Item *item1 = data1;
3372 return _elm_genlist_item_compare_cb(it, item1);
3376 _item_move_after(Elm_Gen_Item *it, Elm_Gen_Item *after)
3381 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3382 _item_block_del(it);
3384 it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
3385 it->item->rel = after;
3386 it->item->rel->relcount++;
3387 it->item->before = EINA_FALSE;
3388 if (after->item->group_item) it->item->group_item = after->item->group_item;
3389 _item_queue(it->wd, it);
3391 evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it);
3395 _item_move_before(Elm_Gen_Item *it, Elm_Gen_Item *before)
3398 if (!before) return;
3400 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3401 _item_block_del(it);
3402 it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
3403 it->item->rel = before;
3404 it->item->rel->relcount++;
3405 it->item->before = EINA_TRUE;
3406 if (before->item->group_item) it->item->group_item = before->item->group_item;
3407 _item_queue(it->wd, it);
3409 evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it);
3413 elm_genlist_item_append(Evas_Object *obj,
3414 const Elm_Genlist_Item_Class *itc,
3416 Elm_Gen_Item *parent,
3417 Elm_Genlist_Item_Flags flags,
3419 const void *func_data)
3421 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3422 Widget_Data *wd = elm_widget_data_get(obj);
3423 if (!wd) return NULL;
3424 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3426 if (!it) return NULL;
3429 if (flags & ELM_GENLIST_ITEM_GROUP)
3430 wd->group_items = eina_list_append(wd->group_items, it);
3431 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
3432 it->item->rel = NULL;
3436 Elm_Gen_Item *it2 = NULL;
3437 Eina_List *ll = eina_list_last(it->parent->item->items);
3438 if (ll) it2 = ll->data;
3439 it->parent->item->items = eina_list_append(it->parent->item->items, it);
3440 if (!it2) it2 = it->parent;
3442 eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3443 EINA_INLIST_GET(it2));
3444 it->item->rel = it2;
3445 it->item->rel->relcount++;
3447 it->item->before = EINA_FALSE;
3448 _item_queue(wd, it);
3453 elm_genlist_item_prepend(Evas_Object *obj,
3454 const Elm_Genlist_Item_Class *itc,
3456 Elm_Gen_Item *parent,
3457 Elm_Genlist_Item_Flags flags,
3459 const void *func_data)
3461 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3462 Widget_Data *wd = elm_widget_data_get(obj);
3463 if (!wd) return NULL;
3464 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3466 if (!it) return NULL;
3469 if (flags & ELM_GENLIST_ITEM_GROUP)
3470 wd->group_items = eina_list_prepend(wd->group_items, it);
3471 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
3472 it->item->rel = NULL;
3476 Elm_Gen_Item *it2 = NULL;
3477 Eina_List *ll = it->parent->item->items;
3478 if (ll) it2 = ll->data;
3479 it->parent->item->items = eina_list_prepend(it->parent->item->items, it);
3480 if (!it2) it2 = it->parent;
3482 eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3483 EINA_INLIST_GET(it2));
3484 it->item->rel = it2;
3485 it->item->rel->relcount++;
3487 it->item->before = EINA_TRUE;
3488 _item_queue(wd, it);
3493 elm_genlist_item_insert_after(Evas_Object *obj,
3494 const Elm_Genlist_Item_Class *itc,
3496 Elm_Gen_Item *parent,
3497 Elm_Gen_Item *after,
3498 Elm_Genlist_Item_Flags flags,
3500 const void *func_data)
3502 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3503 EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
3504 Widget_Data *wd = elm_widget_data_get(obj);
3505 if (!wd) return NULL;
3506 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3508 if (!it) return NULL;
3509 /* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */
3510 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3514 if ((flags & ELM_GENLIST_ITEM_GROUP) &&
3515 (after->item->flags & ELM_GENLIST_ITEM_GROUP))
3516 wd->group_items = eina_list_append_relative(wd->group_items, it,
3521 it->parent->item->items = eina_list_append_relative(it->parent->item->items, it,
3524 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3525 EINA_INLIST_GET(after));
3526 it->item->rel = after;
3527 it->item->rel->relcount++;
3528 it->item->before = EINA_FALSE;
3529 _item_queue(wd, it);
3534 elm_genlist_item_insert_before(Evas_Object *obj,
3535 const Elm_Genlist_Item_Class *itc,
3537 Elm_Gen_Item *parent,
3538 Elm_Gen_Item *before,
3539 Elm_Genlist_Item_Flags flags,
3541 const void *func_data)
3543 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3544 EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
3545 Widget_Data *wd = elm_widget_data_get(obj);
3546 if (!wd) return NULL;
3547 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3549 if (!it) return NULL;
3550 /* It makes no sense to insert before in an empty list with before != NULL, something really bad is happening in your app. */
3551 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3555 if ((flags & ELM_GENLIST_ITEM_GROUP) &&
3556 (before->item->flags & ELM_GENLIST_ITEM_GROUP))
3557 wd->group_items = eina_list_prepend_relative(wd->group_items, it,
3562 it->parent->item->items = eina_list_prepend_relative(it->parent->item->items, it,
3565 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3566 EINA_INLIST_GET(before));
3567 it->item->rel = before;
3568 it->item->rel->relcount++;
3569 it->item->before = EINA_TRUE;
3570 _item_queue(wd, it);
3575 elm_genlist_item_direct_sorted_insert(Evas_Object *obj,
3576 const Elm_Genlist_Item_Class *itc,
3578 Elm_Gen_Item *parent,
3579 Elm_Genlist_Item_Flags flags,
3580 Eina_Compare_Cb comp,
3582 const void *func_data)
3584 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3585 Widget_Data *wd = elm_widget_data_get(obj);
3586 if (!wd) return NULL;
3587 Elm_Gen_Item *rel = NULL;
3588 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3590 if (!it) return NULL;
3592 _elm_genlist_item_compare_cb = comp;
3599 l = eina_list_search_sorted_near_list(it->parent->item->items,
3600 _elm_genlist_item_list_compare, it,
3603 rel = eina_list_data_get(l);
3607 if (cmp_result >= 0)
3609 it->parent->item->items = eina_list_prepend_relative_list(it->parent->item->items, it, l);
3610 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
3611 it->item->before = EINA_FALSE;
3613 else if (cmp_result < 0)
3615 it->parent->item->items = eina_list_append_relative_list(it->parent->item->items, it, l);
3616 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
3617 it->item->before = EINA_TRUE;
3624 wd->state = eina_inlist_sorted_state_new();
3627 if (flags & ELM_GENLIST_ITEM_GROUP)
3628 wd->group_items = eina_list_append(wd->group_items, it);
3630 wd->items = eina_inlist_sorted_state_insert(wd->items, EINA_INLIST_GET(it),
3631 _elm_genlist_item_compare, wd->state);
3633 if (EINA_INLIST_GET(it)->next)
3635 rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3636 it->item->before = EINA_TRUE;
3638 else if (EINA_INLIST_GET(it)->prev)
3640 rel = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3641 it->item->before = EINA_FALSE;
3647 it->item->rel = rel;
3648 it->item->rel->relcount++;
3651 _item_queue(wd, it);
3657 elm_genlist_item_sorted_insert(Evas_Object *obj,
3658 const Elm_Genlist_Item_Class *itc,
3660 Elm_Gen_Item *parent,
3661 Elm_Genlist_Item_Flags flags,
3662 Eina_Compare_Cb comp,
3664 const void *func_data)
3666 _elm_genlist_item_compare_data_cb = comp;
3668 return elm_genlist_item_direct_sorted_insert(obj, itc, data, parent, flags,
3669 _elm_genlist_item_compare_data, func, func_data);
3673 elm_genlist_clear(Evas_Object *obj)
3679 elm_genlist_multi_select_set(Evas_Object *obj,
3682 ELM_CHECK_WIDTYPE(obj, widtype);
3683 Widget_Data *wd = elm_widget_data_get(obj);
3689 elm_genlist_multi_select_get(const Evas_Object *obj)
3691 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3692 Widget_Data *wd = elm_widget_data_get(obj);
3693 if (!wd) return EINA_FALSE;
3698 elm_genlist_selected_item_get(const Evas_Object *obj)
3700 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3701 Widget_Data *wd = elm_widget_data_get(obj);
3702 if (!wd) return NULL;
3703 if (wd->selected) return wd->selected->data;
3707 EAPI const Eina_List *
3708 elm_genlist_selected_items_get(const Evas_Object *obj)
3710 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3711 Widget_Data *wd = elm_widget_data_get(obj);
3712 if (!wd) return NULL;
3713 return wd->selected;
3717 elm_genlist_realized_items_get(const Evas_Object *obj)
3719 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3720 Widget_Data *wd = elm_widget_data_get(obj);
3721 Eina_List *list = NULL;
3723 Eina_Bool done = EINA_FALSE;
3724 if (!wd) return NULL;
3725 EINA_INLIST_FOREACH(wd->blocks, itb)
3733 EINA_LIST_FOREACH(itb->items, l, it)
3735 if (it->realized) list = eina_list_append(list, it);
3747 elm_genlist_at_xy_item_get(const Evas_Object *obj,
3752 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3753 Widget_Data *wd = elm_widget_data_get(obj);
3754 Evas_Coord ox, oy, ow, oh;
3757 if (!wd) return NULL;
3758 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
3760 EINA_INLIST_FOREACH(wd->blocks, itb)
3765 if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
3766 oy + itb->y - itb->wd->pan_y,
3767 itb->w, itb->h, x, y, 1, 1))
3769 EINA_LIST_FOREACH(itb->items, l, it)
3771 Evas_Coord itx, ity;
3773 itx = ox + itb->x + it->x - itb->wd->pan_x;
3774 ity = oy + itb->y + it->y - itb->wd->pan_y;
3775 if (ELM_RECTS_INTERSECT(itx, ity, it->item->w, it->item->h, x, y, 1, 1))
3779 if (y <= (ity + (it->item->h / 4))) *posret = -1;
3780 else if (y >= (ity + it->item->h - (it->item->h / 4)))
3786 lasty = ity + it->item->h;
3791 if (y > lasty) *posret = 1;
3798 elm_genlist_first_item_get(const Evas_Object *obj)
3800 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3801 Widget_Data *wd = elm_widget_data_get(obj);
3802 if (!wd) return NULL;
3803 if (!wd->items) return NULL;
3804 Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items);
3805 while ((it) && (it->delete_me))
3806 it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3811 elm_genlist_last_item_get(const Evas_Object *obj)
3813 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3814 Widget_Data *wd = elm_widget_data_get(obj);
3815 if (!wd) return NULL;
3816 if (!wd->items) return NULL;
3817 Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
3818 while ((it) && (it->delete_me))
3819 it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3824 elm_genlist_item_next_get(const Elm_Gen_Item *it)
3826 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3829 it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3830 if ((it) && (!it->delete_me)) break;
3832 return (Elm_Gen_Item *)it;
3836 elm_genlist_item_prev_get(const Elm_Gen_Item *it)
3838 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3841 it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3842 if ((it) && (!it->delete_me)) break;
3844 return (Elm_Gen_Item *)it;
3848 elm_genlist_item_genlist_get(const Elm_Gen_Item *it)
3850 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3855 elm_genlist_item_parent_get(const Elm_Gen_Item *it)
3857 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3862 elm_genlist_item_subitems_clear(Elm_Gen_Item *it)
3864 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3865 Eina_List *tl = NULL, *l;
3868 EINA_LIST_FOREACH(it->item->items, l, it2)
3869 tl = eina_list_append(tl, it2);
3870 EINA_LIST_FREE(tl, it2)
3871 elm_genlist_item_del(it2);
3875 elm_genlist_item_selected_set(Elm_Gen_Item *it,
3878 elm_gen_item_selected_set(it, selected);
3882 elm_genlist_item_selected_get(const Elm_Gen_Item *it)
3884 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
3885 return it->selected;
3889 elm_genlist_item_expanded_set(Elm_Gen_Item *it,
3892 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3893 if (it->item->expanded == expanded) return;
3894 it->item->expanded = expanded;
3895 it->wd->expanded_item = it;
3896 if (it->item->expanded)
3899 edje_object_signal_emit(VIEW(it), "elm,state,expanded", "elm");
3900 evas_object_smart_callback_call(WIDGET(it), SIG_EXPANDED, it);
3901 it->wd->auto_scroll_enabled = EINA_TRUE;
3906 edje_object_signal_emit(VIEW(it), "elm,state,contracted", "elm");
3907 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACTED, it);
3908 it->wd->auto_scroll_enabled = EINA_FALSE;
3913 elm_genlist_item_expanded_get(const Elm_Gen_Item *it)
3915 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
3916 return it->item->expanded;
3920 elm_genlist_item_expanded_depth_get(const Elm_Gen_Item *it)
3922 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, 0);
3923 return it->item->expanded_depth;
3927 elm_genlist_item_disabled_set(Elm_Gen_Item *it,
3930 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3933 if (it->disabled == disabled) return;
3934 if (it->delete_me) return;
3935 it->disabled = !!disabled;
3937 elm_genlist_item_selected_set(it, EINA_FALSE);
3941 edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
3943 edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm");
3944 EINA_LIST_FOREACH(it->icon_objs, l, obj)
3945 elm_widget_disabled_set(obj, disabled);
3950 elm_genlist_item_disabled_get(const Elm_Gen_Item *it)
3952 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
3953 if (it->delete_me) return EINA_FALSE;
3954 return it->disabled;
3958 elm_genlist_item_display_only_set(Elm_Gen_Item *it,
3959 Eina_Bool display_only)
3961 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3962 if (it->display_only == display_only) return;
3963 if (it->delete_me) return;
3964 it->display_only = display_only;
3965 it->item->mincalcd = EINA_FALSE;
3966 it->item->updateme = EINA_TRUE;
3967 if (it->item->block) it->item->block->updateme = EINA_TRUE;
3968 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
3969 it->wd->update_job = ecore_job_add(_update_job, it->wd);
3973 elm_genlist_item_display_only_get(const Elm_Gen_Item *it)
3975 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
3976 if (it->delete_me) return EINA_FALSE;
3977 return it->display_only;
3981 elm_genlist_item_show(Elm_Gen_Item *it)
3983 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3984 Evas_Coord gith = 0;
3985 if (it->delete_me) return;
3986 if ((it->item->queued) || (!it->item->mincalcd))
3988 it->wd->show_item = it;
3989 it->wd->bring_in = EINA_TRUE;
3990 it->item->showme = EINA_TRUE;
3993 if (it->wd->show_item)
3995 it->wd->show_item->item->showme = EINA_FALSE;
3996 it->wd->show_item = NULL;
3998 if ((it->item->group_item) && (it->wd->pan_y > (it->y + it->item->block->y)))
3999 gith = it->item->group_item->item->h;
4000 elm_smart_scroller_child_region_show(it->wd->scr,
4001 it->x + it->item->block->x,
4002 it->y + it->item->block->y - gith,
4003 it->item->block->w, it->item->h);
4007 elm_genlist_item_bring_in(Elm_Gen_Item *it)
4009 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4010 Evas_Coord gith = 0;
4011 if (it->delete_me) return;
4012 if ((it->item->queued) || (!it->item->mincalcd))
4014 it->wd->show_item = it;
4015 it->wd->bring_in = EINA_TRUE;
4016 it->item->showme = EINA_TRUE;
4019 if (it->wd->show_item)
4021 it->wd->show_item->item->showme = EINA_FALSE;
4022 it->wd->show_item = NULL;
4024 if ((it->item->group_item) && (it->wd->pan_y > (it->y + it->item->block->y)))
4025 gith = it->item->group_item->item->h;
4026 elm_smart_scroller_region_bring_in(it->wd->scr,
4027 it->x + it->item->block->x,
4028 it->y + it->item->block->y - gith,
4029 it->item->block->w, it->item->h);
4033 elm_genlist_item_top_show(Elm_Gen_Item *it)
4035 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4037 Evas_Coord gith = 0;
4039 if (it->delete_me) return;
4040 if ((it->item->queued) || (!it->item->mincalcd))
4042 it->wd->show_item = it;
4043 it->wd->bring_in = EINA_TRUE;
4044 it->item->showme = EINA_TRUE;
4047 if (it->wd->show_item)
4049 it->wd->show_item->item->showme = EINA_FALSE;
4050 it->wd->show_item = NULL;
4052 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4053 if (it->item->group_item) gith = it->item->group_item->item->h;
4054 elm_smart_scroller_child_region_show(it->wd->scr,
4055 it->x + it->item->block->x,
4056 it->y + it->item->block->y - gith,
4057 it->item->block->w, oh);
4061 elm_genlist_item_top_bring_in(Elm_Gen_Item *it)
4063 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4065 Evas_Coord gith = 0;
4067 if (it->delete_me) return;
4068 if ((it->item->queued) || (!it->item->mincalcd))
4070 it->wd->show_item = it;
4071 it->wd->bring_in = EINA_TRUE;
4072 it->item->showme = EINA_TRUE;
4075 if (it->wd->show_item)
4077 it->wd->show_item->item->showme = EINA_FALSE;
4078 it->wd->show_item = NULL;
4080 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4081 if (it->item->group_item) gith = it->item->group_item->item->h;
4082 elm_smart_scroller_region_bring_in(it->wd->scr,
4083 it->x + it->item->block->x,
4084 it->y + it->item->block->y - gith,
4085 it->item->block->w, oh);
4089 elm_genlist_item_middle_show(Elm_Gen_Item *it)
4091 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4094 if (it->delete_me) return;
4095 if ((it->item->queued) || (!it->item->mincalcd))
4097 it->wd->show_item = it;
4098 it->wd->bring_in = EINA_TRUE;
4099 it->item->showme = EINA_TRUE;
4102 if (it->wd->show_item)
4104 it->wd->show_item->item->showme = EINA_FALSE;
4105 it->wd->show_item = NULL;
4107 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4108 elm_smart_scroller_child_region_show(it->wd->scr,
4109 it->x + it->item->block->x,
4110 it->y + it->item->block->y - oh / 2 +
4111 it->item->h / 2, it->item->block->w, oh);
4115 elm_genlist_item_middle_bring_in(Elm_Gen_Item *it)
4117 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4120 if (it->delete_me) return;
4121 if ((it->item->queued) || (!it->item->mincalcd))
4123 it->wd->show_item = it;
4124 it->wd->bring_in = EINA_TRUE;
4125 it->item->showme = EINA_TRUE;
4128 if (it->wd->show_item)
4130 it->wd->show_item->item->showme = EINA_FALSE;
4131 it->wd->show_item = NULL;
4133 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4134 elm_smart_scroller_region_bring_in(it->wd->scr,
4135 it->x + it->item->block->x,
4136 it->y + it->item->block->y - oh / 2 + it->item->h / 2,
4137 it->item->block->w, oh);
4141 elm_genlist_item_del(Elm_Gen_Item *it)
4143 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4144 if ((it->relcount > 0) || (it->walking > 0))
4146 elm_genlist_item_subitems_clear(it);
4147 if (it->wd->show_item == it) it->wd->show_item = NULL;
4148 elm_gen_item_del_notserious(it);
4149 if (it->item->block)
4151 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE);
4152 it->item->block->changed = EINA_TRUE;
4153 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
4154 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
4162 elm_genlist_item_data_set(Elm_Gen_Item *it,
4165 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4166 elm_widget_item_data_set(it, data);
4170 elm_genlist_item_data_get(const Elm_Gen_Item *it)
4172 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4173 return elm_widget_item_data_get(it);
4177 elm_genlist_item_icons_orphan(Elm_Gen_Item *it)
4180 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4181 EINA_LIST_FREE(it->icon_objs, icon)
4183 elm_widget_sub_object_del(WIDGET(it), icon);
4184 evas_object_smart_member_del(icon);
4185 evas_object_hide(icon);
4189 EAPI const Evas_Object *
4190 elm_genlist_item_object_get(const Elm_Gen_Item *it)
4192 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4197 elm_genlist_item_update(Elm_Gen_Item *it)
4199 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4200 if (!it->item->block) return;
4201 if (it->delete_me) return;
4202 it->item->mincalcd = EINA_FALSE;
4203 it->item->updateme = EINA_TRUE;
4204 it->item->block->updateme = EINA_TRUE;
4205 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4206 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4210 elm_genlist_item_item_class_update(Elm_Gen_Item *it,
4211 const Elm_Genlist_Item_Class *itc)
4213 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4214 if (!it->item->block) return;
4215 EINA_SAFETY_ON_NULL_RETURN(itc);
4216 if (it->delete_me) return;
4218 it->item->nocache = EINA_TRUE;
4219 elm_genlist_item_update(it);
4222 EAPI const Elm_Genlist_Item_Class *
4223 elm_genlist_item_item_class_get(const Elm_Gen_Item *it)
4225 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4226 if (it->delete_me) return NULL;
4230 static Evas_Object *
4231 _elm_genlist_item_label_create(void *data,
4232 Evas_Object *obj __UNUSED__,
4233 Evas_Object *tooltip,
4234 void *it __UNUSED__)
4236 Evas_Object *label = elm_label_add(tooltip);
4239 elm_object_style_set(label, "tooltip");
4240 elm_object_text_set(label, data);
4245 _elm_genlist_item_label_del_cb(void *data,
4246 Evas_Object *obj __UNUSED__,
4247 void *event_info __UNUSED__)
4249 eina_stringshare_del(data);
4253 elm_genlist_item_tooltip_text_set(Elm_Gen_Item *it,
4256 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4257 text = eina_stringshare_add(text);
4258 elm_genlist_item_tooltip_content_cb_set(it, _elm_genlist_item_label_create,
4260 _elm_genlist_item_label_del_cb);
4264 elm_genlist_item_tooltip_content_cb_set(Elm_Gen_Item *it,
4265 Elm_Tooltip_Item_Content_Cb func,
4267 Evas_Smart_Cb del_cb)
4269 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(it, error);
4271 if ((it->tooltip.content_cb == func) && (it->tooltip.data == data))
4274 if (it->tooltip.del_cb)
4275 it->tooltip.del_cb((void *)it->tooltip.data,
4278 it->tooltip.content_cb = func;
4279 it->tooltip.data = data;
4280 it->tooltip.del_cb = del_cb;
4284 elm_widget_item_tooltip_content_cb_set(it,
4285 it->tooltip.content_cb,
4286 it->tooltip.data, NULL);
4287 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
4288 elm_widget_item_tooltip_size_restrict_disable(it, it->tooltip.free_size);
4294 if (del_cb) del_cb((void *)data, NULL, NULL);
4298 elm_genlist_item_tooltip_unset(Elm_Gen_Item *it)
4300 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4301 if ((VIEW(it)) && (it->tooltip.content_cb))
4302 elm_widget_item_tooltip_unset(it);
4304 if (it->tooltip.del_cb)
4305 it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
4306 it->tooltip.del_cb = NULL;
4307 it->tooltip.content_cb = NULL;
4308 it->tooltip.data = NULL;
4309 it->tooltip.free_size = EINA_FALSE;
4310 if (it->tooltip.style)
4311 elm_genlist_item_tooltip_style_set(it, NULL);
4315 elm_genlist_item_tooltip_style_set(Elm_Gen_Item *it,
4318 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4319 eina_stringshare_replace(&it->tooltip.style, style);
4320 if (VIEW(it)) elm_widget_item_tooltip_style_set(it, style);
4324 elm_genlist_item_tooltip_style_get(const Elm_Gen_Item *it)
4326 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4327 return it->tooltip.style;
4331 elm_genlist_item_tooltip_size_restrict_disable(Elm_Gen_Item *it, Eina_Bool disable)
4333 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4334 it->tooltip.free_size = disable;
4335 if (VIEW(it)) return elm_widget_item_tooltip_size_restrict_disable(it, disable);
4340 elm_genlist_item_tooltip_size_restrict_disabled_get(const Elm_Gen_Item *it)
4342 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4343 return it->tooltip.free_size;
4347 elm_genlist_item_cursor_set(Elm_Gen_Item *it,
4350 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4351 eina_stringshare_replace(&it->mouse_cursor, cursor);
4352 if (VIEW(it)) elm_widget_item_cursor_set(it, cursor);
4356 elm_genlist_item_cursor_get(const Elm_Gen_Item *it)
4358 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4359 return elm_widget_item_cursor_get(it);
4363 elm_genlist_item_cursor_unset(Elm_Gen_Item *it)
4365 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4366 if (!it->mouse_cursor)
4370 elm_widget_item_cursor_unset(it);
4372 eina_stringshare_del(it->mouse_cursor);
4373 it->mouse_cursor = NULL;
4377 elm_genlist_item_cursor_style_set(Elm_Gen_Item *it,
4380 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4381 elm_widget_item_cursor_style_set(it, style);
4385 elm_genlist_item_cursor_style_get(const Elm_Gen_Item *it)
4387 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4388 return elm_widget_item_cursor_style_get(it);
4392 elm_genlist_item_cursor_engine_only_set(Elm_Gen_Item *it,
4393 Eina_Bool engine_only)
4395 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4396 elm_widget_item_cursor_engine_only_set(it, engine_only);
4400 elm_genlist_item_cursor_engine_only_get(const Elm_Gen_Item *it)
4402 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4403 return elm_widget_item_cursor_engine_only_get(it);
4407 elm_genlist_horizontal_set(Evas_Object *obj,
4410 ELM_CHECK_WIDTYPE(obj, widtype);
4411 Widget_Data *wd = elm_widget_data_get(obj);
4413 if (wd->mode == mode) return;
4419 elm_genlist_horizontal_mode_set(Evas_Object *obj,
4422 elm_genlist_horizontal_set(obj, mode);
4426 elm_genlist_horizontal_get(const Evas_Object *obj)
4428 ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
4429 Widget_Data *wd = elm_widget_data_get(obj);
4430 if (!wd) return ELM_LIST_LAST;
4435 elm_genlist_horizontal_mode_get(const Evas_Object *obj)
4437 return elm_genlist_horizontal_get(obj);
4441 elm_genlist_always_select_mode_set(Evas_Object *obj,
4442 Eina_Bool always_select)
4444 ELM_CHECK_WIDTYPE(obj, widtype);
4445 Widget_Data *wd = elm_widget_data_get(obj);
4447 wd->always_select = always_select;
4451 elm_genlist_always_select_mode_get(const Evas_Object *obj)
4453 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4454 Widget_Data *wd = elm_widget_data_get(obj);
4455 if (!wd) return EINA_FALSE;
4456 return wd->always_select;
4460 elm_genlist_no_select_mode_set(Evas_Object *obj,
4461 Eina_Bool no_select)
4463 ELM_CHECK_WIDTYPE(obj, widtype);
4464 Widget_Data *wd = elm_widget_data_get(obj);
4466 wd->no_select = no_select;
4470 elm_genlist_no_select_mode_get(const Evas_Object *obj)
4472 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4473 Widget_Data *wd = elm_widget_data_get(obj);
4474 if (!wd) return EINA_FALSE;
4475 return wd->no_select;
4479 elm_genlist_compress_mode_set(Evas_Object *obj,
4482 ELM_CHECK_WIDTYPE(obj, widtype);
4483 Widget_Data *wd = elm_widget_data_get(obj);
4485 wd->compress = compress;
4486 if (!compress) elm_genlist_homogeneous_set(obj, EINA_FALSE);
4490 elm_genlist_compress_mode_get(const Evas_Object *obj)
4492 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4493 Widget_Data *wd = elm_widget_data_get(obj);
4494 if (!wd) return EINA_FALSE;
4495 return wd->compress;
4499 elm_genlist_height_for_width_mode_set(Evas_Object *obj,
4500 Eina_Bool height_for_width)
4502 ELM_CHECK_WIDTYPE(obj, widtype);
4503 Widget_Data *wd = elm_widget_data_get(obj);
4505 wd->height_for_width = !!height_for_width;
4506 if (wd->height_for_width)
4508 elm_genlist_homogeneous_set(obj, EINA_FALSE);
4509 elm_genlist_compress_mode_set(obj, EINA_TRUE);
4514 elm_genlist_height_for_width_mode_get(const Evas_Object *obj)
4516 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4517 Widget_Data *wd = elm_widget_data_get(obj);
4518 if (!wd) return EINA_FALSE;
4519 return wd->height_for_width;
4523 elm_genlist_bounce_set(Evas_Object *obj,
4527 ELM_CHECK_WIDTYPE(obj, widtype);
4528 Widget_Data *wd = elm_widget_data_get(obj);
4530 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
4534 elm_genlist_bounce_get(const Evas_Object *obj,
4535 Eina_Bool *h_bounce,
4536 Eina_Bool *v_bounce)
4538 ELM_CHECK_WIDTYPE(obj, widtype);
4539 Widget_Data *wd = elm_widget_data_get(obj);
4541 elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce);
4545 elm_genlist_homogeneous_set(Evas_Object *obj,
4546 Eina_Bool homogeneous)
4548 ELM_CHECK_WIDTYPE(obj, widtype);
4549 Widget_Data *wd = elm_widget_data_get(obj);
4551 if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
4552 wd->homogeneous = homogeneous;
4556 elm_genlist_homogeneous_get(const Evas_Object *obj)
4558 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4559 Widget_Data *wd = elm_widget_data_get(obj);
4560 if (!wd) return EINA_FALSE;
4561 return wd->homogeneous;
4565 elm_genlist_block_count_set(Evas_Object *obj,
4568 ELM_CHECK_WIDTYPE(obj, widtype);
4569 Widget_Data *wd = elm_widget_data_get(obj);
4571 wd->max_items_per_block = n;
4572 wd->item_cache_max = wd->max_items_per_block * 2;
4573 _item_cache_clean(wd);
4577 elm_genlist_block_count_get(const Evas_Object *obj)
4579 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4580 Widget_Data *wd = elm_widget_data_get(obj);
4582 return wd->max_items_per_block;
4586 elm_genlist_longpress_timeout_set(Evas_Object *obj,
4589 ELM_CHECK_WIDTYPE(obj, widtype);
4590 Widget_Data *wd = elm_widget_data_get(obj);
4592 wd->longpress_timeout = timeout;
4596 elm_genlist_longpress_timeout_get(const Evas_Object *obj)
4598 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4599 Widget_Data *wd = elm_widget_data_get(obj);
4601 return wd->longpress_timeout;
4605 elm_genlist_scroller_policy_set(Evas_Object *obj,
4606 Elm_Scroller_Policy policy_h,
4607 Elm_Scroller_Policy policy_v)
4609 ELM_CHECK_WIDTYPE(obj, widtype);
4610 Widget_Data *wd = elm_widget_data_get(obj);
4611 if ((!wd) || (!wd->scr)) return;
4612 if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
4613 (policy_v >= ELM_SCROLLER_POLICY_LAST))
4615 elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
4619 elm_genlist_scroller_policy_get(const Evas_Object *obj,
4620 Elm_Scroller_Policy *policy_h,
4621 Elm_Scroller_Policy *policy_v)
4623 ELM_CHECK_WIDTYPE(obj, widtype);
4624 Widget_Data *wd = elm_widget_data_get(obj);
4625 Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
4626 if ((!wd) || (!wd->scr)) return;
4627 elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
4628 if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
4629 if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
4633 elm_genlist_realized_items_update(Evas_Object *obj)
4635 ELM_CHECK_WIDTYPE(obj, widtype);
4637 Eina_List *list, *l;
4640 list = elm_genlist_realized_items_get(obj);
4641 EINA_LIST_FOREACH(list, l, it)
4642 elm_genlist_item_update(it);
4646 elm_genlist_item_mode_set(Elm_Gen_Item *it,
4647 const char *mode_type,
4650 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4651 Widget_Data *wd = it->wd;
4656 if (!mode_type) return;
4657 if ((it->delete_me) || (it->disabled)) return;
4659 if ((wd->mode_item == it) &&
4660 (!strcmp(mode_type, wd->mode_type)) &&
4663 if (!wd->mode_item_style) return;
4664 it->mode_set = mode_set;
4668 EINA_LIST_FOREACH(wd->selected, l, it2)
4670 elm_genlist_item_selected_set(it2, EINA_FALSE);
4674 it2 = elm_genlist_selected_item_get(wd->obj);
4675 if ((it2) && (it2->realized))
4676 elm_genlist_item_selected_set(it2, EINA_FALSE);
4679 if (((wd->mode_type) && (strcmp(mode_type, wd->mode_type))) ||
4681 ((it == wd->mode_item) && (!mode_set)))
4682 _item_mode_unset(wd);
4684 eina_stringshare_replace(&wd->mode_type, mode_type);
4685 if (mode_set) _item_mode_set(it);
4690 elm_genlist_mode_item_style_get(const Evas_Object *obj)
4692 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4693 Widget_Data *wd = elm_widget_data_get(obj);
4694 if (!wd) return NULL;
4695 return wd->mode_item_style;
4699 elm_genlist_mode_item_style_set(Evas_Object *obj, const char *style)
4701 ELM_CHECK_WIDTYPE(obj, widtype);
4702 Widget_Data *wd = elm_widget_data_get(obj);
4704 if ((style == wd->mode_item_style) || (style && wd->mode_item_style &&
4705 (!strcmp(style, wd->mode_item_style))))
4707 eina_stringshare_replace(&wd->mode_item_style, style);
4708 elm_genlist_realized_items_update(obj);
4712 elm_genlist_mode_get(const Evas_Object *obj)
4714 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4715 Widget_Data *wd = elm_widget_data_get(obj);
4716 if (!wd) return NULL;
4717 return wd->mode_type;
4720 EAPI const Elm_Gen_Item *
4721 elm_genlist_mode_item_get(const Evas_Object *obj)
4723 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4724 Widget_Data *wd = elm_widget_data_get(obj);
4725 if (!wd) return NULL;
4726 return wd->mode_item;
4730 elm_genlist_reorder_mode_set(Evas_Object *obj,
4731 Eina_Bool reorder_mode)
4733 ELM_CHECK_WIDTYPE(obj, widtype);
4734 Widget_Data *wd = elm_widget_data_get(obj);
4736 wd->reorder_mode = reorder_mode;
4740 elm_genlist_reorder_mode_get(const Evas_Object *obj)
4742 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4743 Widget_Data *wd = elm_widget_data_get(obj);
4744 if (!wd) return EINA_FALSE;
4745 return wd->reorder_mode;