3 #include <Elementary.h>
4 #include <Elementary_Cursor.h>
6 #include "els_scroller.h"
9 #define MAX_ITEMS_PER_BLOCK 32
10 #define REORDER_EFFECT_TIME 0.5
12 typedef struct _Widget_Data Widget_Data;
13 typedef struct _Item_Block Item_Block;
14 typedef struct _Pan Pan;
15 typedef struct _Item_Cache Item_Cache;
16 typedef enum _Elm_Genlist_Item_Move_effect_Mode
18 ELM_GENLIST_ITEM_MOVE_EFFECT_NONE = 0,
19 ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND = (1 << 0),
20 ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT = (1 << 1),
21 ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE = (1 << 2),
22 } Elm_Genlist_Item_Move_effect_Mode;
26 Evas_Object *obj, *scr, *pan_smart;
27 Eina_Inlist *items, *blocks;
28 Eina_List *group_items;
30 Evas_Coord pan_x, pan_y, old_pan_y, w, h, minw, minh, realminw, prev_viewport_w;
31 Ecore_Job *calc_job, *update_job;
32 Ecore_Idle_Enterer *queue_idle_enterer;
33 Ecore_Idler *must_recalc_idler;
34 Eina_List *queue, *selected;
35 Elm_Genlist_Item *show_item, *last_selected_item, *anchor_item, *mode_item, *reorder_it, *reorder_rel, *expand_item;
36 Eina_Inlist *item_cache;
37 Evas_Coord anchor_y, reorder_start_y;
39 Ecore_Timer *multi_timer, *scr_hold_timer;
40 Ecore_Animator *reorder_move_animator;
41 const char *mode_type;
42 unsigned int start_time;
43 Evas_Coord prev_x, prev_y, prev_mx, prev_my;
44 Evas_Coord cur_x, cur_y, cur_mx, cur_my;
45 Eina_Bool mouse_down : 1;
46 Eina_Bool multi_down : 1;
47 Eina_Bool multi_timeout : 1;
48 Eina_Bool multitouched : 1;
49 Eina_Bool on_hold : 1;
51 Eina_Bool always_select : 1;
52 Eina_Bool longpressed : 1;
53 Eina_Bool wasselected : 1;
54 Eina_Bool no_select : 1;
55 Eina_Bool bring_in : 1;
56 Eina_Bool compress : 1;
57 Eina_Bool height_for_width : 1;
58 Eina_Bool pan_resize : 1;
59 Eina_Bool homogeneous : 1;
60 Eina_Bool clear_me : 1;
62 Eina_Bool reorder_mode : 1;
63 Eina_Bool reorder_pan_move : 1;
67 } history[SWIPE_MOVES];
76 int group_item_height;
77 int max_items_per_block;
78 double longpress_timeout;
81 Eina_Bool reorder_deleted : 1;
82 Eina_Bool effect_mode : 1;
83 Eina_Bool auto_scrolled : 1;
84 Eina_Bool pan_changed : 1;
85 Eina_Bool drag_started : 1;
87 Ecore_Animator *item_moving_effect_timer;
88 Evas_Object *alpha_bg;
89 Evas_Coord expand_item_end;
90 Evas_Coord expand_item_gap;
92 Ecore_Job *changed_job;
93 Elm_Genlist_Item *rename_it;
104 Evas_Coord x, y, w, h, minw, minh;
105 Eina_Bool want_unrealize : 1;
106 Eina_Bool realized : 1;
107 Eina_Bool changed : 1;
108 Eina_Bool updateme : 1;
109 Eina_Bool changeme : 1;
110 Eina_Bool showme : 1;
111 Eina_Bool must_recalc : 1;
114 struct _Elm_Genlist_Item
116 Elm_Widget_Item base;
121 Evas_Coord x, y, w, h, minw, minh;
122 const Elm_Genlist_Item_Class *itc;
123 Elm_Genlist_Item *parent;
124 Elm_Genlist_Item *group_item;
125 Elm_Genlist_Item_Flags flags;
133 Eina_List *labels, *icons, *states, *icon_objs;
134 Eina_List *mode_labels, *mode_icons, *mode_states, *mode_icon_objs;
135 Ecore_Timer *long_timer;
136 Ecore_Timer *swipe_timer;
138 Evas_Coord scrl_x, scrl_y;
140 Elm_Genlist_Item *rel;
141 Evas_Object *mode_view;
146 Elm_Tooltip_Item_Content_Cb content_cb;
147 Evas_Smart_Cb del_cb;
151 const char *mouse_cursor;
158 Eina_Bool before : 1;
160 Eina_Bool want_unrealize : 1;
161 Eina_Bool want_realize : 1;
162 Eina_Bool realized : 1;
163 Eina_Bool selected : 1;
164 Eina_Bool highlighted : 1;
165 Eina_Bool expanded : 1;
166 Eina_Bool disabled : 1;
167 Eina_Bool display_only : 1;
168 Eina_Bool mincalcd : 1;
169 Eina_Bool queued : 1;
170 Eina_Bool showme : 1;
171 Eina_Bool delete_me : 1;
173 Eina_Bool dragging : 1;
174 Eina_Bool updateme : 1;
175 Eina_Bool nocache : 1;
176 Eina_Bool move_effect_enabled : 1;
177 Eina_Bool defer_unrealize : 1;
180 Eina_Bool effect_done : 1;
181 Eina_Bool reordering : 1;
182 Eina_Bool renamed : 1;
183 Eina_Bool effect_item_realized : 1;
184 Eina_List *edit_icon_objs;
185 Evas_Object *edit_obj;
187 Ecore_Animator *item_moving_effect_timer;
188 Evas_Coord old_scrl_y;
195 Evas_Object *base_view, *spacer;
197 const char *item_style; // it->itc->item_style
198 Eina_Bool tree : 1; // it->flags & ELM_GENLIST_ITEM_SUBITEMS
199 Eina_Bool compress : 1; // it->wd->compress
200 Eina_Bool odd : 1; // in & 0x1
202 Eina_Bool selected : 1; // it->selected
203 Eina_Bool disabled : 1; // it->disabled
204 Eina_Bool expanded : 1; // it->expanded
207 #define ELM_GENLIST_ITEM_FROM_INLIST(item) \
208 ((item) ? EINA_INLIST_CONTAINER_GET(item, Elm_Genlist_Item) : NULL)
212 Evas_Object_Smart_Clipped_Data __clipped_data;
214 Ecore_Job *resize_job;
217 static const char *widtype = NULL;
218 static void _item_cache_zero(Widget_Data *wd);
219 static void _del_hook(Evas_Object *obj);
220 static void _mirrored_set(Evas_Object *obj,
222 static void _theme_hook(Evas_Object *obj);
223 static void _show_region_hook(void *data,
225 static void _sizing_eval(Evas_Object *obj);
226 static void _item_realize(Elm_Genlist_Item *it,
229 static void _item_unrealize(Elm_Genlist_Item *it,
231 static void _item_block_unrealize(Item_Block *itb);
232 static void _calc_job(void *data);
233 static void _on_focus_hook(void *data,
235 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
236 static void _changed_job(void *data);
237 static Eina_Bool _item_multi_select_up(Widget_Data *wd);
238 static Eina_Bool _item_multi_select_down(Widget_Data *wd);
239 static Eina_Bool _item_single_select_up(Widget_Data *wd);
240 static Eina_Bool _item_single_select_down(Widget_Data *wd);
241 static Eina_Bool _event_hook(Evas_Object *obj,
243 Evas_Callback_Type type,
245 static void _signal_emit_hook(Evas_Object *obj,
246 const char *emission,
248 static Eina_Bool _deselect_all_items(Widget_Data *wd);
249 static void _pan_calculate(Evas_Object *obj);
250 static void _pan_max_get(Evas_Object *obj,
253 static void _item_position(Elm_Genlist_Item *it,
257 static void _mode_item_realize(Elm_Genlist_Item *it);
258 static void _mode_item_unrealize(Elm_Genlist_Item *it);
259 static void _item_mode_set(Elm_Genlist_Item *it);
260 static void _item_mode_unset(Widget_Data *wd);
261 static void _group_items_recalc(void *data);
262 static void _item_move_after(Elm_Genlist_Item *it,
263 Elm_Genlist_Item *after);
264 static void _item_move_before(Elm_Genlist_Item *it,
265 Elm_Genlist_Item *before);
267 // TODO : refactoring
268 static Evas_Object* _create_tray_alpha_bg(const Evas_Object *obj);
269 static unsigned int current_time_get();
270 static Eina_Bool _item_moving_effect_timer_cb(void *data);
271 static int _item_flip_effect_show(Elm_Genlist_Item *it);
272 static void _effect_item_controls(Elm_Genlist_Item *it, int itx, int ity);
273 static void _effect_item_realize(Elm_Genlist_Item *it, Eina_Bool effect_on);
274 static void _effect_item_unrealize(Elm_Genlist_Item *it);
275 static void _item_auto_scroll(void *data);
277 static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
279 static const char SIG_ACTIVATED[] = "activated";
280 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
281 static const char SIG_SELECTED[] = "selected";
282 static const char SIG_UNSELECTED[] = "unselected";
283 static const char SIG_EXPANDED[] = "expanded";
284 static const char SIG_CONTRACTED[] = "contracted";
285 static const char SIG_EXPAND_REQUEST[] = "expand,request";
286 static const char SIG_CONTRACT_REQUEST[] = "contract,request";
287 static const char SIG_REALIZED[] = "realized";
288 static const char SIG_UNREALIZED[] = "unrealized";
289 static const char SIG_DRAG_START_UP[] = "drag,start,up";
290 static const char SIG_DRAG_START_DOWN[] = "drag,start,down";
291 static const char SIG_DRAG_START_LEFT[] = "drag,start,left";
292 static const char SIG_DRAG_START_RIGHT[] = "drag,start,right";
293 static const char SIG_DRAG_STOP[] = "drag,stop";
294 static const char SIG_DRAG[] = "drag";
295 static const char SIG_LONGPRESSED[] = "longpressed";
296 static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
297 static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
298 static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
299 static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
300 static const char SIG_SCROLL_EDGE_TOP[] = "scroll,edge,top";
301 static const char SIG_SCROLL_EDGE_BOTTOM[] = "scroll,edge,bottom";
302 static const char SIG_SCROLL_EDGE_LEFT[] = "scroll,edge,left";
303 static const char SIG_SCROLL_EDGE_RIGHT[] = "scroll,edge,right";
304 static const char SIG_MULTI_SWIPE_LEFT[] = "multi,swipe,left";
305 static const char SIG_MULTI_SWIPE_RIGHT[] = "multi,swipe,right";
306 static const char SIG_MULTI_SWIPE_UP[] = "multi,swipe,up";
307 static const char SIG_MULTI_SWIPE_DOWN[] = "multi,swipe,down";
308 static const char SIG_MULTI_PINCH_OUT[] = "multi,pinch,out";
309 static const char SIG_MULTI_PINCH_IN[] = "multi,pinch,in";
310 static const char SIG_SWIPE[] = "swipe";
312 static const Evas_Smart_Cb_Description _signals[] = {
313 {SIG_CLICKED_DOUBLE, ""},
316 {SIG_UNSELECTED, ""},
318 {SIG_CONTRACTED, ""},
319 {SIG_EXPAND_REQUEST, ""},
320 {SIG_CONTRACT_REQUEST, ""},
322 {SIG_UNREALIZED, ""},
323 {SIG_DRAG_START_UP, ""},
324 {SIG_DRAG_START_DOWN, ""},
325 {SIG_DRAG_START_LEFT, ""},
326 {SIG_DRAG_START_RIGHT, ""},
329 {SIG_LONGPRESSED, ""},
330 {SIG_SCROLL_ANIM_START, ""},
331 {SIG_SCROLL_ANIM_STOP, ""},
332 {SIG_SCROLL_DRAG_START, ""},
333 {SIG_SCROLL_DRAG_STOP, ""},
334 {SIG_SCROLL_EDGE_TOP, ""},
335 {SIG_SCROLL_EDGE_BOTTOM, ""},
336 {SIG_SCROLL_EDGE_LEFT, ""},
337 {SIG_SCROLL_EDGE_RIGHT, ""},
338 {SIG_MULTI_SWIPE_LEFT, ""},
339 {SIG_MULTI_SWIPE_RIGHT, ""},
340 {SIG_MULTI_SWIPE_UP, ""},
341 {SIG_MULTI_SWIPE_DOWN, ""},
342 {SIG_MULTI_PINCH_OUT, ""},
343 {SIG_MULTI_PINCH_IN, ""},
349 _event_hook(Evas_Object *obj,
350 Evas_Object *src __UNUSED__,
351 Evas_Callback_Type type,
354 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
355 Evas_Event_Key_Down *ev = event_info;
356 Widget_Data *wd = elm_widget_data_get(obj);
357 Evas_Coord pan_max_x = 0, pan_max_y = 0;
358 if (!wd) return EINA_FALSE;
359 if (!wd->items) return EINA_FALSE;
360 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
361 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
363 Elm_Genlist_Item *it = NULL;
366 Evas_Coord step_x = 0;
367 Evas_Coord step_y = 0;
370 Evas_Coord page_x = 0;
371 Evas_Coord page_y = 0;
373 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
374 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
375 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
376 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
378 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
382 else if ((!strcmp(ev->keyname, "Right")) ||
383 (!strcmp(ev->keyname, "KP_Right")))
387 else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
389 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
390 (_item_multi_select_up(wd)))
391 || (_item_single_select_up(wd)))
393 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
399 else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
401 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
402 (_item_multi_select_down(wd)))
403 || (_item_single_select_down(wd)))
405 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
411 else if ((!strcmp(ev->keyname, "Home")) ||
412 (!strcmp(ev->keyname, "KP_Home")))
414 it = elm_genlist_first_item_get(obj);
415 elm_genlist_item_bring_in(it);
416 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
419 else if ((!strcmp(ev->keyname, "End")) ||
420 (!strcmp(ev->keyname, "KP_End")))
422 it = elm_genlist_last_item_get(obj);
423 elm_genlist_item_bring_in(it);
424 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
427 else if ((!strcmp(ev->keyname, "Prior")) ||
428 (!strcmp(ev->keyname, "KP_Prior")))
431 y -= -(page_y * v_h) / 100;
435 else if ((!strcmp(ev->keyname, "Next")) ||
436 (!strcmp(ev->keyname, "KP_Next")))
439 y += -(page_y * v_h) / 100;
443 else if (((!strcmp(ev->keyname, "Return")) ||
444 (!strcmp(ev->keyname, "KP_Enter")) ||
445 (!strcmp(ev->keyname, "space")))
446 && (!wd->multi) && (wd->selected))
448 it = elm_genlist_selected_item_get(obj);
449 elm_genlist_item_expanded_set(it,
450 !elm_genlist_item_expanded_get(it));
451 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
453 else if (!strcmp(ev->keyname, "Escape"))
455 if (!_deselect_all_items(wd)) return EINA_FALSE;
456 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
459 else return EINA_FALSE;
461 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
462 _pan_max_get(wd->pan_smart, &pan_max_x, &pan_max_y);
464 if (x > pan_max_x) x = pan_max_x;
466 if (y > pan_max_y) y = pan_max_y;
467 elm_smart_scroller_child_pos_set(wd->scr, x, y);
472 _deselect_all_items(Widget_Data *wd)
474 if (!wd->selected) return EINA_FALSE;
476 elm_genlist_item_selected_set(wd->selected->data, EINA_FALSE);
482 _item_multi_select_up(Widget_Data *wd)
484 if (!wd->selected) return EINA_FALSE;
485 if (!wd->multi) return EINA_FALSE;
487 Elm_Genlist_Item *prev = elm_genlist_item_prev_get(wd->last_selected_item);
488 if (!prev) return EINA_TRUE;
490 if (elm_genlist_item_selected_get(prev))
492 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
493 wd->last_selected_item = prev;
494 elm_genlist_item_show(wd->last_selected_item);
498 elm_genlist_item_selected_set(prev, EINA_TRUE);
499 elm_genlist_item_show(prev);
505 _item_multi_select_down(Widget_Data *wd)
507 if (!wd->selected) return EINA_FALSE;
508 if (!wd->multi) return EINA_FALSE;
510 Elm_Genlist_Item *next = elm_genlist_item_next_get(wd->last_selected_item);
511 if (!next) return EINA_TRUE;
513 if (elm_genlist_item_selected_get(next))
515 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
516 wd->last_selected_item = next;
517 elm_genlist_item_show(wd->last_selected_item);
521 elm_genlist_item_selected_set(next, EINA_TRUE);
522 elm_genlist_item_show(next);
528 _item_single_select_up(Widget_Data *wd)
530 Elm_Genlist_Item *prev;
533 prev = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
534 while ((prev) && (prev->delete_me))
535 prev = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
537 else prev = elm_genlist_item_prev_get(wd->last_selected_item);
539 if (!prev) return EINA_FALSE;
541 _deselect_all_items(wd);
543 elm_genlist_item_selected_set(prev, EINA_TRUE);
544 elm_genlist_item_show(prev);
549 _item_single_select_down(Widget_Data *wd)
551 Elm_Genlist_Item *next;
554 next = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
555 while ((next) && (next->delete_me))
556 next = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
558 else next = elm_genlist_item_next_get(wd->last_selected_item);
560 if (!next) return EINA_FALSE;
562 _deselect_all_items(wd);
564 elm_genlist_item_selected_set(next, EINA_TRUE);
565 elm_genlist_item_show(next);
570 _on_focus_hook(void *data __UNUSED__,
573 Widget_Data *wd = elm_widget_data_get(obj);
575 if (elm_widget_focus_get(obj))
577 elm_object_signal_emit(wd->obj, "elm,action,focus", "elm");
578 evas_object_focus_set(wd->obj, EINA_TRUE);
579 if ((wd->items) && (wd->selected) && (!wd->last_selected_item))
580 wd->last_selected_item = eina_list_data_get(wd->selected);
584 elm_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
585 evas_object_focus_set(wd->obj, EINA_FALSE);
590 _del_hook(Evas_Object *obj)
592 Widget_Data *wd = elm_widget_data_get(obj);
594 _item_cache_zero(wd);
595 if (wd->calc_job) ecore_job_del(wd->calc_job);
596 if (wd->update_job) ecore_job_del(wd->update_job);
597 if (wd->queue_idle_enterer) ecore_idle_enterer_del(wd->queue_idle_enterer);
598 if (wd->changed_job) ecore_job_del(wd->changed_job);
599 if (wd->must_recalc_idler) ecore_idler_del(wd->must_recalc_idler);
600 if (wd->multi_timer) ecore_timer_del(wd->multi_timer);
601 if (wd->mode_type) eina_stringshare_del(wd->mode_type);
602 if (wd->scr_hold_timer) ecore_timer_del(wd->scr_hold_timer);
607 _del_pre_hook(Evas_Object *obj)
609 Widget_Data *wd = elm_widget_data_get(obj);
611 if (wd->edit_mode) elm_genlist_edit_mode_set(wd->obj, EINA_FALSE);
612 elm_genlist_clear(obj);
613 evas_object_del(wd->pan_smart);
614 wd->pan_smart = NULL;
618 _mirrored_set(Evas_Object *obj,
621 Widget_Data *wd = elm_widget_data_get(obj);
623 _item_cache_zero(wd);
624 elm_smart_scroller_mirrored_set(wd->scr, rtl);
628 _theme_hook(Evas_Object *obj)
630 Widget_Data *wd = elm_widget_data_get(obj);
633 evas_event_freeze(evas_object_evas_get(wd->obj));
634 _item_cache_zero(wd);
635 _elm_widget_mirrored_reload(obj);
636 _mirrored_set(obj, elm_widget_mirrored_get(obj));
637 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
638 elm_widget_style_get(obj));
639 // edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
640 wd->item_width = wd->item_height = 0;
641 wd->group_item_width = wd->group_item_height = 0;
642 wd->minw = wd->minh = wd->realminw = 0;
643 EINA_INLIST_FOREACH(wd->blocks, itb)
646 Elm_Genlist_Item *it;
648 if (itb->realized) _item_block_unrealize(itb);
649 EINA_LIST_FOREACH(itb->items, l, it)
650 it->mincalcd = EINA_FALSE;
652 itb->changed = EINA_TRUE;
654 if (wd->calc_job) ecore_job_del(wd->calc_job);
655 wd->calc_job = ecore_job_add(_calc_job, wd);
657 evas_event_thaw(evas_object_evas_get(wd->obj));
658 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
662 _show_region_hook(void *data,
665 Widget_Data *wd = elm_widget_data_get(data);
666 Evas_Coord x, y, w, h;
668 elm_widget_show_region_get(obj, &x, &y, &w, &h);
669 //x & y are screen coordinates, Add with pan coordinates
672 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
676 _translate_hook(Evas_Object *obj)
678 evas_object_smart_callback_call(obj, "language,changed", NULL);
682 _sizing_eval(Evas_Object *obj)
684 Widget_Data *wd = elm_widget_data_get(obj);
685 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
687 evas_object_size_hint_min_get(wd->scr, &minw, &minh);
688 evas_object_size_hint_max_get(wd->scr, &maxw, &maxh);
690 if (wd->height_for_width)
694 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
695 if ((vw != 0) && (vw != wd->prev_viewport_w))
699 wd->prev_viewport_w = vw;
700 EINA_INLIST_FOREACH(wd->blocks, itb)
702 itb->must_recalc = EINA_TRUE;
704 if (wd->calc_job) ecore_job_del(wd->calc_job);
705 wd->calc_job = ecore_job_add(_calc_job, wd);
708 if (wd->mode == ELM_LIST_LIMIT)
714 elm_smart_scroller_child_viewport_size_get(wd->scr, &vmw, &vmh);
715 edje_object_size_min_calc
716 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
723 edje_object_size_min_calc
724 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
728 evas_object_size_hint_min_set(obj, minw, minh);
729 evas_object_size_hint_max_set(obj, maxw, maxh);
733 _signal_emit_hook(Evas_Object *obj,
734 const char *emission,
737 Widget_Data *wd = elm_widget_data_get(obj);
738 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
743 _item_highlight(Elm_Genlist_Item *it)
745 const char *selectraise;
746 if ((it->wd->no_select) || (it->delete_me) || (it->highlighted) ||
747 (it->disabled) || (it->display_only) || (it->mode_view))
749 edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
750 if (it->edit_obj) edje_object_signal_emit(it->edit_obj, "elm,state,selected", "elm");
751 selectraise = edje_object_data_get(VIEW(it), "selectraise");
752 if ((selectraise) && (!strcmp(selectraise, "on")))
754 if (it->edit_obj) evas_object_raise(it->edit_obj);
755 else evas_object_raise(VIEW(it));
756 if ((it->group_item) && (it->group_item->realized))
757 evas_object_raise(it->VIEW(group_item));
759 it->highlighted = EINA_TRUE;
763 _item_block_del(Elm_Genlist_Item *it)
766 Item_Block *itb = it->block;
768 itb->items = eina_list_remove(itb->items, it);
770 itb->changed = EINA_TRUE;
771 if (!it->wd->reorder_deleted)
773 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
774 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
778 il = EINA_INLIST_GET(itb);
779 Item_Block *itbn = (Item_Block *)(il->next);
781 it->parent->items = eina_list_remove(it->parent->items, it);
783 it->wd->blocks = eina_inlist_remove(it->wd->blocks, il);
785 if (itbn) itbn->changed = EINA_TRUE;
789 if (itb->count < itb->wd->max_items_per_block/2)
791 il = EINA_INLIST_GET(itb);
792 Item_Block *itbp = (Item_Block *)(il->prev);
793 Item_Block *itbn = (Item_Block *)(il->next);
794 if ((itbp) && ((itbp->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
796 Elm_Genlist_Item *it2;
798 EINA_LIST_FREE(itb->items, it2)
801 itbp->items = eina_list_append(itbp->items, it2);
803 itbp->changed = EINA_TRUE;
805 it->wd->blocks = eina_inlist_remove(it->wd->blocks,
806 EINA_INLIST_GET(itb));
809 else if ((itbn) && ((itbn->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
813 Eina_List *last = eina_list_last(itb->items);
814 Elm_Genlist_Item *it2 = last->data;
817 itb->items = eina_list_remove_list(itb->items, last);
818 itbn->items = eina_list_prepend(itbn->items, it2);
820 itbn->changed = EINA_TRUE;
823 eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb));
831 _item_subitems_clear(Elm_Genlist_Item *it)
834 Eina_List *tl = NULL, *l;
835 Elm_Genlist_Item *it2;
837 EINA_LIST_FOREACH(it->items, l, it2)
838 tl = eina_list_append(tl, it2);
840 EINA_LIST_FREE(tl, it2)
841 elm_genlist_item_del(it2);
845 _item_del(Elm_Genlist_Item *it)
847 Evas_Object *tob = it->wd->obj;
849 evas_event_freeze(evas_object_evas_get(tob));
850 elm_widget_item_pre_notify_del(it);
851 elm_genlist_item_subitems_clear(it);
852 it->wd->walking -= it->walking;
853 if (it->wd->show_item == it) it->wd->show_item = NULL;
854 if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it);
855 if (it->realized) _item_unrealize(it, EINA_FALSE);
856 if (it->effect_item_realized) _effect_item_unrealize(it);
857 if (it->block) _item_block_del(it);
858 if ((!it->delete_me) && (it->itc->func.del))
859 it->itc->func.del((void *)it->base.data, WIDGET(it));
860 it->delete_me = EINA_TRUE;
862 it->wd->queue = eina_list_remove(it->wd->queue, it);
864 if (it->wd->anchor_item == it)
866 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
867 if (!it->wd->anchor_item)
868 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
871 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
873 it->parent->items = eina_list_remove(it->parent->items, it);
874 if (it->flags & ELM_GENLIST_ITEM_GROUP)
875 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
876 if (it->long_timer) ecore_timer_del(it->long_timer);
877 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
879 if (it->tooltip.del_cb)
880 it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
882 evas_event_thaw(evas_object_evas_get(tob));
883 evas_event_thaw_eval(evas_object_evas_get(tob));
885 elm_widget_item_del(it);
889 _item_select(Elm_Genlist_Item *it)
893 Evas_Object *parent = WIDGET(it);
895 if ((it->wd->no_select) || (it->delete_me) || (it->mode_view)) return;
898 if (it->wd->always_select) goto call;
901 it->selected = EINA_TRUE;
902 it->wd->selected = eina_list_append(it->wd->selected, it);
904 evas_object_ref(parent);
907 if (it->wd->last_selected_item && (it != it->wd->last_selected_item))
909 EINA_LIST_FOREACH(it->wd->last_selected_item->icon_objs, l, obj)
911 //elm_widget_focused_object_clear(obj);
912 // FIXME:it prevents to focusable items can get focus
913 // if another genlist item is selected.
914 // when genlist items can receive focus, it should be removed
915 elm_genlist_item_fields_update(it->wd->last_selected_item,
916 "*", ELM_GENLIST_ITEM_FIELD_ICON);
919 if (it->func.func) it->func.func((void *)it->func.data, parent, it);
921 evas_object_smart_callback_call(parent, SIG_SELECTED, it);
924 if ((it->wd->clear_me) && (!it->wd->walking))
926 elm_genlist_clear(parent);
931 if ((!it->walking) && (it->delete_me))
933 if (!it->relcount) _item_del(it);
937 if (it && it->wd) it->wd->last_selected_item = it; // TODO: Remove 'if'?
939 evas_object_unref(parent);
943 _item_unselect(Elm_Genlist_Item *it)
945 const char *stacking, *selectraise;
947 if ((it->delete_me) || (!it->highlighted)) return;
948 edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm");
949 if (it->edit_obj) edje_object_signal_emit(it->edit_obj, "elm,state,unselected", "elm");
950 stacking = edje_object_data_get(VIEW(it), "stacking");
951 selectraise = edje_object_data_get(VIEW(it), "selectraise");
952 if ((selectraise) && (!strcmp(selectraise, "on")))
954 if ((stacking) && (!strcmp(stacking, "below")))
955 evas_object_lower(VIEW(it));
957 it->highlighted = EINA_FALSE;
960 it->selected = EINA_FALSE;
961 it->wd->selected = eina_list_remove(it->wd->selected, it);
962 evas_object_smart_callback_call(WIDGET(it), SIG_UNSELECTED, it);
967 _mouse_move(void *data,
968 Evas *evas __UNUSED__,
972 Elm_Genlist_Item *it = data;
973 Evas_Event_Mouse_Move *ev = event_info;
974 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
975 Evas_Coord ox, oy, ow, oh, it_scrl_y, y_pos;
977 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
979 if (!it->wd->on_hold)
981 it->wd->on_hold = EINA_TRUE;
982 if ((!it->wd->wasselected) && (!it->renamed))
986 if (it->wd->multitouched)
988 it->wd->cur_x = ev->cur.canvas.x;
989 it->wd->cur_y = ev->cur.canvas.y;
992 if ((it->dragging) && (it->down))
994 if (it->wd->movements == SWIPE_MOVES) it->wd->swipe = EINA_TRUE;
997 it->wd->history[it->wd->movements].x = ev->cur.canvas.x;
998 it->wd->history[it->wd->movements].y = ev->cur.canvas.y;
999 if (abs((it->wd->history[it->wd->movements].x -
1000 it->wd->history[0].x)) > 40)
1001 it->wd->swipe = EINA_TRUE;
1003 it->wd->movements++;
1007 ecore_timer_del(it->long_timer);
1008 it->long_timer = NULL;
1010 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG, it);
1013 if ((!it->down) /* || (it->wd->on_hold)*/ || (it->wd->longpressed))
1017 ecore_timer_del(it->long_timer);
1018 it->long_timer = NULL;
1020 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
1022 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
1023 it_scrl_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
1025 if (!it->wd->reorder_start_y)
1026 it->wd->reorder_start_y = it->block->y + it->y;
1030 else if (it_scrl_y + it->wd->reorder_it->h > oy + oh)
1031 y_pos = oy + oh - it->wd->reorder_it->h;
1036 _item_position(it, it->edit_obj, it->scrl_x, y_pos);
1038 _item_position(it, VIEW(it), it->scrl_x, y_pos);
1040 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1041 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1045 if (!it->display_only)
1046 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1047 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1048 x = ev->cur.canvas.x - x;
1049 y = ev->cur.canvas.y - y;
1052 if (adx < 0) adx = -dx;
1055 if (ady < 0) ady = -dy;
1058 if ((adx > minw) || (ady > minh))
1060 it->dragging = EINA_TRUE;
1063 ecore_timer_del(it->long_timer);
1064 it->long_timer = NULL;
1066 if ((!it->wd->wasselected) && (!it->renamed))
1070 if ((ady > adx) && (!it->wd->drag_started))
1071 evas_object_smart_callback_call(WIDGET(it),
1072 SIG_DRAG_START_UP, it);
1076 evas_object_smart_callback_call(WIDGET(it),
1077 SIG_DRAG_START_LEFT, it);
1079 evas_object_smart_callback_call(WIDGET(it),
1080 SIG_DRAG_START_RIGHT, it);
1085 if ((ady > adx) && (!it->wd->drag_started))
1086 evas_object_smart_callback_call(WIDGET(it),
1087 SIG_DRAG_START_DOWN, it);
1091 evas_object_smart_callback_call(WIDGET(it),
1092 SIG_DRAG_START_LEFT, it);
1094 evas_object_smart_callback_call(WIDGET(it),
1095 SIG_DRAG_START_RIGHT, it);
1102 _long_press(void *data)
1104 Elm_Genlist_Item *it = data, *it_tmp;
1105 Eina_List *list, *l;
1107 it->long_timer = NULL;
1108 if ((it->disabled) || (it->dragging) || (it->display_only) || (it->wd->rename_it))
1109 return ECORE_CALLBACK_CANCEL;
1110 it->wd->longpressed = EINA_TRUE;
1111 evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it);
1112 if ((it->wd->reorder_mode) && (it->flags != ELM_GENLIST_ITEM_GROUP))
1114 it->wd->reorder_it = it;
1115 it->wd->reorder_start_y = 0;
1117 evas_object_raise(it->edit_obj);
1119 evas_object_raise(VIEW(it));
1121 elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
1122 elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_FALSE);
1124 list = elm_genlist_realized_items_get(it->wd->obj);
1125 EINA_LIST_FOREACH(list, l, it_tmp)
1127 if (it != it_tmp) _item_unselect(it_tmp);
1131 EINA_LIST_FOREACH(it->items, l, it_tmp)
1133 if (elm_genlist_item_expanded_get(it_tmp))
1135 elm_genlist_item_expanded_set(it_tmp, EINA_FALSE);
1136 return ECORE_CALLBACK_RENEW;
1140 if (elm_genlist_item_expanded_get(it))
1142 elm_genlist_item_expanded_set(it, EINA_FALSE);
1143 return ECORE_CALLBACK_RENEW;
1146 edje_object_signal_emit(it->edit_obj, "elm,action,item,reorder_start", "elm");
1148 edje_object_signal_emit(VIEW(it), "elm,state,reorder,enabled", "elm");
1150 return ECORE_CALLBACK_CANCEL;
1154 _swipe(Elm_Genlist_Item *it)
1159 if ((it->display_only) || (it->disabled)) return;
1160 it->wd->swipe = EINA_FALSE;
1161 for (i = 0; i < it->wd->movements; i++)
1163 sum += it->wd->history[i].x;
1164 if (abs(it->wd->history[0].y - it->wd->history[i].y) > 10) return;
1167 sum /= it->wd->movements;
1168 if (abs(sum - it->wd->history[0].x) <= 10) return;
1169 evas_object_smart_callback_call(WIDGET(it), SIG_SWIPE, it);
1173 _swipe_cancel(void *data)
1175 Elm_Genlist_Item *it = data;
1177 if (!it) return ECORE_CALLBACK_CANCEL;
1178 it->wd->swipe = EINA_FALSE;
1179 it->wd->movements = 0;
1180 return ECORE_CALLBACK_RENEW;
1184 _multi_cancel(void *data)
1186 Widget_Data *wd = data;
1188 if (!wd) return ECORE_CALLBACK_CANCEL;
1189 wd->multi_timeout = EINA_TRUE;
1190 return ECORE_CALLBACK_RENEW;
1194 _multi_touch_gesture_eval(void *data)
1196 Elm_Genlist_Item *it = data;
1198 it->wd->multitouched = EINA_FALSE;
1199 if (it->wd->multi_timer)
1201 ecore_timer_del(it->wd->multi_timer);
1202 it->wd->multi_timer = NULL;
1204 if (it->wd->multi_timeout)
1206 it->wd->multi_timeout = EINA_FALSE;
1210 Evas_Coord minw = 0, minh = 0;
1211 Evas_Coord off_x, off_y, off_mx, off_my;
1213 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1214 off_x = abs(it->wd->cur_x - it->wd->prev_x);
1215 off_y = abs(it->wd->cur_y - it->wd->prev_y);
1216 off_mx = abs(it->wd->cur_mx - it->wd->prev_mx);
1217 off_my = abs(it->wd->cur_my - it->wd->prev_my);
1219 if (((off_x > minw) || (off_y > minh)) && ((off_mx > minw) || (off_my > minh)))
1221 if ((off_x + off_mx) > (off_y + off_my))
1223 if ((it->wd->cur_x > it->wd->prev_x) && (it->wd->cur_mx > it->wd->prev_mx))
1224 evas_object_smart_callback_call(WIDGET(it),
1225 SIG_MULTI_SWIPE_RIGHT, it);
1226 else if ((it->wd->cur_x < it->wd->prev_x) && (it->wd->cur_mx < it->wd->prev_mx))
1227 evas_object_smart_callback_call(WIDGET(it),
1228 SIG_MULTI_SWIPE_LEFT, it);
1229 else if (abs(it->wd->cur_x - it->wd->cur_mx) > abs(it->wd->prev_x - it->wd->prev_mx))
1230 evas_object_smart_callback_call(WIDGET(it),
1231 SIG_MULTI_PINCH_OUT, it);
1233 evas_object_smart_callback_call(WIDGET(it),
1234 SIG_MULTI_PINCH_IN, it);
1238 if ((it->wd->cur_y > it->wd->prev_y) && (it->wd->cur_my > it->wd->prev_my))
1239 evas_object_smart_callback_call(WIDGET(it),
1240 SIG_MULTI_SWIPE_DOWN, it);
1241 else if ((it->wd->cur_y < it->wd->prev_y) && (it->wd->cur_my < it->wd->prev_my))
1242 evas_object_smart_callback_call(WIDGET(it),
1243 SIG_MULTI_SWIPE_UP, it);
1244 else if (abs(it->wd->cur_y - it->wd->cur_my) > abs(it->wd->prev_y - it->wd->prev_my))
1245 evas_object_smart_callback_call(WIDGET(it),
1246 SIG_MULTI_PINCH_OUT, it);
1248 evas_object_smart_callback_call(WIDGET(it),
1249 SIG_MULTI_PINCH_IN, it);
1252 it->wd->multi_timeout = EINA_FALSE;
1256 _multi_down(void *data,
1257 Evas *evas __UNUSED__,
1258 Evas_Object *obj __UNUSED__,
1261 Elm_Genlist_Item *it = data;
1262 Evas_Event_Multi_Down *ev = event_info;
1264 if ((it->wd->multi_device != 0) || (it->wd->multitouched) || (it->wd->multi_timeout)) return;
1265 it->wd->multi_device = ev->device;
1266 it->wd->multi_down = EINA_TRUE;
1267 it->wd->multitouched = EINA_TRUE;
1268 it->wd->prev_mx = ev->canvas.x;
1269 it->wd->prev_my = ev->canvas.y;
1270 if (!it->wd->wasselected) _item_unselect(it);
1271 it->wd->wasselected = EINA_FALSE;
1272 it->wd->longpressed = EINA_FALSE;
1275 ecore_timer_del(it->long_timer);
1276 it->long_timer = NULL;
1280 it->dragging = EINA_FALSE;
1281 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
1283 if (it->swipe_timer)
1285 ecore_timer_del(it->swipe_timer);
1286 it->swipe_timer = NULL;
1288 if (it->wd->on_hold)
1290 it->wd->swipe = EINA_FALSE;
1291 it->wd->movements = 0;
1292 it->wd->on_hold = EINA_FALSE;
1297 _multi_up(void *data,
1298 Evas *evas __UNUSED__,
1299 Evas_Object *obj __UNUSED__,
1302 Elm_Genlist_Item *it = data;
1303 Evas_Event_Multi_Up *ev = event_info;
1305 if (it->wd->multi_device != ev->device) return;
1306 it->wd->multi_device = 0;
1307 it->wd->multi_down = EINA_FALSE;
1308 if (it->wd->mouse_down) return;
1309 _multi_touch_gesture_eval(data);
1313 _multi_move(void *data,
1314 Evas *evas __UNUSED__,
1315 Evas_Object *obj __UNUSED__,
1318 Elm_Genlist_Item *it = data;
1319 Evas_Event_Multi_Move *ev = event_info;
1321 if (it->wd->multi_device != ev->device) return;
1322 it->wd->cur_mx = ev->cur.canvas.x;
1323 it->wd->cur_my = ev->cur.canvas.y;
1327 _mouse_down(void *data,
1328 Evas *evas __UNUSED__,
1332 Elm_Genlist_Item *it = data;
1333 Evas_Event_Mouse_Down *ev = event_info;
1336 if (ev->button != 1) return;
1337 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1339 it->wd->on_hold = EINA_TRUE;
1341 it->down = EINA_TRUE;
1342 it->dragging = EINA_FALSE;
1343 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1344 it->dx = ev->canvas.x - x;
1345 it->dy = ev->canvas.y - y;
1346 it->wd->mouse_down = EINA_TRUE;
1347 if (!it->wd->multitouched)
1349 it->wd->prev_x = ev->canvas.x;
1350 it->wd->prev_y = ev->canvas.y;
1351 it->wd->multi_timeout = EINA_FALSE;
1352 if (it->wd->multi_timer) ecore_timer_del(it->wd->multi_timer);
1353 it->wd->multi_timer = ecore_timer_add(1, _multi_cancel, it->wd);
1355 it->wd->longpressed = EINA_FALSE;
1356 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1357 else it->wd->on_hold = EINA_FALSE;
1358 if (it->wd->on_hold) return;
1359 it->wd->wasselected = it->selected;
1360 _item_highlight(it);
1361 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
1362 if ((!it->disabled) && (!it->display_only))
1364 evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
1365 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
1367 if (it->long_timer) ecore_timer_del(it->long_timer);
1368 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
1369 it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
1371 it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press,
1374 it->long_timer = NULL;
1375 it->wd->swipe = EINA_FALSE;
1376 it->wd->movements = 0;
1380 _mouse_up(void *data,
1381 Evas *evas __UNUSED__,
1382 Evas_Object *obj __UNUSED__,
1385 Elm_Genlist_Item *it = data;
1386 Evas_Event_Mouse_Up *ev = event_info;
1387 Eina_Bool dragged = EINA_FALSE;
1389 if (ev->button != 1) return;
1390 it->down = EINA_FALSE;
1391 it->wd->mouse_down = EINA_FALSE;
1392 if (it->wd->multitouched)
1394 // in single selection modes, some multi touching can make multi highlighted items.
1395 // if a item not selected and highlighted, it should be unhighlighted.
1396 if ((!it->wd->multi) && (!it->selected) && (it->highlighted)) _item_unselect(it);
1397 if (it->wd->multi_down) return;
1398 _multi_touch_gesture_eval(data);
1401 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1402 else it->wd->on_hold = EINA_FALSE;
1405 ecore_timer_del(it->long_timer);
1406 it->long_timer = NULL;
1410 it->dragging = EINA_FALSE;
1411 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
1414 if (it->swipe_timer)
1416 ecore_timer_del(it->swipe_timer);
1417 it->swipe_timer = NULL;
1419 if (it->wd->multi_timer)
1421 ecore_timer_del(it->wd->multi_timer);
1422 it->wd->multi_timer = NULL;
1423 it->wd->multi_timeout = EINA_FALSE;
1425 if (it->wd->on_hold)
1427 if (it->wd->swipe) _swipe(data);
1428 it->wd->longpressed = EINA_FALSE;
1429 it->wd->on_hold = EINA_FALSE;
1432 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
1434 Evas_Coord it_scrl_y = ev->canvas.y - it->wd->reorder_it->dy;
1436 if (it->wd->reorder_rel && (it->wd->reorder_it->parent == it->wd->reorder_rel->parent))
1438 if (it_scrl_y <= it->wd->reorder_rel->scrl_y)
1439 _item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
1441 _item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
1445 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1446 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1448 it->wd->reorder_deleted = EINA_FALSE;
1449 edje_object_signal_emit(it->edit_obj, "elm,action,item,reorder_end", "elm");
1450 it->wd->reorder_it = it->wd->reorder_rel = NULL;
1451 elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
1452 elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_TRUE);
1455 if (it->wd->longpressed)
1457 it->wd->longpressed = EINA_FALSE;
1458 if ((!it->wd->wasselected) && (!it->renamed))
1460 it->wd->wasselected = EINA_FALSE;
1465 if (it->want_unrealize)
1467 _item_unrealize(it, EINA_FALSE);
1468 if (it->block->want_unrealize)
1469 _item_block_unrealize(it->block);
1472 if ((it->disabled) || (dragged) || (it->display_only)) return;
1473 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1478 _item_highlight(it);
1481 else _item_unselect(it);
1487 Widget_Data *wd = it->wd;
1490 while (wd->selected) _item_unselect(wd->selected->data);
1495 const Eina_List *l, *l_next;
1496 Elm_Genlist_Item *it2;
1498 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
1499 if (it2 != it) _item_unselect(it2);
1500 //_item_highlight(it);
1503 _item_highlight(it);
1509 _mouse_down_scroller(void *data,
1510 Evas *evas __UNUSED__,
1511 Evas_Object *obj __UNUSED__,
1512 void *event_info __UNUSED__)
1514 Widget_Data *wd = elm_widget_data_get(data);
1517 wd->drag_started = EINA_FALSE;
1521 _mouse_up_scroller(void *data,
1522 Evas *evas __UNUSED__,
1523 Evas_Object *obj __UNUSED__,
1524 void *event_info __UNUSED__)
1526 Widget_Data *wd = elm_widget_data_get(data);
1529 wd->drag_started = EINA_FALSE;
1533 _mouse_move_scroller(void *data,
1534 Evas *evas __UNUSED__,
1535 Evas_Object *obj __UNUSED__,
1538 Widget_Data *wd = elm_widget_data_get(data);
1539 Evas_Event_Mouse_Move *ev = event_info;
1540 Evas_Coord minw = 0, minh = 0, dx, dy, adx, ady;
1543 if (wd->drag_started) return;
1545 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1546 dx = ev->cur.canvas.x - ev->prev.canvas.x;
1547 dy = ev->cur.canvas.y - ev->prev.canvas.y;
1550 if (adx < 0) adx = -dx;
1551 if (ady < 0) ady = -dy;
1552 if (((ady < minh) && (ady > minh / 2)) && (ady > adx))
1556 evas_object_smart_callback_call(data, SIG_DRAG_START_UP, NULL);
1557 wd->drag_started = EINA_TRUE;
1561 evas_object_smart_callback_call(data, SIG_DRAG_START_DOWN, NULL);
1562 wd->drag_started = EINA_TRUE;
1568 _signal_expand_toggle(void *data,
1569 Evas_Object *obj __UNUSED__,
1570 const char *emission __UNUSED__,
1571 const char *source __UNUSED__)
1573 Elm_Genlist_Item *it = data;
1576 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it);
1578 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it);
1582 _signal_expand(void *data,
1583 Evas_Object *obj __UNUSED__,
1584 const char *emission __UNUSED__,
1585 const char *source __UNUSED__)
1587 Elm_Genlist_Item *it = data;
1590 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it);
1594 _signal_contract(void *data,
1595 Evas_Object *obj __UNUSED__,
1596 const char *emission __UNUSED__,
1597 const char *source __UNUSED__)
1599 Elm_Genlist_Item *it = data;
1602 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it);
1606 _scr_hold_timer_cb(void *data)
1608 if (!data) return ECORE_CALLBACK_CANCEL;
1609 Widget_Data *wd = data;
1610 elm_smart_scroller_hold_set(wd->scr, EINA_FALSE);
1611 wd->scr_hold_timer = NULL;
1612 return ECORE_CALLBACK_CANCEL;
1616 _mode_finished_signal_cb(void *data,
1618 const char *emission __UNUSED__,
1619 const char *source __UNUSED__)
1623 Elm_Genlist_Item *it = data;
1624 if ((it->delete_me) || (!it->realized) || (!it->mode_view)) return;
1626 Evas *te = evas_object_evas_get(obj);
1628 evas_event_freeze(te);
1629 it->nocache = EINA_FALSE;
1630 _mode_item_unrealize(it);
1632 evas_object_raise(it->VIEW(group_item));
1633 snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished", it->wd->mode_type);
1634 edje_object_signal_callback_del_full(obj, buf, "elm", _mode_finished_signal_cb, it);
1635 evas_event_thaw(te);
1636 evas_event_thaw_eval(te);
1640 _item_cache_clean(Widget_Data *wd)
1642 evas_event_freeze(evas_object_evas_get(wd->obj));
1643 while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max))
1647 itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache);
1648 wd->item_cache = eina_inlist_remove(wd->item_cache,
1649 wd->item_cache->last);
1650 wd->item_cache_count--;
1651 if (itc->spacer) evas_object_del(itc->spacer);
1652 if (itc->base_view) evas_object_del(itc->base_view);
1653 if (itc->item_style) eina_stringshare_del(itc->item_style);
1656 evas_event_thaw(evas_object_evas_get(wd->obj));
1657 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
1661 _item_cache_zero(Widget_Data *wd)
1663 int pmax = wd->item_cache_max;
1664 wd->item_cache_max = 0;
1665 _item_cache_clean(wd);
1666 wd->item_cache_max = pmax;
1670 _item_cache_add(Elm_Genlist_Item *it)
1674 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1675 if (it->wd->item_cache_max <= 0)
1677 evas_object_del(VIEW(it));
1679 evas_object_del(it->spacer);
1681 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1682 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1686 it->wd->item_cache_count++;
1687 itc = calloc(1, sizeof(Item_Cache));
1690 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1691 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1694 it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache,
1695 EINA_INLIST_GET(itc));
1696 itc->spacer = it->spacer;
1698 itc->base_view = VIEW(it);
1700 evas_object_hide(itc->base_view);
1701 evas_object_move(itc->base_view, -9999, -9999);
1702 itc->item_style = eina_stringshare_add(it->itc->item_style);
1703 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
1704 itc->compress = (it->wd->compress);
1705 itc->odd = (it->order_num_in & 0x1);
1706 itc->selected = it->selected;
1707 itc->disabled = it->disabled;
1708 itc->expanded = it->expanded;
1711 ecore_timer_del(it->long_timer);
1712 it->long_timer = NULL;
1714 if (it->swipe_timer)
1716 ecore_timer_del(it->swipe_timer);
1717 it->swipe_timer = NULL;
1719 // FIXME: other callbacks?
1720 edje_object_signal_callback_del_full(itc->base_view,
1721 "elm,action,expand,toggle",
1722 "elm", _signal_expand_toggle, it);
1723 edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand",
1725 _signal_expand, it);
1726 edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract",
1727 "elm", _signal_contract, it);
1728 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_DOWN,
1730 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP,
1732 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_MOVE,
1734 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_DOWN,
1736 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_UP,
1738 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_MOVE,
1740 _item_cache_clean(it->wd);
1741 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1742 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1746 _item_cache_find(Elm_Genlist_Item *it)
1749 Eina_Bool tree = 0, odd;
1751 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
1752 odd = (it->order_num_in & 0x1);
1753 EINA_INLIST_FOREACH(it->wd->item_cache, itc)
1755 if ((itc->selected) || (itc->disabled) || (itc->expanded))
1757 if ((itc->tree == tree) &&
1758 (itc->odd == odd) &&
1759 (itc->compress == it->wd->compress) &&
1760 (!strcmp(it->itc->item_style, itc->item_style)))
1762 it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
1763 EINA_INLIST_GET(itc));
1764 it->wd->item_cache_count--;
1772 _item_cache_free(Item_Cache *itc)
1774 if (itc->spacer) evas_object_del(itc->spacer);
1775 if (itc->base_view) evas_object_del(itc->base_view);
1776 if (itc->item_style) eina_stringshare_del(itc->item_style);
1781 _item_label_hook(Elm_Genlist_Item *it, const char *part)
1783 if (!it->itc->func.label_get) return NULL;
1784 return edje_object_part_text_get(VIEW(it), part);
1788 _icon_focused(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1790 Elm_Genlist_Item *it = data;
1791 if (it) it->defer_unrealize = EINA_TRUE;
1795 _icon_unfocused(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1797 Elm_Genlist_Item *it = data;
1798 if (it) it->defer_unrealize = EINA_FALSE;
1802 _item_del_hook(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1804 Elm_Genlist_Item *it = event_info;
1806 if (it->wd->last_selected_item == it)
1807 it->wd->last_selected_item = NULL;
1811 _item_label_realize(Elm_Genlist_Item *it,
1812 Evas_Object *target,
1816 if (it->itc->func.label_get)
1821 *source = elm_widget_stringlist_get(edje_object_data_get(target, "labels"));
1822 EINA_LIST_FOREACH(*source, l, key)
1824 if (parts && fnmatch(parts, key, FNM_PERIOD))
1827 char *s = it->itc->func.label_get
1828 ((void *)it->base.data, WIDGET(it), key);
1832 edje_object_part_text_set(target, key, s);
1837 edje_object_part_text_set(target, key, "");
1845 _item_icon_unrealize(Elm_Genlist_Item *it,
1846 Evas_Object *target,
1850 Eina_List *res = it->icon_objs;
1852 if (it->itc->func.icon_get)
1856 Evas_Object *ic = NULL;
1858 EINA_LIST_FOREACH(*source, l, key)
1860 if (parts && fnmatch(parts, key, FNM_PERIOD))
1863 ic = edje_object_part_swallow_get(target, key);
1866 res = eina_list_remove(res, ic);
1867 edje_object_part_unswallow(target, ic);
1868 evas_object_del(ic);
1877 _item_icon_realize(Elm_Genlist_Item *it,
1878 Evas_Object *target,
1882 Eina_List *res = NULL;
1884 if (it->itc->func.icon_get)
1889 *source = elm_widget_stringlist_get(edje_object_data_get(target, "icons"));
1890 if (parts && (eina_list_count(*source) != eina_list_count(it->icon_objs)))
1891 res = it->icon_objs;
1892 EINA_LIST_FOREACH(*source, l, key)
1894 if (parts && fnmatch(parts, key, FNM_PERIOD))
1897 Evas_Object *ic = it->itc->func.icon_get
1898 ((void *)it->base.data, WIDGET(it), key);
1902 res = eina_list_append(res, ic);
1903 edje_object_part_swallow(target, key, ic);
1904 evas_object_show(ic);
1905 elm_widget_sub_object_add(WIDGET(it), ic);
1906 evas_object_event_callback_add(ic, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, it);
1908 elm_widget_disabled_set(ic, EINA_TRUE);
1917 _item_state_realize(Elm_Genlist_Item *it,
1918 Evas_Object *target,
1922 if (it->itc->func.state_get)
1928 *source = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
1929 EINA_LIST_FOREACH(*source, l, key)
1931 if (parts && fnmatch(parts, key, FNM_PERIOD))
1934 Eina_Bool on = it->itc->func.state_get
1935 ((void *)it->base.data, WIDGET(it), key);
1939 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
1940 edje_object_signal_emit(target, buf, "elm");
1944 snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
1945 edje_object_signal_emit(target, buf, "elm");
1952 _item_realize(Elm_Genlist_Item *it,
1956 Elm_Genlist_Item *it2;
1957 const char *stacking;
1958 const char *treesize;
1960 int depth, tsize = 20;
1961 Item_Cache *itc = NULL;
1963 if ((it->realized) || (it->delete_me)) return;
1964 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1965 it->order_num_in = in;
1966 if (it->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE) calc = EINA_FALSE;
1967 if ((it->nocache) && (!it->renamed))
1968 it->nocache = EINA_FALSE;
1970 itc = _item_cache_find(it);
1971 if (itc && (!it->wd->effect_mode))
1973 VIEW(it) = itc->base_view;
1974 itc->base_view = NULL;
1975 it->spacer = itc->spacer;
1980 VIEW(it) = edje_object_add(evas_object_evas_get(WIDGET(it)));
1981 edje_object_scale_set(VIEW(it),
1982 elm_widget_scale_get(WIDGET(it)) *
1983 _elm_config->scale);
1984 evas_object_smart_member_add(VIEW(it), it->wd->pan_smart);
1985 elm_widget_sub_object_add(WIDGET(it), VIEW(it));
1987 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS)
1988 strncpy(buf, "tree", sizeof(buf));
1989 else strncpy(buf, "item", sizeof(buf));
1990 if (it->wd->compress)
1991 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
1993 if (in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
1994 strncat(buf, "/", sizeof(buf) - strlen(buf));
1995 strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf));
1997 _elm_theme_object_set(WIDGET(it), VIEW(it), "genlist", buf,
1998 elm_widget_style_get(WIDGET(it)));
1999 edje_object_mirrored_set(VIEW(it),
2000 elm_widget_mirrored_get(WIDGET(it)));
2002 evas_object_rectangle_add(evas_object_evas_get(WIDGET(it)));
2003 evas_object_color_set(it->spacer, 0, 0, 0, 0);
2004 elm_widget_sub_object_add(WIDGET(it), it->spacer);
2006 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
2008 if (it2->parent->flags != ELM_GENLIST_ITEM_GROUP) depth += 1;
2010 it->expanded_depth = depth;
2011 treesize = edje_object_data_get(VIEW(it), "treesize");
2012 if (treesize) tsize = atoi(treesize);
2013 evas_object_size_hint_min_set(it->spacer,
2014 (depth * tsize) * _elm_config->scale, 1);
2015 edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer);
2018 edje_object_signal_callback_add(VIEW(it),
2019 "elm,action,expand,toggle",
2020 "elm", _signal_expand_toggle, it);
2021 edje_object_signal_callback_add(VIEW(it), "elm,action,expand",
2022 "elm", _signal_expand, it);
2023 edje_object_signal_callback_add(VIEW(it), "elm,action,contract",
2024 "elm", _signal_contract, it);
2025 stacking = edje_object_data_get(VIEW(it), "stacking");
2028 if (!strcmp(stacking, "below")) evas_object_lower(VIEW(it));
2029 else if (!strcmp(stacking, "above"))
2030 evas_object_raise(VIEW(it));
2032 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN,
2034 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_UP,
2036 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
2038 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_DOWN,
2040 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_UP,
2042 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_MOVE,
2045 if ((!it->edit_obj) &&(it->wd->edit_mode) &&
2046 (it->flags != ELM_GENLIST_ITEM_GROUP) && (it->itc->edit_item_style))
2047 _effect_item_realize(it, EINA_FALSE);
2051 if ((it->selected) && (it->selected != itc->selected))
2053 edje_object_signal_emit(VIEW(it),
2054 "elm,state,selected", "elm");
2056 edje_object_signal_emit(it->edit_obj,
2057 "elm,state,selected", "elm");
2059 if ((it->disabled) && (it->disabled != itc->disabled))
2061 edje_object_signal_emit(VIEW(it),
2062 "elm,state,disabled", "elm");
2064 edje_object_signal_emit(it->edit_obj,
2065 "elm,state,disabled", "elm");
2067 if ((it->expanded) && (it->expanded != itc->expanded))
2069 edje_object_signal_emit(VIEW(it),
2070 "elm,state,expanded", "elm");
2072 edje_object_signal_emit(it->edit_obj,
2073 "elm,state,expanded", "elm");
2080 edje_object_signal_emit(VIEW(it),
2081 "elm,state,selected", "elm");
2083 edje_object_signal_emit(it->edit_obj,
2084 "elm,state,selected", "elm");
2088 edje_object_signal_emit(VIEW(it),
2089 "elm,state,disabled", "elm");
2091 edje_object_signal_emit(it->edit_obj,
2092 "elm,state,disabled", "elm");
2096 edje_object_signal_emit(VIEW(it),
2097 "elm,state,expanded", "elm");
2099 edje_object_signal_emit(it->edit_obj,
2100 "elm,state,expanded", "elm");
2105 if ((calc) && (it->wd->homogeneous) &&
2106 ((it->wd->item_width) ||
2107 ((it->wd->item_width) && (it->wd->group_item_width))))
2109 /* homogenous genlist shortcut */
2112 if (it->flags & ELM_GENLIST_ITEM_GROUP)
2114 it->w = it->minw = it->wd->group_item_width;
2115 it->h = it->minh = it->wd->group_item_height;
2119 it->w = it->minw = it->wd->item_width;
2120 it->h = it->minh = it->wd->item_height;
2122 it->mincalcd = EINA_TRUE;
2127 _item_label_realize(it, VIEW(it), &it->labels, NULL);
2128 it->icon_objs = _item_icon_realize(it, VIEW(it), &it->icons, NULL);
2129 _item_state_realize(it, VIEW(it), &it->states, NULL);
2130 if (it->itc->func.icon_get) // for rename mode
2136 edje_object_signal_emit(VIEW(it), "elm,state,rename,enabled", "elm");
2138 elm_widget_stringlist_get(edje_object_data_get(VIEW(it), "renames"));
2139 EINA_LIST_FOREACH(it->icons, l, key)
2141 Evas_Object *ic = it->itc->func.icon_get
2142 ((void *)it->base.data, WIDGET(it), l->data);
2145 it->icon_objs = eina_list_append(it->icon_objs, ic);
2146 edje_object_part_swallow(VIEW(it), key, ic);
2147 evas_object_show(ic);
2148 elm_widget_sub_object_add(WIDGET(it), ic);
2149 // FIXME: if entry calcuates its cursor position correctly and conformant works,
2150 // genlist does not need to handle this focus thing.
2151 evas_object_smart_callback_add(ic, "focused", _icon_focused, it);
2152 evas_object_smart_callback_add(ic, "unfocused", _icon_unfocused, it);
2157 if (!it->mincalcd || it->wd->pan_resize || ((it->wd->height_for_width) && (it->w != it->minw)))
2159 Evas_Coord mw = -1, mh = -1;
2161 if (it->wd->height_for_width) mw = it->wd->w; // TODO: Removed this. This was removed from upstream.
2163 if (!it->display_only)
2164 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2165 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
2166 edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw,
2168 if (!it->display_only)
2169 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2170 it->w = it->minw = mw;
2171 it->h = it->minh = mh;
2172 it->mincalcd = EINA_TRUE;
2174 if ((!it->wd->group_item_width) && (it->flags == ELM_GENLIST_ITEM_GROUP))
2176 it->wd->group_item_width = mw;
2177 it->wd->group_item_height = mh;
2179 else if ((!it->wd->item_width) && (it->flags == ELM_GENLIST_ITEM_NONE))
2181 it->wd->item_width = mw;
2182 it->wd->item_height = mh;
2185 if (!calc) evas_object_show(VIEW(it));
2188 if (it->tooltip.content_cb)
2190 elm_widget_item_tooltip_content_cb_set(it,
2191 it->tooltip.content_cb,
2192 it->tooltip.data, NULL);
2193 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
2196 if (it->mouse_cursor)
2197 elm_widget_item_cursor_set(it, it->mouse_cursor);
2199 it->realized = EINA_TRUE;
2200 it->want_unrealize = EINA_FALSE;
2202 if (itc) _item_cache_free(itc);
2203 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2204 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2206 evas_object_smart_callback_call(WIDGET(it), SIG_REALIZED, it);
2207 if ((!calc) && (it->wd->edit_mode) && (it->flags != ELM_GENLIST_ITEM_GROUP))
2209 if (it->itc->edit_item_style)
2211 if (!it->edit_obj) _effect_item_realize(it, EINA_FALSE);
2212 edje_object_message_signal_process(it->edit_obj);
2215 edje_object_message_signal_process(VIEW(it));
2219 _item_unrealize(Elm_Genlist_Item *it,
2224 if (!it->realized) return;
2225 if (it->wd->reorder_it == it) return;
2226 if (it->defer_unrealize && !it->updateme) return;
2227 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2229 evas_object_smart_callback_call(WIDGET(it), SIG_UNREALIZED, it);
2232 ecore_timer_del(it->long_timer);
2233 it->long_timer = NULL;
2237 evas_object_del(VIEW(it));
2239 evas_object_del(it->spacer);
2244 edje_object_mirrored_set(VIEW(it),
2245 elm_widget_mirrored_get(WIDGET(it)));
2246 edje_object_scale_set(VIEW(it),
2247 elm_widget_scale_get(WIDGET(it))
2248 * _elm_config->scale);
2249 _item_cache_add(it);
2251 elm_widget_stringlist_free(it->labels);
2253 elm_widget_stringlist_free(it->icons);
2255 elm_widget_stringlist_free(it->states);
2257 EINA_LIST_FREE(it->icon_objs, icon)
2258 evas_object_del(icon);
2260 _mode_item_unrealize(it);
2262 it->realized = EINA_FALSE;
2263 it->want_unrealize = EINA_FALSE;
2264 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2265 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2266 if (it->wd->edit_mode) _effect_item_unrealize(it);
2270 _item_block_recalc(Item_Block *itb,
2275 Elm_Genlist_Item *it;
2276 Evas_Coord minw = 0, minh = 0;
2277 Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE;
2280 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2282 EINA_LIST_FOREACH(itb->items, l, it)
2284 if (it->delete_me) continue;
2285 showme |= it->showme;
2290 if (!it->mincalcd) changed = EINA_TRUE;
2293 _item_realize(it, in, EINA_TRUE);
2294 _item_unrealize(it, EINA_TRUE);
2299 _item_realize(it, in, EINA_TRUE);
2300 _item_unrealize(it, EINA_TRUE);
2304 _item_realize(it, in, EINA_FALSE);
2306 if (minw < it->minw) minw = it->minw;
2314 itb->changed = EINA_FALSE;
2315 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2316 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2321 _item_block_realize(Item_Block *itb)
2323 if (itb->realized) return;
2324 itb->realized = EINA_TRUE;
2325 itb->want_unrealize = EINA_FALSE;
2329 _item_block_unrealize(Item_Block *itb)
2332 Elm_Genlist_Item *it;
2333 Eina_Bool dragging = EINA_FALSE;
2335 if (!itb->realized) return;
2336 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2337 EINA_LIST_FOREACH(itb->items, l, it)
2339 if (itb->must_recalc || it->flags != ELM_GENLIST_ITEM_GROUP)
2343 dragging = EINA_TRUE;
2344 it->want_unrealize = EINA_TRUE;
2347 _item_unrealize(it, EINA_FALSE);
2352 itb->realized = EINA_FALSE;
2353 itb->want_unrealize = EINA_TRUE;
2356 itb->want_unrealize = EINA_FALSE;
2357 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2358 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2362 _get_space_for_reorder_item(Elm_Genlist_Item *it)
2364 Evas_Coord rox, roy, row, roh, oy, oh;
2365 Eina_Bool top = EINA_FALSE;
2366 Elm_Genlist_Item *reorder_it = it->wd->reorder_it;
2367 if (!reorder_it) return 0;
2369 evas_object_geometry_get(it->wd->pan_smart, NULL, &oy, NULL, &oh);
2370 evas_object_geometry_get(it->wd->VIEW(reorder_it), &rox, &roy, &row, &roh);
2372 if ((it->wd->reorder_start_y < it->block->y) &&
2373 (roy - oy + (roh / 2) >= it->block->y - it->wd->pan_y))
2375 it->block->reorder_offset = it->wd->reorder_it->h * -1;
2376 if (it->block->count == 1)
2377 it->wd->reorder_rel = it;
2379 else if ((it->wd->reorder_start_y >= it->block->y) &&
2380 (roy - oy + (roh / 2) <= it->block->y - it->wd->pan_y))
2382 it->block->reorder_offset = it->wd->reorder_it->h;
2385 it->block->reorder_offset = 0;
2387 it->scrl_y += it->block->reorder_offset;
2389 top = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
2390 rox, roy + (roh / 2), row, 1));
2393 it->wd->reorder_rel = it;
2394 it->scrl_y += it->wd->reorder_it->h;
2395 return it->wd->reorder_it->h;
2402 _reorder_move_animator_cb(void *data)
2404 Elm_Genlist_Item *it = data;
2405 Eina_Bool down = EINA_FALSE;
2407 int y, dy = it->h / 10 * _elm_config->scale, diff;
2409 t = ((0.0 > (t = ecore_loop_time_get()-it->wd->start_time)) ? 0.0 : t);
2411 if (t <= REORDER_EFFECT_TIME) y = (1 * sin((t / REORDER_EFFECT_TIME) * (M_PI / 2)) * dy);
2414 diff = abs(it->old_scrl_y - it->scrl_y);
2415 if (diff > it->h) y = diff / 2;
2416 if (it->old_scrl_y < it->scrl_y)
2418 it->old_scrl_y += y;
2421 else if (it->old_scrl_y > it->scrl_y)
2423 it->old_scrl_y -= y;
2428 _item_position(it, it->edit_obj, it->scrl_x, it->old_scrl_y);
2430 _item_position(it, VIEW(it), it->scrl_x, it->old_scrl_y);
2431 _group_items_recalc(it->wd);
2432 if ((it->wd->reorder_pan_move) ||
2433 (down && it->old_scrl_y >= it->scrl_y) ||
2434 (!down && it->old_scrl_y <= it->scrl_y))
2436 it->old_scrl_y = it->scrl_y;
2437 it->move_effect_enabled = EINA_FALSE;
2438 it->wd->reorder_move_animator = NULL;
2439 return ECORE_CALLBACK_CANCEL;
2441 return ECORE_CALLBACK_RENEW;
2445 _item_position(Elm_Genlist_Item *it,
2453 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2454 evas_object_resize(view, it->w, it->h);
2455 evas_object_move(view, it_x, it_y);
2456 evas_object_show(view);
2457 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2458 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2462 _item_block_position(Item_Block *itb,
2466 Elm_Genlist_Item *it;
2467 Elm_Genlist_Item *git;
2468 Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2469 Evas_Coord minh = 0;
2472 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2473 evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh);
2474 evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy,
2476 EINA_LIST_FOREACH(itb->items, l, it)
2478 if (it->delete_me) continue;
2479 else if (it->wd->reorder_it == it) continue;
2484 it->scrl_x = itb->x + it->x - it->wd->pan_x + ox;
2485 it->scrl_y = itb->y + it->y - it->wd->pan_y + oy;
2487 vis = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
2488 cvx, cvy, cvw, cvh));
2489 if (it->flags != ELM_GENLIST_ITEM_GROUP)
2491 if ((itb->realized))
2495 if (!it->realized) _item_realize(it, in, EINA_FALSE);
2502 if (it->wd->reorder_mode)
2503 y += _get_space_for_reorder_item(it);
2504 git = it->group_item;
2507 git->scrl_x = it->scrl_x;
2508 if (git->scrl_y < oy)
2510 if ((git->scrl_y + git->h) > (it->scrl_y + it->h))
2511 git->scrl_y = (it->scrl_y + it->h) - git->h;
2512 git->want_realize = EINA_TRUE;
2514 if ((it->wd->reorder_it) && (it->old_scrl_y != it->scrl_y))
2516 if (!it->move_effect_enabled)
2518 it->move_effect_enabled = EINA_TRUE;
2519 it->wd->reorder_move_animator =
2521 _reorder_move_animator_cb, it);
2524 if (!it->move_effect_enabled)
2525 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))
2527 if (it->wd->edit_mode && it->itc->edit_item_style)
2529 _item_position(it, it->edit_obj, it->scrl_x, it->scrl_y);
2533 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)))
2536 _item_position(it, it->mode_view, it->scrl_x,
2539 _item_position(it, VIEW(it), it->scrl_x,
2544 evas_object_resize(VIEW(it), it->w, it->h);
2545 evas_object_move(VIEW(it), it->scrl_x, it->scrl_y);
2546 evas_object_hide(VIEW(it));
2553 if (!it->dragging && (!it->wd->item_moving_effect_timer)) _item_unrealize(it, EINA_FALSE);
2560 if (vis) it->want_realize = EINA_TRUE;
2562 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))
2564 it->old_scrl_y = it->scrl_y;
2569 if (!itb->wd->reorder_it) itb->minh = minh;
2570 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2571 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2575 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2577 Elm_Genlist_Item *it = data;
2579 it->mincalcd = EINA_FALSE;
2580 it->block->changeme = EINA_TRUE;
2581 if (it->wd->changed_job) ecore_job_del(it->wd->changed_job);
2582 it->wd->changed_job = ecore_job_add(_changed_job, it->wd);
2586 _group_items_recalc(void *data)
2588 Widget_Data *wd = data;
2590 Elm_Genlist_Item *git;
2592 evas_event_freeze(evas_object_evas_get(wd->obj));
2593 EINA_LIST_FOREACH(wd->group_items, l, git)
2595 if (git->want_realize)
2598 _item_realize(git, 0, EINA_FALSE);
2599 evas_object_resize(VIEW(git), wd->minw, git->h);
2600 evas_object_move(VIEW(git), git->scrl_x, git->scrl_y);
2601 evas_object_show(VIEW(git));
2602 evas_object_raise(VIEW(git));
2604 else if (!git->want_realize && git->realized)
2607 _item_unrealize(git, EINA_FALSE);
2610 evas_event_thaw(evas_object_evas_get(wd->obj));
2611 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2615 _must_recalc_idler(void *data)
2617 Widget_Data *wd = data;
2618 if (wd->calc_job) ecore_job_del(wd->calc_job);
2619 wd->calc_job = ecore_job_add(_calc_job, wd);
2620 wd->must_recalc_idler = NULL;
2621 return ECORE_CALLBACK_CANCEL;
2625 _calc_job(void *data)
2627 Widget_Data *wd = data;
2628 Item_Block *itb, *chb = NULL;
2629 Evas_Coord minw = -1, minh = 0, y = 0, ow;
2632 Eina_Bool minw_change = EINA_FALSE;
2633 Eina_Bool did_must_recalc = EINA_FALSE;
2636 t0 = ecore_time_get();
2637 evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h);
2641 evas_event_freeze(evas_object_evas_get(wd->obj));
2642 EINA_INLIST_FOREACH(wd->blocks, itb)
2644 Eina_Bool showme = EINA_FALSE;
2647 showme = itb->showme;
2648 itb->showme = EINA_FALSE;
2651 if (itb->realized) _item_block_unrealize(itb);
2653 if ((itb->changed) || ((itb->must_recalc) && (!did_must_recalc)))
2655 if (itb->must_recalc)
2658 Elm_Genlist_Item *it;
2659 EINA_LIST_FOREACH(itb->items, l, it)
2660 if (it->mincalcd) it->mincalcd = EINA_FALSE;
2661 itb->changed = EINA_TRUE;
2662 if (itb->must_recalc) did_must_recalc = EINA_TRUE;
2663 if (itb->realized) _item_block_unrealize(itb);
2664 itb->must_recalc = EINA_FALSE;
2666 showme = _item_block_recalc(itb, in, EINA_FALSE);
2672 if (minw == -1) minw = itb->minw;
2673 else if ((!itb->must_recalc) && (minw < itb->minw))
2676 minw_change = EINA_TRUE;
2682 if ((showme) && (wd->show_item) && (!wd->show_item->queued))
2684 wd->show_item->showme = EINA_FALSE;
2686 elm_smart_scroller_region_bring_in(wd->scr,
2688 wd->show_item->block->x,
2690 wd->show_item->block->y,
2691 wd->show_item->block->w,
2694 elm_smart_scroller_child_region_show(wd->scr,
2696 wd->show_item->block->x,
2698 wd->show_item->block->y,
2699 wd->show_item->block->w,
2701 wd->show_item = NULL;
2706 EINA_INLIST_FOREACH(wd->blocks, itb)
2712 if ((chb) && (EINA_INLIST_GET(chb)->next))
2714 EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb)
2716 if (itb->realized) _item_block_unrealize(itb);
2719 wd->realminw = minw;
2720 if (minw < wd->w) minw = wd->w;
2721 if ((minw != wd->minw) || (minh != wd->minh))
2725 if (wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE)
2726 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
2727 _sizing_eval(wd->obj);
2729 if ((wd->anchor_item) && (wd->anchor_item->block) && (!wd->auto_scrolled))
2731 Elm_Genlist_Item *it;
2734 it = wd->anchor_item;
2735 it_y = wd->anchor_y;
2736 elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x,
2737 it->block->y + it->y + it_y);
2738 wd->anchor_item = it;
2739 wd->anchor_y = it_y;
2743 t = ecore_time_get();
2744 if (did_must_recalc)
2746 if (!wd->must_recalc_idler)
2747 wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd);
2749 wd->calc_job = NULL;
2750 evas_object_smart_changed(wd->pan_smart);
2751 evas_event_thaw(evas_object_evas_get(wd->obj));
2752 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2756 _update_job(void *data)
2758 Widget_Data *wd = data;
2762 Eina_Bool position = EINA_FALSE, recalc = EINA_FALSE;
2764 wd->update_job = NULL;
2767 evas_event_freeze(evas_object_evas_get(wd->obj));
2768 EINA_INLIST_FOREACH(wd->blocks, itb)
2770 Evas_Coord itminw, itminh;
2771 Elm_Genlist_Item *it;
2777 _item_block_position(itb, num);
2781 recalc = EINA_FALSE;
2782 EINA_LIST_FOREACH(itb->items, l2, it)
2791 _item_unrealize(it, EINA_FALSE);
2792 _item_realize(it, num, EINA_FALSE);
2793 position = EINA_TRUE;
2797 _item_realize(it, num, EINA_TRUE);
2798 _item_unrealize(it, EINA_TRUE);
2800 if ((it->minw != itminw) || (it->minh != itminh))
2802 it->updateme = EINA_FALSE;
2806 itb->updateme = EINA_FALSE;
2809 position = EINA_TRUE;
2810 itb->changed = EINA_TRUE;
2811 _item_block_recalc(itb, num0, EINA_FALSE);
2812 _item_block_position(itb, num0);
2817 if (wd->calc_job) ecore_job_del(wd->calc_job);
2818 wd->calc_job = ecore_job_add(_calc_job, wd);
2820 evas_event_thaw(evas_object_evas_get(wd->obj));
2821 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2825 _changed_job(void *data)
2827 Widget_Data *wd = data; Eina_List *l2;
2829 int num, num0, position = 0;
2830 Eina_Bool width_changed = EINA_FALSE, height_changed = EINA_FALSE;
2832 wd->changed_job = NULL;
2834 EINA_INLIST_FOREACH(wd->blocks, itb)
2836 Evas_Coord itminw, itminh;
2837 Elm_Genlist_Item *it;
2843 _item_block_position(itb, num);
2847 width_changed = height_changed = EINA_FALSE;
2848 EINA_LIST_FOREACH(itb->items, l2, it)
2850 if ((!it->mincalcd) && (it->realized))
2852 Evas_Coord mw = -1, mh = -1;
2856 if (it->wd->height_for_width) mw = it->wd->w;
2857 if (!it->display_only)
2858 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2859 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
2860 edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw, mh);
2861 if (!it->display_only)
2862 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2863 it->w = it->minw = mw;
2864 it->h = it->minh = mh;
2865 it->mincalcd = EINA_TRUE;
2867 //if ((it->minw != itminw) || (it->minh != itminh))
2868 //if ((it->minh != itminh))
2870 if ((it->minw != itminw))
2871 width_changed = EINA_TRUE;
2872 if ((it->minh != itminh))
2873 height_changed = EINA_TRUE;
2875 if ((!it->wd->group_item_width) && (it->flags == ELM_GENLIST_ITEM_GROUP))
2877 it->wd->group_item_width = mw;
2878 it->wd->group_item_height = mh;
2880 else if ((!it->wd->item_width) && (it->flags == ELM_GENLIST_ITEM_NONE))
2882 it->wd->item_width = mw;
2883 it->wd->item_height = mh;
2888 itb->changeme = EINA_FALSE;
2889 // TODO: why this is separated.
2893 itb->changed = EINA_TRUE;
2894 _item_block_recalc(itb, num0, 0);
2895 _item_block_position(itb, num0);
2897 else if (width_changed)
2899 _item_block_position(itb, num0);
2904 if (wd->calc_job) ecore_job_del(wd->calc_job);
2905 wd->calc_job = ecore_job_add(_calc_job, wd);
2910 _pan_set(Evas_Object *obj,
2914 Pan *sd = evas_object_smart_data_get(obj);
2920 // Evas_Coord ow, oh;
2921 // evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2922 // ow = sd->wd->minw - ow;
2923 // if (ow < 0) ow = 0;
2924 // oh = sd->wd->minh - oh;
2925 // if (oh < 0) oh = 0;
2926 // if (x < 0) x = 0;
2927 // if (y < 0) y = 0;
2928 // if (x > ow) x = ow;
2929 // if (y > oh) y = oh;
2930 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
2935 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2937 if ((itb->y + itb->h) > y)
2939 Elm_Genlist_Item *it;
2942 EINA_LIST_FOREACH(itb->items, l2, it)
2944 if ((itb->y + it->y) >= y)
2946 sd->wd->anchor_item = it;
2947 sd->wd->anchor_y = -(itb->y + it->y - y);
2955 if (!sd->wd->reorder_move_animator) evas_object_smart_changed(obj);
2959 _pan_get(Evas_Object *obj,
2963 Pan *sd = evas_object_smart_data_get(obj);
2966 if (x) *x = sd->wd->pan_x;
2967 if (y) *y = sd->wd->pan_y;
2971 _pan_max_get(Evas_Object *obj,
2975 Pan *sd = evas_object_smart_data_get(obj);
2979 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2980 ow = sd->wd->minw - ow;
2982 oh = sd->wd->minh - oh;
2989 _pan_min_get(Evas_Object *obj __UNUSED__,
2998 _pan_child_size_get(Evas_Object *obj,
3002 Pan *sd = evas_object_smart_data_get(obj);
3005 if (w) *w = sd->wd->minw;
3006 if (h) *h = sd->wd->minh;
3010 _pan_add(Evas_Object *obj)
3013 Evas_Object_Smart_Clipped_Data *cd;
3016 cd = evas_object_smart_data_get(obj);
3019 sd->__clipped_data = *cd;
3021 evas_object_smart_data_set(obj, sd);
3025 _pan_del(Evas_Object *obj)
3027 Pan *sd = evas_object_smart_data_get(obj);
3032 ecore_job_del(sd->resize_job);
3033 sd->resize_job = NULL;
3039 _pan_resize_job(void *data)
3043 _sizing_eval(sd->wd->obj);
3044 sd->resize_job = NULL;
3048 _pan_resize(Evas_Object *obj,
3052 Pan *sd = evas_object_smart_data_get(obj);
3056 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
3057 if ((ow == w) && (oh == h)) return;
3058 if ((sd->wd->height_for_width) && (ow != w))
3060 sd->wd->pan_resize = EINA_TRUE;
3061 if (sd->resize_job) ecore_job_del(sd->resize_job);
3062 sd->resize_job = ecore_job_add(_pan_resize_job, sd);
3064 sd->wd->pan_changed = EINA_TRUE;
3065 evas_object_smart_changed(obj);
3066 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
3067 sd->wd->calc_job = NULL;
3071 _pan_calculate(Evas_Object *obj)
3073 Pan *sd = evas_object_smart_data_get(obj);
3075 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
3077 Elm_Genlist_Item *git;
3081 evas_event_freeze(evas_object_evas_get(obj));
3083 if (sd->wd->pan_changed)
3086 sd->wd->pan_changed = EINA_FALSE;
3089 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
3090 sd->wd->prev_viewport_w = ow;
3091 evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
3092 EINA_LIST_FOREACH(sd->wd->group_items, l, git)
3094 git->want_realize = EINA_FALSE;
3096 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
3098 itb->w = sd->wd->minw;
3099 if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox,
3100 itb->y - sd->wd->pan_y + oy,
3102 cvx, cvy, cvw, cvh))
3104 if ((!itb->realized) || (itb->changed))
3105 _item_block_realize(itb);
3106 _item_block_position(itb, in);
3110 if (itb->realized) _item_block_unrealize(itb);
3114 if ((!sd->wd->reorder_it) || (sd->wd->reorder_pan_move))
3115 _group_items_recalc(sd->wd);
3117 if ((sd->wd->reorder_mode) && (sd->wd->reorder_it))
3119 if (sd->wd->pan_y != sd->wd->old_pan_y)
3120 sd->wd->reorder_pan_move = EINA_TRUE;
3121 else sd->wd->reorder_pan_move = EINA_FALSE;
3122 evas_object_raise(sd->wd->reorder_it->edit_obj);
3123 sd->wd->old_pan_y = sd->wd->pan_y;
3124 sd->wd->start_time = ecore_loop_time_get();
3127 if (sd->wd->effect_mode &&
3128 ((sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND) ||
3129 (sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT) ||
3130 (sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE)))
3132 if (!sd->wd->item_moving_effect_timer)
3134 if (sd->wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE)
3135 _item_flip_effect_show(sd->wd->expand_item);
3137 evas_object_raise(sd->wd->alpha_bg);
3138 evas_object_show(sd->wd->alpha_bg);
3139 elm_smart_scroller_bounce_animator_disabled_set(sd->wd->scr, EINA_TRUE);
3140 sd->wd->start_time = current_time_get();
3141 sd->wd->item_moving_effect_timer = ecore_animator_add(_item_moving_effect_timer_cb, sd->wd);
3144 else _item_auto_scroll(sd->wd);
3145 sd->wd->pan_resize = EINA_FALSE;
3146 evas_event_thaw(evas_object_evas_get(obj));
3147 evas_event_thaw_eval(evas_object_evas_get(obj));
3151 _pan_move(Evas_Object *obj,
3152 Evas_Coord x __UNUSED__,
3153 Evas_Coord y __UNUSED__)
3155 Pan *sd = evas_object_smart_data_get(obj);
3159 sd->wd->pan_changed = EINA_TRUE;
3160 evas_object_smart_changed(obj);
3161 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
3162 sd->wd->calc_job = NULL;
3166 _hold_on(void *data __UNUSED__,
3168 void *event_info __UNUSED__)
3170 Widget_Data *wd = elm_widget_data_get(obj);
3172 elm_smart_scroller_hold_set(wd->scr, 1);
3176 _hold_off(void *data __UNUSED__,
3178 void *event_info __UNUSED__)
3180 Widget_Data *wd = elm_widget_data_get(obj);
3182 elm_smart_scroller_hold_set(wd->scr, 0);
3186 _freeze_on(void *data __UNUSED__,
3188 void *event_info __UNUSED__)
3190 Widget_Data *wd = elm_widget_data_get(obj);
3192 elm_smart_scroller_freeze_set(wd->scr, 1);
3196 _freeze_off(void *data __UNUSED__,
3198 void *event_info __UNUSED__)
3200 Widget_Data *wd = elm_widget_data_get(obj);
3202 elm_smart_scroller_freeze_set(wd->scr, 0);
3206 _scr_anim_start(void *data,
3207 Evas_Object *obj __UNUSED__,
3208 void *event_info __UNUSED__)
3210 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL);
3214 _scr_anim_stop(void *data,
3215 Evas_Object *obj __UNUSED__,
3216 void *event_info __UNUSED__)
3218 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL);
3222 _scr_drag_start(void *data,
3223 Evas_Object *obj __UNUSED__,
3224 void *event_info __UNUSED__)
3226 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
3230 _scr_drag_stop(void *data,
3231 Evas_Object *obj __UNUSED__,
3232 void *event_info __UNUSED__)
3234 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
3238 _scroll_edge_left(void *data,
3239 Evas_Object *scr __UNUSED__,
3240 void *event_info __UNUSED__)
3242 Evas_Object *obj = data;
3243 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_LEFT, NULL);
3247 _scroll_edge_right(void *data,
3248 Evas_Object *scr __UNUSED__,
3249 void *event_info __UNUSED__)
3251 Evas_Object *obj = data;
3252 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_RIGHT, NULL);
3256 _scroll_edge_top(void *data,
3257 Evas_Object *scr __UNUSED__,
3258 void *event_info __UNUSED__)
3260 Evas_Object *obj = data;
3261 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_TOP, NULL);
3265 _scroll_edge_bottom(void *data,
3266 Evas_Object *scr __UNUSED__,
3267 void *event_info __UNUSED__)
3269 Evas_Object *obj = data;
3270 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_BOTTOM, NULL);
3274 _mode_item_realize(Elm_Genlist_Item *it)
3278 if ((it->mode_view) || (it->delete_me)) return;
3280 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3281 it->mode_view = edje_object_add(evas_object_evas_get(WIDGET(it)));
3282 edje_object_scale_set(it->mode_view,
3283 elm_widget_scale_get(WIDGET(it)) *
3284 _elm_config->scale);
3285 evas_object_smart_member_add(it->mode_view, it->wd->pan_smart);
3286 elm_widget_sub_object_add(WIDGET(it), it->mode_view);
3288 strncpy(buf, "item", sizeof(buf));
3289 if (it->wd->compress)
3290 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
3292 if (it->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
3293 strncat(buf, "/", sizeof(buf) - strlen(buf));
3294 strncat(buf, it->itc->mode_item_style, sizeof(buf) - strlen(buf));
3296 _elm_theme_object_set(WIDGET(it), it->mode_view, "genlist", buf,
3297 elm_widget_style_get(WIDGET(it)));
3298 edje_object_mirrored_set(it->mode_view,
3299 elm_widget_mirrored_get(WIDGET(it)));
3301 /* signal callback add */
3302 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_DOWN,
3304 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_UP,
3306 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_MOVE,
3309 /* label_get, icon_get, state_get */
3310 _item_label_realize(it, it->mode_view, &it->mode_labels, NULL);
3311 if (it->itc->func.icon_get)
3317 elm_widget_stringlist_get(edje_object_data_get(it->mode_view,
3319 EINA_LIST_FOREACH(it->mode_icons, l, key)
3321 Evas_Object *ic = it->itc->func.icon_get
3322 ((void *)it->base.data, WIDGET(it), l->data);
3326 it->mode_icon_objs = eina_list_append(it->mode_icon_objs, ic);
3327 edje_object_part_swallow(it->mode_view, key, ic);
3328 evas_object_show(ic);
3329 elm_widget_sub_object_add(WIDGET(it), ic);
3331 elm_widget_disabled_set(ic, EINA_TRUE);
3335 _item_state_realize(it, it->mode_view, &it->mode_states, NULL);
3336 edje_object_part_swallow(it->mode_view,
3337 edje_object_data_get(it->mode_view, "mode_part"),
3340 it->want_unrealize = EINA_FALSE;
3341 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3342 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3346 _mode_item_unrealize(Elm_Genlist_Item *it)
3348 Widget_Data *wd = it->wd;
3350 if (!it->mode_view) return;
3352 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3353 elm_widget_stringlist_free(it->mode_labels);
3354 it->mode_labels = NULL;
3355 elm_widget_stringlist_free(it->mode_icons);
3356 it->mode_icons = NULL;
3357 elm_widget_stringlist_free(it->mode_states);
3359 EINA_LIST_FREE(it->mode_icon_objs, icon)
3360 evas_object_del(icon);
3362 edje_object_part_unswallow(it->mode_view, VIEW(it));
3363 evas_object_smart_member_add(VIEW(it), wd->pan_smart);
3364 evas_object_del(it->mode_view);
3365 it->mode_view = NULL;
3367 if (wd->mode_item == it)
3368 wd->mode_item = NULL;
3369 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3370 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3374 _item_mode_set(Elm_Genlist_Item *it)
3377 Widget_Data *wd = it->wd;
3382 it->nocache = EINA_TRUE;
3384 if (wd->scr_hold_timer)
3386 ecore_timer_del(wd->scr_hold_timer);
3387 wd->scr_hold_timer = NULL;
3389 elm_smart_scroller_hold_set(wd->scr, EINA_TRUE);
3390 wd->scr_hold_timer = ecore_timer_add(0.1, _scr_hold_timer_cb, wd);
3392 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3393 _mode_item_realize(it);
3395 evas_object_raise(it->VIEW(group_item));
3396 _item_position(it, it->mode_view, it->scrl_x, it->scrl_y);
3397 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3398 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3400 snprintf(buf, sizeof(buf), "elm,state,%s,active", wd->mode_type);
3401 edje_object_signal_emit(it->mode_view, buf, "elm");
3405 _item_mode_unset(Widget_Data *wd)
3408 if (!wd->mode_item) return;
3409 char buf[1024], buf2[1024];
3410 Elm_Genlist_Item *it;
3413 it->nocache = EINA_TRUE;
3415 snprintf(buf, sizeof(buf), "elm,state,%s,passive", wd->mode_type);
3416 snprintf(buf2, sizeof(buf2), "elm,state,%s,passive,finished", wd->mode_type);
3418 edje_object_signal_emit(it->mode_view, buf, "elm");
3419 edje_object_signal_callback_add(it->mode_view, buf2, "elm", _mode_finished_signal_cb, it);
3421 wd->mode_item = NULL;
3426 _item_auto_scroll(void *data)
3428 Widget_Data *wd = data;
3431 if ((wd->expand_item) && (!wd->auto_scrolled))
3433 Elm_Genlist_Item *it;
3435 Evas_Coord ox, oy, ow, oh;
3436 evas_object_geometry_get(wd->obj, &ox, &oy, &ow, &oh);
3438 wd->auto_scrolled = EINA_TRUE;
3439 if (wd->expand_item->scrl_y > (oh + oy) / 2)
3441 EINA_LIST_FOREACH(wd->expand_item->items, l, it)
3443 elm_genlist_item_bring_in(it);
3449 elm_genlist_add(Evas_Object *parent)
3454 Evas_Coord minw, minh;
3455 static Evas_Smart *smart = NULL;
3459 static Evas_Smart_Class sc;
3461 evas_object_smart_clipped_smart_set(&_pan_sc);
3463 sc.name = "elm_genlist_pan";
3464 sc.version = EVAS_SMART_CLASS_VERSION;
3467 sc.resize = _pan_resize;
3468 sc.move = _pan_move;
3469 sc.calculate = _pan_calculate;
3470 if (!(smart = evas_smart_class_new(&sc))) return NULL;
3473 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
3475 ELM_SET_WIDTYPE(widtype, "genlist");
3476 elm_widget_type_set(obj, "genlist");
3477 elm_widget_sub_object_add(parent, obj);
3478 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
3479 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
3480 elm_widget_data_set(obj, wd);
3481 elm_widget_del_hook_set(obj, _del_hook);
3482 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
3483 elm_widget_theme_hook_set(obj, _theme_hook);
3484 elm_widget_can_focus_set(obj, EINA_TRUE);
3485 elm_widget_event_hook_set(obj, _event_hook);
3486 elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
3487 elm_widget_translate_hook_set(obj, _translate_hook);
3489 wd->scr = elm_smart_scroller_add(e);
3490 evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_MOUSE_DOWN,
3491 _mouse_down_scroller, obj);
3492 evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_MOUSE_UP,
3493 _mouse_up_scroller, obj);
3494 evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_MOUSE_MOVE,
3495 _mouse_move_scroller, obj);
3496 elm_smart_scroller_widget_set(wd->scr, obj);
3497 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
3498 elm_widget_style_get(obj));
3499 elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE,
3500 _elm_config->thumbscroll_bounce_enable);
3501 elm_widget_resize_object_set(obj, wd->scr);
3503 evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj);
3504 evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, obj);
3505 evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj);
3506 evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj);
3507 evas_object_smart_callback_add(wd->scr, "edge,left", _scroll_edge_left, obj);
3508 evas_object_smart_callback_add(wd->scr, "edge,right", _scroll_edge_right,
3510 evas_object_smart_callback_add(wd->scr, "edge,top", _scroll_edge_top, obj);
3511 evas_object_smart_callback_add(wd->scr, "edge,bottom", _scroll_edge_bottom,
3515 wd->mode = ELM_LIST_SCROLL;
3516 wd->max_items_per_block = MAX_ITEMS_PER_BLOCK;
3517 wd->item_cache_max = wd->max_items_per_block * 2;
3518 wd->longpress_timeout = _elm_config->longpress_timeout;
3519 wd->effect_mode = _elm_config->effect_enable;
3521 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
3522 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
3523 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
3524 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
3526 wd->pan_smart = evas_object_smart_add(e, smart);
3527 wd->pan = evas_object_smart_data_get(wd->pan_smart);
3530 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
3531 _pan_set, _pan_get, _pan_max_get,
3532 _pan_min_get, _pan_child_size_get);
3534 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
3536 evas_object_size_hint_min_set(obj, minw, minh);
3538 evas_object_smart_callbacks_descriptions_set(obj, _signals);
3539 _mirrored_set(obj, elm_widget_mirrored_get(obj));
3544 static Elm_Genlist_Item *
3545 _item_new(Widget_Data *wd,
3546 const Elm_Genlist_Item_Class *itc,
3548 Elm_Genlist_Item *parent,
3549 Elm_Genlist_Item_Flags flags,
3551 const void *func_data)
3553 Elm_Genlist_Item *it;
3555 it = elm_widget_item_new(wd->obj, Elm_Genlist_Item);
3556 if (!it) return NULL;
3559 it->base.data = data;
3560 it->parent = parent;
3562 it->func.func = func;
3563 it->func.data = func_data;
3564 it->mouse_cursor = NULL;
3565 it->expanded_depth = 0;
3566 elm_widget_item_text_get_hook_set(it, _item_label_hook);
3567 elm_widget_item_del_cb_set(it, _item_del_hook);
3571 if (it->parent->flags & ELM_GENLIST_ITEM_GROUP)
3572 it->group_item = parent;
3573 else if (it->parent->group_item)
3574 it->group_item = it->parent->group_item;
3580 _item_block_add(Widget_Data *wd,
3581 Elm_Genlist_Item *it)
3583 Item_Block *itb = NULL;
3590 itb = calloc(1, sizeof(Item_Block));
3593 if (!it->rel->block)
3596 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3597 itb->items = eina_list_append(itb->items, it);
3603 wd->blocks = eina_inlist_prepend_relative
3604 (wd->blocks, EINA_INLIST_GET(itb),
3605 EINA_INLIST_GET(it->rel->block));
3607 eina_list_prepend_relative(itb->items, it, it->rel);
3611 wd->blocks = eina_inlist_append_relative
3612 (wd->blocks, EINA_INLIST_GET(itb),
3613 EINA_INLIST_GET(it->rel->block));
3615 eina_list_append_relative(itb->items, it, it->rel);
3625 itb = (Item_Block *)(wd->blocks);
3626 if (itb->count >= wd->max_items_per_block)
3628 itb = calloc(1, sizeof(Item_Block));
3632 eina_inlist_prepend(wd->blocks,
3633 EINA_INLIST_GET(itb));
3638 itb = calloc(1, sizeof(Item_Block));
3642 eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
3644 itb->items = eina_list_prepend(itb->items, it);
3650 itb = (Item_Block *)(wd->blocks->last);
3651 if (itb->count >= wd->max_items_per_block)
3653 itb = calloc(1, sizeof(Item_Block));
3657 eina_inlist_append(wd->blocks,
3658 EINA_INLIST_GET(itb));
3663 itb = calloc(1, sizeof(Item_Block));
3667 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3669 itb->items = eina_list_append(itb->items, it);
3675 itb = it->rel->block;
3676 if (!itb) goto newblock;
3678 itb->items = eina_list_prepend_relative(itb->items, it, it->rel);
3680 itb->items = eina_list_append_relative(itb->items, it, it->rel);
3683 itb->changed = EINA_TRUE;
3685 if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job);
3686 itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd);
3689 it->rel->relcount--;
3690 if ((it->rel->delete_me) && (!it->rel->relcount))
3694 if (itb->count > itb->wd->max_items_per_block)
3698 Elm_Genlist_Item *it2;
3700 newc = itb->count / 2;
3701 itb2 = calloc(1, sizeof(Item_Block));
3705 eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
3706 EINA_INLIST_GET(itb));
3707 itb2->changed = EINA_TRUE;
3708 while ((itb->count > newc) && (itb->items))
3712 l = eina_list_last(itb->items);
3714 itb->items = eina_list_remove_list(itb->items, l);
3717 itb2->items = eina_list_prepend(itb2->items, it2);
3725 _queue_process(Widget_Data *wd)
3728 Eina_Bool showme = EINA_FALSE;
3731 t0 = ecore_time_get();
3732 //evas_event_freeze(evas_object_evas_get(wd->obj));
3733 for (n = 0; (wd->queue) && (n < 128); n++)
3735 Elm_Genlist_Item *it;
3737 it = wd->queue->data;
3738 wd->queue = eina_list_remove_list(wd->queue, wd->queue);
3739 it->queued = EINA_FALSE;
3740 _item_block_add(wd, it);
3741 t = ecore_time_get();
3742 if (it->block->changed)
3744 showme = _item_block_recalc(it->block, it->block->num, EINA_TRUE);
3745 it->block->changed = 0;
3748 if (wd->calc_job) ecore_job_del(wd->calc_job);
3749 wd->calc_job = NULL;
3751 wd->pan_changed = EINA_FALSE;
3754 if (showme) it->block->showme = EINA_TRUE;
3755 if (eina_inlist_count(wd->blocks) > 1)
3757 if ((t - t0) > (ecore_animator_frametime_get())) break;
3760 //evas_event_thaw(evas_object_evas_get(wd->obj));
3761 //evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3766 _idle_process(void *data, Eina_Bool *wakeup)
3768 Widget_Data *wd = data;
3771 //static double q_start = 0.0;
3772 //if (q_start == 0.0) q_start = ecore_time_get();
3774 if (_queue_process(wd) > 0) *wakeup = EINA_TRUE;
3778 //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start);
3780 return ECORE_CALLBACK_CANCEL;
3782 return ECORE_CALLBACK_RENEW;
3786 _item_idle_enterer(void *data)
3788 Widget_Data *wd = data;
3789 Eina_Bool wakeup = EINA_FALSE;
3790 Eina_Bool ok = _idle_process(data, &wakeup);
3795 if (wd->calc_job) ecore_job_del(wd->calc_job);
3796 wd->calc_job = ecore_job_add(_calc_job, wd);
3798 if (ok == ECORE_CALLBACK_CANCEL) wd->queue_idle_enterer = NULL;
3803 _item_queue(Widget_Data *wd,
3804 Elm_Genlist_Item *it)
3806 if (it->queued) return;
3807 it->queued = EINA_TRUE;
3808 wd->queue = eina_list_append(wd->queue, it);
3809 // FIXME: why does a freeze then thaw here cause some genlist
3810 // elm_genlist_item_append() to be much much slower?
3811 // evas_event_freeze(evas_object_evas_get(wd->obj));
3812 while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
3814 if (wd->queue_idle_enterer)
3816 ecore_idle_enterer_del(wd->queue_idle_enterer);
3817 wd->queue_idle_enterer = NULL;
3821 // evas_event_thaw(evas_object_evas_get(wd->obj));
3822 // evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3823 if (!wd->queue_idle_enterer)
3824 wd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, wd);
3828 _item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after)
3833 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3834 it->wd->reorder_deleted = EINA_TRUE;
3835 _item_block_del(it);
3837 it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
3839 it->rel->relcount++;
3840 it->before = EINA_FALSE;
3841 if (after->group_item) it->group_item = after->group_item;
3842 _item_queue(it->wd, it);
3844 // TODO: change this to smart callback
3845 if (it->itc->func.moved)
3846 it->itc->func.moved(WIDGET(it), it, after, EINA_TRUE);
3850 _item_move_before(Elm_Genlist_Item *it, Elm_Genlist_Item *before)
3853 if (!before) return;
3855 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3856 it->wd->reorder_deleted = EINA_TRUE;
3857 _item_block_del(it);
3858 it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
3860 it->rel->relcount++;
3861 it->before = EINA_TRUE;
3862 if (before->group_item) it->group_item = before->group_item;
3863 _item_queue(it->wd, it);
3865 // TODO: change this to smart callback
3866 if (it->itc->func.moved)
3867 it->itc->func.moved(WIDGET(it), it, before, EINA_FALSE);
3870 EAPI Elm_Genlist_Item *
3871 elm_genlist_item_append(Evas_Object *obj,
3872 const Elm_Genlist_Item_Class *itc,
3874 Elm_Genlist_Item *parent,
3875 Elm_Genlist_Item_Flags flags,
3877 const void *func_data)
3879 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3880 Widget_Data *wd = elm_widget_data_get(obj);
3881 if (!wd) return NULL;
3882 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3884 if (!it) return NULL;
3887 if (flags & ELM_GENLIST_ITEM_GROUP)
3888 wd->group_items = eina_list_append(wd->group_items, it);
3889 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
3894 Elm_Genlist_Item *it2 = NULL;
3895 Eina_List *ll = eina_list_last(it->parent->items);
3896 if (ll) it2 = ll->data;
3897 it->parent->items = eina_list_append(it->parent->items, it);
3898 if (!it2) it2 = it->parent;
3900 it2 = elm_genlist_item_prev_get(it2);
3902 eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3903 EINA_INLIST_GET(it2));
3905 it->rel->relcount++;
3907 it->before = EINA_FALSE;
3908 _item_queue(wd, it);
3912 EAPI Elm_Genlist_Item *
3913 elm_genlist_item_prepend(Evas_Object *obj,
3914 const Elm_Genlist_Item_Class *itc,
3916 Elm_Genlist_Item *parent,
3917 Elm_Genlist_Item_Flags flags,
3919 const void *func_data)
3921 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3922 Widget_Data *wd = elm_widget_data_get(obj);
3923 if (!wd) return NULL;
3924 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3927 if (!it) return NULL;
3930 if (flags & ELM_GENLIST_ITEM_GROUP)
3931 wd->group_items = eina_list_prepend(wd->group_items, it);
3932 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
3937 Elm_Genlist_Item *it2 = NULL;
3938 Eina_List *ll = it->parent->items;
3939 if (ll) it2 = ll->data;
3940 it->parent->items = eina_list_prepend(it->parent->items, it);
3941 if (!it2) it2 = it->parent;
3943 it2 = elm_genlist_item_next_get(it2);
3945 eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3946 EINA_INLIST_GET(it2));
3948 it->rel->relcount++;
3950 it->before = EINA_TRUE;
3951 _item_queue(wd, it);
3955 EAPI Elm_Genlist_Item *
3956 elm_genlist_item_insert_after(Evas_Object *obj,
3957 const Elm_Genlist_Item_Class *itc,
3959 Elm_Genlist_Item *parent,
3960 Elm_Genlist_Item *after,
3961 Elm_Genlist_Item_Flags flags,
3963 const void *func_data)
3965 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3966 EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
3967 Widget_Data *wd = elm_widget_data_get(obj);
3968 if (!wd) return NULL;
3969 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3970 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3972 if (!it) return NULL;
3976 if ((flags & ELM_GENLIST_ITEM_GROUP) &&
3977 (after->flags & ELM_GENLIST_ITEM_GROUP))
3978 wd->group_items = eina_list_append_relative(wd->group_items, it,
3983 it->parent->items = eina_list_append_relative(it->parent->items, it,
3986 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3987 EINA_INLIST_GET(after));
3989 it->rel->relcount++;
3990 it->before = EINA_FALSE;
3991 _item_queue(wd, it);
3995 EAPI Elm_Genlist_Item *
3996 elm_genlist_item_insert_before(Evas_Object *obj,
3997 const Elm_Genlist_Item_Class *itc,
3999 Elm_Genlist_Item *parent,
4000 Elm_Genlist_Item *before,
4001 Elm_Genlist_Item_Flags flags,
4003 const void *func_data)
4005 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4006 EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
4007 Widget_Data *wd = elm_widget_data_get(obj);
4008 if (!wd) return NULL;
4009 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
4010 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
4012 if (!it) return NULL;
4016 if ((flags & ELM_GENLIST_ITEM_GROUP) &&
4017 (before->flags & ELM_GENLIST_ITEM_GROUP))
4018 wd->group_items = eina_list_prepend_relative(wd->group_items, it,
4023 it->parent->items = eina_list_prepend_relative(it->parent->items, it,
4026 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
4027 EINA_INLIST_GET(before));
4029 it->rel->relcount++;
4030 it->before = EINA_TRUE;
4031 _item_queue(wd, it);
4036 elm_genlist_clear(Evas_Object *obj)
4038 ELM_CHECK_WIDTYPE(obj, widtype);
4039 Widget_Data *wd = elm_widget_data_get(obj);
4041 if (wd->walking > 0)
4043 Elm_Genlist_Item *it;
4045 wd->clear_me = EINA_TRUE;
4046 EINA_INLIST_FOREACH(wd->items, it)
4048 it->delete_me = EINA_TRUE;
4052 evas_event_freeze(evas_object_evas_get(wd->obj));
4055 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
4056 it->nocache = EINA_TRUE;
4057 it->highlighted = EINA_FALSE;
4059 if (wd->anchor_item == it)
4061 wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
4062 if (!wd->anchor_item)
4064 ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
4067 wd->items = eina_inlist_remove(wd->items, wd->items);
4068 if (it->flags & ELM_GENLIST_ITEM_GROUP)
4069 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
4070 elm_widget_item_pre_notify_del(it);
4071 if (it->realized) _item_unrealize(it, EINA_FALSE);
4072 if (((wd->clear_me) || (!it->delete_me)) && (it->itc->func.del))
4073 it->itc->func.del((void *)it->base.data, WIDGET(it));
4074 if (it->long_timer) ecore_timer_del(it->long_timer);
4075 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
4076 elm_widget_item_del(it);
4078 wd->clear_me = EINA_FALSE;
4079 wd->anchor_item = NULL;
4082 Item_Block *itb = (Item_Block *)(wd->blocks);
4084 wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
4085 if (itb->items) eina_list_free(itb->items);
4088 wd->pan_changed = EINA_TRUE;
4091 ecore_job_del(wd->calc_job);
4092 wd->calc_job = NULL;
4094 if (wd->queue_idle_enterer)
4096 ecore_idle_enterer_del(wd->queue_idle_enterer);
4097 wd->queue_idle_enterer = NULL;
4099 if (wd->must_recalc_idler)
4101 ecore_idler_del(wd->must_recalc_idler);
4102 wd->must_recalc_idler = NULL;
4106 eina_list_free(wd->queue);
4111 eina_list_free(wd->selected);
4112 wd->selected = NULL;
4114 if (wd->reorder_move_animator)
4116 ecore_animator_del(wd->reorder_move_animator);
4117 wd->reorder_move_animator = NULL;
4119 wd->show_item = NULL;
4127 evas_object_del(wd->alpha_bg);
4128 wd->alpha_bg = NULL;
4132 evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
4133 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
4136 elm_smart_scroller_child_region_show(wd->scr, 0, 0, 0, 0);
4137 evas_event_thaw(evas_object_evas_get(wd->obj));
4138 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
4142 elm_genlist_multi_select_set(Evas_Object *obj,
4145 ELM_CHECK_WIDTYPE(obj, widtype);
4146 Widget_Data *wd = elm_widget_data_get(obj);
4152 elm_genlist_multi_select_get(const Evas_Object *obj)
4154 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4155 Widget_Data *wd = elm_widget_data_get(obj);
4156 if (!wd) return EINA_FALSE;
4160 EAPI Elm_Genlist_Item *
4161 elm_genlist_selected_item_get(const Evas_Object *obj)
4163 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4164 Widget_Data *wd = elm_widget_data_get(obj);
4165 if (!wd) return NULL;
4166 if (wd->selected) return wd->selected->data;
4170 EAPI const Eina_List *
4171 elm_genlist_selected_items_get(const Evas_Object *obj)
4173 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4174 Widget_Data *wd = elm_widget_data_get(obj);
4175 if (!wd) return NULL;
4176 return wd->selected;
4180 elm_genlist_realized_items_get(const Evas_Object *obj)
4182 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4183 Widget_Data *wd = elm_widget_data_get(obj);
4184 Eina_List *list = NULL;
4186 Eina_Bool done = EINA_FALSE;
4187 if (!wd) return NULL;
4188 EINA_INLIST_FOREACH(wd->blocks, itb)
4193 Elm_Genlist_Item *it;
4196 EINA_LIST_FOREACH(itb->items, l, it)
4198 if (it->realized) list = eina_list_append(list, it);
4209 EAPI Elm_Genlist_Item *
4210 elm_genlist_at_xy_item_get(const Evas_Object *obj,
4215 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4216 Widget_Data *wd = elm_widget_data_get(obj);
4217 Evas_Coord ox, oy, ow, oh;
4220 if (!wd) return NULL;
4221 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
4223 EINA_INLIST_FOREACH(wd->blocks, itb)
4226 Elm_Genlist_Item *it;
4228 if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
4229 oy + itb->y - itb->wd->pan_y,
4230 itb->w, itb->h, x, y, 1, 1))
4232 EINA_LIST_FOREACH(itb->items, l, it)
4234 Evas_Coord itx, ity;
4236 itx = ox + itb->x + it->x - itb->wd->pan_x;
4237 ity = oy + itb->y + it->y - itb->wd->pan_y;
4238 if (ELM_RECTS_INTERSECT(itx, ity, it->w, it->h, x, y, 1, 1))
4242 if (y <= (ity + (it->h / 4))) *posret = -1;
4243 else if (y >= (ity + it->h - (it->h / 4)))
4249 lasty = ity + it->h;
4254 if (y > lasty) *posret = 1;
4260 EAPI Elm_Genlist_Item *
4261 elm_genlist_first_item_get(const Evas_Object *obj)
4263 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4264 Widget_Data *wd = elm_widget_data_get(obj);
4265 if (!wd) return NULL;
4266 if (!wd->items) return NULL;
4267 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
4268 while ((it) && (it->delete_me))
4269 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
4273 EAPI Elm_Genlist_Item *
4274 elm_genlist_last_item_get(const Evas_Object *obj)
4276 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4277 Widget_Data *wd = elm_widget_data_get(obj);
4278 if (!wd) return NULL;
4279 if (!wd->items) return NULL;
4280 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
4281 while ((it) && (it->delete_me))
4282 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
4286 EAPI Elm_Genlist_Item *
4287 elm_genlist_item_next_get(const Elm_Genlist_Item *it)
4289 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4292 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
4293 if ((it) && (!it->delete_me)) break;
4295 return (Elm_Genlist_Item *)it;
4298 EAPI Elm_Genlist_Item *
4299 elm_genlist_item_prev_get(const Elm_Genlist_Item *it)
4301 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4304 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
4305 if ((it) && (!it->delete_me)) break;
4307 return (Elm_Genlist_Item *)it;
4311 elm_genlist_item_genlist_get(const Elm_Genlist_Item *it)
4313 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4317 EAPI Elm_Genlist_Item *
4318 elm_genlist_item_parent_get(const Elm_Genlist_Item *it)
4320 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4325 elm_genlist_item_subitems_clear(Elm_Genlist_Item *it)
4327 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4328 Widget_Data *wd = elm_widget_data_get(WIDGET(it));
4330 Elm_Genlist_Item *it2;
4333 if (!it->wd->effect_mode || !it->wd->move_effect_mode)
4334 _item_subitems_clear(it);
4337 if ((!it->wd->item_moving_effect_timer) && (it->flags != ELM_GENLIST_ITEM_GROUP) &&
4338 it->wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE )
4340 it->wd->expand_item = it;
4341 _item_flip_effect_show(it);
4342 evas_object_geometry_get(VIEW(it), NULL, &y, NULL, &h);
4343 it->wd->expand_item_end = y + h;
4347 it2 = elm_genlist_item_next_get(it2);
4349 } while (it2->expanded_depth > it->expanded_depth);
4353 evas_output_viewport_get(evas_object_evas_get(wd->pan_smart), NULL, &vy, NULL, &vh);
4354 it2->old_scrl_y = ((it2->old_scrl_y > vy + vh) ? vy + vh : it2->old_scrl_y);
4355 it->wd->expand_item_gap = it->wd->expand_item_end - it2->old_scrl_y;
4358 it->wd->expand_item_gap = 0;
4360 evas_object_raise(it->wd->alpha_bg);
4361 evas_object_show(it->wd->alpha_bg);
4363 it->wd->start_time = current_time_get();
4364 it->wd->item_moving_effect_timer = ecore_animator_add(_item_moving_effect_timer_cb, it->wd);
4367 _item_subitems_clear(it);
4372 elm_genlist_item_selected_set(Elm_Genlist_Item *it,
4375 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4376 Widget_Data *wd = elm_widget_data_get(WIDGET(it));
4378 if ((it->delete_me) || (it->disabled)) return;
4379 selected = !!selected;
4380 if (it->selected == selected) return;
4386 while (wd->selected)
4387 _item_unselect(wd->selected->data);
4389 _item_highlight(it);
4397 elm_genlist_item_selected_get(const Elm_Genlist_Item *it)
4399 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4400 return it->selected;
4404 elm_genlist_item_expanded_set(Elm_Genlist_Item *it,
4407 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4408 if (it->flags != ELM_GENLIST_ITEM_SUBITEMS) return;
4409 if (it->expanded == expanded) return;
4410 it->expanded = expanded;
4411 it->wd->expand_item = it;
4413 if (it->wd->effect_mode && !it->wd->alpha_bg)
4414 it->wd->alpha_bg = _create_tray_alpha_bg(WIDGET(it));
4418 it->wd->auto_scrolled = EINA_FALSE;
4419 it->wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND;
4421 edje_object_signal_emit(VIEW(it), "elm,state,expanded", "elm");
4422 evas_object_smart_callback_call(WIDGET(it), "expanded", it);
4426 it->wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT;
4428 edje_object_signal_emit(VIEW(it), "elm,state,contracted", "elm");
4429 evas_object_smart_callback_call(WIDGET(it), "contracted", it);
4434 elm_genlist_item_expanded_get(const Elm_Genlist_Item *it)
4436 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4437 return it->expanded;
4441 elm_genlist_item_expanded_depth_get(const Elm_Genlist_Item *it)
4443 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, 0);
4444 return it->expanded_depth;
4448 elm_genlist_item_disabled_set(Elm_Genlist_Item *it,
4451 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4454 if (it->disabled == disabled) return;
4455 if (it->delete_me) return;
4456 it->disabled = !!disabled;
4458 elm_genlist_item_selected_set(it, EINA_FALSE);
4463 edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
4465 edje_object_signal_emit(it->edit_obj, "elm,state,disabled", "elm");
4469 edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm");
4471 edje_object_signal_emit(it->edit_obj, "elm,state,enabled", "elm");
4473 EINA_LIST_FOREACH(it->icon_objs, l, obj)
4474 elm_widget_disabled_set(obj, disabled);
4479 elm_genlist_item_disabled_get(const Elm_Genlist_Item *it)
4481 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4482 if (it->delete_me) return EINA_FALSE;
4483 return it->disabled;
4487 elm_genlist_item_display_only_set(Elm_Genlist_Item *it,
4488 Eina_Bool display_only)
4490 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4491 if (it->display_only == display_only) return;
4492 if (it->delete_me) return;
4493 it->display_only = display_only;
4494 it->mincalcd = EINA_FALSE;
4495 it->updateme = EINA_TRUE;
4496 if (it->block) it->block->updateme = EINA_TRUE;
4497 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4498 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4502 elm_genlist_item_display_only_get(const Elm_Genlist_Item *it)
4504 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4505 if (it->delete_me) return EINA_FALSE;
4506 return it->display_only;
4510 elm_genlist_item_show(Elm_Genlist_Item *it)
4512 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4513 Evas_Coord gith = 0;
4514 if (it->delete_me) return;
4515 if ((it->queued) || (!it->mincalcd))
4517 it->wd->show_item = it;
4518 it->wd->bring_in = EINA_TRUE;
4519 it->showme = EINA_TRUE;
4522 if (it->wd->show_item)
4524 it->wd->show_item->showme = EINA_FALSE;
4525 it->wd->show_item = NULL;
4527 if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
4528 gith = it->group_item->h;
4529 elm_smart_scroller_child_region_show(it->wd->scr,
4530 it->x + it->block->x,
4531 it->y + it->block->y - gith,
4532 it->block->w, it->h);
4536 elm_genlist_item_bring_in(Elm_Genlist_Item *it)
4538 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4539 Evas_Coord gith = 0;
4540 if (it->delete_me) return;
4541 if ((it->queued) || (!it->mincalcd))
4543 it->wd->show_item = it;
4544 it->wd->bring_in = EINA_TRUE;
4545 it->showme = EINA_TRUE;
4548 if (it->wd->show_item)
4550 it->wd->show_item->showme = EINA_FALSE;
4551 it->wd->show_item = NULL;
4553 if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
4554 gith = it->group_item->h;
4555 elm_smart_scroller_region_bring_in(it->wd->scr,
4556 it->x + it->block->x,
4557 it->y + it->block->y - gith,
4558 it->block->w, it->h);
4562 elm_genlist_item_top_show(Elm_Genlist_Item *it)
4564 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4566 Evas_Coord gith = 0;
4568 if (it->delete_me) return;
4569 if ((it->queued) || (!it->mincalcd))
4571 it->wd->show_item = it;
4572 it->wd->bring_in = EINA_TRUE;
4573 it->showme = EINA_TRUE;
4576 if (it->wd->show_item)
4578 it->wd->show_item->showme = EINA_FALSE;
4579 it->wd->show_item = NULL;
4581 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4582 if (it->group_item) gith = it->group_item->h;
4583 elm_smart_scroller_child_region_show(it->wd->scr,
4584 it->x + it->block->x,
4585 it->y + it->block->y - gith,
4590 elm_genlist_item_top_bring_in(Elm_Genlist_Item *it)
4592 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4594 Evas_Coord gith = 0;
4596 if (it->delete_me) return;
4597 if ((it->queued) || (!it->mincalcd))
4599 it->wd->show_item = it;
4600 it->wd->bring_in = EINA_TRUE;
4601 it->showme = EINA_TRUE;
4604 if (it->wd->show_item)
4606 it->wd->show_item->showme = EINA_FALSE;
4607 it->wd->show_item = NULL;
4609 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4610 if (it->group_item) gith = it->group_item->h;
4611 elm_smart_scroller_region_bring_in(it->wd->scr,
4612 it->x + it->block->x,
4613 it->y + it->block->y - gith,
4618 elm_genlist_item_middle_show(Elm_Genlist_Item *it)
4620 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4623 if (it->delete_me) return;
4624 if ((it->queued) || (!it->mincalcd))
4626 it->wd->show_item = it;
4627 it->wd->bring_in = EINA_TRUE;
4628 it->showme = EINA_TRUE;
4631 if (it->wd->show_item)
4633 it->wd->show_item->showme = EINA_FALSE;
4634 it->wd->show_item = NULL;
4636 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4637 elm_smart_scroller_child_region_show(it->wd->scr,
4638 it->x + it->block->x,
4639 it->y + it->block->y - oh / 2 +
4640 it->h / 2, it->block->w, oh);
4644 elm_genlist_item_middle_bring_in(Elm_Genlist_Item *it)
4646 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4649 if (it->delete_me) return;
4650 if ((it->queued) || (!it->mincalcd))
4652 it->wd->show_item = it;
4653 it->wd->bring_in = EINA_TRUE;
4654 it->showme = EINA_TRUE;
4657 if (it->wd->show_item)
4659 it->wd->show_item->showme = EINA_FALSE;
4660 it->wd->show_item = NULL;
4662 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4663 elm_smart_scroller_region_bring_in(it->wd->scr,
4664 it->x + it->block->x,
4665 it->y + it->block->y - oh / 2 + it->h / 2,
4670 elm_genlist_item_del(Elm_Genlist_Item *it)
4672 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4673 if ((it->relcount > 0) || (it->walking > 0))
4675 elm_widget_item_pre_notify_del(it);
4676 elm_genlist_item_subitems_clear(it);
4677 it->delete_me = EINA_TRUE;
4678 if (it->wd->show_item == it) it->wd->show_item = NULL;
4680 it->wd->selected = eina_list_remove(it->wd->selected,
4684 if (it->realized) _item_unrealize(it, EINA_FALSE);
4685 it->block->changed = EINA_TRUE;
4686 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
4687 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
4689 if (it->itc->func.del)
4690 it->itc->func.del((void *)it->base.data, WIDGET(it));
4697 elm_genlist_item_data_set(Elm_Genlist_Item *it,
4700 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4701 elm_widget_item_data_set(it, data);
4702 elm_genlist_item_update(it);
4706 elm_genlist_item_data_get(const Elm_Genlist_Item *it)
4708 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4709 return elm_widget_item_data_get(it);
4713 elm_genlist_item_icons_orphan(Elm_Genlist_Item *it)
4716 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4717 EINA_LIST_FREE(it->icon_objs, icon)
4719 elm_widget_sub_object_del(WIDGET(it), icon);
4720 evas_object_smart_member_del(icon);
4721 evas_object_hide(icon);
4725 EAPI const Evas_Object *
4726 elm_genlist_item_object_get(const Elm_Genlist_Item *it)
4728 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4733 elm_genlist_item_update(Elm_Genlist_Item *it)
4735 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4736 if (!it->block) return;
4737 if (it->delete_me) return;
4738 it->mincalcd = EINA_FALSE;
4739 it->updateme = EINA_TRUE;
4740 it->block->updateme = EINA_TRUE;
4741 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4742 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4743 it->defer_unrealize = EINA_FALSE;
4747 elm_genlist_item_fields_update(Elm_Genlist_Item *it,
4749 Elm_Genlist_Item_Field_Flags itf)
4751 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4752 if (!it->block) return;
4753 if (it->delete_me) return;
4755 if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_LABEL))
4756 _item_label_realize(it, VIEW(it), &it->labels, parts);
4757 if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_ICON))
4759 it->icon_objs = _item_icon_unrealize(it, VIEW(it),
4761 it->icon_objs = _item_icon_realize(it, VIEW(it),
4764 if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_STATE))
4765 _item_state_realize(it, VIEW(it), &it->states, parts);
4769 elm_genlist_item_item_class_update(Elm_Genlist_Item *it,
4770 const Elm_Genlist_Item_Class *itc)
4772 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4773 if (!it->block) return;
4774 EINA_SAFETY_ON_NULL_RETURN(itc);
4775 if (it->delete_me) return;
4777 it->nocache = EINA_TRUE;
4778 elm_genlist_item_update(it);
4781 EAPI const Elm_Genlist_Item_Class *
4782 elm_genlist_item_item_class_get(const Elm_Genlist_Item *it)
4784 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4785 if (it->delete_me) return NULL;
4788 static Evas_Object *
4789 _elm_genlist_item_label_create(void *data,
4791 void *item __UNUSED__)
4793 Evas_Object *label = elm_label_add(obj);
4796 elm_object_style_set(label, "tooltip");
4797 elm_object_text_set(label, data);
4802 _elm_genlist_item_label_del_cb(void *data,
4803 Evas_Object *obj __UNUSED__,
4804 void *event_info __UNUSED__)
4806 eina_stringshare_del(data);
4810 elm_genlist_item_tooltip_text_set(Elm_Genlist_Item *item,
4813 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4814 text = eina_stringshare_add(text);
4815 elm_genlist_item_tooltip_content_cb_set(item, _elm_genlist_item_label_create,
4817 _elm_genlist_item_label_del_cb);
4821 elm_genlist_item_tooltip_content_cb_set(Elm_Genlist_Item *item,
4822 Elm_Tooltip_Item_Content_Cb func,
4824 Evas_Smart_Cb del_cb)
4826 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(item, error);
4828 if ((item->tooltip.content_cb == func) && (item->tooltip.data == data))
4831 if (item->tooltip.del_cb)
4832 item->tooltip.del_cb((void *)item->tooltip.data,
4833 item->base.widget, item);
4835 item->tooltip.content_cb = func;
4836 item->tooltip.data = data;
4837 item->tooltip.del_cb = del_cb;
4841 elm_widget_item_tooltip_content_cb_set(item,
4842 item->tooltip.content_cb,
4843 item->tooltip.data, NULL);
4844 elm_widget_item_tooltip_style_set(item, item->tooltip.style);
4850 if (del_cb) del_cb((void *)data, NULL, NULL);
4854 elm_genlist_item_tooltip_unset(Elm_Genlist_Item *item)
4856 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4857 if ((item->base.view) && (item->tooltip.content_cb))
4858 elm_widget_item_tooltip_unset(item);
4860 if (item->tooltip.del_cb)
4861 item->tooltip.del_cb((void *)item->tooltip.data, item->base.widget, item);
4862 item->tooltip.del_cb = NULL;
4863 item->tooltip.content_cb = NULL;
4864 item->tooltip.data = NULL;
4865 if (item->tooltip.style)
4866 elm_genlist_item_tooltip_style_set(item, NULL);
4870 elm_genlist_item_tooltip_style_set(Elm_Genlist_Item *item,
4873 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4874 eina_stringshare_replace(&item->tooltip.style, style);
4875 if (item->base.view) elm_widget_item_tooltip_style_set(item, style);
4879 elm_genlist_item_tooltip_style_get(const Elm_Genlist_Item *item)
4881 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4882 return item->tooltip.style;
4886 elm_genlist_item_cursor_set(Elm_Genlist_Item *item,
4889 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4890 eina_stringshare_replace(&item->mouse_cursor, cursor);
4891 if (item->base.view) elm_widget_item_cursor_set(item, cursor);
4895 elm_genlist_item_cursor_get(const Elm_Genlist_Item *item)
4897 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4898 return elm_widget_item_cursor_get(item);
4902 elm_genlist_item_cursor_unset(Elm_Genlist_Item *item)
4904 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4905 if (!item->mouse_cursor)
4909 elm_widget_item_cursor_unset(item);
4911 eina_stringshare_del(item->mouse_cursor);
4912 item->mouse_cursor = NULL;
4916 elm_genlist_item_cursor_style_set(Elm_Genlist_Item *item,
4919 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4920 elm_widget_item_cursor_style_set(item, style);
4924 elm_genlist_item_cursor_style_get(const Elm_Genlist_Item *item)
4926 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4927 return elm_widget_item_cursor_style_get(item);
4931 elm_genlist_item_cursor_engine_only_set(Elm_Genlist_Item *item,
4932 Eina_Bool engine_only)
4934 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4935 elm_widget_item_cursor_engine_only_set(item, engine_only);
4939 elm_genlist_item_cursor_engine_only_get(const Elm_Genlist_Item *item)
4941 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
4942 return elm_widget_item_cursor_engine_only_get(item);
4946 elm_genlist_horizontal_mode_set(Evas_Object *obj,
4949 ELM_CHECK_WIDTYPE(obj, widtype);
4950 Widget_Data *wd = elm_widget_data_get(obj);
4952 if (wd->mode == mode) return;
4958 elm_genlist_horizontal_mode_get(const Evas_Object *obj)
4960 ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
4961 Widget_Data *wd = elm_widget_data_get(obj);
4962 if (!wd) return ELM_LIST_LAST;
4967 elm_genlist_always_select_mode_set(Evas_Object *obj,
4968 Eina_Bool always_select)
4970 ELM_CHECK_WIDTYPE(obj, widtype);
4971 Widget_Data *wd = elm_widget_data_get(obj);
4973 wd->always_select = always_select;
4977 elm_genlist_always_select_mode_get(const Evas_Object *obj)
4979 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4980 Widget_Data *wd = elm_widget_data_get(obj);
4981 if (!wd) return EINA_FALSE;
4982 return wd->always_select;
4986 elm_genlist_no_select_mode_set(Evas_Object *obj,
4987 Eina_Bool no_select)
4989 ELM_CHECK_WIDTYPE(obj, widtype);
4990 Widget_Data *wd = elm_widget_data_get(obj);
4992 wd->no_select = no_select;
4996 elm_genlist_no_select_mode_get(const Evas_Object *obj)
4998 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4999 Widget_Data *wd = elm_widget_data_get(obj);
5000 if (!wd) return EINA_FALSE;
5001 return wd->no_select;
5005 elm_genlist_compress_mode_set(Evas_Object *obj,
5008 ELM_CHECK_WIDTYPE(obj, widtype);
5009 Widget_Data *wd = elm_widget_data_get(obj);
5011 wd->compress = compress;
5015 elm_genlist_compress_mode_get(const Evas_Object *obj)
5017 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5018 Widget_Data *wd = elm_widget_data_get(obj);
5019 if (!wd) return EINA_FALSE;
5020 return wd->compress;
5024 elm_genlist_height_for_width_mode_set(Evas_Object *obj,
5025 Eina_Bool height_for_width)
5027 ELM_CHECK_WIDTYPE(obj, widtype);
5028 Widget_Data *wd = elm_widget_data_get(obj);
5030 wd->height_for_width = !!height_for_width;
5031 if (wd->height_for_width)
5033 elm_genlist_homogeneous_set(obj, EINA_FALSE);
5034 elm_genlist_compress_mode_set(obj, EINA_TRUE);
5039 elm_genlist_height_for_width_mode_get(const Evas_Object *obj)
5041 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5042 Widget_Data *wd = elm_widget_data_get(obj);
5043 if (!wd) return EINA_FALSE;
5044 return wd->height_for_width;
5048 elm_genlist_bounce_set(Evas_Object *obj,
5052 ELM_CHECK_WIDTYPE(obj, widtype);
5053 Widget_Data *wd = elm_widget_data_get(obj);
5055 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
5059 elm_genlist_bounce_get(const Evas_Object *obj,
5060 Eina_Bool *h_bounce,
5061 Eina_Bool *v_bounce)
5063 ELM_CHECK_WIDTYPE(obj, widtype);
5064 Widget_Data *wd = elm_widget_data_get(obj);
5066 elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce);
5070 elm_genlist_homogeneous_set(Evas_Object *obj,
5071 Eina_Bool homogeneous)
5073 ELM_CHECK_WIDTYPE(obj, widtype);
5074 Widget_Data *wd = elm_widget_data_get(obj);
5076 if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
5077 wd->homogeneous = homogeneous;
5081 elm_genlist_homogeneous_get(const Evas_Object *obj)
5083 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5084 Widget_Data *wd = elm_widget_data_get(obj);
5085 if (!wd) return EINA_FALSE;
5086 return wd->homogeneous;
5090 elm_genlist_block_count_set(Evas_Object *obj,
5093 ELM_CHECK_WIDTYPE(obj, widtype);
5094 Widget_Data *wd = elm_widget_data_get(obj);
5096 wd->max_items_per_block = n;
5097 wd->item_cache_max = wd->max_items_per_block * 2;
5098 _item_cache_clean(wd);
5102 elm_genlist_block_count_get(const Evas_Object *obj)
5104 ELM_CHECK_WIDTYPE(obj, widtype) 0;
5105 Widget_Data *wd = elm_widget_data_get(obj);
5107 return wd->max_items_per_block;
5111 elm_genlist_longpress_timeout_set(Evas_Object *obj,
5114 ELM_CHECK_WIDTYPE(obj, widtype);
5115 Widget_Data *wd = elm_widget_data_get(obj);
5117 wd->longpress_timeout = timeout;
5121 elm_genlist_longpress_timeout_get(const Evas_Object *obj)
5123 ELM_CHECK_WIDTYPE(obj, widtype) 0;
5124 Widget_Data *wd = elm_widget_data_get(obj);
5126 return wd->longpress_timeout;
5130 elm_genlist_scroller_policy_set(Evas_Object *obj,
5131 Elm_Scroller_Policy policy_h,
5132 Elm_Scroller_Policy policy_v)
5134 ELM_CHECK_WIDTYPE(obj, widtype);
5135 Widget_Data *wd = elm_widget_data_get(obj);
5136 if ((!wd) || (!wd->scr)) return;
5137 if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
5138 (policy_v >= ELM_SCROLLER_POLICY_LAST))
5140 elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
5144 elm_genlist_scroller_policy_get(const Evas_Object *obj,
5145 Elm_Scroller_Policy *policy_h,
5146 Elm_Scroller_Policy *policy_v)
5148 ELM_CHECK_WIDTYPE(obj, widtype);
5149 Widget_Data *wd = elm_widget_data_get(obj);
5150 Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
5151 if ((!wd) || (!wd->scr)) return;
5152 elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
5153 if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
5154 if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
5158 elm_genlist_realized_items_update(Evas_Object *obj)
5160 ELM_CHECK_WIDTYPE(obj, widtype);
5162 Eina_List *list, *l;
5163 Elm_Genlist_Item *it;
5165 list = elm_genlist_realized_items_get(obj);
5166 EINA_LIST_FOREACH(list, l, it)
5167 elm_genlist_item_update(it);
5171 elm_genlist_item_mode_set(Elm_Genlist_Item *it,
5172 const char *mode_type,
5175 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
5176 Widget_Data *wd = it->wd;
5178 Elm_Genlist_Item *it2;
5181 if (!mode_type) return;
5182 if ((it->delete_me) || (it->disabled)) return;
5183 if (wd->edit_mode) return;
5185 if ((wd->mode_item == it) &&
5186 (!strcmp(mode_type, wd->mode_type)) &&
5189 if (!it->itc->mode_item_style) return;
5193 EINA_LIST_FOREACH(wd->selected, l, it2)
5195 elm_genlist_item_selected_set(it2, EINA_FALSE);
5199 it2 = elm_genlist_selected_item_get(wd->obj);
5200 if ((it2) && (it2->realized))
5201 elm_genlist_item_selected_set(it2, EINA_FALSE);
5204 if (((wd->mode_type) && (strcmp(mode_type, wd->mode_type))) ||
5206 ((it == wd->mode_item) && (!mode_set)))
5207 _item_mode_unset(wd);
5209 eina_stringshare_replace(&wd->mode_type, mode_type);
5210 if (mode_set) _item_mode_set(it);
5214 elm_genlist_mode_get(const Evas_Object *obj)
5216 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5217 Widget_Data *wd = elm_widget_data_get(obj);
5218 if (!wd) return NULL;
5219 return wd->mode_type;
5222 EAPI const Elm_Genlist_Item *
5223 elm_genlist_mode_item_get(const Evas_Object *obj)
5225 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5226 Widget_Data *wd = elm_widget_data_get(obj);
5227 if (!wd) return NULL;
5228 return wd->mode_item;
5232 elm_genlist_reorder_mode_set(Evas_Object *obj,
5233 Eina_Bool reorder_mode)
5235 ELM_CHECK_WIDTYPE(obj, widtype);
5236 Widget_Data *wd = elm_widget_data_get(obj);
5238 wd->reorder_mode = reorder_mode;
5242 elm_genlist_reorder_mode_get(const Evas_Object *obj)
5244 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5245 Widget_Data *wd = elm_widget_data_get(obj);
5246 if (!wd) return EINA_FALSE;
5247 return wd->reorder_mode;
5251 elm_genlist_item_move_after(Elm_Genlist_Item *it __UNUSED__, Elm_Genlist_Item *after __UNUSED__)
5257 elm_genlist_item_move_before(Elm_Genlist_Item *it __UNUSED__, Elm_Genlist_Item *before __UNUSED__)
5263 elm_genlist_effect_set(const Evas_Object *obj, Eina_Bool emode)
5265 ELM_CHECK_WIDTYPE(obj, widtype);
5266 Widget_Data *wd = elm_widget_data_get(obj);
5268 wd->effect_mode = emode;
5269 // wd->point_rect = evas_object_rectangle_add(evas_object_evas_get(wd->obj));
5270 // evas_object_resize(wd->point_rect, 10, 25);
5271 // evas_object_color_set(wd->point_rect, 255, 0, 0, 130);
5272 // evas_object_show(wd->point_rect);
5273 // evas_object_hide(wd->point_rect);
5277 _create_tray_alpha_bg(const Evas_Object *obj)
5279 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5280 Widget_Data *wd = elm_widget_data_get(obj);
5281 if (!wd) return NULL;
5283 Evas_Object *bg = NULL;
5284 Evas_Coord ox, oy, ow, oh;
5286 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
5287 bg = evas_object_rectangle_add(evas_object_evas_get(wd->obj));
5288 evas_object_color_set(bg,0,0,0,0);
5289 evas_object_resize(bg , ow, oh);
5290 evas_object_move(bg , ox, oy);
5291 evas_object_show(bg);
5292 evas_object_hide(bg);
5299 struct timeval timev;
5301 gettimeofday(&timev, NULL);
5302 return ((timev.tv_sec * 1000) + ((timev.tv_usec) / 1000));
5305 // added for item moving animation.
5307 _item_moving_effect_timer_cb(void *data)
5309 Widget_Data *wd = data;
5310 if (!wd) return EINA_FALSE;
5312 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
5313 Elm_Genlist_Item *it = NULL, *it2;
5315 double time = 0.5, t;
5317 Eina_Bool check, end = EINA_FALSE;
5320 t = ((0.0 > (t = current_time_get() - wd->start_time)) ? 0.0 : t) / 1000;
5322 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
5323 evas_output_viewport_get(evas_object_evas_get(wd->pan_smart), &cvx, &cvy, &cvw, &cvh);
5324 if (t > time) end = EINA_TRUE;
5326 it2 = elm_genlist_item_next_get(wd->expand_item);
5329 if (wd->expand_item->expanded_depth >= it2->expanded_depth) break;
5330 it2 = elm_genlist_item_next_get(it2);
5335 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5336 dy = ((it2->scrl_y > cvy + cvh) ? cvy + cvh : it2->scrl_y) - it2->old_scrl_y;
5337 else if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5338 dy = wd->expand_item_gap;
5342 y = ((1 - (1 - (t / time)) * (1 - (t /time))) * dy);
5351 EINA_INLIST_FOREACH(wd->blocks, itb)
5354 if (ELM_RECTS_INTERSECT(itb->x - wd->pan_x + ox,
5355 itb->y - wd->pan_y + oy,
5357 cvx, cvy, cvw, cvh))
5359 EINA_LIST_FOREACH(itb->items, l, it)
5361 if (it == it2) check = EINA_TRUE;
5362 if (!check) continue;
5364 if (!it->old_scrl_y)
5365 it->old_scrl_y = it->scrl_y;
5366 if (it->old_scrl_y + y < oy + oh)
5368 if (!it->realized) _item_realize(it, in, 0);
5370 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE && it->old_scrl_y + y < it->scrl_y)
5371 it->old_scrl_y = it->scrl_y - y;
5374 if (wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE ||
5375 (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE && it->old_scrl_y + y >= it->scrl_y))
5377 if (wd->edit_mode) _effect_item_controls(it, it->scrl_x, it->old_scrl_y + y);
5380 evas_object_resize(VIEW(it), it->w, it->h);
5381 evas_object_move(VIEW(it), it->scrl_x, it->old_scrl_y + y);
5382 evas_object_show(VIEW(it));
5383 evas_object_raise(VIEW(it));
5386 if (it->group_item) evas_object_raise(it->group_item->base.view);
5392 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5394 it = elm_genlist_item_prev_get(it2);
5397 if (it->expanded_depth <= it2->expanded_depth) break;
5398 if ((it->scrl_y < it2->old_scrl_y + y) && (it->expanded_depth > it2->expanded_depth))
5400 if (!it->effect_done)
5402 edje_object_signal_emit(VIEW(it), "flip_item", "");
5403 evas_object_show(VIEW(it));
5404 it->effect_done = EINA_TRUE;
5407 it = elm_genlist_item_prev_get(it);
5410 else if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5412 it = elm_genlist_item_prev_get(it2);
5415 if ((it->scrl_y > it2->old_scrl_y + y) && (it->expanded_depth > it2->expanded_depth))
5417 if (!it->effect_done)
5419 edje_object_signal_emit(VIEW(it), "elm,state,hide", "");
5420 it->effect_done = EINA_TRUE;
5425 it = elm_genlist_item_prev_get(it);
5432 int expand_order = 0;
5433 if (wd->expand_item) it = elm_genlist_item_next_get(wd->expand_item);
5437 it = elm_genlist_item_next_get(it);
5439 if (wd->expand_item) it = elm_genlist_item_next_get(wd->expand_item);
5443 if (wd->expand_item->expanded_depth >= it->expanded_depth) break;
5444 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5446 if (!it->effect_done)
5448 if (t >= (((expand_order - 1) * time) / expand_num))
5450 edje_object_signal_emit(VIEW(it), "flip_item", "");
5451 evas_object_show(VIEW(it));
5452 it->effect_done = EINA_TRUE;
5456 it = elm_genlist_item_next_get(it);
5462 if (wd->item_moving_effect_timer)
5464 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5465 _item_subitems_clear(wd->expand_item);
5466 EINA_INLIST_FOREACH(wd->blocks, itb)
5468 EINA_LIST_FOREACH(itb->items, l, it)
5470 it->effect_done = EINA_TRUE;
5471 it->old_scrl_y = it->scrl_y;
5475 wd->item_moving_effect_timer = NULL;
5477 _item_auto_scroll(wd);
5478 evas_object_lower(wd->alpha_bg);
5479 evas_object_hide(wd->alpha_bg);
5480 elm_smart_scroller_bounce_animator_disabled_set(wd->scr, EINA_FALSE);
5481 wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_NONE;
5483 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
5484 evas_object_smart_callback_call(wd->obj, "effect_done", NULL);
5485 evas_object_smart_changed(wd->pan_smart);
5486 return ECORE_CALLBACK_CANCEL;
5488 return ECORE_CALLBACK_RENEW;
5492 _emit_contract(Elm_Genlist_Item *it)
5494 Elm_Genlist_Item *it2;
5497 // printf("%p is emited contract\n", it);
5498 edje_object_signal_emit(VIEW(it), "elm,state,contract_flip", "");
5499 it->effect_done = EINA_FALSE;
5501 EINA_LIST_FOREACH(it->items, l, it2)
5503 _emit_contract(it2);
5506 // added for item moving animation.
5508 _item_flip_effect_show(Elm_Genlist_Item *it)
5510 Elm_Genlist_Item *it2;
5512 Widget_Data *wd = it->wd;
5513 Eina_Bool check = EINA_FALSE;
5515 it2 = elm_genlist_item_next_get(it);
5518 if (it2->expanded_depth <= it->expanded_depth) check = EINA_TRUE;
5519 it2 = elm_genlist_item_next_get(it2);
5521 EINA_LIST_FOREACH(it->items, l, it2)
5523 if (it2->parent && it == it2->parent)
5525 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5526 edje_object_signal_emit(it2->base.view, "elm,state,hide", "");
5527 else if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5528 _emit_contract(it2);
5532 return ECORE_CALLBACK_CANCEL;
5537 _elm_genlist_pinch_zoom_execute(Evas_Object *obj, Eina_Bool emode)
5539 printf("!!! NOW FIXING \n");
5544 * Set pinch zoom mode
5546 * @param obj The genlist object
5548 * (EINA_TRUE = pinch contract (zoom in), EINA_FALSE = pinch expand (zoom out)
5553 elm_genlist_pinch_zoom_mode_set(Evas_Object *obj __UNUSED__, Eina_Bool emode __UNUSED__)
5555 printf("!!! NOW FIXING \n");
5559 * Get pinch zoom mode
5561 * @param obj The genlist object
5562 * @return The pinch mode
5563 * (EINA_TRUE = pinch contract (zoom in), EINA_FALSE = pinch expand (zoom out)
5568 elm_genlist_pinch_zoom_mode_get(const Evas_Object *obj __UNUSED__)
5570 printf("!!! NOW FIXING \n");
5575 elm_genlist_pinch_zoom_set(Evas_Object *obj __UNUSED__, Eina_Bool emode __UNUSED__)
5577 printf("!!! NOW FIXING \n");
5581 ////////////////////////////////////////////////////////////////////////
5583 ////////////////////////////////////////////////////////////////////////
5586 _effect_item_controls(Elm_Genlist_Item *it, int itx, int ity)
5588 if (!it->wd->edit_mode) return;
5589 evas_object_resize(it->edit_obj,it->w, it->h);
5590 evas_object_move(it->edit_obj, itx, ity);
5594 _effect_item_realize(Elm_Genlist_Item *it, Eina_Bool effect_on)
5596 if ((it->effect_item_realized) || (it->delete_me)) return;
5600 _mode_finished_signal_cb(it, (Evas_Object *)elm_genlist_item_object_get(it), NULL, NULL);
5602 it->edit_obj = edje_object_add(evas_object_evas_get(WIDGET(it)));
5603 edje_object_scale_set(it->edit_obj, elm_widget_scale_get(WIDGET(it)) *
5604 _elm_config->scale);
5605 evas_object_smart_member_add(it->edit_obj, it->wd->pan_smart);
5606 elm_widget_sub_object_add(WIDGET(it), it->edit_obj);
5608 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) strncpy(buf, "tree", sizeof(buf));
5609 else strncpy(buf, "item", sizeof(buf));
5610 if (it->wd->compress) strncat(buf, "_compress", sizeof(buf) - strlen(buf));
5612 strncat(buf, "/", sizeof(buf) - strlen(buf));
5614 if (it->itc->edit_item_style && strcmp(it->itc->edit_item_style, "default"))
5616 strncat(buf, it->itc->edit_item_style, sizeof(buf) - strlen(buf));
5617 _elm_theme_object_set(WIDGET(it), it->edit_obj, "genlist", buf, elm_widget_style_get(WIDGET(it)));
5621 _elm_theme_object_set(WIDGET(it), it->edit_obj, "genlist", "item/edit_default", elm_widget_style_get(WIDGET(it)));
5624 if (it->wd->reorder_mode)
5626 if (effect_on) edje_object_signal_emit(it->edit_obj, "elm,state,reorder_enabled_effect", "elm");
5627 else edje_object_signal_emit(it->edit_obj, "elm,state,reorder_enabled", "elm");
5629 if (effect_on) edje_object_signal_emit(it->edit_obj, "elm,state,emode_enabled_effect", "elm");
5630 else edje_object_signal_emit(it->edit_obj, "elm,state,emode_enabled", "elm");
5632 if (it->disabled) edje_object_signal_emit(it->edit_obj, "elm,state,disabled", "elm");
5633 else edje_object_signal_emit(it->edit_obj, "elm,state,enabled", "elm");
5636 if ((it->wd->edit_mode))
5638 if (it->itc->func.icon_get)
5643 if (it->renamed) edje_object_signal_emit(it->edit_obj, "elm,state,rename,enabled", "elm");
5644 it->icons = elm_widget_stringlist_get(edje_object_data_get(it->edit_obj, "edit_icons"));
5645 EINA_LIST_FOREACH(it->icons, l, key)
5647 Evas_Object *ic = it->itc->func.icon_get
5648 ((void *)it->base.data, WIDGET(it), l->data);
5652 it->edit_icon_objs = eina_list_append(it->edit_icon_objs, ic);
5653 edje_object_part_swallow(it->edit_obj, key, ic);
5654 evas_object_show(ic);
5655 elm_widget_sub_object_add(WIDGET(it), ic);
5657 elm_widget_disabled_set(ic, EINA_TRUE);
5662 edje_object_part_swallow(it->edit_obj, "original_edc", VIEW(it));
5663 _effect_item_controls(it,it->scrl_x, it->scrl_y);
5664 evas_object_show(it->edit_obj);
5666 it->effect_item_realized = EINA_TRUE;
5667 it->want_unrealize = EINA_FALSE;
5671 _effect_item_unrealize(Elm_Genlist_Item *it)
5675 if (!it->effect_item_realized) return;
5676 if (it->wd->reorder_it && it->wd->reorder_it == it) return;
5678 edje_object_signal_emit(it->edit_obj, "elm,state,reorder_disable_effect", "elm");
5679 edje_object_signal_emit(it->edit_obj, "elm,state,sel,disable", "elm");
5680 edje_object_message_signal_process(it->edit_obj);
5681 edje_object_part_unswallow(it->edit_obj, VIEW(it));
5682 evas_object_smart_member_add(VIEW(it), it->wd->pan_smart);
5683 elm_widget_sub_object_add(WIDGET(it), VIEW(it));
5684 // evas_object_smart_callback_call(it->edit_obj, "unrealized", it);
5685 // _item_cache_add(it);
5686 evas_object_del(it->edit_obj);
5687 it->edit_obj = NULL;
5688 EINA_LIST_FREE(it->edit_icon_objs, icon)
5689 evas_object_del(icon);
5691 // edje_object_signal_emit(it->edit_obj, "elm,state,edit_end,disable", "elm");
5692 it->effect_item_realized = EINA_FALSE;
5696 * Get Genlist edit mode
5698 * @param obj The genlist object
5699 * @return The edit mode status
5700 * (EINA_TRUE = edit mode, EINA_FALSE = normal mode
5705 elm_genlist_edit_mode_get(const Evas_Object *obj)
5707 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5708 Widget_Data *wd = elm_widget_data_get(obj);
5709 if (!wd) return EINA_FALSE;
5711 if (wd->edit_mode) return EINA_TRUE;
5712 else return EINA_FALSE;
5716 * Set Genlist edit mode
5718 * This sets Genlist edit mode.
5720 * @param obj The Genlist object
5721 * @param emode ELM_GENLIST_EDIT_MODE_{NONE & REORDER & INSERT & DELETE & SELECT & SELECT_ALL}
5722 * @param edit_class Genlist edit class (Elm_Genlist_Edit_Class structure)
5727 elm_genlist_edit_mode_set(Evas_Object *obj, Eina_Bool edit_mode)
5729 ELM_CHECK_WIDTYPE(obj, widtype);
5733 Elm_Genlist_Item *it;
5735 Widget_Data *wd = elm_widget_data_get(obj);
5737 if (wd->edit_mode == edit_mode) return;
5739 wd->edit_mode = edit_mode;
5742 EINA_INLIST_FOREACH(wd->blocks, itb)
5746 EINA_LIST_FOREACH(itb->items, l, it)
5748 if (it->flags != ELM_GENLIST_ITEM_GROUP && it->realized)
5750 _effect_item_unrealize(it);
5755 _item_cache_zero(wd);
5760 EINA_INLIST_FOREACH(wd->blocks, itb)
5764 EINA_LIST_FOREACH(itb->items, l, it)
5766 if (it->flags != ELM_GENLIST_ITEM_GROUP && it->realized)
5768 if(it->selected) _item_unselect(it);
5769 if (it->itc->edit_item_style) _effect_item_realize(it, EINA_TRUE);
5776 if (wd->calc_job) ecore_job_del(wd->calc_job);
5777 wd->calc_job = ecore_job_add(_calc_job, wd);
5781 * Set a given item's rename mode
5783 * This renames the item's label from genlist
5785 * @param it The item
5786 * @param renamed set if emode is EINA_TRUE, unset if emode is EINA_FALSE
5791 elm_genlist_item_rename_mode_set(Elm_Genlist_Item *it, Eina_Bool renamed)
5797 _item_unrealize(it, EINA_FALSE);
5798 it->renamed = EINA_TRUE;
5799 it->wd->rename_it = it;
5800 it->nocache = EINA_TRUE;
5801 if (it->selected) _item_unselect(it);
5803 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
5804 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
5810 it->renamed = EINA_FALSE;
5811 it->nocache = EINA_TRUE;
5812 it->wd->rename_it = NULL;
5813 _item_cache_zero(it->wd);
5814 elm_genlist_item_update(it);
5820 elm_genlist_item_rename_mode_get(Elm_Genlist_Item *item)
5822 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
5823 return item->renamed;