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)
910 elm_widget_focused_object_clear(obj);
912 if (it->func.func) it->func.func((void *)it->func.data, parent, it);
914 evas_object_smart_callback_call(parent, SIG_SELECTED, it);
917 if ((it->wd->clear_me) && (!it->wd->walking))
919 elm_genlist_clear(parent);
924 if ((!it->walking) && (it->delete_me))
926 if (!it->relcount) _item_del(it);
930 if (it && it->wd) it->wd->last_selected_item = it; // TODO: Remove 'if'?
932 evas_object_unref(parent);
936 _item_unselect(Elm_Genlist_Item *it)
938 const char *stacking, *selectraise;
940 if ((it->delete_me) || ((!it->highlighted) && (!it->selected))) return;
941 edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm");
942 if (it->edit_obj) edje_object_signal_emit(it->edit_obj, "elm,state,unselected", "elm");
943 stacking = edje_object_data_get(VIEW(it), "stacking");
944 selectraise = edje_object_data_get(VIEW(it), "selectraise");
945 if ((selectraise) && (!strcmp(selectraise, "on")))
947 if ((stacking) && (!strcmp(stacking, "below")))
948 evas_object_lower(VIEW(it));
950 it->highlighted = EINA_FALSE;
953 it->selected = EINA_FALSE;
954 it->wd->selected = eina_list_remove(it->wd->selected, it);
955 evas_object_smart_callback_call(WIDGET(it), SIG_UNSELECTED, it);
960 _mouse_move(void *data,
961 Evas *evas __UNUSED__,
965 Elm_Genlist_Item *it = data;
966 Evas_Event_Mouse_Move *ev = event_info;
967 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
968 Evas_Coord ox, oy, ow, oh, it_scrl_y, y_pos;
970 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
972 if (!it->wd->on_hold)
974 it->wd->on_hold = EINA_TRUE;
975 if ((!it->wd->wasselected) && (!it->renamed))
979 if (it->wd->multitouched)
981 it->wd->cur_x = ev->cur.canvas.x;
982 it->wd->cur_y = ev->cur.canvas.y;
985 if ((it->dragging) && (it->down))
987 if (it->wd->movements == SWIPE_MOVES) it->wd->swipe = EINA_TRUE;
990 it->wd->history[it->wd->movements].x = ev->cur.canvas.x;
991 it->wd->history[it->wd->movements].y = ev->cur.canvas.y;
992 if (abs((it->wd->history[it->wd->movements].x -
993 it->wd->history[0].x)) > 40)
994 it->wd->swipe = EINA_TRUE;
1000 ecore_timer_del(it->long_timer);
1001 it->long_timer = NULL;
1003 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG, it);
1006 if ((!it->down) /* || (it->wd->on_hold)*/ || (it->wd->longpressed))
1010 ecore_timer_del(it->long_timer);
1011 it->long_timer = NULL;
1013 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
1015 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
1016 it_scrl_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
1018 if (!it->wd->reorder_start_y)
1019 it->wd->reorder_start_y = it->block->y + it->y;
1023 else if (it_scrl_y + it->wd->reorder_it->h > oy + oh)
1024 y_pos = oy + oh - it->wd->reorder_it->h;
1029 _item_position(it, it->edit_obj, it->scrl_x, y_pos);
1031 _item_position(it, VIEW(it), it->scrl_x, y_pos);
1033 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1034 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1038 if (!it->display_only)
1039 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1040 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1041 x = ev->cur.canvas.x - x;
1042 y = ev->cur.canvas.y - y;
1045 if (adx < 0) adx = -dx;
1048 if (ady < 0) ady = -dy;
1051 if ((adx > minw) || (ady > minh))
1053 it->dragging = EINA_TRUE;
1056 ecore_timer_del(it->long_timer);
1057 it->long_timer = NULL;
1059 if ((!it->wd->wasselected) && (!it->renamed))
1063 if ((ady > adx) && (!it->wd->drag_started))
1064 evas_object_smart_callback_call(WIDGET(it),
1065 SIG_DRAG_START_UP, it);
1069 evas_object_smart_callback_call(WIDGET(it),
1070 SIG_DRAG_START_LEFT, it);
1072 evas_object_smart_callback_call(WIDGET(it),
1073 SIG_DRAG_START_RIGHT, it);
1078 if ((ady > adx) && (!it->wd->drag_started))
1079 evas_object_smart_callback_call(WIDGET(it),
1080 SIG_DRAG_START_DOWN, it);
1084 evas_object_smart_callback_call(WIDGET(it),
1085 SIG_DRAG_START_LEFT, it);
1087 evas_object_smart_callback_call(WIDGET(it),
1088 SIG_DRAG_START_RIGHT, it);
1095 _long_press(void *data)
1097 Elm_Genlist_Item *it = data, *it_tmp;
1098 Eina_List *list, *l;
1100 it->long_timer = NULL;
1101 if ((it->disabled) || (it->dragging) || (it->display_only) || (it->wd->rename_it))
1102 return ECORE_CALLBACK_CANCEL;
1103 it->wd->longpressed = EINA_TRUE;
1104 evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it);
1105 if ((it->wd->reorder_mode) && (it->flags != ELM_GENLIST_ITEM_GROUP))
1107 it->wd->reorder_it = it;
1108 it->wd->reorder_start_y = 0;
1110 evas_object_raise(it->edit_obj);
1112 evas_object_raise(VIEW(it));
1114 elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
1115 elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_FALSE);
1117 list = elm_genlist_realized_items_get(it->wd->obj);
1118 EINA_LIST_FOREACH(list, l, it_tmp)
1120 if (it != it_tmp) _item_unselect(it_tmp);
1124 EINA_LIST_FOREACH(it->items, l, it_tmp)
1126 if (elm_genlist_item_expanded_get(it_tmp))
1128 elm_genlist_item_expanded_set(it_tmp, EINA_FALSE);
1129 return ECORE_CALLBACK_RENEW;
1133 if (elm_genlist_item_expanded_get(it))
1135 elm_genlist_item_expanded_set(it, EINA_FALSE);
1136 return ECORE_CALLBACK_RENEW;
1139 edje_object_signal_emit(it->edit_obj, "elm,action,item,reorder_start", "elm");
1141 edje_object_signal_emit(VIEW(it), "elm,state,reorder,enabled", "elm");
1143 return ECORE_CALLBACK_CANCEL;
1147 _swipe(Elm_Genlist_Item *it)
1152 if ((it->display_only) || (it->disabled)) return;
1153 it->wd->swipe = EINA_FALSE;
1154 for (i = 0; i < it->wd->movements; i++)
1156 sum += it->wd->history[i].x;
1157 if (abs(it->wd->history[0].y - it->wd->history[i].y) > 10) return;
1160 sum /= it->wd->movements;
1161 if (abs(sum - it->wd->history[0].x) <= 10) return;
1162 evas_object_smart_callback_call(WIDGET(it), SIG_SWIPE, it);
1166 _swipe_cancel(void *data)
1168 Elm_Genlist_Item *it = data;
1170 if (!it) return ECORE_CALLBACK_CANCEL;
1171 it->wd->swipe = EINA_FALSE;
1172 it->wd->movements = 0;
1173 return ECORE_CALLBACK_RENEW;
1177 _multi_cancel(void *data)
1179 Widget_Data *wd = data;
1181 if (!wd) return ECORE_CALLBACK_CANCEL;
1182 wd->multi_timeout = EINA_TRUE;
1183 return ECORE_CALLBACK_RENEW;
1187 _multi_touch_gesture_eval(void *data)
1189 Elm_Genlist_Item *it = data;
1191 it->wd->multitouched = EINA_FALSE;
1192 if (it->wd->multi_timer)
1194 ecore_timer_del(it->wd->multi_timer);
1195 it->wd->multi_timer = NULL;
1197 if (it->wd->multi_timeout)
1199 it->wd->multi_timeout = EINA_FALSE;
1203 Evas_Coord minw = 0, minh = 0;
1204 Evas_Coord off_x, off_y, off_mx, off_my;
1206 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1207 off_x = abs(it->wd->cur_x - it->wd->prev_x);
1208 off_y = abs(it->wd->cur_y - it->wd->prev_y);
1209 off_mx = abs(it->wd->cur_mx - it->wd->prev_mx);
1210 off_my = abs(it->wd->cur_my - it->wd->prev_my);
1212 if (((off_x > minw) || (off_y > minh)) && ((off_mx > minw) || (off_my > minh)))
1214 if ((off_x + off_mx) > (off_y + off_my))
1216 if ((it->wd->cur_x > it->wd->prev_x) && (it->wd->cur_mx > it->wd->prev_mx))
1217 evas_object_smart_callback_call(WIDGET(it),
1218 SIG_MULTI_SWIPE_RIGHT, it);
1219 else if ((it->wd->cur_x < it->wd->prev_x) && (it->wd->cur_mx < it->wd->prev_mx))
1220 evas_object_smart_callback_call(WIDGET(it),
1221 SIG_MULTI_SWIPE_LEFT, it);
1222 else if (abs(it->wd->cur_x - it->wd->cur_mx) > abs(it->wd->prev_x - it->wd->prev_mx))
1223 evas_object_smart_callback_call(WIDGET(it),
1224 SIG_MULTI_PINCH_OUT, it);
1226 evas_object_smart_callback_call(WIDGET(it),
1227 SIG_MULTI_PINCH_IN, it);
1231 if ((it->wd->cur_y > it->wd->prev_y) && (it->wd->cur_my > it->wd->prev_my))
1232 evas_object_smart_callback_call(WIDGET(it),
1233 SIG_MULTI_SWIPE_DOWN, it);
1234 else if ((it->wd->cur_y < it->wd->prev_y) && (it->wd->cur_my < it->wd->prev_my))
1235 evas_object_smart_callback_call(WIDGET(it),
1236 SIG_MULTI_SWIPE_UP, it);
1237 else if (abs(it->wd->cur_y - it->wd->cur_my) > abs(it->wd->prev_y - it->wd->prev_my))
1238 evas_object_smart_callback_call(WIDGET(it),
1239 SIG_MULTI_PINCH_OUT, it);
1241 evas_object_smart_callback_call(WIDGET(it),
1242 SIG_MULTI_PINCH_IN, it);
1245 it->wd->multi_timeout = EINA_FALSE;
1249 _multi_down(void *data,
1250 Evas *evas __UNUSED__,
1251 Evas_Object *obj __UNUSED__,
1254 Elm_Genlist_Item *it = data;
1255 Evas_Event_Multi_Down *ev = event_info;
1257 if ((it->wd->multi_device != 0) || (it->wd->multitouched) || (it->wd->multi_timeout)) return;
1258 it->wd->multi_device = ev->device;
1259 it->wd->multi_down = EINA_TRUE;
1260 it->wd->multitouched = EINA_TRUE;
1261 it->wd->prev_mx = ev->canvas.x;
1262 it->wd->prev_my = ev->canvas.y;
1263 if (!it->wd->wasselected) _item_unselect(it);
1264 it->wd->wasselected = EINA_FALSE;
1265 it->wd->longpressed = EINA_FALSE;
1268 ecore_timer_del(it->long_timer);
1269 it->long_timer = NULL;
1273 it->dragging = EINA_FALSE;
1274 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
1276 if (it->swipe_timer)
1278 ecore_timer_del(it->swipe_timer);
1279 it->swipe_timer = NULL;
1281 if (it->wd->on_hold)
1283 it->wd->swipe = EINA_FALSE;
1284 it->wd->movements = 0;
1285 it->wd->on_hold = EINA_FALSE;
1290 _multi_up(void *data,
1291 Evas *evas __UNUSED__,
1292 Evas_Object *obj __UNUSED__,
1295 Elm_Genlist_Item *it = data;
1296 Evas_Event_Multi_Up *ev = event_info;
1298 if (it->wd->multi_device != ev->device) return;
1299 it->wd->multi_device = 0;
1300 it->wd->multi_down = EINA_FALSE;
1301 if (it->wd->mouse_down) return;
1302 _multi_touch_gesture_eval(data);
1306 _multi_move(void *data,
1307 Evas *evas __UNUSED__,
1308 Evas_Object *obj __UNUSED__,
1311 Elm_Genlist_Item *it = data;
1312 Evas_Event_Multi_Move *ev = event_info;
1314 if (it->wd->multi_device != ev->device) return;
1315 it->wd->cur_mx = ev->cur.canvas.x;
1316 it->wd->cur_my = ev->cur.canvas.y;
1320 _mouse_down(void *data,
1321 Evas *evas __UNUSED__,
1325 Elm_Genlist_Item *it = data;
1326 Evas_Event_Mouse_Down *ev = event_info;
1329 if (ev->button != 1) return;
1330 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1332 it->wd->on_hold = EINA_TRUE;
1334 it->down = EINA_TRUE;
1335 it->dragging = EINA_FALSE;
1336 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1337 it->dx = ev->canvas.x - x;
1338 it->dy = ev->canvas.y - y;
1339 it->wd->mouse_down = EINA_TRUE;
1340 if (!it->wd->multitouched)
1342 it->wd->prev_x = ev->canvas.x;
1343 it->wd->prev_y = ev->canvas.y;
1344 it->wd->multi_timeout = EINA_FALSE;
1345 if (it->wd->multi_timer) ecore_timer_del(it->wd->multi_timer);
1346 it->wd->multi_timer = ecore_timer_add(1, _multi_cancel, it->wd);
1348 it->wd->longpressed = EINA_FALSE;
1349 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1350 else it->wd->on_hold = EINA_FALSE;
1351 if (it->wd->on_hold) return;
1352 it->wd->wasselected = it->selected;
1353 _item_highlight(it);
1354 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
1355 if ((!it->disabled) && (!it->display_only))
1357 evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
1358 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
1360 if (it->long_timer) ecore_timer_del(it->long_timer);
1361 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
1362 it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
1364 it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press,
1367 it->long_timer = NULL;
1368 it->wd->swipe = EINA_FALSE;
1369 it->wd->movements = 0;
1373 _mouse_up(void *data,
1374 Evas *evas __UNUSED__,
1375 Evas_Object *obj __UNUSED__,
1378 Elm_Genlist_Item *it = data;
1379 Evas_Event_Mouse_Up *ev = event_info;
1380 Eina_Bool dragged = EINA_FALSE;
1382 if (ev->button != 1) return;
1383 it->down = EINA_FALSE;
1384 it->wd->mouse_down = EINA_FALSE;
1385 if (it->wd->multitouched)
1387 // in single selection modes, some multi touching can make multi highlighted items.
1388 // if a item not selected and highlighted, it should be unhighlighted.
1389 if ((!it->wd->multi) && (!it->selected) && (it->highlighted)) _item_unselect(it);
1390 if (it->wd->multi_down) return;
1391 _multi_touch_gesture_eval(data);
1394 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1395 else it->wd->on_hold = EINA_FALSE;
1398 ecore_timer_del(it->long_timer);
1399 it->long_timer = NULL;
1403 it->dragging = EINA_FALSE;
1404 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
1407 if (it->swipe_timer)
1409 ecore_timer_del(it->swipe_timer);
1410 it->swipe_timer = NULL;
1412 if (it->wd->multi_timer)
1414 ecore_timer_del(it->wd->multi_timer);
1415 it->wd->multi_timer = NULL;
1416 it->wd->multi_timeout = EINA_FALSE;
1418 if (it->wd->on_hold)
1420 if (it->wd->swipe) _swipe(data);
1421 it->wd->longpressed = EINA_FALSE;
1422 it->wd->on_hold = EINA_FALSE;
1425 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
1427 Evas_Coord it_scrl_y = ev->canvas.y - it->wd->reorder_it->dy;
1429 if (it->wd->reorder_rel && (it->wd->reorder_it->parent == it->wd->reorder_rel->parent))
1431 if (it_scrl_y <= it->wd->reorder_rel->scrl_y)
1432 _item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
1434 _item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
1438 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1439 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1441 it->wd->reorder_deleted = EINA_FALSE;
1442 edje_object_signal_emit(it->edit_obj, "elm,action,item,reorder_end", "elm");
1443 it->wd->reorder_it = it->wd->reorder_rel = NULL;
1444 elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
1445 elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_TRUE);
1448 if (it->wd->longpressed)
1450 it->wd->longpressed = EINA_FALSE;
1451 if ((!it->wd->wasselected) && (!it->renamed))
1453 it->wd->wasselected = EINA_FALSE;
1458 if (it->want_unrealize)
1460 _item_unrealize(it, EINA_FALSE);
1461 if (it->block->want_unrealize)
1462 _item_block_unrealize(it->block);
1465 if ((it->disabled) || (dragged) || (it->display_only)) return;
1466 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1471 _item_highlight(it);
1474 else _item_unselect(it);
1480 Widget_Data *wd = it->wd;
1483 while (wd->selected) _item_unselect(wd->selected->data);
1488 const Eina_List *l, *l_next;
1489 Elm_Genlist_Item *it2;
1491 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
1492 if (it2 != it) _item_unselect(it2);
1493 //_item_highlight(it);
1496 _item_highlight(it);
1502 _mouse_down_scroller(void *data,
1503 Evas *evas __UNUSED__,
1504 Evas_Object *obj __UNUSED__,
1505 void *event_info __UNUSED__)
1507 Widget_Data *wd = elm_widget_data_get(data);
1510 wd->drag_started = EINA_FALSE;
1514 _mouse_up_scroller(void *data,
1515 Evas *evas __UNUSED__,
1516 Evas_Object *obj __UNUSED__,
1517 void *event_info __UNUSED__)
1519 Widget_Data *wd = elm_widget_data_get(data);
1522 wd->drag_started = EINA_FALSE;
1526 _mouse_move_scroller(void *data,
1527 Evas *evas __UNUSED__,
1528 Evas_Object *obj __UNUSED__,
1531 Widget_Data *wd = elm_widget_data_get(data);
1532 Evas_Event_Mouse_Move *ev = event_info;
1533 Evas_Coord minw = 0, minh = 0, dx, dy, adx, ady;
1536 if (wd->drag_started) return;
1538 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1539 dx = ev->cur.canvas.x - ev->prev.canvas.x;
1540 dy = ev->cur.canvas.y - ev->prev.canvas.y;
1543 if (adx < 0) adx = -dx;
1544 if (ady < 0) ady = -dy;
1545 if (((ady < minh) && (ady > minh / 2)) && (ady > adx))
1549 evas_object_smart_callback_call(data, SIG_DRAG_START_UP, NULL);
1550 wd->drag_started = EINA_TRUE;
1554 evas_object_smart_callback_call(data, SIG_DRAG_START_DOWN, NULL);
1555 wd->drag_started = EINA_TRUE;
1561 _signal_expand_toggle(void *data,
1562 Evas_Object *obj __UNUSED__,
1563 const char *emission __UNUSED__,
1564 const char *source __UNUSED__)
1566 Elm_Genlist_Item *it = data;
1569 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it);
1571 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it);
1575 _signal_expand(void *data,
1576 Evas_Object *obj __UNUSED__,
1577 const char *emission __UNUSED__,
1578 const char *source __UNUSED__)
1580 Elm_Genlist_Item *it = data;
1583 evas_object_smart_callback_call(WIDGET(it), SIG_EXPAND_REQUEST, it);
1587 _signal_contract(void *data,
1588 Evas_Object *obj __UNUSED__,
1589 const char *emission __UNUSED__,
1590 const char *source __UNUSED__)
1592 Elm_Genlist_Item *it = data;
1595 evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACT_REQUEST, it);
1599 _scr_hold_timer_cb(void *data)
1601 if (!data) return ECORE_CALLBACK_CANCEL;
1602 Widget_Data *wd = data;
1603 elm_smart_scroller_hold_set(wd->scr, EINA_FALSE);
1604 wd->scr_hold_timer = NULL;
1605 return ECORE_CALLBACK_CANCEL;
1609 _mode_finished_signal_cb(void *data,
1611 const char *emission __UNUSED__,
1612 const char *source __UNUSED__)
1616 Elm_Genlist_Item *it = data;
1617 if ((it->delete_me) || (!it->realized) || (!it->mode_view)) return;
1619 Evas *te = evas_object_evas_get(obj);
1621 evas_event_freeze(te);
1622 it->nocache = EINA_FALSE;
1623 _mode_item_unrealize(it);
1625 evas_object_raise(it->VIEW(group_item));
1626 snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished", it->wd->mode_type);
1627 edje_object_signal_callback_del_full(obj, buf, "elm", _mode_finished_signal_cb, it);
1628 evas_event_thaw(te);
1629 evas_event_thaw_eval(te);
1633 _item_cache_clean(Widget_Data *wd)
1635 evas_event_freeze(evas_object_evas_get(wd->obj));
1636 while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max))
1640 itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache);
1641 wd->item_cache = eina_inlist_remove(wd->item_cache,
1642 wd->item_cache->last);
1643 wd->item_cache_count--;
1644 if (itc->spacer) evas_object_del(itc->spacer);
1645 if (itc->base_view) evas_object_del(itc->base_view);
1646 if (itc->item_style) eina_stringshare_del(itc->item_style);
1649 evas_event_thaw(evas_object_evas_get(wd->obj));
1650 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
1654 _item_cache_zero(Widget_Data *wd)
1656 int pmax = wd->item_cache_max;
1657 wd->item_cache_max = 0;
1658 _item_cache_clean(wd);
1659 wd->item_cache_max = pmax;
1663 _item_cache_add(Elm_Genlist_Item *it)
1667 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1668 if (it->wd->item_cache_max <= 0)
1670 evas_object_del(VIEW(it));
1672 evas_object_del(it->spacer);
1674 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1675 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1679 it->wd->item_cache_count++;
1680 itc = calloc(1, sizeof(Item_Cache));
1683 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1684 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1687 it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache,
1688 EINA_INLIST_GET(itc));
1689 itc->spacer = it->spacer;
1691 itc->base_view = VIEW(it);
1693 evas_object_hide(itc->base_view);
1694 evas_object_move(itc->base_view, -9999, -9999);
1695 itc->item_style = eina_stringshare_add(it->itc->item_style);
1696 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
1697 itc->compress = (it->wd->compress);
1698 itc->odd = (it->order_num_in & 0x1);
1699 itc->selected = it->selected;
1700 itc->disabled = it->disabled;
1701 itc->expanded = it->expanded;
1704 ecore_timer_del(it->long_timer);
1705 it->long_timer = NULL;
1707 if (it->swipe_timer)
1709 ecore_timer_del(it->swipe_timer);
1710 it->swipe_timer = NULL;
1712 // FIXME: other callbacks?
1713 edje_object_signal_callback_del_full(itc->base_view,
1714 "elm,action,expand,toggle",
1715 "elm", _signal_expand_toggle, it);
1716 edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand",
1718 _signal_expand, it);
1719 edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract",
1720 "elm", _signal_contract, it);
1721 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_DOWN,
1723 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP,
1725 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_MOVE,
1727 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_DOWN,
1729 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_UP,
1731 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_MOVE,
1733 _item_cache_clean(it->wd);
1734 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1735 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1739 _item_cache_find(Elm_Genlist_Item *it)
1742 Eina_Bool tree = 0, odd;
1744 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
1745 odd = (it->order_num_in & 0x1);
1746 EINA_INLIST_FOREACH(it->wd->item_cache, itc)
1748 if ((itc->selected) || (itc->disabled) || (itc->expanded))
1750 if ((itc->tree == tree) &&
1751 (itc->odd == odd) &&
1752 (itc->compress == it->wd->compress) &&
1753 (!strcmp(it->itc->item_style, itc->item_style)))
1755 it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
1756 EINA_INLIST_GET(itc));
1757 it->wd->item_cache_count--;
1765 _item_cache_free(Item_Cache *itc)
1767 if (itc->spacer) evas_object_del(itc->spacer);
1768 if (itc->base_view) evas_object_del(itc->base_view);
1769 if (itc->item_style) eina_stringshare_del(itc->item_style);
1774 _item_label_hook(Elm_Genlist_Item *it, const char *part)
1776 if (!it->itc->func.label_get) return NULL;
1777 return edje_object_part_text_get(VIEW(it), part);
1781 _icon_focused(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1783 Elm_Genlist_Item *it = data;
1784 if (it) it->defer_unrealize = EINA_TRUE;
1788 _icon_unfocused(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1790 Elm_Genlist_Item *it = data;
1791 if (it) it->defer_unrealize = EINA_FALSE;
1795 _item_del_hook(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1797 Elm_Genlist_Item *it = event_info;
1799 if (it->wd->last_selected_item == it)
1800 it->wd->last_selected_item = NULL;
1804 _item_label_realize(Elm_Genlist_Item *it,
1805 Evas_Object *target,
1809 if (it->itc->func.label_get)
1814 *source = elm_widget_stringlist_get(edje_object_data_get(target, "labels"));
1815 EINA_LIST_FOREACH(*source, l, key)
1817 if (parts && fnmatch(parts, key, FNM_PERIOD))
1820 char *s = it->itc->func.label_get
1821 ((void *)it->base.data, WIDGET(it), key);
1825 edje_object_part_text_set(target, key, s);
1830 edje_object_part_text_set(target, key, "");
1838 _item_icon_unrealize(Elm_Genlist_Item *it,
1839 Evas_Object *target,
1843 Eina_List *res = it->icon_objs;
1845 if (it->itc->func.icon_get)
1849 Evas_Object *ic = NULL;
1851 EINA_LIST_FOREACH(*source, l, key)
1853 if (parts && fnmatch(parts, key, FNM_PERIOD))
1856 ic = edje_object_part_swallow_get(target, key);
1859 res = eina_list_remove(res, ic);
1860 edje_object_part_unswallow(target, ic);
1861 evas_object_del(ic);
1870 _item_icon_realize(Elm_Genlist_Item *it,
1871 Evas_Object *target,
1875 Eina_List *res = NULL;
1877 if (it->itc->func.icon_get)
1882 *source = elm_widget_stringlist_get(edje_object_data_get(target, "icons"));
1883 if (parts && (eina_list_count(*source) != eina_list_count(it->icon_objs)))
1884 res = it->icon_objs;
1885 EINA_LIST_FOREACH(*source, l, key)
1887 if (parts && fnmatch(parts, key, FNM_PERIOD))
1890 Evas_Object *ic = it->itc->func.icon_get
1891 ((void *)it->base.data, WIDGET(it), key);
1895 res = eina_list_append(res, ic);
1896 edje_object_part_swallow(target, key, ic);
1897 evas_object_show(ic);
1898 elm_widget_sub_object_add(WIDGET(it), ic);
1899 evas_object_event_callback_add(ic, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, it);
1901 elm_widget_disabled_set(ic, EINA_TRUE);
1910 _item_state_realize(Elm_Genlist_Item *it,
1911 Evas_Object *target,
1915 if (it->itc->func.state_get)
1921 *source = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
1922 EINA_LIST_FOREACH(*source, l, key)
1924 if (parts && fnmatch(parts, key, FNM_PERIOD))
1927 Eina_Bool on = it->itc->func.state_get
1928 ((void *)it->base.data, WIDGET(it), key);
1932 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
1933 edje_object_signal_emit(target, buf, "elm");
1937 snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
1938 edje_object_signal_emit(target, buf, "elm");
1945 _item_realize(Elm_Genlist_Item *it,
1949 Elm_Genlist_Item *it2;
1950 const char *stacking;
1951 const char *treesize;
1953 int depth, tsize = 20;
1954 Item_Cache *itc = NULL;
1956 if ((it->realized) || (it->delete_me)) return;
1957 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1958 it->order_num_in = in;
1959 if (it->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE) calc = EINA_FALSE;
1960 if ((it->nocache) && (!it->renamed))
1961 it->nocache = EINA_FALSE;
1963 itc = _item_cache_find(it);
1964 if (itc && (!it->wd->effect_mode))
1966 VIEW(it) = itc->base_view;
1967 itc->base_view = NULL;
1968 it->spacer = itc->spacer;
1973 VIEW(it) = edje_object_add(evas_object_evas_get(WIDGET(it)));
1974 edje_object_scale_set(VIEW(it),
1975 elm_widget_scale_get(WIDGET(it)) *
1976 _elm_config->scale);
1977 evas_object_smart_member_add(VIEW(it), it->wd->pan_smart);
1978 elm_widget_sub_object_add(WIDGET(it), VIEW(it));
1980 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS)
1981 strncpy(buf, "tree", sizeof(buf));
1982 else strncpy(buf, "item", sizeof(buf));
1983 if (it->wd->compress)
1984 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
1986 if (in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
1987 strncat(buf, "/", sizeof(buf) - strlen(buf));
1988 strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf));
1990 _elm_theme_object_set(WIDGET(it), VIEW(it), "genlist", buf,
1991 elm_widget_style_get(WIDGET(it)));
1992 edje_object_mirrored_set(VIEW(it),
1993 elm_widget_mirrored_get(WIDGET(it)));
1995 evas_object_rectangle_add(evas_object_evas_get(WIDGET(it)));
1996 evas_object_color_set(it->spacer, 0, 0, 0, 0);
1997 elm_widget_sub_object_add(WIDGET(it), it->spacer);
1999 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
2001 if (it2->parent->flags != ELM_GENLIST_ITEM_GROUP) depth += 1;
2003 it->expanded_depth = depth;
2004 treesize = edje_object_data_get(VIEW(it), "treesize");
2005 if (treesize) tsize = atoi(treesize);
2006 evas_object_size_hint_min_set(it->spacer,
2007 (depth * tsize) * _elm_config->scale, 1);
2008 edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer);
2011 edje_object_signal_callback_add(VIEW(it),
2012 "elm,action,expand,toggle",
2013 "elm", _signal_expand_toggle, it);
2014 edje_object_signal_callback_add(VIEW(it), "elm,action,expand",
2015 "elm", _signal_expand, it);
2016 edje_object_signal_callback_add(VIEW(it), "elm,action,contract",
2017 "elm", _signal_contract, it);
2018 stacking = edje_object_data_get(VIEW(it), "stacking");
2021 if (!strcmp(stacking, "below")) evas_object_lower(VIEW(it));
2022 else if (!strcmp(stacking, "above"))
2023 evas_object_raise(VIEW(it));
2025 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN,
2027 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_UP,
2029 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
2031 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_DOWN,
2033 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_UP,
2035 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MULTI_MOVE,
2038 if ((!it->edit_obj) &&(it->wd->edit_mode) &&
2039 (it->flags != ELM_GENLIST_ITEM_GROUP) && (it->itc->edit_item_style))
2040 _effect_item_realize(it, EINA_FALSE);
2044 if ((it->selected) && (it->selected != itc->selected))
2046 edje_object_signal_emit(VIEW(it),
2047 "elm,state,selected", "elm");
2049 edje_object_signal_emit(it->edit_obj,
2050 "elm,state,selected", "elm");
2052 if ((it->disabled) && (it->disabled != itc->disabled))
2054 edje_object_signal_emit(VIEW(it),
2055 "elm,state,disabled", "elm");
2057 edje_object_signal_emit(it->edit_obj,
2058 "elm,state,disabled", "elm");
2060 if ((it->expanded) && (it->expanded != itc->expanded))
2062 edje_object_signal_emit(VIEW(it),
2063 "elm,state,expanded", "elm");
2065 edje_object_signal_emit(it->edit_obj,
2066 "elm,state,expanded", "elm");
2073 edje_object_signal_emit(VIEW(it),
2074 "elm,state,selected", "elm");
2076 edje_object_signal_emit(it->edit_obj,
2077 "elm,state,selected", "elm");
2081 edje_object_signal_emit(VIEW(it),
2082 "elm,state,disabled", "elm");
2084 edje_object_signal_emit(it->edit_obj,
2085 "elm,state,disabled", "elm");
2089 edje_object_signal_emit(VIEW(it),
2090 "elm,state,expanded", "elm");
2092 edje_object_signal_emit(it->edit_obj,
2093 "elm,state,expanded", "elm");
2098 if ((calc) && (it->wd->homogeneous) &&
2099 ((it->wd->item_width) ||
2100 ((it->wd->item_width) && (it->wd->group_item_width))))
2102 /* homogenous genlist shortcut */
2105 if (it->flags & ELM_GENLIST_ITEM_GROUP)
2107 it->w = it->minw = it->wd->group_item_width;
2108 it->h = it->minh = it->wd->group_item_height;
2112 it->w = it->minw = it->wd->item_width;
2113 it->h = it->minh = it->wd->item_height;
2115 it->mincalcd = EINA_TRUE;
2120 _item_label_realize(it, VIEW(it), &it->labels, NULL);
2121 it->icon_objs = _item_icon_realize(it, VIEW(it), &it->icons, NULL);
2122 _item_state_realize(it, VIEW(it), &it->states, NULL);
2123 if (it->itc->func.icon_get) // for rename mode
2129 edje_object_signal_emit(VIEW(it), "elm,state,rename,enabled", "elm");
2131 elm_widget_stringlist_get(edje_object_data_get(VIEW(it), "renames"));
2132 EINA_LIST_FOREACH(it->icons, l, key)
2134 Evas_Object *ic = it->itc->func.icon_get
2135 ((void *)it->base.data, WIDGET(it), l->data);
2138 it->icon_objs = eina_list_append(it->icon_objs, ic);
2139 edje_object_part_swallow(VIEW(it), key, ic);
2140 evas_object_show(ic);
2141 elm_widget_sub_object_add(WIDGET(it), ic);
2142 // FIXME: if entry calcuates its cursor position correctly and conformant works,
2143 // genlist does not need to handle this focus thing.
2144 evas_object_smart_callback_add(ic, "focused", _icon_focused, it);
2145 evas_object_smart_callback_add(ic, "unfocused", _icon_unfocused, it);
2150 if (!it->mincalcd || it->wd->pan_resize || ((it->wd->height_for_width) && (it->w != it->minw)))
2152 Evas_Coord mw = -1, mh = -1;
2154 if (it->wd->height_for_width) mw = it->wd->w; // TODO: Removed this. This was removed from upstream.
2156 if (!it->display_only)
2157 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2158 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
2159 edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw,
2161 if (!it->display_only)
2162 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2163 it->w = it->minw = mw;
2164 it->h = it->minh = mh;
2165 it->mincalcd = EINA_TRUE;
2167 if ((!it->wd->group_item_width) && (it->flags == ELM_GENLIST_ITEM_GROUP))
2169 it->wd->group_item_width = mw;
2170 it->wd->group_item_height = mh;
2172 else if ((!it->wd->item_width) && (it->flags == ELM_GENLIST_ITEM_NONE))
2174 it->wd->item_width = mw;
2175 it->wd->item_height = mh;
2178 if (!calc) evas_object_show(VIEW(it));
2181 if (it->tooltip.content_cb)
2183 elm_widget_item_tooltip_content_cb_set(it,
2184 it->tooltip.content_cb,
2185 it->tooltip.data, NULL);
2186 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
2189 if (it->mouse_cursor)
2190 elm_widget_item_cursor_set(it, it->mouse_cursor);
2192 it->realized = EINA_TRUE;
2193 it->want_unrealize = EINA_FALSE;
2195 if (itc) _item_cache_free(itc);
2196 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2197 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2199 evas_object_smart_callback_call(WIDGET(it), SIG_REALIZED, it);
2200 if ((!calc) && (it->wd->edit_mode) && (it->flags != ELM_GENLIST_ITEM_GROUP))
2202 if (it->itc->edit_item_style)
2204 if (!it->edit_obj) _effect_item_realize(it, EINA_FALSE);
2205 edje_object_message_signal_process(it->edit_obj);
2208 edje_object_message_signal_process(VIEW(it));
2212 _item_unrealize(Elm_Genlist_Item *it,
2217 if (!it->realized) return;
2218 if (it->wd->reorder_it == it) return;
2219 if (it->defer_unrealize && !it->updateme) return;
2220 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2222 evas_object_smart_callback_call(WIDGET(it), SIG_UNREALIZED, it);
2225 ecore_timer_del(it->long_timer);
2226 it->long_timer = NULL;
2230 evas_object_del(VIEW(it));
2232 evas_object_del(it->spacer);
2237 edje_object_mirrored_set(VIEW(it),
2238 elm_widget_mirrored_get(WIDGET(it)));
2239 edje_object_scale_set(VIEW(it),
2240 elm_widget_scale_get(WIDGET(it))
2241 * _elm_config->scale);
2242 _item_cache_add(it);
2244 elm_widget_stringlist_free(it->labels);
2246 elm_widget_stringlist_free(it->icons);
2248 elm_widget_stringlist_free(it->states);
2250 EINA_LIST_FREE(it->icon_objs, icon)
2251 evas_object_del(icon);
2253 _mode_item_unrealize(it);
2255 it->realized = EINA_FALSE;
2256 it->want_unrealize = EINA_FALSE;
2257 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2258 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2259 if (it->wd->edit_mode) _effect_item_unrealize(it);
2263 _item_block_recalc(Item_Block *itb,
2268 Elm_Genlist_Item *it;
2269 Evas_Coord minw = 0, minh = 0;
2270 Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE;
2273 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2275 EINA_LIST_FOREACH(itb->items, l, it)
2277 if (it->delete_me) continue;
2278 showme |= it->showme;
2283 if (!it->mincalcd) changed = EINA_TRUE;
2286 _item_realize(it, in, EINA_TRUE);
2287 _item_unrealize(it, EINA_TRUE);
2292 _item_realize(it, in, EINA_TRUE);
2293 _item_unrealize(it, EINA_TRUE);
2297 _item_realize(it, in, EINA_FALSE);
2299 if (minw < it->minw) minw = it->minw;
2307 itb->changed = EINA_FALSE;
2308 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2309 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2314 _item_block_realize(Item_Block *itb)
2316 if (itb->realized) return;
2317 itb->realized = EINA_TRUE;
2318 itb->want_unrealize = EINA_FALSE;
2322 _item_block_unrealize(Item_Block *itb)
2325 Elm_Genlist_Item *it;
2326 Eina_Bool dragging = EINA_FALSE;
2328 if (!itb->realized) return;
2329 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2330 EINA_LIST_FOREACH(itb->items, l, it)
2332 if (itb->must_recalc || it->flags != ELM_GENLIST_ITEM_GROUP)
2336 dragging = EINA_TRUE;
2337 it->want_unrealize = EINA_TRUE;
2340 _item_unrealize(it, EINA_FALSE);
2345 itb->realized = EINA_FALSE;
2346 itb->want_unrealize = EINA_TRUE;
2349 itb->want_unrealize = EINA_FALSE;
2350 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2351 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2355 _get_space_for_reorder_item(Elm_Genlist_Item *it)
2357 Evas_Coord rox, roy, row, roh, oy, oh;
2358 Eina_Bool top = EINA_FALSE;
2359 Elm_Genlist_Item *reorder_it = it->wd->reorder_it;
2360 if (!reorder_it) return 0;
2362 evas_object_geometry_get(it->wd->pan_smart, NULL, &oy, NULL, &oh);
2363 evas_object_geometry_get(it->wd->VIEW(reorder_it), &rox, &roy, &row, &roh);
2365 if ((it->wd->reorder_start_y < it->block->y) &&
2366 (roy - oy + (roh / 2) >= it->block->y - it->wd->pan_y))
2368 it->block->reorder_offset = it->wd->reorder_it->h * -1;
2369 if (it->block->count == 1)
2370 it->wd->reorder_rel = it;
2372 else 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;
2378 it->block->reorder_offset = 0;
2380 it->scrl_y += it->block->reorder_offset;
2382 top = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
2383 rox, roy + (roh / 2), row, 1));
2386 it->wd->reorder_rel = it;
2387 it->scrl_y += it->wd->reorder_it->h;
2388 return it->wd->reorder_it->h;
2395 _reorder_move_animator_cb(void *data)
2397 Elm_Genlist_Item *it = data;
2398 Eina_Bool down = EINA_FALSE;
2400 int y, dy = it->h / 10 * _elm_config->scale, diff;
2402 t = ((0.0 > (t = ecore_loop_time_get()-it->wd->start_time)) ? 0.0 : t);
2404 if (t <= REORDER_EFFECT_TIME) y = (1 * sin((t / REORDER_EFFECT_TIME) * (M_PI / 2)) * dy);
2407 diff = abs(it->old_scrl_y - it->scrl_y);
2408 if (diff > it->h) y = diff / 2;
2409 if (it->old_scrl_y < it->scrl_y)
2411 it->old_scrl_y += y;
2414 else if (it->old_scrl_y > it->scrl_y)
2416 it->old_scrl_y -= y;
2421 _item_position(it, it->edit_obj, it->scrl_x, it->old_scrl_y);
2423 _item_position(it, VIEW(it), it->scrl_x, it->old_scrl_y);
2424 _group_items_recalc(it->wd);
2425 if ((it->wd->reorder_pan_move) ||
2426 (down && it->old_scrl_y >= it->scrl_y) ||
2427 (!down && it->old_scrl_y <= it->scrl_y))
2429 it->old_scrl_y = it->scrl_y;
2430 it->move_effect_enabled = EINA_FALSE;
2431 it->wd->reorder_move_animator = NULL;
2432 return ECORE_CALLBACK_CANCEL;
2434 return ECORE_CALLBACK_RENEW;
2438 _item_position(Elm_Genlist_Item *it,
2446 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2447 evas_object_resize(view, it->w, it->h);
2448 evas_object_move(view, it_x, it_y);
2449 evas_object_show(view);
2450 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2451 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2455 _item_block_position(Item_Block *itb,
2459 Elm_Genlist_Item *it;
2460 Elm_Genlist_Item *git;
2461 Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2462 Evas_Coord minh = 0;
2465 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2466 evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh);
2467 evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy,
2469 EINA_LIST_FOREACH(itb->items, l, it)
2471 if (it->delete_me) continue;
2472 else if (it->wd->reorder_it == it) continue;
2477 it->scrl_x = itb->x + it->x - it->wd->pan_x + ox;
2478 it->scrl_y = itb->y + it->y - it->wd->pan_y + oy;
2480 vis = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
2481 cvx, cvy, cvw, cvh));
2482 if (it->flags != ELM_GENLIST_ITEM_GROUP)
2484 if ((itb->realized))
2488 if (!it->realized) _item_realize(it, in, EINA_FALSE);
2495 if (it->wd->reorder_mode)
2496 y += _get_space_for_reorder_item(it);
2497 git = it->group_item;
2500 git->scrl_x = it->scrl_x;
2501 if (git->scrl_y < oy)
2503 if ((git->scrl_y + git->h) > (it->scrl_y + it->h))
2504 git->scrl_y = (it->scrl_y + it->h) - git->h;
2505 git->want_realize = EINA_TRUE;
2507 if ((it->wd->reorder_it) && (it->old_scrl_y != it->scrl_y))
2509 if (!it->move_effect_enabled)
2511 it->move_effect_enabled = EINA_TRUE;
2512 it->wd->reorder_move_animator =
2514 _reorder_move_animator_cb, it);
2517 if (!it->move_effect_enabled)
2518 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))
2520 if (it->wd->edit_mode && it->itc->edit_item_style)
2522 _item_position(it, it->edit_obj, it->scrl_x, it->scrl_y);
2526 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)))
2529 _item_position(it, it->mode_view, it->scrl_x,
2532 _item_position(it, VIEW(it), it->scrl_x,
2537 evas_object_resize(VIEW(it), it->w, it->h);
2538 evas_object_move(VIEW(it), it->scrl_x, it->scrl_y);
2539 evas_object_hide(VIEW(it));
2546 if (!it->dragging && (!it->wd->item_moving_effect_timer)) _item_unrealize(it, EINA_FALSE);
2553 if (vis) it->want_realize = EINA_TRUE;
2555 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))
2557 it->old_scrl_y = it->scrl_y;
2562 if (!itb->wd->reorder_it) itb->minh = minh;
2563 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2564 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2568 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2570 Elm_Genlist_Item *it = data;
2572 it->mincalcd = EINA_FALSE;
2573 it->block->changeme = EINA_TRUE;
2574 if (it->wd->changed_job) ecore_job_del(it->wd->changed_job);
2575 it->wd->changed_job = ecore_job_add(_changed_job, it->wd);
2579 _group_items_recalc(void *data)
2581 Widget_Data *wd = data;
2583 Elm_Genlist_Item *git;
2585 evas_event_freeze(evas_object_evas_get(wd->obj));
2586 EINA_LIST_FOREACH(wd->group_items, l, git)
2588 if (git->want_realize)
2591 _item_realize(git, 0, EINA_FALSE);
2592 evas_object_resize(VIEW(git), wd->minw, git->h);
2593 evas_object_move(VIEW(git), git->scrl_x, git->scrl_y);
2594 evas_object_show(VIEW(git));
2595 evas_object_raise(VIEW(git));
2597 else if (!git->want_realize && git->realized)
2600 _item_unrealize(git, EINA_FALSE);
2603 evas_event_thaw(evas_object_evas_get(wd->obj));
2604 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2608 _must_recalc_idler(void *data)
2610 Widget_Data *wd = data;
2611 if (wd->calc_job) ecore_job_del(wd->calc_job);
2612 wd->calc_job = ecore_job_add(_calc_job, wd);
2613 wd->must_recalc_idler = NULL;
2614 return ECORE_CALLBACK_CANCEL;
2618 _calc_job(void *data)
2620 Widget_Data *wd = data;
2621 Item_Block *itb, *chb = NULL;
2622 Evas_Coord minw = -1, minh = 0, y = 0, ow;
2625 Eina_Bool minw_change = EINA_FALSE;
2626 Eina_Bool did_must_recalc = EINA_FALSE;
2629 t0 = ecore_time_get();
2630 evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h);
2634 evas_event_freeze(evas_object_evas_get(wd->obj));
2635 EINA_INLIST_FOREACH(wd->blocks, itb)
2637 Eina_Bool showme = EINA_FALSE;
2640 showme = itb->showme;
2641 itb->showme = EINA_FALSE;
2644 if (itb->realized) _item_block_unrealize(itb);
2646 if ((itb->changed) || ((itb->must_recalc) && (!did_must_recalc)))
2648 if (itb->must_recalc)
2651 Elm_Genlist_Item *it;
2652 EINA_LIST_FOREACH(itb->items, l, it)
2653 if (it->mincalcd) it->mincalcd = EINA_FALSE;
2654 itb->changed = EINA_TRUE;
2655 if (itb->must_recalc) did_must_recalc = EINA_TRUE;
2656 if (itb->realized) _item_block_unrealize(itb);
2657 itb->must_recalc = EINA_FALSE;
2659 showme = _item_block_recalc(itb, in, EINA_FALSE);
2665 if (minw == -1) minw = itb->minw;
2666 else if ((!itb->must_recalc) && (minw < itb->minw))
2669 minw_change = EINA_TRUE;
2675 if ((showme) && (wd->show_item) && (!wd->show_item->queued))
2677 wd->show_item->showme = EINA_FALSE;
2679 elm_smart_scroller_region_bring_in(wd->scr,
2681 wd->show_item->block->x,
2683 wd->show_item->block->y,
2684 wd->show_item->block->w,
2687 elm_smart_scroller_child_region_show(wd->scr,
2689 wd->show_item->block->x,
2691 wd->show_item->block->y,
2692 wd->show_item->block->w,
2694 wd->show_item = NULL;
2699 EINA_INLIST_FOREACH(wd->blocks, itb)
2705 if ((chb) && (EINA_INLIST_GET(chb)->next))
2707 EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb)
2709 if (itb->realized) _item_block_unrealize(itb);
2712 wd->realminw = minw;
2713 if (minw < wd->w) minw = wd->w;
2714 if ((minw != wd->minw) || (minh != wd->minh))
2718 if (wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE)
2719 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
2720 _sizing_eval(wd->obj);
2722 if ((wd->anchor_item) && (wd->anchor_item->block) && (!wd->auto_scrolled))
2724 Elm_Genlist_Item *it;
2727 it = wd->anchor_item;
2728 it_y = wd->anchor_y;
2729 elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x,
2730 it->block->y + it->y + it_y);
2731 wd->anchor_item = it;
2732 wd->anchor_y = it_y;
2736 t = ecore_time_get();
2737 if (did_must_recalc)
2739 if (!wd->must_recalc_idler)
2740 wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd);
2742 wd->calc_job = NULL;
2743 evas_object_smart_changed(wd->pan_smart);
2744 evas_event_thaw(evas_object_evas_get(wd->obj));
2745 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2749 _update_job(void *data)
2751 Widget_Data *wd = data;
2755 Eina_Bool position = EINA_FALSE, recalc = EINA_FALSE;
2757 wd->update_job = NULL;
2760 evas_event_freeze(evas_object_evas_get(wd->obj));
2761 EINA_INLIST_FOREACH(wd->blocks, itb)
2763 Evas_Coord itminw, itminh;
2764 Elm_Genlist_Item *it;
2770 _item_block_position(itb, num);
2774 recalc = EINA_FALSE;
2775 EINA_LIST_FOREACH(itb->items, l2, it)
2784 _item_unrealize(it, EINA_FALSE);
2785 _item_realize(it, num, EINA_FALSE);
2786 position = EINA_TRUE;
2790 _item_realize(it, num, EINA_TRUE);
2791 _item_unrealize(it, EINA_TRUE);
2793 if ((it->minw != itminw) || (it->minh != itminh))
2795 it->updateme = EINA_FALSE;
2799 itb->updateme = EINA_FALSE;
2802 position = EINA_TRUE;
2803 itb->changed = EINA_TRUE;
2804 _item_block_recalc(itb, num0, EINA_FALSE);
2805 _item_block_position(itb, num0);
2810 if (wd->calc_job) ecore_job_del(wd->calc_job);
2811 wd->calc_job = ecore_job_add(_calc_job, wd);
2813 evas_event_thaw(evas_object_evas_get(wd->obj));
2814 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2818 _changed_job(void *data)
2820 Widget_Data *wd = data; Eina_List *l2;
2822 int num, num0, position = 0;
2823 Eina_Bool width_changed = EINA_FALSE, height_changed = EINA_FALSE;
2825 wd->changed_job = NULL;
2827 EINA_INLIST_FOREACH(wd->blocks, itb)
2829 Evas_Coord itminw, itminh;
2830 Elm_Genlist_Item *it;
2836 _item_block_position(itb, num);
2840 width_changed = height_changed = EINA_FALSE;
2841 EINA_LIST_FOREACH(itb->items, l2, it)
2843 if ((!it->mincalcd) && (it->realized))
2845 Evas_Coord mw = -1, mh = -1;
2849 if (it->wd->height_for_width) mw = it->wd->w;
2850 if (!it->display_only)
2851 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2852 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
2853 edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw, mh);
2854 if (!it->display_only)
2855 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2856 it->w = it->minw = mw;
2857 it->h = it->minh = mh;
2858 it->mincalcd = EINA_TRUE;
2860 //if ((it->minw != itminw) || (it->minh != itminh))
2861 //if ((it->minh != itminh))
2863 if ((it->minw != itminw))
2864 width_changed = EINA_TRUE;
2865 if ((it->minh != itminh))
2866 height_changed = EINA_TRUE;
2868 if ((!it->wd->group_item_width) && (it->flags == ELM_GENLIST_ITEM_GROUP))
2870 it->wd->group_item_width = mw;
2871 it->wd->group_item_height = mh;
2873 else if ((!it->wd->item_width) && (it->flags == ELM_GENLIST_ITEM_NONE))
2875 it->wd->item_width = mw;
2876 it->wd->item_height = mh;
2881 itb->changeme = EINA_FALSE;
2882 // TODO: why this is separated.
2886 itb->changed = EINA_TRUE;
2887 _item_block_recalc(itb, num0, 0);
2888 _item_block_position(itb, num0);
2890 else if (width_changed)
2892 _item_block_position(itb, num0);
2897 if (wd->calc_job) ecore_job_del(wd->calc_job);
2898 wd->calc_job = ecore_job_add(_calc_job, wd);
2903 _pan_set(Evas_Object *obj,
2907 Pan *sd = evas_object_smart_data_get(obj);
2913 // Evas_Coord ow, oh;
2914 // evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2915 // ow = sd->wd->minw - ow;
2916 // if (ow < 0) ow = 0;
2917 // oh = sd->wd->minh - oh;
2918 // if (oh < 0) oh = 0;
2919 // if (x < 0) x = 0;
2920 // if (y < 0) y = 0;
2921 // if (x > ow) x = ow;
2922 // if (y > oh) y = oh;
2923 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
2928 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2930 if ((itb->y + itb->h) > y)
2932 Elm_Genlist_Item *it;
2935 EINA_LIST_FOREACH(itb->items, l2, it)
2937 if ((itb->y + it->y) >= y)
2939 sd->wd->anchor_item = it;
2940 sd->wd->anchor_y = -(itb->y + it->y - y);
2948 if (!sd->wd->reorder_move_animator) evas_object_smart_changed(obj);
2952 _pan_get(Evas_Object *obj,
2956 Pan *sd = evas_object_smart_data_get(obj);
2959 if (x) *x = sd->wd->pan_x;
2960 if (y) *y = sd->wd->pan_y;
2964 _pan_max_get(Evas_Object *obj,
2968 Pan *sd = evas_object_smart_data_get(obj);
2972 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2973 ow = sd->wd->minw - ow;
2975 oh = sd->wd->minh - oh;
2982 _pan_min_get(Evas_Object *obj __UNUSED__,
2991 _pan_child_size_get(Evas_Object *obj,
2995 Pan *sd = evas_object_smart_data_get(obj);
2998 if (w) *w = sd->wd->minw;
2999 if (h) *h = sd->wd->minh;
3003 _pan_add(Evas_Object *obj)
3006 Evas_Object_Smart_Clipped_Data *cd;
3009 cd = evas_object_smart_data_get(obj);
3012 sd->__clipped_data = *cd;
3014 evas_object_smart_data_set(obj, sd);
3018 _pan_del(Evas_Object *obj)
3020 Pan *sd = evas_object_smart_data_get(obj);
3025 ecore_job_del(sd->resize_job);
3026 sd->resize_job = NULL;
3032 _pan_resize_job(void *data)
3036 _sizing_eval(sd->wd->obj);
3037 sd->resize_job = NULL;
3041 _pan_resize(Evas_Object *obj,
3045 Pan *sd = evas_object_smart_data_get(obj);
3049 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
3050 if ((ow == w) && (oh == h)) return;
3051 if ((sd->wd->height_for_width) && (ow != w))
3053 sd->wd->pan_resize = EINA_TRUE;
3054 if (sd->resize_job) ecore_job_del(sd->resize_job);
3055 sd->resize_job = ecore_job_add(_pan_resize_job, sd);
3057 sd->wd->pan_changed = EINA_TRUE;
3058 evas_object_smart_changed(obj);
3059 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
3060 sd->wd->calc_job = NULL;
3064 _pan_calculate(Evas_Object *obj)
3066 Pan *sd = evas_object_smart_data_get(obj);
3068 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
3070 Elm_Genlist_Item *git;
3074 evas_event_freeze(evas_object_evas_get(obj));
3076 if (sd->wd->pan_changed)
3079 sd->wd->pan_changed = EINA_FALSE;
3082 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
3083 sd->wd->prev_viewport_w = ow;
3084 evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
3085 EINA_LIST_FOREACH(sd->wd->group_items, l, git)
3087 git->want_realize = EINA_FALSE;
3089 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
3091 itb->w = sd->wd->minw;
3092 if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox,
3093 itb->y - sd->wd->pan_y + oy,
3095 cvx, cvy, cvw, cvh))
3097 if ((!itb->realized) || (itb->changed))
3098 _item_block_realize(itb);
3099 _item_block_position(itb, in);
3103 if (itb->realized) _item_block_unrealize(itb);
3107 if ((!sd->wd->reorder_it) || (sd->wd->reorder_pan_move))
3108 _group_items_recalc(sd->wd);
3110 if ((sd->wd->reorder_mode) && (sd->wd->reorder_it))
3112 if (sd->wd->pan_y != sd->wd->old_pan_y)
3113 sd->wd->reorder_pan_move = EINA_TRUE;
3114 else sd->wd->reorder_pan_move = EINA_FALSE;
3115 evas_object_raise(sd->wd->reorder_it->edit_obj);
3116 sd->wd->old_pan_y = sd->wd->pan_y;
3117 sd->wd->start_time = ecore_loop_time_get();
3120 if (sd->wd->effect_mode &&
3121 ((sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND) ||
3122 (sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT) ||
3123 (sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE)))
3125 if (!sd->wd->item_moving_effect_timer)
3127 if (sd->wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE)
3128 _item_flip_effect_show(sd->wd->expand_item);
3130 evas_object_raise(sd->wd->alpha_bg);
3131 evas_object_show(sd->wd->alpha_bg);
3132 elm_smart_scroller_bounce_animator_disabled_set(sd->wd->scr, EINA_TRUE);
3133 sd->wd->start_time = current_time_get();
3134 sd->wd->item_moving_effect_timer = ecore_animator_add(_item_moving_effect_timer_cb, sd->wd);
3137 else _item_auto_scroll(sd->wd);
3138 sd->wd->pan_resize = EINA_FALSE;
3139 evas_event_thaw(evas_object_evas_get(obj));
3140 evas_event_thaw_eval(evas_object_evas_get(obj));
3144 _pan_move(Evas_Object *obj,
3145 Evas_Coord x __UNUSED__,
3146 Evas_Coord y __UNUSED__)
3148 Pan *sd = evas_object_smart_data_get(obj);
3152 sd->wd->pan_changed = EINA_TRUE;
3153 evas_object_smart_changed(obj);
3154 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
3155 sd->wd->calc_job = NULL;
3159 _hold_on(void *data __UNUSED__,
3161 void *event_info __UNUSED__)
3163 Widget_Data *wd = elm_widget_data_get(obj);
3165 elm_smart_scroller_hold_set(wd->scr, 1);
3169 _hold_off(void *data __UNUSED__,
3171 void *event_info __UNUSED__)
3173 Widget_Data *wd = elm_widget_data_get(obj);
3175 elm_smart_scroller_hold_set(wd->scr, 0);
3179 _freeze_on(void *data __UNUSED__,
3181 void *event_info __UNUSED__)
3183 Widget_Data *wd = elm_widget_data_get(obj);
3185 elm_smart_scroller_freeze_set(wd->scr, 1);
3189 _freeze_off(void *data __UNUSED__,
3191 void *event_info __UNUSED__)
3193 Widget_Data *wd = elm_widget_data_get(obj);
3195 elm_smart_scroller_freeze_set(wd->scr, 0);
3199 _scr_anim_start(void *data,
3200 Evas_Object *obj __UNUSED__,
3201 void *event_info __UNUSED__)
3203 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL);
3207 _scr_anim_stop(void *data,
3208 Evas_Object *obj __UNUSED__,
3209 void *event_info __UNUSED__)
3211 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL);
3215 _scr_drag_start(void *data,
3216 Evas_Object *obj __UNUSED__,
3217 void *event_info __UNUSED__)
3219 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
3223 _scr_drag_stop(void *data,
3224 Evas_Object *obj __UNUSED__,
3225 void *event_info __UNUSED__)
3227 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
3231 _scroll_edge_left(void *data,
3232 Evas_Object *scr __UNUSED__,
3233 void *event_info __UNUSED__)
3235 Evas_Object *obj = data;
3236 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_LEFT, NULL);
3240 _scroll_edge_right(void *data,
3241 Evas_Object *scr __UNUSED__,
3242 void *event_info __UNUSED__)
3244 Evas_Object *obj = data;
3245 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_RIGHT, NULL);
3249 _scroll_edge_top(void *data,
3250 Evas_Object *scr __UNUSED__,
3251 void *event_info __UNUSED__)
3253 Evas_Object *obj = data;
3254 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_TOP, NULL);
3258 _scroll_edge_bottom(void *data,
3259 Evas_Object *scr __UNUSED__,
3260 void *event_info __UNUSED__)
3262 Evas_Object *obj = data;
3263 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_BOTTOM, NULL);
3267 _mode_item_realize(Elm_Genlist_Item *it)
3271 if ((it->mode_view) || (it->delete_me)) return;
3273 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3274 it->mode_view = edje_object_add(evas_object_evas_get(WIDGET(it)));
3275 edje_object_scale_set(it->mode_view,
3276 elm_widget_scale_get(WIDGET(it)) *
3277 _elm_config->scale);
3278 evas_object_smart_member_add(it->mode_view, it->wd->pan_smart);
3279 elm_widget_sub_object_add(WIDGET(it), it->mode_view);
3281 strncpy(buf, "item", sizeof(buf));
3282 if (it->wd->compress)
3283 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
3285 if (it->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
3286 strncat(buf, "/", sizeof(buf) - strlen(buf));
3287 strncat(buf, it->itc->mode_item_style, sizeof(buf) - strlen(buf));
3289 _elm_theme_object_set(WIDGET(it), it->mode_view, "genlist", buf,
3290 elm_widget_style_get(WIDGET(it)));
3291 edje_object_mirrored_set(it->mode_view,
3292 elm_widget_mirrored_get(WIDGET(it)));
3294 /* signal callback add */
3295 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_DOWN,
3297 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_UP,
3299 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_MOVE,
3302 /* label_get, icon_get, state_get */
3303 _item_label_realize(it, it->mode_view, &it->mode_labels, NULL);
3304 if (it->itc->func.icon_get)
3310 elm_widget_stringlist_get(edje_object_data_get(it->mode_view,
3312 EINA_LIST_FOREACH(it->mode_icons, l, key)
3314 Evas_Object *ic = it->itc->func.icon_get
3315 ((void *)it->base.data, WIDGET(it), l->data);
3319 it->mode_icon_objs = eina_list_append(it->mode_icon_objs, ic);
3320 edje_object_part_swallow(it->mode_view, key, ic);
3321 evas_object_show(ic);
3322 elm_widget_sub_object_add(WIDGET(it), ic);
3324 elm_widget_disabled_set(ic, EINA_TRUE);
3328 _item_state_realize(it, it->mode_view, &it->mode_states, NULL);
3329 edje_object_part_swallow(it->mode_view,
3330 edje_object_data_get(it->mode_view, "mode_part"),
3333 it->want_unrealize = EINA_FALSE;
3334 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3335 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3339 _mode_item_unrealize(Elm_Genlist_Item *it)
3341 Widget_Data *wd = it->wd;
3343 if (!it->mode_view) return;
3345 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3346 elm_widget_stringlist_free(it->mode_labels);
3347 it->mode_labels = NULL;
3348 elm_widget_stringlist_free(it->mode_icons);
3349 it->mode_icons = NULL;
3350 elm_widget_stringlist_free(it->mode_states);
3352 EINA_LIST_FREE(it->mode_icon_objs, icon)
3353 evas_object_del(icon);
3355 edje_object_part_unswallow(it->mode_view, VIEW(it));
3356 evas_object_smart_member_add(VIEW(it), wd->pan_smart);
3357 evas_object_del(it->mode_view);
3358 it->mode_view = NULL;
3360 if (wd->mode_item == it)
3361 wd->mode_item = NULL;
3362 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3363 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3367 _item_mode_set(Elm_Genlist_Item *it)
3370 Widget_Data *wd = it->wd;
3375 it->nocache = EINA_TRUE;
3377 if (wd->scr_hold_timer)
3379 ecore_timer_del(wd->scr_hold_timer);
3380 wd->scr_hold_timer = NULL;
3382 elm_smart_scroller_hold_set(wd->scr, EINA_TRUE);
3383 wd->scr_hold_timer = ecore_timer_add(0.1, _scr_hold_timer_cb, wd);
3385 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3386 _mode_item_realize(it);
3388 evas_object_raise(it->VIEW(group_item));
3389 _item_position(it, it->mode_view, it->scrl_x, it->scrl_y);
3390 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3391 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3393 snprintf(buf, sizeof(buf), "elm,state,%s,active", wd->mode_type);
3394 edje_object_signal_emit(it->mode_view, buf, "elm");
3398 _item_mode_unset(Widget_Data *wd)
3401 if (!wd->mode_item) return;
3402 char buf[1024], buf2[1024];
3403 Elm_Genlist_Item *it;
3406 it->nocache = EINA_TRUE;
3408 snprintf(buf, sizeof(buf), "elm,state,%s,passive", wd->mode_type);
3409 snprintf(buf2, sizeof(buf2), "elm,state,%s,passive,finished", wd->mode_type);
3411 edje_object_signal_emit(it->mode_view, buf, "elm");
3412 edje_object_signal_callback_add(it->mode_view, buf2, "elm", _mode_finished_signal_cb, it);
3414 wd->mode_item = NULL;
3419 _item_auto_scroll(void *data)
3421 Widget_Data *wd = data;
3424 if ((wd->expand_item) && (!wd->auto_scrolled))
3426 Elm_Genlist_Item *it;
3428 Evas_Coord ox, oy, ow, oh;
3429 evas_object_geometry_get(wd->obj, &ox, &oy, &ow, &oh);
3431 wd->auto_scrolled = EINA_TRUE;
3432 if (wd->expand_item->scrl_y > (oh + oy) / 2)
3434 EINA_LIST_FOREACH(wd->expand_item->items, l, it)
3436 elm_genlist_item_bring_in(it);
3442 elm_genlist_add(Evas_Object *parent)
3447 Evas_Coord minw, minh;
3448 static Evas_Smart *smart = NULL;
3452 static Evas_Smart_Class sc;
3454 evas_object_smart_clipped_smart_set(&_pan_sc);
3456 sc.name = "elm_genlist_pan";
3457 sc.version = EVAS_SMART_CLASS_VERSION;
3460 sc.resize = _pan_resize;
3461 sc.move = _pan_move;
3462 sc.calculate = _pan_calculate;
3463 if (!(smart = evas_smart_class_new(&sc))) return NULL;
3466 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
3468 ELM_SET_WIDTYPE(widtype, "genlist");
3469 elm_widget_type_set(obj, "genlist");
3470 elm_widget_sub_object_add(parent, obj);
3471 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
3472 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
3473 elm_widget_data_set(obj, wd);
3474 elm_widget_del_hook_set(obj, _del_hook);
3475 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
3476 elm_widget_theme_hook_set(obj, _theme_hook);
3477 elm_widget_can_focus_set(obj, EINA_TRUE);
3478 elm_widget_event_hook_set(obj, _event_hook);
3479 elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
3480 elm_widget_translate_hook_set(obj, _translate_hook);
3482 wd->scr = elm_smart_scroller_add(e);
3483 evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_MOUSE_DOWN,
3484 _mouse_down_scroller, obj);
3485 evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_MOUSE_UP,
3486 _mouse_up_scroller, obj);
3487 evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_MOUSE_MOVE,
3488 _mouse_move_scroller, obj);
3489 elm_smart_scroller_widget_set(wd->scr, obj);
3490 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
3491 elm_widget_style_get(obj));
3492 elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE,
3493 _elm_config->thumbscroll_bounce_enable);
3494 elm_widget_resize_object_set(obj, wd->scr);
3496 evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj);
3497 evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, obj);
3498 evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj);
3499 evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj);
3500 evas_object_smart_callback_add(wd->scr, "edge,left", _scroll_edge_left, obj);
3501 evas_object_smart_callback_add(wd->scr, "edge,right", _scroll_edge_right,
3503 evas_object_smart_callback_add(wd->scr, "edge,top", _scroll_edge_top, obj);
3504 evas_object_smart_callback_add(wd->scr, "edge,bottom", _scroll_edge_bottom,
3508 wd->mode = ELM_LIST_SCROLL;
3509 wd->max_items_per_block = MAX_ITEMS_PER_BLOCK;
3510 wd->item_cache_max = wd->max_items_per_block * 2;
3511 wd->longpress_timeout = _elm_config->longpress_timeout;
3512 wd->effect_mode = _elm_config->effect_enable;
3514 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
3515 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
3516 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
3517 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
3519 wd->pan_smart = evas_object_smart_add(e, smart);
3520 wd->pan = evas_object_smart_data_get(wd->pan_smart);
3523 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
3524 _pan_set, _pan_get, _pan_max_get,
3525 _pan_min_get, _pan_child_size_get);
3527 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
3529 evas_object_size_hint_min_set(obj, minw, minh);
3531 evas_object_smart_callbacks_descriptions_set(obj, _signals);
3532 _mirrored_set(obj, elm_widget_mirrored_get(obj));
3537 static Elm_Genlist_Item *
3538 _item_new(Widget_Data *wd,
3539 const Elm_Genlist_Item_Class *itc,
3541 Elm_Genlist_Item *parent,
3542 Elm_Genlist_Item_Flags flags,
3544 const void *func_data)
3546 Elm_Genlist_Item *it;
3548 it = elm_widget_item_new(wd->obj, Elm_Genlist_Item);
3549 if (!it) return NULL;
3552 it->base.data = data;
3553 it->parent = parent;
3555 it->func.func = func;
3556 it->func.data = func_data;
3557 it->mouse_cursor = NULL;
3558 it->expanded_depth = 0;
3559 elm_widget_item_text_get_hook_set(it, _item_label_hook);
3560 elm_widget_item_del_cb_set(it, _item_del_hook);
3564 if (it->parent->flags & ELM_GENLIST_ITEM_GROUP)
3565 it->group_item = parent;
3566 else if (it->parent->group_item)
3567 it->group_item = it->parent->group_item;
3573 _item_block_add(Widget_Data *wd,
3574 Elm_Genlist_Item *it)
3576 Item_Block *itb = NULL;
3583 itb = calloc(1, sizeof(Item_Block));
3586 if (!it->rel->block)
3589 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3590 itb->items = eina_list_append(itb->items, it);
3596 wd->blocks = eina_inlist_prepend_relative
3597 (wd->blocks, EINA_INLIST_GET(itb),
3598 EINA_INLIST_GET(it->rel->block));
3600 eina_list_prepend_relative(itb->items, it, it->rel);
3604 wd->blocks = eina_inlist_append_relative
3605 (wd->blocks, EINA_INLIST_GET(itb),
3606 EINA_INLIST_GET(it->rel->block));
3608 eina_list_append_relative(itb->items, it, it->rel);
3618 itb = (Item_Block *)(wd->blocks);
3619 if (itb->count >= wd->max_items_per_block)
3621 itb = calloc(1, sizeof(Item_Block));
3625 eina_inlist_prepend(wd->blocks,
3626 EINA_INLIST_GET(itb));
3631 itb = calloc(1, sizeof(Item_Block));
3635 eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
3637 itb->items = eina_list_prepend(itb->items, it);
3643 itb = (Item_Block *)(wd->blocks->last);
3644 if (itb->count >= wd->max_items_per_block)
3646 itb = calloc(1, sizeof(Item_Block));
3650 eina_inlist_append(wd->blocks,
3651 EINA_INLIST_GET(itb));
3656 itb = calloc(1, sizeof(Item_Block));
3660 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3662 itb->items = eina_list_append(itb->items, it);
3668 itb = it->rel->block;
3669 if (!itb) goto newblock;
3671 itb->items = eina_list_prepend_relative(itb->items, it, it->rel);
3673 itb->items = eina_list_append_relative(itb->items, it, it->rel);
3676 itb->changed = EINA_TRUE;
3678 if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job);
3679 itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd);
3682 it->rel->relcount--;
3683 if ((it->rel->delete_me) && (!it->rel->relcount))
3687 if (itb->count > itb->wd->max_items_per_block)
3691 Elm_Genlist_Item *it2;
3693 newc = itb->count / 2;
3694 itb2 = calloc(1, sizeof(Item_Block));
3698 eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
3699 EINA_INLIST_GET(itb));
3700 itb2->changed = EINA_TRUE;
3701 while ((itb->count > newc) && (itb->items))
3705 l = eina_list_last(itb->items);
3707 itb->items = eina_list_remove_list(itb->items, l);
3710 itb2->items = eina_list_prepend(itb2->items, it2);
3718 _queue_process(Widget_Data *wd)
3721 Eina_Bool showme = EINA_FALSE;
3724 t0 = ecore_time_get();
3725 //evas_event_freeze(evas_object_evas_get(wd->obj));
3726 for (n = 0; (wd->queue) && (n < 128); n++)
3728 Elm_Genlist_Item *it;
3730 it = wd->queue->data;
3731 wd->queue = eina_list_remove_list(wd->queue, wd->queue);
3732 it->queued = EINA_FALSE;
3733 _item_block_add(wd, it);
3734 t = ecore_time_get();
3735 if (it->block->changed)
3737 showme = _item_block_recalc(it->block, it->block->num, EINA_TRUE);
3738 it->block->changed = 0;
3741 if (wd->calc_job) ecore_job_del(wd->calc_job);
3742 wd->calc_job = NULL;
3744 wd->pan_changed = EINA_FALSE;
3747 if (showme) it->block->showme = EINA_TRUE;
3748 if (eina_inlist_count(wd->blocks) > 1)
3750 if ((t - t0) > (ecore_animator_frametime_get())) break;
3753 //evas_event_thaw(evas_object_evas_get(wd->obj));
3754 //evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3759 _idle_process(void *data, Eina_Bool *wakeup)
3761 Widget_Data *wd = data;
3764 //static double q_start = 0.0;
3765 //if (q_start == 0.0) q_start = ecore_time_get();
3767 if (_queue_process(wd) > 0) *wakeup = EINA_TRUE;
3771 //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start);
3773 return ECORE_CALLBACK_CANCEL;
3775 return ECORE_CALLBACK_RENEW;
3779 _item_idle_enterer(void *data)
3781 Widget_Data *wd = data;
3782 Eina_Bool wakeup = EINA_FALSE;
3783 Eina_Bool ok = _idle_process(data, &wakeup);
3788 if (wd->calc_job) ecore_job_del(wd->calc_job);
3789 wd->calc_job = ecore_job_add(_calc_job, wd);
3791 if (ok == ECORE_CALLBACK_CANCEL) wd->queue_idle_enterer = NULL;
3796 _item_queue(Widget_Data *wd,
3797 Elm_Genlist_Item *it)
3799 if (it->queued) return;
3800 it->queued = EINA_TRUE;
3801 wd->queue = eina_list_append(wd->queue, it);
3802 // FIXME: why does a freeze then thaw here cause some genlist
3803 // elm_genlist_item_append() to be much much slower?
3804 // evas_event_freeze(evas_object_evas_get(wd->obj));
3805 while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
3807 if (wd->queue_idle_enterer)
3809 ecore_idle_enterer_del(wd->queue_idle_enterer);
3810 wd->queue_idle_enterer = NULL;
3814 // evas_event_thaw(evas_object_evas_get(wd->obj));
3815 // evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3816 if (!wd->queue_idle_enterer)
3817 wd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, wd);
3821 _item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after)
3826 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3827 it->wd->reorder_deleted = EINA_TRUE;
3828 _item_block_del(it);
3830 it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
3832 it->rel->relcount++;
3833 it->before = EINA_FALSE;
3834 if (after->group_item) it->group_item = after->group_item;
3835 _item_queue(it->wd, it);
3837 // TODO: change this to smart callback
3838 if (it->itc->func.moved)
3839 it->itc->func.moved(WIDGET(it), it, after, EINA_TRUE);
3843 _item_move_before(Elm_Genlist_Item *it, Elm_Genlist_Item *before)
3846 if (!before) return;
3848 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3849 it->wd->reorder_deleted = EINA_TRUE;
3850 _item_block_del(it);
3851 it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
3853 it->rel->relcount++;
3854 it->before = EINA_TRUE;
3855 if (before->group_item) it->group_item = before->group_item;
3856 _item_queue(it->wd, it);
3858 // TODO: change this to smart callback
3859 if (it->itc->func.moved)
3860 it->itc->func.moved(WIDGET(it), it, before, EINA_FALSE);
3863 EAPI Elm_Genlist_Item *
3864 elm_genlist_item_append(Evas_Object *obj,
3865 const Elm_Genlist_Item_Class *itc,
3867 Elm_Genlist_Item *parent,
3868 Elm_Genlist_Item_Flags flags,
3870 const void *func_data)
3872 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3873 Widget_Data *wd = elm_widget_data_get(obj);
3874 if (!wd) return NULL;
3875 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3877 if (!it) return NULL;
3880 if (flags & ELM_GENLIST_ITEM_GROUP)
3881 wd->group_items = eina_list_append(wd->group_items, it);
3882 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
3887 Elm_Genlist_Item *it2 = NULL;
3888 Eina_List *ll = eina_list_last(it->parent->items);
3889 if (ll) it2 = ll->data;
3890 it->parent->items = eina_list_append(it->parent->items, it);
3891 if (!it2) it2 = it->parent;
3893 it2 = elm_genlist_item_prev_get(it2);
3895 eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3896 EINA_INLIST_GET(it2));
3898 it->rel->relcount++;
3900 it->before = EINA_FALSE;
3901 _item_queue(wd, it);
3905 EAPI Elm_Genlist_Item *
3906 elm_genlist_item_prepend(Evas_Object *obj,
3907 const Elm_Genlist_Item_Class *itc,
3909 Elm_Genlist_Item *parent,
3910 Elm_Genlist_Item_Flags flags,
3912 const void *func_data)
3914 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3915 Widget_Data *wd = elm_widget_data_get(obj);
3916 if (!wd) return NULL;
3917 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3920 if (!it) return NULL;
3923 if (flags & ELM_GENLIST_ITEM_GROUP)
3924 wd->group_items = eina_list_prepend(wd->group_items, it);
3925 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
3930 Elm_Genlist_Item *it2 = NULL;
3931 Eina_List *ll = it->parent->items;
3932 if (ll) it2 = ll->data;
3933 it->parent->items = eina_list_prepend(it->parent->items, it);
3934 if (!it2) it2 = it->parent;
3936 it2 = elm_genlist_item_next_get(it2);
3938 eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3939 EINA_INLIST_GET(it2));
3941 it->rel->relcount++;
3943 it->before = EINA_TRUE;
3944 _item_queue(wd, it);
3948 EAPI Elm_Genlist_Item *
3949 elm_genlist_item_insert_after(Evas_Object *obj,
3950 const Elm_Genlist_Item_Class *itc,
3952 Elm_Genlist_Item *parent,
3953 Elm_Genlist_Item *after,
3954 Elm_Genlist_Item_Flags flags,
3956 const void *func_data)
3958 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3959 EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
3960 Widget_Data *wd = elm_widget_data_get(obj);
3961 if (!wd) return NULL;
3962 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3963 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3965 if (!it) return NULL;
3969 if ((flags & ELM_GENLIST_ITEM_GROUP) &&
3970 (after->flags & ELM_GENLIST_ITEM_GROUP))
3971 wd->group_items = eina_list_append_relative(wd->group_items, it,
3976 it->parent->items = eina_list_append_relative(it->parent->items, it,
3979 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3980 EINA_INLIST_GET(after));
3982 it->rel->relcount++;
3983 it->before = EINA_FALSE;
3984 _item_queue(wd, it);
3988 EAPI Elm_Genlist_Item *
3989 elm_genlist_item_insert_before(Evas_Object *obj,
3990 const Elm_Genlist_Item_Class *itc,
3992 Elm_Genlist_Item *parent,
3993 Elm_Genlist_Item *before,
3994 Elm_Genlist_Item_Flags flags,
3996 const void *func_data)
3998 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3999 EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
4000 Widget_Data *wd = elm_widget_data_get(obj);
4001 if (!wd) return NULL;
4002 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
4003 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
4005 if (!it) return NULL;
4009 if ((flags & ELM_GENLIST_ITEM_GROUP) &&
4010 (before->flags & ELM_GENLIST_ITEM_GROUP))
4011 wd->group_items = eina_list_prepend_relative(wd->group_items, it,
4016 it->parent->items = eina_list_prepend_relative(it->parent->items, it,
4019 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
4020 EINA_INLIST_GET(before));
4022 it->rel->relcount++;
4023 it->before = EINA_TRUE;
4024 _item_queue(wd, it);
4029 elm_genlist_clear(Evas_Object *obj)
4031 ELM_CHECK_WIDTYPE(obj, widtype);
4032 Widget_Data *wd = elm_widget_data_get(obj);
4034 if (wd->walking > 0)
4036 Elm_Genlist_Item *it;
4038 wd->clear_me = EINA_TRUE;
4039 EINA_INLIST_FOREACH(wd->items, it)
4041 it->delete_me = EINA_TRUE;
4045 evas_event_freeze(evas_object_evas_get(wd->obj));
4048 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
4049 it->nocache = EINA_TRUE;
4050 it->highlighted = EINA_FALSE;
4052 if (wd->anchor_item == it)
4054 wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
4055 if (!wd->anchor_item)
4057 ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
4060 wd->items = eina_inlist_remove(wd->items, wd->items);
4061 if (it->flags & ELM_GENLIST_ITEM_GROUP)
4062 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
4063 elm_widget_item_pre_notify_del(it);
4064 if (it->realized) _item_unrealize(it, EINA_FALSE);
4065 if (((wd->clear_me) || (!it->delete_me)) && (it->itc->func.del))
4066 it->itc->func.del((void *)it->base.data, WIDGET(it));
4067 if (it->long_timer) ecore_timer_del(it->long_timer);
4068 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
4069 elm_widget_item_del(it);
4071 wd->clear_me = EINA_FALSE;
4072 wd->anchor_item = NULL;
4075 Item_Block *itb = (Item_Block *)(wd->blocks);
4077 wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
4078 if (itb->items) eina_list_free(itb->items);
4081 wd->pan_changed = EINA_TRUE;
4084 ecore_job_del(wd->calc_job);
4085 wd->calc_job = NULL;
4087 if (wd->queue_idle_enterer)
4089 ecore_idle_enterer_del(wd->queue_idle_enterer);
4090 wd->queue_idle_enterer = NULL;
4092 if (wd->must_recalc_idler)
4094 ecore_idler_del(wd->must_recalc_idler);
4095 wd->must_recalc_idler = NULL;
4099 eina_list_free(wd->queue);
4104 eina_list_free(wd->selected);
4105 wd->selected = NULL;
4107 if (wd->reorder_move_animator)
4109 ecore_animator_del(wd->reorder_move_animator);
4110 wd->reorder_move_animator = NULL;
4112 wd->show_item = NULL;
4120 evas_object_del(wd->alpha_bg);
4121 wd->alpha_bg = NULL;
4125 evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
4126 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
4129 elm_smart_scroller_child_region_show(wd->scr, 0, 0, 0, 0);
4130 evas_event_thaw(evas_object_evas_get(wd->obj));
4131 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
4135 elm_genlist_multi_select_set(Evas_Object *obj,
4138 ELM_CHECK_WIDTYPE(obj, widtype);
4139 Widget_Data *wd = elm_widget_data_get(obj);
4145 elm_genlist_multi_select_get(const Evas_Object *obj)
4147 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4148 Widget_Data *wd = elm_widget_data_get(obj);
4149 if (!wd) return EINA_FALSE;
4153 EAPI Elm_Genlist_Item *
4154 elm_genlist_selected_item_get(const Evas_Object *obj)
4156 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4157 Widget_Data *wd = elm_widget_data_get(obj);
4158 if (!wd) return NULL;
4159 if (wd->selected) return wd->selected->data;
4163 EAPI const Eina_List *
4164 elm_genlist_selected_items_get(const Evas_Object *obj)
4166 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4167 Widget_Data *wd = elm_widget_data_get(obj);
4168 if (!wd) return NULL;
4169 return wd->selected;
4173 elm_genlist_realized_items_get(const Evas_Object *obj)
4175 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4176 Widget_Data *wd = elm_widget_data_get(obj);
4177 Eina_List *list = NULL;
4179 Eina_Bool done = EINA_FALSE;
4180 if (!wd) return NULL;
4181 EINA_INLIST_FOREACH(wd->blocks, itb)
4186 Elm_Genlist_Item *it;
4189 EINA_LIST_FOREACH(itb->items, l, it)
4191 if (it->realized) list = eina_list_append(list, it);
4202 EAPI Elm_Genlist_Item *
4203 elm_genlist_at_xy_item_get(const Evas_Object *obj,
4208 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4209 Widget_Data *wd = elm_widget_data_get(obj);
4210 Evas_Coord ox, oy, ow, oh;
4213 if (!wd) return NULL;
4214 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
4216 EINA_INLIST_FOREACH(wd->blocks, itb)
4219 Elm_Genlist_Item *it;
4221 if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
4222 oy + itb->y - itb->wd->pan_y,
4223 itb->w, itb->h, x, y, 1, 1))
4225 EINA_LIST_FOREACH(itb->items, l, it)
4227 Evas_Coord itx, ity;
4229 itx = ox + itb->x + it->x - itb->wd->pan_x;
4230 ity = oy + itb->y + it->y - itb->wd->pan_y;
4231 if (ELM_RECTS_INTERSECT(itx, ity, it->w, it->h, x, y, 1, 1))
4235 if (y <= (ity + (it->h / 4))) *posret = -1;
4236 else if (y >= (ity + it->h - (it->h / 4)))
4242 lasty = ity + it->h;
4247 if (y > lasty) *posret = 1;
4253 EAPI Elm_Genlist_Item *
4254 elm_genlist_first_item_get(const Evas_Object *obj)
4256 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4257 Widget_Data *wd = elm_widget_data_get(obj);
4258 if (!wd) return NULL;
4259 if (!wd->items) return NULL;
4260 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
4261 while ((it) && (it->delete_me))
4262 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
4266 EAPI Elm_Genlist_Item *
4267 elm_genlist_last_item_get(const Evas_Object *obj)
4269 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4270 Widget_Data *wd = elm_widget_data_get(obj);
4271 if (!wd) return NULL;
4272 if (!wd->items) return NULL;
4273 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
4274 while ((it) && (it->delete_me))
4275 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
4279 EAPI Elm_Genlist_Item *
4280 elm_genlist_item_next_get(const Elm_Genlist_Item *it)
4282 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4285 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
4286 if ((it) && (!it->delete_me)) break;
4288 return (Elm_Genlist_Item *)it;
4291 EAPI Elm_Genlist_Item *
4292 elm_genlist_item_prev_get(const Elm_Genlist_Item *it)
4294 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4297 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
4298 if ((it) && (!it->delete_me)) break;
4300 return (Elm_Genlist_Item *)it;
4304 elm_genlist_item_genlist_get(const Elm_Genlist_Item *it)
4306 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4310 EAPI Elm_Genlist_Item *
4311 elm_genlist_item_parent_get(const Elm_Genlist_Item *it)
4313 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4318 elm_genlist_item_subitems_clear(Elm_Genlist_Item *it)
4320 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4321 Widget_Data *wd = elm_widget_data_get(WIDGET(it));
4323 Elm_Genlist_Item *it2;
4326 if (!it->wd->effect_mode || !it->wd->move_effect_mode)
4327 _item_subitems_clear(it);
4330 if ((!it->wd->item_moving_effect_timer) && (it->flags != ELM_GENLIST_ITEM_GROUP) &&
4331 it->wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE )
4333 it->wd->expand_item = it;
4334 _item_flip_effect_show(it);
4335 evas_object_geometry_get(VIEW(it), NULL, &y, NULL, &h);
4336 it->wd->expand_item_end = y + h;
4340 it2 = elm_genlist_item_next_get(it2);
4342 } while (it2->expanded_depth > it->expanded_depth);
4346 evas_output_viewport_get(evas_object_evas_get(wd->pan_smart), NULL, &vy, NULL, &vh);
4347 it2->old_scrl_y = ((it2->old_scrl_y > vy + vh) ? vy + vh : it2->old_scrl_y);
4348 it->wd->expand_item_gap = it->wd->expand_item_end - it2->old_scrl_y;
4351 it->wd->expand_item_gap = 0;
4353 evas_object_raise(it->wd->alpha_bg);
4354 evas_object_show(it->wd->alpha_bg);
4356 it->wd->start_time = current_time_get();
4357 it->wd->item_moving_effect_timer = ecore_animator_add(_item_moving_effect_timer_cb, it->wd);
4360 _item_subitems_clear(it);
4365 elm_genlist_item_selected_set(Elm_Genlist_Item *it,
4368 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4369 Widget_Data *wd = elm_widget_data_get(WIDGET(it));
4371 if ((it->delete_me) || (it->disabled)) return;
4372 selected = !!selected;
4373 if (it->selected == selected) return;
4379 while (wd->selected)
4380 _item_unselect(wd->selected->data);
4382 _item_highlight(it);
4390 elm_genlist_item_selected_get(const Elm_Genlist_Item *it)
4392 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4393 return it->selected;
4397 elm_genlist_item_expanded_set(Elm_Genlist_Item *it,
4400 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4401 if (it->flags != ELM_GENLIST_ITEM_SUBITEMS) return;
4402 if (it->expanded == expanded) return;
4403 it->expanded = expanded;
4404 it->wd->expand_item = it;
4406 if (it->wd->effect_mode && !it->wd->alpha_bg)
4407 it->wd->alpha_bg = _create_tray_alpha_bg(WIDGET(it));
4411 it->wd->auto_scrolled = EINA_FALSE;
4412 it->wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND;
4414 edje_object_signal_emit(VIEW(it), "elm,state,expanded", "elm");
4415 evas_object_smart_callback_call(WIDGET(it), "expanded", it);
4419 it->wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT;
4421 edje_object_signal_emit(VIEW(it), "elm,state,contracted", "elm");
4422 evas_object_smart_callback_call(WIDGET(it), "contracted", it);
4427 elm_genlist_item_expanded_get(const Elm_Genlist_Item *it)
4429 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4430 return it->expanded;
4434 elm_genlist_item_expanded_depth_get(const Elm_Genlist_Item *it)
4436 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, 0);
4437 return it->expanded_depth;
4441 elm_genlist_item_disabled_set(Elm_Genlist_Item *it,
4444 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4447 if (it->disabled == disabled) return;
4448 if (it->delete_me) return;
4449 it->disabled = !!disabled;
4451 elm_genlist_item_selected_set(it, EINA_FALSE);
4456 edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
4458 edje_object_signal_emit(it->edit_obj, "elm,state,disabled", "elm");
4462 edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm");
4464 edje_object_signal_emit(it->edit_obj, "elm,state,enabled", "elm");
4466 EINA_LIST_FOREACH(it->icon_objs, l, obj)
4467 elm_widget_disabled_set(obj, disabled);
4472 elm_genlist_item_disabled_get(const Elm_Genlist_Item *it)
4474 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4475 if (it->delete_me) return EINA_FALSE;
4476 return it->disabled;
4480 elm_genlist_item_display_only_set(Elm_Genlist_Item *it,
4481 Eina_Bool display_only)
4483 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4484 if (it->display_only == display_only) return;
4485 if (it->delete_me) return;
4486 it->display_only = display_only;
4487 it->mincalcd = EINA_FALSE;
4488 it->updateme = EINA_TRUE;
4489 if (it->block) it->block->updateme = EINA_TRUE;
4490 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4491 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4495 elm_genlist_item_display_only_get(const Elm_Genlist_Item *it)
4497 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4498 if (it->delete_me) return EINA_FALSE;
4499 return it->display_only;
4503 elm_genlist_item_show(Elm_Genlist_Item *it)
4505 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4506 Evas_Coord gith = 0;
4507 if (it->delete_me) return;
4508 if ((it->queued) || (!it->mincalcd))
4510 it->wd->show_item = it;
4511 it->wd->bring_in = EINA_TRUE;
4512 it->showme = EINA_TRUE;
4515 if (it->wd->show_item)
4517 it->wd->show_item->showme = EINA_FALSE;
4518 it->wd->show_item = NULL;
4520 if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
4521 gith = it->group_item->h;
4522 elm_smart_scroller_child_region_show(it->wd->scr,
4523 it->x + it->block->x,
4524 it->y + it->block->y - gith,
4525 it->block->w, it->h);
4529 elm_genlist_item_bring_in(Elm_Genlist_Item *it)
4531 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4532 Evas_Coord gith = 0;
4533 if (it->delete_me) return;
4534 if ((it->queued) || (!it->mincalcd))
4536 it->wd->show_item = it;
4537 it->wd->bring_in = EINA_TRUE;
4538 it->showme = EINA_TRUE;
4541 if (it->wd->show_item)
4543 it->wd->show_item->showme = EINA_FALSE;
4544 it->wd->show_item = NULL;
4546 if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
4547 gith = it->group_item->h;
4548 elm_smart_scroller_region_bring_in(it->wd->scr,
4549 it->x + it->block->x,
4550 it->y + it->block->y - gith,
4551 it->block->w, it->h);
4555 elm_genlist_item_top_show(Elm_Genlist_Item *it)
4557 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4559 Evas_Coord gith = 0;
4561 if (it->delete_me) return;
4562 if ((it->queued) || (!it->mincalcd))
4564 it->wd->show_item = it;
4565 it->wd->bring_in = EINA_TRUE;
4566 it->showme = EINA_TRUE;
4569 if (it->wd->show_item)
4571 it->wd->show_item->showme = EINA_FALSE;
4572 it->wd->show_item = NULL;
4574 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4575 if (it->group_item) gith = it->group_item->h;
4576 elm_smart_scroller_child_region_show(it->wd->scr,
4577 it->x + it->block->x,
4578 it->y + it->block->y - gith,
4583 elm_genlist_item_top_bring_in(Elm_Genlist_Item *it)
4585 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4587 Evas_Coord gith = 0;
4589 if (it->delete_me) return;
4590 if ((it->queued) || (!it->mincalcd))
4592 it->wd->show_item = it;
4593 it->wd->bring_in = EINA_TRUE;
4594 it->showme = EINA_TRUE;
4597 if (it->wd->show_item)
4599 it->wd->show_item->showme = EINA_FALSE;
4600 it->wd->show_item = NULL;
4602 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4603 if (it->group_item) gith = it->group_item->h;
4604 elm_smart_scroller_region_bring_in(it->wd->scr,
4605 it->x + it->block->x,
4606 it->y + it->block->y - gith,
4611 elm_genlist_item_middle_show(Elm_Genlist_Item *it)
4613 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4616 if (it->delete_me) return;
4617 if ((it->queued) || (!it->mincalcd))
4619 it->wd->show_item = it;
4620 it->wd->bring_in = EINA_TRUE;
4621 it->showme = EINA_TRUE;
4624 if (it->wd->show_item)
4626 it->wd->show_item->showme = EINA_FALSE;
4627 it->wd->show_item = NULL;
4629 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4630 elm_smart_scroller_child_region_show(it->wd->scr,
4631 it->x + it->block->x,
4632 it->y + it->block->y - oh / 2 +
4633 it->h / 2, it->block->w, oh);
4637 elm_genlist_item_middle_bring_in(Elm_Genlist_Item *it)
4639 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4642 if (it->delete_me) return;
4643 if ((it->queued) || (!it->mincalcd))
4645 it->wd->show_item = it;
4646 it->wd->bring_in = EINA_TRUE;
4647 it->showme = EINA_TRUE;
4650 if (it->wd->show_item)
4652 it->wd->show_item->showme = EINA_FALSE;
4653 it->wd->show_item = NULL;
4655 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4656 elm_smart_scroller_region_bring_in(it->wd->scr,
4657 it->x + it->block->x,
4658 it->y + it->block->y - oh / 2 + it->h / 2,
4663 elm_genlist_item_del(Elm_Genlist_Item *it)
4665 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4666 if ((it->relcount > 0) || (it->walking > 0))
4668 elm_widget_item_pre_notify_del(it);
4669 elm_genlist_item_subitems_clear(it);
4670 it->delete_me = EINA_TRUE;
4671 if (it->wd->show_item == it) it->wd->show_item = NULL;
4673 it->wd->selected = eina_list_remove(it->wd->selected,
4677 if (it->realized) _item_unrealize(it, EINA_FALSE);
4678 it->block->changed = EINA_TRUE;
4679 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
4680 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
4682 if (it->itc->func.del)
4683 it->itc->func.del((void *)it->base.data, WIDGET(it));
4690 elm_genlist_item_data_set(Elm_Genlist_Item *it,
4693 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4694 elm_widget_item_data_set(it, data);
4698 elm_genlist_item_data_get(const Elm_Genlist_Item *it)
4700 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4701 return elm_widget_item_data_get(it);
4705 elm_genlist_item_icons_orphan(Elm_Genlist_Item *it)
4708 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4709 EINA_LIST_FREE(it->icon_objs, icon)
4711 elm_widget_sub_object_del(WIDGET(it), icon);
4712 evas_object_smart_member_del(icon);
4713 evas_object_hide(icon);
4717 EAPI const Evas_Object *
4718 elm_genlist_item_object_get(const Elm_Genlist_Item *it)
4720 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4725 elm_genlist_item_update(Elm_Genlist_Item *it)
4727 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4728 if (!it->block) return;
4729 if (it->delete_me) return;
4730 it->mincalcd = EINA_FALSE;
4731 it->updateme = EINA_TRUE;
4732 it->block->updateme = EINA_TRUE;
4733 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4734 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4735 it->defer_unrealize = EINA_FALSE;
4739 elm_genlist_item_fields_update(Elm_Genlist_Item *it,
4741 Elm_Genlist_Item_Field_Flags itf)
4743 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4744 if (!it->block) return;
4745 if (it->delete_me) return;
4747 if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_LABEL))
4748 _item_label_realize(it, VIEW(it), &it->labels, parts);
4749 if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_ICON))
4751 it->icon_objs = _item_icon_unrealize(it, VIEW(it),
4753 it->icon_objs = _item_icon_realize(it, VIEW(it),
4756 if ((!itf) || (itf & ELM_GENLIST_ITEM_FIELD_STATE))
4757 _item_state_realize(it, VIEW(it), &it->states, parts);
4761 elm_genlist_item_item_class_update(Elm_Genlist_Item *it,
4762 const Elm_Genlist_Item_Class *itc)
4764 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4765 if (!it->block) return;
4766 EINA_SAFETY_ON_NULL_RETURN(itc);
4767 if (it->delete_me) return;
4769 it->nocache = EINA_TRUE;
4770 elm_genlist_item_update(it);
4773 EAPI const Elm_Genlist_Item_Class *
4774 elm_genlist_item_item_class_get(const Elm_Genlist_Item *it)
4776 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4777 if (it->delete_me) return NULL;
4780 static Evas_Object *
4781 _elm_genlist_item_label_create(void *data,
4783 void *item __UNUSED__)
4785 Evas_Object *label = elm_label_add(obj);
4788 elm_object_style_set(label, "tooltip");
4789 elm_object_text_set(label, data);
4794 _elm_genlist_item_label_del_cb(void *data,
4795 Evas_Object *obj __UNUSED__,
4796 void *event_info __UNUSED__)
4798 eina_stringshare_del(data);
4802 elm_genlist_item_tooltip_text_set(Elm_Genlist_Item *item,
4805 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4806 text = eina_stringshare_add(text);
4807 elm_genlist_item_tooltip_content_cb_set(item, _elm_genlist_item_label_create,
4809 _elm_genlist_item_label_del_cb);
4813 elm_genlist_item_tooltip_content_cb_set(Elm_Genlist_Item *item,
4814 Elm_Tooltip_Item_Content_Cb func,
4816 Evas_Smart_Cb del_cb)
4818 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(item, error);
4820 if ((item->tooltip.content_cb == func) && (item->tooltip.data == data))
4823 if (item->tooltip.del_cb)
4824 item->tooltip.del_cb((void *)item->tooltip.data,
4825 item->base.widget, item);
4827 item->tooltip.content_cb = func;
4828 item->tooltip.data = data;
4829 item->tooltip.del_cb = del_cb;
4833 elm_widget_item_tooltip_content_cb_set(item,
4834 item->tooltip.content_cb,
4835 item->tooltip.data, NULL);
4836 elm_widget_item_tooltip_style_set(item, item->tooltip.style);
4842 if (del_cb) del_cb((void *)data, NULL, NULL);
4846 elm_genlist_item_tooltip_unset(Elm_Genlist_Item *item)
4848 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4849 if ((item->base.view) && (item->tooltip.content_cb))
4850 elm_widget_item_tooltip_unset(item);
4852 if (item->tooltip.del_cb)
4853 item->tooltip.del_cb((void *)item->tooltip.data, item->base.widget, item);
4854 item->tooltip.del_cb = NULL;
4855 item->tooltip.content_cb = NULL;
4856 item->tooltip.data = NULL;
4857 if (item->tooltip.style)
4858 elm_genlist_item_tooltip_style_set(item, NULL);
4862 elm_genlist_item_tooltip_style_set(Elm_Genlist_Item *item,
4865 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4866 eina_stringshare_replace(&item->tooltip.style, style);
4867 if (item->base.view) elm_widget_item_tooltip_style_set(item, style);
4871 elm_genlist_item_tooltip_style_get(const Elm_Genlist_Item *item)
4873 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4874 return item->tooltip.style;
4878 elm_genlist_item_cursor_set(Elm_Genlist_Item *item,
4881 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4882 eina_stringshare_replace(&item->mouse_cursor, cursor);
4883 if (item->base.view) elm_widget_item_cursor_set(item, cursor);
4887 elm_genlist_item_cursor_get(const Elm_Genlist_Item *item)
4889 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4890 return elm_widget_item_cursor_get(item);
4894 elm_genlist_item_cursor_unset(Elm_Genlist_Item *item)
4896 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4897 if (!item->mouse_cursor)
4901 elm_widget_item_cursor_unset(item);
4903 eina_stringshare_del(item->mouse_cursor);
4904 item->mouse_cursor = NULL;
4908 elm_genlist_item_cursor_style_set(Elm_Genlist_Item *item,
4911 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4912 elm_widget_item_cursor_style_set(item, style);
4916 elm_genlist_item_cursor_style_get(const Elm_Genlist_Item *item)
4918 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4919 return elm_widget_item_cursor_style_get(item);
4923 elm_genlist_item_cursor_engine_only_set(Elm_Genlist_Item *item,
4924 Eina_Bool engine_only)
4926 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4927 elm_widget_item_cursor_engine_only_set(item, engine_only);
4931 elm_genlist_item_cursor_engine_only_get(const Elm_Genlist_Item *item)
4933 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
4934 return elm_widget_item_cursor_engine_only_get(item);
4938 elm_genlist_horizontal_mode_set(Evas_Object *obj,
4941 ELM_CHECK_WIDTYPE(obj, widtype);
4942 Widget_Data *wd = elm_widget_data_get(obj);
4944 if (wd->mode == mode) return;
4950 elm_genlist_horizontal_mode_get(const Evas_Object *obj)
4952 ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
4953 Widget_Data *wd = elm_widget_data_get(obj);
4954 if (!wd) return ELM_LIST_LAST;
4959 elm_genlist_always_select_mode_set(Evas_Object *obj,
4960 Eina_Bool always_select)
4962 ELM_CHECK_WIDTYPE(obj, widtype);
4963 Widget_Data *wd = elm_widget_data_get(obj);
4965 wd->always_select = always_select;
4969 elm_genlist_always_select_mode_get(const Evas_Object *obj)
4971 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4972 Widget_Data *wd = elm_widget_data_get(obj);
4973 if (!wd) return EINA_FALSE;
4974 return wd->always_select;
4978 elm_genlist_no_select_mode_set(Evas_Object *obj,
4979 Eina_Bool no_select)
4981 ELM_CHECK_WIDTYPE(obj, widtype);
4982 Widget_Data *wd = elm_widget_data_get(obj);
4984 wd->no_select = no_select;
4988 elm_genlist_no_select_mode_get(const Evas_Object *obj)
4990 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4991 Widget_Data *wd = elm_widget_data_get(obj);
4992 if (!wd) return EINA_FALSE;
4993 return wd->no_select;
4997 elm_genlist_compress_mode_set(Evas_Object *obj,
5000 ELM_CHECK_WIDTYPE(obj, widtype);
5001 Widget_Data *wd = elm_widget_data_get(obj);
5003 wd->compress = compress;
5007 elm_genlist_compress_mode_get(const Evas_Object *obj)
5009 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5010 Widget_Data *wd = elm_widget_data_get(obj);
5011 if (!wd) return EINA_FALSE;
5012 return wd->compress;
5016 elm_genlist_height_for_width_mode_set(Evas_Object *obj,
5017 Eina_Bool height_for_width)
5019 ELM_CHECK_WIDTYPE(obj, widtype);
5020 Widget_Data *wd = elm_widget_data_get(obj);
5022 wd->height_for_width = !!height_for_width;
5023 if (wd->height_for_width)
5025 elm_genlist_homogeneous_set(obj, EINA_FALSE);
5026 elm_genlist_compress_mode_set(obj, EINA_TRUE);
5031 elm_genlist_height_for_width_mode_get(const Evas_Object *obj)
5033 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5034 Widget_Data *wd = elm_widget_data_get(obj);
5035 if (!wd) return EINA_FALSE;
5036 return wd->height_for_width;
5040 elm_genlist_bounce_set(Evas_Object *obj,
5044 ELM_CHECK_WIDTYPE(obj, widtype);
5045 Widget_Data *wd = elm_widget_data_get(obj);
5047 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
5051 elm_genlist_bounce_get(const Evas_Object *obj,
5052 Eina_Bool *h_bounce,
5053 Eina_Bool *v_bounce)
5055 ELM_CHECK_WIDTYPE(obj, widtype);
5056 Widget_Data *wd = elm_widget_data_get(obj);
5058 elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce);
5062 elm_genlist_homogeneous_set(Evas_Object *obj,
5063 Eina_Bool homogeneous)
5065 ELM_CHECK_WIDTYPE(obj, widtype);
5066 Widget_Data *wd = elm_widget_data_get(obj);
5068 if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
5069 wd->homogeneous = homogeneous;
5073 elm_genlist_homogeneous_get(const Evas_Object *obj)
5075 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5076 Widget_Data *wd = elm_widget_data_get(obj);
5077 if (!wd) return EINA_FALSE;
5078 return wd->homogeneous;
5082 elm_genlist_block_count_set(Evas_Object *obj,
5085 ELM_CHECK_WIDTYPE(obj, widtype);
5086 Widget_Data *wd = elm_widget_data_get(obj);
5088 wd->max_items_per_block = n;
5089 wd->item_cache_max = wd->max_items_per_block * 2;
5090 _item_cache_clean(wd);
5094 elm_genlist_block_count_get(const Evas_Object *obj)
5096 ELM_CHECK_WIDTYPE(obj, widtype) 0;
5097 Widget_Data *wd = elm_widget_data_get(obj);
5099 return wd->max_items_per_block;
5103 elm_genlist_longpress_timeout_set(Evas_Object *obj,
5106 ELM_CHECK_WIDTYPE(obj, widtype);
5107 Widget_Data *wd = elm_widget_data_get(obj);
5109 wd->longpress_timeout = timeout;
5113 elm_genlist_longpress_timeout_get(const Evas_Object *obj)
5115 ELM_CHECK_WIDTYPE(obj, widtype) 0;
5116 Widget_Data *wd = elm_widget_data_get(obj);
5118 return wd->longpress_timeout;
5122 elm_genlist_scroller_policy_set(Evas_Object *obj,
5123 Elm_Scroller_Policy policy_h,
5124 Elm_Scroller_Policy policy_v)
5126 ELM_CHECK_WIDTYPE(obj, widtype);
5127 Widget_Data *wd = elm_widget_data_get(obj);
5128 if ((!wd) || (!wd->scr)) return;
5129 if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
5130 (policy_v >= ELM_SCROLLER_POLICY_LAST))
5132 elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
5136 elm_genlist_scroller_policy_get(const Evas_Object *obj,
5137 Elm_Scroller_Policy *policy_h,
5138 Elm_Scroller_Policy *policy_v)
5140 ELM_CHECK_WIDTYPE(obj, widtype);
5141 Widget_Data *wd = elm_widget_data_get(obj);
5142 Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
5143 if ((!wd) || (!wd->scr)) return;
5144 elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
5145 if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
5146 if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
5150 elm_genlist_realized_items_update(Evas_Object *obj)
5152 ELM_CHECK_WIDTYPE(obj, widtype);
5154 Eina_List *list, *l;
5155 Elm_Genlist_Item *it;
5157 list = elm_genlist_realized_items_get(obj);
5158 EINA_LIST_FOREACH(list, l, it)
5159 elm_genlist_item_update(it);
5163 elm_genlist_item_mode_set(Elm_Genlist_Item *it,
5164 const char *mode_type,
5167 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
5168 Widget_Data *wd = it->wd;
5170 Elm_Genlist_Item *it2;
5173 if (!mode_type) return;
5174 if ((it->delete_me) || (it->disabled)) return;
5175 if (wd->edit_mode) return;
5177 if ((wd->mode_item == it) &&
5178 (!strcmp(mode_type, wd->mode_type)) &&
5181 if (!it->itc->mode_item_style) return;
5185 EINA_LIST_FOREACH(wd->selected, l, it2)
5187 elm_genlist_item_selected_set(it2, EINA_FALSE);
5191 it2 = elm_genlist_selected_item_get(wd->obj);
5192 if ((it2) && (it2->realized))
5193 elm_genlist_item_selected_set(it2, EINA_FALSE);
5196 if (((wd->mode_type) && (strcmp(mode_type, wd->mode_type))) ||
5198 ((it == wd->mode_item) && (!mode_set)))
5199 _item_mode_unset(wd);
5201 eina_stringshare_replace(&wd->mode_type, mode_type);
5202 if (mode_set) _item_mode_set(it);
5206 elm_genlist_mode_get(const Evas_Object *obj)
5208 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5209 Widget_Data *wd = elm_widget_data_get(obj);
5210 if (!wd) return NULL;
5211 return wd->mode_type;
5214 EAPI const Elm_Genlist_Item *
5215 elm_genlist_mode_item_get(const Evas_Object *obj)
5217 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5218 Widget_Data *wd = elm_widget_data_get(obj);
5219 if (!wd) return NULL;
5220 return wd->mode_item;
5224 elm_genlist_reorder_mode_set(Evas_Object *obj,
5225 Eina_Bool reorder_mode)
5227 ELM_CHECK_WIDTYPE(obj, widtype);
5228 Widget_Data *wd = elm_widget_data_get(obj);
5230 wd->reorder_mode = reorder_mode;
5234 elm_genlist_reorder_mode_get(const Evas_Object *obj)
5236 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5237 Widget_Data *wd = elm_widget_data_get(obj);
5238 if (!wd) return EINA_FALSE;
5239 return wd->reorder_mode;
5243 elm_genlist_item_move_after(Elm_Genlist_Item *it __UNUSED__, Elm_Genlist_Item *after __UNUSED__)
5249 elm_genlist_item_move_before(Elm_Genlist_Item *it __UNUSED__, Elm_Genlist_Item *before __UNUSED__)
5255 elm_genlist_effect_set(const Evas_Object *obj, Eina_Bool emode)
5257 ELM_CHECK_WIDTYPE(obj, widtype);
5258 Widget_Data *wd = elm_widget_data_get(obj);
5260 wd->effect_mode = emode;
5261 // wd->point_rect = evas_object_rectangle_add(evas_object_evas_get(wd->obj));
5262 // evas_object_resize(wd->point_rect, 10, 25);
5263 // evas_object_color_set(wd->point_rect, 255, 0, 0, 130);
5264 // evas_object_show(wd->point_rect);
5265 // evas_object_hide(wd->point_rect);
5269 _create_tray_alpha_bg(const Evas_Object *obj)
5271 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5272 Widget_Data *wd = elm_widget_data_get(obj);
5273 if (!wd) return NULL;
5275 Evas_Object *bg = NULL;
5276 Evas_Coord ox, oy, ow, oh;
5278 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
5279 bg = evas_object_rectangle_add(evas_object_evas_get(wd->obj));
5280 evas_object_color_set(bg,0,0,0,0);
5281 evas_object_resize(bg , ow, oh);
5282 evas_object_move(bg , ox, oy);
5283 evas_object_show(bg);
5284 evas_object_hide(bg);
5291 struct timeval timev;
5293 gettimeofday(&timev, NULL);
5294 return ((timev.tv_sec * 1000) + ((timev.tv_usec) / 1000));
5297 // added for item moving animation.
5299 _item_moving_effect_timer_cb(void *data)
5301 Widget_Data *wd = data;
5302 if (!wd) return EINA_FALSE;
5304 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
5305 Elm_Genlist_Item *it = NULL, *it2;
5307 double time = 0.5, t;
5309 Eina_Bool check, end = EINA_FALSE;
5312 t = ((0.0 > (t = current_time_get() - wd->start_time)) ? 0.0 : t) / 1000;
5314 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
5315 evas_output_viewport_get(evas_object_evas_get(wd->pan_smart), &cvx, &cvy, &cvw, &cvh);
5316 if (t > time) end = EINA_TRUE;
5318 it2 = elm_genlist_item_next_get(wd->expand_item);
5321 if (wd->expand_item->expanded_depth >= it2->expanded_depth) break;
5322 it2 = elm_genlist_item_next_get(it2);
5327 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5328 dy = ((it2->scrl_y > cvy + cvh) ? cvy + cvh : it2->scrl_y) - it2->old_scrl_y;
5329 else if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5330 dy = wd->expand_item_gap;
5334 y = ((1 - (1 - (t / time)) * (1 - (t /time))) * dy);
5343 EINA_INLIST_FOREACH(wd->blocks, itb)
5346 if (ELM_RECTS_INTERSECT(itb->x - wd->pan_x + ox,
5347 itb->y - wd->pan_y + oy,
5349 cvx, cvy, cvw, cvh))
5351 EINA_LIST_FOREACH(itb->items, l, it)
5353 if (it == it2) check = EINA_TRUE;
5354 if (!check) continue;
5356 if (!it->old_scrl_y)
5357 it->old_scrl_y = it->scrl_y;
5358 if (it->old_scrl_y + y < oy + oh)
5360 if (!it->realized) _item_realize(it, in, 0);
5362 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE && it->old_scrl_y + y < it->scrl_y)
5363 it->old_scrl_y = it->scrl_y - y;
5366 if (wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE ||
5367 (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE && it->old_scrl_y + y >= it->scrl_y))
5369 if (wd->edit_mode) _effect_item_controls(it, it->scrl_x, it->old_scrl_y + y);
5372 evas_object_resize(VIEW(it), it->w, it->h);
5373 evas_object_move(VIEW(it), it->scrl_x, it->old_scrl_y + y);
5374 evas_object_show(VIEW(it));
5375 evas_object_raise(VIEW(it));
5378 if (it->group_item) evas_object_raise(it->group_item->base.view);
5384 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5386 it = elm_genlist_item_prev_get(it2);
5389 if (it->expanded_depth <= it2->expanded_depth) break;
5390 if ((it->scrl_y < it2->old_scrl_y + y) && (it->expanded_depth > it2->expanded_depth))
5392 if (!it->effect_done)
5394 edje_object_signal_emit(VIEW(it), "flip_item", "");
5395 evas_object_show(VIEW(it));
5396 it->effect_done = EINA_TRUE;
5399 it = elm_genlist_item_prev_get(it);
5402 else if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5404 it = elm_genlist_item_prev_get(it2);
5407 if ((it->scrl_y > it2->old_scrl_y + y) && (it->expanded_depth > it2->expanded_depth))
5409 if (!it->effect_done)
5411 edje_object_signal_emit(VIEW(it), "elm,state,hide", "");
5412 it->effect_done = EINA_TRUE;
5417 it = elm_genlist_item_prev_get(it);
5424 int expand_order = 0;
5425 if (wd->expand_item) it = elm_genlist_item_next_get(wd->expand_item);
5429 it = elm_genlist_item_next_get(it);
5431 if (wd->expand_item) it = elm_genlist_item_next_get(wd->expand_item);
5435 if (wd->expand_item->expanded_depth >= it->expanded_depth) break;
5436 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5438 if (!it->effect_done)
5440 if (t >= (((expand_order - 1) * time) / expand_num))
5442 edje_object_signal_emit(VIEW(it), "flip_item", "");
5443 evas_object_show(VIEW(it));
5444 it->effect_done = EINA_TRUE;
5448 it = elm_genlist_item_next_get(it);
5454 if (wd->item_moving_effect_timer)
5456 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5457 _item_subitems_clear(wd->expand_item);
5458 EINA_INLIST_FOREACH(wd->blocks, itb)
5460 EINA_LIST_FOREACH(itb->items, l, it)
5462 it->effect_done = EINA_TRUE;
5463 it->old_scrl_y = it->scrl_y;
5467 wd->item_moving_effect_timer = NULL;
5469 _item_auto_scroll(wd);
5470 evas_object_lower(wd->alpha_bg);
5471 evas_object_hide(wd->alpha_bg);
5472 elm_smart_scroller_bounce_animator_disabled_set(wd->scr, EINA_FALSE);
5473 wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_NONE;
5475 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
5476 evas_object_smart_callback_call(wd->obj, "effect_done", NULL);
5477 evas_object_smart_changed(wd->pan_smart);
5478 return ECORE_CALLBACK_CANCEL;
5480 return ECORE_CALLBACK_RENEW;
5484 _emit_contract(Elm_Genlist_Item *it)
5486 Elm_Genlist_Item *it2;
5489 // printf("%p is emited contract\n", it);
5490 edje_object_signal_emit(VIEW(it), "elm,state,contract_flip", "");
5491 it->effect_done = EINA_FALSE;
5493 EINA_LIST_FOREACH(it->items, l, it2)
5495 _emit_contract(it2);
5498 // added for item moving animation.
5500 _item_flip_effect_show(Elm_Genlist_Item *it)
5502 Elm_Genlist_Item *it2;
5504 Widget_Data *wd = it->wd;
5505 Eina_Bool check = EINA_FALSE;
5507 it2 = elm_genlist_item_next_get(it);
5510 if (it2->expanded_depth <= it->expanded_depth) check = EINA_TRUE;
5511 it2 = elm_genlist_item_next_get(it2);
5513 EINA_LIST_FOREACH(it->items, l, it2)
5515 if (it2->parent && it == it2->parent)
5517 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5518 edje_object_signal_emit(it2->base.view, "elm,state,hide", "");
5519 else if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5520 _emit_contract(it2);
5524 return ECORE_CALLBACK_CANCEL;
5529 _elm_genlist_pinch_zoom_execute(Evas_Object *obj, Eina_Bool emode)
5531 printf("!!! NOW FIXING \n");
5536 * Set pinch zoom mode
5538 * @param obj The genlist object
5540 * (EINA_TRUE = pinch contract (zoom in), EINA_FALSE = pinch expand (zoom out)
5545 elm_genlist_pinch_zoom_mode_set(Evas_Object *obj __UNUSED__, Eina_Bool emode __UNUSED__)
5547 printf("!!! NOW FIXING \n");
5551 * Get pinch zoom mode
5553 * @param obj The genlist object
5554 * @return The pinch mode
5555 * (EINA_TRUE = pinch contract (zoom in), EINA_FALSE = pinch expand (zoom out)
5560 elm_genlist_pinch_zoom_mode_get(const Evas_Object *obj __UNUSED__)
5562 printf("!!! NOW FIXING \n");
5567 elm_genlist_pinch_zoom_set(Evas_Object *obj __UNUSED__, Eina_Bool emode __UNUSED__)
5569 printf("!!! NOW FIXING \n");
5573 ////////////////////////////////////////////////////////////////////////
5575 ////////////////////////////////////////////////////////////////////////
5578 _effect_item_controls(Elm_Genlist_Item *it, int itx, int ity)
5580 if (!it->wd->edit_mode) return;
5581 evas_object_resize(it->edit_obj,it->w, it->h);
5582 evas_object_move(it->edit_obj, itx, ity);
5586 _effect_item_realize(Elm_Genlist_Item *it, Eina_Bool effect_on)
5588 if ((it->effect_item_realized) || (it->delete_me)) return;
5592 _mode_finished_signal_cb(it, (Evas_Object *)elm_genlist_item_object_get(it), NULL, NULL);
5594 it->edit_obj = edje_object_add(evas_object_evas_get(WIDGET(it)));
5595 edje_object_scale_set(it->edit_obj, elm_widget_scale_get(WIDGET(it)) *
5596 _elm_config->scale);
5597 evas_object_smart_member_add(it->edit_obj, it->wd->pan_smart);
5598 elm_widget_sub_object_add(WIDGET(it), it->edit_obj);
5600 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) strncpy(buf, "tree", sizeof(buf));
5601 else strncpy(buf, "item", sizeof(buf));
5602 if (it->wd->compress) strncat(buf, "_compress", sizeof(buf) - strlen(buf));
5604 strncat(buf, "/", sizeof(buf) - strlen(buf));
5606 if (it->itc->edit_item_style && strcmp(it->itc->edit_item_style, "default"))
5608 strncat(buf, it->itc->edit_item_style, sizeof(buf) - strlen(buf));
5609 _elm_theme_object_set(WIDGET(it), it->edit_obj, "genlist", buf, elm_widget_style_get(WIDGET(it)));
5613 _elm_theme_object_set(WIDGET(it), it->edit_obj, "genlist", "item/edit_default", elm_widget_style_get(WIDGET(it)));
5616 if (it->wd->reorder_mode)
5618 if (effect_on) edje_object_signal_emit(it->edit_obj, "elm,state,reorder_enabled_effect", "elm");
5619 else edje_object_signal_emit(it->edit_obj, "elm,state,reorder_enabled", "elm");
5621 if (effect_on) edje_object_signal_emit(it->edit_obj, "elm,state,emode_enabled_effect", "elm");
5622 else edje_object_signal_emit(it->edit_obj, "elm,state,emode_enabled", "elm");
5624 if (it->disabled) edje_object_signal_emit(it->edit_obj, "elm,state,disabled", "elm");
5625 else edje_object_signal_emit(it->edit_obj, "elm,state,enabled", "elm");
5628 if ((it->wd->edit_mode))
5630 if (it->itc->func.icon_get)
5635 if (it->renamed) edje_object_signal_emit(it->edit_obj, "elm,state,rename,enabled", "elm");
5636 it->icons = elm_widget_stringlist_get(edje_object_data_get(it->edit_obj, "edit_icons"));
5637 EINA_LIST_FOREACH(it->icons, l, key)
5639 Evas_Object *ic = it->itc->func.icon_get
5640 ((void *)it->base.data, WIDGET(it), l->data);
5644 it->edit_icon_objs = eina_list_append(it->edit_icon_objs, ic);
5645 edje_object_part_swallow(it->edit_obj, key, ic);
5646 evas_object_show(ic);
5647 elm_widget_sub_object_add(WIDGET(it), ic);
5649 elm_widget_disabled_set(ic, EINA_TRUE);
5654 edje_object_part_swallow(it->edit_obj, "original_edc", VIEW(it));
5655 _effect_item_controls(it,it->scrl_x, it->scrl_y);
5656 evas_object_show(it->edit_obj);
5658 it->effect_item_realized = EINA_TRUE;
5659 it->want_unrealize = EINA_FALSE;
5663 _effect_item_unrealize(Elm_Genlist_Item *it)
5667 if (!it->effect_item_realized) return;
5668 if (it->wd->reorder_it && it->wd->reorder_it == it) return;
5670 edje_object_signal_emit(it->edit_obj, "elm,state,reorder_disable_effect", "elm");
5671 edje_object_signal_emit(it->edit_obj, "elm,state,sel,disable", "elm");
5672 edje_object_message_signal_process(it->edit_obj);
5673 edje_object_part_unswallow(it->edit_obj, VIEW(it));
5674 evas_object_smart_member_add(VIEW(it), it->wd->pan_smart);
5675 elm_widget_sub_object_add(WIDGET(it), VIEW(it));
5676 // evas_object_smart_callback_call(it->edit_obj, "unrealized", it);
5677 // _item_cache_add(it);
5678 evas_object_del(it->edit_obj);
5679 it->edit_obj = NULL;
5680 EINA_LIST_FREE(it->edit_icon_objs, icon)
5681 evas_object_del(icon);
5683 // edje_object_signal_emit(it->edit_obj, "elm,state,edit_end,disable", "elm");
5684 it->effect_item_realized = EINA_FALSE;
5688 * Get Genlist edit mode
5690 * @param obj The genlist object
5691 * @return The edit mode status
5692 * (EINA_TRUE = edit mode, EINA_FALSE = normal mode
5697 elm_genlist_edit_mode_get(const Evas_Object *obj)
5699 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5700 Widget_Data *wd = elm_widget_data_get(obj);
5701 if (!wd) return EINA_FALSE;
5703 if (wd->edit_mode) return EINA_TRUE;
5704 else return EINA_FALSE;
5708 * Set Genlist edit mode
5710 * This sets Genlist edit mode.
5712 * @param obj The Genlist object
5713 * @param emode ELM_GENLIST_EDIT_MODE_{NONE & REORDER & INSERT & DELETE & SELECT & SELECT_ALL}
5714 * @param edit_class Genlist edit class (Elm_Genlist_Edit_Class structure)
5719 elm_genlist_edit_mode_set(Evas_Object *obj, Eina_Bool edit_mode)
5721 ELM_CHECK_WIDTYPE(obj, widtype);
5725 Elm_Genlist_Item *it;
5727 Widget_Data *wd = elm_widget_data_get(obj);
5729 if (wd->edit_mode == edit_mode) return;
5731 wd->edit_mode = edit_mode;
5734 EINA_INLIST_FOREACH(wd->blocks, itb)
5738 EINA_LIST_FOREACH(itb->items, l, it)
5740 if (it->flags != ELM_GENLIST_ITEM_GROUP && it->realized)
5742 _effect_item_unrealize(it);
5747 _item_cache_zero(wd);
5752 EINA_INLIST_FOREACH(wd->blocks, itb)
5756 EINA_LIST_FOREACH(itb->items, l, it)
5758 if (it->flags != ELM_GENLIST_ITEM_GROUP && it->realized)
5760 if(it->selected) _item_unselect(it);
5761 if (it->itc->edit_item_style) _effect_item_realize(it, EINA_TRUE);
5768 if (wd->calc_job) ecore_job_del(wd->calc_job);
5769 wd->calc_job = ecore_job_add(_calc_job, wd);
5773 * Set a given item's rename mode
5775 * This renames the item's label from genlist
5777 * @param it The item
5778 * @param renamed set if emode is EINA_TRUE, unset if emode is EINA_FALSE
5783 elm_genlist_item_rename_mode_set(Elm_Genlist_Item *it, Eina_Bool renamed)
5789 _item_unrealize(it, EINA_FALSE);
5790 it->renamed = EINA_TRUE;
5791 it->wd->rename_it = it;
5792 it->nocache = EINA_TRUE;
5793 if (it->selected) _item_unselect(it);
5795 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
5796 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
5802 it->renamed = EINA_FALSE;
5803 it->nocache = EINA_TRUE;
5804 it->wd->rename_it = NULL;
5805 _item_cache_zero(it->wd);
5806 elm_genlist_item_update(it);
5812 elm_genlist_item_rename_mode_get(Elm_Genlist_Item *item)
5814 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
5815 return item->renamed;