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 typedef struct _Item_Block Item_Block;
14 typedef struct _Item_Cache Item_Cache;
16 struct Elm_Gen_Item_Type
21 Evas_Coord w, h, minw, minh;
22 Elm_Gen_Item *group_item;
23 Elm_Genlist_Item_Flags flags;
24 Eina_List *mode_labels, *mode_icons, *mode_states, *mode_icon_objs;
25 Ecore_Timer *swipe_timer;
26 Evas_Coord scrl_x, scrl_y, old_scrl_y;
29 Evas_Object *mode_view;
35 Eina_Bool want_realize : 1;
36 Eina_Bool expanded : 1;
37 Eina_Bool mincalcd : 1;
40 Eina_Bool updateme : 1;
41 Eina_Bool nocache : 1;
42 Eina_Bool stacking_even : 1;
43 Eina_Bool nostacking : 1;
44 Eina_Bool move_effect_enabled : 1;
49 Eina_Inlist_Sorted_State *state;
50 Evas_Object *obj; /* the genlist object */
51 Evas_Object *scr; /* a smart scroller object which is used internally in genlist */
52 Evas_Object *pan_smart; /* "elm_genlist_pan" evas smart object. this is an extern pan of smart scroller(scr). */
54 Eina_List *group_items; /* list of groups index items */
55 Eina_Inlist *items; /* inlist of all items */
56 Elm_Gen_Item *reorder_it; /* item currently being repositioned */
57 Elm_Gen_Item *last_selected_item;
58 Pan *pan; /* pan_smart object's smart data */
61 Evas_Coord pan_x, pan_y;
62 Eina_Bool reorder_mode : 1;
63 Eina_Bool on_hold : 1;
65 Eina_Bool no_select : 1;
66 Eina_Bool wasselected : 1;
67 Eina_Bool always_select : 1;
68 ////////////////////////////////////
69 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'. */
70 Evas_Coord reorder_old_pan_y, w, h, minw, minh, realminw, prev_viewport_w;
71 Ecore_Job *update_job;
72 Ecore_Idle_Enterer *queue_idle_enterer;
73 Ecore_Idler *must_recalc_idler;
75 Elm_Gen_Item *show_item, *anchor_item, *mode_item, *reorder_rel, *expanded_item;
76 Eina_Inlist *item_cache; /* an inlist of edje object it cache. */
78 Evas_Coord reorder_start_y; /* reorder it's initial y coordinate in the pan. */
80 Ecore_Timer *multi_timer, *scr_hold_timer;
81 Ecore_Animator *reorder_move_animator;
82 const char *mode_type;
83 const char *mode_item_style;
84 unsigned int start_time;
85 Evas_Coord prev_x, prev_y, prev_mx, prev_my;
86 Evas_Coord cur_x, cur_y, cur_mx, cur_my;
87 Eina_Bool mouse_down : 1;
88 Eina_Bool multi_down : 1;
89 Eina_Bool multi_timeout : 1;
90 Eina_Bool multitouched : 1;
91 Eina_Bool longpressed : 1;
92 Eina_Bool bring_in : 1;
93 Eina_Bool compress : 1;
94 Eina_Bool height_for_width : 1;
95 Eina_Bool homogeneous : 1;
96 Eina_Bool clear_me : 1;
98 Eina_Bool reorder_pan_move : 1;
99 Eina_Bool auto_scroll_enabled : 1;
100 Eina_Bool pan_resized : 1;
104 } history[SWIPE_MOVES];
106 int item_cache_count;
107 int item_cache_max; /* maximum number of cached items */
111 int group_item_width;
112 int group_item_height;
113 int max_items_per_block; /* maximum number of items per block */
114 double longpress_timeout; /* longpress timeout. this value comes from _elm_config by default. this can be changed by elm_genlist_longpress_timeout_set() */
125 Evas_Coord x, y, w, h, minw, minh;
126 Eina_Bool want_unrealize : 1;
127 Eina_Bool realized : 1;
128 Eina_Bool changed : 1;
129 Eina_Bool updateme : 1;
130 Eina_Bool showme : 1;
131 Eina_Bool must_recalc : 1;
138 Evas_Object *base_view, *spacer;
140 const char *item_style; // it->itc->item_style
141 Eina_Bool tree : 1; // it->group
142 Eina_Bool compress : 1; // it->wd->compress
144 Eina_Bool selected : 1; // it->selected
145 Eina_Bool disabled : 1; // it->disabled
146 Eina_Bool expanded : 1; // it->item->expanded
149 #define ELM_GENLIST_ITEM_FROM_INLIST(it) \
150 ((it) ? EINA_INLIST_CONTAINER_GET(it, Elm_Gen_Item) : NULL)
152 static const char *widtype = NULL;
153 static void _item_cache_zero(Widget_Data *wd);
154 static void _del_hook(Evas_Object *obj);
155 static void _mirrored_set(Evas_Object *obj,
157 static void _theme_hook(Evas_Object *obj);
158 static void _show_region_hook(void *data,
160 static void _sizing_eval(Evas_Object *obj);
161 static void _item_realize(Elm_Gen_Item *it,
164 static void _item_unrealize_cb(Elm_Gen_Item *it);
165 static void _item_block_unrealize(Item_Block *itb);
166 static void _calc_job(void *data);
167 static void _on_focus_hook(void *data,
169 static Eina_Bool _item_multi_select_up(Widget_Data *wd);
170 static Eina_Bool _item_multi_select_down(Widget_Data *wd);
171 static Eina_Bool _item_single_select_up(Widget_Data *wd);
172 static Eina_Bool _item_single_select_down(Widget_Data *wd);
173 static Eina_Bool _event_hook(Evas_Object *obj,
175 Evas_Callback_Type type,
177 static void _signal_emit_hook(Evas_Object *obj,
178 const char *emission,
180 static Eina_Bool _deselect_all_items(Widget_Data *wd);
181 static void _pan_calculate(Evas_Object *obj);
182 static void _pan_max_get(Evas_Object *obj,
185 static void _item_position(Elm_Gen_Item *it,
189 static void _mode_item_realize(Elm_Gen_Item *it);
190 static void _mode_item_unrealize(Elm_Gen_Item *it);
191 static void _item_mode_set(Elm_Gen_Item *it);
192 static void _item_mode_unset(Widget_Data *wd);
193 static void _group_items_recalc(void *data);
194 static void _item_move_after(Elm_Gen_Item *it,
195 Elm_Gen_Item *after);
196 static void _item_move_before(Elm_Gen_Item *it,
197 Elm_Gen_Item *before);
198 static void _item_auto_scroll(Widget_Data *wd);
200 static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
202 static const char SIG_ACTIVATED[] = "activated";
203 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
204 static const char SIG_SELECTED[] = "selected";
205 static const char SIG_UNSELECTED[] = "unselected";
206 static const char SIG_EXPANDED[] = "expanded";
207 static const char SIG_CONTRACTED[] = "contracted";
208 static const char SIG_EXPAND_REQUEST[] = "expand,request";
209 static const char SIG_CONTRACT_REQUEST[] = "contract,request";
210 static const char SIG_REALIZED[] = "realized";
211 static const char SIG_UNREALIZED[] = "unrealized";
212 static const char SIG_DRAG_START_UP[] = "drag,start,up";
213 static const char SIG_DRAG_START_DOWN[] = "drag,start,down";
214 static const char SIG_DRAG_START_LEFT[] = "drag,start,left";
215 static const char SIG_DRAG_START_RIGHT[] = "drag,start,right";
216 static const char SIG_DRAG_STOP[] = "drag,stop";
217 static const char SIG_DRAG[] = "drag";
218 static const char SIG_LONGPRESSED[] = "longpressed";
219 static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
220 static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
221 static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
222 static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
223 static const char SIG_SCROLL_EDGE_TOP[] = "scroll,edge,top"; // TODO : remove this
224 static const char SIG_SCROLL_EDGE_BOTTOM[] = "scroll,edge,bottom"; // TODO : remove this
225 static const char SIG_SCROLL_EDGE_LEFT[] = "scroll,edge,left"; // TODO : remove this
226 static const char SIG_SCROLL_EDGE_RIGHT[] = "scroll,edge,right"; // TODO : remove this
227 static const char SIG_EDGE_TOP[] = "edge,top";
228 static const char SIG_EDGE_BOTTOM[] = "edge,bottom";
229 static const char SIG_EDGE_LEFT[] = "edge,left";
230 static const char SIG_EDGE_RIGHT[] = "edge,right";
231 static const char SIG_MULTI_SWIPE_LEFT[] = "multi,swipe,left";
232 static const char SIG_MULTI_SWIPE_RIGHT[] = "multi,swipe,right";
233 static const char SIG_MULTI_SWIPE_UP[] = "multi,swipe,up";
234 static const char SIG_MULTI_SWIPE_DOWN[] = "multi,swipe,down";
235 static const char SIG_MULTI_PINCH_OUT[] = "multi,pinch,out";
236 static const char SIG_MULTI_PINCH_IN[] = "multi,pinch,in";
237 static const char SIG_SWIPE[] = "swipe";
238 static const char SIG_MOVED[] = "moved";
240 static const Evas_Smart_Cb_Description _signals[] = {
241 {SIG_CLICKED_DOUBLE, ""},
244 {SIG_UNSELECTED, ""},
246 {SIG_CONTRACTED, ""},
247 {SIG_EXPAND_REQUEST, ""},
248 {SIG_CONTRACT_REQUEST, ""},
250 {SIG_UNREALIZED, ""},
251 {SIG_DRAG_START_UP, ""},
252 {SIG_DRAG_START_DOWN, ""},
253 {SIG_DRAG_START_LEFT, ""},
254 {SIG_DRAG_START_RIGHT, ""},
257 {SIG_LONGPRESSED, ""},
258 {SIG_SCROLL_ANIM_START, ""},
259 {SIG_SCROLL_ANIM_STOP, ""},
260 {SIG_SCROLL_DRAG_START, ""},
261 {SIG_SCROLL_DRAG_STOP, ""},
262 {SIG_SCROLL_EDGE_TOP, ""},
263 {SIG_SCROLL_EDGE_BOTTOM, ""},
264 {SIG_SCROLL_EDGE_LEFT, ""},
265 {SIG_SCROLL_EDGE_RIGHT, ""},
267 {SIG_EDGE_BOTTOM, ""},
269 {SIG_EDGE_RIGHT, ""},
270 {SIG_MULTI_SWIPE_LEFT, ""},
271 {SIG_MULTI_SWIPE_RIGHT, ""},
272 {SIG_MULTI_SWIPE_UP, ""},
273 {SIG_MULTI_SWIPE_DOWN, ""},
274 {SIG_MULTI_PINCH_OUT, ""},
275 {SIG_MULTI_PINCH_IN, ""},
281 static Eina_Compare_Cb _elm_genlist_item_compare_cb;
282 static Eina_Compare_Cb _elm_genlist_item_compare_data_cb;
285 _event_hook(Evas_Object *obj,
286 Evas_Object *src __UNUSED__,
287 Evas_Callback_Type type,
290 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
291 Evas_Event_Key_Down *ev = event_info;
292 Widget_Data *wd = elm_widget_data_get(obj);
293 Evas_Coord pan_max_x = 0, pan_max_y = 0;
294 if (!wd) return EINA_FALSE;
295 if (!wd->items) return EINA_FALSE;
296 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
297 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
299 Elm_Gen_Item *it = NULL;
302 Evas_Coord step_x = 0;
303 Evas_Coord step_y = 0;
306 Evas_Coord page_x = 0;
307 Evas_Coord page_y = 0;
309 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
310 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
311 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
312 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
314 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
318 else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")))
322 else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
324 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
325 (_item_multi_select_up(wd)))
326 || (_item_single_select_up(wd)))
328 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
334 else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
336 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
337 (_item_multi_select_down(wd)))
338 || (_item_single_select_down(wd)))
340 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
346 else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
348 it = elm_genlist_first_item_get(obj);
349 elm_genlist_item_bring_in(it);
350 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
353 else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
355 it = elm_genlist_last_item_get(obj);
356 elm_genlist_item_bring_in(it);
357 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
360 else if ((!strcmp(ev->keyname, "Prior")) || (!strcmp(ev->keyname, "KP_Prior")))
363 y -= -(page_y * v_h) / 100;
367 else if ((!strcmp(ev->keyname, "Next")) || (!strcmp(ev->keyname, "KP_Next")))
370 y += -(page_y * v_h) / 100;
374 else if (!strcmp(ev->keyname, "Escape"))
376 if (!_deselect_all_items(wd)) return EINA_FALSE;
377 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
380 else if (((!strcmp(ev->keyname, "Return")) ||
381 (!strcmp(ev->keyname, "KP_Enter")) ||
382 (!strcmp(ev->keyname, "space")))
383 && (!wd->multi) && (wd->selected))
385 it = elm_genlist_selected_item_get(obj);
386 elm_genlist_item_expanded_set(it,
387 !elm_genlist_item_expanded_get(it));
388 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
390 else return EINA_FALSE;
392 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
393 _pan_max_get(wd->pan_smart, &pan_max_x, &pan_max_y);
395 if (x > pan_max_x) x = pan_max_x;
397 if (y > pan_max_y) y = pan_max_y;
398 elm_smart_scroller_child_pos_set(wd->scr, x, y);
403 _deselect_all_items(Widget_Data *wd)
405 if (!wd->selected) return EINA_FALSE;
407 elm_genlist_item_selected_set(wd->selected->data, EINA_FALSE);
413 _item_multi_select_up(Widget_Data *wd)
415 if (!wd->selected) return EINA_FALSE;
416 if (!wd->multi) return EINA_FALSE;
418 Elm_Gen_Item *prev = elm_genlist_item_prev_get(wd->last_selected_item);
419 if (!prev) return EINA_TRUE;
421 if (elm_genlist_item_selected_get(prev))
423 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
424 wd->last_selected_item = prev;
425 elm_genlist_item_show(wd->last_selected_item);
429 elm_genlist_item_selected_set(prev, EINA_TRUE);
430 elm_genlist_item_show(prev);
436 _item_multi_select_down(Widget_Data *wd)
438 if (!wd->selected) return EINA_FALSE;
439 if (!wd->multi) return EINA_FALSE;
441 Elm_Gen_Item *next = elm_genlist_item_next_get(wd->last_selected_item);
442 if (!next) return EINA_TRUE;
444 if (elm_genlist_item_selected_get(next))
446 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
447 wd->last_selected_item = next;
448 elm_genlist_item_show(wd->last_selected_item);
452 elm_genlist_item_selected_set(next, EINA_TRUE);
453 elm_genlist_item_show(next);
459 _item_single_select_up(Widget_Data *wd)
464 prev = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
465 while ((prev) && (prev->delete_me))
466 prev = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
468 else prev = elm_genlist_item_prev_get(wd->last_selected_item);
470 if (!prev) return EINA_FALSE;
472 _deselect_all_items(wd);
474 elm_genlist_item_selected_set(prev, EINA_TRUE);
475 elm_genlist_item_show(prev);
480 _item_single_select_down(Widget_Data *wd)
485 next = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
486 while ((next) && (next->delete_me))
487 next = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
489 else next = elm_genlist_item_next_get(wd->last_selected_item);
491 if (!next) return EINA_FALSE;
493 _deselect_all_items(wd);
495 elm_genlist_item_selected_set(next, EINA_TRUE);
496 elm_genlist_item_show(next);
501 _on_focus_hook(void *data __UNUSED__,
504 Widget_Data *wd = elm_widget_data_get(obj);
506 if (elm_widget_focus_get(obj))
508 elm_object_signal_emit(wd->obj, "elm,action,focus", "elm");
509 evas_object_focus_set(wd->obj, EINA_TRUE);
510 if ((wd->selected) && (!wd->last_selected_item))
511 wd->last_selected_item = eina_list_data_get(wd->selected);
515 elm_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
516 evas_object_focus_set(wd->obj, EINA_FALSE);
521 _del_hook(Evas_Object *obj)
523 Widget_Data *wd = elm_widget_data_get(obj);
525 _item_cache_zero(wd);
526 if (wd->calc_job) ecore_job_del(wd->calc_job);
527 if (wd->update_job) ecore_job_del(wd->update_job);
528 if (wd->queue_idle_enterer) ecore_idle_enterer_del(wd->queue_idle_enterer);
529 if (wd->must_recalc_idler) ecore_idler_del(wd->must_recalc_idler);
530 if (wd->multi_timer) ecore_timer_del(wd->multi_timer);
531 if (wd->mode_type) eina_stringshare_del(wd->mode_type);
532 if (wd->scr_hold_timer) ecore_timer_del(wd->scr_hold_timer);
537 _del_pre_hook(Evas_Object *obj)
539 Widget_Data *wd = elm_widget_data_get(obj);
541 elm_genlist_clear(obj);
542 evas_object_del(wd->pan_smart);
543 wd->pan_smart = NULL;
547 _mirrored_set(Evas_Object *obj,
550 Widget_Data *wd = elm_widget_data_get(obj);
552 _item_cache_zero(wd);
553 elm_smart_scroller_mirrored_set(wd->scr, rtl);
557 _theme_hook(Evas_Object *obj)
559 Widget_Data *wd = elm_widget_data_get(obj);
562 evas_event_freeze(evas_object_evas_get(wd->obj));
563 _item_cache_zero(wd);
564 _elm_widget_mirrored_reload(obj);
565 _mirrored_set(obj, elm_widget_mirrored_get(obj));
566 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
567 elm_widget_style_get(obj));
568 edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
569 wd->item_width = wd->item_height = 0;
570 wd->group_item_width = wd->group_item_height = 0;
571 wd->minw = wd->minh = wd->realminw = 0;
572 EINA_INLIST_FOREACH(wd->blocks, itb)
577 if (itb->realized) _item_block_unrealize(itb);
578 EINA_LIST_FOREACH(itb->items, l, it)
579 it->item->mincalcd = EINA_FALSE;
581 itb->changed = EINA_TRUE;
583 if (wd->calc_job) ecore_job_del(wd->calc_job);
584 wd->calc_job = ecore_job_add(_calc_job, wd);
586 evas_event_thaw(evas_object_evas_get(wd->obj));
587 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
591 _show_region_hook(void *data,
594 Widget_Data *wd = elm_widget_data_get(data);
595 Evas_Coord x, y, w, h;
597 elm_widget_show_region_get(obj, &x, &y, &w, &h);
598 //x & y are screen coordinates, Add with pan coordinates
601 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
605 _translate_hook(Evas_Object *obj)
607 evas_object_smart_callback_call(obj, "language,changed", NULL);
611 _sizing_eval(Evas_Object *obj)
613 Widget_Data *wd = elm_widget_data_get(obj);
614 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
616 evas_object_size_hint_min_get(wd->scr, &minw, &minh);
617 evas_object_size_hint_max_get(wd->scr, &maxw, &maxh);
619 if (wd->height_for_width)
623 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
624 if ((vw != 0) && (vw != wd->prev_viewport_w))
628 wd->prev_viewport_w = vw;
629 EINA_INLIST_FOREACH(wd->blocks, itb)
631 itb->must_recalc = EINA_TRUE;
633 if (wd->calc_job) ecore_job_del(wd->calc_job);
634 wd->calc_job = ecore_job_add(_calc_job, wd);
637 if (wd->mode == ELM_LIST_LIMIT)
639 Evas_Coord vmw, vmh, vw, vh;
643 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
644 if ((minw > 0) && (vw < minw)) vw = minw;
645 else if ((maxw > 0) && (vw > maxw))
647 edje_object_size_min_calc
648 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
655 edje_object_size_min_calc
656 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
660 evas_object_size_hint_min_set(obj, minw, minh);
661 evas_object_size_hint_max_set(obj, maxw, maxh);
665 _signal_emit_hook(Evas_Object *obj,
666 const char *emission,
669 Widget_Data *wd = elm_widget_data_get(obj);
670 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
675 _item_highlight(Elm_Gen_Item *it)
677 const char *selectraise;
678 if ((it->wd->no_select) || (it->delete_me) || (it->highlighted) ||
679 (it->disabled) || (it->display_only) || (it->item->mode_view))
681 edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
682 selectraise = edje_object_data_get(VIEW(it), "selectraise");
683 if ((selectraise) && (!strcmp(selectraise, "on")))
685 evas_object_raise(VIEW(it));
686 if ((it->item->group_item) && (it->item->group_item->realized))
687 evas_object_raise(it->item->VIEW(group_item));
689 it->highlighted = EINA_TRUE;
693 _item_unhighlight(Elm_Gen_Item *it)
695 const char *stacking, *selectraise;
696 if ((it->delete_me) || (!it->highlighted)) return;
697 edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm");
698 stacking = edje_object_data_get(VIEW(it), "stacking");
699 selectraise = edje_object_data_get(VIEW(it), "selectraise");
700 if (!it->item->nostacking)
702 if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even) evas_object_lower(VIEW(it));
703 else evas_object_raise(VIEW(it));
705 it->highlighted = EINA_FALSE;
709 _item_block_del(Elm_Gen_Item *it)
712 Item_Block *itb = it->item->block;
714 itb->items = eina_list_remove(itb->items, it);
716 itb->changed = EINA_TRUE;
717 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
718 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
721 il = EINA_INLIST_GET(itb);
722 Item_Block *itbn = (Item_Block *)(il->next);
724 it->parent->item->items = eina_list_remove(it->parent->item->items, it);
726 it->wd->blocks = eina_inlist_remove(it->wd->blocks, il);
728 if (itbn) itbn->changed = EINA_TRUE;
732 if (itb->count < itb->wd->max_items_per_block/2)
734 il = EINA_INLIST_GET(itb);
735 Item_Block *itbp = (Item_Block *)(il->prev);
736 Item_Block *itbn = (Item_Block *)(il->next);
737 if ((itbp) && ((itbp->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
741 EINA_LIST_FREE(itb->items, it2)
743 it2->item->block = itbp;
744 itbp->items = eina_list_append(itbp->items, it2);
746 itbp->changed = EINA_TRUE;
748 it->wd->blocks = eina_inlist_remove(it->wd->blocks,
749 EINA_INLIST_GET(itb));
752 else if ((itbn) && ((itbn->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
756 Eina_List *last = eina_list_last(itb->items);
757 Elm_Gen_Item *it2 = last->data;
759 it2->item->block = itbn;
760 itb->items = eina_list_remove_list(itb->items, last);
761 itbn->items = eina_list_prepend(itbn->items, it2);
763 itbn->changed = EINA_TRUE;
766 eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb));
774 _item_del(Elm_Gen_Item *it)
776 Evas_Object *obj = WIDGET(it);
778 evas_event_freeze(evas_object_evas_get(obj));
779 elm_genlist_item_subitems_clear(it);
780 if (it->wd->show_item == it) it->wd->show_item = NULL;
781 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
782 if (it->item->block) _item_block_del(it);
783 if (it->item->queued)
784 it->wd->queue = eina_list_remove(it->wd->queue, it);
785 if (it->wd->anchor_item == it)
787 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
788 if (!it->wd->anchor_item)
789 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
792 it->parent->item->items = eina_list_remove(it->parent->item->items, it);
793 if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
794 elm_gen_item_del_serious(it, (Ecore_Cb)_calc_job);
795 evas_event_thaw(evas_object_evas_get(obj));
796 evas_event_thaw_eval(evas_object_evas_get(obj));
800 _item_select(Elm_Gen_Item *it)
802 Evas_Object *parent = WIDGET(it);
804 if ((it->wd->no_select) || (it->delete_me) || (it->item->mode_view)) return;
807 if (it->wd->always_select) goto call;
810 it->selected = EINA_TRUE;
811 it->wd->selected = eina_list_append(it->wd->selected, it);
813 evas_object_ref(parent);
816 if (it->func.func) it->func.func((void *)it->func.data, WIDGET(it), it);
818 evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, it);
821 if ((it->wd->clear_me) && (!it->wd->walking))
823 elm_genlist_clear(WIDGET(it));
828 if ((!it->walking) && (it->delete_me))
830 if (!it->relcount) _item_del(it);
834 it->wd->last_selected_item = it;
837 evas_object_unref(parent);
841 _item_unselect(Elm_Gen_Item *it)
843 if ((it->delete_me) || (!it->selected)) return;
844 it->selected = EINA_FALSE;
845 it->wd->selected = eina_list_remove(it->wd->selected, it);
846 evas_object_smart_callback_call(WIDGET(it), SIG_UNSELECTED, it);
850 _mouse_move(void *data,
851 Evas *evas __UNUSED__,
855 Elm_Gen_Item *it = data;
856 Evas_Event_Mouse_Move *ev = event_info;
857 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
858 Evas_Coord ox, oy, ow, oh, it_scrl_y, y_pos;
860 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
862 if (!it->wd->on_hold)
864 it->wd->on_hold = EINA_TRUE;
865 if (!it->wd->wasselected)
867 _item_unhighlight(it);
872 if (it->wd->multitouched)
874 it->wd->cur_x = ev->cur.canvas.x;
875 it->wd->cur_y = ev->cur.canvas.y;
878 if ((it->dragging) && (it->down))
880 if (it->wd->movements == SWIPE_MOVES) it->wd->swipe = EINA_TRUE;
883 it->wd->history[it->wd->movements].x = ev->cur.canvas.x;
884 it->wd->history[it->wd->movements].y = ev->cur.canvas.y;
885 if (abs((it->wd->history[it->wd->movements].x -
886 it->wd->history[0].x)) > 40)
887 it->wd->swipe = EINA_TRUE;
893 ecore_timer_del(it->long_timer);
894 it->long_timer = NULL;
896 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG, it);
899 if ((!it->down) /* || (it->wd->on_hold)*/ || (it->wd->longpressed))
903 ecore_timer_del(it->long_timer);
904 it->long_timer = NULL;
906 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
908 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
909 it_scrl_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
911 if (!it->wd->reorder_start_y)
912 it->wd->reorder_start_y = it->item->block->y + it->y;
916 else if (it_scrl_y + it->wd->reorder_it->item->h > oy + oh)
917 y_pos = oy + oh - it->wd->reorder_it->item->h;
921 _item_position(it, VIEW(it), it->item->scrl_x, y_pos);
923 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
924 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
928 if (!it->display_only)
929 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
930 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
931 x = ev->cur.canvas.x - x;
932 y = ev->cur.canvas.y - y;
935 if (adx < 0) adx = -dx;
938 if (ady < 0) ady = -dy;
941 if ((adx > minw) || (ady > minh))
943 it->dragging = EINA_TRUE;
946 ecore_timer_del(it->long_timer);
947 it->long_timer = NULL;
949 if (!it->wd->wasselected)
951 _item_unhighlight(it);
957 evas_object_smart_callback_call(WIDGET(it),
958 SIG_DRAG_START_UP, it);
962 evas_object_smart_callback_call(WIDGET(it),
963 SIG_DRAG_START_LEFT, it);
965 evas_object_smart_callback_call(WIDGET(it),
966 SIG_DRAG_START_RIGHT, it);
972 evas_object_smart_callback_call(WIDGET(it),
973 SIG_DRAG_START_DOWN, it);
977 evas_object_smart_callback_call(WIDGET(it),
978 SIG_DRAG_START_LEFT, it);
980 evas_object_smart_callback_call(WIDGET(it),
981 SIG_DRAG_START_RIGHT, it);
988 _long_press(void *data)
990 Elm_Gen_Item *it = data, *it_tmp;
993 it->long_timer = NULL;
994 if ((it->disabled) || (it->dragging) || (it->display_only))
995 return ECORE_CALLBACK_CANCEL;
996 it->wd->longpressed = EINA_TRUE;
997 evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it);
998 if ((it->wd->reorder_mode) && (it->item->flags != ELM_GENLIST_ITEM_GROUP))
1000 it->wd->reorder_it = it;
1001 it->wd->reorder_start_y = 0;
1003 evas_object_raise(VIEW(it));
1004 elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
1005 elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_FALSE);
1007 list = elm_genlist_realized_items_get(it->wd->obj);
1008 EINA_LIST_FOREACH(list, l, it_tmp)
1010 if (it != it_tmp) _item_unselect(it_tmp);
1012 if (elm_genlist_item_expanded_get(it))
1014 elm_genlist_item_expanded_set(it, EINA_FALSE);
1015 return ECORE_CALLBACK_RENEW;
1017 edje_object_signal_emit(VIEW(it), "elm,state,reorder,enabled", "elm");
1019 return ECORE_CALLBACK_CANCEL;
1023 _swipe(Elm_Gen_Item *it)
1028 if ((it->display_only) || (it->disabled)) return;
1029 it->wd->swipe = EINA_FALSE;
1030 for (i = 0; i < it->wd->movements; i++)
1032 sum += it->wd->history[i].x;
1033 if (abs(it->wd->history[0].y - it->wd->history[i].y) > 10) return;
1036 sum /= it->wd->movements;
1037 if (abs(sum - it->wd->history[0].x) <= 10) return;
1038 evas_object_smart_callback_call(WIDGET(it), SIG_SWIPE, it);
1042 _swipe_cancel(void *data)
1044 Elm_Gen_Item *it = data;
1046 if (!it) return ECORE_CALLBACK_CANCEL;
1047 it->wd->swipe = EINA_FALSE;
1048 it->wd->movements = 0;
1049 return ECORE_CALLBACK_RENEW;
1053 _multi_cancel(void *data)
1055 Widget_Data *wd = data;
1057 if (!wd) return ECORE_CALLBACK_CANCEL;
1058 wd->multi_timeout = EINA_TRUE;
1059 return ECORE_CALLBACK_RENEW;
1063 _multi_touch_gesture_eval(void *data)
1065 Elm_Gen_Item *it = data;
1067 it->wd->multitouched = EINA_FALSE;
1068 if (it->wd->multi_timer)
1070 ecore_timer_del(it->wd->multi_timer);
1071 it->wd->multi_timer = NULL;
1073 if (it->wd->multi_timeout)
1075 it->wd->multi_timeout = EINA_FALSE;
1079 Evas_Coord minw = 0, minh = 0;
1080 Evas_Coord off_x, off_y, off_mx, off_my;
1082 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1083 off_x = abs(it->wd->cur_x - it->wd->prev_x);
1084 off_y = abs(it->wd->cur_y - it->wd->prev_y);
1085 off_mx = abs(it->wd->cur_mx - it->wd->prev_mx);
1086 off_my = abs(it->wd->cur_my - it->wd->prev_my);
1088 if (((off_x > minw) || (off_y > minh)) && ((off_mx > minw) || (off_my > minh)))
1090 if ((off_x + off_mx) > (off_y + off_my))
1092 if ((it->wd->cur_x > it->wd->prev_x) && (it->wd->cur_mx > it->wd->prev_mx))
1093 evas_object_smart_callback_call(WIDGET(it),
1094 SIG_MULTI_SWIPE_RIGHT, it);
1095 else 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_LEFT, it);
1098 else if (abs(it->wd->cur_x - it->wd->cur_mx) > abs(it->wd->prev_x - it->wd->prev_mx))
1099 evas_object_smart_callback_call(WIDGET(it),
1100 SIG_MULTI_PINCH_OUT, it);
1102 evas_object_smart_callback_call(WIDGET(it),
1103 SIG_MULTI_PINCH_IN, it);
1107 if ((it->wd->cur_y > it->wd->prev_y) && (it->wd->cur_my > it->wd->prev_my))
1108 evas_object_smart_callback_call(WIDGET(it),
1109 SIG_MULTI_SWIPE_DOWN, it);
1110 else 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_UP, it);
1113 else if (abs(it->wd->cur_y - it->wd->cur_my) > abs(it->wd->prev_y - it->wd->prev_my))
1114 evas_object_smart_callback_call(WIDGET(it),
1115 SIG_MULTI_PINCH_OUT, it);
1117 evas_object_smart_callback_call(WIDGET(it),
1118 SIG_MULTI_PINCH_IN, it);
1121 it->wd->multi_timeout = EINA_FALSE;
1125 _multi_down(void *data,
1126 Evas *evas __UNUSED__,
1127 Evas_Object *obj __UNUSED__,
1130 Elm_Gen_Item *it = data;
1131 Evas_Event_Multi_Down *ev = event_info;
1133 if ((it->wd->multi_device != 0) || (it->wd->multitouched) || (it->wd->multi_timeout)) return;
1134 it->wd->multi_device = ev->device;
1135 it->wd->multi_down = EINA_TRUE;
1136 it->wd->multitouched = EINA_TRUE;
1137 it->wd->prev_mx = ev->canvas.x;
1138 it->wd->prev_my = ev->canvas.y;
1139 if (!it->wd->wasselected)
1141 _item_unhighlight(it);
1144 it->wd->wasselected = EINA_FALSE;
1145 it->wd->longpressed = EINA_FALSE;
1148 ecore_timer_del(it->long_timer);
1149 it->long_timer = NULL;
1153 it->dragging = EINA_FALSE;
1154 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
1156 if (it->item->swipe_timer)
1158 ecore_timer_del(it->item->swipe_timer);
1159 it->item->swipe_timer = NULL;
1161 if (it->wd->on_hold)
1163 it->wd->swipe = EINA_FALSE;
1164 it->wd->movements = 0;
1165 it->wd->on_hold = EINA_FALSE;
1170 _multi_up(void *data,
1171 Evas *evas __UNUSED__,
1172 Evas_Object *obj __UNUSED__,
1175 Elm_Gen_Item *it = data;
1176 Evas_Event_Multi_Up *ev = event_info;
1178 if (it->wd->multi_device != ev->device) return;
1179 it->wd->multi_device = 0;
1180 it->wd->multi_down = EINA_FALSE;
1181 if (it->wd->mouse_down) return;
1182 _multi_touch_gesture_eval(data);
1186 _multi_move(void *data,
1187 Evas *evas __UNUSED__,
1188 Evas_Object *obj __UNUSED__,
1191 Elm_Gen_Item *it = data;
1192 Evas_Event_Multi_Move *ev = event_info;
1194 if (it->wd->multi_device != ev->device) return;
1195 it->wd->cur_mx = ev->cur.canvas.x;
1196 it->wd->cur_my = ev->cur.canvas.y;
1200 _mouse_down(void *data,
1201 Evas *evas __UNUSED__,
1205 Elm_Gen_Item *it = data;
1206 Evas_Event_Mouse_Down *ev = event_info;
1209 if (ev->button != 1) return;
1210 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1212 it->wd->on_hold = EINA_TRUE;
1215 it->down = EINA_TRUE;
1216 it->dragging = EINA_FALSE;
1217 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1218 it->dx = ev->canvas.x - x;
1219 it->dy = ev->canvas.y - y;
1220 it->wd->mouse_down = EINA_TRUE;
1221 if (!it->wd->multitouched)
1223 it->wd->prev_x = ev->canvas.x;
1224 it->wd->prev_y = ev->canvas.y;
1225 it->wd->multi_timeout = EINA_FALSE;
1226 if (it->wd->multi_timer) ecore_timer_del(it->wd->multi_timer);
1227 it->wd->multi_timer = ecore_timer_add(1, _multi_cancel, it->wd);
1229 it->wd->longpressed = EINA_FALSE;
1230 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1231 else it->wd->on_hold = EINA_FALSE;
1232 if (it->wd->on_hold) return;
1233 it->wd->wasselected = it->selected;
1234 _item_highlight(it);
1235 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
1236 if ((!it->disabled) && (!it->display_only))
1238 evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
1239 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
1241 if (it->long_timer) ecore_timer_del(it->long_timer);
1242 if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
1243 it->item->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
1245 it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press,
1248 it->long_timer = NULL;
1249 it->wd->swipe = EINA_FALSE;
1250 it->wd->movements = 0;
1254 _mouse_up(void *data,
1255 Evas *evas __UNUSED__,
1256 Evas_Object *obj __UNUSED__,
1259 Elm_Gen_Item *it = data;
1260 Evas_Event_Mouse_Up *ev = event_info;
1261 Eina_Bool dragged = EINA_FALSE;
1263 if (ev->button != 1) return;
1264 it->down = EINA_FALSE;
1265 it->wd->mouse_down = EINA_FALSE;
1266 if (it->wd->multitouched)
1268 if ((!it->wd->multi) && (!it->selected) && (it->highlighted)) _item_unhighlight(it);
1269 if (it->wd->multi_down) return;
1270 _multi_touch_gesture_eval(data);
1273 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1274 else it->wd->on_hold = EINA_FALSE;
1277 ecore_timer_del(it->long_timer);
1278 it->long_timer = NULL;
1282 it->dragging = EINA_FALSE;
1283 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
1286 if (it->item->swipe_timer)
1288 ecore_timer_del(it->item->swipe_timer);
1289 it->item->swipe_timer = NULL;
1291 if (it->wd->multi_timer)
1293 ecore_timer_del(it->wd->multi_timer);
1294 it->wd->multi_timer = NULL;
1295 it->wd->multi_timeout = EINA_FALSE;
1297 if (it->wd->on_hold)
1299 if (it->wd->swipe) _swipe(data);
1300 it->wd->longpressed = EINA_FALSE;
1301 it->wd->on_hold = EINA_FALSE;
1304 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
1306 Evas_Coord it_scrl_y = ev->canvas.y - it->wd->reorder_it->dy;
1308 if (it->wd->reorder_rel && (it->wd->reorder_it->parent == it->wd->reorder_rel->parent))
1310 if (it_scrl_y <= it->wd->reorder_rel->item->scrl_y)
1311 _item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
1313 _item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
1317 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1318 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1320 edje_object_signal_emit(VIEW(it), "elm,state,reorder,disabled", "elm");
1321 it->wd->reorder_it = it->wd->reorder_rel = NULL;
1322 elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
1323 elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_TRUE);
1325 if (it->wd->longpressed)
1327 it->wd->longpressed = EINA_FALSE;
1328 if (!it->wd->wasselected)
1330 _item_unhighlight(it);
1333 it->wd->wasselected = EINA_FALSE;
1338 if (it->want_unrealize)
1340 elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
1341 if (it->item->block->want_unrealize)
1342 _item_block_unrealize(it->item->block);
1345 if ((it->disabled) || (dragged) || (it->display_only)) return;
1346 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1351 _item_highlight(it);
1356 _item_unhighlight(it);
1364 Widget_Data *wd = it->wd;
1367 while (wd->selected)
1369 _item_unhighlight(wd->selected->data);
1370 _item_unselect(wd->selected->data);
1376 const Eina_List *l, *l_next;
1379 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
1382 _item_unhighlight(it2);
1383 _item_unselect(it2);
1385 //_item_highlight(it);
1388 _item_highlight(it);
1394 _signal_expand_toggle(void *data,
1395 Evas_Object *obj __UNUSED__,
1396 const char *emission __UNUSED__,
1397 const char *source __UNUSED__)
1399 Elm_Gen_Item *it = data;
1401 if (it->item->expanded)
1402 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it);
1404 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it);
1408 _signal_expand(void *data,
1409 Evas_Object *obj __UNUSED__,
1410 const char *emission __UNUSED__,
1411 const char *source __UNUSED__)
1413 Elm_Gen_Item *it = data;
1415 if (!it->item->expanded)
1416 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it);
1420 _signal_contract(void *data,
1421 Evas_Object *obj __UNUSED__,
1422 const char *emission __UNUSED__,
1423 const char *source __UNUSED__)
1425 Elm_Gen_Item *it = data;
1427 if (it->item->expanded)
1428 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it);
1432 _scr_hold_timer_cb(void *data)
1434 if (!data) return ECORE_CALLBACK_CANCEL;
1435 Widget_Data *wd = data;
1436 elm_smart_scroller_hold_set(wd->scr, EINA_FALSE);
1437 wd->scr_hold_timer = NULL;
1438 return ECORE_CALLBACK_CANCEL;
1442 _mode_finished_signal_cb(void *data,
1444 const char *emission __UNUSED__,
1445 const char *source __UNUSED__)
1449 Elm_Gen_Item *it = data;
1450 if ((it->delete_me) || (!it->realized) || (!it->item->mode_view)) return;
1452 Evas *te = evas_object_evas_get(obj);
1454 evas_event_freeze(te);
1455 it->item->nocache = EINA_FALSE;
1456 _mode_item_unrealize(it);
1457 if (it->item->group_item)
1458 evas_object_raise(it->item->VIEW(group_item));
1459 snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished", it->wd->mode_type);
1460 edje_object_signal_callback_del_full(obj, buf, "elm", _mode_finished_signal_cb, it);
1461 evas_event_thaw(te);
1462 evas_event_thaw_eval(te);
1466 _item_cache_clean(Widget_Data *wd)
1468 evas_event_freeze(evas_object_evas_get(wd->obj));
1469 while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max))
1473 itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache);
1474 wd->item_cache = eina_inlist_remove(wd->item_cache,
1475 wd->item_cache->last);
1476 wd->item_cache_count--;
1477 if (itc->spacer) evas_object_del(itc->spacer);
1478 if (itc->base_view) evas_object_del(itc->base_view);
1479 if (itc->item_style) eina_stringshare_del(itc->item_style);
1482 evas_event_thaw(evas_object_evas_get(wd->obj));
1483 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
1487 _item_cache_zero(Widget_Data *wd)
1489 int pmax = wd->item_cache_max;
1490 wd->item_cache_max = 0;
1491 _item_cache_clean(wd);
1492 wd->item_cache_max = pmax;
1496 _item_cache_add(Elm_Gen_Item *it)
1500 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1501 if (it->wd->item_cache_max <= 0)
1503 evas_object_del(VIEW(it));
1505 evas_object_del(it->spacer);
1507 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1508 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1512 it->wd->item_cache_count++;
1513 itc = calloc(1, sizeof(Item_Cache));
1514 it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache,
1515 EINA_INLIST_GET(itc));
1516 itc->spacer = it->spacer;
1518 itc->base_view = VIEW(it);
1520 evas_object_hide(itc->base_view);
1521 evas_object_move(itc->base_view, -9999, -9999);
1522 itc->item_style = eina_stringshare_add(it->itc->item_style);
1523 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
1524 itc->compress = (it->wd->compress);
1525 itc->selected = it->selected;
1526 itc->disabled = it->disabled;
1527 itc->expanded = it->item->expanded;
1530 ecore_timer_del(it->long_timer);
1531 it->long_timer = NULL;
1533 if (it->item->swipe_timer)
1535 ecore_timer_del(it->item->swipe_timer);
1536 it->item->swipe_timer = NULL;
1538 // FIXME: other callbacks?
1539 edje_object_signal_callback_del_full(itc->base_view,
1540 "elm,action,expand,toggle",
1541 "elm", _signal_expand_toggle, it);
1542 edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand",
1544 _signal_expand, it);
1545 edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract",
1546 "elm", _signal_contract, it);
1547 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_DOWN,
1549 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP,
1551 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_MOVE,
1553 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_DOWN,
1555 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_UP,
1557 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_MOVE,
1559 _item_cache_clean(it->wd);
1560 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1561 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1565 _item_cache_find(Elm_Gen_Item *it)
1570 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
1571 EINA_INLIST_FOREACH(it->wd->item_cache, itc)
1573 if ((itc->selected) || (itc->disabled) || (itc->expanded))
1575 if ((itc->tree == tree) &&
1576 (itc->compress == it->wd->compress) &&
1577 (!strcmp(it->itc->item_style, itc->item_style)))
1579 it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
1580 EINA_INLIST_GET(itc));
1581 it->wd->item_cache_count--;
1589 _elm_genlist_item_odd_even_update(Elm_Gen_Item *it)
1591 if (!it->item->nostacking)
1593 if ((it->item->order_num_in & 0x1) ^ it->item->stacking_even)
1594 evas_object_lower(VIEW(it));
1596 evas_object_raise(VIEW(it));
1599 if (it->item->order_num_in & 0x1)
1600 edje_object_signal_emit(VIEW(it), "elm,state,odd", "elm");
1602 edje_object_signal_emit(VIEW(it), "elm,state,even", "elm");
1606 _elm_genlist_item_state_update(Elm_Gen_Item *it, Item_Cache *itc)
1610 if (it->selected != itc->selected)
1613 edje_object_signal_emit(VIEW(it),
1614 "elm,state,selected", "elm");
1616 if (it->disabled != itc->disabled)
1619 edje_object_signal_emit(VIEW(it),
1620 "elm,state,disabled", "elm");
1622 if (it->item->expanded != itc->expanded)
1624 if (it->item->expanded)
1625 edje_object_signal_emit(VIEW(it),
1626 "elm,state,expanded", "elm");
1632 edje_object_signal_emit(VIEW(it),
1633 "elm,state,selected", "elm");
1635 edje_object_signal_emit(VIEW(it),
1636 "elm,state,disabled", "elm");
1637 if (it->item->expanded)
1638 edje_object_signal_emit(VIEW(it),
1639 "elm,state,expanded", "elm");
1644 _item_cache_free(Item_Cache *itc)
1646 if (itc->spacer) evas_object_del(itc->spacer);
1647 if (itc->base_view) evas_object_del(itc->base_view);
1648 if (itc->item_style) eina_stringshare_del(itc->item_style);
1653 _item_del_hook(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1655 Elm_Gen_Item *it = event_info;
1657 if (it->wd->last_selected_item == it)
1658 it->wd->last_selected_item = NULL;
1662 _item_label_realize(Elm_Gen_Item *it,
1663 Evas_Object *target,
1666 if (it->itc->func.label_get)
1671 *source = elm_widget_stringlist_get(edje_object_data_get(target, "labels"));
1672 EINA_LIST_FOREACH(*source, l, key)
1674 char *s = it->itc->func.label_get
1675 ((void *)it->base.data, WIDGET(it), key);
1679 edje_object_part_text_set(target, key, s);
1684 edje_object_part_text_set(target, key, "");
1691 _item_icon_realize(Elm_Gen_Item *it,
1692 Evas_Object *target,
1695 Eina_List *res = NULL;
1697 if (it->itc->func.icon_get)
1702 *source = elm_widget_stringlist_get(edje_object_data_get(target, "icons"));
1703 EINA_LIST_FOREACH(*source, l, key)
1705 Evas_Object *ic = it->itc->func.icon_get
1706 ((void *)it->base.data, WIDGET(it), key);
1710 res = eina_list_append(res, ic);
1711 edje_object_part_swallow(target, key, ic);
1712 evas_object_show(ic);
1713 elm_widget_sub_object_add(WIDGET(it), ic);
1715 elm_widget_disabled_set(ic, EINA_TRUE);
1724 _item_state_realize(Elm_Gen_Item *it,
1725 Evas_Object *target,
1728 if (it->itc->func.state_get)
1734 *source = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
1735 EINA_LIST_FOREACH(*source, l, key)
1737 Eina_Bool on = it->itc->func.state_get
1738 ((void *)it->base.data, WIDGET(it), key);
1742 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
1743 edje_object_signal_emit(target, buf, "elm");
1747 snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
1748 edje_object_signal_emit(target, buf, "elm");
1755 _item_realize(Elm_Gen_Item *it,
1760 const char *treesize;
1762 int depth, tsize = 20;
1763 Item_Cache *itc = NULL;
1765 if (it->delete_me) return;
1766 //evas_event_freeze(evas_object_evas_get(it->wd->obj));
1769 if (it->item->order_num_in != in)
1771 it->item->order_num_in = in;
1772 _elm_genlist_item_odd_even_update(it);
1773 _elm_genlist_item_state_update(it, NULL);
1775 //evas_event_thaw(evas_object_evas_get(it->wd->obj));
1776 //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1779 it->item->order_num_in = in;
1781 if (it->item->nocache)
1782 it->item->nocache = EINA_FALSE;
1784 itc = _item_cache_find(it);
1787 VIEW(it) = itc->base_view;
1788 itc->base_view = NULL;
1789 it->spacer = itc->spacer;
1794 const char *stacking_even;
1795 const char *stacking;
1797 VIEW(it) = edje_object_add(evas_object_evas_get(WIDGET(it)));
1798 edje_object_scale_set(VIEW(it),
1799 elm_widget_scale_get(WIDGET(it)) *
1800 _elm_config->scale);
1801 evas_object_smart_member_add(VIEW(it), it->wd->pan_smart);
1802 elm_widget_sub_object_add(WIDGET(it), VIEW(it));
1804 if (it->item->flags & ELM_GENLIST_ITEM_SUBITEMS)
1805 strncpy(buf, "tree", sizeof(buf));
1806 else strncpy(buf, "item", sizeof(buf));
1807 if (it->wd->compress)
1808 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
1810 strncat(buf, "/", sizeof(buf) - strlen(buf));
1811 strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf));
1813 _elm_theme_object_set(WIDGET(it), VIEW(it), "genlist", buf,
1814 elm_widget_style_get(WIDGET(it)));
1816 stacking_even = edje_object_data_get(VIEW(it), "stacking_even");
1817 if (!stacking_even) stacking_even = "above";
1818 it->item->stacking_even = !!strcmp("above", stacking_even);
1820 stacking = edje_object_data_get(VIEW(it), "stacking");
1821 if (!stacking) stacking = "yes";
1822 it->item->nostacking = !!strcmp("yes", stacking);
1824 edje_object_mirrored_set(VIEW(it),
1825 elm_widget_mirrored_get(WIDGET(it)));
1827 evas_object_rectangle_add(evas_object_evas_get(WIDGET(it)));
1828 evas_object_color_set(it->spacer, 0, 0, 0, 0);
1829 elm_widget_sub_object_add(WIDGET(it), it->spacer);
1832 _elm_genlist_item_odd_even_update(it);
1834 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
1836 if (it2->parent->item->flags != ELM_GENLIST_ITEM_GROUP) depth += 1;
1838 it->item->expanded_depth = depth;
1839 treesize = edje_object_data_get(VIEW(it), "treesize");
1840 if (treesize) tsize = atoi(treesize);
1841 evas_object_size_hint_min_set(it->spacer,
1842 (depth * tsize) * _elm_config->scale, 1);
1843 edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer);
1846 edje_object_signal_callback_add(VIEW(it),
1847 "elm,action,expand,toggle",
1848 "elm", _signal_expand_toggle, it);
1849 edje_object_signal_callback_add(VIEW(it), "elm,action,expand",
1850 "elm", _signal_expand, it);
1851 edje_object_signal_callback_add(VIEW(it), "elm,action,contract",
1852 "elm", _signal_contract, it);
1853 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN,
1855 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_UP,
1857 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
1859 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_DOWN,
1861 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_UP,
1863 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_MOVE,
1866 _elm_genlist_item_state_update(it, itc);
1869 if ((calc) && (it->wd->homogeneous) &&
1870 ((it->wd->item_width) ||
1871 ((it->wd->item_width) && (it->wd->group_item_width))))
1873 /* homogenous genlist shortcut */
1874 if (!it->item->mincalcd)
1876 if (it->item->flags & ELM_GENLIST_ITEM_GROUP)
1878 it->item->w = it->item->minw = it->wd->group_item_width;
1879 it->item->h = it->item->minh = it->wd->group_item_height;
1883 it->item->w = it->item->minw = it->wd->item_width;
1884 it->item->h = it->item->minh = it->wd->item_height;
1886 it->item->mincalcd = EINA_TRUE;
1891 /* FIXME: If you see that assert, please notify us and we
1892 will clean our mess */
1893 assert(eina_list_count(it->icon_objs) == 0);
1895 _item_label_realize(it, VIEW(it), &it->labels);
1896 it->icon_objs = _item_icon_realize(it, VIEW(it), &it->icons);
1897 _item_state_realize(it, VIEW(it), &it->states);
1899 if (!it->item->mincalcd)
1901 Evas_Coord mw = -1, mh = -1;
1903 if (!it->display_only)
1904 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1905 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
1906 edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw,
1908 if (!it->display_only)
1909 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1910 it->item->w = it->item->minw = mw;
1911 it->item->h = it->item->minh = mh;
1912 it->item->mincalcd = EINA_TRUE;
1914 if ((!it->wd->group_item_width) && (it->item->flags == ELM_GENLIST_ITEM_GROUP))
1916 it->wd->group_item_width = mw;
1917 it->wd->group_item_height = mh;
1919 else if ((!it->wd->item_width) && (it->item->flags == ELM_GENLIST_ITEM_NONE))
1921 it->wd->item_width = mw;
1922 it->wd->item_height = mh;
1925 if (!calc) evas_object_show(VIEW(it));
1928 if (it->tooltip.content_cb)
1930 elm_widget_item_tooltip_content_cb_set(it,
1931 it->tooltip.content_cb,
1932 it->tooltip.data, NULL);
1933 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
1934 elm_widget_item_tooltip_size_restrict_disable(it, it->tooltip.free_size);
1937 if (it->mouse_cursor)
1938 elm_widget_item_cursor_set(it, it->mouse_cursor);
1940 it->realized = EINA_TRUE;
1941 it->want_unrealize = EINA_FALSE;
1943 if (itc) _item_cache_free(itc);
1944 //evas_event_thaw(evas_object_evas_get(it->wd->obj));
1945 //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1947 evas_object_smart_callback_call(WIDGET(it), SIG_REALIZED, it);
1948 edje_object_message_signal_process(VIEW(it));
1952 _item_unrealize_cb(Elm_Gen_Item *it)
1954 if (it->item->nocache)
1956 evas_object_del(VIEW(it));
1958 evas_object_del(it->spacer);
1963 edje_object_mirrored_set(VIEW(it),
1964 elm_widget_mirrored_get(WIDGET(it)));
1965 edje_object_scale_set(VIEW(it),
1966 elm_widget_scale_get(WIDGET(it))
1967 * _elm_config->scale);
1968 _item_cache_add(it);
1971 _mode_item_unrealize(it);
1973 it->realized = EINA_FALSE;
1974 it->want_unrealize = EINA_FALSE;
1978 _item_block_recalc(Item_Block *itb,
1984 Evas_Coord minw = 0, minh = 0;
1985 Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE;
1988 //evas_event_freeze(evas_object_evas_get(itb->wd->obj));
1990 EINA_LIST_FOREACH(itb->items, l, it)
1992 if (it->delete_me) continue;
1993 showme |= it->item->showme;
1998 if (!it->item->mincalcd) changed = EINA_TRUE;
2001 _item_realize(it, in, EINA_TRUE);
2002 elm_gen_item_unrealize(it, EINA_TRUE, (Ecore_Cb)_item_unrealize_cb);
2007 _item_realize(it, in, EINA_TRUE);
2008 elm_gen_item_unrealize(it, EINA_TRUE, (Ecore_Cb)_item_unrealize_cb);
2012 _item_realize(it, in, EINA_FALSE);
2013 minh += it->item->minh;
2014 if (minw < it->item->minw) minw = it->item->minw;
2022 itb->changed = EINA_FALSE;
2023 //evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2024 //evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2029 _item_block_realize(Item_Block *itb)
2031 if (itb->realized) return;
2032 itb->realized = EINA_TRUE;
2033 itb->want_unrealize = EINA_FALSE;
2037 _item_block_unrealize(Item_Block *itb)
2041 Eina_Bool dragging = EINA_FALSE;
2043 if (!itb->realized) return;
2044 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2045 EINA_LIST_FOREACH(itb->items, l, it)
2047 if (it->item->flags != ELM_GENLIST_ITEM_GROUP)
2051 dragging = EINA_TRUE;
2052 it->want_unrealize = EINA_TRUE;
2055 elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
2060 itb->realized = EINA_FALSE;
2061 itb->want_unrealize = EINA_TRUE;
2064 itb->want_unrealize = EINA_FALSE;
2065 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2066 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2070 _get_space_for_reorder_item(Elm_Gen_Item *it)
2072 Evas_Coord rox, roy, row, roh, oy, oh;
2073 Eina_Bool top = EINA_FALSE;
2074 Elm_Gen_Item *reorder_it = it->wd->reorder_it;
2075 if (!reorder_it) return 0;
2077 evas_object_geometry_get(it->wd->pan_smart, NULL, &oy, NULL, &oh);
2078 evas_object_geometry_get(it->wd->VIEW(reorder_it), &rox, &roy, &row, &roh);
2080 if ((it->wd->reorder_start_y < it->item->block->y) &&
2081 (roy - oy + (roh / 2) >= it->item->block->y - it->wd->pan_y))
2083 it->item->block->reorder_offset = it->wd->reorder_it->item->h * -1;
2084 if (it->item->block->count == 1)
2085 it->wd->reorder_rel = it;
2087 else if ((it->wd->reorder_start_y >= it->item->block->y) &&
2088 (roy - oy + (roh / 2) <= it->item->block->y - it->wd->pan_y))
2090 it->item->block->reorder_offset = it->wd->reorder_it->item->h;
2093 it->item->block->reorder_offset = 0;
2095 it->item->scrl_y += it->item->block->reorder_offset;
2097 top = (ELM_RECTS_INTERSECT(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h,
2098 rox, roy + (roh / 2), row, 1));
2101 it->wd->reorder_rel = it;
2102 it->item->scrl_y += it->wd->reorder_it->item->h;
2103 return it->wd->reorder_it->item->h;
2110 _reorder_move_animator_cb(void *data)
2112 Elm_Gen_Item *it = data;
2113 Eina_Bool down = EINA_FALSE;
2115 int y, dy = it->item->h / 10 * _elm_config->scale, diff;
2117 t = ((0.0 > (t = ecore_loop_time_get()-it->wd->start_time)) ? 0.0 : t);
2119 if (t <= REORDER_EFFECT_TIME) y = (1 * sin((t / REORDER_EFFECT_TIME) * (M_PI / 2)) * dy);
2122 diff = abs(it->item->old_scrl_y - it->item->scrl_y);
2123 if (diff > it->item->h) y = diff / 2;
2125 if (it->item->old_scrl_y < it->item->scrl_y)
2127 it->item->old_scrl_y += y;
2130 else if (it->item->old_scrl_y > it->item->scrl_y)
2132 it->item->old_scrl_y -= y;
2135 _item_position(it, VIEW(it), it->item->scrl_x, it->item->old_scrl_y);
2136 _group_items_recalc(it->wd);
2138 if ((it->wd->reorder_pan_move) ||
2139 (down && it->item->old_scrl_y >= it->item->scrl_y) ||
2140 (!down && it->item->old_scrl_y <= it->item->scrl_y))
2142 it->item->old_scrl_y = it->item->scrl_y;
2143 it->item->move_effect_enabled = EINA_FALSE;
2144 it->wd->reorder_move_animator = NULL;
2145 return ECORE_CALLBACK_CANCEL;
2147 return ECORE_CALLBACK_RENEW;
2151 _item_position(Elm_Gen_Item *it,
2159 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2160 evas_object_resize(view, it->item->w, it->item->h);
2161 evas_object_move(view, it_x, it_y);
2162 evas_object_show(view);
2163 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2164 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2168 _item_block_position(Item_Block *itb,
2174 Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2177 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2178 evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh);
2179 evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy,
2181 EINA_LIST_FOREACH(itb->items, l, it)
2183 if (it->delete_me) continue;
2184 else if (it->wd->reorder_it == it) continue;
2187 it->item->w = itb->w;
2188 it->item->scrl_x = itb->x + it->x - it->wd->pan_x + ox;
2189 it->item->scrl_y = itb->y + it->y - it->wd->pan_y + oy;
2191 vis = (ELM_RECTS_INTERSECT(it->item->scrl_x, it->item->scrl_y, it->item->w, it->item->h,
2192 cvx, cvy, cvw, cvh));
2193 if (it->item->flags != ELM_GENLIST_ITEM_GROUP)
2195 if ((itb->realized) && (!it->realized))
2197 if (vis) _item_realize(it, in, EINA_FALSE);
2203 if (it->wd->reorder_mode)
2204 y += _get_space_for_reorder_item(it);
2205 git = it->item->group_item;
2208 if (git->item->scrl_y < oy)
2209 git->item->scrl_y = oy;
2210 if ((git->item->scrl_y + git->item->h) > (it->item->scrl_y + it->item->h))
2211 git->item->scrl_y = (it->item->scrl_y + it->item->h) - git->item->h;
2212 git->item->want_realize = EINA_TRUE;
2214 if ((it->wd->reorder_it) && (it->item->old_scrl_y != it->item->scrl_y))
2216 if (!it->item->move_effect_enabled)
2218 it->item->move_effect_enabled = EINA_TRUE;
2219 it->wd->reorder_move_animator =
2221 _reorder_move_animator_cb, it);
2224 if (!it->item->move_effect_enabled)
2226 if (it->item->mode_view)
2227 _item_position(it, it->item->mode_view, it->item->scrl_x,
2230 _item_position(it, VIEW(it), it->item->scrl_x,
2232 it->item->old_scrl_y = it->item->scrl_y;
2237 if (!it->dragging) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
2244 if (vis) it->item->want_realize = EINA_TRUE;
2248 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2249 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2253 _group_items_recalc(void *data)
2255 Widget_Data *wd = data;
2259 evas_event_freeze(evas_object_evas_get(wd->obj));
2260 EINA_LIST_FOREACH(wd->group_items, l, git)
2262 if (git->item->want_realize)
2265 _item_realize(git, 0, EINA_FALSE);
2266 evas_object_resize(VIEW(git), wd->minw, git->item->h);
2267 evas_object_move(VIEW(git), git->item->scrl_x, git->item->scrl_y);
2268 evas_object_show(VIEW(git));
2269 evas_object_raise(VIEW(git));
2271 else if (!git->item->want_realize && git->realized)
2274 elm_gen_item_unrealize(git, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
2277 evas_event_thaw(evas_object_evas_get(wd->obj));
2278 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2282 _must_recalc_idler(void *data)
2284 Widget_Data *wd = data;
2285 if (wd->calc_job) ecore_job_del(wd->calc_job);
2286 wd->calc_job = ecore_job_add(_calc_job, wd);
2287 wd->must_recalc_idler = NULL;
2288 return ECORE_CALLBACK_CANCEL;
2292 _calc_job(void *data)
2294 Widget_Data *wd = data;
2295 Item_Block *itb, *chb = NULL;
2296 Evas_Coord minw = -1, minh = 0, y = 0, ow;
2299 Eina_Bool minw_change = EINA_FALSE;
2300 Eina_Bool did_must_recalc = EINA_FALSE;
2303 t0 = ecore_time_get();
2304 evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h);
2308 evas_event_freeze(evas_object_evas_get(wd->obj));
2309 EINA_INLIST_FOREACH(wd->blocks, itb)
2311 Eina_Bool showme = EINA_FALSE;
2314 showme = itb->showme;
2315 itb->showme = EINA_FALSE;
2318 if (itb->realized) _item_block_unrealize(itb);
2320 if ((itb->changed) || ((itb->must_recalc) && (!did_must_recalc)))
2322 if (itb->must_recalc)
2326 EINA_LIST_FOREACH(itb->items, l, it)
2327 if (it->item->mincalcd) it->item->mincalcd = EINA_FALSE;
2328 itb->changed = EINA_TRUE;
2329 if (itb->must_recalc) did_must_recalc = EINA_TRUE;
2330 itb->must_recalc = EINA_FALSE;
2332 if (itb->realized) _item_block_unrealize(itb);
2333 showme = _item_block_recalc(itb, in, EINA_FALSE);
2339 if (minw == -1) minw = itb->minw;
2340 else if ((!itb->must_recalc) && (minw < itb->minw))
2343 minw_change = EINA_TRUE;
2349 if ((showme) && (wd->show_item) && (!wd->show_item->item->queued))
2351 wd->show_item->item->showme = EINA_FALSE;
2353 elm_smart_scroller_region_bring_in(wd->scr,
2355 wd->show_item->item->block->x,
2357 wd->show_item->item->block->y,
2358 wd->show_item->item->block->w,
2359 wd->show_item->item->h);
2361 elm_smart_scroller_child_region_show(wd->scr,
2363 wd->show_item->item->block->x,
2365 wd->show_item->item->block->y,
2366 wd->show_item->item->block->w,
2367 wd->show_item->item->h);
2368 wd->show_item = NULL;
2373 EINA_INLIST_FOREACH(wd->blocks, itb)
2379 if ((chb) && (EINA_INLIST_GET(chb)->next))
2381 EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb)
2383 if (itb->realized) _item_block_unrealize(itb);
2386 wd->realminw = minw;
2387 if (minw < wd->w) minw = wd->w;
2388 if ((minw != wd->minw) || (minh != wd->minh))
2392 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
2393 _sizing_eval(wd->obj);
2394 if ((wd->anchor_item) && (wd->anchor_item->item->block) && (!wd->auto_scroll_enabled))
2399 it = wd->anchor_item;
2400 it_y = wd->anchor_y;
2401 elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x,
2402 it->item->block->y + it->y + it_y);
2403 wd->anchor_item = it;
2404 wd->anchor_y = it_y;
2407 t = ecore_time_get();
2408 if (did_must_recalc)
2410 if (!wd->must_recalc_idler)
2411 wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd);
2413 wd->calc_job = NULL;
2414 evas_object_smart_changed(wd->pan_smart);
2415 evas_event_thaw(evas_object_evas_get(wd->obj));
2416 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2420 _update_job(void *data)
2422 Widget_Data *wd = data;
2426 Eina_Bool position = EINA_FALSE, recalc = EINA_FALSE;
2428 wd->update_job = NULL;
2431 evas_event_freeze(evas_object_evas_get(wd->obj));
2432 EINA_INLIST_FOREACH(wd->blocks, itb)
2434 Evas_Coord itminw, itminh;
2441 _item_block_position(itb, num);
2445 recalc = EINA_FALSE;
2446 EINA_LIST_FOREACH(itb->items, l2, it)
2448 if (it->item->updateme)
2450 itminw = it->item->minw;
2451 itminh = it->item->minh;
2453 it->item->updateme = EINA_FALSE;
2456 elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
2457 _item_realize(it, num, EINA_FALSE);
2458 position = EINA_TRUE;
2462 _item_realize(it, num, EINA_TRUE);
2463 elm_gen_item_unrealize(it, EINA_TRUE, (Ecore_Cb)_item_unrealize_cb);
2465 if ((it->item->minw != itminw) || (it->item->minh != itminh))
2470 itb->updateme = EINA_FALSE;
2473 position = EINA_TRUE;
2474 itb->changed = EINA_TRUE;
2475 _item_block_recalc(itb, num0, EINA_FALSE);
2476 _item_block_position(itb, num0);
2481 if (wd->calc_job) ecore_job_del(wd->calc_job);
2482 wd->calc_job = ecore_job_add(_calc_job, wd);
2484 evas_event_thaw(evas_object_evas_get(wd->obj));
2485 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2489 _pan_set(Evas_Object *obj,
2493 Pan *sd = evas_object_smart_data_get(obj);
2497 // Evas_Coord ow, oh;
2498 // evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2499 // ow = sd->wd->minw - ow;
2500 // if (ow < 0) ow = 0;
2501 // oh = sd->wd->minh - oh;
2502 // if (oh < 0) oh = 0;
2503 // if (x < 0) x = 0;
2504 // if (y < 0) y = 0;
2505 // if (x > ow) x = ow;
2506 // if (y > oh) y = oh;
2507 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
2511 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2513 if ((itb->y + itb->h) > y)
2518 EINA_LIST_FOREACH(itb->items, l2, it)
2520 if ((itb->y + it->y) >= y)
2522 sd->wd->anchor_item = it;
2523 sd->wd->anchor_y = -(itb->y + it->y - y);
2530 if (!sd->wd->reorder_move_animator) evas_object_smart_changed(obj);
2534 _pan_get(Evas_Object *obj,
2538 Pan *sd = evas_object_smart_data_get(obj);
2541 if (x) *x = sd->wd->pan_x;
2542 if (y) *y = sd->wd->pan_y;
2546 _pan_max_get(Evas_Object *obj,
2550 Pan *sd = evas_object_smart_data_get(obj);
2554 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2555 ow = sd->wd->minw - ow;
2557 oh = sd->wd->minh - oh;
2564 _pan_min_get(Evas_Object *obj __UNUSED__,
2573 _pan_child_size_get(Evas_Object *obj,
2577 Pan *sd = evas_object_smart_data_get(obj);
2580 if (w) *w = sd->wd->minw;
2581 if (h) *h = sd->wd->minh;
2585 _pan_add(Evas_Object *obj)
2588 Evas_Object_Smart_Clipped_Data *cd;
2591 cd = evas_object_smart_data_get(obj);
2594 sd->__clipped_data = *cd;
2596 evas_object_smart_data_set(obj, sd);
2600 _pan_del(Evas_Object *obj)
2602 Pan *sd = evas_object_smart_data_get(obj);
2607 ecore_job_del(sd->resize_job);
2608 sd->resize_job = NULL;
2614 _pan_resize_job(void *data)
2618 _sizing_eval(sd->wd->obj);
2619 sd->resize_job = NULL;
2623 _pan_resize(Evas_Object *obj,
2627 Pan *sd = evas_object_smart_data_get(obj);
2631 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2632 if ((ow == w) && (oh == h)) return;
2633 if ((sd->wd->height_for_width) && (ow != w))
2636 if (sd->resize_job) ecore_job_del(sd->resize_job);
2637 sd->resize_job = ecore_job_add(_pan_resize_job, sd);
2639 sd->wd->pan_resized = EINA_TRUE;
2640 evas_object_smart_changed(obj);
2641 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2642 sd->wd->calc_job = NULL;
2644 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2645 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2650 _pan_calculate(Evas_Object *obj)
2652 Pan *sd = evas_object_smart_data_get(obj);
2654 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2660 evas_event_freeze(evas_object_evas_get(obj));
2662 if (sd->wd->pan_resized)
2665 sd->wd->pan_resized = EINA_FALSE;
2668 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
2669 evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
2670 EINA_LIST_FOREACH(sd->wd->group_items, l, git)
2672 git->item->want_realize = EINA_FALSE;
2674 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2676 itb->w = sd->wd->minw;
2677 if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox,
2678 itb->y - sd->wd->pan_y + oy,
2680 cvx, cvy, cvw, cvh))
2682 if ((!itb->realized) || (itb->changed))
2683 _item_block_realize(itb);
2684 _item_block_position(itb, in);
2688 if (itb->realized) _item_block_unrealize(itb);
2692 if ((!sd->wd->reorder_it) || (sd->wd->reorder_pan_move))
2693 _group_items_recalc(sd->wd);
2694 if ((sd->wd->reorder_mode) && (sd->wd->reorder_it))
2696 if (sd->wd->pan_y != sd->wd->reorder_old_pan_y)
2697 sd->wd->reorder_pan_move = EINA_TRUE;
2698 else sd->wd->reorder_pan_move = EINA_FALSE;
2699 evas_object_raise(sd->wd->VIEW(reorder_it));
2700 sd->wd->reorder_old_pan_y = sd->wd->pan_y;
2701 sd->wd->start_time = ecore_loop_time_get();
2703 _item_auto_scroll(sd->wd);
2704 evas_event_thaw(evas_object_evas_get(obj));
2705 evas_event_thaw_eval(evas_object_evas_get(obj));
2709 _pan_move(Evas_Object *obj,
2710 Evas_Coord x __UNUSED__,
2711 Evas_Coord y __UNUSED__)
2713 Pan *sd = evas_object_smart_data_get(obj);
2716 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2717 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2721 _hold_on(void *data __UNUSED__,
2723 void *event_info __UNUSED__)
2725 Widget_Data *wd = elm_widget_data_get(obj);
2727 elm_smart_scroller_hold_set(wd->scr, 1);
2731 _hold_off(void *data __UNUSED__,
2733 void *event_info __UNUSED__)
2735 Widget_Data *wd = elm_widget_data_get(obj);
2737 elm_smart_scroller_hold_set(wd->scr, 0);
2741 _freeze_on(void *data __UNUSED__,
2743 void *event_info __UNUSED__)
2745 Widget_Data *wd = elm_widget_data_get(obj);
2747 elm_smart_scroller_freeze_set(wd->scr, 1);
2751 _freeze_off(void *data __UNUSED__,
2753 void *event_info __UNUSED__)
2755 Widget_Data *wd = elm_widget_data_get(obj);
2757 elm_smart_scroller_freeze_set(wd->scr, 0);
2761 _scr_anim_start(void *data,
2762 Evas_Object *obj __UNUSED__,
2763 void *event_info __UNUSED__)
2765 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL);
2769 _scr_anim_stop(void *data,
2770 Evas_Object *obj __UNUSED__,
2771 void *event_info __UNUSED__)
2773 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL);
2777 _scr_drag_start(void *data,
2778 Evas_Object *obj __UNUSED__,
2779 void *event_info __UNUSED__)
2781 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
2785 _scr_drag_stop(void *data,
2786 Evas_Object *obj __UNUSED__,
2787 void *event_info __UNUSED__)
2789 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
2793 _edge_left(void *data,
2794 Evas_Object *scr __UNUSED__,
2795 void *event_info __UNUSED__)
2797 Evas_Object *obj = data;
2798 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_LEFT, NULL);
2799 evas_object_smart_callback_call(obj, SIG_EDGE_LEFT, NULL);
2803 _edge_right(void *data,
2804 Evas_Object *scr __UNUSED__,
2805 void *event_info __UNUSED__)
2807 Evas_Object *obj = data;
2808 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_RIGHT, NULL);
2809 evas_object_smart_callback_call(obj, SIG_EDGE_RIGHT, NULL);
2813 _edge_top(void *data,
2814 Evas_Object *scr __UNUSED__,
2815 void *event_info __UNUSED__)
2817 Evas_Object *obj = data;
2818 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_TOP, NULL);
2819 evas_object_smart_callback_call(obj, SIG_EDGE_TOP, NULL);
2823 _edge_bottom(void *data,
2824 Evas_Object *scr __UNUSED__,
2825 void *event_info __UNUSED__)
2827 Evas_Object *obj = data;
2828 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_BOTTOM, NULL);
2829 evas_object_smart_callback_call(obj, SIG_EDGE_BOTTOM, NULL);
2833 _mode_item_realize(Elm_Gen_Item *it)
2837 if ((it->item->mode_view) || (it->delete_me)) return;
2839 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2840 it->item->mode_view = edje_object_add(evas_object_evas_get(WIDGET(it)));
2841 edje_object_scale_set(it->item->mode_view,
2842 elm_widget_scale_get(WIDGET(it)) *
2843 _elm_config->scale);
2844 evas_object_smart_member_add(it->item->mode_view, it->wd->pan_smart);
2845 elm_widget_sub_object_add(WIDGET(it), it->item->mode_view);
2847 strncpy(buf, "item", sizeof(buf));
2848 if (it->wd->compress)
2849 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
2851 if (it->item->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
2852 strncat(buf, "/", sizeof(buf) - strlen(buf));
2853 strncat(buf, it->wd->mode_item_style, sizeof(buf) - strlen(buf));
2855 _elm_theme_object_set(WIDGET(it), it->item->mode_view, "genlist", buf,
2856 elm_widget_style_get(WIDGET(it)));
2857 edje_object_mirrored_set(it->item->mode_view,
2858 elm_widget_mirrored_get(WIDGET(it)));
2860 /* signal callback add */
2861 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_DOWN,
2863 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_UP,
2865 evas_object_event_callback_add(it->item->mode_view, EVAS_CALLBACK_MOUSE_MOVE,
2868 /* label_get, icon_get, state_get */
2869 /* FIXME: If you see that assert, please notify us and we
2870 will clean our mess */
2871 assert(eina_list_count(it->item->mode_icon_objs) == 0);
2873 _item_label_realize(it, it->item->mode_view, &it->item->mode_labels);
2874 it->item->mode_icon_objs = _item_icon_realize(it,
2875 it->item->mode_view,
2876 &it->item->mode_icons);
2877 _item_state_realize(it, it->item->mode_view, &it->item->mode_states);
2879 edje_object_part_swallow(it->item->mode_view,
2880 edje_object_data_get(it->item->mode_view, "mode_part"),
2883 it->want_unrealize = EINA_FALSE;
2884 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2885 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2889 _mode_item_unrealize(Elm_Gen_Item *it)
2891 Widget_Data *wd = it->wd;
2893 if (!it->item->mode_view) return;
2895 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2896 elm_widget_stringlist_free(it->item->mode_labels);
2897 it->item->mode_labels = NULL;
2898 elm_widget_stringlist_free(it->item->mode_icons);
2899 it->item->mode_icons = NULL;
2900 elm_widget_stringlist_free(it->item->mode_states);
2902 EINA_LIST_FREE(it->item->mode_icon_objs, icon)
2903 evas_object_del(icon);
2905 edje_object_part_unswallow(it->item->mode_view, VIEW(it));
2906 evas_object_smart_member_add(VIEW(it), wd->pan_smart);
2907 evas_object_del(it->item->mode_view);
2908 it->item->mode_view = NULL;
2910 if (wd->mode_item == it)
2911 wd->mode_item = NULL;
2912 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2913 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2917 _item_mode_set(Elm_Gen_Item *it)
2920 Widget_Data *wd = it->wd;
2925 it->item->nocache = EINA_TRUE;
2927 if (wd->scr_hold_timer)
2929 ecore_timer_del(wd->scr_hold_timer);
2930 wd->scr_hold_timer = NULL;
2932 elm_smart_scroller_hold_set(wd->scr, EINA_TRUE);
2933 wd->scr_hold_timer = ecore_timer_add(0.1, _scr_hold_timer_cb, wd);
2935 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2936 _mode_item_realize(it);
2937 if (it->item->group_item)
2938 evas_object_raise(it->item->VIEW(group_item));
2939 _item_position(it, it->item->mode_view, it->item->scrl_x, it->item->scrl_y);
2940 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2941 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2943 snprintf(buf, sizeof(buf), "elm,state,%s,active", wd->mode_type);
2944 edje_object_signal_emit(it->item->mode_view, buf, "elm");
2948 _item_mode_unset(Widget_Data *wd)
2951 if (!wd->mode_item) return;
2952 char buf[1024], buf2[1024];
2956 it->item->nocache = EINA_TRUE;
2958 snprintf(buf, sizeof(buf), "elm,state,%s,passive", wd->mode_type);
2959 snprintf(buf2, sizeof(buf2), "elm,state,%s,passive,finished", wd->mode_type);
2961 edje_object_signal_emit(it->item->mode_view, buf, "elm");
2962 edje_object_signal_callback_add(it->item->mode_view, buf2, "elm", _mode_finished_signal_cb, it);
2964 wd->mode_item = NULL;
2968 _item_auto_scroll(Widget_Data *wd)
2973 Evas_Coord ox, oy, ow, oh;
2975 if ((wd->expanded_item) && (wd->auto_scroll_enabled))
2977 evas_object_geometry_get(wd->obj, &ox, &oy, &ow, &oh);
2978 if (wd->expanded_item->item->scrl_y > (oh + oy) / 2)
2980 EINA_LIST_FOREACH(wd->expanded_item->item->items, l, it)
2981 elm_genlist_item_bring_in(it);
2983 wd->auto_scroll_enabled = EINA_FALSE;
2988 elm_genlist_add(Evas_Object *parent)
2993 Evas_Coord minw, minh;
2994 static Evas_Smart *smart = NULL;
2998 static Evas_Smart_Class sc;
3000 evas_object_smart_clipped_smart_set(&_pan_sc);
3002 sc.name = "elm_genlist_pan";
3003 sc.version = EVAS_SMART_CLASS_VERSION;
3006 sc.resize = _pan_resize;
3007 sc.move = _pan_move;
3008 sc.calculate = _pan_calculate;
3009 if (!(smart = evas_smart_class_new(&sc))) return NULL;
3012 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
3014 ELM_SET_WIDTYPE(widtype, "genlist");
3015 elm_widget_type_set(obj, "genlist");
3016 elm_widget_sub_object_add(parent, obj);
3017 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
3018 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
3019 elm_widget_data_set(obj, wd);
3020 elm_widget_del_hook_set(obj, _del_hook);
3021 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
3022 elm_widget_theme_hook_set(obj, _theme_hook);
3023 elm_widget_can_focus_set(obj, EINA_TRUE);
3024 elm_widget_event_hook_set(obj, _event_hook);
3025 elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
3026 elm_widget_translate_hook_set(obj, _translate_hook);
3028 wd->scr = elm_smart_scroller_add(e);
3029 elm_smart_scroller_widget_set(wd->scr, obj);
3030 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
3031 elm_widget_style_get(obj));
3032 elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE,
3033 _elm_config->thumbscroll_bounce_enable);
3034 elm_widget_resize_object_set(obj, wd->scr);
3036 evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj);
3037 evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, obj);
3038 evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj);
3039 evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj);
3040 evas_object_smart_callback_add(wd->scr, "edge,left", _edge_left, obj);
3041 evas_object_smart_callback_add(wd->scr, "edge,right", _edge_right, obj);
3042 evas_object_smart_callback_add(wd->scr, "edge,top", _edge_top, obj);
3043 evas_object_smart_callback_add(wd->scr, "edge,bottom", _edge_bottom, obj);
3046 wd->mode = ELM_LIST_SCROLL;
3047 wd->max_items_per_block = MAX_ITEMS_PER_BLOCK;
3048 wd->item_cache_max = wd->max_items_per_block * 2;
3049 wd->longpress_timeout = _elm_config->longpress_timeout;
3051 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
3052 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
3053 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
3054 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
3056 wd->pan_smart = evas_object_smart_add(e, smart);
3057 wd->pan = evas_object_smart_data_get(wd->pan_smart);
3060 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
3061 _pan_set, _pan_get, _pan_max_get,
3062 _pan_min_get, _pan_child_size_get);
3064 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
3066 evas_object_size_hint_min_set(obj, minw, minh);
3068 evas_object_smart_callbacks_descriptions_set(obj, _signals);
3070 _mirrored_set(obj, elm_widget_mirrored_get(obj));
3075 static Elm_Gen_Item *
3076 _item_new(Widget_Data *wd,
3077 const Elm_Genlist_Item_Class *itc,
3079 Elm_Gen_Item *parent,
3080 Elm_Genlist_Item_Flags flags,
3082 const void *func_data)
3086 it = elm_gen_item_new(wd, itc, data, parent, func, func_data);
3087 if (!it) return NULL;
3088 it->item = ELM_NEW(Elm_Gen_Item_Type);
3089 it->item->flags = flags;
3090 if (flags & ELM_GENLIST_ITEM_GROUP) it->group++;
3091 it->item->expanded_depth = 0;
3092 elm_widget_item_del_cb_set(it, _item_del_hook);
3095 if (it->parent->group)
3096 it->item->group_item = parent;
3097 else if (it->parent->item->group_item)
3098 it->item->group_item = it->parent->item->group_item;
3104 _item_block_add(Widget_Data *wd,
3107 Item_Block *itb = NULL;
3114 itb = calloc(1, sizeof(Item_Block));
3117 if (!it->item->rel->item->block)
3120 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3121 itb->items = eina_list_append(itb->items, it);
3125 if (it->item->before)
3127 wd->blocks = eina_inlist_prepend_relative
3128 (wd->blocks, EINA_INLIST_GET(itb),
3129 EINA_INLIST_GET(it->item->rel->item->block));
3131 eina_list_prepend_relative(itb->items, it, it->item->rel);
3135 wd->blocks = eina_inlist_append_relative
3136 (wd->blocks, EINA_INLIST_GET(itb),
3137 EINA_INLIST_GET(it->item->rel->item->block));
3139 eina_list_append_relative(itb->items, it, it->item->rel);
3145 if (it->item->before)
3149 itb = (Item_Block *)(wd->blocks);
3150 if (itb->count >= wd->max_items_per_block)
3152 itb = calloc(1, sizeof(Item_Block));
3156 eina_inlist_prepend(wd->blocks,
3157 EINA_INLIST_GET(itb));
3162 itb = calloc(1, sizeof(Item_Block));
3166 eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
3168 itb->items = eina_list_prepend(itb->items, it);
3174 itb = (Item_Block *)(wd->blocks->last);
3175 if (itb->count >= wd->max_items_per_block)
3177 itb = calloc(1, sizeof(Item_Block));
3181 eina_inlist_append(wd->blocks,
3182 EINA_INLIST_GET(itb));
3187 itb = calloc(1, sizeof(Item_Block));
3191 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3193 itb->items = eina_list_append(itb->items, it);
3199 itb = it->item->rel->item->block;
3200 if (!itb) goto newblock;
3201 if (it->item->before)
3202 itb->items = eina_list_prepend_relative(itb->items, it, it->item->rel);
3204 itb->items = eina_list_append_relative(itb->items, it, it->item->rel);
3207 itb->changed = EINA_TRUE;
3208 it->item->block = itb;
3209 if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job);
3210 itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd);
3213 it->item->rel->relcount--;
3214 if ((it->item->rel->delete_me) && (!it->item->rel->relcount))
3215 _item_del(it->item->rel);
3216 it->item->rel = NULL;
3218 if (itb->count > itb->wd->max_items_per_block)
3224 newc = itb->count / 2;
3225 itb2 = calloc(1, sizeof(Item_Block));
3229 eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
3230 EINA_INLIST_GET(itb));
3231 itb2->changed = EINA_TRUE;
3232 while ((itb->count > newc) && (itb->items))
3236 l = eina_list_last(itb->items);
3238 itb->items = eina_list_remove_list(itb->items, l);
3241 itb2->items = eina_list_prepend(itb2->items, it2);
3242 it2->item->block = itb2;
3249 _queue_process(Widget_Data *wd)
3252 Eina_Bool showme = EINA_FALSE;
3255 t0 = ecore_time_get();
3256 //evas_event_freeze(evas_object_evas_get(wd->obj));
3257 for (n = 0; (wd->queue) && (n < 128); n++)
3261 it = wd->queue->data;
3262 wd->queue = eina_list_remove_list(wd->queue, wd->queue);
3263 it->item->queued = EINA_FALSE;
3264 _item_block_add(wd, it);
3265 t = ecore_time_get();
3266 if (it->item->block->changed)
3268 showme = _item_block_recalc(it->item->block, it->item->block->num, EINA_TRUE);
3269 it->item->block->changed = 0;
3271 if (showme) it->item->block->showme = EINA_TRUE;
3272 if (eina_inlist_count(wd->blocks) > 1)
3274 if ((t - t0) > (ecore_animator_frametime_get())) break;
3277 //evas_event_thaw(evas_object_evas_get(wd->obj));
3278 //evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3283 _idle_process(void *data, Eina_Bool *wakeup)
3285 Widget_Data *wd = data;
3288 //static double q_start = 0.0;
3289 //if (q_start == 0.0) q_start = ecore_time_get();
3291 if (_queue_process(wd) > 0) *wakeup = EINA_TRUE;
3295 //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start);
3297 return ECORE_CALLBACK_CANCEL;
3299 return ECORE_CALLBACK_RENEW;
3303 _item_idle_enterer(void *data)
3305 Widget_Data *wd = data;
3306 Eina_Bool wakeup = EINA_FALSE;
3307 Eina_Bool ok = _idle_process(data, &wakeup);
3312 if (wd->calc_job) ecore_job_del(wd->calc_job);
3313 wd->calc_job = ecore_job_add(_calc_job, wd);
3315 if (ok == ECORE_CALLBACK_CANCEL) wd->queue_idle_enterer = NULL;
3320 _item_queue(Widget_Data *wd,
3323 if (it->item->queued) return;
3324 it->item->queued = EINA_TRUE;
3325 wd->queue = eina_list_append(wd->queue, it);
3326 // FIXME: why does a freeze then thaw here cause some genlist
3327 // elm_genlist_item_append() to be much much slower?
3328 // evas_event_freeze(evas_object_evas_get(wd->obj));
3329 while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
3331 if (wd->queue_idle_enterer)
3333 ecore_idle_enterer_del(wd->queue_idle_enterer);
3334 wd->queue_idle_enterer = NULL;
3338 // evas_event_thaw(evas_object_evas_get(wd->obj));
3339 // evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3340 if (!wd->queue_idle_enterer)
3341 wd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, wd);
3345 _elm_genlist_item_compare_data(const void *data, const void *data1)
3347 const Elm_Gen_Item *it = data;
3348 const Elm_Gen_Item *item1 = data1;
3350 return _elm_genlist_item_compare_data_cb(it->base.data, item1->base.data);
3354 _elm_genlist_item_compare(const void *data, const void *data1)
3356 const Elm_Gen_Item *it, *item1;
3357 it = ELM_GENLIST_ITEM_FROM_INLIST(data);
3358 item1 = ELM_GENLIST_ITEM_FROM_INLIST(data1);
3359 return _elm_genlist_item_compare_cb(it, item1);
3363 _elm_genlist_item_list_compare(const void *data, const void *data1)
3365 const Elm_Gen_Item *it = data;
3366 const Elm_Gen_Item *item1 = data1;
3367 return _elm_genlist_item_compare_cb(it, item1);
3371 _item_move_after(Elm_Gen_Item *it, Elm_Gen_Item *after)
3376 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3377 _item_block_del(it);
3379 it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
3380 it->item->rel = after;
3381 it->item->rel->relcount++;
3382 it->item->before = EINA_FALSE;
3383 if (after->item->group_item) it->item->group_item = after->item->group_item;
3384 _item_queue(it->wd, it);
3386 evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it);
3390 _item_move_before(Elm_Gen_Item *it, Elm_Gen_Item *before)
3393 if (!before) return;
3395 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3396 _item_block_del(it);
3397 it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
3398 it->item->rel = before;
3399 it->item->rel->relcount++;
3400 it->item->before = EINA_TRUE;
3401 if (before->item->group_item) it->item->group_item = before->item->group_item;
3402 _item_queue(it->wd, it);
3404 evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it);
3408 elm_genlist_item_append(Evas_Object *obj,
3409 const Elm_Genlist_Item_Class *itc,
3411 Elm_Gen_Item *parent,
3412 Elm_Genlist_Item_Flags flags,
3414 const void *func_data)
3416 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3417 Widget_Data *wd = elm_widget_data_get(obj);
3418 if (!wd) return NULL;
3419 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3421 if (!it) return NULL;
3424 if (flags & ELM_GENLIST_ITEM_GROUP)
3425 wd->group_items = eina_list_append(wd->group_items, it);
3426 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
3427 it->item->rel = NULL;
3431 Elm_Gen_Item *it2 = NULL;
3432 Eina_List *ll = eina_list_last(it->parent->item->items);
3433 if (ll) it2 = ll->data;
3434 it->parent->item->items = eina_list_append(it->parent->item->items, it);
3435 if (!it2) it2 = it->parent;
3437 eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3438 EINA_INLIST_GET(it2));
3439 it->item->rel = it2;
3440 it->item->rel->relcount++;
3442 it->item->before = EINA_FALSE;
3443 _item_queue(wd, it);
3448 elm_genlist_item_prepend(Evas_Object *obj,
3449 const Elm_Genlist_Item_Class *itc,
3451 Elm_Gen_Item *parent,
3452 Elm_Genlist_Item_Flags flags,
3454 const void *func_data)
3456 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3457 Widget_Data *wd = elm_widget_data_get(obj);
3458 if (!wd) return NULL;
3459 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3461 if (!it) return NULL;
3464 if (flags & ELM_GENLIST_ITEM_GROUP)
3465 wd->group_items = eina_list_prepend(wd->group_items, it);
3466 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
3467 it->item->rel = NULL;
3471 Elm_Gen_Item *it2 = NULL;
3472 Eina_List *ll = it->parent->item->items;
3473 if (ll) it2 = ll->data;
3474 it->parent->item->items = eina_list_prepend(it->parent->item->items, it);
3475 if (!it2) it2 = it->parent;
3477 eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3478 EINA_INLIST_GET(it2));
3479 it->item->rel = it2;
3480 it->item->rel->relcount++;
3482 it->item->before = EINA_TRUE;
3483 _item_queue(wd, it);
3488 elm_genlist_item_insert_after(Evas_Object *obj,
3489 const Elm_Genlist_Item_Class *itc,
3491 Elm_Gen_Item *parent,
3492 Elm_Gen_Item *after,
3493 Elm_Genlist_Item_Flags flags,
3495 const void *func_data)
3497 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3498 EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
3499 Widget_Data *wd = elm_widget_data_get(obj);
3500 if (!wd) return NULL;
3501 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3503 if (!it) return NULL;
3504 /* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */
3505 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3509 if ((flags & ELM_GENLIST_ITEM_GROUP) &&
3510 (after->item->flags & ELM_GENLIST_ITEM_GROUP))
3511 wd->group_items = eina_list_append_relative(wd->group_items, it,
3516 it->parent->item->items = eina_list_append_relative(it->parent->item->items, it,
3519 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3520 EINA_INLIST_GET(after));
3521 it->item->rel = after;
3522 it->item->rel->relcount++;
3523 it->item->before = EINA_FALSE;
3524 _item_queue(wd, it);
3529 elm_genlist_item_insert_before(Evas_Object *obj,
3530 const Elm_Genlist_Item_Class *itc,
3532 Elm_Gen_Item *parent,
3533 Elm_Gen_Item *before,
3534 Elm_Genlist_Item_Flags flags,
3536 const void *func_data)
3538 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3539 EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
3540 Widget_Data *wd = elm_widget_data_get(obj);
3541 if (!wd) return NULL;
3542 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3544 if (!it) return NULL;
3545 /* It makes no sense to insert before in an empty list with before != NULL, something really bad is happening in your app. */
3546 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3550 if ((flags & ELM_GENLIST_ITEM_GROUP) &&
3551 (before->item->flags & ELM_GENLIST_ITEM_GROUP))
3552 wd->group_items = eina_list_prepend_relative(wd->group_items, it,
3557 it->parent->item->items = eina_list_prepend_relative(it->parent->item->items, it,
3560 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3561 EINA_INLIST_GET(before));
3562 it->item->rel = before;
3563 it->item->rel->relcount++;
3564 it->item->before = EINA_TRUE;
3565 _item_queue(wd, it);
3570 elm_genlist_item_direct_sorted_insert(Evas_Object *obj,
3571 const Elm_Genlist_Item_Class *itc,
3573 Elm_Gen_Item *parent,
3574 Elm_Genlist_Item_Flags flags,
3575 Eina_Compare_Cb comp,
3577 const void *func_data)
3579 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3580 Widget_Data *wd = elm_widget_data_get(obj);
3581 if (!wd) return NULL;
3582 Elm_Gen_Item *rel = NULL;
3583 Elm_Gen_Item *it = _item_new(wd, itc, data, parent, flags, func,
3585 if (!it) return NULL;
3587 _elm_genlist_item_compare_cb = comp;
3594 l = eina_list_search_sorted_near_list(it->parent->item->items,
3595 _elm_genlist_item_list_compare, it,
3598 rel = eina_list_data_get(l);
3602 if (cmp_result >= 0)
3604 it->parent->item->items = eina_list_prepend_relative_list(it->parent->item->items, it, l);
3605 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
3606 it->item->before = EINA_FALSE;
3608 else if (cmp_result < 0)
3610 it->parent->item->items = eina_list_append_relative_list(it->parent->item->items, it, l);
3611 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
3612 it->item->before = EINA_TRUE;
3619 wd->state = eina_inlist_sorted_state_new();
3622 if (flags & ELM_GENLIST_ITEM_GROUP)
3623 wd->group_items = eina_list_append(wd->group_items, it);
3625 wd->items = eina_inlist_sorted_state_insert(wd->items, EINA_INLIST_GET(it),
3626 _elm_genlist_item_compare, wd->state);
3628 if (EINA_INLIST_GET(it)->next)
3630 rel = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3631 it->item->before = EINA_TRUE;
3633 else if (EINA_INLIST_GET(it)->prev)
3635 rel = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3636 it->item->before = EINA_FALSE;
3642 it->item->rel = rel;
3643 it->item->rel->relcount++;
3646 _item_queue(wd, it);
3652 elm_genlist_item_sorted_insert(Evas_Object *obj,
3653 const Elm_Genlist_Item_Class *itc,
3655 Elm_Gen_Item *parent,
3656 Elm_Genlist_Item_Flags flags,
3657 Eina_Compare_Cb comp,
3659 const void *func_data)
3661 _elm_genlist_item_compare_data_cb = comp;
3663 return elm_genlist_item_direct_sorted_insert(obj, itc, data, parent, flags,
3664 _elm_genlist_item_compare_data, func, func_data);
3668 elm_genlist_clear(Evas_Object *obj)
3670 ELM_CHECK_WIDTYPE(obj, widtype);
3671 Widget_Data *wd = elm_widget_data_get(obj);
3675 eina_inlist_sorted_state_free(wd->state);
3678 if (wd->walking > 0)
3682 wd->clear_me = EINA_TRUE;
3683 EINA_INLIST_FOREACH(wd->items, it)
3685 it->delete_me = EINA_TRUE;
3689 evas_event_freeze(evas_object_evas_get(wd->obj));
3692 Elm_Gen_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
3694 if (wd->anchor_item == it)
3696 wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3697 if (!wd->anchor_item)
3699 ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3701 wd->items = eina_inlist_remove(wd->items, wd->items);
3702 if (it->item->flags & ELM_GENLIST_ITEM_GROUP)
3703 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
3704 elm_widget_item_pre_notify_del(it);
3705 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
3706 if (((wd->clear_me) || (!it->delete_me)) && (it->itc->func.del))
3707 it->itc->func.del((void *)it->base.data, WIDGET(it));
3708 if (it->long_timer) ecore_timer_del(it->long_timer);
3709 if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer);
3711 elm_widget_item_del(it);
3713 wd->clear_me = EINA_FALSE;
3714 wd->anchor_item = NULL;
3717 Item_Block *itb = (Item_Block *)(wd->blocks);
3719 wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
3720 if (itb->items) eina_list_free(itb->items);
3725 ecore_job_del(wd->calc_job);
3726 wd->calc_job = NULL;
3728 if (wd->queue_idle_enterer)
3730 ecore_idle_enterer_del(wd->queue_idle_enterer);
3731 wd->queue_idle_enterer = NULL;
3733 if (wd->must_recalc_idler)
3735 ecore_idler_del(wd->must_recalc_idler);
3736 wd->must_recalc_idler = NULL;
3740 eina_list_free(wd->queue);
3745 eina_list_free(wd->selected);
3746 wd->selected = NULL;
3748 if (wd->reorder_move_animator)
3750 ecore_animator_del(wd->reorder_move_animator);
3751 wd->reorder_move_animator = NULL;
3753 wd->show_item = NULL;
3756 wd->reorder_old_pan_y = 0;
3761 evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
3762 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
3765 elm_smart_scroller_child_region_show(wd->scr, 0, 0, 0, 0);
3766 evas_event_thaw(evas_object_evas_get(wd->obj));
3767 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3771 elm_genlist_multi_select_set(Evas_Object *obj,
3774 ELM_CHECK_WIDTYPE(obj, widtype);
3775 Widget_Data *wd = elm_widget_data_get(obj);
3781 elm_genlist_multi_select_get(const Evas_Object *obj)
3783 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3784 Widget_Data *wd = elm_widget_data_get(obj);
3785 if (!wd) return EINA_FALSE;
3790 elm_genlist_selected_item_get(const Evas_Object *obj)
3792 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3793 Widget_Data *wd = elm_widget_data_get(obj);
3794 if (!wd) return NULL;
3795 if (wd->selected) return wd->selected->data;
3799 EAPI const Eina_List *
3800 elm_genlist_selected_items_get(const Evas_Object *obj)
3802 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3803 Widget_Data *wd = elm_widget_data_get(obj);
3804 if (!wd) return NULL;
3805 return wd->selected;
3809 elm_genlist_realized_items_get(const Evas_Object *obj)
3811 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3812 Widget_Data *wd = elm_widget_data_get(obj);
3813 Eina_List *list = NULL;
3815 Eina_Bool done = EINA_FALSE;
3816 if (!wd) return NULL;
3817 EINA_INLIST_FOREACH(wd->blocks, itb)
3825 EINA_LIST_FOREACH(itb->items, l, it)
3827 if (it->realized) list = eina_list_append(list, it);
3839 elm_genlist_at_xy_item_get(const Evas_Object *obj,
3844 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3845 Widget_Data *wd = elm_widget_data_get(obj);
3846 Evas_Coord ox, oy, ow, oh;
3849 if (!wd) return NULL;
3850 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
3852 EINA_INLIST_FOREACH(wd->blocks, itb)
3857 if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
3858 oy + itb->y - itb->wd->pan_y,
3859 itb->w, itb->h, x, y, 1, 1))
3861 EINA_LIST_FOREACH(itb->items, l, it)
3863 Evas_Coord itx, ity;
3865 itx = ox + itb->x + it->x - itb->wd->pan_x;
3866 ity = oy + itb->y + it->y - itb->wd->pan_y;
3867 if (ELM_RECTS_INTERSECT(itx, ity, it->item->w, it->item->h, x, y, 1, 1))
3871 if (y <= (ity + (it->item->h / 4))) *posret = -1;
3872 else if (y >= (ity + it->item->h - (it->item->h / 4)))
3878 lasty = ity + it->item->h;
3883 if (y > lasty) *posret = 1;
3890 elm_genlist_first_item_get(const Evas_Object *obj)
3892 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3893 Widget_Data *wd = elm_widget_data_get(obj);
3894 if (!wd) return NULL;
3895 if (!wd->items) return NULL;
3896 Elm_Gen_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
3897 while ((it) && (it->delete_me))
3898 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3903 elm_genlist_last_item_get(const Evas_Object *obj)
3905 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3906 Widget_Data *wd = elm_widget_data_get(obj);
3907 if (!wd) return NULL;
3908 if (!wd->items) return NULL;
3909 Elm_Gen_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
3910 while ((it) && (it->delete_me))
3911 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3916 elm_genlist_item_next_get(const Elm_Gen_Item *it)
3918 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3921 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3922 if ((it) && (!it->delete_me)) break;
3924 return (Elm_Gen_Item *)it;
3928 elm_genlist_item_prev_get(const Elm_Gen_Item *it)
3930 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3933 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3934 if ((it) && (!it->delete_me)) break;
3936 return (Elm_Gen_Item *)it;
3940 elm_genlist_item_genlist_get(const Elm_Gen_Item *it)
3942 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3947 elm_genlist_item_parent_get(const Elm_Gen_Item *it)
3949 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3954 elm_genlist_item_subitems_clear(Elm_Gen_Item *it)
3956 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3957 Eina_List *tl = NULL, *l;
3960 EINA_LIST_FOREACH(it->item->items, l, it2)
3961 tl = eina_list_append(tl, it2);
3962 EINA_LIST_FREE(tl, it2)
3963 elm_genlist_item_del(it2);
3967 elm_genlist_item_selected_set(Elm_Gen_Item *it,
3970 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3971 Widget_Data *wd = it->wd;
3973 if ((it->delete_me) || (it->disabled)) return;
3974 selected = !!selected;
3975 if (it->selected == selected) return;
3981 while (wd->selected)
3983 _item_unhighlight(wd->selected->data);
3984 _item_unselect(wd->selected->data);
3987 _item_highlight(it);
3992 _item_unhighlight(it);
3998 elm_genlist_item_selected_get(const Elm_Gen_Item *it)
4000 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4001 return it->selected;
4005 elm_genlist_item_expanded_set(Elm_Gen_Item *it,
4008 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4009 if (it->item->expanded == expanded) return;
4010 it->item->expanded = expanded;
4011 it->wd->expanded_item = it;
4012 if (it->item->expanded)
4015 edje_object_signal_emit(VIEW(it), "elm,state,expanded", "elm");
4016 evas_object_smart_callback_call(WIDGET(it), SIG_EXPANDED, it);
4017 it->wd->auto_scroll_enabled = EINA_TRUE;
4022 edje_object_signal_emit(VIEW(it), "elm,state,contracted", "elm");
4023 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACTED, it);
4024 it->wd->auto_scroll_enabled = EINA_FALSE;
4029 elm_genlist_item_expanded_get(const Elm_Gen_Item *it)
4031 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4032 return it->item->expanded;
4036 elm_genlist_item_expanded_depth_get(const Elm_Gen_Item *it)
4038 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, 0);
4039 return it->item->expanded_depth;
4043 elm_genlist_item_disabled_set(Elm_Gen_Item *it,
4046 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4049 if (it->disabled == disabled) return;
4050 if (it->delete_me) return;
4051 it->disabled = !!disabled;
4053 elm_genlist_item_selected_set(it, EINA_FALSE);
4057 edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
4059 edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm");
4060 EINA_LIST_FOREACH(it->icon_objs, l, obj)
4061 elm_widget_disabled_set(obj, disabled);
4066 elm_genlist_item_disabled_get(const Elm_Gen_Item *it)
4068 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4069 if (it->delete_me) return EINA_FALSE;
4070 return it->disabled;
4074 elm_genlist_item_display_only_set(Elm_Gen_Item *it,
4075 Eina_Bool display_only)
4077 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4078 if (it->display_only == display_only) return;
4079 if (it->delete_me) return;
4080 it->display_only = display_only;
4081 it->item->mincalcd = EINA_FALSE;
4082 it->item->updateme = EINA_TRUE;
4083 if (it->item->block) it->item->block->updateme = EINA_TRUE;
4084 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4085 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4089 elm_genlist_item_display_only_get(const Elm_Gen_Item *it)
4091 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4092 if (it->delete_me) return EINA_FALSE;
4093 return it->display_only;
4097 elm_genlist_item_show(Elm_Gen_Item *it)
4099 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4100 Evas_Coord gith = 0;
4101 if (it->delete_me) return;
4102 if ((it->item->queued) || (!it->item->mincalcd))
4104 it->wd->show_item = it;
4105 it->wd->bring_in = EINA_TRUE;
4106 it->item->showme = EINA_TRUE;
4109 if (it->wd->show_item)
4111 it->wd->show_item->item->showme = EINA_FALSE;
4112 it->wd->show_item = NULL;
4114 if ((it->item->group_item) && (it->wd->pan_y > (it->y + it->item->block->y)))
4115 gith = it->item->group_item->item->h;
4116 elm_smart_scroller_child_region_show(it->wd->scr,
4117 it->x + it->item->block->x,
4118 it->y + it->item->block->y - gith,
4119 it->item->block->w, it->item->h);
4123 elm_genlist_item_bring_in(Elm_Gen_Item *it)
4125 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4126 Evas_Coord gith = 0;
4127 if (it->delete_me) return;
4128 if ((it->item->queued) || (!it->item->mincalcd))
4130 it->wd->show_item = it;
4131 it->wd->bring_in = EINA_TRUE;
4132 it->item->showme = EINA_TRUE;
4135 if (it->wd->show_item)
4137 it->wd->show_item->item->showme = EINA_FALSE;
4138 it->wd->show_item = NULL;
4140 if ((it->item->group_item) && (it->wd->pan_y > (it->y + it->item->block->y)))
4141 gith = it->item->group_item->item->h;
4142 elm_smart_scroller_region_bring_in(it->wd->scr,
4143 it->x + it->item->block->x,
4144 it->y + it->item->block->y - gith,
4145 it->item->block->w, it->item->h);
4149 elm_genlist_item_top_show(Elm_Gen_Item *it)
4151 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4153 Evas_Coord gith = 0;
4155 if (it->delete_me) return;
4156 if ((it->item->queued) || (!it->item->mincalcd))
4158 it->wd->show_item = it;
4159 it->wd->bring_in = EINA_TRUE;
4160 it->item->showme = EINA_TRUE;
4163 if (it->wd->show_item)
4165 it->wd->show_item->item->showme = EINA_FALSE;
4166 it->wd->show_item = NULL;
4168 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4169 if (it->item->group_item) gith = it->item->group_item->item->h;
4170 elm_smart_scroller_child_region_show(it->wd->scr,
4171 it->x + it->item->block->x,
4172 it->y + it->item->block->y - gith,
4173 it->item->block->w, oh);
4177 elm_genlist_item_top_bring_in(Elm_Gen_Item *it)
4179 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4181 Evas_Coord gith = 0;
4183 if (it->delete_me) return;
4184 if ((it->item->queued) || (!it->item->mincalcd))
4186 it->wd->show_item = it;
4187 it->wd->bring_in = EINA_TRUE;
4188 it->item->showme = EINA_TRUE;
4191 if (it->wd->show_item)
4193 it->wd->show_item->item->showme = EINA_FALSE;
4194 it->wd->show_item = NULL;
4196 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4197 if (it->item->group_item) gith = it->item->group_item->item->h;
4198 elm_smart_scroller_region_bring_in(it->wd->scr,
4199 it->x + it->item->block->x,
4200 it->y + it->item->block->y - gith,
4201 it->item->block->w, oh);
4205 elm_genlist_item_middle_show(Elm_Gen_Item *it)
4207 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4210 if (it->delete_me) return;
4211 if ((it->item->queued) || (!it->item->mincalcd))
4213 it->wd->show_item = it;
4214 it->wd->bring_in = EINA_TRUE;
4215 it->item->showme = EINA_TRUE;
4218 if (it->wd->show_item)
4220 it->wd->show_item->item->showme = EINA_FALSE;
4221 it->wd->show_item = NULL;
4223 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4224 elm_smart_scroller_child_region_show(it->wd->scr,
4225 it->x + it->item->block->x,
4226 it->y + it->item->block->y - oh / 2 +
4227 it->item->h / 2, it->item->block->w, oh);
4231 elm_genlist_item_middle_bring_in(Elm_Gen_Item *it)
4233 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4236 if (it->delete_me) return;
4237 if ((it->item->queued) || (!it->item->mincalcd))
4239 it->wd->show_item = it;
4240 it->wd->bring_in = EINA_TRUE;
4241 it->item->showme = EINA_TRUE;
4244 if (it->wd->show_item)
4246 it->wd->show_item->item->showme = EINA_FALSE;
4247 it->wd->show_item = NULL;
4249 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4250 elm_smart_scroller_region_bring_in(it->wd->scr,
4251 it->x + it->item->block->x,
4252 it->y + it->item->block->y - oh / 2 + it->item->h / 2,
4253 it->item->block->w, oh);
4257 elm_genlist_item_del(Elm_Gen_Item *it)
4259 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4260 if ((it->relcount > 0) || (it->walking > 0))
4262 elm_genlist_item_subitems_clear(it);
4263 if (it->wd->show_item == it) it->wd->show_item = NULL;
4264 elm_gen_item_del_notserious(it);
4265 if (it->item->block)
4267 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE, (Ecore_Cb)_item_unrealize_cb);
4268 it->item->block->changed = EINA_TRUE;
4269 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
4270 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
4278 elm_genlist_item_data_set(Elm_Gen_Item *it,
4281 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4282 elm_widget_item_data_set(it, data);
4286 elm_genlist_item_data_get(const Elm_Gen_Item *it)
4288 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4289 return elm_widget_item_data_get(it);
4293 elm_genlist_item_icons_orphan(Elm_Gen_Item *it)
4296 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4297 EINA_LIST_FREE(it->icon_objs, icon)
4299 elm_widget_sub_object_del(WIDGET(it), icon);
4300 evas_object_smart_member_del(icon);
4301 evas_object_hide(icon);
4305 EAPI const Evas_Object *
4306 elm_genlist_item_object_get(const Elm_Gen_Item *it)
4308 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4313 elm_genlist_item_update(Elm_Gen_Item *it)
4315 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4316 if (!it->item->block) return;
4317 if (it->delete_me) return;
4318 it->item->mincalcd = EINA_FALSE;
4319 it->item->updateme = EINA_TRUE;
4320 it->item->block->updateme = EINA_TRUE;
4321 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4322 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4326 elm_genlist_item_item_class_update(Elm_Gen_Item *it,
4327 const Elm_Genlist_Item_Class *itc)
4329 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4330 if (!it->item->block) return;
4331 EINA_SAFETY_ON_NULL_RETURN(itc);
4332 if (it->delete_me) return;
4334 it->item->nocache = EINA_TRUE;
4335 elm_genlist_item_update(it);
4338 EAPI const Elm_Genlist_Item_Class *
4339 elm_genlist_item_item_class_get(const Elm_Gen_Item *it)
4341 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4342 if (it->delete_me) return NULL;
4346 static Evas_Object *
4347 _elm_genlist_item_label_create(void *data,
4348 Evas_Object *obj __UNUSED__,
4349 Evas_Object *tooltip,
4350 void *it __UNUSED__)
4352 Evas_Object *label = elm_label_add(tooltip);
4355 elm_object_style_set(label, "tooltip");
4356 elm_object_text_set(label, data);
4361 _elm_genlist_item_label_del_cb(void *data,
4362 Evas_Object *obj __UNUSED__,
4363 void *event_info __UNUSED__)
4365 eina_stringshare_del(data);
4369 elm_genlist_item_tooltip_text_set(Elm_Gen_Item *it,
4372 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4373 text = eina_stringshare_add(text);
4374 elm_genlist_item_tooltip_content_cb_set(it, _elm_genlist_item_label_create,
4376 _elm_genlist_item_label_del_cb);
4380 elm_genlist_item_tooltip_content_cb_set(Elm_Gen_Item *it,
4381 Elm_Tooltip_Item_Content_Cb func,
4383 Evas_Smart_Cb del_cb)
4385 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(it, error);
4387 if ((it->tooltip.content_cb == func) && (it->tooltip.data == data))
4390 if (it->tooltip.del_cb)
4391 it->tooltip.del_cb((void *)it->tooltip.data,
4394 it->tooltip.content_cb = func;
4395 it->tooltip.data = data;
4396 it->tooltip.del_cb = del_cb;
4400 elm_widget_item_tooltip_content_cb_set(it,
4401 it->tooltip.content_cb,
4402 it->tooltip.data, NULL);
4403 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
4404 elm_widget_item_tooltip_size_restrict_disable(it, it->tooltip.free_size);
4410 if (del_cb) del_cb((void *)data, NULL, NULL);
4414 elm_genlist_item_tooltip_unset(Elm_Gen_Item *it)
4416 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4417 if ((VIEW(it)) && (it->tooltip.content_cb))
4418 elm_widget_item_tooltip_unset(it);
4420 if (it->tooltip.del_cb)
4421 it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
4422 it->tooltip.del_cb = NULL;
4423 it->tooltip.content_cb = NULL;
4424 it->tooltip.data = NULL;
4425 it->tooltip.free_size = EINA_FALSE;
4426 if (it->tooltip.style)
4427 elm_genlist_item_tooltip_style_set(it, NULL);
4431 elm_genlist_item_tooltip_style_set(Elm_Gen_Item *it,
4434 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4435 eina_stringshare_replace(&it->tooltip.style, style);
4436 if (VIEW(it)) elm_widget_item_tooltip_style_set(it, style);
4440 elm_genlist_item_tooltip_style_get(const Elm_Gen_Item *it)
4442 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4443 return it->tooltip.style;
4447 elm_genlist_item_tooltip_size_restrict_disable(Elm_Gen_Item *it, Eina_Bool disable)
4449 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4450 it->tooltip.free_size = disable;
4451 if (VIEW(it)) return elm_widget_item_tooltip_size_restrict_disable(it, disable);
4456 elm_genlist_item_tooltip_size_restrict_disabled_get(const Elm_Gen_Item *it)
4458 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4459 return it->tooltip.free_size;
4463 elm_genlist_item_cursor_set(Elm_Gen_Item *it,
4466 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4467 eina_stringshare_replace(&it->mouse_cursor, cursor);
4468 if (VIEW(it)) elm_widget_item_cursor_set(it, cursor);
4472 elm_genlist_item_cursor_get(const Elm_Gen_Item *it)
4474 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4475 return elm_widget_item_cursor_get(it);
4479 elm_genlist_item_cursor_unset(Elm_Gen_Item *it)
4481 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4482 if (!it->mouse_cursor)
4486 elm_widget_item_cursor_unset(it);
4488 eina_stringshare_del(it->mouse_cursor);
4489 it->mouse_cursor = NULL;
4493 elm_genlist_item_cursor_style_set(Elm_Gen_Item *it,
4496 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4497 elm_widget_item_cursor_style_set(it, style);
4501 elm_genlist_item_cursor_style_get(const Elm_Gen_Item *it)
4503 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4504 return elm_widget_item_cursor_style_get(it);
4508 elm_genlist_item_cursor_engine_only_set(Elm_Gen_Item *it,
4509 Eina_Bool engine_only)
4511 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4512 elm_widget_item_cursor_engine_only_set(it, engine_only);
4516 elm_genlist_item_cursor_engine_only_get(const Elm_Gen_Item *it)
4518 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4519 return elm_widget_item_cursor_engine_only_get(it);
4523 elm_genlist_horizontal_set(Evas_Object *obj,
4526 ELM_CHECK_WIDTYPE(obj, widtype);
4527 Widget_Data *wd = elm_widget_data_get(obj);
4529 if (wd->mode == mode) return;
4535 elm_genlist_horizontal_mode_set(Evas_Object *obj,
4538 elm_genlist_horizontal_set(obj, mode);
4542 elm_genlist_horizontal_get(const Evas_Object *obj)
4544 ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
4545 Widget_Data *wd = elm_widget_data_get(obj);
4546 if (!wd) return ELM_LIST_LAST;
4551 elm_genlist_horizontal_mode_get(const Evas_Object *obj)
4553 return elm_genlist_horizontal_get(obj);
4557 elm_genlist_always_select_mode_set(Evas_Object *obj,
4558 Eina_Bool always_select)
4560 ELM_CHECK_WIDTYPE(obj, widtype);
4561 Widget_Data *wd = elm_widget_data_get(obj);
4563 wd->always_select = always_select;
4567 elm_genlist_always_select_mode_get(const Evas_Object *obj)
4569 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4570 Widget_Data *wd = elm_widget_data_get(obj);
4571 if (!wd) return EINA_FALSE;
4572 return wd->always_select;
4576 elm_genlist_no_select_mode_set(Evas_Object *obj,
4577 Eina_Bool no_select)
4579 ELM_CHECK_WIDTYPE(obj, widtype);
4580 Widget_Data *wd = elm_widget_data_get(obj);
4582 wd->no_select = no_select;
4586 elm_genlist_no_select_mode_get(const Evas_Object *obj)
4588 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4589 Widget_Data *wd = elm_widget_data_get(obj);
4590 if (!wd) return EINA_FALSE;
4591 return wd->no_select;
4595 elm_genlist_compress_mode_set(Evas_Object *obj,
4598 ELM_CHECK_WIDTYPE(obj, widtype);
4599 Widget_Data *wd = elm_widget_data_get(obj);
4601 wd->compress = compress;
4602 if (!compress) elm_genlist_homogeneous_set(obj, EINA_FALSE);
4606 elm_genlist_compress_mode_get(const Evas_Object *obj)
4608 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4609 Widget_Data *wd = elm_widget_data_get(obj);
4610 if (!wd) return EINA_FALSE;
4611 return wd->compress;
4615 elm_genlist_height_for_width_mode_set(Evas_Object *obj,
4616 Eina_Bool height_for_width)
4618 ELM_CHECK_WIDTYPE(obj, widtype);
4619 Widget_Data *wd = elm_widget_data_get(obj);
4621 wd->height_for_width = !!height_for_width;
4622 if (wd->height_for_width)
4624 elm_genlist_homogeneous_set(obj, EINA_FALSE);
4625 elm_genlist_compress_mode_set(obj, EINA_TRUE);
4630 elm_genlist_height_for_width_mode_get(const Evas_Object *obj)
4632 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4633 Widget_Data *wd = elm_widget_data_get(obj);
4634 if (!wd) return EINA_FALSE;
4635 return wd->height_for_width;
4639 elm_genlist_bounce_set(Evas_Object *obj,
4643 ELM_CHECK_WIDTYPE(obj, widtype);
4644 Widget_Data *wd = elm_widget_data_get(obj);
4646 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
4650 elm_genlist_bounce_get(const Evas_Object *obj,
4651 Eina_Bool *h_bounce,
4652 Eina_Bool *v_bounce)
4654 ELM_CHECK_WIDTYPE(obj, widtype);
4655 Widget_Data *wd = elm_widget_data_get(obj);
4657 elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce);
4661 elm_genlist_homogeneous_set(Evas_Object *obj,
4662 Eina_Bool homogeneous)
4664 ELM_CHECK_WIDTYPE(obj, widtype);
4665 Widget_Data *wd = elm_widget_data_get(obj);
4667 if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
4668 wd->homogeneous = homogeneous;
4672 elm_genlist_homogeneous_get(const Evas_Object *obj)
4674 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4675 Widget_Data *wd = elm_widget_data_get(obj);
4676 if (!wd) return EINA_FALSE;
4677 return wd->homogeneous;
4681 elm_genlist_block_count_set(Evas_Object *obj,
4684 ELM_CHECK_WIDTYPE(obj, widtype);
4685 Widget_Data *wd = elm_widget_data_get(obj);
4687 wd->max_items_per_block = n;
4688 wd->item_cache_max = wd->max_items_per_block * 2;
4689 _item_cache_clean(wd);
4693 elm_genlist_block_count_get(const Evas_Object *obj)
4695 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4696 Widget_Data *wd = elm_widget_data_get(obj);
4698 return wd->max_items_per_block;
4702 elm_genlist_longpress_timeout_set(Evas_Object *obj,
4705 ELM_CHECK_WIDTYPE(obj, widtype);
4706 Widget_Data *wd = elm_widget_data_get(obj);
4708 wd->longpress_timeout = timeout;
4712 elm_genlist_longpress_timeout_get(const Evas_Object *obj)
4714 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4715 Widget_Data *wd = elm_widget_data_get(obj);
4717 return wd->longpress_timeout;
4721 elm_genlist_scroller_policy_set(Evas_Object *obj,
4722 Elm_Scroller_Policy policy_h,
4723 Elm_Scroller_Policy policy_v)
4725 ELM_CHECK_WIDTYPE(obj, widtype);
4726 Widget_Data *wd = elm_widget_data_get(obj);
4727 if ((!wd) || (!wd->scr)) return;
4728 if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
4729 (policy_v >= ELM_SCROLLER_POLICY_LAST))
4731 elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
4735 elm_genlist_scroller_policy_get(const Evas_Object *obj,
4736 Elm_Scroller_Policy *policy_h,
4737 Elm_Scroller_Policy *policy_v)
4739 ELM_CHECK_WIDTYPE(obj, widtype);
4740 Widget_Data *wd = elm_widget_data_get(obj);
4741 Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
4742 if ((!wd) || (!wd->scr)) return;
4743 elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
4744 if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
4745 if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
4749 elm_genlist_realized_items_update(Evas_Object *obj)
4751 ELM_CHECK_WIDTYPE(obj, widtype);
4753 Eina_List *list, *l;
4756 list = elm_genlist_realized_items_get(obj);
4757 EINA_LIST_FOREACH(list, l, it)
4758 elm_genlist_item_update(it);
4762 elm_genlist_item_mode_set(Elm_Gen_Item *it,
4763 const char *mode_type,
4766 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4767 Widget_Data *wd = it->wd;
4772 if (!mode_type) return;
4773 if ((it->delete_me) || (it->disabled)) return;
4775 if ((wd->mode_item == it) &&
4776 (!strcmp(mode_type, wd->mode_type)) &&
4779 if (!wd->mode_item_style) return;
4783 EINA_LIST_FOREACH(wd->selected, l, it2)
4785 elm_genlist_item_selected_set(it2, EINA_FALSE);
4789 it2 = elm_genlist_selected_item_get(wd->obj);
4790 if ((it2) && (it2->realized))
4791 elm_genlist_item_selected_set(it2, EINA_FALSE);
4794 if (((wd->mode_type) && (strcmp(mode_type, wd->mode_type))) ||
4796 ((it == wd->mode_item) && (!mode_set)))
4797 _item_mode_unset(wd);
4799 eina_stringshare_replace(&wd->mode_type, mode_type);
4800 if (mode_set) _item_mode_set(it);
4805 elm_genlist_mode_item_style_get(const Evas_Object *obj)
4807 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4808 Widget_Data *wd = elm_widget_data_get(obj);
4809 if (!wd) return NULL;
4810 return wd->mode_item_style;
4814 elm_genlist_mode_item_style_set(Evas_Object *obj, const char *style)
4816 ELM_CHECK_WIDTYPE(obj, widtype);
4817 Widget_Data *wd = elm_widget_data_get(obj);
4819 if ((style == wd->mode_item_style) || (style && wd->mode_item_style &&
4820 (!strcmp(style, wd->mode_item_style))))
4822 eina_stringshare_replace(&wd->mode_item_style, style);
4823 elm_genlist_realized_items_update(obj);
4827 elm_genlist_mode_get(const Evas_Object *obj)
4829 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4830 Widget_Data *wd = elm_widget_data_get(obj);
4831 if (!wd) return NULL;
4832 return wd->mode_type;
4835 EAPI const Elm_Gen_Item *
4836 elm_genlist_mode_item_get(const Evas_Object *obj)
4838 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4839 Widget_Data *wd = elm_widget_data_get(obj);
4840 if (!wd) return NULL;
4841 return wd->mode_item;
4845 elm_genlist_reorder_mode_set(Evas_Object *obj,
4846 Eina_Bool reorder_mode)
4848 ELM_CHECK_WIDTYPE(obj, widtype);
4849 Widget_Data *wd = elm_widget_data_get(obj);
4851 wd->reorder_mode = reorder_mode;
4855 elm_genlist_reorder_mode_get(const Evas_Object *obj)
4857 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4858 Widget_Data *wd = elm_widget_data_get(obj);
4859 if (!wd) return EINA_FALSE;
4860 return wd->reorder_mode;