2 #include <Elementary.h>
3 #include <Elementary_Cursor.h>
7 #define MAX_ITEMS_PER_BLOCK 32
8 #define REORDER_EFFECT_TIME 0.5
10 typedef struct _Widget_Data Widget_Data;
11 typedef struct _Item_Block Item_Block;
12 typedef struct _Pan Pan;
13 typedef struct _Item_Cache Item_Cache;
14 typedef enum _Elm_Genlist_Item_Move_effect_Mode
16 ELM_GENLIST_ITEM_MOVE_EFFECT_NONE = 0,
17 ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND = (1 << 0),
18 ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT = (1 << 1),
19 ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE = (1 << 2),
20 } Elm_Genlist_Item_Move_effect_Mode;
24 Evas_Object *obj, *scr, *pan_smart;
25 Eina_Inlist *items, *blocks;
26 Eina_List *group_items;
28 Evas_Coord pan_x, pan_y, w, h, minw, minh, realminw, prev_viewport_w;
29 Ecore_Job *calc_job, *update_job;
30 Ecore_Idle_Enterer *queue_idle_enterer;
31 Ecore_Idler *must_recalc_idler;
32 Eina_List *queue, *selected;
33 Elm_Genlist_Item *show_item, *last_selected_item, *anchor_item, *mode_item, *reorder_it, *reorder_rel, *expand_item;
34 Eina_Inlist *item_cache;
35 Evas_Coord anchor_y, reorder_start_y;
37 Ecore_Timer *multi_timer, *scr_hold_timer;
38 const char *mode_type;
39 unsigned int start_time;
40 Evas_Coord prev_x, prev_y, prev_mx, prev_my;
41 Evas_Coord cur_x, cur_y, cur_mx, cur_my;
42 Eina_Bool mouse_down : 1;
43 Eina_Bool multi_down : 1;
44 Eina_Bool multi_timeout : 1;
45 Eina_Bool multitouched : 1;
46 Eina_Bool on_hold : 1;
48 Eina_Bool always_select : 1;
49 Eina_Bool longpressed : 1;
50 Eina_Bool wasselected : 1;
51 Eina_Bool no_select : 1;
52 Eina_Bool bring_in : 1;
53 Eina_Bool compress : 1;
54 Eina_Bool height_for_width : 1;
55 Eina_Bool homogeneous : 1;
56 Eina_Bool clear_me : 1;
58 Eina_Bool reorder_mode : 1;
59 Eina_Bool reorder_pan_move : 1;
63 } history[SWIPE_MOVES];
72 int group_item_height;
73 int max_items_per_block;
74 double longpress_timeout;
77 Eina_Bool reorder_deleted : 1;
78 Eina_Bool effect_mode : 1;
79 Eina_Bool auto_scrolled : 1;
81 Ecore_Animator *item_moving_effect_timer;
82 Evas_Object *alpha_bg;
83 Evas_Coord expand_item_end;
84 Evas_Coord expand_item_gap;
86 Ecore_Job *changed_job;
87 Elm_Genlist_Item *rename_it;
98 Evas_Coord x, y, w, h, minw, minh;
99 Eina_Bool want_unrealize : 1;
100 Eina_Bool realized : 1;
101 Eina_Bool changed : 1;
102 Eina_Bool updateme : 1;
103 Eina_Bool showme : 1;
104 Eina_Bool must_recalc : 1;
107 struct _Elm_Genlist_Item
109 Elm_Widget_Item base;
114 Evas_Coord x, y, w, h, minw, minh;
115 const Elm_Genlist_Item_Class *itc;
116 Elm_Genlist_Item *parent;
117 Elm_Genlist_Item *group_item;
118 Elm_Genlist_Item_Flags flags;
126 Eina_List *labels, *icons, *states, *icon_objs;
127 Eina_List *mode_labels, *mode_icons, *mode_states, *mode_icon_objs;
128 Ecore_Timer *long_timer;
129 Ecore_Timer *swipe_timer;
131 Evas_Coord scrl_x, scrl_y;
133 Elm_Genlist_Item *rel;
134 Evas_Object *mode_view;
139 Elm_Tooltip_Item_Content_Cb content_cb;
140 Evas_Smart_Cb del_cb;
144 const char *mouse_cursor;
151 Eina_Bool before : 1;
153 Eina_Bool want_unrealize : 1;
154 Eina_Bool want_realize : 1;
155 Eina_Bool realized : 1;
156 Eina_Bool selected : 1;
157 Eina_Bool highlighted : 1;
158 Eina_Bool expanded : 1;
159 Eina_Bool disabled : 1;
160 Eina_Bool display_only : 1;
161 Eina_Bool mincalcd : 1;
162 Eina_Bool queued : 1;
163 Eina_Bool showme : 1;
164 Eina_Bool delete_me : 1;
166 Eina_Bool dragging : 1;
167 Eina_Bool updateme : 1;
168 Eina_Bool nocache : 1;
171 Eina_Bool move_effect_me : 1;
172 Eina_Bool effect_done : 1;
173 Eina_Bool reordering : 1;
174 Eina_Bool renamed : 1;
175 Eina_Bool effect_item_realized : 1;
176 Eina_List *edit_icon_objs;
177 Evas_Object *edit_obj;
179 Ecore_Animator *item_moving_effect_timer;
180 Evas_Coord old_scrl_y;
187 Evas_Object *base_view, *spacer;
189 const char *item_style; // it->itc->item_style
190 Eina_Bool tree : 1; // it->flags & ELM_GENLIST_ITEM_SUBITEMS
191 Eina_Bool compress : 1; // it->wd->compress
192 Eina_Bool odd : 1; // in & 0x1
194 Eina_Bool selected : 1; // it->selected
195 Eina_Bool disabled : 1; // it->disabled
196 Eina_Bool expanded : 1; // it->expanded
199 #define ELM_GENLIST_ITEM_FROM_INLIST(item) \
200 ((item) ? EINA_INLIST_CONTAINER_GET(item, Elm_Genlist_Item) : NULL)
204 Evas_Object_Smart_Clipped_Data __clipped_data;
206 Ecore_Job *resize_job;
209 static const char *widtype = NULL;
210 static void _item_cache_zero(Widget_Data *wd);
211 static void _del_hook(Evas_Object *obj);
212 static void _mirrored_set(Evas_Object *obj,
214 static void _theme_hook(Evas_Object *obj);
215 static void _show_region_hook(void *data,
217 static void _sizing_eval(Evas_Object *obj);
218 static void _item_realize(Elm_Genlist_Item *it,
221 static void _item_unrealize(Elm_Genlist_Item *it,
223 static void _item_block_unrealize(Item_Block *itb);
224 static void _calc_job(void *data);
225 static void _on_focus_hook(void *data,
227 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
228 static void _changed_job(void *data);
229 static Eina_Bool _item_multi_select_up(Widget_Data *wd);
230 static Eina_Bool _item_multi_select_down(Widget_Data *wd);
231 static Eina_Bool _item_single_select_up(Widget_Data *wd);
232 static Eina_Bool _item_single_select_down(Widget_Data *wd);
233 static Eina_Bool _event_hook(Evas_Object *obj,
235 Evas_Callback_Type type,
237 static void _signal_emit_hook(Evas_Object *obj,
238 const char *emission,
240 static Eina_Bool _deselect_all_items(Widget_Data *wd);
241 static void _pan_calculate(Evas_Object *obj);
242 static void _item_position(Elm_Genlist_Item *it, Evas_Object *obj);
243 static void _mode_item_realize(Elm_Genlist_Item *it);
244 static void _mode_item_unrealize(Elm_Genlist_Item *it);
245 static void _item_mode_set(Elm_Genlist_Item *it);
246 static void _item_mode_unset(Widget_Data *wd);
247 static void _group_items_recalc(void *data);
249 // TODO : refactoring
250 static Evas_Object* _create_tray_alpha_bg(const Evas_Object *obj);
251 static unsigned int current_time_get();
252 static Eina_Bool _item_moving_effect_timer_cb(void *data);
253 static int _item_flip_effect_show(Elm_Genlist_Item *it);
254 static void _effect_item_controls(Elm_Genlist_Item *it, int itx, int ity);
255 static void _effect_item_realize(Elm_Genlist_Item *it, Eina_Bool effect_on);
256 static void _effect_item_unrealize(Elm_Genlist_Item *it);
257 static void _effect_item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after);
258 static void _effect_item_move_before(Elm_Genlist_Item *it, Elm_Genlist_Item *before);
259 static void _item_auto_scroll(void *data);
261 static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
263 static const char SIG_ACTIVATED[] = "activated";
264 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
265 static const char SIG_SELECTED[] = "selected";
266 static const char SIG_UNSELECTED[] = "unselected";
267 static const char SIG_EXPANDED[] = "expanded";
268 static const char SIG_CONTRACTED[] = "contracted";
269 static const char SIG_EXPAND_REQUEST[] = "expand,request";
270 static const char SIG_CONTRACT_REQUEST[] = "contract,request";
271 static const char SIG_REALIZED[] = "realized";
272 static const char SIG_UNREALIZED[] = "unrealized";
273 static const char SIG_DRAG_START_UP[] = "drag,start,up";
274 static const char SIG_DRAG_START_DOWN[] = "drag,start,down";
275 static const char SIG_DRAG_START_LEFT[] = "drag,start,left";
276 static const char SIG_DRAG_START_RIGHT[] = "drag,start,right";
277 static const char SIG_DRAG_STOP[] = "drag,stop";
278 static const char SIG_DRAG[] = "drag";
279 static const char SIG_LONGPRESSED[] = "longpressed";
280 static const char SIG_SCROLL_EDGE_TOP[] = "scroll,edge,top";
281 static const char SIG_SCROLL_EDGE_BOTTOM[] = "scroll,edge,bottom";
282 static const char SIG_SCROLL_EDGE_LEFT[] = "scroll,edge,left";
283 static const char SIG_SCROLL_EDGE_RIGHT[] = "scroll,edge,right";
284 static const char SIG_MULTI_SWIPE_LEFT[] = "multi,swipe,left";
285 static const char SIG_MULTI_SWIPE_RIGHT[] = "multi,swipe,right";
286 static const char SIG_MULTI_SWIPE_UP[] = "multi,swipe,up";
287 static const char SIG_MULTI_SWIPE_DOWN[] = "multi,swipe,down";
288 static const char SIG_MULTI_PINCH_OUT[] = "multi,pinch,out";
289 static const char SIG_MULTI_PINCH_IN[] = "multi,pinch,in";
290 static const char SIG_SWIPE[] = "swipe";
292 static const Evas_Smart_Cb_Description _signals[] = {
293 {SIG_CLICKED_DOUBLE, ""},
296 {SIG_UNSELECTED, ""},
298 {SIG_CONTRACTED, ""},
299 {SIG_EXPAND_REQUEST, ""},
300 {SIG_CONTRACT_REQUEST, ""},
302 {SIG_UNREALIZED, ""},
303 {SIG_DRAG_START_UP, ""},
304 {SIG_DRAG_START_DOWN, ""},
305 {SIG_DRAG_START_LEFT, ""},
306 {SIG_DRAG_START_RIGHT, ""},
309 {SIG_LONGPRESSED, ""},
310 {SIG_SCROLL_EDGE_TOP, ""},
311 {SIG_SCROLL_EDGE_BOTTOM, ""},
312 {SIG_SCROLL_EDGE_LEFT, ""},
313 {SIG_SCROLL_EDGE_RIGHT, ""},
314 {SIG_MULTI_SWIPE_LEFT, ""},
315 {SIG_MULTI_SWIPE_RIGHT, ""},
316 {SIG_MULTI_SWIPE_UP, ""},
317 {SIG_MULTI_SWIPE_DOWN, ""},
318 {SIG_MULTI_PINCH_OUT, ""},
319 {SIG_MULTI_PINCH_IN, ""},
325 _event_hook(Evas_Object *obj,
326 Evas_Object *src __UNUSED__,
327 Evas_Callback_Type type,
330 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
331 Evas_Event_Key_Down *ev = event_info;
332 Widget_Data *wd = elm_widget_data_get(obj);
333 if (!wd) return EINA_FALSE;
334 if (!wd->items) return EINA_FALSE;
335 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
336 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
338 Elm_Genlist_Item *it = NULL;
341 Evas_Coord step_x = 0;
342 Evas_Coord step_y = 0;
345 Evas_Coord page_x = 0;
346 Evas_Coord page_y = 0;
348 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
349 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
350 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
351 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
353 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
357 else if ((!strcmp(ev->keyname, "Right")) ||
358 (!strcmp(ev->keyname, "KP_Right")))
362 else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
364 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
365 (_item_multi_select_up(wd)))
366 || (_item_single_select_up(wd)))
368 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
374 else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
376 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
377 (_item_multi_select_down(wd)))
378 || (_item_single_select_down(wd)))
380 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
386 else if ((!strcmp(ev->keyname, "Home")) ||
387 (!strcmp(ev->keyname, "KP_Home")))
389 it = elm_genlist_first_item_get(obj);
390 elm_genlist_item_bring_in(it);
391 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
394 else if ((!strcmp(ev->keyname, "End")) ||
395 (!strcmp(ev->keyname, "KP_End")))
397 it = elm_genlist_last_item_get(obj);
398 elm_genlist_item_bring_in(it);
399 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
402 else if ((!strcmp(ev->keyname, "Prior")) ||
403 (!strcmp(ev->keyname, "KP_Prior")))
406 y -= -(page_y * v_h) / 100;
410 else if ((!strcmp(ev->keyname, "Next")) ||
411 (!strcmp(ev->keyname, "KP_Next")))
414 y += -(page_y * v_h) / 100;
418 else if (((!strcmp(ev->keyname, "Return")) ||
419 (!strcmp(ev->keyname, "KP_Enter")) ||
420 (!strcmp(ev->keyname, "space")))
421 && (!wd->multi) && (wd->selected))
423 it = elm_genlist_selected_item_get(obj);
424 elm_genlist_item_expanded_set(it,
425 !elm_genlist_item_expanded_get(it));
426 evas_object_smart_callback_call(it->base.widget, SIG_ACTIVATED, it);
428 else if (!strcmp(ev->keyname, "Escape"))
430 if (!_deselect_all_items(wd)) return EINA_FALSE;
431 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
434 else return EINA_FALSE;
436 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
437 elm_smart_scroller_child_pos_set(wd->scr, x, y);
442 _deselect_all_items(Widget_Data *wd)
444 if (!wd->selected) return EINA_FALSE;
446 elm_genlist_item_selected_set(wd->selected->data, EINA_FALSE);
452 _item_multi_select_up(Widget_Data *wd)
454 if (!wd->selected) return EINA_FALSE;
455 if (!wd->multi) return EINA_FALSE;
457 Elm_Genlist_Item *prev = elm_genlist_item_prev_get(wd->last_selected_item);
458 if (!prev) return EINA_TRUE;
460 if (elm_genlist_item_selected_get(prev))
462 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
463 wd->last_selected_item = prev;
464 elm_genlist_item_show(wd->last_selected_item);
468 elm_genlist_item_selected_set(prev, EINA_TRUE);
469 elm_genlist_item_show(prev);
475 _item_multi_select_down(Widget_Data *wd)
477 if (!wd->selected) return EINA_FALSE;
478 if (!wd->multi) return EINA_FALSE;
480 Elm_Genlist_Item *next = elm_genlist_item_next_get(wd->last_selected_item);
481 if (!next) return EINA_TRUE;
483 if (elm_genlist_item_selected_get(next))
485 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
486 wd->last_selected_item = next;
487 elm_genlist_item_show(wd->last_selected_item);
491 elm_genlist_item_selected_set(next, EINA_TRUE);
492 elm_genlist_item_show(next);
498 _item_single_select_up(Widget_Data *wd)
500 Elm_Genlist_Item *prev;
503 prev = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
504 while ((prev) && (prev->delete_me))
505 prev = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
507 else prev = elm_genlist_item_prev_get(wd->last_selected_item);
509 if (!prev) return EINA_FALSE;
511 _deselect_all_items(wd);
513 elm_genlist_item_selected_set(prev, EINA_TRUE);
514 elm_genlist_item_show(prev);
519 _item_single_select_down(Widget_Data *wd)
521 Elm_Genlist_Item *next;
524 next = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
525 while ((next) && (next->delete_me))
526 next = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
528 else next = elm_genlist_item_next_get(wd->last_selected_item);
530 if (!next) return EINA_FALSE;
532 _deselect_all_items(wd);
534 elm_genlist_item_selected_set(next, EINA_TRUE);
535 elm_genlist_item_show(next);
540 _on_focus_hook(void *data __UNUSED__,
543 Widget_Data *wd = elm_widget_data_get(obj);
545 if (elm_widget_focus_get(obj))
547 elm_object_signal_emit(wd->obj, "elm,action,focus", "elm");
548 evas_object_focus_set(wd->obj, EINA_TRUE);
549 if ((wd->selected) && (!wd->last_selected_item))
550 wd->last_selected_item = eina_list_data_get(wd->selected);
554 elm_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
555 evas_object_focus_set(wd->obj, EINA_FALSE);
560 _del_hook(Evas_Object *obj)
562 Widget_Data *wd = elm_widget_data_get(obj);
564 _item_cache_zero(wd);
565 if (wd->calc_job) ecore_job_del(wd->calc_job);
566 if (wd->update_job) ecore_job_del(wd->update_job);
567 if (wd->queue_idle_enterer) ecore_idle_enterer_del(wd->queue_idle_enterer);
568 if (wd->changed_job) ecore_job_del(wd->changed_job);
569 if (wd->must_recalc_idler) ecore_idler_del(wd->must_recalc_idler);
570 if (wd->multi_timer) ecore_timer_del(wd->multi_timer);
571 if (wd->mode_type) eina_stringshare_del(wd->mode_type);
572 if (wd->scr_hold_timer) ecore_timer_del(wd->scr_hold_timer);
576 elm_genlist_clear(obj);
582 _del_pre_hook(Evas_Object *obj)
584 Widget_Data *wd = elm_widget_data_get(obj);
586 if (wd->edit_mode) elm_genlist_edit_mode_set(wd->obj, EINA_FALSE);
587 evas_object_del(wd->pan_smart);
588 wd->pan_smart = NULL;
589 elm_genlist_clear(obj);
593 _mirrored_set(Evas_Object *obj,
596 Widget_Data *wd = elm_widget_data_get(obj);
598 _item_cache_zero(wd);
599 elm_smart_scroller_mirrored_set(wd->scr, rtl);
603 _theme_hook(Evas_Object *obj)
605 Widget_Data *wd = elm_widget_data_get(obj);
608 evas_event_freeze(evas_object_evas_get(wd->obj));
609 _item_cache_zero(wd);
610 _elm_widget_mirrored_reload(obj);
611 _mirrored_set(obj, elm_widget_mirrored_get(obj));
612 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
613 elm_widget_style_get(obj));
614 // edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
615 wd->item_width = wd->item_height = 0;
616 wd->group_item_width = wd->group_item_height = 0;
617 wd->minw = wd->minh = wd->realminw = 0;
618 EINA_INLIST_FOREACH(wd->blocks, itb)
621 Elm_Genlist_Item *it;
623 if (itb->realized) _item_block_unrealize(itb);
624 EINA_LIST_FOREACH(itb->items, l, it)
625 it->mincalcd = EINA_FALSE;
627 itb->changed = EINA_TRUE;
629 if (wd->calc_job) ecore_job_del(wd->calc_job);
630 wd->calc_job = ecore_job_add(_calc_job, wd);
632 evas_event_thaw(evas_object_evas_get(wd->obj));
633 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
637 _show_region_hook(void *data,
640 Widget_Data *wd = elm_widget_data_get(data);
641 Evas_Coord x, y, w, h;
643 elm_widget_show_region_get(obj, &x, &y, &w, &h);
644 //x & y are screen coordinates, Add with pan coordinates
647 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
651 _sizing_eval(Evas_Object *obj)
653 Widget_Data *wd = elm_widget_data_get(obj);
654 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
656 evas_object_size_hint_min_get(wd->scr, &minw, &minh);
657 evas_object_size_hint_max_get(wd->scr, &maxw, &maxh);
659 if (wd->height_for_width)
663 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
664 if ((vw != 0) && (vw != wd->prev_viewport_w))
668 wd->prev_viewport_w = vw;
669 EINA_INLIST_FOREACH(wd->blocks, itb)
671 itb->must_recalc = EINA_TRUE;
673 if (wd->calc_job) ecore_job_del(wd->calc_job);
674 wd->calc_job = ecore_job_add(_calc_job, wd);
677 if (wd->mode == ELM_LIST_LIMIT)
679 Evas_Coord vmw, vmh, vw, vh;
683 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
684 if ((minw > 0) && (vw < minw)) vw = minw;
685 else if ((maxw > 0) && (vw > maxw))
687 edje_object_size_min_calc
688 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
695 edje_object_size_min_calc
696 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
700 evas_object_size_hint_min_set(obj, minw, minh);
701 evas_object_size_hint_max_set(obj, maxw, maxh);
705 _signal_emit_hook(Evas_Object *obj,
706 const char *emission,
709 Widget_Data *wd = elm_widget_data_get(obj);
710 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
715 _item_highlight(Elm_Genlist_Item *it)
717 const char *selectraise;
718 if ((it->wd->no_select) || (it->delete_me) || (it->highlighted) ||
719 (it->disabled) || (it->display_only) || (it->mode_view))
721 edje_object_signal_emit(it->base.view, "elm,state,selected", "elm");
722 if (it->edit_obj) edje_object_signal_emit(it->edit_obj, "elm,state,selected", "elm");
723 selectraise = edje_object_data_get(it->base.view, "selectraise");
724 if ((selectraise) && (!strcmp(selectraise, "on")))
726 if (it->edit_obj) evas_object_raise(it->edit_obj);
727 else evas_object_raise(it->base.view);
728 if ((it->group_item) && (it->group_item->realized))
729 evas_object_raise(it->group_item->base.view);
731 it->highlighted = EINA_TRUE;
735 _item_block_del(Elm_Genlist_Item *it)
738 Item_Block *itb = it->block;
740 itb->items = eina_list_remove(itb->items, it);
742 itb->changed = EINA_TRUE;
743 if (!it->wd->reorder_deleted)
745 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
746 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
750 il = EINA_INLIST_GET(itb);
751 Item_Block *itbn = (Item_Block *)(il->next);
753 it->parent->items = eina_list_remove(it->parent->items, it);
755 it->wd->blocks = eina_inlist_remove(it->wd->blocks, il);
757 if (itbn) itbn->changed = EINA_TRUE;
761 if (itb->count < itb->wd->max_items_per_block/2)
763 il = EINA_INLIST_GET(itb);
764 Item_Block *itbp = (Item_Block *)(il->prev);
765 Item_Block *itbn = (Item_Block *)(il->next);
766 if ((itbp) && ((itbp->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
768 Elm_Genlist_Item *it2;
770 EINA_LIST_FREE(itb->items, it2)
773 itbp->items = eina_list_append(itbp->items, it2);
775 itbp->changed = EINA_TRUE;
777 it->wd->blocks = eina_inlist_remove(it->wd->blocks,
778 EINA_INLIST_GET(itb));
781 else if ((itbn) && ((itbn->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
785 Eina_List *last = eina_list_last(itb->items);
786 Elm_Genlist_Item *it2 = last->data;
789 itb->items = eina_list_remove_list(itb->items, last);
790 itbn->items = eina_list_prepend(itbn->items, it2);
792 itbn->changed = EINA_TRUE;
795 eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb));
803 _item_subitems_clear(Elm_Genlist_Item *it)
806 Eina_List *tl = NULL, *l;
807 Elm_Genlist_Item *it2;
809 EINA_LIST_FOREACH(it->items, l, it2)
810 tl = eina_list_append(tl, it2);
812 EINA_LIST_FREE(tl, it2)
813 elm_genlist_item_del(it2);
817 _item_del(Elm_Genlist_Item *it)
819 Evas_Object *tob = it->wd->obj;
821 evas_event_freeze(evas_object_evas_get(tob));
822 elm_widget_item_pre_notify_del(it);
823 elm_genlist_item_subitems_clear(it);
824 it->wd->walking -= it->walking;
825 if (it->wd->show_item == it) it->wd->show_item = NULL;
826 if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it);
827 if (it->realized) _item_unrealize(it, EINA_FALSE);
828 if (it->effect_item_realized) _effect_item_unrealize(it);
829 if (it->block) _item_block_del(it);
830 if ((!it->delete_me) && (it->itc->func.del))
831 it->itc->func.del((void *)it->base.data, it->base.widget);
832 it->delete_me = EINA_TRUE;
834 it->wd->queue = eina_list_remove(it->wd->queue, it);
836 if (it->wd->anchor_item == it)
838 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
839 if (!it->wd->anchor_item)
840 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
843 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
845 it->parent->items = eina_list_remove(it->parent->items, it);
846 if (it->flags & ELM_GENLIST_ITEM_GROUP)
847 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
848 if (it->long_timer) ecore_timer_del(it->long_timer);
849 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
851 if (it->tooltip.del_cb)
852 it->tooltip.del_cb((void *)it->tooltip.data, it->base.widget, it);
854 evas_event_thaw(evas_object_evas_get(tob));
855 evas_event_thaw_eval(evas_object_evas_get(tob));
857 elm_widget_item_del(it);
861 _item_select(Elm_Genlist_Item *it)
863 if ((it->wd->no_select) || (it->delete_me) || (it->mode_view)) return;
866 if (it->wd->always_select) goto call;
869 it->selected = EINA_TRUE;
870 it->wd->selected = eina_list_append(it->wd->selected, it);
876 Evas_Object *baseobj = it->base.widget;
877 const char *objtype = NULL;
878 it->func.func((void *)it->func.data, it->base.widget, it);
879 objtype = evas_object_type_get(baseobj);
880 if ((!objtype) || (!strcmp(objtype,""))) return;
883 evas_object_smart_callback_call(it->base.widget, SIG_SELECTED, it);
886 if ((it->wd->clear_me) && (!it->wd->walking))
888 elm_genlist_clear(it->base.widget);
893 if ((!it->walking) && (it->delete_me))
895 if (!it->relcount) _item_del(it);
898 if (it && it->wd) it->wd->last_selected_item = it; // TODO: Remove 'if'?
902 _item_unselect(Elm_Genlist_Item *it)
904 const char *stacking, *selectraise;
906 if ((it->delete_me) || (!it->highlighted)) return;
907 edje_object_signal_emit(it->base.view, "elm,state,unselected", "elm");
908 if (it->edit_obj) edje_object_signal_emit(it->edit_obj, "elm,state,unselected", "elm");
909 stacking = edje_object_data_get(it->base.view, "stacking");
910 selectraise = edje_object_data_get(it->base.view, "selectraise");
911 if ((selectraise) && (!strcmp(selectraise, "on")))
913 if ((stacking) && (!strcmp(stacking, "below")))
914 evas_object_lower(it->base.view);
916 it->highlighted = EINA_FALSE;
919 it->selected = EINA_FALSE;
920 it->wd->selected = eina_list_remove(it->wd->selected, it);
921 evas_object_smart_callback_call(it->base.widget, SIG_UNSELECTED, it);
926 _mouse_move(void *data,
927 Evas *evas __UNUSED__,
931 Elm_Genlist_Item *it = data;
932 Evas_Event_Mouse_Move *ev = event_info;
933 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
935 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
937 if (!it->wd->on_hold)
939 it->wd->on_hold = EINA_TRUE;
940 if (!it->wd->wasselected)
944 if (it->wd->multitouched)
946 it->wd->cur_x = ev->cur.canvas.x;
947 it->wd->cur_y = ev->cur.canvas.y;
950 if ((it->dragging) && (it->down))
952 if (it->wd->movements == SWIPE_MOVES) it->wd->swipe = EINA_TRUE;
955 it->wd->history[it->wd->movements].x = ev->cur.canvas.x;
956 it->wd->history[it->wd->movements].y = ev->cur.canvas.y;
957 if (abs((it->wd->history[it->wd->movements].x -
958 it->wd->history[0].x)) > 40)
959 it->wd->swipe = EINA_TRUE;
965 ecore_timer_del(it->long_timer);
966 it->long_timer = NULL;
968 evas_object_smart_callback_call(it->base.widget, SIG_DRAG, it);
971 if ((!it->down) /* || (it->wd->on_hold)*/ || (it->wd->longpressed))
975 ecore_timer_del(it->long_timer);
976 it->long_timer = NULL;
978 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
980 Evas_Coord ox,oy,oh,ow;
981 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
982 int it_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
983 if (!it->wd->reorder_start_y) it->wd->reorder_start_y = it->block->y + it->y;
985 if (it_y < oy) _effect_item_controls(it, it->scrl_x, oy);
986 else if (it_y + it->wd->reorder_it->h > oy+oh) _effect_item_controls(it, it->scrl_x, oy + oh - it->wd->reorder_it->h);
987 else _effect_item_controls(it, it->scrl_x, it_y);
989 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
990 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
994 if (!it->display_only)
995 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
996 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
997 x = ev->cur.canvas.x - x;
998 y = ev->cur.canvas.y - y;
1001 if (adx < 0) adx = -dx;
1004 if (ady < 0) ady = -dy;
1007 if ((adx > minw) || (ady > minh))
1009 it->dragging = EINA_TRUE;
1012 ecore_timer_del(it->long_timer);
1013 it->long_timer = NULL;
1015 if (!it->wd->wasselected)
1020 evas_object_smart_callback_call(it->base.widget,
1021 SIG_DRAG_START_UP, it);
1025 evas_object_smart_callback_call(it->base.widget,
1026 SIG_DRAG_START_LEFT, it);
1028 evas_object_smart_callback_call(it->base.widget,
1029 SIG_DRAG_START_RIGHT, it);
1035 evas_object_smart_callback_call(it->base.widget,
1036 SIG_DRAG_START_DOWN, it);
1040 evas_object_smart_callback_call(it->base.widget,
1041 SIG_DRAG_START_LEFT, it);
1043 evas_object_smart_callback_call(it->base.widget,
1044 SIG_DRAG_START_RIGHT, it);
1051 _long_press(void *data)
1053 Elm_Genlist_Item *it = data;
1054 Elm_Genlist_Item *it_tmp;
1055 static Eina_Bool done = EINA_FALSE;
1056 //static Eina_Bool contracted = EINA_FALSE;
1060 it->long_timer = NULL;
1061 if ((it->disabled) || (it->dragging) || (it->display_only) || (it->wd->rename_it))
1062 return ECORE_CALLBACK_CANCEL;
1063 it->wd->longpressed = EINA_TRUE;
1064 evas_object_smart_callback_call(it->base.widget, SIG_LONGPRESSED, it);
1065 if ((it->wd->reorder_mode) && (it->flags != ELM_GENLIST_ITEM_GROUP))
1067 it->wd->reorder_it = it;
1068 it->wd->reorder_start_y = 0;
1069 evas_object_raise(it->edit_obj);
1070 elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
1071 edje_object_signal_emit(it->edit_obj, "elm,action,item,reorder_start", "elm");
1073 EINA_INLIST_FOREACH(it->wd->blocks, itb)
1078 EINA_LIST_FOREACH(itb->items, l, it_tmp)
1080 if (it_tmp->flags != ELM_GENLIST_ITEM_GROUP && it_tmp->realized)
1082 _item_unselect(it_tmp);
1094 EINA_LIST_FOREACH(it->items, l, it_tmp)
1096 if (elm_genlist_item_expanded_get(it_tmp))
1098 elm_genlist_item_expanded_set(it_tmp, EINA_FALSE);
1099 return ECORE_CALLBACK_RENEW;
1103 if (elm_genlist_item_expanded_get(it)) {
1104 elm_genlist_item_expanded_set(it, EINA_FALSE);
1105 return ECORE_CALLBACK_RENEW;
1109 return ECORE_CALLBACK_CANCEL;
1113 _swipe(Elm_Genlist_Item *it)
1118 if ((it->display_only) || (it->disabled)) return;
1119 it->wd->swipe = EINA_FALSE;
1120 for (i = 0; i < it->wd->movements; i++)
1122 sum += it->wd->history[i].x;
1123 if (abs(it->wd->history[0].y - it->wd->history[i].y) > 10) return;
1126 sum /= it->wd->movements;
1127 if (abs(sum - it->wd->history[0].x) <= 10) return;
1128 evas_object_smart_callback_call(it->base.widget, SIG_SWIPE, it);
1132 _swipe_cancel(void *data)
1134 Elm_Genlist_Item *it = data;
1136 if (!it) return ECORE_CALLBACK_CANCEL;
1137 it->wd->swipe = EINA_FALSE;
1138 it->wd->movements = 0;
1139 return ECORE_CALLBACK_RENEW;
1143 _multi_cancel(void *data)
1145 Widget_Data *wd = data;
1147 if (!wd) return ECORE_CALLBACK_CANCEL;
1148 wd->multi_timeout = EINA_TRUE;
1149 return ECORE_CALLBACK_RENEW;
1153 _multi_touch_gesture_eval(void *data)
1155 Elm_Genlist_Item *it = data;
1157 it->wd->multitouched = EINA_FALSE;
1158 if (it->wd->multi_timer)
1160 ecore_timer_del(it->wd->multi_timer);
1161 it->wd->multi_timer = NULL;
1163 if (it->wd->multi_timeout)
1165 it->wd->multi_timeout = EINA_FALSE;
1169 Evas_Coord minw = 0, minh = 0;
1170 Evas_Coord off_x, off_y, off_mx, off_my;
1172 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1173 off_x = abs(it->wd->cur_x - it->wd->prev_x);
1174 off_y = abs(it->wd->cur_y - it->wd->prev_y);
1175 off_mx = abs(it->wd->cur_mx - it->wd->prev_mx);
1176 off_my = abs(it->wd->cur_my - it->wd->prev_my);
1178 if (((off_x > minw) || (off_y > minh)) && ((off_mx > minw) || (off_my > minh)))
1180 if ((off_x + off_mx) > (off_y + off_my))
1182 if ((it->wd->cur_x > it->wd->prev_x) && (it->wd->cur_mx > it->wd->prev_mx))
1183 evas_object_smart_callback_call(it->base.widget,
1184 SIG_MULTI_SWIPE_RIGHT, it);
1185 else if ((it->wd->cur_x < it->wd->prev_x) && (it->wd->cur_mx < it->wd->prev_mx))
1186 evas_object_smart_callback_call(it->base.widget,
1187 SIG_MULTI_SWIPE_LEFT, it);
1188 else if (abs(it->wd->cur_x - it->wd->cur_mx) > abs(it->wd->prev_x - it->wd->prev_mx))
1189 evas_object_smart_callback_call(it->base.widget,
1190 SIG_MULTI_PINCH_OUT, it);
1192 evas_object_smart_callback_call(it->base.widget,
1193 SIG_MULTI_PINCH_IN, it);
1197 if ((it->wd->cur_y > it->wd->prev_y) && (it->wd->cur_my > it->wd->prev_my))
1198 evas_object_smart_callback_call(it->base.widget,
1199 SIG_MULTI_SWIPE_DOWN, it);
1200 else if ((it->wd->cur_y < it->wd->prev_y) && (it->wd->cur_my < it->wd->prev_my))
1201 evas_object_smart_callback_call(it->base.widget,
1202 SIG_MULTI_SWIPE_UP, it);
1203 else if (abs(it->wd->cur_y - it->wd->cur_my) > abs(it->wd->prev_y - it->wd->prev_my))
1204 evas_object_smart_callback_call(it->base.widget,
1205 SIG_MULTI_PINCH_OUT, it);
1207 evas_object_smart_callback_call(it->base.widget,
1208 SIG_MULTI_PINCH_IN, it);
1211 it->wd->multi_timeout = EINA_FALSE;
1215 _multi_down(void *data,
1216 Evas *evas __UNUSED__,
1217 Evas_Object *obj __UNUSED__,
1220 Elm_Genlist_Item *it = data;
1221 Evas_Event_Multi_Down *ev = event_info;
1223 if ((it->wd->multi_device != 0) || (it->wd->multitouched) || (it->wd->multi_timeout)) return;
1224 it->wd->multi_device = ev->device;
1225 it->wd->multi_down = EINA_TRUE;
1226 it->wd->multitouched = EINA_TRUE;
1227 it->wd->prev_mx = ev->canvas.x;
1228 it->wd->prev_my = ev->canvas.y;
1229 if (!it->wd->wasselected) _item_unselect(it);
1230 it->wd->wasselected = EINA_FALSE;
1231 it->wd->longpressed = EINA_FALSE;
1234 ecore_timer_del(it->long_timer);
1235 it->long_timer = NULL;
1239 it->dragging = EINA_FALSE;
1240 evas_object_smart_callback_call(it->base.widget, SIG_DRAG_STOP, it);
1242 if (it->swipe_timer)
1244 ecore_timer_del(it->swipe_timer);
1245 it->swipe_timer = NULL;
1247 if (it->wd->on_hold)
1249 it->wd->swipe = EINA_FALSE;
1250 it->wd->movements = 0;
1251 it->wd->on_hold = EINA_FALSE;
1256 _multi_up(void *data,
1257 Evas *evas __UNUSED__,
1258 Evas_Object *obj __UNUSED__,
1261 Elm_Genlist_Item *it = data;
1262 Evas_Event_Multi_Up *ev = event_info;
1264 if (it->wd->multi_device != ev->device) return;
1265 it->wd->multi_device = 0;
1266 it->wd->multi_down = EINA_FALSE;
1267 if (it->wd->mouse_down) return;
1268 _multi_touch_gesture_eval(data);
1272 _multi_move(void *data,
1273 Evas *evas __UNUSED__,
1274 Evas_Object *obj __UNUSED__,
1277 Elm_Genlist_Item *it = data;
1278 Evas_Event_Multi_Move *ev = event_info;
1280 if (it->wd->multi_device != ev->device) return;
1281 it->wd->cur_mx = ev->cur.canvas.x;
1282 it->wd->cur_my = ev->cur.canvas.y;
1286 _mouse_down(void *data,
1287 Evas *evas __UNUSED__,
1291 Elm_Genlist_Item *it = data;
1292 Evas_Event_Mouse_Down *ev = event_info;
1295 if (ev->button != 1) return;
1296 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1298 it->wd->on_hold = EINA_TRUE;
1300 it->down = EINA_TRUE;
1301 it->dragging = EINA_FALSE;
1302 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1303 it->dx = ev->canvas.x - x;
1304 it->dy = ev->canvas.y - y;
1305 it->wd->mouse_down = EINA_TRUE;
1306 if (!it->wd->multitouched)
1308 it->wd->prev_x = ev->canvas.x;
1309 it->wd->prev_y = ev->canvas.y;
1310 it->wd->multi_timeout = EINA_FALSE;
1311 if (it->wd->multi_timer) ecore_timer_del(it->wd->multi_timer);
1312 it->wd->multi_timer = ecore_timer_add(1, _multi_cancel, it->wd);
1314 it->wd->longpressed = EINA_FALSE;
1315 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1316 else it->wd->on_hold = EINA_FALSE;
1317 if (it->wd->on_hold) return;
1318 it->wd->wasselected = it->selected;
1319 _item_highlight(it);
1320 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
1321 if ((!it->disabled) && (!it->display_only))
1323 evas_object_smart_callback_call(it->base.widget, SIG_CLICKED_DOUBLE, it);
1324 evas_object_smart_callback_call(it->base.widget, SIG_ACTIVATED, it);
1326 if (it->long_timer) ecore_timer_del(it->long_timer);
1327 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
1328 it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
1330 it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press,
1333 it->long_timer = NULL;
1334 it->wd->swipe = EINA_FALSE;
1335 it->wd->movements = 0;
1339 _mouse_up(void *data,
1340 Evas *evas __UNUSED__,
1341 Evas_Object *obj __UNUSED__,
1344 Elm_Genlist_Item *it = data;
1345 Evas_Event_Mouse_Up *ev = event_info;
1346 Eina_Bool dragged = EINA_FALSE;
1348 if (ev->button != 1) return;
1349 it->down = EINA_FALSE;
1350 it->wd->mouse_down = EINA_FALSE;
1351 if (it->wd->multitouched)
1353 // in single selection modes, some multi touching can make multi highlighted items.
1354 // if a item not selected and highlighted, it should be unhighlighted.
1355 if ((!it->wd->multi) && (!it->selected) && (it->highlighted)) _item_unselect(it);
1356 if (it->wd->multi_down) return;
1357 _multi_touch_gesture_eval(data);
1360 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1361 else it->wd->on_hold = EINA_FALSE;
1364 ecore_timer_del(it->long_timer);
1365 it->long_timer = NULL;
1369 it->dragging = EINA_FALSE;
1370 evas_object_smart_callback_call(it->base.widget, SIG_DRAG_STOP, it);
1373 if (it->swipe_timer)
1375 ecore_timer_del(it->swipe_timer);
1376 it->swipe_timer = NULL;
1378 if (it->wd->multi_timer)
1380 ecore_timer_del(it->wd->multi_timer);
1381 it->wd->multi_timer = NULL;
1382 it->wd->multi_timeout = EINA_FALSE;
1384 if (it->wd->on_hold)
1386 if (it->wd->swipe) _swipe(data);
1387 it->wd->longpressed = EINA_FALSE;
1388 it->wd->on_hold = EINA_FALSE;
1391 if (it->wd->reorder_mode)
1393 Evas_Coord rox, roy, row, roh;
1394 Elm_Genlist_Item *reorder_it = it->wd->reorder_it;
1397 Evas_Coord ox,oy,oh,ow;
1398 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
1399 evas_object_geometry_get(it->wd->reorder_it->base.view, &rox, &roy, &row, &roh);
1400 if (it->wd->reorder_rel)
1402 if (it->wd->reorder_it->parent == it->wd->reorder_rel->parent) // todo : refactoring
1404 if (roy + oy <= it->wd->reorder_rel->scrl_y)
1405 _effect_item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
1407 _effect_item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
1410 it->wd->reorder_deleted = EINA_FALSE;
1411 it->wd->reorder_it = it->wd->reorder_rel = NULL;
1412 elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
1413 edje_object_signal_emit(it->edit_obj, "elm,action,item,reorder_end", "elm");
1416 if (it->wd->longpressed)
1418 it->wd->longpressed = EINA_FALSE;
1419 if (!it->wd->wasselected)
1421 it->wd->wasselected = EINA_FALSE;
1426 if (it->want_unrealize)
1428 _item_unrealize(it, EINA_FALSE);
1429 if (it->block->want_unrealize)
1430 _item_block_unrealize(it->block);
1433 if ((it->disabled) || (dragged) || (it->display_only)) return;
1434 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1439 _item_highlight(it);
1442 else _item_unselect(it);
1448 Widget_Data *wd = it->wd;
1451 while (wd->selected) _item_unselect(wd->selected->data);
1456 const Eina_List *l, *l_next;
1457 Elm_Genlist_Item *it2;
1459 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
1460 if (it2 != it) _item_unselect(it2);
1461 //_item_highlight(it);
1464 _item_highlight(it);
1470 _signal_expand_toggle(void *data,
1471 Evas_Object *obj __UNUSED__,
1472 const char *emission __UNUSED__,
1473 const char *source __UNUSED__)
1475 Elm_Genlist_Item *it = data;
1478 evas_object_smart_callback_call(it->base.widget, SIG_CONTRACT_REQUEST, it);
1480 evas_object_smart_callback_call(it->base.widget, SIG_EXPAND_REQUEST, it);
1484 _signal_expand(void *data,
1485 Evas_Object *obj __UNUSED__,
1486 const char *emission __UNUSED__,
1487 const char *source __UNUSED__)
1489 Elm_Genlist_Item *it = data;
1492 evas_object_smart_callback_call(it->base.widget, SIG_EXPAND_REQUEST, it);
1496 _signal_contract(void *data,
1497 Evas_Object *obj __UNUSED__,
1498 const char *emission __UNUSED__,
1499 const char *source __UNUSED__)
1501 Elm_Genlist_Item *it = data;
1504 evas_object_smart_callback_call(it->base.widget, SIG_CONTRACT_REQUEST, it);
1508 _scr_hold_timer_cb(void *data)
1510 if (!data) return ECORE_CALLBACK_CANCEL;
1511 Widget_Data *wd = data;
1512 elm_smart_scroller_hold_set(wd->scr, EINA_FALSE);
1513 wd->scr_hold_timer = NULL;
1514 return ECORE_CALLBACK_CANCEL;
1518 _mode_finished_signal_cb(void *data,
1520 const char *emission __UNUSED__,
1521 const char *source __UNUSED__)
1525 Elm_Genlist_Item *it = data;
1526 if ((it->delete_me) || (!it->realized) || (!it->mode_view)) return;
1528 Evas *te = evas_object_evas_get(obj);
1530 evas_event_freeze(te);
1531 it->nocache = EINA_FALSE;
1532 _mode_item_unrealize(it);
1533 snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished", it->wd->mode_type);
1534 edje_object_signal_callback_del_full(obj, buf, "elm", _mode_finished_signal_cb, it);
1535 evas_event_thaw(te);
1536 evas_event_thaw_eval(te);
1540 _item_cache_clean(Widget_Data *wd)
1542 evas_event_freeze(evas_object_evas_get(wd->obj));
1543 while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max))
1547 itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache);
1548 wd->item_cache = eina_inlist_remove(wd->item_cache,
1549 wd->item_cache->last);
1550 wd->item_cache_count--;
1551 if (itc->spacer) evas_object_del(itc->spacer);
1552 if (itc->base_view) evas_object_del(itc->base_view);
1553 if (itc->item_style) eina_stringshare_del(itc->item_style);
1556 evas_event_thaw(evas_object_evas_get(wd->obj));
1557 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
1561 _item_cache_zero(Widget_Data *wd)
1563 int pmax = wd->item_cache_max;
1564 wd->item_cache_max = 0;
1565 _item_cache_clean(wd);
1566 wd->item_cache_max = pmax;
1570 _item_cache_add(Elm_Genlist_Item *it)
1574 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1575 if (it->wd->item_cache_max <= 0)
1577 evas_object_del(it->base.view);
1578 it->base.view = NULL;
1579 evas_object_del(it->spacer);
1581 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1582 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1586 it->wd->item_cache_count++;
1587 itc = calloc(1, sizeof(Item_Cache));
1590 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1591 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1594 it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache,
1595 EINA_INLIST_GET(itc));
1596 itc->spacer = it->spacer;
1598 itc->base_view = it->base.view;
1599 it->base.view = NULL;
1600 evas_object_hide(itc->base_view);
1601 evas_object_move(itc->base_view, -9999, -9999);
1602 itc->item_style = eina_stringshare_add(it->itc->item_style);
1603 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
1604 itc->compress = (it->wd->compress);
1605 itc->odd = (it->order_num_in & 0x1);
1606 itc->selected = it->selected;
1607 itc->disabled = it->disabled;
1608 itc->expanded = it->expanded;
1611 ecore_timer_del(it->long_timer);
1612 it->long_timer = NULL;
1614 if (it->swipe_timer)
1616 ecore_timer_del(it->swipe_timer);
1617 it->swipe_timer = NULL;
1619 // FIXME: other callbacks?
1620 edje_object_signal_callback_del_full(itc->base_view,
1621 "elm,action,expand,toggle",
1622 "elm", _signal_expand_toggle, it);
1623 edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand",
1625 _signal_expand, it);
1626 edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract",
1627 "elm", _signal_contract, it);
1628 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_DOWN,
1630 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP,
1632 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_MOVE,
1634 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_DOWN,
1636 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_UP,
1638 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_MOVE,
1640 _item_cache_clean(it->wd);
1641 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1642 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1646 _item_cache_find(Elm_Genlist_Item *it)
1649 Eina_Bool tree = 0, odd;
1651 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
1652 odd = (it->order_num_in & 0x1);
1653 EINA_INLIST_FOREACH(it->wd->item_cache, itc)
1655 if ((itc->selected) || (itc->disabled) || (itc->expanded))
1657 if ((itc->tree == tree) &&
1658 (itc->odd == odd) &&
1659 (itc->compress == it->wd->compress) &&
1660 (!strcmp(it->itc->item_style, itc->item_style)))
1662 it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
1663 EINA_INLIST_GET(itc));
1664 it->wd->item_cache_count--;
1672 _item_cache_free(Item_Cache *itc)
1674 if (itc->spacer) evas_object_del(itc->spacer);
1675 if (itc->base_view) evas_object_del(itc->base_view);
1676 if (itc->item_style) eina_stringshare_del(itc->item_style);
1681 _item_realize(Elm_Genlist_Item *it,
1685 Elm_Genlist_Item *it2;
1686 const char *stacking;
1687 const char *treesize;
1689 int depth, tsize = 20;
1690 Item_Cache *itc = NULL;
1692 if ((it->realized) || (it->delete_me)) return;
1693 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1694 it->order_num_in = in;
1695 if (it->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE) calc = EINA_FALSE;
1696 if ((it->nocache) && (!it->renamed))
1697 it->nocache = EINA_FALSE;
1699 itc = _item_cache_find(it);
1700 if (itc && (!it->wd->effect_mode))
1702 it->base.view = itc->base_view;
1703 itc->base_view = NULL;
1704 it->spacer = itc->spacer;
1709 it->base.view = edje_object_add(evas_object_evas_get(it->base.widget));
1710 edje_object_scale_set(it->base.view,
1711 elm_widget_scale_get(it->base.widget) *
1712 _elm_config->scale);
1713 evas_object_smart_member_add(it->base.view, it->wd->pan_smart);
1714 elm_widget_sub_object_add(it->base.widget, it->base.view);
1716 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS)
1717 strncpy(buf, "tree", sizeof(buf));
1718 else strncpy(buf, "item", sizeof(buf));
1719 if (it->wd->compress)
1720 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
1722 if (in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
1723 strncat(buf, "/", sizeof(buf) - strlen(buf));
1724 strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf));
1726 _elm_theme_object_set(it->base.widget, it->base.view, "genlist", buf,
1727 elm_widget_style_get(it->base.widget));
1728 edje_object_mirrored_set(it->base.view,
1729 elm_widget_mirrored_get(it->base.widget));
1731 evas_object_rectangle_add(evas_object_evas_get(it->base.widget));
1732 evas_object_color_set(it->spacer, 0, 0, 0, 0);
1733 elm_widget_sub_object_add(it->base.widget, it->spacer);
1735 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
1737 if (it2->parent->flags != ELM_GENLIST_ITEM_GROUP) depth += 1;
1739 it->expanded_depth = depth;
1740 treesize = edje_object_data_get(it->base.view, "treesize");
1741 if (treesize) tsize = atoi(treesize);
1742 evas_object_size_hint_min_set(it->spacer,
1743 (depth * tsize) * _elm_config->scale, 1);
1744 edje_object_part_swallow(it->base.view, "elm.swallow.pad", it->spacer);
1747 edje_object_signal_callback_add(it->base.view,
1748 "elm,action,expand,toggle",
1749 "elm", _signal_expand_toggle, it);
1750 edje_object_signal_callback_add(it->base.view, "elm,action,expand",
1751 "elm", _signal_expand, it);
1752 edje_object_signal_callback_add(it->base.view, "elm,action,contract",
1753 "elm", _signal_contract, it);
1754 stacking = edje_object_data_get(it->base.view, "stacking");
1757 if (!strcmp(stacking, "below")) evas_object_lower(it->base.view);
1758 else if (!strcmp(stacking, "above"))
1759 evas_object_raise(it->base.view);
1761 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_DOWN,
1763 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_UP,
1765 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_MOVE,
1767 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_DOWN,
1769 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_UP,
1771 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_MOVE,
1774 if ((!it->edit_obj) &&(it->wd->edit_mode) &&
1775 (it->flags != ELM_GENLIST_ITEM_GROUP) && (it->itc->edit_item_style))
1776 _effect_item_realize(it, EINA_FALSE);
1780 if ((it->selected) && (it->selected != itc->selected))
1782 edje_object_signal_emit(it->base.view,
1783 "elm,state,selected", "elm");
1785 edje_object_signal_emit(it->edit_obj,
1786 "elm,state,selected", "elm");
1788 if ((it->disabled) && (it->disabled != itc->disabled))
1790 edje_object_signal_emit(it->base.view,
1791 "elm,state,disabled", "elm");
1793 edje_object_signal_emit(it->edit_obj,
1794 "elm,state,disabled", "elm");
1796 if ((it->expanded) && (it->expanded != itc->expanded))
1798 edje_object_signal_emit(it->base.view,
1799 "elm,state,expanded", "elm");
1801 edje_object_signal_emit(it->edit_obj,
1802 "elm,state,expanded", "elm");
1809 edje_object_signal_emit(it->base.view,
1810 "elm,state,selected", "elm");
1812 edje_object_signal_emit(it->edit_obj,
1813 "elm,state,selected", "elm");
1817 edje_object_signal_emit(it->base.view,
1818 "elm,state,disabled", "elm");
1820 edje_object_signal_emit(it->edit_obj,
1821 "elm,state,disabled", "elm");
1825 edje_object_signal_emit(it->base.view,
1826 "elm,state,expanded", "elm");
1828 edje_object_signal_emit(it->edit_obj,
1829 "elm,state,expanded", "elm");
1834 if ((calc) && (it->wd->homogeneous) &&
1835 ((it->wd->item_width) ||
1836 ((it->wd->item_width) && (it->wd->group_item_width))))
1838 /* homogenous genlist shortcut */
1841 if (it->flags & ELM_GENLIST_ITEM_GROUP)
1843 it->w = it->minw = it->wd->group_item_width;
1844 it->h = it->minh = it->wd->group_item_height;
1848 it->w = it->minw = it->wd->item_width;
1849 it->h = it->minh = it->wd->item_height;
1851 it->mincalcd = EINA_TRUE;
1856 if (it->itc->func.label_get)
1862 elm_widget_stringlist_get(edje_object_data_get(it->base.view,
1864 EINA_LIST_FOREACH(it->labels, l, key)
1866 char *s = it->itc->func.label_get
1867 ((void *)it->base.data, it->base.widget, l->data);
1871 edje_object_part_text_set(it->base.view, l->data, s);
1875 edje_object_part_text_set(it->base.view, l->data, "");
1878 if (it->itc->func.icon_get)
1884 elm_widget_stringlist_get(edje_object_data_get(it->base.view,
1886 EINA_LIST_FOREACH(it->icons, l, key)
1888 Evas_Object *ic = it->itc->func.icon_get
1889 ((void *)it->base.data, it->base.widget, l->data);
1893 it->icon_objs = eina_list_append(it->icon_objs, ic);
1894 edje_object_part_swallow(it->base.view, key, ic);
1895 evas_object_show(ic);
1896 elm_widget_sub_object_add(it->base.widget, ic);
1897 evas_object_event_callback_add(ic, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, it);
1899 elm_widget_disabled_set(ic, EINA_TRUE);
1905 elm_widget_stringlist_get(edje_object_data_get(it->base.view, "renames"));
1906 EINA_LIST_FOREACH(it->icons, l, key)
1908 Evas_Object *ic = it->itc->func.icon_get
1909 ((void *)it->base.data, it->base.widget, l->data);
1912 it->icon_objs = eina_list_append(it->icon_objs, ic);
1913 edje_object_part_swallow(it->base.view, key, ic);
1914 evas_object_show(ic);
1915 elm_widget_sub_object_add(it->base.widget, ic);
1920 if (it->itc->func.state_get)
1926 elm_widget_stringlist_get(edje_object_data_get(it->base.view,
1928 EINA_LIST_FOREACH(it->states, l, key)
1930 Eina_Bool on = it->itc->func.state_get
1931 ((void *)it->base.data, it->base.widget, l->data);
1935 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
1936 edje_object_signal_emit(it->base.view, buf, "elm");
1940 snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
1941 edje_object_signal_emit(it->base.view, buf, "elm");
1947 Evas_Coord mw = -1, mh = -1;
1949 if (it->wd->height_for_width) mw = it->wd->w; // TODO: Removed this. This was removed from upstream.
1951 if (!it->display_only)
1952 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1953 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
1954 edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw,
1956 if (!it->display_only)
1957 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1958 it->w = it->minw = mw;
1959 it->h = it->minh = mh;
1960 it->mincalcd = EINA_TRUE;
1962 if ((!it->wd->group_item_width) && (it->flags == ELM_GENLIST_ITEM_GROUP))
1964 it->wd->group_item_width = mw;
1965 it->wd->group_item_height = mh;
1967 else if ((!it->wd->item_width) && (it->flags == ELM_GENLIST_ITEM_NONE))
1969 it->wd->item_width = mw;
1970 it->wd->item_height = mh;
1973 if (!calc) evas_object_show(it->base.view);
1976 if (it->tooltip.content_cb)
1978 elm_widget_item_tooltip_content_cb_set(it,
1979 it->tooltip.content_cb,
1980 it->tooltip.data, NULL);
1981 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
1984 if (it->mouse_cursor)
1985 elm_widget_item_cursor_set(it, it->mouse_cursor);
1987 it->realized = EINA_TRUE;
1988 it->want_unrealize = EINA_FALSE;
1990 if (itc) _item_cache_free(itc);
1991 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1992 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1994 evas_object_smart_callback_call(it->base.widget, SIG_REALIZED, it);
1995 if ((!calc) && (it->wd->edit_mode) && (it->flags != ELM_GENLIST_ITEM_GROUP))
1997 if (it->itc->edit_item_style)
1999 if (!it->edit_obj) _effect_item_realize(it, EINA_FALSE);
2000 edje_object_message_signal_process(it->edit_obj);
2003 edje_object_message_signal_process(it->base.view);
2007 _item_unrealize(Elm_Genlist_Item *it,
2012 if (!it->realized) return;
2013 if (it->wd->reorder_it == it) return;
2014 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2016 evas_object_smart_callback_call(it->base.widget, SIG_UNREALIZED, it);
2019 ecore_timer_del(it->long_timer);
2020 it->long_timer = NULL;
2024 evas_object_del(it->base.view);
2025 it->base.view = NULL;
2026 evas_object_del(it->spacer);
2031 edje_object_mirrored_set(it->base.view, elm_widget_mirrored_get(it->base.widget));
2032 _item_cache_add(it);
2034 elm_widget_stringlist_free(it->labels);
2036 elm_widget_stringlist_free(it->icons);
2038 elm_widget_stringlist_free(it->states);
2040 EINA_LIST_FREE(it->icon_objs, icon)
2041 evas_object_del(icon);
2043 _mode_item_unrealize(it);
2045 it->realized = EINA_FALSE;
2046 it->want_unrealize = EINA_FALSE;
2047 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2048 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2049 if (it->wd->edit_mode) _effect_item_unrealize(it);
2053 _item_block_recalc(Item_Block *itb,
2058 Elm_Genlist_Item *it;
2059 Evas_Coord minw = 0, minh = 0;
2060 Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE;
2063 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2065 EINA_LIST_FOREACH(itb->items, l, it)
2067 if (it->delete_me) continue;
2068 showme |= it->showme;
2073 if (!it->mincalcd) changed = EINA_TRUE;
2076 _item_realize(it, in, EINA_TRUE);
2077 _item_unrealize(it, EINA_TRUE);
2082 _item_realize(it, in, EINA_TRUE);
2083 _item_unrealize(it, EINA_TRUE);
2087 _item_realize(it, in, EINA_FALSE);
2089 if (minw < it->minw) minw = it->minw;
2097 itb->changed = EINA_FALSE;
2098 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2099 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2104 _item_block_realize(Item_Block *itb,
2109 Elm_Genlist_Item *it;
2111 if (itb->realized) return;
2112 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2113 EINA_LIST_FOREACH(itb->items, l, it)
2115 if (it->delete_me) continue;
2116 if (full) _item_realize(it, in, EINA_FALSE);
2119 itb->realized = EINA_TRUE;
2120 itb->want_unrealize = EINA_FALSE;
2121 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2122 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2126 _item_block_unrealize(Item_Block *itb)
2129 Elm_Genlist_Item *it;
2130 Eina_Bool dragging = EINA_FALSE;
2132 if (!itb->realized) return;
2133 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2134 EINA_LIST_FOREACH(itb->items, l, it)
2136 if (it->flags != ELM_GENLIST_ITEM_GROUP)
2140 dragging = EINA_TRUE;
2141 it->want_unrealize = EINA_TRUE;
2144 _item_unrealize(it, EINA_FALSE);
2149 itb->realized = EINA_FALSE;
2150 itb->want_unrealize = EINA_TRUE;
2153 itb->want_unrealize = EINA_FALSE;
2154 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2155 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2159 _get_space_for_reorder_item(Elm_Genlist_Item *it)
2161 Evas_Coord rox, roy, row, roh;
2162 Eina_Bool top = EINA_FALSE;
2163 Elm_Genlist_Item *reorder_it = it->wd->reorder_it;
2164 if (!reorder_it) return 0;
2166 Evas_Coord ox,oy,oh,ow;
2167 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
2168 evas_object_geometry_get(it->wd->reorder_it->base.view, &rox, &roy, &row, &roh);
2170 if ((it->wd->reorder_start_y < it->block->y) && (roy - oy + roh/2 >= it->block->y - it->wd->pan_y))
2172 it->block->reorder_offset = it->wd->reorder_it->h * -1;
2173 if (it->block->count == 1)
2174 it->wd->reorder_rel = it;
2176 else if ((it->wd->reorder_start_y >= it->block->y) && (roy - oy + roh/2 <= it->block->y - it->wd->pan_y))
2178 it->block->reorder_offset = it->wd->reorder_it->h;
2181 it->block->reorder_offset = 0;
2183 it->scrl_y += it->block->reorder_offset;
2185 top = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
2186 rox, roy+roh/2, row, 1));
2189 it->wd->reorder_rel = it;
2190 it->scrl_y+=it->wd->reorder_it->h;
2191 return it->wd->reorder_it->h;
2198 _reorder_item_moving_effect_timer_cb(void *data)
2200 Elm_Genlist_Item *it = data;
2201 Eina_Bool down = EINA_FALSE;
2202 double time = 0.4, t;
2204 t = ((0.0 > (t = current_time_get() - it->wd->start_time)) ? 0.0 : t) / 1000;
2207 y = (1 * sin((t / time) * (M_PI / 2)) * dy);
2211 if (it->old_scrl_y < it->scrl_y)
2213 it->old_scrl_y += y;
2216 else if (it->old_scrl_y > it->scrl_y)
2218 it->old_scrl_y -= y;
2222 _effect_item_controls(it, it->scrl_x, it->old_scrl_y);
2224 _group_items_recalc(it->wd);
2225 if (!it->wd->reorder_it || it->wd->reorder_pan_move)
2227 it->old_scrl_y = it->scrl_y;
2228 it->move_effect_me = EINA_FALSE;
2229 it->wd->item_moving_effect_timer = NULL;
2230 return ECORE_CALLBACK_CANCEL;
2232 if ((down && it->old_scrl_y >= it->scrl_y) || (!down && it->old_scrl_y <= it->scrl_y))
2234 it->old_scrl_y = it->scrl_y;
2235 it->move_effect_me = EINA_FALSE;
2236 it->wd->item_moving_effect_timer = NULL;
2237 return ECORE_CALLBACK_CANCEL;
2239 return ECORE_CALLBACK_RENEW;
2243 _item_position(Elm_Genlist_Item *it, Evas_Object *view)
2248 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2249 evas_object_resize(view, it->w, it->h);
2250 evas_object_move(view, it->scrl_x, it->scrl_y);
2251 evas_object_show(view);
2252 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2253 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2257 _item_block_position(Item_Block *itb,
2261 Elm_Genlist_Item *it;
2262 Elm_Genlist_Item *git;
2263 Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2266 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2267 evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh);
2268 evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy,
2270 EINA_LIST_FOREACH(itb->items, l, it)
2272 if (it->delete_me) continue;
2273 else if (it->wd->reorder_it == it) continue;
2278 it->scrl_x = itb->x + it->x - it->wd->pan_x + ox;
2279 it->scrl_y = itb->y + it->y - it->wd->pan_y + oy;
2281 vis = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
2282 cvx, cvy, cvw, cvh));
2283 if (it->flags != ELM_GENLIST_ITEM_GROUP || (it->wd->reorder_it ))
2285 if ((itb->realized))
2289 if (!it->realized) _item_realize(it, in, EINA_FALSE);
2292 if (it->wd->edit_mode) edje_object_signal_emit(it->edit_obj, "elm,state,rename,enabled", "elm");
2293 edje_object_signal_emit(it->base.view, "elm,state,rename,enabled", "elm");
2301 if (it->wd->reorder_mode)
2302 y += _get_space_for_reorder_item(it);
2303 git = it->group_item;
2306 git->scrl_x = it->scrl_x;
2307 if (git->scrl_y < oy)
2309 if ((git->scrl_y + git->h) > (it->scrl_y + it->h))
2310 git->scrl_y = (it->scrl_y + it->h) - git->h;
2311 git->want_realize = EINA_TRUE;
2313 if (it->wd->reorder_it && !it->wd->reorder_pan_move && it->old_scrl_y && it->old_scrl_y != it->scrl_y)
2315 if (!it->move_effect_me)
2317 it->move_effect_me = EINA_TRUE;
2318 it->item_moving_effect_timer = ecore_animator_add(_reorder_item_moving_effect_timer_cb, it);
2322 if (!it->move_effect_me )
2323 if (!it->wd->effect_mode || it->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_NONE || ((it->wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE) && it->parent == it->wd->expand_item))
2325 if (it->wd->edit_mode && it->itc->edit_item_style)
2327 _effect_item_controls(it, it->scrl_x, it->scrl_y);
2331 if((!it->wd->effect_mode || it->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_NONE) || ((it->wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_NONE) && (it->old_scrl_y == it->scrl_y)))
2334 _item_position(it, it->mode_view);
2336 _item_position(it, it->base.view);
2340 evas_object_resize(it->base.view, it->w, it->h);
2341 evas_object_move(it->base.view, it->scrl_x, it->scrl_y);
2342 evas_object_hide(it->base.view);
2349 if (!it->dragging) _item_unrealize(it, EINA_FALSE);
2356 if (vis) it->want_realize = EINA_TRUE;
2358 if (!it->wd->effect_mode || it->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_NONE || ((it->wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE) && it->parent == it->wd->expand_item))
2360 it->old_scrl_y = it->scrl_y;
2364 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2365 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2369 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2371 Elm_Genlist_Item *it = data;
2373 it->mincalcd = EINA_FALSE;
2374 it->block->updateme = EINA_TRUE;
2375 if (it->wd->changed_job) ecore_job_del(it->wd->changed_job);
2376 it->wd->changed_job = ecore_job_add(_changed_job, it->wd);
2380 _group_items_recalc(void *data)
2382 Widget_Data *wd = data;
2384 Elm_Genlist_Item *git;
2386 evas_event_freeze(evas_object_evas_get(wd->obj));
2387 EINA_LIST_FOREACH(wd->group_items, l, git)
2389 if (git->want_realize)
2392 _item_realize(git, 0, EINA_FALSE);
2393 evas_object_resize(git->base.view, wd->minw, git->h);
2394 evas_object_move(git->base.view, git->scrl_x, git->scrl_y);
2395 evas_object_show(git->base.view);
2396 evas_object_raise(git->base.view);
2398 else if (!git->want_realize && git->realized)
2401 _item_unrealize(git, EINA_FALSE);
2404 evas_event_thaw(evas_object_evas_get(wd->obj));
2405 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2409 _must_recalc_idler(void *data)
2411 Widget_Data *wd = data;
2412 if (wd->calc_job) ecore_job_del(wd->calc_job);
2413 wd->calc_job = ecore_job_add(_calc_job, wd);
2414 wd->must_recalc_idler = NULL;
2415 return ECORE_CALLBACK_CANCEL;
2419 _calc_job(void *data)
2421 Widget_Data *wd = data;
2422 Item_Block *itb, *chb = NULL;
2423 Evas_Coord minw = -1, minh = 0, y = 0, ow;
2424 int in = 0, minw_change = 0;
2425 Eina_Bool changed = EINA_FALSE;
2427 Eina_Bool did_must_recalc = EINA_FALSE;
2430 t0 = ecore_time_get();
2431 evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h);
2435 evas_event_freeze(evas_object_evas_get(wd->obj));
2436 EINA_INLIST_FOREACH(wd->blocks, itb)
2438 Eina_Bool showme = EINA_FALSE;
2441 showme = itb->showme;
2442 itb->showme = EINA_FALSE;
2445 if (itb->realized) _item_block_unrealize(itb);
2447 if ((itb->changed) || (changed) ||
2448 ((itb->must_recalc) && (!did_must_recalc)))
2450 if ((changed) || (itb->must_recalc))
2453 Elm_Genlist_Item *it;
2454 EINA_LIST_FOREACH(itb->items, l, it)
2455 if (it->mincalcd) it->mincalcd = EINA_FALSE;
2456 itb->changed = EINA_TRUE;
2457 if (itb->must_recalc) did_must_recalc = EINA_TRUE;
2458 itb->must_recalc = EINA_FALSE;
2460 if (itb->realized) _item_block_unrealize(itb);
2461 showme = _item_block_recalc(itb, in, EINA_FALSE);
2467 if (minw == -1) minw = itb->minw;
2468 else if ((!itb->must_recalc) && (minw < itb->minw))
2471 minw_change = EINA_TRUE;
2477 if ((showme) && (wd->show_item) && (!wd->show_item->queued))
2479 wd->show_item->showme = EINA_FALSE;
2481 elm_smart_scroller_region_bring_in(wd->scr,
2483 wd->show_item->block->x,
2485 wd->show_item->block->y,
2486 wd->show_item->block->w,
2489 elm_smart_scroller_child_region_show(wd->scr,
2491 wd->show_item->block->x,
2493 wd->show_item->block->y,
2494 wd->show_item->block->w,
2496 wd->show_item = NULL;
2501 EINA_INLIST_FOREACH(wd->blocks, itb)
2507 if ((chb) && (EINA_INLIST_GET(chb)->next))
2509 EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb)
2511 if (itb->realized) _item_block_unrealize(itb);
2514 wd->realminw = minw;
2515 if (minw < wd->w) minw = wd->w;
2516 if ((minw != wd->minw) || (minh != wd->minh))
2520 if (wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE)
2521 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
2522 _sizing_eval(wd->obj);
2524 if ((wd->anchor_item) && (wd->anchor_item->block) && (!wd->auto_scrolled))
2526 Elm_Genlist_Item *it;
2529 it = wd->anchor_item;
2530 it_y = wd->anchor_y;
2531 elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x,
2532 it->block->y + it->y + it_y);
2533 wd->anchor_item = it;
2534 wd->anchor_y = it_y;
2538 t = ecore_time_get();
2539 if (did_must_recalc)
2541 if (!wd->must_recalc_idler)
2542 wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd);
2544 wd->calc_job = NULL;
2545 evas_object_smart_changed(wd->pan_smart);
2546 evas_event_thaw(evas_object_evas_get(wd->obj));
2547 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2551 _update_job(void *data)
2553 Widget_Data *wd = data;
2557 Eina_Bool position = EINA_FALSE, recalc = EINA_FALSE;
2559 wd->update_job = NULL;
2562 evas_event_freeze(evas_object_evas_get(wd->obj));
2563 EINA_INLIST_FOREACH(wd->blocks, itb)
2565 Evas_Coord itminw, itminh;
2566 Elm_Genlist_Item *it;
2572 _item_block_position(itb, num);
2576 recalc = EINA_FALSE;
2577 EINA_LIST_FOREACH(itb->items, l2, it)
2584 it->updateme = EINA_FALSE;
2587 _item_unrealize(it, EINA_FALSE);
2588 _item_realize(it, num, EINA_FALSE);
2589 position = EINA_TRUE;
2593 _item_realize(it, num, EINA_TRUE);
2594 _item_unrealize(it, EINA_TRUE);
2596 if ((it->minw != itminw) || (it->minh != itminh))
2601 itb->updateme = EINA_FALSE;
2604 position = EINA_TRUE;
2605 itb->changed = EINA_TRUE;
2606 _item_block_recalc(itb, num0, EINA_FALSE);
2607 _item_block_position(itb, num0);
2612 if (wd->calc_job) ecore_job_del(wd->calc_job);
2613 wd->calc_job = ecore_job_add(_calc_job, wd);
2615 evas_event_thaw(evas_object_evas_get(wd->obj));
2616 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2620 _changed_job(void *data)
2622 Widget_Data *wd = data; Eina_List *l2;
2624 int num, num0, position = 0;
2625 Eina_Bool width_changed = EINA_FALSE, height_changed = EINA_FALSE;
2627 wd->changed_job = NULL;
2629 EINA_INLIST_FOREACH(wd->blocks, itb)
2631 Evas_Coord itminw, itminh;
2632 Elm_Genlist_Item *it;
2638 _item_block_position(itb, num);
2642 width_changed = height_changed = EINA_FALSE;
2643 EINA_LIST_FOREACH(itb->items, l2, it)
2645 if ((!it->mincalcd) && (it->realized))
2647 Evas_Coord mw = -1, mh = -1;
2651 if (it->wd->height_for_width) mw = it->wd->w;
2652 if (!it->display_only)
2653 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2654 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
2655 edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw, mh);
2656 if (!it->display_only)
2657 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2658 it->w = it->minw = mw;
2659 it->h = it->minh = mh;
2660 it->mincalcd = EINA_TRUE;
2662 //if ((it->minw != itminw) || (it->minh != itminh))
2663 //if ((it->minh != itminh))
2665 if ((it->minw != itminw))
2666 width_changed = EINA_TRUE;
2667 if ((it->minh != itminh))
2668 height_changed = EINA_TRUE;
2670 if ((!it->wd->group_item_width) && (it->flags == ELM_GENLIST_ITEM_GROUP))
2672 it->wd->group_item_width = mw;
2673 it->wd->group_item_height = mh;
2675 else if ((!it->wd->item_width) && (it->flags == ELM_GENLIST_ITEM_NONE))
2677 it->wd->item_width = mw;
2678 it->wd->item_height = mh;
2683 itb->updateme = EINA_FALSE;
2684 // TODO: why this is separated.
2688 itb->changed = EINA_TRUE;
2689 _item_block_recalc(itb, num0, 0);
2690 _item_block_position(itb, num0);
2692 else if (width_changed)
2694 _item_block_position(itb, num0);
2699 if (wd->calc_job) ecore_job_del(wd->calc_job);
2700 wd->calc_job = ecore_job_add(_calc_job, wd);
2705 _pan_set(Evas_Object *obj,
2709 Pan *sd = evas_object_smart_data_get(obj);
2714 // Evas_Coord ow, oh;
2715 // evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2716 // ow = sd->wd->minw - ow;
2717 // if (ow < 0) ow = 0;
2718 // oh = sd->wd->minh - oh;
2719 // if (oh < 0) oh = 0;
2720 // if (x < 0) x = 0;
2721 // if (y < 0) y = 0;
2722 // if (x > ow) x = ow;
2723 // if (y > oh) y = oh;
2724 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
2729 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2731 if ((itb->y + itb->h) > y)
2733 Elm_Genlist_Item *it;
2736 EINA_LIST_FOREACH(itb->items, l2, it)
2738 if ((itb->y + it->y) >= y)
2740 sd->wd->anchor_item = it;
2741 sd->wd->anchor_y = -(itb->y + it->y - y);
2749 if(!sd->wd->item_moving_effect_timer) evas_object_smart_changed(obj);
2753 _pan_get(Evas_Object *obj,
2757 Pan *sd = evas_object_smart_data_get(obj);
2759 if (x) *x = sd->wd->pan_x;
2760 if (y) *y = sd->wd->pan_y;
2764 _pan_max_get(Evas_Object *obj,
2768 Pan *sd = evas_object_smart_data_get(obj);
2771 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2772 ow = sd->wd->minw - ow;
2774 oh = sd->wd->minh - oh;
2781 _pan_min_get(Evas_Object *obj __UNUSED__,
2790 _pan_child_size_get(Evas_Object *obj,
2794 Pan *sd = evas_object_smart_data_get(obj);
2796 if (w) *w = sd->wd->minw;
2797 if (h) *h = sd->wd->minh;
2801 _pan_add(Evas_Object *obj)
2804 Evas_Object_Smart_Clipped_Data *cd;
2807 cd = evas_object_smart_data_get(obj);
2810 sd->__clipped_data = *cd;
2812 evas_object_smart_data_set(obj, sd);
2816 _pan_del(Evas_Object *obj)
2818 Pan *sd = evas_object_smart_data_get(obj);
2823 ecore_job_del(sd->resize_job);
2824 sd->resize_job = NULL;
2830 _pan_resize_job(void *data)
2833 _sizing_eval(sd->wd->obj);
2834 sd->resize_job = NULL;
2838 _pan_resize(Evas_Object *obj,
2842 Pan *sd = evas_object_smart_data_get(obj);
2845 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2846 if ((ow == w) && (oh == h)) return;
2847 if ((sd->wd->height_for_width) && (ow != w))
2849 if (sd->resize_job) ecore_job_del(sd->resize_job);
2850 sd->resize_job = ecore_job_add(_pan_resize_job, sd);
2852 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2853 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2857 _pan_calculate(Evas_Object *obj)
2859 Pan *sd = evas_object_smart_data_get(obj);
2861 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2862 static Evas_Coord old_pan_y = 0;
2864 Elm_Genlist_Item *git;
2867 evas_event_freeze(evas_object_evas_get(obj));
2868 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
2869 evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
2870 EINA_LIST_FOREACH(sd->wd->group_items, l, git)
2872 git->want_realize = EINA_FALSE;
2874 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2876 itb->w = sd->wd->minw;
2877 if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox,
2878 itb->y - sd->wd->pan_y + oy,
2880 cvx, cvy, cvw, cvh))
2882 if ((!itb->realized) || (itb->changed))
2883 _item_block_realize(itb, in, 0);
2884 _item_block_position(itb, in);
2888 if (itb->realized) _item_block_unrealize(itb);
2892 if ((!sd->wd->reorder_it) || (sd->wd->reorder_pan_move))
2893 _group_items_recalc(sd->wd);
2895 if ((sd->wd->reorder_mode) && (sd->wd->reorder_it))
2897 if (sd->wd->pan_y != old_pan_y) sd->wd->reorder_pan_move = EINA_TRUE;
2898 else sd->wd->reorder_pan_move = EINA_FALSE;
2899 evas_object_raise(sd->wd->reorder_it->edit_obj);
2900 old_pan_y = sd->wd->pan_y;
2903 if (sd->wd->effect_mode &&
2904 ((sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND) ||
2905 (sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT) ||
2906 (sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE)))
2908 if (!sd->wd->item_moving_effect_timer)
2910 if (sd->wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE)
2911 _item_flip_effect_show(sd->wd->expand_item);
2913 evas_object_raise(sd->wd->alpha_bg);
2914 evas_object_show(sd->wd->alpha_bg);
2915 elm_smart_scroller_bounce_animator_disabled_set(sd->wd->scr, EINA_TRUE);
2916 sd->wd->start_time = current_time_get();
2917 sd->wd->item_moving_effect_timer = ecore_animator_add(_item_moving_effect_timer_cb, sd->wd);
2920 else _item_auto_scroll(sd->wd);
2921 evas_event_thaw(evas_object_evas_get(obj));
2922 evas_event_thaw_eval(evas_object_evas_get(obj));
2926 _pan_move(Evas_Object *obj,
2927 Evas_Coord x __UNUSED__,
2928 Evas_Coord y __UNUSED__)
2930 Pan *sd = evas_object_smart_data_get(obj);
2932 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2933 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2937 _hold_on(void *data __UNUSED__,
2939 void *event_info __UNUSED__)
2941 Widget_Data *wd = elm_widget_data_get(obj);
2943 elm_smart_scroller_hold_set(wd->scr, 1);
2947 _hold_off(void *data __UNUSED__,
2949 void *event_info __UNUSED__)
2951 Widget_Data *wd = elm_widget_data_get(obj);
2953 elm_smart_scroller_hold_set(wd->scr, 0);
2957 _freeze_on(void *data __UNUSED__,
2959 void *event_info __UNUSED__)
2961 Widget_Data *wd = elm_widget_data_get(obj);
2963 elm_smart_scroller_freeze_set(wd->scr, 1);
2967 _freeze_off(void *data __UNUSED__,
2969 void *event_info __UNUSED__)
2971 Widget_Data *wd = elm_widget_data_get(obj);
2973 elm_smart_scroller_freeze_set(wd->scr, 0);
2977 _scroll_edge_left(void *data,
2978 Evas_Object *scr __UNUSED__,
2979 void *event_info __UNUSED__)
2981 Evas_Object *obj = data;
2982 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_LEFT, NULL);
2986 _scroll_edge_right(void *data,
2987 Evas_Object *scr __UNUSED__,
2988 void *event_info __UNUSED__)
2990 Evas_Object *obj = data;
2991 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_RIGHT, NULL);
2995 _scroll_edge_top(void *data,
2996 Evas_Object *scr __UNUSED__,
2997 void *event_info __UNUSED__)
2999 Evas_Object *obj = data;
3000 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_TOP, NULL);
3004 _scroll_edge_bottom(void *data,
3005 Evas_Object *scr __UNUSED__,
3006 void *event_info __UNUSED__)
3008 Evas_Object *obj = data;
3009 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_BOTTOM, NULL);
3013 _mode_item_realize(Elm_Genlist_Item *it)
3017 if ((it->mode_view) || (it->delete_me)) return;
3019 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3020 it->mode_view = edje_object_add(evas_object_evas_get(it->base.widget));
3021 edje_object_scale_set(it->mode_view,
3022 elm_widget_scale_get(it->base.widget) *
3023 _elm_config->scale);
3024 evas_object_smart_member_add(it->mode_view, it->wd->pan_smart);
3025 elm_widget_sub_object_add(it->base.widget, it->mode_view);
3027 strncpy(buf, "item", sizeof(buf));
3028 if (it->wd->compress)
3029 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
3031 if (it->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
3032 strncat(buf, "/", sizeof(buf) - strlen(buf));
3033 strncat(buf, it->itc->mode_item_style, sizeof(buf) - strlen(buf));
3035 _elm_theme_object_set(it->base.widget, it->mode_view, "genlist", buf,
3036 elm_widget_style_get(it->base.widget));
3037 edje_object_mirrored_set(it->mode_view,
3038 elm_widget_mirrored_get(it->base.widget));
3040 /* signal callback add */
3041 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_DOWN,
3043 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_UP,
3045 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_MOVE,
3048 /* label_get, icon_get, state_get */
3049 if (it->itc->func.label_get)
3055 elm_widget_stringlist_get(edje_object_data_get(it->mode_view,
3057 EINA_LIST_FOREACH(it->mode_labels, l, key)
3059 char *s = it->itc->func.label_get
3060 ((void *)it->base.data, it->base.widget, l->data);
3064 edje_object_part_text_set(it->mode_view, l->data, s);
3069 if (it->itc->func.icon_get)
3075 elm_widget_stringlist_get(edje_object_data_get(it->mode_view,
3077 EINA_LIST_FOREACH(it->mode_icons, l, key)
3079 Evas_Object *ic = it->itc->func.icon_get
3080 ((void *)it->base.data, it->base.widget, l->data);
3084 it->mode_icon_objs = eina_list_append(it->mode_icon_objs, ic);
3085 edje_object_part_swallow(it->mode_view, key, ic);
3086 evas_object_show(ic);
3087 elm_widget_sub_object_add(it->base.widget, ic);
3089 elm_widget_disabled_set(ic, EINA_TRUE);
3093 if (it->itc->func.state_get)
3099 elm_widget_stringlist_get(edje_object_data_get(it->mode_view,
3101 EINA_LIST_FOREACH(it->mode_states, l, key)
3103 Eina_Bool on = it->itc->func.state_get
3104 ((void *)it->base.data, it->base.widget, l->data);
3108 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
3109 edje_object_signal_emit(it->mode_view, buf, "elm");
3114 edje_object_part_swallow(it->mode_view,
3115 edje_object_data_get(it->mode_view, "mode_part"),
3118 it->want_unrealize = EINA_FALSE;
3119 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3120 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3124 _mode_item_unrealize(Elm_Genlist_Item *it)
3126 Widget_Data *wd = it->wd;
3128 if (!it->mode_view) return;
3130 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3131 elm_widget_stringlist_free(it->mode_labels);
3132 it->mode_labels = NULL;
3133 elm_widget_stringlist_free(it->mode_icons);
3134 it->mode_icons = NULL;
3135 elm_widget_stringlist_free(it->mode_states);
3137 EINA_LIST_FREE(it->mode_icon_objs, icon)
3138 evas_object_del(icon);
3140 edje_object_part_unswallow(it->mode_view, it->base.view);
3141 evas_object_smart_member_add(it->base.view, wd->pan_smart);
3142 evas_object_del(it->mode_view);
3143 it->mode_view = NULL;
3145 if (wd->mode_item == it)
3146 wd->mode_item = NULL;
3147 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3148 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3152 _item_mode_set(Elm_Genlist_Item *it)
3155 Widget_Data *wd = it->wd;
3160 it->nocache = EINA_TRUE;
3162 if (wd->scr_hold_timer)
3164 ecore_timer_del(wd->scr_hold_timer);
3165 wd->scr_hold_timer = NULL;
3167 elm_smart_scroller_hold_set(wd->scr, EINA_TRUE);
3168 wd->scr_hold_timer = ecore_timer_add(0.1, _scr_hold_timer_cb, wd);
3170 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3171 _mode_item_realize(it);
3172 _item_position(it, it->mode_view);
3173 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3174 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3176 snprintf(buf, sizeof(buf), "elm,state,%s,active", wd->mode_type);
3177 edje_object_signal_emit(it->mode_view, buf, "elm");
3181 _item_mode_unset(Widget_Data *wd)
3184 if (!wd->mode_item) return;
3185 char buf[1024], buf2[1024];
3186 Elm_Genlist_Item *it;
3189 it->nocache = EINA_TRUE;
3191 snprintf(buf, sizeof(buf), "elm,state,%s,passive", wd->mode_type);
3192 snprintf(buf2, sizeof(buf2), "elm,state,%s,passive,finished", wd->mode_type);
3194 edje_object_signal_emit(it->mode_view, buf, "elm");
3195 edje_object_signal_callback_add(it->mode_view, buf2, "elm", _mode_finished_signal_cb, it);
3197 wd->mode_item = NULL;
3201 elm_genlist_add(Evas_Object *parent)
3206 Evas_Coord minw, minh;
3207 static Evas_Smart *smart = NULL;
3211 static Evas_Smart_Class sc;
3213 evas_object_smart_clipped_smart_set(&_pan_sc);
3215 sc.name = "elm_genlist_pan";
3216 sc.version = EVAS_SMART_CLASS_VERSION;
3219 sc.resize = _pan_resize;
3220 sc.move = _pan_move;
3221 sc.calculate = _pan_calculate;
3222 if (!(smart = evas_smart_class_new(&sc))) return NULL;
3225 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
3227 ELM_SET_WIDTYPE(widtype, "genlist");
3228 elm_widget_type_set(obj, "genlist");
3229 elm_widget_sub_object_add(parent, obj);
3230 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
3231 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
3232 elm_widget_data_set(obj, wd);
3233 elm_widget_del_hook_set(obj, _del_hook);
3234 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
3235 elm_widget_theme_hook_set(obj, _theme_hook);
3236 elm_widget_can_focus_set(obj, EINA_TRUE);
3237 elm_widget_event_hook_set(obj, _event_hook);
3238 elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
3240 wd->scr = elm_smart_scroller_add(e);
3241 elm_smart_scroller_widget_set(wd->scr, obj);
3242 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
3243 elm_widget_style_get(obj));
3244 elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE,
3245 _elm_config->thumbscroll_bounce_enable);
3246 elm_widget_resize_object_set(obj, wd->scr);
3248 evas_object_smart_callback_add(wd->scr, "edge,left", _scroll_edge_left, obj);
3249 evas_object_smart_callback_add(wd->scr, "edge,right", _scroll_edge_right,
3251 evas_object_smart_callback_add(wd->scr, "edge,top", _scroll_edge_top, obj);
3252 evas_object_smart_callback_add(wd->scr, "edge,bottom", _scroll_edge_bottom,
3256 wd->mode = ELM_LIST_SCROLL;
3257 wd->max_items_per_block = MAX_ITEMS_PER_BLOCK;
3258 wd->item_cache_max = wd->max_items_per_block * 2;
3259 wd->longpress_timeout = _elm_config->longpress_timeout;
3260 wd->effect_mode = _elm_config->effect_enable;
3262 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
3263 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
3264 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
3265 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
3267 wd->pan_smart = evas_object_smart_add(e, smart);
3268 wd->pan = evas_object_smart_data_get(wd->pan_smart);
3271 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
3272 _pan_set, _pan_get, _pan_max_get,
3273 _pan_min_get, _pan_child_size_get);
3275 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
3277 evas_object_size_hint_min_set(obj, minw, minh);
3279 evas_object_smart_callbacks_descriptions_set(obj, _signals);
3280 _mirrored_set(obj, elm_widget_mirrored_get(obj));
3285 static Elm_Genlist_Item *
3286 _item_new(Widget_Data *wd,
3287 const Elm_Genlist_Item_Class *itc,
3289 Elm_Genlist_Item *parent,
3290 Elm_Genlist_Item_Flags flags,
3292 const void *func_data)
3294 Elm_Genlist_Item *it;
3296 it = elm_widget_item_new(wd->obj, Elm_Genlist_Item);
3297 if (!it) return NULL;
3300 it->base.data = data;
3301 it->parent = parent;
3303 it->func.func = func;
3304 it->func.data = func_data;
3305 it->mouse_cursor = NULL;
3306 it->expanded_depth = 0;
3310 if (it->parent->flags & ELM_GENLIST_ITEM_GROUP)
3311 it->group_item = parent;
3312 else if (it->parent->group_item)
3313 it->group_item = it->parent->group_item;
3319 _item_block_add(Widget_Data *wd,
3320 Elm_Genlist_Item *it)
3322 Item_Block *itb = NULL;
3329 itb = calloc(1, sizeof(Item_Block));
3332 if (!it->rel->block)
3335 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3336 itb->items = eina_list_append(itb->items, it);
3342 wd->blocks = eina_inlist_prepend_relative
3343 (wd->blocks, EINA_INLIST_GET(itb),
3344 EINA_INLIST_GET(it->rel->block));
3346 eina_list_prepend_relative(itb->items, it, it->rel);
3350 wd->blocks = eina_inlist_append_relative
3351 (wd->blocks, EINA_INLIST_GET(itb),
3352 EINA_INLIST_GET(it->rel->block));
3354 eina_list_append_relative(itb->items, it, it->rel);
3364 itb = (Item_Block *)(wd->blocks);
3365 if (itb->count >= wd->max_items_per_block)
3367 itb = calloc(1, sizeof(Item_Block));
3371 eina_inlist_prepend(wd->blocks,
3372 EINA_INLIST_GET(itb));
3377 itb = calloc(1, sizeof(Item_Block));
3381 eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
3383 itb->items = eina_list_prepend(itb->items, it);
3389 itb = (Item_Block *)(wd->blocks->last);
3390 if (itb->count >= wd->max_items_per_block)
3392 itb = calloc(1, sizeof(Item_Block));
3396 eina_inlist_append(wd->blocks,
3397 EINA_INLIST_GET(itb));
3402 itb = calloc(1, sizeof(Item_Block));
3406 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3408 itb->items = eina_list_append(itb->items, it);
3414 itb = it->rel->block;
3415 if (!itb) goto newblock;
3417 itb->items = eina_list_prepend_relative(itb->items, it, it->rel);
3419 itb->items = eina_list_append_relative(itb->items, it, it->rel);
3422 itb->changed = EINA_TRUE;
3424 if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job);
3425 itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd);
3428 it->rel->relcount--;
3429 if ((it->rel->delete_me) && (!it->rel->relcount))
3433 if (itb->count > itb->wd->max_items_per_block)
3437 Elm_Genlist_Item *it2;
3439 newc = itb->count / 2;
3440 itb2 = calloc(1, sizeof(Item_Block));
3444 eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
3445 EINA_INLIST_GET(itb));
3446 itb2->changed = EINA_TRUE;
3447 while ((itb->count > newc) && (itb->items))
3451 l = eina_list_last(itb->items);
3453 itb->items = eina_list_remove_list(itb->items, l);
3456 itb2->items = eina_list_prepend(itb2->items, it2);
3464 _queue_process(Widget_Data *wd)
3467 Eina_Bool showme = EINA_FALSE;
3470 t0 = ecore_time_get();
3471 //evas_event_freeze(evas_object_evas_get(wd->obj));
3472 for (n = 0; (wd->queue) && (n < 128); n++)
3474 Elm_Genlist_Item *it;
3476 it = wd->queue->data;
3477 wd->queue = eina_list_remove_list(wd->queue, wd->queue);
3478 it->queued = EINA_FALSE;
3479 _item_block_add(wd, it);
3480 t = ecore_time_get();
3481 if (it->block->changed)
3483 showme = _item_block_recalc(it->block, it->block->num, EINA_TRUE);
3484 it->block->changed = 0;
3486 if (showme) it->block->showme = EINA_TRUE;
3487 if (eina_inlist_count(wd->blocks) > 1)
3489 if ((t - t0) > (ecore_animator_frametime_get())) break;
3492 //evas_event_thaw(evas_object_evas_get(wd->obj));
3493 //evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3498 _idle_process(void *data, Eina_Bool *wakeup)
3500 Widget_Data *wd = data;
3503 //static double q_start = 0.0;
3504 //if (q_start == 0.0) q_start = ecore_time_get();
3506 if (_queue_process(wd) > 0) *wakeup = EINA_TRUE;
3510 //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start);
3512 return ECORE_CALLBACK_CANCEL;
3514 return ECORE_CALLBACK_RENEW;
3518 _item_idle_enterer(void *data)
3520 Widget_Data *wd = data;
3521 Eina_Bool wakeup = EINA_FALSE;
3522 Eina_Bool ok = _idle_process(data, &wakeup);
3527 if (wd->calc_job) ecore_job_del(wd->calc_job);
3528 wd->calc_job = ecore_job_add(_calc_job, wd);
3530 if (ok == ECORE_CALLBACK_CANCEL) wd->queue_idle_enterer = NULL;
3535 _item_queue(Widget_Data *wd,
3536 Elm_Genlist_Item *it)
3538 if (it->queued) return;
3539 it->queued = EINA_TRUE;
3540 wd->queue = eina_list_append(wd->queue, it);
3541 // FIXME: why does a freeze then thaw here cause some genlist
3542 // elm_genlist_item_append() to be much much slower?
3543 // evas_event_freeze(evas_object_evas_get(wd->obj));
3544 while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
3546 if (wd->queue_idle_enterer)
3548 ecore_idle_enterer_del(wd->queue_idle_enterer);
3549 wd->queue_idle_enterer = NULL;
3553 // evas_event_thaw(evas_object_evas_get(wd->obj));
3554 // evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3555 if (!wd->queue_idle_enterer)
3556 wd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, wd);
3559 EAPI Elm_Genlist_Item *
3560 elm_genlist_item_append(Evas_Object *obj,
3561 const Elm_Genlist_Item_Class *itc,
3563 Elm_Genlist_Item *parent,
3564 Elm_Genlist_Item_Flags flags,
3566 const void *func_data)
3568 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3569 Widget_Data *wd = elm_widget_data_get(obj);
3570 if (!wd) return NULL;
3571 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3573 if (!it) return NULL;
3576 if (flags & ELM_GENLIST_ITEM_GROUP)
3577 wd->group_items = eina_list_append(wd->group_items, it);
3578 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
3583 Elm_Genlist_Item *it2 = NULL;
3584 Eina_List *ll = eina_list_last(it->parent->items);
3585 if (ll) it2 = ll->data;
3586 it->parent->items = eina_list_append(it->parent->items, it);
3587 if (!it2) it2 = it->parent;
3589 it2 = elm_genlist_item_prev_get(it2);
3591 eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3592 EINA_INLIST_GET(it2));
3594 it->rel->relcount++;
3596 it->before = EINA_FALSE;
3597 _item_queue(wd, it);
3601 EAPI Elm_Genlist_Item *
3602 elm_genlist_item_prepend(Evas_Object *obj,
3603 const Elm_Genlist_Item_Class *itc,
3605 Elm_Genlist_Item *parent,
3606 Elm_Genlist_Item_Flags flags,
3608 const void *func_data)
3610 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3611 Widget_Data *wd = elm_widget_data_get(obj);
3612 if (!wd) return NULL;
3613 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3615 if (!it) return NULL;
3618 if (flags & ELM_GENLIST_ITEM_GROUP)
3619 wd->group_items = eina_list_prepend(wd->group_items, it);
3620 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
3625 Elm_Genlist_Item *it2 = NULL;
3626 Eina_List *ll = it->parent->items;
3627 if (ll) it2 = ll->data;
3628 it->parent->items = eina_list_prepend(it->parent->items, it);
3629 if (!it2) it2 = it->parent;
3631 it2 = elm_genlist_item_next_get(it2);
3633 eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3634 EINA_INLIST_GET(it2));
3636 it->rel->relcount++;
3638 it->before = EINA_TRUE;
3639 _item_queue(wd, it);
3643 EAPI Elm_Genlist_Item *
3644 elm_genlist_item_insert_after(Evas_Object *obj,
3645 const Elm_Genlist_Item_Class *itc,
3647 Elm_Genlist_Item *parent,
3648 Elm_Genlist_Item *after,
3649 Elm_Genlist_Item_Flags flags,
3651 const void *func_data)
3653 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3654 EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
3655 Widget_Data *wd = elm_widget_data_get(obj);
3656 if (!wd) return NULL;
3657 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3659 if (!it) return NULL;
3660 /* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */
3661 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3665 if ((flags & ELM_GENLIST_ITEM_GROUP) &&
3666 (after->flags & ELM_GENLIST_ITEM_GROUP))
3667 wd->group_items = eina_list_append_relative(wd->group_items, it,
3672 it->parent->items = eina_list_append_relative(it->parent->items, it,
3675 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3676 EINA_INLIST_GET(after));
3678 it->rel->relcount++;
3679 it->before = EINA_FALSE;
3680 _item_queue(wd, it);
3684 EAPI Elm_Genlist_Item *
3685 elm_genlist_item_insert_before(Evas_Object *obj,
3686 const Elm_Genlist_Item_Class *itc,
3688 Elm_Genlist_Item *parent,
3689 Elm_Genlist_Item *before,
3690 Elm_Genlist_Item_Flags flags,
3692 const void *func_data)
3694 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3695 EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
3696 Widget_Data *wd = elm_widget_data_get(obj);
3697 if (!wd) return NULL;
3698 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3700 if (!it) return NULL;
3701 /* It makes no sense to insert before in an empty list with before != NULL, something really bad is happening in your app. */
3702 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3706 if ((flags & ELM_GENLIST_ITEM_GROUP) &&
3707 (before->flags & ELM_GENLIST_ITEM_GROUP))
3708 wd->group_items = eina_list_prepend_relative(wd->group_items, it,
3713 it->parent->items = eina_list_prepend_relative(it->parent->items, it,
3716 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3717 EINA_INLIST_GET(before));
3719 it->rel->relcount++;
3720 it->before = EINA_TRUE;
3721 _item_queue(wd, it);
3726 elm_genlist_clear(Evas_Object *obj)
3728 ELM_CHECK_WIDTYPE(obj, widtype);
3729 Widget_Data *wd = elm_widget_data_get(obj);
3731 if (wd->walking > 0)
3733 Elm_Genlist_Item *it;
3735 wd->clear_me = EINA_TRUE;
3736 EINA_INLIST_FOREACH(wd->items, it)
3738 it->delete_me = EINA_TRUE;
3742 evas_event_freeze(evas_object_evas_get(wd->obj));
3745 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
3746 it->nocache = EINA_TRUE;
3747 it->highlighted = EINA_FALSE;
3749 if (wd->anchor_item == it)
3751 wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3752 if (!wd->anchor_item)
3754 ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3757 wd->items = eina_inlist_remove(wd->items, wd->items);
3758 if (it->flags & ELM_GENLIST_ITEM_GROUP)
3759 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
3760 elm_widget_item_pre_notify_del(it);
3761 if (it->realized) _item_unrealize(it, EINA_FALSE);
3762 if (((wd->clear_me) || (!it->delete_me)) && (it->itc->func.del))
3763 it->itc->func.del((void *)it->base.data, it->base.widget);
3764 if (it->long_timer) ecore_timer_del(it->long_timer);
3765 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
3766 elm_widget_item_del(it);
3768 wd->clear_me = EINA_FALSE;
3769 wd->anchor_item = NULL;
3772 Item_Block *itb = (Item_Block *)(wd->blocks);
3774 wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
3775 if (itb->items) eina_list_free(itb->items);
3780 ecore_job_del(wd->calc_job);
3781 wd->calc_job = NULL;
3783 if (wd->queue_idle_enterer)
3785 ecore_idle_enterer_del(wd->queue_idle_enterer);
3786 wd->queue_idle_enterer = NULL;
3788 if (wd->must_recalc_idler)
3790 ecore_idler_del(wd->must_recalc_idler);
3791 wd->must_recalc_idler = NULL;
3795 eina_list_free(wd->queue);
3800 eina_list_free(wd->selected);
3801 wd->selected = NULL;
3803 if (wd->item_moving_effect_timer)
3805 ecore_animator_del(wd->item_moving_effect_timer);
3806 wd->item_moving_effect_timer = NULL;
3808 wd->show_item = NULL;
3815 evas_object_del(wd->alpha_bg);
3816 wd->alpha_bg = NULL;
3820 evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
3821 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
3824 evas_event_thaw(evas_object_evas_get(wd->obj));
3825 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3829 elm_genlist_multi_select_set(Evas_Object *obj,
3832 ELM_CHECK_WIDTYPE(obj, widtype);
3833 Widget_Data *wd = elm_widget_data_get(obj);
3839 elm_genlist_multi_select_get(const Evas_Object *obj)
3841 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3842 Widget_Data *wd = elm_widget_data_get(obj);
3843 if (!wd) return EINA_FALSE;
3847 EAPI Elm_Genlist_Item *
3848 elm_genlist_selected_item_get(const Evas_Object *obj)
3850 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3851 Widget_Data *wd = elm_widget_data_get(obj);
3852 if (!wd) return NULL;
3853 if (wd->selected) return wd->selected->data;
3857 EAPI const Eina_List *
3858 elm_genlist_selected_items_get(const Evas_Object *obj)
3860 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3861 Widget_Data *wd = elm_widget_data_get(obj);
3862 if (!wd) return NULL;
3863 return wd->selected;
3867 elm_genlist_realized_items_get(const Evas_Object *obj)
3869 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3870 Widget_Data *wd = elm_widget_data_get(obj);
3871 Eina_List *list = NULL;
3873 Eina_Bool done = EINA_FALSE;
3874 if (!wd) return NULL;
3875 EINA_INLIST_FOREACH(wd->blocks, itb)
3880 Elm_Genlist_Item *it;
3883 EINA_LIST_FOREACH(itb->items, l, it)
3885 if (it->realized) list = eina_list_append(list, it);
3896 EAPI Elm_Genlist_Item *
3897 elm_genlist_at_xy_item_get(const Evas_Object *obj,
3902 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3903 Widget_Data *wd = elm_widget_data_get(obj);
3904 Evas_Coord ox, oy, ow, oh;
3907 if (!wd) return NULL;
3908 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
3910 EINA_INLIST_FOREACH(wd->blocks, itb)
3913 Elm_Genlist_Item *it;
3915 if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
3916 oy + itb->y - itb->wd->pan_y,
3917 itb->w, itb->h, x, y, 1, 1))
3919 EINA_LIST_FOREACH(itb->items, l, it)
3921 Evas_Coord itx, ity;
3923 itx = ox + itb->x + it->x - itb->wd->pan_x;
3924 ity = oy + itb->y + it->y - itb->wd->pan_y;
3925 if (ELM_RECTS_INTERSECT(itx, ity, it->w, it->h, x, y, 1, 1))
3929 if (y <= (ity + (it->h / 4))) *posret = -1;
3930 else if (y >= (ity + it->h - (it->h / 4)))
3936 lasty = ity + it->h;
3941 if (y > lasty) *posret = 1;
3947 EAPI Elm_Genlist_Item *
3948 elm_genlist_first_item_get(const Evas_Object *obj)
3950 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3951 Widget_Data *wd = elm_widget_data_get(obj);
3952 if (!wd) return NULL;
3953 if (!wd->items) return NULL;
3954 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
3955 while ((it) && (it->delete_me))
3956 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3960 EAPI Elm_Genlist_Item *
3961 elm_genlist_last_item_get(const Evas_Object *obj)
3963 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3964 Widget_Data *wd = elm_widget_data_get(obj);
3965 if (!wd) return NULL;
3966 if (!wd->items) return NULL;
3967 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
3968 while ((it) && (it->delete_me))
3969 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3973 EAPI Elm_Genlist_Item *
3974 elm_genlist_item_next_get(const Elm_Genlist_Item *it)
3976 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3979 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3980 if ((it) && (!it->delete_me)) break;
3982 return (Elm_Genlist_Item *)it;
3985 EAPI Elm_Genlist_Item *
3986 elm_genlist_item_prev_get(const Elm_Genlist_Item *it)
3988 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3991 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3992 if ((it) && (!it->delete_me)) break;
3994 return (Elm_Genlist_Item *)it;
3998 elm_genlist_item_genlist_get(const Elm_Genlist_Item *it)
4000 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4001 return it->base.widget;
4004 EAPI Elm_Genlist_Item *
4005 elm_genlist_item_parent_get(const Elm_Genlist_Item *it)
4007 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4012 elm_genlist_item_subitems_clear(Elm_Genlist_Item *it)
4014 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4015 Elm_Genlist_Item *it2;
4018 if (!it->wd->effect_mode || !it->wd->move_effect_mode)
4019 _item_subitems_clear(it);
4022 if ((!it->wd->item_moving_effect_timer) && (it->flags != ELM_GENLIST_ITEM_GROUP) &&
4023 it->wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE )
4025 it->wd->expand_item = it;
4026 _item_flip_effect_show(it);
4027 evas_object_geometry_get(it->base.view, NULL, &y, NULL, &h);
4028 it->wd->expand_item_end = y + h;
4032 it2 = elm_genlist_item_next_get(it2);
4034 } while (it2->expanded_depth > it->expanded_depth);
4036 it->wd->expand_item_gap = it->wd->expand_item_end - it2->old_scrl_y;
4038 it->wd->expand_item_gap = 0;
4040 evas_object_raise(it->wd->alpha_bg);
4041 evas_object_show(it->wd->alpha_bg);
4043 it->wd->start_time = current_time_get();
4044 it->wd->item_moving_effect_timer = ecore_animator_add(_item_moving_effect_timer_cb, it->wd);
4047 _item_subitems_clear(it);
4052 elm_genlist_item_selected_set(Elm_Genlist_Item *it,
4055 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4056 Widget_Data *wd = elm_widget_data_get(it->base.widget);
4058 if ((it->delete_me) || (it->disabled)) return;
4059 selected = !!selected;
4060 if (it->selected == selected) return;
4066 while (wd->selected)
4067 _item_unselect(wd->selected->data);
4069 _item_highlight(it);
4077 elm_genlist_item_selected_get(const Elm_Genlist_Item *it)
4079 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4080 return it->selected;
4084 elm_genlist_item_expanded_set(Elm_Genlist_Item *it,
4087 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4088 if (it->flags != ELM_GENLIST_ITEM_SUBITEMS) return;
4089 if (it->expanded == expanded) return;
4090 it->expanded = expanded;
4091 it->wd->expand_item = it;
4093 if (it->wd->effect_mode && !it->wd->alpha_bg)
4094 it->wd->alpha_bg = _create_tray_alpha_bg(it->base.widget);
4098 it->wd->auto_scrolled = EINA_FALSE;
4099 it->wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND;
4101 edje_object_signal_emit(it->base.view, "elm,state,expanded", "elm");
4102 evas_object_smart_callback_call(it->base.widget, "expanded", it);
4106 it->wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT;
4108 edje_object_signal_emit(it->base.view, "elm,state,contracted", "elm");
4109 evas_object_smart_callback_call(it->base.widget, "contracted", it);
4114 elm_genlist_item_expanded_get(const Elm_Genlist_Item *it)
4116 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4117 return it->expanded;
4121 elm_genlist_item_expanded_depth_get(const Elm_Genlist_Item *it)
4123 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, 0);
4124 return it->expanded_depth;
4128 elm_genlist_item_disabled_set(Elm_Genlist_Item *it,
4131 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4134 if (it->disabled == disabled) return;
4135 if (it->delete_me) return;
4136 it->disabled = disabled;
4138 elm_genlist_item_selected_set(it, EINA_FALSE);
4143 edje_object_signal_emit(it->base.view, "elm,state,disabled", "elm");
4145 edje_object_signal_emit(it->edit_obj, "elm,state,disabled", "elm");
4149 edje_object_signal_emit(it->base.view, "elm,state,enabled", "elm");
4151 edje_object_signal_emit(it->edit_obj, "elm,state,enabled", "elm");
4153 EINA_LIST_FOREACH(it->icon_objs, l, obj)
4154 elm_widget_disabled_set(obj, disabled);
4159 elm_genlist_item_disabled_get(const Elm_Genlist_Item *it)
4161 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4162 if (it->delete_me) return EINA_FALSE;
4163 return it->disabled;
4167 elm_genlist_item_display_only_set(Elm_Genlist_Item *it,
4168 Eina_Bool display_only)
4170 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4171 if (it->display_only == display_only) return;
4172 if (it->delete_me) return;
4173 it->display_only = display_only;
4174 it->mincalcd = EINA_FALSE;
4175 it->updateme = EINA_TRUE;
4176 if (it->block) it->block->updateme = EINA_TRUE;
4177 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4178 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4182 elm_genlist_item_display_only_get(const Elm_Genlist_Item *it)
4184 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4185 if (it->delete_me) return EINA_FALSE;
4186 return it->display_only;
4190 elm_genlist_item_show(Elm_Genlist_Item *it)
4192 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4193 Evas_Coord gith = 0;
4194 if (it->delete_me) return;
4195 if ((it->queued) || (!it->mincalcd))
4197 it->wd->show_item = it;
4198 it->wd->bring_in = EINA_TRUE;
4199 it->showme = EINA_TRUE;
4202 if (it->wd->show_item)
4204 it->wd->show_item->showme = EINA_FALSE;
4205 it->wd->show_item = NULL;
4207 if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
4208 gith = it->group_item->h;
4209 elm_smart_scroller_child_region_show(it->wd->scr,
4210 it->x + it->block->x,
4211 it->y + it->block->y - gith,
4212 it->block->w, it->h);
4216 elm_genlist_item_bring_in(Elm_Genlist_Item *it)
4218 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4219 Evas_Coord gith = 0;
4220 if (it->delete_me) return;
4221 if ((it->queued) || (!it->mincalcd))
4223 it->wd->show_item = it;
4224 it->wd->bring_in = EINA_TRUE;
4225 it->showme = EINA_TRUE;
4228 if (it->wd->show_item)
4230 it->wd->show_item->showme = EINA_FALSE;
4231 it->wd->show_item = NULL;
4233 if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
4234 gith = it->group_item->h;
4235 elm_smart_scroller_region_bring_in(it->wd->scr,
4236 it->x + it->block->x,
4237 it->y + it->block->y - gith,
4238 it->block->w, it->h);
4242 elm_genlist_item_top_show(Elm_Genlist_Item *it)
4244 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4246 Evas_Coord gith = 0;
4248 if (it->delete_me) return;
4249 if ((it->queued) || (!it->mincalcd))
4251 it->wd->show_item = it;
4252 it->wd->bring_in = EINA_TRUE;
4253 it->showme = EINA_TRUE;
4256 if (it->wd->show_item)
4258 it->wd->show_item->showme = EINA_FALSE;
4259 it->wd->show_item = NULL;
4261 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4262 if (it->group_item) gith = it->group_item->h;
4263 elm_smart_scroller_child_region_show(it->wd->scr,
4264 it->x + it->block->x,
4265 it->y + it->block->y - gith,
4270 elm_genlist_item_top_bring_in(Elm_Genlist_Item *it)
4272 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4274 Evas_Coord gith = 0;
4276 if (it->delete_me) return;
4277 if ((it->queued) || (!it->mincalcd))
4279 it->wd->show_item = it;
4280 it->wd->bring_in = EINA_TRUE;
4281 it->showme = EINA_TRUE;
4284 if (it->wd->show_item)
4286 it->wd->show_item->showme = EINA_FALSE;
4287 it->wd->show_item = NULL;
4289 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4290 if (it->group_item) gith = it->group_item->h;
4291 elm_smart_scroller_region_bring_in(it->wd->scr,
4292 it->x + it->block->x,
4293 it->y + it->block->y - gith,
4298 elm_genlist_item_middle_show(Elm_Genlist_Item *it)
4300 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4303 if (it->delete_me) return;
4304 if ((it->queued) || (!it->mincalcd))
4306 it->wd->show_item = it;
4307 it->wd->bring_in = EINA_TRUE;
4308 it->showme = EINA_TRUE;
4311 if (it->wd->show_item)
4313 it->wd->show_item->showme = EINA_FALSE;
4314 it->wd->show_item = NULL;
4316 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4317 elm_smart_scroller_child_region_show(it->wd->scr,
4318 it->x + it->block->x,
4319 it->y + it->block->y - oh / 2 +
4320 it->h / 2, it->block->w, oh);
4324 elm_genlist_item_middle_bring_in(Elm_Genlist_Item *it)
4326 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4329 if (it->delete_me) return;
4330 if ((it->queued) || (!it->mincalcd))
4332 it->wd->show_item = it;
4333 it->wd->bring_in = EINA_TRUE;
4334 it->showme = EINA_TRUE;
4337 if (it->wd->show_item)
4339 it->wd->show_item->showme = EINA_FALSE;
4340 it->wd->show_item = NULL;
4342 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4343 elm_smart_scroller_region_bring_in(it->wd->scr,
4344 it->x + it->block->x,
4345 it->y + it->block->y - oh / 2 + it->h / 2,
4350 elm_genlist_item_del(Elm_Genlist_Item *it)
4352 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4353 if ((it->relcount > 0) || (it->walking > 0))
4355 elm_widget_item_pre_notify_del(it);
4356 elm_genlist_item_subitems_clear(it);
4357 it->delete_me = EINA_TRUE;
4358 if (it->wd->show_item == it) it->wd->show_item = NULL;
4360 it->wd->selected = eina_list_remove(it->wd->selected,
4364 if (it->realized) _item_unrealize(it, EINA_FALSE);
4365 it->block->changed = EINA_TRUE;
4366 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
4367 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
4369 if (it->itc->func.del)
4370 it->itc->func.del((void *)it->base.data, it->base.widget);
4377 elm_genlist_item_data_set(Elm_Genlist_Item *it,
4380 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4381 elm_widget_item_data_set(it, data);
4382 elm_genlist_item_update(it);
4386 elm_genlist_item_data_get(const Elm_Genlist_Item *it)
4388 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4389 return elm_widget_item_data_get(it);
4393 elm_genlist_item_icons_orphan(Elm_Genlist_Item *it)
4396 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4397 EINA_LIST_FREE(it->icon_objs, icon)
4399 elm_widget_sub_object_del(it->base.widget, icon);
4400 evas_object_smart_member_del(icon);
4401 evas_object_hide(icon);
4405 EAPI const Evas_Object *
4406 elm_genlist_item_object_get(const Elm_Genlist_Item *it)
4408 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4409 return it->base.view;
4413 elm_genlist_item_update(Elm_Genlist_Item *it)
4415 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4416 if (!it->block) return;
4417 if (it->delete_me) return;
4418 it->mincalcd = EINA_FALSE;
4419 it->updateme = EINA_TRUE;
4420 it->block->updateme = EINA_TRUE;
4421 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4422 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4426 elm_genlist_item_item_class_update(Elm_Genlist_Item *it,
4427 const Elm_Genlist_Item_Class *itc)
4429 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4430 if (!it->block) return;
4431 EINA_SAFETY_ON_NULL_RETURN(itc);
4432 if (it->delete_me) return;
4434 it->nocache = EINA_TRUE;
4435 elm_genlist_item_update(it);
4438 EAPI const Elm_Genlist_Item_Class *
4439 elm_genlist_item_item_class_get(const Elm_Genlist_Item *it)
4441 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4442 if (it->delete_me) return NULL;
4445 static Evas_Object *
4446 _elm_genlist_item_label_create(void *data,
4448 void *item __UNUSED__)
4450 Evas_Object *label = elm_label_add(obj);
4453 elm_object_style_set(label, "tooltip");
4454 elm_object_text_set(label, data);
4459 _elm_genlist_item_label_del_cb(void *data,
4460 Evas_Object *obj __UNUSED__,
4461 void *event_info __UNUSED__)
4463 eina_stringshare_del(data);
4467 elm_genlist_item_tooltip_text_set(Elm_Genlist_Item *item,
4470 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4471 text = eina_stringshare_add(text);
4472 elm_genlist_item_tooltip_content_cb_set(item, _elm_genlist_item_label_create,
4474 _elm_genlist_item_label_del_cb);
4478 elm_genlist_item_tooltip_content_cb_set(Elm_Genlist_Item *item,
4479 Elm_Tooltip_Item_Content_Cb func,
4481 Evas_Smart_Cb del_cb)
4483 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(item, error);
4485 if ((item->tooltip.content_cb == func) && (item->tooltip.data == data))
4488 if (item->tooltip.del_cb)
4489 item->tooltip.del_cb((void *)item->tooltip.data,
4490 item->base.widget, item);
4492 item->tooltip.content_cb = func;
4493 item->tooltip.data = data;
4494 item->tooltip.del_cb = del_cb;
4496 if (item->base.view)
4498 elm_widget_item_tooltip_content_cb_set(item,
4499 item->tooltip.content_cb,
4500 item->tooltip.data, NULL);
4501 elm_widget_item_tooltip_style_set(item, item->tooltip.style);
4507 if (del_cb) del_cb((void *)data, NULL, NULL);
4511 elm_genlist_item_tooltip_unset(Elm_Genlist_Item *item)
4513 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4514 if ((item->base.view) && (item->tooltip.content_cb))
4515 elm_widget_item_tooltip_unset(item);
4517 if (item->tooltip.del_cb)
4518 item->tooltip.del_cb((void *)item->tooltip.data, item->base.widget, item);
4519 item->tooltip.del_cb = NULL;
4520 item->tooltip.content_cb = NULL;
4521 item->tooltip.data = NULL;
4522 if (item->tooltip.style)
4523 elm_genlist_item_tooltip_style_set(item, NULL);
4527 elm_genlist_item_tooltip_style_set(Elm_Genlist_Item *item,
4530 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4531 eina_stringshare_replace(&item->tooltip.style, style);
4532 if (item->base.view) elm_widget_item_tooltip_style_set(item, style);
4536 elm_genlist_item_tooltip_style_get(const Elm_Genlist_Item *item)
4538 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4539 return item->tooltip.style;
4543 elm_genlist_item_cursor_set(Elm_Genlist_Item *item,
4546 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4547 eina_stringshare_replace(&item->mouse_cursor, cursor);
4548 if (item->base.view) elm_widget_item_cursor_set(item, cursor);
4552 elm_genlist_item_cursor_get(const Elm_Genlist_Item *item)
4554 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4555 return elm_widget_item_cursor_get(item);
4559 elm_genlist_item_cursor_unset(Elm_Genlist_Item *item)
4561 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4562 if (!item->mouse_cursor)
4565 if (item->base.view)
4566 elm_widget_item_cursor_unset(item);
4568 eina_stringshare_del(item->mouse_cursor);
4569 item->mouse_cursor = NULL;
4573 elm_genlist_item_cursor_style_set(Elm_Genlist_Item *item,
4576 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4577 elm_widget_item_cursor_style_set(item, style);
4581 elm_genlist_item_cursor_style_get(const Elm_Genlist_Item *item)
4583 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4584 return elm_widget_item_cursor_style_get(item);
4588 elm_genlist_item_cursor_engine_only_set(Elm_Genlist_Item *item,
4589 Eina_Bool engine_only)
4591 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4592 elm_widget_item_cursor_engine_only_set(item, engine_only);
4596 elm_genlist_item_cursor_engine_only_get(const Elm_Genlist_Item *item)
4598 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
4599 return elm_widget_item_cursor_engine_only_get(item);
4603 elm_genlist_horizontal_mode_set(Evas_Object *obj,
4606 ELM_CHECK_WIDTYPE(obj, widtype);
4607 Widget_Data *wd = elm_widget_data_get(obj);
4609 if (wd->mode == mode) return;
4615 elm_genlist_horizontal_mode_get(const Evas_Object *obj)
4617 ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
4618 Widget_Data *wd = elm_widget_data_get(obj);
4619 if (!wd) return ELM_LIST_LAST;
4624 elm_genlist_always_select_mode_set(Evas_Object *obj,
4625 Eina_Bool always_select)
4627 ELM_CHECK_WIDTYPE(obj, widtype);
4628 Widget_Data *wd = elm_widget_data_get(obj);
4630 wd->always_select = always_select;
4634 elm_genlist_always_select_mode_get(const Evas_Object *obj)
4636 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4637 Widget_Data *wd = elm_widget_data_get(obj);
4638 if (!wd) return EINA_FALSE;
4639 return wd->always_select;
4643 elm_genlist_no_select_mode_set(Evas_Object *obj,
4644 Eina_Bool no_select)
4646 ELM_CHECK_WIDTYPE(obj, widtype);
4647 Widget_Data *wd = elm_widget_data_get(obj);
4649 wd->no_select = no_select;
4653 elm_genlist_no_select_mode_get(const Evas_Object *obj)
4655 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4656 Widget_Data *wd = elm_widget_data_get(obj);
4657 if (!wd) return EINA_FALSE;
4658 return wd->no_select;
4662 elm_genlist_compress_mode_set(Evas_Object *obj,
4665 ELM_CHECK_WIDTYPE(obj, widtype);
4666 Widget_Data *wd = elm_widget_data_get(obj);
4668 wd->compress = compress;
4672 elm_genlist_compress_mode_get(const Evas_Object *obj)
4674 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4675 Widget_Data *wd = elm_widget_data_get(obj);
4676 if (!wd) return EINA_FALSE;
4677 return wd->compress;
4681 elm_genlist_height_for_width_mode_set(Evas_Object *obj,
4682 Eina_Bool height_for_width)
4684 ELM_CHECK_WIDTYPE(obj, widtype);
4685 Widget_Data *wd = elm_widget_data_get(obj);
4687 wd->height_for_width = !!height_for_width;
4688 if (wd->height_for_width)
4690 elm_genlist_homogeneous_set(obj, EINA_FALSE);
4691 elm_genlist_compress_mode_set(obj, EINA_TRUE);
4696 elm_genlist_height_for_width_mode_get(const Evas_Object *obj)
4698 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4699 Widget_Data *wd = elm_widget_data_get(obj);
4700 if (!wd) return EINA_FALSE;
4701 return wd->height_for_width;
4705 elm_genlist_bounce_set(Evas_Object *obj,
4709 ELM_CHECK_WIDTYPE(obj, widtype);
4710 Widget_Data *wd = elm_widget_data_get(obj);
4712 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
4716 elm_genlist_bounce_get(const Evas_Object *obj,
4717 Eina_Bool *h_bounce,
4718 Eina_Bool *v_bounce)
4720 ELM_CHECK_WIDTYPE(obj, widtype);
4721 Widget_Data *wd = elm_widget_data_get(obj);
4723 elm_smart_scroller_bounce_allow_get(obj, h_bounce, v_bounce);
4727 elm_genlist_homogeneous_set(Evas_Object *obj,
4728 Eina_Bool homogeneous)
4730 ELM_CHECK_WIDTYPE(obj, widtype);
4731 Widget_Data *wd = elm_widget_data_get(obj);
4733 if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
4734 wd->homogeneous = homogeneous;
4738 elm_genlist_homogeneous_get(const Evas_Object *obj)
4740 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4741 Widget_Data *wd = elm_widget_data_get(obj);
4742 if (!wd) return EINA_FALSE;
4743 return wd->homogeneous;
4747 elm_genlist_block_count_set(Evas_Object *obj,
4750 ELM_CHECK_WIDTYPE(obj, widtype);
4751 Widget_Data *wd = elm_widget_data_get(obj);
4753 wd->max_items_per_block = n;
4754 wd->item_cache_max = wd->max_items_per_block * 2;
4755 _item_cache_clean(wd);
4759 elm_genlist_block_count_get(const Evas_Object *obj)
4761 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4762 Widget_Data *wd = elm_widget_data_get(obj);
4764 return wd->max_items_per_block;
4768 elm_genlist_longpress_timeout_set(Evas_Object *obj,
4771 ELM_CHECK_WIDTYPE(obj, widtype);
4772 Widget_Data *wd = elm_widget_data_get(obj);
4774 wd->longpress_timeout = timeout;
4778 elm_genlist_longpress_timeout_get(const Evas_Object *obj)
4780 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4781 Widget_Data *wd = elm_widget_data_get(obj);
4783 return wd->longpress_timeout;
4787 elm_genlist_scroller_policy_set(Evas_Object *obj,
4788 Elm_Scroller_Policy policy_h,
4789 Elm_Scroller_Policy policy_v)
4791 ELM_CHECK_WIDTYPE(obj, widtype);
4792 Widget_Data *wd = elm_widget_data_get(obj);
4794 if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
4795 (policy_v >= ELM_SCROLLER_POLICY_LAST))
4798 elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
4802 elm_genlist_scroller_policy_get(const Evas_Object *obj,
4803 Elm_Scroller_Policy *policy_h,
4804 Elm_Scroller_Policy *policy_v)
4806 ELM_CHECK_WIDTYPE(obj, widtype);
4807 Widget_Data *wd = elm_widget_data_get(obj);
4808 Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
4809 if ((!wd) || (!wd->scr)) return;
4810 elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
4811 if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
4812 if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
4816 elm_genlist_realized_items_update(Evas_Object *obj)
4818 ELM_CHECK_WIDTYPE(obj, widtype);
4820 Eina_List *list, *l;
4821 Elm_Genlist_Item *it;
4823 list = elm_genlist_realized_items_get(obj);
4824 EINA_LIST_FOREACH(list, l, it)
4825 elm_genlist_item_update(it);
4829 * Set genlist item mode
4831 * @param item The genlist item
4832 * @param mode Mode name
4833 * @param mode_set Boolean to define set or unset mode.
4838 elm_genlist_item_mode_set(Elm_Genlist_Item *it,
4839 const char *mode_type,
4842 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4843 Widget_Data *wd = it->wd;
4845 Elm_Genlist_Item *it2;
4848 if (!mode_type) return;
4849 if ((it->delete_me) || (it->disabled)) return;
4850 if (wd->edit_mode) return;
4852 if ((wd->mode_item == it) &&
4853 (!strcmp(mode_type, wd->mode_type)) &&
4856 if (!it->itc->mode_item_style) return;
4860 EINA_LIST_FOREACH(wd->selected, l, it2)
4862 elm_genlist_item_selected_set(it2, EINA_FALSE);
4866 it2 = elm_genlist_selected_item_get(wd->obj);
4867 if ((it2) && (it2->realized))
4868 elm_genlist_item_selected_set(it2, EINA_FALSE);
4871 if (((wd->mode_type) && (strcmp(mode_type, wd->mode_type))) ||
4873 ((it == wd->mode_item) && (!mode_set)))
4874 _item_mode_unset(wd);
4876 eina_stringshare_replace(&wd->mode_type, mode_type);
4877 if (mode_set) _item_mode_set(it);
4881 * Get active genlist mode type
4883 * @param obj The genlist object
4888 elm_genlist_mode_get(const Evas_Object *obj)
4890 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4891 Widget_Data *wd = elm_widget_data_get(obj);
4892 if (!wd) return NULL;
4893 return wd->mode_type;
4897 * Get active genlist mode item
4899 * @param obj The genlist object
4903 EAPI const Elm_Genlist_Item *
4904 elm_genlist_mode_item_get(const Evas_Object *obj)
4906 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4907 Widget_Data *wd = elm_widget_data_get(obj);
4908 if (!wd) return NULL;
4909 return wd->mode_item;
4915 * @param obj The genlist object
4916 * @param reorder_mode The reorder mode
4917 * (EINA_TRUE = on, EINA_FALSE = off)
4922 elm_genlist_reorder_mode_set(Evas_Object *obj,
4923 Eina_Bool reorder_mode)
4925 ELM_CHECK_WIDTYPE(obj, widtype);
4926 Widget_Data *wd = elm_widget_data_get(obj);
4928 wd->reorder_mode = reorder_mode;
4932 * Get the reorder mode
4934 * @param obj The genlist object
4935 * @return The reorder mode
4936 * (EINA_TRUE = on, EINA_FALSE = off)
4941 elm_genlist_reorder_mode_get(const Evas_Object *obj)
4943 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4944 Widget_Data *wd = elm_widget_data_get(obj);
4945 if (!wd) return EINA_FALSE;
4946 return wd->reorder_mode;
4950 elm_genlist_item_move_after(Elm_Genlist_Item *it __UNUSED__, Elm_Genlist_Item *after __UNUSED__)
4956 elm_genlist_item_move_before(Elm_Genlist_Item *it __UNUSED__, Elm_Genlist_Item *before __UNUSED__)
4962 _effect_item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after)
4967 // printf("MOVE AFTER : it = %d after = %d \n", it->num, after->num);
4968 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
4969 it->wd->reorder_deleted = EINA_TRUE;
4970 _item_block_del(it);
4972 it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
4974 it->rel->relcount++;
4975 it->before = EINA_FALSE;
4976 _item_queue(it->wd, it);
4978 if (it->itc->func.moved)
4979 it->itc->func.moved(it->base.widget, it, after, EINA_TRUE);
4983 _effect_item_move_before(Elm_Genlist_Item *it, Elm_Genlist_Item *before)
4986 if (!before) return;
4988 // printf("MOVE BEFORE : it = %d before = %d \n", it->num, before->num);
4989 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
4990 it->wd->reorder_deleted = EINA_TRUE;
4991 _item_block_del(it);
4992 it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
4994 it->rel->relcount++;
4995 it->before = EINA_TRUE;
4996 _item_queue(it->wd, it);
4998 if (it->itc->func.moved)
4999 it->itc->func.moved(it->base.widget, it, before, EINA_FALSE);
5003 elm_genlist_effect_set(const Evas_Object *obj, Eina_Bool emode)
5005 ELM_CHECK_WIDTYPE(obj, widtype);
5006 Widget_Data *wd = elm_widget_data_get(obj);
5008 wd->effect_mode = emode;
5009 // wd->point_rect = evas_object_rectangle_add(evas_object_evas_get(wd->obj));
5010 // evas_object_resize(wd->point_rect, 10, 25);
5011 // evas_object_color_set(wd->point_rect, 255, 0, 0, 130);
5012 // evas_object_show(wd->point_rect);
5013 // evas_object_hide(wd->point_rect);
5017 _create_tray_alpha_bg(const Evas_Object *obj)
5019 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5020 Widget_Data *wd = elm_widget_data_get(obj);
5021 if (!wd) return NULL;
5023 Evas_Object *bg = NULL;
5024 Evas_Coord ox, oy, ow, oh;
5026 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
5027 bg = evas_object_rectangle_add(evas_object_evas_get(wd->obj));
5028 evas_object_color_set(bg,0,0,0,0);
5029 evas_object_resize(bg , ow, oh);
5030 evas_object_move(bg , ox, oy);
5031 evas_object_show(bg);
5032 evas_object_hide(bg);
5039 struct timeval timev;
5041 gettimeofday(&timev, NULL);
5042 return ((timev.tv_sec * 1000) + ((timev.tv_usec) / 1000));
5045 // added for item moving animation.
5047 _item_moving_effect_timer_cb(void *data)
5049 Widget_Data *wd = data;
5050 if (!wd) return EINA_FALSE;
5052 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
5053 Elm_Genlist_Item *it = NULL, *it2;
5055 double time = 0.3, t;
5057 Eina_Bool check, end = EINA_FALSE;
5060 t = ((0.0 > (t = current_time_get() - wd->start_time)) ? 0.0 : t) / 1000;
5062 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
5063 evas_output_viewport_get(evas_object_evas_get(wd->pan_smart), &cvx, &cvy, &cvw, &cvh);
5064 if (t > time) end = EINA_TRUE;
5066 it2 = elm_genlist_item_next_get(wd->expand_item);
5069 if (wd->expand_item->expanded_depth >= it2->expanded_depth) break;
5070 it2 = elm_genlist_item_next_get(it2);
5075 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5076 dy = it2->scrl_y - it2->old_scrl_y;
5077 else if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5078 dy = wd->expand_item_gap;
5082 y = ((1 - (1 - (t / time)) * (1 - (t /time))) * dy);
5091 EINA_INLIST_FOREACH(wd->blocks, itb)
5094 if (ELM_RECTS_INTERSECT(itb->x - wd->pan_x + ox,
5095 itb->y - wd->pan_y + oy,
5097 cvx, cvy, cvw, cvh))
5099 EINA_LIST_FOREACH(itb->items, l, it)
5101 if (it == it2) check = EINA_TRUE;
5102 if (!check) continue;
5104 if (!it->old_scrl_y)
5105 it->old_scrl_y = it->scrl_y;
5106 if (it->old_scrl_y + y < oy + oh)
5108 if (!it->realized) _item_realize(it, in, 0);
5110 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE && it->old_scrl_y + y < it->scrl_y)
5111 it->old_scrl_y = it->scrl_y - y;
5114 if (wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE ||
5115 (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE && it->old_scrl_y + y >= it->scrl_y))
5117 if (wd->edit_mode) _effect_item_controls(it, it->scrl_x, it->old_scrl_y + y);
5120 evas_object_resize(it->base.view, it->w, it->h);
5121 evas_object_move(it->base.view, it->scrl_x, it->old_scrl_y + y);
5122 evas_object_show(it->base.view);
5123 evas_object_raise(it->base.view);
5126 if (it->group_item) evas_object_raise(it->group_item->base.view);
5132 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5134 it = elm_genlist_item_prev_get(it2);
5137 if (it->expanded_depth <= it2->expanded_depth) break;
5138 if ((it->scrl_y < it2->old_scrl_y + y) && (it->expanded_depth > it2->expanded_depth))
5140 if (!it->effect_done)
5142 edje_object_signal_emit(it->base.view, "flip_item", "");
5143 evas_object_show(it->base.view);
5144 it->effect_done = EINA_TRUE;
5147 it = elm_genlist_item_prev_get(it);
5150 else if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5152 it = elm_genlist_item_prev_get(it2);
5155 if ((it->scrl_y > it2->old_scrl_y + y) && (it->expanded_depth > it2->expanded_depth))
5157 if (!it->effect_done)
5159 edje_object_signal_emit(it->base.view, "elm,state,hide", "");
5160 it->effect_done = EINA_TRUE;
5165 it = elm_genlist_item_prev_get(it);
5172 int expand_order = 0;
5173 if (wd->expand_item) it = elm_genlist_item_next_get(wd->expand_item);
5177 it = elm_genlist_item_next_get(it);
5179 if (wd->expand_item) it = elm_genlist_item_next_get(wd->expand_item);
5183 if (wd->expand_item->expanded_depth >= it->expanded_depth) break;
5184 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5186 if (!it->effect_done)
5188 if (t >= (((expand_order - 1) * time) / expand_num))
5190 edje_object_signal_emit(it->base.view, "flip_item", "");
5191 evas_object_show(it->base.view);
5192 it->effect_done = EINA_TRUE;
5196 it = elm_genlist_item_next_get(it);
5202 if (wd->item_moving_effect_timer)
5204 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5205 _item_subitems_clear(wd->expand_item);
5206 EINA_INLIST_FOREACH(wd->blocks, itb)
5208 EINA_LIST_FOREACH(itb->items, l, it)
5210 it->effect_done = EINA_TRUE;
5211 it->old_scrl_y = it->scrl_y;
5215 wd->item_moving_effect_timer = NULL;
5217 _item_auto_scroll(wd);
5218 evas_object_lower(wd->alpha_bg);
5219 evas_object_hide(wd->alpha_bg);
5220 if (wd->calc_job) ecore_job_del(wd->calc_job);
5221 wd->calc_job = ecore_job_add(_calc_job, wd);
5222 elm_smart_scroller_bounce_animator_disabled_set(wd->scr, EINA_FALSE);
5223 wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_NONE;
5225 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
5226 evas_object_smart_callback_call(wd->obj, "effect_done", NULL);
5227 return ECORE_CALLBACK_CANCEL;
5229 return ECORE_CALLBACK_RENEW;
5233 _emit_contract(Elm_Genlist_Item *it)
5235 Elm_Genlist_Item *it2;
5238 // printf("%p is emited contract\n", it);
5239 edje_object_signal_emit(it->base.view, "elm,state,contract_flip", "");
5240 it->effect_done = EINA_FALSE;
5242 EINA_LIST_FOREACH(it->items, l, it2)
5244 _emit_contract(it2);
5247 // added for item moving animation.
5249 _item_flip_effect_show(Elm_Genlist_Item *it)
5251 Elm_Genlist_Item *it2;
5253 Widget_Data *wd = it->wd;
5254 Eina_Bool check = EINA_FALSE;
5256 it2 = elm_genlist_item_next_get(it);
5259 if (it2->expanded_depth <= it->expanded_depth) check = EINA_TRUE;
5260 it2 = elm_genlist_item_next_get(it2);
5262 EINA_LIST_FOREACH(it->items, l, it2)
5264 if (it2->parent && it == it2->parent)
5266 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5267 edje_object_signal_emit(it2->base.view, "elm,state,hide", "");
5268 else if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5269 _emit_contract(it2);
5273 return ECORE_CALLBACK_CANCEL;
5278 _elm_genlist_pinch_zoom_execute(Evas_Object *obj, Eina_Bool emode)
5280 printf("!!! NOW FIXING \n");
5285 * Set pinch zoom mode
5287 * @param obj The genlist object
5289 * (EINA_TRUE = pinch contract (zoom in), EINA_FALSE = pinch expand (zoom out)
5294 elm_genlist_pinch_zoom_mode_set(Evas_Object *obj __UNUSED__, Eina_Bool emode __UNUSED__)
5296 printf("!!! NOW FIXING \n");
5300 * Get pinch zoom mode
5302 * @param obj The genlist object
5303 * @return The pinch mode
5304 * (EINA_TRUE = pinch contract (zoom in), EINA_FALSE = pinch expand (zoom out)
5309 elm_genlist_pinch_zoom_mode_get(const Evas_Object *obj __UNUSED__)
5311 printf("!!! NOW FIXING \n");
5316 elm_genlist_pinch_zoom_set(Evas_Object *obj __UNUSED__, Eina_Bool emode __UNUSED__)
5318 printf("!!! NOW FIXING \n");
5322 ////////////////////////////////////////////////////////////////////////
5324 ////////////////////////////////////////////////////////////////////////
5327 _effect_item_controls(Elm_Genlist_Item *it, int itx, int ity)
5329 if (!it->wd->edit_mode) return;
5330 evas_object_resize(it->edit_obj,it->w, it->h);
5331 evas_object_move(it->edit_obj, itx, ity);
5335 _effect_item_realize(Elm_Genlist_Item *it, Eina_Bool effect_on)
5337 if ((it->effect_item_realized) || (it->delete_me)) return;
5341 _mode_finished_signal_cb(it, (Evas_Object *)elm_genlist_item_object_get(it), NULL, NULL);
5343 it->edit_obj = edje_object_add(evas_object_evas_get(it->base.widget));
5344 edje_object_scale_set(it->edit_obj, elm_widget_scale_get(it->base.widget) *
5345 _elm_config->scale);
5346 evas_object_smart_member_add(it->edit_obj, it->wd->pan_smart);
5347 elm_widget_sub_object_add(it->base.widget, it->edit_obj);
5349 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) strncpy(buf, "tree", sizeof(buf));
5350 else strncpy(buf, "item", sizeof(buf));
5351 if (it->wd->compress) strncat(buf, "_compress", sizeof(buf) - strlen(buf));
5353 strncat(buf, "/", sizeof(buf) - strlen(buf));
5355 if (it->itc->edit_item_style && strcmp(it->itc->edit_item_style, "default"))
5357 strncat(buf, it->itc->edit_item_style, sizeof(buf) - strlen(buf));
5358 _elm_theme_object_set(it->base.widget, it->edit_obj, "genlist", buf, elm_widget_style_get(it->base.widget));
5362 _elm_theme_object_set(it->base.widget, it->edit_obj, "genlist", "item/edit_default", elm_widget_style_get(it->base.widget));
5365 if (it->wd->reorder_mode)
5367 if (effect_on) edje_object_signal_emit(it->edit_obj, "elm,state,reorder_enabled_effect", "elm");
5368 else edje_object_signal_emit(it->edit_obj, "elm,state,reorder_enabled", "elm");
5370 if (effect_on) edje_object_signal_emit(it->edit_obj, "elm,state,emode_enabled_effect", "elm");
5371 else edje_object_signal_emit(it->edit_obj, "elm,state,emode_enabled", "elm");
5373 if (it->disabled) edje_object_signal_emit(it->edit_obj, "elm,state,disabled", "elm");
5374 else edje_object_signal_emit(it->edit_obj, "elm,state,enabled", "elm");
5377 if ((it->wd->edit_mode))
5379 if (it->itc->func.icon_get)
5384 it->icons = elm_widget_stringlist_get(edje_object_data_get(it->edit_obj, "edit_icons"));
5385 EINA_LIST_FOREACH(it->icons, l, key)
5387 Evas_Object *ic = it->itc->func.icon_get
5388 ((void *)it->base.data, it->base.widget, l->data);
5392 it->edit_icon_objs = eina_list_append(it->edit_icon_objs, ic);
5393 edje_object_part_swallow(it->edit_obj, key, ic);
5394 evas_object_show(ic);
5395 elm_widget_sub_object_add(it->base.widget, ic);
5397 elm_widget_disabled_set(ic, EINA_TRUE);
5402 edje_object_part_swallow(it->edit_obj, "original_edc", it->base.view);
5403 _effect_item_controls(it,it->scrl_x, it->scrl_y);
5404 evas_object_show(it->edit_obj);
5406 it->effect_item_realized = EINA_TRUE;
5407 it->want_unrealize = EINA_FALSE;
5411 _effect_item_unrealize(Elm_Genlist_Item *it)
5415 if (!it->effect_item_realized) return;
5416 if (it->wd->reorder_it && it->wd->reorder_it == it) return;
5418 edje_object_signal_emit(it->edit_obj, "elm,state,reorder_disable_effect", "elm");
5419 edje_object_signal_emit(it->edit_obj, "elm,state,sel,disable", "elm");
5420 edje_object_message_signal_process(it->edit_obj);
5421 edje_object_part_unswallow(it->edit_obj, it->base.view);
5422 evas_object_smart_member_add(it->base.view, it->wd->pan_smart);
5423 elm_widget_sub_object_add(it->base.widget, it->base.view);
5424 // evas_object_smart_callback_call(it->edit_obj, "unrealized", it);
5425 // _item_cache_add(it);
5426 evas_object_del(it->edit_obj);
5427 it->edit_obj = NULL;
5428 EINA_LIST_FREE(it->edit_icon_objs, icon)
5429 evas_object_del(icon);
5431 // edje_object_signal_emit(it->edit_obj, "elm,state,edit_end,disable", "elm");
5432 it->effect_item_realized = EINA_FALSE;
5436 * Get Genlist edit mode
5438 * @param obj The genlist object
5439 * @return The edit mode status
5440 * (EINA_TRUE = edit mode, EINA_FALSE = normal mode
5445 elm_genlist_edit_mode_get(const Evas_Object *obj)
5447 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5448 Widget_Data *wd = elm_widget_data_get(obj);
5449 if (!wd) return EINA_FALSE;
5451 if (wd->edit_mode) return EINA_TRUE;
5452 else return EINA_FALSE;
5456 * Set Genlist edit mode
5458 * This sets Genlist edit mode.
5460 * @param obj The Genlist object
5461 * @param emode ELM_GENLIST_EDIT_MODE_{NONE & REORDER & INSERT & DELETE & SELECT & SELECT_ALL}
5462 * @param edit_class Genlist edit class (Elm_Genlist_Edit_Class structure)
5467 elm_genlist_edit_mode_set(Evas_Object *obj, Eina_Bool edit_mode)
5469 ELM_CHECK_WIDTYPE(obj, widtype);
5473 Elm_Genlist_Item *it;
5475 Widget_Data *wd = elm_widget_data_get(obj);
5477 if (wd->edit_mode == edit_mode) return;
5479 wd->edit_mode = edit_mode;
5482 EINA_INLIST_FOREACH(wd->blocks, itb)
5486 EINA_LIST_FOREACH(itb->items, l, it)
5488 if (it->flags != ELM_GENLIST_ITEM_GROUP && it->realized)
5490 _effect_item_unrealize(it);
5495 _item_cache_zero(wd);
5500 EINA_INLIST_FOREACH(wd->blocks, itb)
5504 EINA_LIST_FOREACH(itb->items, l, it)
5506 if (it->flags != ELM_GENLIST_ITEM_GROUP && it->realized)
5508 if(it->selected) _item_unselect(it);
5509 if (it->itc->edit_item_style) _effect_item_realize(it, EINA_TRUE);
5516 if (wd->calc_job) ecore_job_del(wd->calc_job);
5517 wd->calc_job = ecore_job_add(_calc_job, wd);
5521 * Set a given item's rename mode
5523 * This renames the item's label from genlist
5525 * @param it The item
5526 * @param renamed set if emode is EINA_TRUE, unset if emode is EINA_FALSE
5531 elm_genlist_item_rename_mode_set(Elm_Genlist_Item *it, Eina_Bool renamed)
5537 _item_unrealize(it, EINA_FALSE);
5538 it->renamed = EINA_TRUE;
5539 it->wd->rename_it = it;
5540 it->nocache = EINA_TRUE;
5541 if (it->selected) _item_unselect(it);
5543 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
5544 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
5550 it->renamed = EINA_FALSE;
5551 it->nocache = EINA_TRUE;
5552 it->wd->rename_it = NULL;
5553 _item_cache_zero(it->wd);
5554 elm_genlist_item_update(it);
5560 elm_genlist_item_rename_mode_get(Elm_Genlist_Item *item)
5562 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
5563 return item->renamed;
5567 _item_auto_scroll(void *data)
5569 Widget_Data *wd = data;
5572 if ((wd->expand_item) && (!wd->auto_scrolled))
5574 Elm_Genlist_Item *it;
5576 Evas_Coord ox, oy, ow, oh;
5577 evas_object_geometry_get(wd->obj, &ox, &oy, &ow, &oh);
5579 wd->auto_scrolled = EINA_TRUE;
5580 if (wd->expand_item->scrl_y > (oh + oy) / 2)
5582 EINA_LIST_FOREACH(wd->expand_item->items, l, it)
5584 elm_genlist_item_bring_in(it);