3 #include <Elementary.h>
4 #include <Elementary_Cursor.h>
8 #define MAX_ITEMS_PER_BLOCK 32
9 #define REORDER_EFFECT_TIME 0.5
11 typedef struct _Widget_Data Widget_Data;
12 typedef struct _Item_Block Item_Block;
13 typedef struct _Pan Pan;
14 typedef struct _Item_Cache Item_Cache;
18 Evas_Object *obj, *scr, *pan_smart;
19 Eina_Inlist *items, *blocks;
20 Eina_List *group_items;
22 Evas_Coord pan_x, pan_y, old_pan_y, w, h, minw, minh, realminw, prev_viewport_w;
23 Ecore_Job *calc_job, *update_job;
24 Ecore_Idle_Enterer *queue_idle_enterer;
25 Ecore_Idler *must_recalc_idler;
26 Eina_List *queue, *selected;
27 Elm_Genlist_Item *show_item, *last_selected_item, *anchor_item, *mode_item, *reorder_it, *reorder_rel, *expanded_item;
28 Eina_Inlist *item_cache;
29 Evas_Coord anchor_y, reorder_start_y;
31 Ecore_Timer *multi_timer, *scr_hold_timer;
32 Ecore_Animator *reorder_move_animator;
33 const char *mode_type;
34 unsigned int start_time;
35 Evas_Coord prev_x, prev_y, prev_mx, prev_my;
36 Evas_Coord cur_x, cur_y, cur_mx, cur_my;
37 Eina_Bool mouse_down : 1;
38 Eina_Bool multi_down : 1;
39 Eina_Bool multi_timeout : 1;
40 Eina_Bool multitouched : 1;
41 Eina_Bool on_hold : 1;
43 Eina_Bool always_select : 1;
44 Eina_Bool longpressed : 1;
45 Eina_Bool wasselected : 1;
46 Eina_Bool no_select : 1;
47 Eina_Bool bring_in : 1;
48 Eina_Bool compress : 1;
49 Eina_Bool height_for_width : 1;
50 Eina_Bool homogeneous : 1;
51 Eina_Bool clear_me : 1;
53 Eina_Bool reorder_mode : 1;
54 Eina_Bool reorder_pan_move : 1;
55 Eina_Bool auto_scroll_enabled : 1;
59 } history[SWIPE_MOVES];
68 int group_item_height;
69 int max_items_per_block;
70 double longpress_timeout;
81 Evas_Coord x, y, w, h, minw, minh;
82 Eina_Bool want_unrealize : 1;
83 Eina_Bool realized : 1;
84 Eina_Bool changed : 1;
85 Eina_Bool updateme : 1;
87 Eina_Bool must_recalc : 1;
90 struct _Elm_Genlist_Item
97 Evas_Coord x, y, w, h, minw, minh;
98 const Elm_Genlist_Item_Class *itc;
99 Elm_Genlist_Item *parent;
100 Elm_Genlist_Item *group_item;
101 Elm_Genlist_Item_Flags flags;
109 Eina_List *labels, *icons, *states, *icon_objs;
110 Eina_List *mode_labels, *mode_icons, *mode_states, *mode_icon_objs;
111 Ecore_Timer *long_timer;
112 Ecore_Timer *swipe_timer;
114 Evas_Coord scrl_x, scrl_y, old_scrl_y;
116 Elm_Genlist_Item *rel;
117 Evas_Object *mode_view;
122 Elm_Tooltip_Item_Content_Cb content_cb;
123 Evas_Smart_Cb del_cb;
125 Eina_Bool free_size : 1;
128 const char *mouse_cursor;
135 Eina_Bool before : 1;
137 Eina_Bool want_unrealize : 1;
138 Eina_Bool want_realize : 1;
139 Eina_Bool realized : 1;
140 Eina_Bool selected : 1;
141 Eina_Bool highlighted : 1;
142 Eina_Bool expanded : 1;
143 Eina_Bool disabled : 1;
144 Eina_Bool display_only : 1;
145 Eina_Bool mincalcd : 1;
146 Eina_Bool queued : 1;
147 Eina_Bool showme : 1;
148 Eina_Bool delete_me : 1;
150 Eina_Bool dragging : 1;
151 Eina_Bool updateme : 1;
152 Eina_Bool nocache : 1;
153 Eina_Bool stacking_even : 1;
154 Eina_Bool nostacking : 1;
155 Eina_Bool move_effect_enabled : 1;
162 Evas_Object *base_view, *spacer;
164 const char *item_style; // it->itc->item_style
165 Eina_Bool tree : 1; // it->flags & ELM_GENLIST_ITEM_SUBITEMS
166 Eina_Bool compress : 1; // it->wd->compress
168 Eina_Bool selected : 1; // it->selected
169 Eina_Bool disabled : 1; // it->disabled
170 Eina_Bool expanded : 1; // it->expanded
173 #define ELM_GENLIST_ITEM_FROM_INLIST(item) \
174 ((item) ? EINA_INLIST_CONTAINER_GET(item, Elm_Genlist_Item) : NULL)
178 Evas_Object_Smart_Clipped_Data __clipped_data;
180 Ecore_Job *resize_job;
183 static const char *widtype = NULL;
184 static void _item_cache_zero(Widget_Data *wd);
185 static void _del_hook(Evas_Object *obj);
186 static void _mirrored_set(Evas_Object *obj,
188 static void _theme_hook(Evas_Object *obj);
189 static void _show_region_hook(void *data,
191 static void _sizing_eval(Evas_Object *obj);
192 static void _item_realize(Elm_Genlist_Item *it,
195 static void _item_unrealize(Elm_Genlist_Item *it,
197 static void _item_block_unrealize(Item_Block *itb);
198 static void _calc_job(void *data);
199 static void _on_focus_hook(void *data,
201 static Eina_Bool _item_multi_select_up(Widget_Data *wd);
202 static Eina_Bool _item_multi_select_down(Widget_Data *wd);
203 static Eina_Bool _item_single_select_up(Widget_Data *wd);
204 static Eina_Bool _item_single_select_down(Widget_Data *wd);
205 static Eina_Bool _event_hook(Evas_Object *obj,
207 Evas_Callback_Type type,
209 static void _signal_emit_hook(Evas_Object *obj,
210 const char *emission,
212 static Eina_Bool _deselect_all_items(Widget_Data *wd);
213 static void _pan_calculate(Evas_Object *obj);
214 static void _item_position(Elm_Genlist_Item *it,
218 static void _mode_item_realize(Elm_Genlist_Item *it);
219 static void _mode_item_unrealize(Elm_Genlist_Item *it);
220 static void _item_mode_set(Elm_Genlist_Item *it);
221 static void _item_mode_unset(Widget_Data *wd);
222 static void _group_items_recalc(void *data);
223 static void _item_move_after(Elm_Genlist_Item *it,
224 Elm_Genlist_Item *after);
225 static void _item_move_before(Elm_Genlist_Item *it,
226 Elm_Genlist_Item *before);
227 static void _item_auto_scroll(Widget_Data *wd);
229 static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
231 static const char SIG_ACTIVATED[] = "activated";
232 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
233 static const char SIG_SELECTED[] = "selected";
234 static const char SIG_UNSELECTED[] = "unselected";
235 static const char SIG_EXPANDED[] = "expanded";
236 static const char SIG_CONTRACTED[] = "contracted";
237 static const char SIG_EXPAND_REQUEST[] = "expand,request";
238 static const char SIG_CONTRACT_REQUEST[] = "contract,request";
239 static const char SIG_REALIZED[] = "realized";
240 static const char SIG_UNREALIZED[] = "unrealized";
241 static const char SIG_DRAG_START_UP[] = "drag,start,up";
242 static const char SIG_DRAG_START_DOWN[] = "drag,start,down";
243 static const char SIG_DRAG_START_LEFT[] = "drag,start,left";
244 static const char SIG_DRAG_START_RIGHT[] = "drag,start,right";
245 static const char SIG_DRAG_STOP[] = "drag,stop";
246 static const char SIG_DRAG[] = "drag";
247 static const char SIG_LONGPRESSED[] = "longpressed";
248 static const char SIG_SCROLL_EDGE_TOP[] = "scroll,edge,top";
249 static const char SIG_SCROLL_EDGE_BOTTOM[] = "scroll,edge,bottom";
250 static const char SIG_SCROLL_EDGE_LEFT[] = "scroll,edge,left";
251 static const char SIG_SCROLL_EDGE_RIGHT[] = "scroll,edge,right";
252 static const char SIG_MULTI_SWIPE_LEFT[] = "multi,swipe,left";
253 static const char SIG_MULTI_SWIPE_RIGHT[] = "multi,swipe,right";
254 static const char SIG_MULTI_SWIPE_UP[] = "multi,swipe,up";
255 static const char SIG_MULTI_SWIPE_DOWN[] = "multi,swipe,down";
256 static const char SIG_MULTI_PINCH_OUT[] = "multi,pinch,out";
257 static const char SIG_MULTI_PINCH_IN[] = "multi,pinch,in";
258 static const char SIG_SWIPE[] = "swipe";
260 static const Evas_Smart_Cb_Description _signals[] = {
261 {SIG_CLICKED_DOUBLE, ""},
264 {SIG_UNSELECTED, ""},
266 {SIG_CONTRACTED, ""},
267 {SIG_EXPAND_REQUEST, ""},
268 {SIG_CONTRACT_REQUEST, ""},
270 {SIG_UNREALIZED, ""},
271 {SIG_DRAG_START_UP, ""},
272 {SIG_DRAG_START_DOWN, ""},
273 {SIG_DRAG_START_LEFT, ""},
274 {SIG_DRAG_START_RIGHT, ""},
277 {SIG_LONGPRESSED, ""},
278 {SIG_SCROLL_EDGE_TOP, ""},
279 {SIG_SCROLL_EDGE_BOTTOM, ""},
280 {SIG_SCROLL_EDGE_LEFT, ""},
281 {SIG_SCROLL_EDGE_RIGHT, ""},
282 {SIG_MULTI_SWIPE_LEFT, ""},
283 {SIG_MULTI_SWIPE_RIGHT, ""},
284 {SIG_MULTI_SWIPE_UP, ""},
285 {SIG_MULTI_SWIPE_DOWN, ""},
286 {SIG_MULTI_PINCH_OUT, ""},
287 {SIG_MULTI_PINCH_IN, ""},
292 static Eina_Compare_Cb _elm_genlist_item_compare_cb;
293 static Eina_Compare_Cb _elm_genlist_item_compare_data_cb;
296 _event_hook(Evas_Object *obj,
297 Evas_Object *src __UNUSED__,
298 Evas_Callback_Type type,
301 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
302 Evas_Event_Key_Down *ev = event_info;
303 Widget_Data *wd = elm_widget_data_get(obj);
304 if (!wd) return EINA_FALSE;
305 if (!wd->items) return EINA_FALSE;
306 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
307 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
309 Elm_Genlist_Item *it = NULL;
312 Evas_Coord step_x = 0;
313 Evas_Coord step_y = 0;
316 Evas_Coord page_x = 0;
317 Evas_Coord page_y = 0;
319 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
320 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
321 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
322 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
324 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
328 else if ((!strcmp(ev->keyname, "Right")) ||
329 (!strcmp(ev->keyname, "KP_Right")))
333 else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
335 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
336 (_item_multi_select_up(wd)))
337 || (_item_single_select_up(wd)))
339 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
345 else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
347 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
348 (_item_multi_select_down(wd)))
349 || (_item_single_select_down(wd)))
351 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
357 else if ((!strcmp(ev->keyname, "Home")) ||
358 (!strcmp(ev->keyname, "KP_Home")))
360 it = elm_genlist_first_item_get(obj);
361 elm_genlist_item_bring_in(it);
362 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
365 else if ((!strcmp(ev->keyname, "End")) ||
366 (!strcmp(ev->keyname, "KP_End")))
368 it = elm_genlist_last_item_get(obj);
369 elm_genlist_item_bring_in(it);
370 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
373 else if ((!strcmp(ev->keyname, "Prior")) ||
374 (!strcmp(ev->keyname, "KP_Prior")))
377 y -= -(page_y * v_h) / 100;
381 else if ((!strcmp(ev->keyname, "Next")) ||
382 (!strcmp(ev->keyname, "KP_Next")))
385 y += -(page_y * v_h) / 100;
389 else if (((!strcmp(ev->keyname, "Return")) ||
390 (!strcmp(ev->keyname, "KP_Enter")) ||
391 (!strcmp(ev->keyname, "space")))
392 && (!wd->multi) && (wd->selected))
394 it = elm_genlist_selected_item_get(obj);
395 elm_genlist_item_expanded_set(it,
396 !elm_genlist_item_expanded_get(it));
397 evas_object_smart_callback_call(it->base.widget, SIG_ACTIVATED, it);
399 else if (!strcmp(ev->keyname, "Escape"))
401 if (!_deselect_all_items(wd)) return EINA_FALSE;
402 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
405 else return EINA_FALSE;
407 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
408 elm_smart_scroller_child_pos_set(wd->scr, x, y);
413 _deselect_all_items(Widget_Data *wd)
415 if (!wd->selected) return EINA_FALSE;
417 elm_genlist_item_selected_set(wd->selected->data, EINA_FALSE);
423 _item_multi_select_up(Widget_Data *wd)
425 if (!wd->selected) return EINA_FALSE;
426 if (!wd->multi) return EINA_FALSE;
428 Elm_Genlist_Item *prev = elm_genlist_item_prev_get(wd->last_selected_item);
429 if (!prev) return EINA_TRUE;
431 if (elm_genlist_item_selected_get(prev))
433 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
434 wd->last_selected_item = prev;
435 elm_genlist_item_show(wd->last_selected_item);
439 elm_genlist_item_selected_set(prev, EINA_TRUE);
440 elm_genlist_item_show(prev);
446 _item_multi_select_down(Widget_Data *wd)
448 if (!wd->selected) return EINA_FALSE;
449 if (!wd->multi) return EINA_FALSE;
451 Elm_Genlist_Item *next = elm_genlist_item_next_get(wd->last_selected_item);
452 if (!next) return EINA_TRUE;
454 if (elm_genlist_item_selected_get(next))
456 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
457 wd->last_selected_item = next;
458 elm_genlist_item_show(wd->last_selected_item);
462 elm_genlist_item_selected_set(next, EINA_TRUE);
463 elm_genlist_item_show(next);
469 _item_single_select_up(Widget_Data *wd)
471 Elm_Genlist_Item *prev;
474 prev = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
475 while ((prev) && (prev->delete_me))
476 prev = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
478 else prev = elm_genlist_item_prev_get(wd->last_selected_item);
480 if (!prev) return EINA_FALSE;
482 _deselect_all_items(wd);
484 elm_genlist_item_selected_set(prev, EINA_TRUE);
485 elm_genlist_item_show(prev);
490 _item_single_select_down(Widget_Data *wd)
492 Elm_Genlist_Item *next;
495 next = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
496 while ((next) && (next->delete_me))
497 next = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
499 else next = elm_genlist_item_next_get(wd->last_selected_item);
501 if (!next) return EINA_FALSE;
503 _deselect_all_items(wd);
505 elm_genlist_item_selected_set(next, EINA_TRUE);
506 elm_genlist_item_show(next);
511 _on_focus_hook(void *data __UNUSED__,
514 Widget_Data *wd = elm_widget_data_get(obj);
516 if (elm_widget_focus_get(obj))
518 elm_object_signal_emit(wd->obj, "elm,action,focus", "elm");
519 evas_object_focus_set(wd->obj, EINA_TRUE);
520 if ((wd->selected) && (!wd->last_selected_item))
521 wd->last_selected_item = eina_list_data_get(wd->selected);
525 elm_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
526 evas_object_focus_set(wd->obj, EINA_FALSE);
531 _del_hook(Evas_Object *obj)
533 Widget_Data *wd = elm_widget_data_get(obj);
535 _item_cache_zero(wd);
536 if (wd->calc_job) ecore_job_del(wd->calc_job);
537 if (wd->update_job) ecore_job_del(wd->update_job);
538 if (wd->queue_idle_enterer) ecore_idle_enterer_del(wd->queue_idle_enterer);
539 if (wd->must_recalc_idler) ecore_idler_del(wd->must_recalc_idler);
540 if (wd->multi_timer) ecore_timer_del(wd->multi_timer);
541 if (wd->mode_type) eina_stringshare_del(wd->mode_type);
542 if (wd->scr_hold_timer) ecore_timer_del(wd->scr_hold_timer);
547 _del_pre_hook(Evas_Object *obj)
549 Widget_Data *wd = elm_widget_data_get(obj);
551 evas_object_del(wd->pan_smart);
552 wd->pan_smart = NULL;
553 elm_genlist_clear(obj);
557 _mirrored_set(Evas_Object *obj,
560 Widget_Data *wd = elm_widget_data_get(obj);
562 _item_cache_zero(wd);
563 elm_smart_scroller_mirrored_set(wd->scr, rtl);
567 _theme_hook(Evas_Object *obj)
569 Widget_Data *wd = elm_widget_data_get(obj);
572 evas_event_freeze(evas_object_evas_get(wd->obj));
573 _item_cache_zero(wd);
574 _elm_widget_mirrored_reload(obj);
575 _mirrored_set(obj, elm_widget_mirrored_get(obj));
576 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
577 elm_widget_style_get(obj));
578 edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
579 wd->item_width = wd->item_height = 0;
580 wd->group_item_width = wd->group_item_height = 0;
581 wd->minw = wd->minh = wd->realminw = 0;
582 EINA_INLIST_FOREACH(wd->blocks, itb)
585 Elm_Genlist_Item *it;
587 if (itb->realized) _item_block_unrealize(itb);
588 EINA_LIST_FOREACH(itb->items, l, it)
589 it->mincalcd = EINA_FALSE;
591 itb->changed = EINA_TRUE;
593 if (wd->calc_job) ecore_job_del(wd->calc_job);
594 wd->calc_job = ecore_job_add(_calc_job, wd);
596 evas_event_thaw(evas_object_evas_get(wd->obj));
597 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
601 _show_region_hook(void *data,
604 Widget_Data *wd = elm_widget_data_get(data);
605 Evas_Coord x, y, w, h;
607 elm_widget_show_region_get(obj, &x, &y, &w, &h);
608 //x & y are screen coordinates, Add with pan coordinates
611 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
615 _sizing_eval(Evas_Object *obj)
617 Widget_Data *wd = elm_widget_data_get(obj);
618 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
620 evas_object_size_hint_min_get(wd->scr, &minw, &minh);
621 evas_object_size_hint_max_get(wd->scr, &maxw, &maxh);
623 if (wd->height_for_width)
627 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
628 if ((vw != 0) && (vw != wd->prev_viewport_w))
632 wd->prev_viewport_w = vw;
633 EINA_INLIST_FOREACH(wd->blocks, itb)
635 itb->must_recalc = EINA_TRUE;
637 if (wd->calc_job) ecore_job_del(wd->calc_job);
638 wd->calc_job = ecore_job_add(_calc_job, wd);
641 if (wd->mode == ELM_LIST_LIMIT)
643 Evas_Coord vmw, vmh, vw, vh;
647 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
648 if ((minw > 0) && (vw < minw)) vw = minw;
649 else if ((maxw > 0) && (vw > maxw))
651 edje_object_size_min_calc
652 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
659 edje_object_size_min_calc
660 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
664 evas_object_size_hint_min_set(obj, minw, minh);
665 evas_object_size_hint_max_set(obj, maxw, maxh);
669 _signal_emit_hook(Evas_Object *obj,
670 const char *emission,
673 Widget_Data *wd = elm_widget_data_get(obj);
674 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
679 _item_highlight(Elm_Genlist_Item *it)
681 const char *selectraise;
682 if ((it->wd->no_select) || (it->delete_me) || (it->highlighted) ||
683 (it->disabled) || (it->display_only) || (it->mode_view))
685 edje_object_signal_emit(it->base.view, "elm,state,selected", "elm");
686 selectraise = edje_object_data_get(it->base.view, "selectraise");
687 if ((selectraise) && (!strcmp(selectraise, "on")))
689 evas_object_raise(it->base.view);
690 if ((it->group_item) && (it->group_item->realized))
691 evas_object_raise(it->group_item->base.view);
693 it->highlighted = EINA_TRUE;
697 _item_unhighlight(Elm_Genlist_Item *it)
699 const char *stacking, *selectraise;
700 if ((it->delete_me) || (!it->highlighted)) return;
701 edje_object_signal_emit(it->base.view, "elm,state,unselected", "elm");
702 stacking = edje_object_data_get(it->base.view, "stacking");
703 selectraise = edje_object_data_get(it->base.view, "selectraise");
706 if ((it->order_num_in & 0x1) ^ it->stacking_even) evas_object_lower(it->base.view);
707 else evas_object_raise(it->base.view);
709 it->highlighted = EINA_FALSE;
713 _item_block_del(Elm_Genlist_Item *it)
716 Item_Block *itb = it->block;
718 itb->items = eina_list_remove(itb->items, it);
720 itb->changed = EINA_TRUE;
721 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
722 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
725 il = EINA_INLIST_GET(itb);
726 Item_Block *itbn = (Item_Block *)(il->next);
728 it->parent->items = eina_list_remove(it->parent->items, it);
730 it->wd->blocks = eina_inlist_remove(it->wd->blocks, il);
732 if (itbn) itbn->changed = EINA_TRUE;
736 if (itb->count < itb->wd->max_items_per_block/2)
738 il = EINA_INLIST_GET(itb);
739 Item_Block *itbp = (Item_Block *)(il->prev);
740 Item_Block *itbn = (Item_Block *)(il->next);
741 if ((itbp) && ((itbp->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
743 Elm_Genlist_Item *it2;
745 EINA_LIST_FREE(itb->items, it2)
748 itbp->items = eina_list_append(itbp->items, it2);
750 itbp->changed = EINA_TRUE;
752 it->wd->blocks = eina_inlist_remove(it->wd->blocks,
753 EINA_INLIST_GET(itb));
756 else if ((itbn) && ((itbn->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
760 Eina_List *last = eina_list_last(itb->items);
761 Elm_Genlist_Item *it2 = last->data;
764 itb->items = eina_list_remove_list(itb->items, last);
765 itbn->items = eina_list_prepend(itbn->items, it2);
767 itbn->changed = EINA_TRUE;
770 eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb));
778 _item_del(Elm_Genlist_Item *it)
780 Evas_Object *tob = it->wd->obj;
782 evas_event_freeze(evas_object_evas_get(tob));
783 elm_widget_item_pre_notify_del(it);
784 elm_genlist_item_subitems_clear(it);
785 it->wd->walking -= it->walking;
786 if (it->wd->show_item == it) it->wd->show_item = NULL;
787 if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it);
788 if (it->realized) _item_unrealize(it, EINA_FALSE);
789 if (it->block) _item_block_del(it);
790 if ((!it->delete_me) && (it->itc->func.del))
791 it->itc->func.del((void *)it->base.data, it->base.widget);
792 it->delete_me = EINA_TRUE;
794 it->wd->queue = eina_list_remove(it->wd->queue, it);
795 if (it->wd->anchor_item == it)
797 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
798 if (!it->wd->anchor_item)
799 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
801 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
803 it->parent->items = eina_list_remove(it->parent->items, it);
804 if (it->flags & ELM_GENLIST_ITEM_GROUP)
805 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
806 if (it->long_timer) ecore_timer_del(it->long_timer);
807 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
809 if (it->tooltip.del_cb)
810 it->tooltip.del_cb((void *)it->tooltip.data, it->base.widget, it);
812 evas_event_thaw(evas_object_evas_get(tob));
813 evas_event_thaw_eval(evas_object_evas_get(tob));
815 elm_widget_item_del(it);
819 _item_select(Elm_Genlist_Item *it)
821 if ((it->wd->no_select) || (it->delete_me) || (it->mode_view)) return;
824 if (it->wd->always_select) goto call;
827 it->selected = EINA_TRUE;
828 it->wd->selected = eina_list_append(it->wd->selected, it);
832 if (it->func.func) it->func.func((void *)it->func.data, it->base.widget, it);
834 evas_object_smart_callback_call(it->base.widget, SIG_SELECTED, it);
837 if ((it->wd->clear_me) && (!it->wd->walking))
838 elm_genlist_clear(it->base.widget);
841 if ((!it->walking) && (it->delete_me))
843 if (!it->relcount) _item_del(it);
846 it->wd->last_selected_item = it;
850 _item_unselect(Elm_Genlist_Item *it)
852 if ((it->delete_me) || (!it->selected)) return;
853 it->selected = EINA_FALSE;
854 it->wd->selected = eina_list_remove(it->wd->selected, it);
855 evas_object_smart_callback_call(it->base.widget, SIG_UNSELECTED, it);
859 _mouse_move(void *data,
860 Evas *evas __UNUSED__,
864 Elm_Genlist_Item *it = data;
865 Evas_Event_Mouse_Move *ev = event_info;
866 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
867 Evas_Coord ox, oy, ow, oh, it_scrl_y, y_pos;
869 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
871 if (!it->wd->on_hold)
873 it->wd->on_hold = EINA_TRUE;
874 if (!it->wd->wasselected)
876 _item_unhighlight(it);
881 if (it->wd->multitouched)
883 it->wd->cur_x = ev->cur.canvas.x;
884 it->wd->cur_y = ev->cur.canvas.y;
887 if ((it->dragging) && (it->down))
889 if (it->wd->movements == SWIPE_MOVES) it->wd->swipe = EINA_TRUE;
892 it->wd->history[it->wd->movements].x = ev->cur.canvas.x;
893 it->wd->history[it->wd->movements].y = ev->cur.canvas.y;
894 if (abs((it->wd->history[it->wd->movements].x -
895 it->wd->history[0].x)) > 40)
896 it->wd->swipe = EINA_TRUE;
902 ecore_timer_del(it->long_timer);
903 it->long_timer = NULL;
905 evas_object_smart_callback_call(it->base.widget, SIG_DRAG, it);
908 if ((!it->down) /* || (it->wd->on_hold)*/ || (it->wd->longpressed))
912 ecore_timer_del(it->long_timer);
913 it->long_timer = NULL;
915 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
917 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
918 it_scrl_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
920 if (!it->wd->reorder_start_y)
921 it->wd->reorder_start_y = it->block->y + it->y;
923 if (it_scrl_y < oy) y_pos = oy;
924 else if (it_scrl_y + it->wd->reorder_it->h > oy+oh)
925 y_pos = oy + oh - it->wd->reorder_it->h;
926 else y_pos = it_scrl_y;
928 _item_position(it, it->base.view, it->scrl_x, y_pos);
930 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
931 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
935 if (!it->display_only)
936 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
937 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
938 x = ev->cur.canvas.x - x;
939 y = ev->cur.canvas.y - y;
942 if (adx < 0) adx = -dx;
945 if (ady < 0) ady = -dy;
948 if ((adx > minw) || (ady > minh))
950 it->dragging = EINA_TRUE;
953 ecore_timer_del(it->long_timer);
954 it->long_timer = NULL;
956 if (!it->wd->wasselected)
958 _item_unhighlight(it);
964 evas_object_smart_callback_call(it->base.widget,
965 SIG_DRAG_START_UP, it);
969 evas_object_smart_callback_call(it->base.widget,
970 SIG_DRAG_START_LEFT, it);
972 evas_object_smart_callback_call(it->base.widget,
973 SIG_DRAG_START_RIGHT, it);
979 evas_object_smart_callback_call(it->base.widget,
980 SIG_DRAG_START_DOWN, it);
984 evas_object_smart_callback_call(it->base.widget,
985 SIG_DRAG_START_LEFT, it);
987 evas_object_smart_callback_call(it->base.widget,
988 SIG_DRAG_START_RIGHT, it);
995 _long_press(void *data)
997 Elm_Genlist_Item *it = data, *it_tmp;
1000 it->long_timer = NULL;
1001 if ((it->disabled) || (it->dragging) || (it->display_only))
1002 return ECORE_CALLBACK_CANCEL;
1003 it->wd->longpressed = EINA_TRUE;
1004 evas_object_smart_callback_call(it->base.widget, SIG_LONGPRESSED, it);
1005 if ((it->wd->reorder_mode) && (it->flags != ELM_GENLIST_ITEM_GROUP))
1007 it->wd->reorder_it = it;
1008 it->wd->reorder_start_y = 0;
1010 evas_object_raise(it->base.view);
1011 elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
1013 list = elm_genlist_realized_items_get(it->wd->obj);
1014 EINA_LIST_FOREACH(list, l, it_tmp)
1016 if (it != it_tmp) _item_unselect(it_tmp);
1018 if (elm_genlist_item_expanded_get(it))
1020 elm_genlist_item_expanded_set(it, EINA_FALSE);
1021 return ECORE_CALLBACK_RENEW;
1023 edje_object_signal_emit(it->base.view, "elm,state,reorder,enabled", "elm");
1025 return ECORE_CALLBACK_CANCEL;
1029 _swipe(Elm_Genlist_Item *it)
1034 if ((it->display_only) || (it->disabled)) return;
1035 it->wd->swipe = EINA_FALSE;
1036 for (i = 0; i < it->wd->movements; i++)
1038 sum += it->wd->history[i].x;
1039 if (abs(it->wd->history[0].y - it->wd->history[i].y) > 10) return;
1042 sum /= it->wd->movements;
1043 if (abs(sum - it->wd->history[0].x) <= 10) return;
1044 evas_object_smart_callback_call(it->base.widget, SIG_SWIPE, it);
1048 _swipe_cancel(void *data)
1050 Elm_Genlist_Item *it = data;
1052 if (!it) return ECORE_CALLBACK_CANCEL;
1053 it->wd->swipe = EINA_FALSE;
1054 it->wd->movements = 0;
1055 return ECORE_CALLBACK_RENEW;
1059 _multi_cancel(void *data)
1061 Widget_Data *wd = data;
1063 if (!wd) return ECORE_CALLBACK_CANCEL;
1064 wd->multi_timeout = EINA_TRUE;
1065 return ECORE_CALLBACK_RENEW;
1069 _multi_touch_gesture_eval(void *data)
1071 Elm_Genlist_Item *it = data;
1073 it->wd->multitouched = EINA_FALSE;
1074 if (it->wd->multi_timer)
1076 ecore_timer_del(it->wd->multi_timer);
1077 it->wd->multi_timer = NULL;
1079 if (it->wd->multi_timeout)
1081 it->wd->multi_timeout = EINA_FALSE;
1085 Evas_Coord minw = 0, minh = 0;
1086 Evas_Coord off_x, off_y, off_mx, off_my;
1088 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1089 off_x = abs(it->wd->cur_x - it->wd->prev_x);
1090 off_y = abs(it->wd->cur_y - it->wd->prev_y);
1091 off_mx = abs(it->wd->cur_mx - it->wd->prev_mx);
1092 off_my = abs(it->wd->cur_my - it->wd->prev_my);
1094 if (((off_x > minw) || (off_y > minh)) && ((off_mx > minw) || (off_my > minh)))
1096 if ((off_x + off_mx) > (off_y + off_my))
1098 if ((it->wd->cur_x > it->wd->prev_x) && (it->wd->cur_mx > it->wd->prev_mx))
1099 evas_object_smart_callback_call(it->base.widget,
1100 SIG_MULTI_SWIPE_RIGHT, it);
1101 else if ((it->wd->cur_x < it->wd->prev_x) && (it->wd->cur_mx < it->wd->prev_mx))
1102 evas_object_smart_callback_call(it->base.widget,
1103 SIG_MULTI_SWIPE_LEFT, it);
1104 else if (abs(it->wd->cur_x - it->wd->cur_mx) > abs(it->wd->prev_x - it->wd->prev_mx))
1105 evas_object_smart_callback_call(it->base.widget,
1106 SIG_MULTI_PINCH_OUT, it);
1108 evas_object_smart_callback_call(it->base.widget,
1109 SIG_MULTI_PINCH_IN, it);
1113 if ((it->wd->cur_y > it->wd->prev_y) && (it->wd->cur_my > it->wd->prev_my))
1114 evas_object_smart_callback_call(it->base.widget,
1115 SIG_MULTI_SWIPE_DOWN, it);
1116 else if ((it->wd->cur_y < it->wd->prev_y) && (it->wd->cur_my < it->wd->prev_my))
1117 evas_object_smart_callback_call(it->base.widget,
1118 SIG_MULTI_SWIPE_UP, it);
1119 else if (abs(it->wd->cur_y - it->wd->cur_my) > abs(it->wd->prev_y - it->wd->prev_my))
1120 evas_object_smart_callback_call(it->base.widget,
1121 SIG_MULTI_PINCH_OUT, it);
1123 evas_object_smart_callback_call(it->base.widget,
1124 SIG_MULTI_PINCH_IN, it);
1127 it->wd->multi_timeout = EINA_FALSE;
1131 _multi_down(void *data,
1132 Evas *evas __UNUSED__,
1133 Evas_Object *obj __UNUSED__,
1136 Elm_Genlist_Item *it = data;
1137 Evas_Event_Multi_Down *ev = event_info;
1139 if ((it->wd->multi_device != 0) || (it->wd->multitouched) || (it->wd->multi_timeout)) return;
1140 it->wd->multi_device = ev->device;
1141 it->wd->multi_down = EINA_TRUE;
1142 it->wd->multitouched = EINA_TRUE;
1143 it->wd->prev_mx = ev->canvas.x;
1144 it->wd->prev_my = ev->canvas.y;
1145 if (!it->wd->wasselected)
1147 _item_unhighlight(it);
1150 it->wd->wasselected = EINA_FALSE;
1151 it->wd->longpressed = EINA_FALSE;
1154 ecore_timer_del(it->long_timer);
1155 it->long_timer = NULL;
1159 it->dragging = EINA_FALSE;
1160 evas_object_smart_callback_call(it->base.widget, SIG_DRAG_STOP, it);
1162 if (it->swipe_timer)
1164 ecore_timer_del(it->swipe_timer);
1165 it->swipe_timer = NULL;
1167 if (it->wd->on_hold)
1169 it->wd->swipe = EINA_FALSE;
1170 it->wd->movements = 0;
1171 it->wd->on_hold = EINA_FALSE;
1176 _multi_up(void *data,
1177 Evas *evas __UNUSED__,
1178 Evas_Object *obj __UNUSED__,
1181 Elm_Genlist_Item *it = data;
1182 Evas_Event_Multi_Up *ev = event_info;
1184 if (it->wd->multi_device != ev->device) return;
1185 it->wd->multi_device = 0;
1186 it->wd->multi_down = EINA_FALSE;
1187 if (it->wd->mouse_down) return;
1188 _multi_touch_gesture_eval(data);
1192 _multi_move(void *data,
1193 Evas *evas __UNUSED__,
1194 Evas_Object *obj __UNUSED__,
1197 Elm_Genlist_Item *it = data;
1198 Evas_Event_Multi_Move *ev = event_info;
1200 if (it->wd->multi_device != ev->device) return;
1201 it->wd->cur_mx = ev->cur.canvas.x;
1202 it->wd->cur_my = ev->cur.canvas.y;
1206 _mouse_down(void *data,
1207 Evas *evas __UNUSED__,
1211 Elm_Genlist_Item *it = data;
1212 Evas_Event_Mouse_Down *ev = event_info;
1215 if (ev->button != 1) return;
1216 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1218 it->wd->on_hold = EINA_TRUE;
1221 it->down = EINA_TRUE;
1222 it->dragging = EINA_FALSE;
1223 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1224 it->dx = ev->canvas.x - x;
1225 it->dy = ev->canvas.y - y;
1226 it->wd->mouse_down = EINA_TRUE;
1227 if (!it->wd->multitouched)
1229 it->wd->prev_x = ev->canvas.x;
1230 it->wd->prev_y = ev->canvas.y;
1231 it->wd->multi_timeout = EINA_FALSE;
1232 if (it->wd->multi_timer) ecore_timer_del(it->wd->multi_timer);
1233 it->wd->multi_timer = ecore_timer_add(1, _multi_cancel, it->wd);
1235 it->wd->longpressed = EINA_FALSE;
1236 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1237 else it->wd->on_hold = EINA_FALSE;
1238 if (it->wd->on_hold) return;
1239 it->wd->wasselected = it->selected;
1240 _item_highlight(it);
1241 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
1242 if ((!it->disabled) && (!it->display_only))
1244 evas_object_smart_callback_call(it->base.widget, SIG_CLICKED_DOUBLE, it);
1245 evas_object_smart_callback_call(it->base.widget, SIG_ACTIVATED, it);
1247 if (it->long_timer) ecore_timer_del(it->long_timer);
1248 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
1249 it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
1251 it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press,
1254 it->long_timer = NULL;
1255 it->wd->swipe = EINA_FALSE;
1256 it->wd->movements = 0;
1260 _mouse_up(void *data,
1261 Evas *evas __UNUSED__,
1262 Evas_Object *obj __UNUSED__,
1265 Elm_Genlist_Item *it = data;
1266 Evas_Event_Mouse_Up *ev = event_info;
1267 Eina_Bool dragged = EINA_FALSE;
1269 if (ev->button != 1) return;
1270 it->down = EINA_FALSE;
1271 it->wd->mouse_down = EINA_FALSE;
1272 if (it->wd->multitouched)
1274 if ((!it->wd->multi) && (!it->selected) && (it->highlighted)) _item_unhighlight(it);
1275 if (it->wd->multi_down) return;
1276 _multi_touch_gesture_eval(data);
1279 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1280 else it->wd->on_hold = EINA_FALSE;
1283 ecore_timer_del(it->long_timer);
1284 it->long_timer = NULL;
1288 it->dragging = EINA_FALSE;
1289 evas_object_smart_callback_call(it->base.widget, SIG_DRAG_STOP, it);
1292 if (it->swipe_timer)
1294 ecore_timer_del(it->swipe_timer);
1295 it->swipe_timer = NULL;
1297 if (it->wd->multi_timer)
1299 ecore_timer_del(it->wd->multi_timer);
1300 it->wd->multi_timer = NULL;
1301 it->wd->multi_timeout = EINA_FALSE;
1303 if (it->wd->on_hold)
1305 if (it->wd->swipe) _swipe(data);
1306 it->wd->longpressed = EINA_FALSE;
1307 it->wd->on_hold = EINA_FALSE;
1310 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
1312 Evas_Coord it_scrl_y = ev->canvas.y - it->wd->reorder_it->dy;
1314 if (it->wd->reorder_rel)
1316 if (it->wd->reorder_it->parent == it->wd->reorder_rel->parent)
1318 if (it_scrl_y <= it->wd->reorder_rel->scrl_y)
1319 _item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
1321 _item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
1325 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1326 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1329 edje_object_signal_emit(it->base.view, "elm,state,reorder,disabled", "elm");
1330 it->wd->reorder_it = it->wd->reorder_rel = NULL;
1331 elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
1333 if (it->wd->longpressed)
1335 it->wd->longpressed = EINA_FALSE;
1336 if (!it->wd->wasselected)
1338 _item_unhighlight(it);
1341 it->wd->wasselected = EINA_FALSE;
1346 if (it->want_unrealize)
1348 _item_unrealize(it, EINA_FALSE);
1349 if (it->block->want_unrealize)
1350 _item_block_unrealize(it->block);
1353 if ((it->disabled) || (dragged) || (it->display_only)) return;
1354 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1359 _item_highlight(it);
1364 _item_unhighlight(it);
1372 Widget_Data *wd = it->wd;
1375 while (wd->selected)
1377 _item_unhighlight(wd->selected->data);
1378 _item_unselect(wd->selected->data);
1384 const Eina_List *l, *l_next;
1385 Elm_Genlist_Item *it2;
1387 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
1390 _item_unhighlight(it2);
1391 _item_unselect(it2);
1393 //_item_highlight(it);
1396 _item_highlight(it);
1402 _signal_expand_toggle(void *data,
1403 Evas_Object *obj __UNUSED__,
1404 const char *emission __UNUSED__,
1405 const char *source __UNUSED__)
1407 Elm_Genlist_Item *it = data;
1410 evas_object_smart_callback_call(it->base.widget, SIG_CONTRACT_REQUEST, it);
1412 evas_object_smart_callback_call(it->base.widget, SIG_EXPAND_REQUEST, it);
1416 _signal_expand(void *data,
1417 Evas_Object *obj __UNUSED__,
1418 const char *emission __UNUSED__,
1419 const char *source __UNUSED__)
1421 Elm_Genlist_Item *it = data;
1424 evas_object_smart_callback_call(it->base.widget, SIG_EXPAND_REQUEST, it);
1428 _signal_contract(void *data,
1429 Evas_Object *obj __UNUSED__,
1430 const char *emission __UNUSED__,
1431 const char *source __UNUSED__)
1433 Elm_Genlist_Item *it = data;
1436 evas_object_smart_callback_call(it->base.widget, SIG_CONTRACT_REQUEST, it);
1440 _scr_hold_timer_cb(void *data)
1442 if (!data) return ECORE_CALLBACK_CANCEL;
1443 Widget_Data *wd = data;
1444 elm_smart_scroller_hold_set(wd->scr, EINA_FALSE);
1445 wd->scr_hold_timer = NULL;
1446 return ECORE_CALLBACK_CANCEL;
1450 _mode_finished_signal_cb(void *data,
1452 const char *emission __UNUSED__,
1453 const char *source __UNUSED__)
1457 Elm_Genlist_Item *it = data;
1458 if ((it->delete_me) || (!it->realized) || (!it->mode_view)) return;
1460 Evas *te = evas_object_evas_get(obj);
1462 evas_event_freeze(te);
1463 it->nocache = EINA_FALSE;
1464 _mode_item_unrealize(it);
1465 snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished", it->wd->mode_type);
1466 edje_object_signal_callback_del_full(obj, buf, "elm", _mode_finished_signal_cb, it);
1467 evas_event_thaw(te);
1468 evas_event_thaw_eval(te);
1472 _item_cache_clean(Widget_Data *wd)
1474 evas_event_freeze(evas_object_evas_get(wd->obj));
1475 while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max))
1479 itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache);
1480 wd->item_cache = eina_inlist_remove(wd->item_cache,
1481 wd->item_cache->last);
1482 wd->item_cache_count--;
1483 if (itc->spacer) evas_object_del(itc->spacer);
1484 if (itc->base_view) evas_object_del(itc->base_view);
1485 if (itc->item_style) eina_stringshare_del(itc->item_style);
1488 evas_event_thaw(evas_object_evas_get(wd->obj));
1489 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
1493 _item_cache_zero(Widget_Data *wd)
1495 int pmax = wd->item_cache_max;
1496 wd->item_cache_max = 0;
1497 _item_cache_clean(wd);
1498 wd->item_cache_max = pmax;
1502 _item_cache_add(Elm_Genlist_Item *it)
1506 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1507 if (it->wd->item_cache_max <= 0)
1509 evas_object_del(it->base.view);
1510 it->base.view = NULL;
1511 evas_object_del(it->spacer);
1513 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1514 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1518 it->wd->item_cache_count++;
1519 itc = calloc(1, sizeof(Item_Cache));
1520 it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache,
1521 EINA_INLIST_GET(itc));
1522 itc->spacer = it->spacer;
1524 itc->base_view = it->base.view;
1525 it->base.view = NULL;
1526 evas_object_hide(itc->base_view);
1527 evas_object_move(itc->base_view, -9999, -9999);
1528 itc->item_style = eina_stringshare_add(it->itc->item_style);
1529 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
1530 itc->compress = (it->wd->compress);
1531 itc->selected = it->selected;
1532 itc->disabled = it->disabled;
1533 itc->expanded = it->expanded;
1536 ecore_timer_del(it->long_timer);
1537 it->long_timer = NULL;
1539 if (it->swipe_timer)
1541 ecore_timer_del(it->swipe_timer);
1542 it->swipe_timer = NULL;
1544 // FIXME: other callbacks?
1545 edje_object_signal_callback_del_full(itc->base_view,
1546 "elm,action,expand,toggle",
1547 "elm", _signal_expand_toggle, it);
1548 edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand",
1550 _signal_expand, it);
1551 edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract",
1552 "elm", _signal_contract, it);
1553 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_DOWN,
1555 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP,
1557 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_MOVE,
1559 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_DOWN,
1561 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_UP,
1563 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_MOVE,
1565 _item_cache_clean(it->wd);
1566 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1567 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1571 _item_cache_find(Elm_Genlist_Item *it)
1576 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
1577 EINA_INLIST_FOREACH(it->wd->item_cache, itc)
1579 if ((itc->selected) || (itc->disabled) || (itc->expanded))
1581 if ((itc->tree == tree) &&
1582 (itc->compress == it->wd->compress) &&
1583 (!strcmp(it->itc->item_style, itc->item_style)))
1585 it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
1586 EINA_INLIST_GET(itc));
1587 it->wd->item_cache_count--;
1595 _elm_genlist_item_odd_even_update(Elm_Genlist_Item *it)
1597 if (!it->nostacking)
1599 if ((it->order_num_in & 0x1) ^ it->stacking_even)
1600 evas_object_lower(it->base.view);
1602 evas_object_raise(it->base.view);
1605 if (it->order_num_in & 0x1)
1606 edje_object_signal_emit(it->base.view, "elm,state,odd", "elm");
1608 edje_object_signal_emit(it->base.view, "elm,state,even", "elm");
1612 _elm_genlist_item_state_update(Elm_Genlist_Item *it, Item_Cache *itc)
1616 if (it->selected != itc->selected)
1619 edje_object_signal_emit(it->base.view,
1620 "elm,state,selected", "elm");
1622 if (it->disabled != itc->disabled)
1625 edje_object_signal_emit(it->base.view,
1626 "elm,state,disabled", "elm");
1628 if (it->expanded != itc->expanded)
1631 edje_object_signal_emit(it->base.view,
1632 "elm,state,expanded", "elm");
1638 edje_object_signal_emit(it->base.view,
1639 "elm,state,selected", "elm");
1641 edje_object_signal_emit(it->base.view,
1642 "elm,state,disabled", "elm");
1644 edje_object_signal_emit(it->base.view,
1645 "elm,state,expanded", "elm");
1650 _item_cache_free(Item_Cache *itc)
1652 if (itc->spacer) evas_object_del(itc->spacer);
1653 if (itc->base_view) evas_object_del(itc->base_view);
1654 if (itc->item_style) eina_stringshare_del(itc->item_style);
1659 _item_label_realize(Elm_Genlist_Item *it,
1660 Evas_Object *target,
1663 if (it->itc->func.label_get)
1668 *source = elm_widget_stringlist_get(edje_object_data_get(target, "labels"));
1669 EINA_LIST_FOREACH(*source, l, key)
1671 char *s = it->itc->func.label_get
1672 ((void *)it->base.data, it->base.widget, key);
1676 edje_object_part_text_set(target, key, s);
1681 edje_object_part_text_set(target, key, "");
1688 _item_icon_realize(Elm_Genlist_Item *it,
1689 Evas_Object *target,
1692 Eina_List *res = NULL;
1694 if (it->itc->func.icon_get)
1699 *source = elm_widget_stringlist_get(edje_object_data_get(target, "icons"));
1700 EINA_LIST_FOREACH(*source, l, key)
1702 Evas_Object *ic = it->itc->func.icon_get
1703 ((void *)it->base.data, it->base.widget, key);
1707 res = eina_list_append(res, ic);
1708 edje_object_part_swallow(target, key, ic);
1709 evas_object_show(ic);
1710 elm_widget_sub_object_add(it->base.widget, ic);
1712 elm_widget_disabled_set(ic, EINA_TRUE);
1721 _item_state_realize(Elm_Genlist_Item *it,
1722 Evas_Object *target,
1725 if (it->itc->func.state_get)
1731 *source = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
1732 EINA_LIST_FOREACH(*source, l, key)
1734 Eina_Bool on = it->itc->func.state_get
1735 ((void *)it->base.data, it->base.widget, key);
1739 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
1740 edje_object_signal_emit(target, buf, "elm");
1744 snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
1745 edje_object_signal_emit(target, buf, "elm");
1752 _item_realize(Elm_Genlist_Item *it,
1756 Elm_Genlist_Item *it2;
1757 const char *treesize;
1759 int depth, tsize = 20;
1760 Item_Cache *itc = NULL;
1762 if (it->delete_me) return;
1763 //evas_event_freeze(evas_object_evas_get(it->wd->obj));
1766 if (it->order_num_in != in)
1768 it->order_num_in = in;
1769 _elm_genlist_item_odd_even_update(it);
1770 _elm_genlist_item_state_update(it, NULL);
1772 //evas_event_thaw(evas_object_evas_get(it->wd->obj));
1773 //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1776 it->order_num_in = in;
1779 it->nocache = EINA_FALSE;
1781 itc = _item_cache_find(it);
1784 it->base.view = itc->base_view;
1785 itc->base_view = NULL;
1786 it->spacer = itc->spacer;
1791 const char *stacking_even;
1792 const char *stacking;
1794 it->base.view = edje_object_add(evas_object_evas_get(it->base.widget));
1795 edje_object_scale_set(it->base.view,
1796 elm_widget_scale_get(it->base.widget) *
1797 _elm_config->scale);
1798 evas_object_smart_member_add(it->base.view, it->wd->pan_smart);
1799 elm_widget_sub_object_add(it->base.widget, it->base.view);
1801 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS)
1802 strncpy(buf, "tree", sizeof(buf));
1803 else strncpy(buf, "item", sizeof(buf));
1804 if (it->wd->compress)
1805 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
1807 strncat(buf, "/", sizeof(buf) - strlen(buf));
1808 strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf));
1810 _elm_theme_object_set(it->base.widget, it->base.view, "genlist", buf,
1811 elm_widget_style_get(it->base.widget));
1813 stacking_even = edje_object_data_get(it->base.view, "stacking_even");
1814 if (!stacking_even) stacking_even = "above";
1815 it->stacking_even = !!strcmp("above", stacking_even);
1817 stacking = edje_object_data_get(it->base.view, "stacking");
1818 if (!stacking) stacking = "yes";
1819 it->nostacking = !!strcmp("yes", stacking);
1821 edje_object_mirrored_set(it->base.view,
1822 elm_widget_mirrored_get(it->base.widget));
1824 evas_object_rectangle_add(evas_object_evas_get(it->base.widget));
1825 evas_object_color_set(it->spacer, 0, 0, 0, 0);
1826 elm_widget_sub_object_add(it->base.widget, it->spacer);
1829 _elm_genlist_item_odd_even_update(it);
1831 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
1833 if (it2->parent->flags != ELM_GENLIST_ITEM_GROUP) depth += 1;
1835 it->expanded_depth = depth;
1836 treesize = edje_object_data_get(it->base.view, "treesize");
1837 if (treesize) tsize = atoi(treesize);
1838 evas_object_size_hint_min_set(it->spacer,
1839 (depth * tsize) * _elm_config->scale, 1);
1840 edje_object_part_swallow(it->base.view, "elm.swallow.pad", it->spacer);
1843 edje_object_signal_callback_add(it->base.view,
1844 "elm,action,expand,toggle",
1845 "elm", _signal_expand_toggle, it);
1846 edje_object_signal_callback_add(it->base.view, "elm,action,expand",
1847 "elm", _signal_expand, it);
1848 edje_object_signal_callback_add(it->base.view, "elm,action,contract",
1849 "elm", _signal_contract, it);
1850 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_DOWN,
1852 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_UP,
1854 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_MOVE,
1856 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_DOWN,
1858 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_UP,
1860 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_MOVE,
1863 _elm_genlist_item_state_update(it, itc);
1866 if ((calc) && (it->wd->homogeneous) &&
1867 ((it->wd->item_width) ||
1868 ((it->wd->item_width) && (it->wd->group_item_width))))
1870 /* homogenous genlist shortcut */
1873 if (it->flags & ELM_GENLIST_ITEM_GROUP)
1875 it->w = it->minw = it->wd->group_item_width;
1876 it->h = it->minh = it->wd->group_item_height;
1880 it->w = it->minw = it->wd->item_width;
1881 it->h = it->minh = it->wd->item_height;
1883 it->mincalcd = EINA_TRUE;
1888 /* FIXME: If you see that assert, please notify us and we
1889 will clean our mess */
1890 assert(eina_list_count(it->icon_objs) == 0);
1892 _item_label_realize(it, it->base.view, &it->labels);
1893 it->icon_objs = _item_icon_realize(it, it->base.view, &it->icons);
1894 _item_state_realize(it, it->base.view, &it->states);
1898 Evas_Coord mw = -1, mh = -1;
1900 if (!it->display_only)
1901 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1902 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
1903 edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw,
1905 if (!it->display_only)
1906 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1907 it->w = it->minw = mw;
1908 it->h = it->minh = mh;
1909 it->mincalcd = EINA_TRUE;
1911 if ((!it->wd->group_item_width) && (it->flags == ELM_GENLIST_ITEM_GROUP))
1913 it->wd->group_item_width = mw;
1914 it->wd->group_item_height = mh;
1916 else if ((!it->wd->item_width) && (it->flags == ELM_GENLIST_ITEM_NONE))
1918 it->wd->item_width = mw;
1919 it->wd->item_height = mh;
1922 if (!calc) evas_object_show(it->base.view);
1925 if (it->tooltip.content_cb)
1927 elm_widget_item_tooltip_content_cb_set(it,
1928 it->tooltip.content_cb,
1929 it->tooltip.data, NULL);
1930 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
1931 elm_widget_item_tooltip_size_restrict_disable(it, it->tooltip.free_size);
1934 if (it->mouse_cursor)
1935 elm_widget_item_cursor_set(it, it->mouse_cursor);
1937 it->realized = EINA_TRUE;
1938 it->want_unrealize = EINA_FALSE;
1940 if (itc) _item_cache_free(itc);
1941 //evas_event_thaw(evas_object_evas_get(it->wd->obj));
1942 //evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1944 evas_object_smart_callback_call(it->base.widget, SIG_REALIZED, it);
1945 edje_object_message_signal_process(it->base.view);
1949 _item_unrealize(Elm_Genlist_Item *it,
1954 if (!it->realized) return;
1955 if (it->wd->reorder_it == it) return;
1956 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1958 evas_object_smart_callback_call(it->base.widget, SIG_UNREALIZED, it);
1961 ecore_timer_del(it->long_timer);
1962 it->long_timer = NULL;
1966 evas_object_del(it->base.view);
1967 it->base.view = NULL;
1968 evas_object_del(it->spacer);
1973 edje_object_mirrored_set(it->base.view,
1974 elm_widget_mirrored_get(it->base.widget));
1975 edje_object_scale_set(it->base.view,
1976 elm_widget_scale_get(it->base.widget)
1977 * _elm_config->scale);
1978 _item_cache_add(it);
1980 elm_widget_stringlist_free(it->labels);
1982 elm_widget_stringlist_free(it->icons);
1984 elm_widget_stringlist_free(it->states);
1986 EINA_LIST_FREE(it->icon_objs, icon)
1987 evas_object_del(icon);
1989 _mode_item_unrealize(it);
1991 it->realized = EINA_FALSE;
1992 it->want_unrealize = EINA_FALSE;
1993 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1994 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1998 _item_block_recalc(Item_Block *itb,
2003 Elm_Genlist_Item *it;
2004 Evas_Coord minw = 0, minh = 0;
2005 Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE;
2008 //evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2010 EINA_LIST_FOREACH(itb->items, l, it)
2012 if (it->delete_me) continue;
2013 showme |= it->showme;
2018 if (!it->mincalcd) changed = EINA_TRUE;
2021 _item_realize(it, in, EINA_TRUE);
2022 _item_unrealize(it, EINA_TRUE);
2027 _item_realize(it, in, EINA_TRUE);
2028 _item_unrealize(it, EINA_TRUE);
2032 _item_realize(it, in, EINA_FALSE);
2034 if (minw < it->minw) minw = it->minw;
2042 itb->changed = EINA_FALSE;
2043 //evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2044 //evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2049 _item_block_realize(Item_Block *itb)
2051 if (itb->realized) return;
2052 itb->realized = EINA_TRUE;
2053 itb->want_unrealize = EINA_FALSE;
2057 _item_block_unrealize(Item_Block *itb)
2060 Elm_Genlist_Item *it;
2061 Eina_Bool dragging = EINA_FALSE;
2063 if (!itb->realized) return;
2064 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2065 EINA_LIST_FOREACH(itb->items, l, it)
2067 if (it->flags != ELM_GENLIST_ITEM_GROUP)
2071 dragging = EINA_TRUE;
2072 it->want_unrealize = EINA_TRUE;
2075 _item_unrealize(it, EINA_FALSE);
2080 itb->realized = EINA_FALSE;
2081 itb->want_unrealize = EINA_TRUE;
2084 itb->want_unrealize = EINA_FALSE;
2085 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2086 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2090 _get_space_for_reorder_item(Elm_Genlist_Item *it)
2092 Evas_Coord rox, roy, row, roh, oy, oh;
2093 Eina_Bool top = EINA_FALSE;
2094 Elm_Genlist_Item *reorder_it = it->wd->reorder_it;
2095 if (!reorder_it) return 0;
2097 evas_object_geometry_get(it->wd->pan_smart, NULL, &oy, NULL, &oh);
2098 evas_object_geometry_get(it->wd->reorder_it->base.view, &rox, &roy, &row, &roh);
2100 if ((it->wd->reorder_start_y < it->block->y) &&
2101 (roy - oy + (roh / 2) >= it->block->y - it->wd->pan_y))
2103 it->block->reorder_offset = it->wd->reorder_it->h * -1;
2104 if (it->block->count == 1)
2105 it->wd->reorder_rel = it;
2107 else if ((it->wd->reorder_start_y >= it->block->y) &&
2108 (roy - oy + (roh / 2) <= it->block->y - it->wd->pan_y))
2110 it->block->reorder_offset = it->wd->reorder_it->h;
2113 it->block->reorder_offset = 0;
2115 it->scrl_y += it->block->reorder_offset;
2117 top = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
2118 rox, roy + (roh / 2), row, 1));
2121 it->wd->reorder_rel = it;
2122 it->scrl_y += it->wd->reorder_it->h;
2123 return it->wd->reorder_it->h;
2130 _reorder_move_animator_cb(void *data)
2132 Elm_Genlist_Item *it = data;
2133 Eina_Bool down = EINA_FALSE;
2135 int y, dy = it->h / 10 * _elm_config->scale, diff;
2137 t = ((0.0 > (t = ecore_loop_time_get()-it->wd->start_time)) ? 0.0 : t);
2139 if (t <= REORDER_EFFECT_TIME) y = (1 * sin((t / REORDER_EFFECT_TIME) * (M_PI / 2)) * dy);
2142 diff = abs(it->old_scrl_y - it->scrl_y);
2143 if (diff > it->h) y = diff / 2;
2145 if (it->old_scrl_y < it->scrl_y)
2147 it->old_scrl_y += y;
2150 else if (it->old_scrl_y > it->scrl_y)
2152 it->old_scrl_y -= y;
2155 _item_position(it, it->base.view, it->scrl_x, it->old_scrl_y);
2156 _group_items_recalc(it->wd);
2158 if ((it->wd->reorder_pan_move) ||
2159 (down && it->old_scrl_y >= it->scrl_y) ||
2160 (!down && it->old_scrl_y <= it->scrl_y))
2162 it->old_scrl_y = it->scrl_y;
2163 it->move_effect_enabled = EINA_FALSE;
2164 it->wd->reorder_move_animator = NULL;
2165 return ECORE_CALLBACK_CANCEL;
2167 return ECORE_CALLBACK_RENEW;
2171 _item_position(Elm_Genlist_Item *it,
2179 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2180 evas_object_resize(view, it->w, it->h);
2181 evas_object_move(view, it_x, it_y);
2182 evas_object_show(view);
2183 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2184 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2188 _item_block_position(Item_Block *itb,
2192 Elm_Genlist_Item *it;
2193 Elm_Genlist_Item *git;
2194 Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2197 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2198 evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh);
2199 evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy,
2201 EINA_LIST_FOREACH(itb->items, l, it)
2203 if (it->delete_me) continue;
2204 else if (it->wd->reorder_it == it) continue;
2208 it->scrl_x = itb->x + it->x - it->wd->pan_x + ox;
2209 it->scrl_y = itb->y + it->y - it->wd->pan_y + oy;
2211 vis = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
2212 cvx, cvy, cvw, cvh));
2213 if (it->flags != ELM_GENLIST_ITEM_GROUP)
2215 if ((itb->realized) && (!it->realized))
2217 if (vis) _item_realize(it, in, EINA_FALSE);
2223 if (it->wd->reorder_mode)
2224 y += _get_space_for_reorder_item(it);
2225 git = it->group_item;
2228 if (git->scrl_y < oy)
2230 if ((git->scrl_y + git->h) > (it->scrl_y + it->h))
2231 git->scrl_y = (it->scrl_y + it->h) - git->h;
2232 git->want_realize = EINA_TRUE;
2234 if ((it->wd->reorder_it) && (it->old_scrl_y != it->scrl_y))
2236 if (!it->move_effect_enabled)
2238 it->move_effect_enabled = EINA_TRUE;
2239 it->wd->reorder_move_animator =
2241 _reorder_move_animator_cb, it);
2244 if (!it->move_effect_enabled)
2248 _item_position(it, it->mode_view, it->scrl_x,
2251 _item_position(it, it->base.view, it->scrl_x,
2254 it->old_scrl_y = it->scrl_y;
2259 if (!it->dragging) _item_unrealize(it, EINA_FALSE);
2266 if (vis) it->want_realize = EINA_TRUE;
2270 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2271 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2275 _group_items_recalc(void *data)
2277 Widget_Data *wd = data;
2279 Elm_Genlist_Item *git;
2281 evas_event_freeze(evas_object_evas_get(wd->obj));
2282 EINA_LIST_FOREACH(wd->group_items, l, git)
2284 if (git->want_realize)
2287 _item_realize(git, 0, EINA_FALSE);
2288 evas_object_resize(git->base.view, wd->minw, git->h);
2289 evas_object_move(git->base.view, git->scrl_x, git->scrl_y);
2290 evas_object_show(git->base.view);
2291 evas_object_raise(git->base.view);
2293 else if (!git->want_realize && git->realized)
2296 _item_unrealize(git, EINA_FALSE);
2299 evas_event_thaw(evas_object_evas_get(wd->obj));
2300 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2304 _must_recalc_idler(void *data)
2306 Widget_Data *wd = data;
2307 if (wd->calc_job) ecore_job_del(wd->calc_job);
2308 wd->calc_job = ecore_job_add(_calc_job, wd);
2309 wd->must_recalc_idler = NULL;
2310 return ECORE_CALLBACK_CANCEL;
2314 _calc_job(void *data)
2316 Widget_Data *wd = data;
2317 Item_Block *itb, *chb = NULL;
2318 Evas_Coord minw = -1, minh = 0, y = 0, ow;
2321 Eina_Bool minw_change = EINA_FALSE, changed = EINA_FALSE;
2322 Eina_Bool did_must_recalc = EINA_FALSE;
2325 t0 = ecore_time_get();
2326 evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h);
2330 evas_event_freeze(evas_object_evas_get(wd->obj));
2331 EINA_INLIST_FOREACH(wd->blocks, itb)
2333 Eina_Bool showme = EINA_FALSE;
2336 showme = itb->showme;
2337 itb->showme = EINA_FALSE;
2340 if (itb->realized) _item_block_unrealize(itb);
2342 if ((itb->changed) || (changed) ||
2343 ((itb->must_recalc) && (!did_must_recalc)))
2345 if ((changed) || (itb->must_recalc))
2348 Elm_Genlist_Item *it;
2349 EINA_LIST_FOREACH(itb->items, l, it)
2350 if (it->mincalcd) it->mincalcd = EINA_FALSE;
2351 itb->changed = EINA_TRUE;
2352 if (itb->must_recalc) did_must_recalc = EINA_TRUE;
2353 itb->must_recalc = EINA_FALSE;
2355 if (itb->realized) _item_block_unrealize(itb);
2356 showme = _item_block_recalc(itb, in, EINA_FALSE);
2362 if (minw == -1) minw = itb->minw;
2363 else if ((!itb->must_recalc) && (minw < itb->minw))
2366 minw_change = EINA_TRUE;
2372 if ((showme) && (wd->show_item) && (!wd->show_item->queued))
2374 wd->show_item->showme = EINA_FALSE;
2376 elm_smart_scroller_region_bring_in(wd->scr,
2378 wd->show_item->block->x,
2380 wd->show_item->block->y,
2381 wd->show_item->block->w,
2384 elm_smart_scroller_child_region_show(wd->scr,
2386 wd->show_item->block->x,
2388 wd->show_item->block->y,
2389 wd->show_item->block->w,
2391 wd->show_item = NULL;
2396 EINA_INLIST_FOREACH(wd->blocks, itb)
2402 if ((chb) && (EINA_INLIST_GET(chb)->next))
2404 EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb)
2406 if (itb->realized) _item_block_unrealize(itb);
2409 wd->realminw = minw;
2410 if (minw < wd->w) minw = wd->w;
2411 if ((minw != wd->minw) || (minh != wd->minh))
2415 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
2416 _sizing_eval(wd->obj);
2417 if ((wd->anchor_item) && (wd->anchor_item->block) && (!wd->auto_scroll_enabled))
2419 Elm_Genlist_Item *it;
2422 it = wd->anchor_item;
2423 it_y = wd->anchor_y;
2424 elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x,
2425 it->block->y + it->y + it_y);
2426 wd->anchor_item = it;
2427 wd->anchor_y = it_y;
2430 t = ecore_time_get();
2431 if (did_must_recalc)
2433 if (!wd->must_recalc_idler)
2434 wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd);
2436 wd->calc_job = NULL;
2437 evas_object_smart_changed(wd->pan_smart);
2438 evas_event_thaw(evas_object_evas_get(wd->obj));
2439 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2443 _update_job(void *data)
2445 Widget_Data *wd = data;
2449 Eina_Bool position = EINA_FALSE, recalc = EINA_FALSE;
2451 wd->update_job = NULL;
2454 evas_event_freeze(evas_object_evas_get(wd->obj));
2455 EINA_INLIST_FOREACH(wd->blocks, itb)
2457 Evas_Coord itminw, itminh;
2458 Elm_Genlist_Item *it;
2464 _item_block_position(itb, num);
2468 recalc = EINA_FALSE;
2469 EINA_LIST_FOREACH(itb->items, l2, it)
2476 it->updateme = EINA_FALSE;
2479 _item_unrealize(it, EINA_FALSE);
2480 _item_realize(it, num, EINA_FALSE);
2481 position = EINA_TRUE;
2485 _item_realize(it, num, EINA_TRUE);
2486 _item_unrealize(it, EINA_TRUE);
2488 if ((it->minw != itminw) || (it->minh != itminh))
2493 itb->updateme = EINA_FALSE;
2496 position = EINA_TRUE;
2497 itb->changed = EINA_TRUE;
2498 _item_block_recalc(itb, num0, EINA_FALSE);
2499 _item_block_position(itb, num0);
2504 if (wd->calc_job) ecore_job_del(wd->calc_job);
2505 wd->calc_job = ecore_job_add(_calc_job, wd);
2507 evas_event_thaw(evas_object_evas_get(wd->obj));
2508 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2512 _pan_set(Evas_Object *obj,
2516 Pan *sd = evas_object_smart_data_get(obj);
2519 // Evas_Coord ow, oh;
2520 // evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2521 // ow = sd->wd->minw - ow;
2522 // if (ow < 0) ow = 0;
2523 // oh = sd->wd->minh - oh;
2524 // if (oh < 0) oh = 0;
2525 // if (x < 0) x = 0;
2526 // if (y < 0) y = 0;
2527 // if (x > ow) x = ow;
2528 // if (y > oh) y = oh;
2529 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
2533 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2535 if ((itb->y + itb->h) > y)
2537 Elm_Genlist_Item *it;
2540 EINA_LIST_FOREACH(itb->items, l2, it)
2542 if ((itb->y + it->y) >= y)
2544 sd->wd->anchor_item = it;
2545 sd->wd->anchor_y = -(itb->y + it->y - y);
2552 if (!sd->wd->reorder_move_animator) evas_object_smart_changed(obj);
2556 _pan_get(Evas_Object *obj,
2560 Pan *sd = evas_object_smart_data_get(obj);
2562 if (x) *x = sd->wd->pan_x;
2563 if (y) *y = sd->wd->pan_y;
2567 _pan_max_get(Evas_Object *obj,
2571 Pan *sd = evas_object_smart_data_get(obj);
2574 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2575 ow = sd->wd->minw - ow;
2577 oh = sd->wd->minh - oh;
2584 _pan_min_get(Evas_Object *obj __UNUSED__,
2593 _pan_child_size_get(Evas_Object *obj,
2597 Pan *sd = evas_object_smart_data_get(obj);
2599 if (w) *w = sd->wd->minw;
2600 if (h) *h = sd->wd->minh;
2604 _pan_add(Evas_Object *obj)
2607 Evas_Object_Smart_Clipped_Data *cd;
2610 cd = evas_object_smart_data_get(obj);
2613 sd->__clipped_data = *cd;
2615 evas_object_smart_data_set(obj, sd);
2619 _pan_del(Evas_Object *obj)
2621 Pan *sd = evas_object_smart_data_get(obj);
2626 ecore_job_del(sd->resize_job);
2627 sd->resize_job = NULL;
2633 _pan_resize_job(void *data)
2636 _sizing_eval(sd->wd->obj);
2637 sd->resize_job = NULL;
2641 _pan_resize(Evas_Object *obj,
2645 Pan *sd = evas_object_smart_data_get(obj);
2648 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2649 if ((ow == w) && (oh == h)) return;
2650 if ((sd->wd->height_for_width) && (ow != w))
2652 if (sd->resize_job) ecore_job_del(sd->resize_job);
2653 sd->resize_job = ecore_job_add(_pan_resize_job, sd);
2655 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2656 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2660 _pan_calculate(Evas_Object *obj)
2662 Pan *sd = evas_object_smart_data_get(obj);
2664 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2666 Elm_Genlist_Item *git;
2669 evas_event_freeze(evas_object_evas_get(obj));
2670 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
2671 evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
2672 EINA_LIST_FOREACH(sd->wd->group_items, l, git)
2674 git->want_realize = EINA_FALSE;
2676 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2678 itb->w = sd->wd->minw;
2679 if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox,
2680 itb->y - sd->wd->pan_y + oy,
2682 cvx, cvy, cvw, cvh))
2684 if ((!itb->realized) || (itb->changed))
2685 _item_block_realize(itb);
2686 _item_block_position(itb, in);
2690 if (itb->realized) _item_block_unrealize(itb);
2694 if ((!sd->wd->reorder_it) || (sd->wd->reorder_pan_move))
2695 _group_items_recalc(sd->wd);
2696 if ((sd->wd->reorder_mode) && (sd->wd->reorder_it))
2698 if (sd->wd->pan_y != sd->wd->old_pan_y)
2699 sd->wd->reorder_pan_move = EINA_TRUE;
2700 else sd->wd->reorder_pan_move = EINA_FALSE;
2701 evas_object_raise(sd->wd->reorder_it->base.view);
2702 sd->wd->old_pan_y = sd->wd->pan_y;
2703 sd->wd->start_time = ecore_loop_time_get();
2705 _item_auto_scroll(sd->wd);
2706 evas_event_thaw(evas_object_evas_get(obj));
2707 evas_event_thaw_eval(evas_object_evas_get(obj));
2711 _pan_move(Evas_Object *obj,
2712 Evas_Coord x __UNUSED__,
2713 Evas_Coord y __UNUSED__)
2715 Pan *sd = evas_object_smart_data_get(obj);
2717 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2718 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2722 _hold_on(void *data __UNUSED__,
2724 void *event_info __UNUSED__)
2726 Widget_Data *wd = elm_widget_data_get(obj);
2728 elm_smart_scroller_hold_set(wd->scr, 1);
2732 _hold_off(void *data __UNUSED__,
2734 void *event_info __UNUSED__)
2736 Widget_Data *wd = elm_widget_data_get(obj);
2738 elm_smart_scroller_hold_set(wd->scr, 0);
2742 _freeze_on(void *data __UNUSED__,
2744 void *event_info __UNUSED__)
2746 Widget_Data *wd = elm_widget_data_get(obj);
2748 elm_smart_scroller_freeze_set(wd->scr, 1);
2752 _freeze_off(void *data __UNUSED__,
2754 void *event_info __UNUSED__)
2756 Widget_Data *wd = elm_widget_data_get(obj);
2758 elm_smart_scroller_freeze_set(wd->scr, 0);
2762 _scroll_edge_left(void *data,
2763 Evas_Object *scr __UNUSED__,
2764 void *event_info __UNUSED__)
2766 Evas_Object *obj = data;
2767 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_LEFT, NULL);
2771 _scroll_edge_right(void *data,
2772 Evas_Object *scr __UNUSED__,
2773 void *event_info __UNUSED__)
2775 Evas_Object *obj = data;
2776 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_RIGHT, NULL);
2780 _scroll_edge_top(void *data,
2781 Evas_Object *scr __UNUSED__,
2782 void *event_info __UNUSED__)
2784 Evas_Object *obj = data;
2785 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_TOP, NULL);
2789 _scroll_edge_bottom(void *data,
2790 Evas_Object *scr __UNUSED__,
2791 void *event_info __UNUSED__)
2793 Evas_Object *obj = data;
2794 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_BOTTOM, NULL);
2798 _mode_item_realize(Elm_Genlist_Item *it)
2802 if ((it->mode_view) || (it->delete_me)) return;
2804 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2805 it->mode_view = edje_object_add(evas_object_evas_get(it->base.widget));
2806 edje_object_scale_set(it->mode_view,
2807 elm_widget_scale_get(it->base.widget) *
2808 _elm_config->scale);
2809 evas_object_smart_member_add(it->mode_view, it->wd->pan_smart);
2810 elm_widget_sub_object_add(it->base.widget, it->mode_view);
2812 strncpy(buf, "item", sizeof(buf));
2813 if (it->wd->compress)
2814 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
2816 if (it->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
2817 strncat(buf, "/", sizeof(buf) - strlen(buf));
2818 strncat(buf, it->itc->mode_item_style, sizeof(buf) - strlen(buf));
2820 _elm_theme_object_set(it->base.widget, it->mode_view, "genlist", buf,
2821 elm_widget_style_get(it->base.widget));
2822 edje_object_mirrored_set(it->mode_view,
2823 elm_widget_mirrored_get(it->base.widget));
2825 /* signal callback add */
2826 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_DOWN,
2828 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_UP,
2830 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_MOVE,
2833 /* label_get, icon_get, state_get */
2834 /* FIXME: If you see that assert, please notify us and we
2835 will clean our mess */
2836 assert(eina_list_count(it->mode_icon_objs) == 0);
2838 _item_label_realize(it, it->mode_view, &it->mode_labels);
2839 it->mode_icon_objs = _item_icon_realize(it,
2842 _item_state_realize(it, it->mode_view, &it->mode_states);
2844 edje_object_part_swallow(it->mode_view,
2845 edje_object_data_get(it->mode_view, "mode_part"),
2848 it->want_unrealize = EINA_FALSE;
2849 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2850 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2854 _mode_item_unrealize(Elm_Genlist_Item *it)
2856 Widget_Data *wd = it->wd;
2858 if (!it->mode_view) return;
2860 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2861 elm_widget_stringlist_free(it->mode_labels);
2862 it->mode_labels = NULL;
2863 elm_widget_stringlist_free(it->mode_icons);
2864 it->mode_icons = NULL;
2865 elm_widget_stringlist_free(it->mode_states);
2867 EINA_LIST_FREE(it->mode_icon_objs, icon)
2868 evas_object_del(icon);
2870 edje_object_part_unswallow(it->mode_view, it->base.view);
2871 evas_object_smart_member_add(it->base.view, wd->pan_smart);
2872 evas_object_del(it->mode_view);
2873 it->mode_view = NULL;
2875 if (wd->mode_item == it)
2876 wd->mode_item = NULL;
2877 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2878 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2882 _item_mode_set(Elm_Genlist_Item *it)
2885 Widget_Data *wd = it->wd;
2890 it->nocache = EINA_TRUE;
2892 if (wd->scr_hold_timer)
2894 ecore_timer_del(wd->scr_hold_timer);
2895 wd->scr_hold_timer = NULL;
2897 elm_smart_scroller_hold_set(wd->scr, EINA_TRUE);
2898 wd->scr_hold_timer = ecore_timer_add(0.1, _scr_hold_timer_cb, wd);
2900 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2901 _mode_item_realize(it);
2902 _item_position(it, it->mode_view, it->scrl_x, it->scrl_y);
2903 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2904 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2906 snprintf(buf, sizeof(buf), "elm,state,%s,active", wd->mode_type);
2907 edje_object_signal_emit(it->mode_view, buf, "elm");
2911 _item_mode_unset(Widget_Data *wd)
2914 if (!wd->mode_item) return;
2915 char buf[1024], buf2[1024];
2916 Elm_Genlist_Item *it;
2919 it->nocache = EINA_TRUE;
2921 snprintf(buf, sizeof(buf), "elm,state,%s,passive", wd->mode_type);
2922 snprintf(buf2, sizeof(buf2), "elm,state,%s,passive,finished", wd->mode_type);
2924 edje_object_signal_emit(it->mode_view, buf, "elm");
2925 edje_object_signal_callback_add(it->mode_view, buf2, "elm", _mode_finished_signal_cb, it);
2927 wd->mode_item = NULL;
2931 _item_auto_scroll(Widget_Data *wd)
2934 Elm_Genlist_Item *it;
2936 Evas_Coord ox, oy, ow, oh;
2938 if ((wd->expanded_item) && (wd->auto_scroll_enabled))
2940 evas_object_geometry_get(wd->obj, &ox, &oy, &ow, &oh);
2941 if (wd->expanded_item->scrl_y > (oh + oy) / 2)
2943 EINA_LIST_FOREACH(wd->expanded_item->items, l, it)
2944 elm_genlist_item_bring_in(it);
2946 wd->auto_scroll_enabled = EINA_FALSE;
2951 elm_genlist_add(Evas_Object *parent)
2956 Evas_Coord minw, minh;
2957 static Evas_Smart *smart = NULL;
2961 static Evas_Smart_Class sc;
2963 evas_object_smart_clipped_smart_set(&_pan_sc);
2965 sc.name = "elm_genlist_pan";
2966 sc.version = EVAS_SMART_CLASS_VERSION;
2969 sc.resize = _pan_resize;
2970 sc.move = _pan_move;
2971 sc.calculate = _pan_calculate;
2972 if (!(smart = evas_smart_class_new(&sc))) return NULL;
2975 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
2977 ELM_SET_WIDTYPE(widtype, "genlist");
2978 elm_widget_type_set(obj, "genlist");
2979 elm_widget_sub_object_add(parent, obj);
2980 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
2981 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
2982 elm_widget_data_set(obj, wd);
2983 elm_widget_del_hook_set(obj, _del_hook);
2984 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
2985 elm_widget_theme_hook_set(obj, _theme_hook);
2986 elm_widget_can_focus_set(obj, EINA_TRUE);
2987 elm_widget_event_hook_set(obj, _event_hook);
2988 elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
2990 wd->scr = elm_smart_scroller_add(e);
2991 elm_smart_scroller_widget_set(wd->scr, obj);
2992 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
2993 elm_widget_style_get(obj));
2994 elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE,
2995 _elm_config->thumbscroll_bounce_enable);
2996 elm_widget_resize_object_set(obj, wd->scr);
2998 evas_object_smart_callback_add(wd->scr, "edge,left", _scroll_edge_left, obj);
2999 evas_object_smart_callback_add(wd->scr, "edge,right", _scroll_edge_right,
3001 evas_object_smart_callback_add(wd->scr, "edge,top", _scroll_edge_top, obj);
3002 evas_object_smart_callback_add(wd->scr, "edge,bottom", _scroll_edge_bottom,
3006 wd->mode = ELM_LIST_SCROLL;
3007 wd->max_items_per_block = MAX_ITEMS_PER_BLOCK;
3008 wd->item_cache_max = wd->max_items_per_block * 2;
3009 wd->longpress_timeout = _elm_config->longpress_timeout;
3011 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
3012 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
3013 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
3014 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
3016 wd->pan_smart = evas_object_smart_add(e, smart);
3017 wd->pan = evas_object_smart_data_get(wd->pan_smart);
3020 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
3021 _pan_set, _pan_get, _pan_max_get,
3022 _pan_min_get, _pan_child_size_get);
3024 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
3026 evas_object_size_hint_min_set(obj, minw, minh);
3028 evas_object_smart_callbacks_descriptions_set(obj, _signals);
3030 _mirrored_set(obj, elm_widget_mirrored_get(obj));
3035 static Elm_Genlist_Item *
3036 _item_new(Widget_Data *wd,
3037 const Elm_Genlist_Item_Class *itc,
3039 Elm_Genlist_Item *parent,
3040 Elm_Genlist_Item_Flags flags,
3042 const void *func_data)
3044 Elm_Genlist_Item *it;
3046 it = elm_widget_item_new(wd->obj, Elm_Genlist_Item);
3047 if (!it) return NULL;
3050 it->base.data = data;
3051 it->parent = parent;
3053 it->func.func = func;
3054 it->func.data = func_data;
3055 it->mouse_cursor = NULL;
3056 it->expanded_depth = 0;
3061 _item_block_add(Widget_Data *wd,
3062 Elm_Genlist_Item *it)
3064 Item_Block *itb = NULL;
3071 itb = calloc(1, sizeof(Item_Block));
3074 if (!it->rel->block)
3077 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3078 itb->items = eina_list_append(itb->items, it);
3084 wd->blocks = eina_inlist_prepend_relative
3085 (wd->blocks, EINA_INLIST_GET(itb),
3086 EINA_INLIST_GET(it->rel->block));
3088 eina_list_prepend_relative(itb->items, it, it->rel);
3092 wd->blocks = eina_inlist_append_relative
3093 (wd->blocks, EINA_INLIST_GET(itb),
3094 EINA_INLIST_GET(it->rel->block));
3096 eina_list_append_relative(itb->items, it, it->rel);
3106 itb = (Item_Block *)(wd->blocks);
3107 if (itb->count >= wd->max_items_per_block)
3109 itb = calloc(1, sizeof(Item_Block));
3113 eina_inlist_prepend(wd->blocks,
3114 EINA_INLIST_GET(itb));
3119 itb = calloc(1, sizeof(Item_Block));
3123 eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
3125 itb->items = eina_list_prepend(itb->items, it);
3131 itb = (Item_Block *)(wd->blocks->last);
3132 if (itb->count >= wd->max_items_per_block)
3134 itb = calloc(1, sizeof(Item_Block));
3138 eina_inlist_append(wd->blocks,
3139 EINA_INLIST_GET(itb));
3144 itb = calloc(1, sizeof(Item_Block));
3148 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3150 itb->items = eina_list_append(itb->items, it);
3156 itb = it->rel->block;
3157 if (!itb) goto newblock;
3159 itb->items = eina_list_prepend_relative(itb->items, it, it->rel);
3161 itb->items = eina_list_append_relative(itb->items, it, it->rel);
3164 itb->changed = EINA_TRUE;
3166 if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job);
3167 itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd);
3170 it->rel->relcount--;
3171 if ((it->rel->delete_me) && (!it->rel->relcount))
3175 if (itb->count > itb->wd->max_items_per_block)
3179 Elm_Genlist_Item *it2;
3181 newc = itb->count / 2;
3182 itb2 = calloc(1, sizeof(Item_Block));
3186 eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
3187 EINA_INLIST_GET(itb));
3188 itb2->changed = EINA_TRUE;
3189 while ((itb->count > newc) && (itb->items))
3193 l = eina_list_last(itb->items);
3195 itb->items = eina_list_remove_list(itb->items, l);
3198 itb2->items = eina_list_prepend(itb2->items, it2);
3206 _queue_process(Widget_Data *wd)
3209 Eina_Bool showme = EINA_FALSE;
3212 t0 = ecore_time_get();
3213 //evas_event_freeze(evas_object_evas_get(wd->obj));
3214 for (n = 0; (wd->queue) && (n < 128); n++)
3216 Elm_Genlist_Item *it;
3218 it = wd->queue->data;
3219 wd->queue = eina_list_remove_list(wd->queue, wd->queue);
3220 it->queued = EINA_FALSE;
3221 _item_block_add(wd, it);
3222 t = ecore_time_get();
3223 if (it->block->changed)
3225 showme = _item_block_recalc(it->block, it->block->num, EINA_TRUE);
3226 it->block->changed = 0;
3228 if (showme) it->block->showme = EINA_TRUE;
3229 if (eina_inlist_count(wd->blocks) > 1)
3231 if ((t - t0) > (ecore_animator_frametime_get())) break;
3234 //evas_event_thaw(evas_object_evas_get(wd->obj));
3235 //evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3240 _idle_process(void *data, Eina_Bool *wakeup)
3242 Widget_Data *wd = data;
3245 //static double q_start = 0.0;
3246 //if (q_start == 0.0) q_start = ecore_time_get();
3248 if (_queue_process(wd) > 0) *wakeup = EINA_TRUE;
3252 //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start);
3254 return ECORE_CALLBACK_CANCEL;
3256 return ECORE_CALLBACK_RENEW;
3260 _item_idle_enterer(void *data)
3262 Widget_Data *wd = data;
3263 Eina_Bool wakeup = EINA_FALSE;
3264 Eina_Bool ok = _idle_process(data, &wakeup);
3269 if (wd->calc_job) ecore_job_del(wd->calc_job);
3270 wd->calc_job = ecore_job_add(_calc_job, wd);
3272 if (ok == ECORE_CALLBACK_CANCEL) wd->queue_idle_enterer = NULL;
3277 _item_queue(Widget_Data *wd,
3278 Elm_Genlist_Item *it)
3280 if (it->queued) return;
3281 it->queued = EINA_TRUE;
3282 wd->queue = eina_list_append(wd->queue, it);
3283 // FIXME: why does a freeze then thaw here cause some genlist
3284 // elm_genlist_item_append() to be much much slower?
3285 // evas_event_freeze(evas_object_evas_get(wd->obj));
3286 while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
3288 if (wd->queue_idle_enterer)
3290 ecore_idle_enterer_del(wd->queue_idle_enterer);
3291 wd->queue_idle_enterer = NULL;
3295 // evas_event_thaw(evas_object_evas_get(wd->obj));
3296 // evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3297 if (!wd->queue_idle_enterer)
3298 wd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, wd);
3302 _elm_genlist_item_compare_data(const void *data, const void *data1)
3304 const Elm_Genlist_Item *item = data;
3305 const Elm_Genlist_Item *item1 = data1;
3307 return _elm_genlist_item_compare_data_cb(item->base.data, item1->base.data);
3311 _elm_genlist_item_compare(const void *data, const void *data1)
3313 const Elm_Genlist_Item *item, *item1;
3314 item = ELM_GENLIST_ITEM_FROM_INLIST(data);
3315 item1 = ELM_GENLIST_ITEM_FROM_INLIST(data1);
3316 return _elm_genlist_item_compare_cb(item, item1);
3320 _elm_genlist_item_list_compare(const void *data, const void *data1)
3322 const Elm_Genlist_Item *item = data;
3323 const Elm_Genlist_Item *item1 = data1;
3324 return _elm_genlist_item_compare_cb(item, item1);
3328 _item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after)
3333 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3334 _item_block_del(it);
3336 it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
3338 it->rel->relcount++;
3339 it->before = EINA_FALSE;
3340 if (after->group_item) it->group_item = after->group_item;
3341 _item_queue(it->wd, it);
3343 // TODO: change this to smart callback
3344 if (it->itc->func.moved)
3345 it->itc->func.moved(it->base.widget, it, after, EINA_TRUE);
3349 _item_move_before(Elm_Genlist_Item *it, Elm_Genlist_Item *before)
3352 if (!before) return;
3354 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3355 _item_block_del(it);
3356 it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
3358 it->rel->relcount++;
3359 it->before = EINA_TRUE;
3360 if (before->group_item) it->group_item = before->group_item;
3361 _item_queue(it->wd, it);
3363 // TODO: change this to smart callback
3364 if (it->itc->func.moved)
3365 it->itc->func.moved(it->base.widget, it, before, EINA_FALSE);
3368 EAPI Elm_Genlist_Item *
3369 elm_genlist_item_append(Evas_Object *obj,
3370 const Elm_Genlist_Item_Class *itc,
3372 Elm_Genlist_Item *parent,
3373 Elm_Genlist_Item_Flags flags,
3375 const void *func_data)
3377 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3378 Widget_Data *wd = elm_widget_data_get(obj);
3379 if (!wd) return NULL;
3380 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3382 if (!it) return NULL;
3385 if (flags & ELM_GENLIST_ITEM_GROUP)
3386 wd->group_items = eina_list_append(wd->group_items, it);
3387 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
3392 Elm_Genlist_Item *it2 = NULL;
3393 Eina_List *ll = eina_list_last(it->parent->items);
3394 if (ll) it2 = ll->data;
3395 it->parent->items = eina_list_append(it->parent->items, it);
3396 if (!it2) it2 = it->parent;
3398 eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3399 EINA_INLIST_GET(it2));
3401 it->rel->relcount++;
3403 if (it->parent->flags & ELM_GENLIST_ITEM_GROUP)
3404 it->group_item = parent;
3405 else if (it->parent->group_item)
3406 it->group_item = it->parent->group_item;
3408 it->before = EINA_FALSE;
3409 _item_queue(wd, it);
3413 EAPI Elm_Genlist_Item *
3414 elm_genlist_item_prepend(Evas_Object *obj,
3415 const Elm_Genlist_Item_Class *itc,
3417 Elm_Genlist_Item *parent,
3418 Elm_Genlist_Item_Flags flags,
3420 const void *func_data)
3422 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3423 Widget_Data *wd = elm_widget_data_get(obj);
3424 if (!wd) return NULL;
3425 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3427 if (!it) return NULL;
3430 if (flags & ELM_GENLIST_ITEM_GROUP)
3431 wd->group_items = eina_list_prepend(wd->group_items, it);
3432 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
3437 Elm_Genlist_Item *it2 = NULL;
3438 Eina_List *ll = it->parent->items;
3439 if (ll) it2 = ll->data;
3440 it->parent->items = eina_list_prepend(it->parent->items, it);
3441 if (!it2) it2 = it->parent;
3443 eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3444 EINA_INLIST_GET(it2));
3446 it->rel->relcount++;
3448 it->before = EINA_TRUE;
3449 _item_queue(wd, it);
3453 EAPI Elm_Genlist_Item *
3454 elm_genlist_item_insert_before(Evas_Object *obj,
3455 const Elm_Genlist_Item_Class *itc,
3457 Elm_Genlist_Item *parent,
3458 Elm_Genlist_Item *before,
3459 Elm_Genlist_Item_Flags flags,
3461 const void *func_data)
3463 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3464 EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
3465 Widget_Data *wd = elm_widget_data_get(obj);
3466 if (!wd) return NULL;
3467 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3469 if (!it) return NULL;
3472 it->parent->items = eina_list_prepend_relative(it->parent->items, it,
3475 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3476 EINA_INLIST_GET(before));
3478 it->rel->relcount++;
3479 it->before = EINA_TRUE;
3480 _item_queue(wd, it);
3484 EAPI Elm_Genlist_Item *
3485 elm_genlist_item_direct_sorted_insert(Evas_Object *obj,
3486 const Elm_Genlist_Item_Class *itc,
3488 Elm_Genlist_Item *parent,
3489 Elm_Genlist_Item_Flags flags,
3490 Eina_Compare_Cb comp,
3492 const void *func_data)
3494 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3495 Widget_Data *wd = elm_widget_data_get(obj);
3496 if (!wd) return NULL;
3497 Elm_Genlist_Item *rel = NULL;
3498 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3500 if (!it) return NULL;
3502 _elm_genlist_item_compare_cb = comp;
3509 l = eina_list_search_sorted_near_list(it->parent->items,
3510 _elm_genlist_item_list_compare, it,
3513 rel = eina_list_data_get(l);
3517 if (cmp_result >= 0)
3519 it->parent->items = eina_list_prepend_relative_list(it->parent->items, it, l);
3520 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
3521 it->before = EINA_FALSE;
3523 else if (cmp_result < 0)
3525 it->parent->items = eina_list_append_relative_list(it->parent->items, it, l);
3526 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(rel));
3527 it->before = EINA_TRUE;
3530 if (it->parent->flags & ELM_GENLIST_ITEM_GROUP)
3531 it->group_item = parent;
3532 else if (it->parent->group_item)
3533 it->group_item = it->parent->group_item;
3537 if (flags & ELM_GENLIST_ITEM_GROUP)
3538 wd->group_items = eina_list_append(wd->group_items, it);
3540 wd->items = eina_inlist_sorted_insert(wd->items, EINA_INLIST_GET(it),
3541 _elm_genlist_item_compare);
3543 if (EINA_INLIST_GET(it)->next)
3545 rel = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3546 it->before = EINA_TRUE;
3548 else if (EINA_INLIST_GET(it)->prev)
3550 rel = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3551 it->before = EINA_FALSE;
3558 it->rel->relcount++;
3561 _item_queue(wd, it);
3566 EAPI Elm_Genlist_Item *
3567 elm_genlist_item_sorted_insert(Evas_Object *obj,
3568 const Elm_Genlist_Item_Class *itc,
3570 Elm_Genlist_Item *parent,
3571 Elm_Genlist_Item_Flags flags,
3572 Eina_Compare_Cb comp,
3574 const void *func_data)
3576 _elm_genlist_item_compare_data_cb = comp;
3578 return elm_genlist_item_direct_sorted_insert(obj, itc, data, parent, flags,
3579 _elm_genlist_item_compare_data, func, func_data);
3582 EAPI Elm_Genlist_Item *
3583 elm_genlist_item_insert_after(Evas_Object *obj,
3584 const Elm_Genlist_Item_Class *itc,
3586 Elm_Genlist_Item *parent,
3587 Elm_Genlist_Item *after,
3588 Elm_Genlist_Item_Flags flags,
3590 const void *func_data)
3592 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3593 EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
3594 Widget_Data *wd = elm_widget_data_get(obj);
3595 if (!wd) return NULL;
3596 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3598 if (!it) return NULL;
3599 /* It make no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */
3600 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3602 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3603 EINA_INLIST_GET(after));
3606 it->parent->items = eina_list_append_relative(it->parent->items, it,
3610 it->rel->relcount++;
3611 it->before = EINA_FALSE;
3612 _item_queue(wd, it);
3617 elm_genlist_clear(Evas_Object *obj)
3619 ELM_CHECK_WIDTYPE(obj, widtype);
3620 Widget_Data *wd = elm_widget_data_get(obj);
3622 if (wd->walking > 0)
3624 Elm_Genlist_Item *it;
3626 wd->clear_me = EINA_TRUE;
3627 EINA_INLIST_FOREACH(wd->items, it)
3629 it->delete_me = EINA_TRUE;
3633 evas_event_freeze(evas_object_evas_get(wd->obj));
3636 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
3638 if (wd->anchor_item == it)
3640 wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3641 if (!wd->anchor_item)
3643 ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3645 wd->items = eina_inlist_remove(wd->items, wd->items);
3646 if (it->flags & ELM_GENLIST_ITEM_GROUP)
3647 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
3648 elm_widget_item_pre_notify_del(it);
3649 if (it->realized) _item_unrealize(it, EINA_FALSE);
3650 if (((wd->clear_me) || (!it->delete_me)) && (it->itc->func.del))
3651 it->itc->func.del((void *)it->base.data, it->base.widget);
3652 if (it->long_timer) ecore_timer_del(it->long_timer);
3653 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
3654 elm_widget_item_del(it);
3656 wd->clear_me = EINA_FALSE;
3657 wd->anchor_item = NULL;
3660 Item_Block *itb = (Item_Block *)(wd->blocks);
3662 wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
3663 if (itb->items) eina_list_free(itb->items);
3668 ecore_job_del(wd->calc_job);
3669 wd->calc_job = NULL;
3671 if (wd->queue_idle_enterer)
3673 ecore_idle_enterer_del(wd->queue_idle_enterer);
3674 wd->queue_idle_enterer = NULL;
3676 if (wd->must_recalc_idler)
3678 ecore_idler_del(wd->must_recalc_idler);
3679 wd->must_recalc_idler = NULL;
3683 eina_list_free(wd->queue);
3688 eina_list_free(wd->selected);
3689 wd->selected = NULL;
3691 if (wd->reorder_move_animator)
3693 ecore_animator_del(wd->reorder_move_animator);
3694 wd->reorder_move_animator = NULL;
3696 wd->show_item = NULL;
3704 evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
3705 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
3708 evas_event_thaw(evas_object_evas_get(wd->obj));
3709 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3713 elm_genlist_multi_select_set(Evas_Object *obj,
3716 ELM_CHECK_WIDTYPE(obj, widtype);
3717 Widget_Data *wd = elm_widget_data_get(obj);
3723 elm_genlist_multi_select_get(const Evas_Object *obj)
3725 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3726 Widget_Data *wd = elm_widget_data_get(obj);
3727 if (!wd) return EINA_FALSE;
3731 EAPI Elm_Genlist_Item *
3732 elm_genlist_selected_item_get(const Evas_Object *obj)
3734 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3735 Widget_Data *wd = elm_widget_data_get(obj);
3736 if (!wd) return NULL;
3737 if (wd->selected) return wd->selected->data;
3741 EAPI const Eina_List *
3742 elm_genlist_selected_items_get(const Evas_Object *obj)
3744 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3745 Widget_Data *wd = elm_widget_data_get(obj);
3746 if (!wd) return NULL;
3747 return wd->selected;
3751 elm_genlist_realized_items_get(const Evas_Object *obj)
3753 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3754 Widget_Data *wd = elm_widget_data_get(obj);
3755 Eina_List *list = NULL;
3757 Eina_Bool done = EINA_FALSE;
3758 if (!wd) return NULL;
3759 EINA_INLIST_FOREACH(wd->blocks, itb)
3764 Elm_Genlist_Item *it;
3767 EINA_LIST_FOREACH(itb->items, l, it)
3769 if (it->realized) list = eina_list_append(list, it);
3780 EAPI Elm_Genlist_Item *
3781 elm_genlist_at_xy_item_get(const Evas_Object *obj,
3786 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3787 Widget_Data *wd = elm_widget_data_get(obj);
3788 Evas_Coord ox, oy, ow, oh;
3791 if (!wd) return NULL;
3792 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
3794 EINA_INLIST_FOREACH(wd->blocks, itb)
3797 Elm_Genlist_Item *it;
3799 if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
3800 oy + itb->y - itb->wd->pan_y,
3801 itb->w, itb->h, x, y, 1, 1))
3803 EINA_LIST_FOREACH(itb->items, l, it)
3805 Evas_Coord itx, ity;
3807 itx = ox + itb->x + it->x - itb->wd->pan_x;
3808 ity = oy + itb->y + it->y - itb->wd->pan_y;
3809 if (ELM_RECTS_INTERSECT(itx, ity, it->w, it->h, x, y, 1, 1))
3813 if (y <= (ity + (it->h / 4))) *posret = -1;
3814 else if (y >= (ity + it->h - (it->h / 4)))
3820 lasty = ity + it->h;
3825 if (y > lasty) *posret = 1;
3831 EAPI Elm_Genlist_Item *
3832 elm_genlist_first_item_get(const Evas_Object *obj)
3834 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3835 Widget_Data *wd = elm_widget_data_get(obj);
3836 if (!wd) return NULL;
3837 if (!wd->items) return NULL;
3838 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
3839 while ((it) && (it->delete_me))
3840 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3844 EAPI Elm_Genlist_Item *
3845 elm_genlist_last_item_get(const Evas_Object *obj)
3847 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3848 Widget_Data *wd = elm_widget_data_get(obj);
3849 if (!wd) return NULL;
3850 if (!wd->items) return NULL;
3851 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
3852 while ((it) && (it->delete_me))
3853 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3857 EAPI Elm_Genlist_Item *
3858 elm_genlist_item_next_get(const Elm_Genlist_Item *it)
3860 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3863 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3864 if ((it) && (!it->delete_me)) break;
3866 return (Elm_Genlist_Item *)it;
3869 EAPI Elm_Genlist_Item *
3870 elm_genlist_item_prev_get(const Elm_Genlist_Item *it)
3872 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3875 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3876 if ((it) && (!it->delete_me)) break;
3878 return (Elm_Genlist_Item *)it;
3882 elm_genlist_item_genlist_get(const Elm_Genlist_Item *it)
3884 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3885 return it->base.widget;
3888 EAPI Elm_Genlist_Item *
3889 elm_genlist_item_parent_get(const Elm_Genlist_Item *it)
3891 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3896 elm_genlist_item_subitems_clear(Elm_Genlist_Item *it)
3898 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3899 Eina_List *tl = NULL, *l;
3900 Elm_Genlist_Item *it2;
3902 EINA_LIST_FOREACH(it->items, l, it2)
3903 tl = eina_list_append(tl, it2);
3904 EINA_LIST_FREE(tl, it2)
3905 elm_genlist_item_del(it2);
3909 elm_genlist_item_selected_set(Elm_Genlist_Item *it,
3912 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3913 Widget_Data *wd = elm_widget_data_get(it->base.widget);
3915 if ((it->delete_me) || (it->disabled)) return;
3916 selected = !!selected;
3917 if (it->selected == selected) return;
3923 while (wd->selected)
3925 _item_unhighlight(wd->selected->data);
3926 _item_unselect(wd->selected->data);
3929 _item_highlight(it);
3934 _item_unhighlight(it);
3940 elm_genlist_item_selected_get(const Elm_Genlist_Item *it)
3942 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
3943 return it->selected;
3947 elm_genlist_item_expanded_set(Elm_Genlist_Item *it,
3950 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3951 if (it->expanded == expanded) return;
3952 it->expanded = expanded;
3953 it->wd->expanded_item = it;
3957 edje_object_signal_emit(it->base.view, "elm,state,expanded", "elm");
3958 evas_object_smart_callback_call(it->base.widget, SIG_EXPANDED, it);
3959 it->wd->auto_scroll_enabled = EINA_TRUE;
3964 edje_object_signal_emit(it->base.view, "elm,state,contracted", "elm");
3965 evas_object_smart_callback_call(it->base.widget, SIG_CONTRACTED, it);
3966 it->wd->auto_scroll_enabled = EINA_FALSE;
3971 elm_genlist_item_expanded_get(const Elm_Genlist_Item *it)
3973 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
3974 return it->expanded;
3978 elm_genlist_item_expanded_depth_get(const Elm_Genlist_Item *it)
3980 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, 0);
3981 return it->expanded_depth;
3985 elm_genlist_item_disabled_set(Elm_Genlist_Item *it,
3988 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3991 if (it->disabled == disabled) return;
3992 if (it->delete_me) return;
3993 it->disabled = !!disabled;
3995 elm_genlist_item_selected_set(it, EINA_FALSE);
3999 edje_object_signal_emit(it->base.view, "elm,state,disabled", "elm");
4001 edje_object_signal_emit(it->base.view, "elm,state,enabled", "elm");
4002 EINA_LIST_FOREACH(it->icon_objs, l, obj)
4003 elm_widget_disabled_set(obj, disabled);
4008 elm_genlist_item_disabled_get(const Elm_Genlist_Item *it)
4010 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4011 if (it->delete_me) return EINA_FALSE;
4012 return it->disabled;
4016 elm_genlist_item_display_only_set(Elm_Genlist_Item *it,
4017 Eina_Bool display_only)
4019 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4020 if (it->display_only == display_only) return;
4021 if (it->delete_me) return;
4022 it->display_only = display_only;
4023 it->mincalcd = EINA_FALSE;
4024 it->updateme = EINA_TRUE;
4025 if (it->block) it->block->updateme = EINA_TRUE;
4026 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4027 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4031 elm_genlist_item_display_only_get(const Elm_Genlist_Item *it)
4033 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4034 if (it->delete_me) return EINA_FALSE;
4035 return it->display_only;
4039 elm_genlist_item_show(Elm_Genlist_Item *it)
4041 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4042 Evas_Coord gith = 0;
4043 if (it->delete_me) return;
4044 if ((it->queued) || (!it->mincalcd))
4046 it->wd->show_item = it;
4047 it->wd->bring_in = EINA_TRUE;
4048 it->showme = EINA_TRUE;
4051 if (it->wd->show_item)
4053 it->wd->show_item->showme = EINA_FALSE;
4054 it->wd->show_item = NULL;
4056 if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
4057 gith = it->group_item->h;
4058 elm_smart_scroller_child_region_show(it->wd->scr,
4059 it->x + it->block->x,
4060 it->y + it->block->y - gith,
4061 it->block->w, it->h);
4065 elm_genlist_item_bring_in(Elm_Genlist_Item *it)
4067 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4068 Evas_Coord gith = 0;
4069 if (it->delete_me) return;
4070 if ((it->queued) || (!it->mincalcd))
4072 it->wd->show_item = it;
4073 it->wd->bring_in = EINA_TRUE;
4074 it->showme = EINA_TRUE;
4077 if (it->wd->show_item)
4079 it->wd->show_item->showme = EINA_FALSE;
4080 it->wd->show_item = NULL;
4082 if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
4083 gith = it->group_item->h;
4084 elm_smart_scroller_region_bring_in(it->wd->scr,
4085 it->x + it->block->x,
4086 it->y + it->block->y - gith,
4087 it->block->w, it->h);
4091 elm_genlist_item_top_show(Elm_Genlist_Item *it)
4093 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4095 Evas_Coord gith = 0;
4097 if (it->delete_me) return;
4098 if ((it->queued) || (!it->mincalcd))
4100 it->wd->show_item = it;
4101 it->wd->bring_in = EINA_TRUE;
4102 it->showme = EINA_TRUE;
4105 if (it->wd->show_item)
4107 it->wd->show_item->showme = EINA_FALSE;
4108 it->wd->show_item = NULL;
4110 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4111 if (it->group_item) gith = it->group_item->h;
4112 elm_smart_scroller_child_region_show(it->wd->scr,
4113 it->x + it->block->x,
4114 it->y + it->block->y - gith,
4119 elm_genlist_item_top_bring_in(Elm_Genlist_Item *it)
4121 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4123 Evas_Coord gith = 0;
4125 if (it->delete_me) return;
4126 if ((it->queued) || (!it->mincalcd))
4128 it->wd->show_item = it;
4129 it->wd->bring_in = EINA_TRUE;
4130 it->showme = EINA_TRUE;
4133 if (it->wd->show_item)
4135 it->wd->show_item->showme = EINA_FALSE;
4136 it->wd->show_item = NULL;
4138 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4139 if (it->group_item) gith = it->group_item->h;
4140 elm_smart_scroller_region_bring_in(it->wd->scr,
4141 it->x + it->block->x,
4142 it->y + it->block->y - gith,
4147 elm_genlist_item_middle_show(Elm_Genlist_Item *it)
4149 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4152 if (it->delete_me) return;
4153 if ((it->queued) || (!it->mincalcd))
4155 it->wd->show_item = it;
4156 it->wd->bring_in = EINA_TRUE;
4157 it->showme = EINA_TRUE;
4160 if (it->wd->show_item)
4162 it->wd->show_item->showme = EINA_FALSE;
4163 it->wd->show_item = NULL;
4165 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4166 elm_smart_scroller_child_region_show(it->wd->scr,
4167 it->x + it->block->x,
4168 it->y + it->block->y - oh / 2 +
4169 it->h / 2, it->block->w, oh);
4173 elm_genlist_item_middle_bring_in(Elm_Genlist_Item *it)
4175 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4178 if (it->delete_me) return;
4179 if ((it->queued) || (!it->mincalcd))
4181 it->wd->show_item = it;
4182 it->wd->bring_in = EINA_TRUE;
4183 it->showme = EINA_TRUE;
4186 if (it->wd->show_item)
4188 it->wd->show_item->showme = EINA_FALSE;
4189 it->wd->show_item = NULL;
4191 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4192 elm_smart_scroller_region_bring_in(it->wd->scr,
4193 it->x + it->block->x,
4194 it->y + it->block->y - oh / 2 + it->h / 2,
4199 elm_genlist_item_del(Elm_Genlist_Item *it)
4201 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4202 if ((it->relcount > 0) || (it->walking > 0))
4204 elm_widget_item_pre_notify_del(it);
4205 elm_genlist_item_subitems_clear(it);
4206 it->delete_me = EINA_TRUE;
4207 if (it->wd->show_item == it) it->wd->show_item = NULL;
4209 it->wd->selected = eina_list_remove(it->wd->selected,
4213 if (it->realized) _item_unrealize(it, EINA_FALSE);
4214 it->block->changed = EINA_TRUE;
4215 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
4216 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
4218 if (it->itc->func.del)
4219 it->itc->func.del((void *)it->base.data, it->base.widget);
4226 elm_genlist_item_data_set(Elm_Genlist_Item *it,
4229 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4230 elm_widget_item_data_set(it, data);
4234 elm_genlist_item_data_get(const Elm_Genlist_Item *it)
4236 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4237 return elm_widget_item_data_get(it);
4241 elm_genlist_item_icons_orphan(Elm_Genlist_Item *it)
4244 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4245 EINA_LIST_FREE(it->icon_objs, icon)
4247 elm_widget_sub_object_del(it->base.widget, icon);
4248 evas_object_smart_member_del(icon);
4249 evas_object_hide(icon);
4253 EAPI const Evas_Object *
4254 elm_genlist_item_object_get(const Elm_Genlist_Item *it)
4256 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4257 return it->base.view;
4261 elm_genlist_item_update(Elm_Genlist_Item *it)
4263 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4264 if (!it->block) return;
4265 if (it->delete_me) return;
4266 it->mincalcd = EINA_FALSE;
4267 it->updateme = EINA_TRUE;
4268 it->block->updateme = EINA_TRUE;
4269 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4270 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4274 elm_genlist_item_item_class_update(Elm_Genlist_Item *it,
4275 const Elm_Genlist_Item_Class *itc)
4277 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4278 if (!it->block) return;
4279 EINA_SAFETY_ON_NULL_RETURN(itc);
4280 if (it->delete_me) return;
4282 it->nocache = EINA_TRUE;
4283 elm_genlist_item_update(it);
4286 EAPI const Elm_Genlist_Item_Class *
4287 elm_genlist_item_item_class_get(const Elm_Genlist_Item *it)
4289 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4290 if (it->delete_me) return NULL;
4294 static Evas_Object *
4295 _elm_genlist_item_label_create(void *data,
4296 Evas_Object *obj __UNUSED__,
4297 Evas_Object *tooltip,
4298 void *item __UNUSED__)
4300 Evas_Object *label = elm_label_add(tooltip);
4303 elm_object_style_set(label, "tooltip");
4304 elm_object_text_set(label, data);
4309 _elm_genlist_item_label_del_cb(void *data,
4310 Evas_Object *obj __UNUSED__,
4311 void *event_info __UNUSED__)
4313 eina_stringshare_del(data);
4317 elm_genlist_item_tooltip_text_set(Elm_Genlist_Item *item,
4320 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4321 text = eina_stringshare_add(text);
4322 elm_genlist_item_tooltip_content_cb_set(item, _elm_genlist_item_label_create,
4324 _elm_genlist_item_label_del_cb);
4328 elm_genlist_item_tooltip_content_cb_set(Elm_Genlist_Item *item,
4329 Elm_Tooltip_Item_Content_Cb func,
4331 Evas_Smart_Cb del_cb)
4333 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(item, error);
4335 if ((item->tooltip.content_cb == func) && (item->tooltip.data == data))
4338 if (item->tooltip.del_cb)
4339 item->tooltip.del_cb((void *)item->tooltip.data,
4340 item->base.widget, item);
4342 item->tooltip.content_cb = func;
4343 item->tooltip.data = data;
4344 item->tooltip.del_cb = del_cb;
4346 if (item->base.view)
4348 elm_widget_item_tooltip_content_cb_set(item,
4349 item->tooltip.content_cb,
4350 item->tooltip.data, NULL);
4351 elm_widget_item_tooltip_style_set(item, item->tooltip.style);
4352 elm_widget_item_tooltip_size_restrict_disable(item, item->tooltip.free_size);
4358 if (del_cb) del_cb((void *)data, NULL, NULL);
4362 elm_genlist_item_tooltip_unset(Elm_Genlist_Item *item)
4364 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4365 if ((item->base.view) && (item->tooltip.content_cb))
4366 elm_widget_item_tooltip_unset(item);
4368 if (item->tooltip.del_cb)
4369 item->tooltip.del_cb((void *)item->tooltip.data, item->base.widget, item);
4370 item->tooltip.del_cb = NULL;
4371 item->tooltip.content_cb = NULL;
4372 item->tooltip.data = NULL;
4373 item->tooltip.free_size = EINA_FALSE;
4374 if (item->tooltip.style)
4375 elm_genlist_item_tooltip_style_set(item, NULL);
4379 elm_genlist_item_tooltip_style_set(Elm_Genlist_Item *item,
4382 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4383 eina_stringshare_replace(&item->tooltip.style, style);
4384 if (item->base.view) elm_widget_item_tooltip_style_set(item, style);
4388 elm_genlist_item_tooltip_style_get(const Elm_Genlist_Item *item)
4390 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4391 return item->tooltip.style;
4395 elm_genlist_item_tooltip_size_restrict_disable(Elm_Genlist_Item *item, Eina_Bool disable)
4397 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
4398 item->tooltip.free_size = disable;
4399 if (item->base.view) return elm_widget_item_tooltip_size_restrict_disable(item, disable);
4404 elm_genlist_item_tooltip_size_restrict_disabled_get(const Elm_Genlist_Item *item)
4406 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
4407 return item->tooltip.free_size;
4411 elm_genlist_item_cursor_set(Elm_Genlist_Item *item,
4414 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4415 eina_stringshare_replace(&item->mouse_cursor, cursor);
4416 if (item->base.view) elm_widget_item_cursor_set(item, cursor);
4420 elm_genlist_item_cursor_get(const Elm_Genlist_Item *item)
4422 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4423 return elm_widget_item_cursor_get(item);
4427 elm_genlist_item_cursor_unset(Elm_Genlist_Item *item)
4429 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4430 if (!item->mouse_cursor)
4433 if (item->base.view)
4434 elm_widget_item_cursor_unset(item);
4436 eina_stringshare_del(item->mouse_cursor);
4437 item->mouse_cursor = NULL;
4441 elm_genlist_item_cursor_style_set(Elm_Genlist_Item *item,
4444 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4445 elm_widget_item_cursor_style_set(item, style);
4449 elm_genlist_item_cursor_style_get(const Elm_Genlist_Item *item)
4451 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4452 return elm_widget_item_cursor_style_get(item);
4456 elm_genlist_item_cursor_engine_only_set(Elm_Genlist_Item *item,
4457 Eina_Bool engine_only)
4459 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4460 elm_widget_item_cursor_engine_only_set(item, engine_only);
4464 elm_genlist_item_cursor_engine_only_get(const Elm_Genlist_Item *item)
4466 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
4467 return elm_widget_item_cursor_engine_only_get(item);
4471 elm_genlist_horizontal_mode_set(Evas_Object *obj,
4474 ELM_CHECK_WIDTYPE(obj, widtype);
4475 Widget_Data *wd = elm_widget_data_get(obj);
4477 if (wd->mode == mode) return;
4483 elm_genlist_horizontal_mode_get(const Evas_Object *obj)
4485 ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
4486 Widget_Data *wd = elm_widget_data_get(obj);
4487 if (!wd) return ELM_LIST_LAST;
4492 elm_genlist_always_select_mode_set(Evas_Object *obj,
4493 Eina_Bool always_select)
4495 ELM_CHECK_WIDTYPE(obj, widtype);
4496 Widget_Data *wd = elm_widget_data_get(obj);
4498 wd->always_select = always_select;
4502 elm_genlist_always_select_mode_get(const Evas_Object *obj)
4504 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4505 Widget_Data *wd = elm_widget_data_get(obj);
4506 if (!wd) return EINA_FALSE;
4507 return wd->always_select;
4511 elm_genlist_no_select_mode_set(Evas_Object *obj,
4512 Eina_Bool no_select)
4514 ELM_CHECK_WIDTYPE(obj, widtype);
4515 Widget_Data *wd = elm_widget_data_get(obj);
4517 wd->no_select = no_select;
4521 elm_genlist_no_select_mode_get(const Evas_Object *obj)
4523 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4524 Widget_Data *wd = elm_widget_data_get(obj);
4525 if (!wd) return EINA_FALSE;
4526 return wd->no_select;
4530 elm_genlist_compress_mode_set(Evas_Object *obj,
4533 ELM_CHECK_WIDTYPE(obj, widtype);
4534 Widget_Data *wd = elm_widget_data_get(obj);
4536 wd->compress = compress;
4537 if (!compress) elm_genlist_homogeneous_set(obj, EINA_FALSE);
4541 elm_genlist_compress_mode_get(const Evas_Object *obj)
4543 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4544 Widget_Data *wd = elm_widget_data_get(obj);
4545 if (!wd) return EINA_FALSE;
4546 return wd->compress;
4550 elm_genlist_height_for_width_mode_set(Evas_Object *obj,
4551 Eina_Bool height_for_width)
4553 ELM_CHECK_WIDTYPE(obj, widtype);
4554 Widget_Data *wd = elm_widget_data_get(obj);
4556 wd->height_for_width = !!height_for_width;
4557 if (wd->height_for_width)
4559 elm_genlist_homogeneous_set(obj, EINA_FALSE);
4560 elm_genlist_compress_mode_set(obj, EINA_TRUE);
4565 elm_genlist_height_for_width_mode_get(const Evas_Object *obj)
4567 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4568 Widget_Data *wd = elm_widget_data_get(obj);
4569 if (!wd) return EINA_FALSE;
4570 return wd->height_for_width;
4574 elm_genlist_bounce_set(Evas_Object *obj,
4578 ELM_CHECK_WIDTYPE(obj, widtype);
4579 Widget_Data *wd = elm_widget_data_get(obj);
4581 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
4585 elm_genlist_bounce_get(const Evas_Object *obj,
4586 Eina_Bool *h_bounce,
4587 Eina_Bool *v_bounce)
4589 ELM_CHECK_WIDTYPE(obj, widtype);
4590 Widget_Data *wd = elm_widget_data_get(obj);
4592 elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce);
4596 elm_genlist_homogeneous_set(Evas_Object *obj,
4597 Eina_Bool homogeneous)
4599 ELM_CHECK_WIDTYPE(obj, widtype);
4600 Widget_Data *wd = elm_widget_data_get(obj);
4602 if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
4603 wd->homogeneous = homogeneous;
4607 elm_genlist_homogeneous_get(const Evas_Object *obj)
4609 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4610 Widget_Data *wd = elm_widget_data_get(obj);
4611 if (!wd) return EINA_FALSE;
4612 return wd->homogeneous;
4616 elm_genlist_block_count_set(Evas_Object *obj,
4619 ELM_CHECK_WIDTYPE(obj, widtype);
4620 Widget_Data *wd = elm_widget_data_get(obj);
4622 wd->max_items_per_block = n;
4623 wd->item_cache_max = wd->max_items_per_block * 2;
4624 _item_cache_clean(wd);
4628 elm_genlist_block_count_get(const Evas_Object *obj)
4630 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4631 Widget_Data *wd = elm_widget_data_get(obj);
4633 return wd->max_items_per_block;
4637 elm_genlist_longpress_timeout_set(Evas_Object *obj,
4640 ELM_CHECK_WIDTYPE(obj, widtype);
4641 Widget_Data *wd = elm_widget_data_get(obj);
4643 wd->longpress_timeout = timeout;
4647 elm_genlist_longpress_timeout_get(const Evas_Object *obj)
4649 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4650 Widget_Data *wd = elm_widget_data_get(obj);
4652 return wd->longpress_timeout;
4656 elm_genlist_scroller_policy_set(Evas_Object *obj,
4657 Elm_Scroller_Policy policy_h,
4658 Elm_Scroller_Policy policy_v)
4660 ELM_CHECK_WIDTYPE(obj, widtype);
4661 Widget_Data *wd = elm_widget_data_get(obj);
4663 if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
4664 (policy_v >= ELM_SCROLLER_POLICY_LAST))
4667 elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
4671 elm_genlist_scroller_policy_get(const Evas_Object *obj,
4672 Elm_Scroller_Policy *policy_h,
4673 Elm_Scroller_Policy *policy_v)
4675 ELM_CHECK_WIDTYPE(obj, widtype);
4676 Widget_Data *wd = elm_widget_data_get(obj);
4677 Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
4678 if ((!wd) || (!wd->scr)) return;
4679 elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
4680 if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
4681 if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
4685 elm_genlist_realized_items_update(Evas_Object *obj)
4687 ELM_CHECK_WIDTYPE(obj, widtype);
4689 Eina_List *list, *l;
4690 Elm_Genlist_Item *it;
4692 list = elm_genlist_realized_items_get(obj);
4693 EINA_LIST_FOREACH(list, l, it)
4694 elm_genlist_item_update(it);
4698 * Set genlist item mode
4700 * @param item The genlist item
4701 * @param mode Mode name
4702 * @param mode_set Boolean to define set or unset mode.
4707 elm_genlist_item_mode_set(Elm_Genlist_Item *it,
4708 const char *mode_type,
4711 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4712 Widget_Data *wd = it->wd;
4714 Elm_Genlist_Item *it2;
4717 if (!mode_type) return;
4718 if ((it->delete_me) || (it->disabled)) return;
4720 if ((wd->mode_item == it) &&
4721 (!strcmp(mode_type, wd->mode_type)) &&
4724 if (!it->itc->mode_item_style) return;
4728 EINA_LIST_FOREACH(wd->selected, l, it2)
4730 elm_genlist_item_selected_set(it2, EINA_FALSE);
4734 it2 = elm_genlist_selected_item_get(wd->obj);
4735 if ((it2) && (it2->realized))
4736 elm_genlist_item_selected_set(it2, EINA_FALSE);
4739 if (((wd->mode_type) && (strcmp(mode_type, wd->mode_type))) ||
4741 ((it == wd->mode_item) && (!mode_set)))
4742 _item_mode_unset(wd);
4744 eina_stringshare_replace(&wd->mode_type, mode_type);
4745 if (mode_set) _item_mode_set(it);
4749 * Get active genlist mode type
4751 * @param obj The genlist object
4756 elm_genlist_mode_get(const Evas_Object *obj)
4758 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4759 Widget_Data *wd = elm_widget_data_get(obj);
4760 if (!wd) return NULL;
4761 return wd->mode_type;
4765 * Get active genlist mode item
4767 * @param obj The genlist object
4771 EAPI const Elm_Genlist_Item *
4772 elm_genlist_mode_item_get(const Evas_Object *obj)
4774 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4775 Widget_Data *wd = elm_widget_data_get(obj);
4776 if (!wd) return NULL;
4777 return wd->mode_item;
4783 * @param obj The genlist object
4784 * @param reorder_mode The reorder mode
4785 * (EINA_TRUE = on, EINA_FALSE = off)
4790 elm_genlist_reorder_mode_set(Evas_Object *obj,
4791 Eina_Bool reorder_mode)
4793 ELM_CHECK_WIDTYPE(obj, widtype);
4794 Widget_Data *wd = elm_widget_data_get(obj);
4796 wd->reorder_mode = reorder_mode;
4800 * Get the reorder mode
4802 * @param obj The genlist object
4803 * @return The reorder mode
4804 * (EINA_TRUE = on, EINA_FALSE = off)
4809 elm_genlist_reorder_mode_get(const Evas_Object *obj)
4811 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4812 Widget_Data *wd = elm_widget_data_get(obj);
4813 if (!wd) return EINA_FALSE;
4814 return wd->reorder_mode;