2 #include <Elementary.h>
3 #include <Elementary_Cursor.h>
7 #define MAX_ITEMS_PER_BLOCK 32
8 #define REORDER_EFFECT_TIME 0.5
10 typedef struct _Widget_Data Widget_Data;
11 typedef struct _Item_Block Item_Block;
12 typedef struct _Pan Pan;
13 typedef struct _Item_Cache Item_Cache;
14 typedef enum _Elm_Genlist_Item_Move_effect_Mode
16 ELM_GENLIST_ITEM_MOVE_EFFECT_NONE = 0,
17 ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND = (1 << 0),
18 ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT = (1 << 1),
19 ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE = (1 << 2),
20 } Elm_Genlist_Item_Move_effect_Mode;
24 Evas_Object *obj, *scr, *pan_smart;
25 Eina_Inlist *items, *blocks;
26 Eina_List *group_items;
28 Evas_Coord pan_x, pan_y, old_pan_y, w, h, minw, minh, realminw, prev_viewport_w;
29 Ecore_Job *calc_job, *update_job;
30 Ecore_Idle_Enterer *queue_idle_enterer;
31 Ecore_Idler *must_recalc_idler;
32 Eina_List *queue, *selected;
33 Elm_Genlist_Item *show_item, *last_selected_item, *anchor_item, *mode_item, *reorder_it, *reorder_rel, *expand_item;
34 Eina_Inlist *item_cache;
35 Evas_Coord anchor_y, reorder_start_y;
37 Ecore_Timer *multi_timer, *scr_hold_timer;
38 Ecore_Animator *reorder_move_animator;
39 const char *mode_type;
40 unsigned int start_time;
41 Evas_Coord prev_x, prev_y, prev_mx, prev_my;
42 Evas_Coord cur_x, cur_y, cur_mx, cur_my;
43 Eina_Bool mouse_down : 1;
44 Eina_Bool multi_down : 1;
45 Eina_Bool multi_timeout : 1;
46 Eina_Bool multitouched : 1;
47 Eina_Bool on_hold : 1;
49 Eina_Bool always_select : 1;
50 Eina_Bool longpressed : 1;
51 Eina_Bool wasselected : 1;
52 Eina_Bool no_select : 1;
53 Eina_Bool bring_in : 1;
54 Eina_Bool compress : 1;
55 Eina_Bool height_for_width : 1;
56 Eina_Bool pan_resize : 1;
57 Eina_Bool homogeneous : 1;
58 Eina_Bool clear_me : 1;
60 Eina_Bool reorder_mode : 1;
61 Eina_Bool reorder_pan_move : 1;
62 Eina_List *dragging_queue;
66 } history[SWIPE_MOVES];
75 int group_item_height;
76 int max_items_per_block;
77 double longpress_timeout;
80 Eina_Bool reorder_deleted : 1;
81 Eina_Bool effect_mode : 1;
82 Eina_Bool auto_scrolled : 1;
83 Eina_Bool pan_changed : 1;
85 Ecore_Animator *item_moving_effect_timer;
86 Evas_Object *alpha_bg;
87 Evas_Coord expand_item_end;
88 Evas_Coord expand_item_gap;
90 Ecore_Job *changed_job;
91 Elm_Genlist_Item *rename_it;
102 Evas_Coord x, y, w, h, minw, minh;
103 Eina_Bool want_unrealize : 1;
104 Eina_Bool realized : 1;
105 Eina_Bool changed : 1;
106 Eina_Bool updateme : 1;
107 Eina_Bool changeme : 1;
108 Eina_Bool showme : 1;
109 Eina_Bool must_recalc : 1;
112 struct _Elm_Genlist_Item
114 Elm_Widget_Item base;
119 Evas_Coord x, y, w, h, minw, minh;
120 const Elm_Genlist_Item_Class *itc;
121 Elm_Genlist_Item *parent;
122 Elm_Genlist_Item *group_item;
123 Elm_Genlist_Item_Flags flags;
131 Eina_List *labels, *icons, *states, *icon_objs;
132 Eina_List *mode_labels, *mode_icons, *mode_states, *mode_icon_objs;
133 Ecore_Timer *long_timer;
134 Ecore_Timer *swipe_timer;
136 Evas_Coord scrl_x, scrl_y;
138 Elm_Genlist_Item *rel;
139 Evas_Object *mode_view;
144 Elm_Tooltip_Item_Content_Cb content_cb;
145 Evas_Smart_Cb del_cb;
149 const char *mouse_cursor;
156 Eina_Bool before : 1;
158 Eina_Bool want_unrealize : 1;
159 Eina_Bool want_realize : 1;
160 Eina_Bool realized : 1;
161 Eina_Bool selected : 1;
162 Eina_Bool highlighted : 1;
163 Eina_Bool expanded : 1;
164 Eina_Bool disabled : 1;
165 Eina_Bool display_only : 1;
166 Eina_Bool mincalcd : 1;
167 Eina_Bool queued : 1;
168 Eina_Bool showme : 1;
169 Eina_Bool delete_me : 1;
171 Eina_Bool dragging : 1;
172 Eina_Bool updateme : 1;
173 Eina_Bool nocache : 1;
174 Eina_Bool move_effect_enabled : 1;
175 Eina_Bool defer_unrealize : 1;
178 Eina_Bool effect_done : 1;
179 Eina_Bool reordering : 1;
180 Eina_Bool renamed : 1;
181 Eina_Bool effect_item_realized : 1;
182 Eina_List *edit_icon_objs;
183 Evas_Object *edit_obj;
185 Ecore_Animator *item_moving_effect_timer;
186 Evas_Coord old_scrl_y;
193 Evas_Object *base_view, *spacer;
195 const char *item_style; // it->itc->item_style
196 Eina_Bool tree : 1; // it->flags & ELM_GENLIST_ITEM_SUBITEMS
197 Eina_Bool compress : 1; // it->wd->compress
198 Eina_Bool odd : 1; // in & 0x1
200 Eina_Bool selected : 1; // it->selected
201 Eina_Bool disabled : 1; // it->disabled
202 Eina_Bool expanded : 1; // it->expanded
205 #define ELM_GENLIST_ITEM_FROM_INLIST(item) \
206 ((item) ? EINA_INLIST_CONTAINER_GET(item, Elm_Genlist_Item) : NULL)
210 Evas_Object_Smart_Clipped_Data __clipped_data;
212 Ecore_Job *resize_job;
215 static const char *widtype = NULL;
216 static void _item_cache_zero(Widget_Data *wd);
217 static void _del_hook(Evas_Object *obj);
218 static void _mirrored_set(Evas_Object *obj,
220 static void _theme_hook(Evas_Object *obj);
221 static void _show_region_hook(void *data,
223 static void _sizing_eval(Evas_Object *obj);
224 static void _item_realize(Elm_Genlist_Item *it,
227 static void _item_unrealize(Elm_Genlist_Item *it,
229 static void _item_block_unrealize(Item_Block *itb);
230 static void _calc_job(void *data);
231 static void _on_focus_hook(void *data,
233 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
234 static void _changed_job(void *data);
235 static Eina_Bool _item_multi_select_up(Widget_Data *wd);
236 static Eina_Bool _item_multi_select_down(Widget_Data *wd);
237 static Eina_Bool _item_single_select_up(Widget_Data *wd);
238 static Eina_Bool _item_single_select_down(Widget_Data *wd);
239 static Eina_Bool _event_hook(Evas_Object *obj,
241 Evas_Callback_Type type,
243 static void _signal_emit_hook(Evas_Object *obj,
244 const char *emission,
246 static Eina_Bool _deselect_all_items(Widget_Data *wd);
247 static void _pan_calculate(Evas_Object *obj);
248 static void _pan_max_get(Evas_Object *obj,
251 static void _item_position(Elm_Genlist_Item *it,
255 static void _mode_item_realize(Elm_Genlist_Item *it);
256 static void _mode_item_unrealize(Elm_Genlist_Item *it);
257 static void _item_mode_set(Elm_Genlist_Item *it);
258 static void _item_mode_unset(Widget_Data *wd);
259 static void _group_items_recalc(void *data);
260 static void _item_move_after(Elm_Genlist_Item *it,
261 Elm_Genlist_Item *after);
262 static void _item_move_before(Elm_Genlist_Item *it,
263 Elm_Genlist_Item *before);
265 // TODO : refactoring
266 static Evas_Object* _create_tray_alpha_bg(const Evas_Object *obj);
267 static unsigned int current_time_get();
268 static Eina_Bool _item_moving_effect_timer_cb(void *data);
269 static int _item_flip_effect_show(Elm_Genlist_Item *it);
270 static void _effect_item_controls(Elm_Genlist_Item *it, int itx, int ity);
271 static void _effect_item_realize(Elm_Genlist_Item *it, Eina_Bool effect_on);
272 static void _effect_item_unrealize(Elm_Genlist_Item *it);
273 static void _item_auto_scroll(void *data);
275 static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
277 static const char SIG_ACTIVATED[] = "activated";
278 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
279 static const char SIG_SELECTED[] = "selected";
280 static const char SIG_UNSELECTED[] = "unselected";
281 static const char SIG_EXPANDED[] = "expanded";
282 static const char SIG_CONTRACTED[] = "contracted";
283 static const char SIG_EXPAND_REQUEST[] = "expand,request";
284 static const char SIG_CONTRACT_REQUEST[] = "contract,request";
285 static const char SIG_REALIZED[] = "realized";
286 static const char SIG_UNREALIZED[] = "unrealized";
287 static const char SIG_DRAG_START_UP[] = "drag,start,up";
288 static const char SIG_DRAG_START_DOWN[] = "drag,start,down";
289 static const char SIG_DRAG_START_LEFT[] = "drag,start,left";
290 static const char SIG_DRAG_START_RIGHT[] = "drag,start,right";
291 static const char SIG_DRAG_STOP[] = "drag,stop";
292 static const char SIG_DRAG[] = "drag";
293 static const char SIG_LONGPRESSED[] = "longpressed";
294 static const char SIG_SCROLL_EDGE_TOP[] = "scroll,edge,top";
295 static const char SIG_SCROLL_EDGE_BOTTOM[] = "scroll,edge,bottom";
296 static const char SIG_SCROLL_EDGE_LEFT[] = "scroll,edge,left";
297 static const char SIG_SCROLL_EDGE_RIGHT[] = "scroll,edge,right";
298 static const char SIG_MULTI_SWIPE_LEFT[] = "multi,swipe,left";
299 static const char SIG_MULTI_SWIPE_RIGHT[] = "multi,swipe,right";
300 static const char SIG_MULTI_SWIPE_UP[] = "multi,swipe,up";
301 static const char SIG_MULTI_SWIPE_DOWN[] = "multi,swipe,down";
302 static const char SIG_MULTI_PINCH_OUT[] = "multi,pinch,out";
303 static const char SIG_MULTI_PINCH_IN[] = "multi,pinch,in";
304 static const char SIG_SWIPE[] = "swipe";
306 static const Evas_Smart_Cb_Description _signals[] = {
307 {SIG_CLICKED_DOUBLE, ""},
310 {SIG_UNSELECTED, ""},
312 {SIG_CONTRACTED, ""},
313 {SIG_EXPAND_REQUEST, ""},
314 {SIG_CONTRACT_REQUEST, ""},
316 {SIG_UNREALIZED, ""},
317 {SIG_DRAG_START_UP, ""},
318 {SIG_DRAG_START_DOWN, ""},
319 {SIG_DRAG_START_LEFT, ""},
320 {SIG_DRAG_START_RIGHT, ""},
323 {SIG_LONGPRESSED, ""},
324 {SIG_SCROLL_EDGE_TOP, ""},
325 {SIG_SCROLL_EDGE_BOTTOM, ""},
326 {SIG_SCROLL_EDGE_LEFT, ""},
327 {SIG_SCROLL_EDGE_RIGHT, ""},
328 {SIG_MULTI_SWIPE_LEFT, ""},
329 {SIG_MULTI_SWIPE_RIGHT, ""},
330 {SIG_MULTI_SWIPE_UP, ""},
331 {SIG_MULTI_SWIPE_DOWN, ""},
332 {SIG_MULTI_PINCH_OUT, ""},
333 {SIG_MULTI_PINCH_IN, ""},
339 _event_hook(Evas_Object *obj,
340 Evas_Object *src __UNUSED__,
341 Evas_Callback_Type type,
344 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
345 Evas_Event_Key_Down *ev = event_info;
346 Widget_Data *wd = elm_widget_data_get(obj);
347 Evas_Coord pan_max_x = 0, pan_max_y = 0;
348 if (!wd) return EINA_FALSE;
349 if (!wd->items) return EINA_FALSE;
350 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
351 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
353 Elm_Genlist_Item *it = NULL;
356 Evas_Coord step_x = 0;
357 Evas_Coord step_y = 0;
360 Evas_Coord page_x = 0;
361 Evas_Coord page_y = 0;
363 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
364 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
365 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
366 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
368 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
372 else if ((!strcmp(ev->keyname, "Right")) ||
373 (!strcmp(ev->keyname, "KP_Right")))
377 else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
379 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
380 (_item_multi_select_up(wd)))
381 || (_item_single_select_up(wd)))
383 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
389 else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
391 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
392 (_item_multi_select_down(wd)))
393 || (_item_single_select_down(wd)))
395 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
401 else if ((!strcmp(ev->keyname, "Home")) ||
402 (!strcmp(ev->keyname, "KP_Home")))
404 it = elm_genlist_first_item_get(obj);
405 elm_genlist_item_bring_in(it);
406 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
409 else if ((!strcmp(ev->keyname, "End")) ||
410 (!strcmp(ev->keyname, "KP_End")))
412 it = elm_genlist_last_item_get(obj);
413 elm_genlist_item_bring_in(it);
414 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
417 else if ((!strcmp(ev->keyname, "Prior")) ||
418 (!strcmp(ev->keyname, "KP_Prior")))
421 y -= -(page_y * v_h) / 100;
425 else if ((!strcmp(ev->keyname, "Next")) ||
426 (!strcmp(ev->keyname, "KP_Next")))
429 y += -(page_y * v_h) / 100;
433 else if (((!strcmp(ev->keyname, "Return")) ||
434 (!strcmp(ev->keyname, "KP_Enter")) ||
435 (!strcmp(ev->keyname, "space")))
436 && (!wd->multi) && (wd->selected))
438 it = elm_genlist_selected_item_get(obj);
439 elm_genlist_item_expanded_set(it,
440 !elm_genlist_item_expanded_get(it));
441 evas_object_smart_callback_call(it->base.widget, SIG_ACTIVATED, it);
443 else if (!strcmp(ev->keyname, "Escape"))
445 if (!_deselect_all_items(wd)) return EINA_FALSE;
446 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
449 else return EINA_FALSE;
451 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
452 _pan_max_get(wd->pan_smart, &pan_max_x, &pan_max_y);
454 if (x > pan_max_x) x = pan_max_x;
456 if (y > pan_max_y) y = pan_max_y;
457 elm_smart_scroller_child_pos_set(wd->scr, x, y);
462 _deselect_all_items(Widget_Data *wd)
464 if (!wd->selected) return EINA_FALSE;
466 elm_genlist_item_selected_set(wd->selected->data, EINA_FALSE);
472 _item_multi_select_up(Widget_Data *wd)
474 if (!wd->selected) return EINA_FALSE;
475 if (!wd->multi) return EINA_FALSE;
477 Elm_Genlist_Item *prev = elm_genlist_item_prev_get(wd->last_selected_item);
478 if (!prev) return EINA_TRUE;
480 if (elm_genlist_item_selected_get(prev))
482 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
483 wd->last_selected_item = prev;
484 elm_genlist_item_show(wd->last_selected_item);
488 elm_genlist_item_selected_set(prev, EINA_TRUE);
489 elm_genlist_item_show(prev);
495 _item_multi_select_down(Widget_Data *wd)
497 if (!wd->selected) return EINA_FALSE;
498 if (!wd->multi) return EINA_FALSE;
500 Elm_Genlist_Item *next = elm_genlist_item_next_get(wd->last_selected_item);
501 if (!next) return EINA_TRUE;
503 if (elm_genlist_item_selected_get(next))
505 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
506 wd->last_selected_item = next;
507 elm_genlist_item_show(wd->last_selected_item);
511 elm_genlist_item_selected_set(next, EINA_TRUE);
512 elm_genlist_item_show(next);
518 _item_single_select_up(Widget_Data *wd)
520 Elm_Genlist_Item *prev;
523 prev = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
524 while ((prev) && (prev->delete_me))
525 prev = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
527 else prev = elm_genlist_item_prev_get(wd->last_selected_item);
529 if (!prev) return EINA_FALSE;
531 _deselect_all_items(wd);
533 elm_genlist_item_selected_set(prev, EINA_TRUE);
534 elm_genlist_item_show(prev);
539 _item_single_select_down(Widget_Data *wd)
541 Elm_Genlist_Item *next;
544 next = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
545 while ((next) && (next->delete_me))
546 next = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
548 else next = elm_genlist_item_next_get(wd->last_selected_item);
550 if (!next) return EINA_FALSE;
552 _deselect_all_items(wd);
554 elm_genlist_item_selected_set(next, EINA_TRUE);
555 elm_genlist_item_show(next);
560 _on_focus_hook(void *data __UNUSED__,
563 Widget_Data *wd = elm_widget_data_get(obj);
565 if (elm_widget_focus_get(obj))
567 elm_object_signal_emit(wd->obj, "elm,action,focus", "elm");
568 evas_object_focus_set(wd->obj, EINA_TRUE);
569 if ((wd->selected) && (!wd->last_selected_item))
570 wd->last_selected_item = eina_list_data_get(wd->selected);
574 elm_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
575 evas_object_focus_set(wd->obj, EINA_FALSE);
580 _del_hook(Evas_Object *obj)
582 Widget_Data *wd = elm_widget_data_get(obj);
584 _item_cache_zero(wd);
585 if (wd->calc_job) ecore_job_del(wd->calc_job);
586 if (wd->update_job) ecore_job_del(wd->update_job);
587 if (wd->queue_idle_enterer) ecore_idle_enterer_del(wd->queue_idle_enterer);
588 if (wd->changed_job) ecore_job_del(wd->changed_job);
589 if (wd->must_recalc_idler) ecore_idler_del(wd->must_recalc_idler);
590 if (wd->multi_timer) ecore_timer_del(wd->multi_timer);
591 if (wd->mode_type) eina_stringshare_del(wd->mode_type);
592 if (wd->scr_hold_timer) ecore_timer_del(wd->scr_hold_timer);
597 _del_pre_hook(Evas_Object *obj)
599 Widget_Data *wd = elm_widget_data_get(obj);
601 if (wd->edit_mode) elm_genlist_edit_mode_set(wd->obj, EINA_FALSE);
602 elm_genlist_clear(obj);
603 evas_object_del(wd->pan_smart);
604 wd->pan_smart = NULL;
608 _mirrored_set(Evas_Object *obj,
611 Widget_Data *wd = elm_widget_data_get(obj);
613 _item_cache_zero(wd);
614 elm_smart_scroller_mirrored_set(wd->scr, rtl);
618 _theme_hook(Evas_Object *obj)
620 Widget_Data *wd = elm_widget_data_get(obj);
623 evas_event_freeze(evas_object_evas_get(wd->obj));
624 _item_cache_zero(wd);
625 _elm_widget_mirrored_reload(obj);
626 _mirrored_set(obj, elm_widget_mirrored_get(obj));
627 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
628 elm_widget_style_get(obj));
629 // edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
630 wd->item_width = wd->item_height = 0;
631 wd->group_item_width = wd->group_item_height = 0;
632 wd->minw = wd->minh = wd->realminw = 0;
633 EINA_INLIST_FOREACH(wd->blocks, itb)
636 Elm_Genlist_Item *it;
638 if (itb->realized) _item_block_unrealize(itb);
639 EINA_LIST_FOREACH(itb->items, l, it)
640 it->mincalcd = EINA_FALSE;
642 itb->changed = EINA_TRUE;
644 if (wd->calc_job) ecore_job_del(wd->calc_job);
645 wd->calc_job = ecore_job_add(_calc_job, wd);
647 evas_event_thaw(evas_object_evas_get(wd->obj));
648 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
652 _show_region_hook(void *data,
655 Widget_Data *wd = elm_widget_data_get(data);
656 Evas_Coord x, y, w, h;
658 elm_widget_show_region_get(obj, &x, &y, &w, &h);
659 //x & y are screen coordinates, Add with pan coordinates
662 if(wd->rename_it) elm_genlist_item_bring_in(wd->rename_it);
663 else elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
667 _sizing_eval(Evas_Object *obj)
669 Widget_Data *wd = elm_widget_data_get(obj);
670 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
672 evas_object_size_hint_min_get(wd->scr, &minw, &minh);
673 evas_object_size_hint_max_get(wd->scr, &maxw, &maxh);
675 if (wd->height_for_width)
679 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
680 if ((vw != 0) && (vw != wd->prev_viewport_w))
684 wd->prev_viewport_w = vw;
685 EINA_INLIST_FOREACH(wd->blocks, itb)
687 itb->must_recalc = EINA_TRUE;
689 if (wd->calc_job) ecore_job_del(wd->calc_job);
690 wd->calc_job = ecore_job_add(_calc_job, wd);
693 if (wd->mode == ELM_LIST_LIMIT)
695 Evas_Coord vmw, vmh, vw, vh;
699 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
700 if ((minw > 0) && (vw < minw)) vw = minw;
701 else if ((maxw > 0) && (vw > maxw))
703 edje_object_size_min_calc
704 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
711 edje_object_size_min_calc
712 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
716 evas_object_size_hint_min_set(obj, minw, minh);
717 evas_object_size_hint_max_set(obj, maxw, maxh);
721 _signal_emit_hook(Evas_Object *obj,
722 const char *emission,
725 Widget_Data *wd = elm_widget_data_get(obj);
726 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
731 _item_highlight(Elm_Genlist_Item *it)
733 const char *selectraise;
734 if ((it->wd->no_select) || (it->delete_me) || (it->highlighted) ||
735 (it->disabled) || (it->display_only) || (it->mode_view))
737 edje_object_signal_emit(it->base.view, "elm,state,selected", "elm");
738 if (it->edit_obj) edje_object_signal_emit(it->edit_obj, "elm,state,selected", "elm");
739 selectraise = edje_object_data_get(it->base.view, "selectraise");
740 if ((selectraise) && (!strcmp(selectraise, "on")))
742 if (it->edit_obj) evas_object_raise(it->edit_obj);
743 else evas_object_raise(it->base.view);
744 if ((it->group_item) && (it->group_item->realized))
745 evas_object_raise(it->group_item->base.view);
747 it->highlighted = EINA_TRUE;
751 _item_block_del(Elm_Genlist_Item *it)
754 Item_Block *itb = it->block;
756 itb->items = eina_list_remove(itb->items, it);
758 itb->changed = EINA_TRUE;
759 if (!it->wd->reorder_deleted)
761 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
762 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
766 il = EINA_INLIST_GET(itb);
767 Item_Block *itbn = (Item_Block *)(il->next);
769 it->parent->items = eina_list_remove(it->parent->items, it);
771 it->wd->blocks = eina_inlist_remove(it->wd->blocks, il);
773 if (itbn) itbn->changed = EINA_TRUE;
777 if (itb->count < itb->wd->max_items_per_block/2)
779 il = EINA_INLIST_GET(itb);
780 Item_Block *itbp = (Item_Block *)(il->prev);
781 Item_Block *itbn = (Item_Block *)(il->next);
782 if ((itbp) && ((itbp->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
784 Elm_Genlist_Item *it2;
786 EINA_LIST_FREE(itb->items, it2)
789 itbp->items = eina_list_append(itbp->items, it2);
791 itbp->changed = EINA_TRUE;
793 it->wd->blocks = eina_inlist_remove(it->wd->blocks,
794 EINA_INLIST_GET(itb));
797 else if ((itbn) && ((itbn->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
801 Eina_List *last = eina_list_last(itb->items);
802 Elm_Genlist_Item *it2 = last->data;
805 itb->items = eina_list_remove_list(itb->items, last);
806 itbn->items = eina_list_prepend(itbn->items, it2);
808 itbn->changed = EINA_TRUE;
811 eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb));
819 _item_subitems_clear(Elm_Genlist_Item *it)
822 Eina_List *tl = NULL, *l;
823 Elm_Genlist_Item *it2;
825 EINA_LIST_FOREACH(it->items, l, it2)
826 tl = eina_list_append(tl, it2);
828 EINA_LIST_FREE(tl, it2)
829 elm_genlist_item_del(it2);
833 _item_del(Elm_Genlist_Item *it)
835 Evas_Object *tob = it->wd->obj;
837 evas_event_freeze(evas_object_evas_get(tob));
838 elm_widget_item_pre_notify_del(it);
839 elm_genlist_item_subitems_clear(it);
840 it->wd->walking -= it->walking;
841 if (it->wd->show_item == it) it->wd->show_item = NULL;
842 if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it);
843 if (it->realized) _item_unrealize(it, EINA_FALSE);
844 if (it->effect_item_realized) _effect_item_unrealize(it);
845 if (it->block) _item_block_del(it);
846 if ((!it->delete_me) && (it->itc->func.del))
847 it->itc->func.del((void *)it->base.data, it->base.widget);
848 it->delete_me = EINA_TRUE;
850 it->wd->queue = eina_list_remove(it->wd->queue, it);
852 if (it->wd->anchor_item == it)
854 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
855 if (!it->wd->anchor_item)
856 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
859 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
861 it->parent->items = eina_list_remove(it->parent->items, it);
862 if (it->flags & ELM_GENLIST_ITEM_GROUP)
863 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
864 if (it->long_timer) ecore_timer_del(it->long_timer);
865 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
867 if (it->tooltip.del_cb)
868 it->tooltip.del_cb((void *)it->tooltip.data, it->base.widget, it);
870 evas_event_thaw(evas_object_evas_get(tob));
871 evas_event_thaw_eval(evas_object_evas_get(tob));
873 elm_widget_item_del(it);
877 _item_select(Elm_Genlist_Item *it)
881 Evas_Object *parent = it->base.widget;
882 if ((it->wd->no_select) || (it->delete_me) || (it->mode_view)) return;
885 if (it->wd->always_select) goto call;
888 it->selected = EINA_TRUE;
889 it->wd->selected = eina_list_append(it->wd->selected, it);
891 evas_object_ref(parent);
894 if (it->wd->last_selected_item && (it != it->wd->last_selected_item))
896 EINA_LIST_FOREACH(it->wd->last_selected_item->icon_objs, l, obj)
897 elm_widget_focused_object_clear(obj);
899 if (it->func.func) it->func.func((void *)it->func.data, parent, it);
901 evas_object_smart_callback_call(parent, SIG_SELECTED, it);
904 if ((it->wd->clear_me) && (!it->wd->walking))
906 elm_genlist_clear(parent);
911 if ((!it->walking) && (it->delete_me))
913 if (!it->relcount) _item_del(it);
917 if (it && it->wd) it->wd->last_selected_item = it; // TODO: Remove 'if'?
919 evas_object_unref(parent);
923 _item_unselect(Elm_Genlist_Item *it)
925 const char *stacking, *selectraise;
927 if ((it->delete_me) || (!it->highlighted)) return;
928 edje_object_signal_emit(it->base.view, "elm,state,unselected", "elm");
929 if (it->edit_obj) edje_object_signal_emit(it->edit_obj, "elm,state,unselected", "elm");
930 stacking = edje_object_data_get(it->base.view, "stacking");
931 selectraise = edje_object_data_get(it->base.view, "selectraise");
932 if ((selectraise) && (!strcmp(selectraise, "on")))
934 if ((stacking) && (!strcmp(stacking, "below")))
935 evas_object_lower(it->base.view);
937 it->highlighted = EINA_FALSE;
940 it->selected = EINA_FALSE;
941 it->wd->selected = eina_list_remove(it->wd->selected, it);
942 evas_object_smart_callback_call(it->base.widget, SIG_UNSELECTED, it);
947 _mouse_move(void *data,
948 Evas *evas __UNUSED__,
952 Elm_Genlist_Item *it = data;
953 Evas_Event_Mouse_Move *ev = event_info;
954 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
955 Evas_Coord ox, oy, ow, oh, it_scrl_y, y_pos;
957 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
959 if (!it->wd->on_hold)
961 it->wd->on_hold = EINA_TRUE;
962 if (!it->wd->wasselected)
966 if (it->wd->multitouched)
968 it->wd->cur_x = ev->cur.canvas.x;
969 it->wd->cur_y = ev->cur.canvas.y;
972 if ((it->dragging) && (it->down))
974 if (it->wd->movements == SWIPE_MOVES) it->wd->swipe = EINA_TRUE;
977 it->wd->history[it->wd->movements].x = ev->cur.canvas.x;
978 it->wd->history[it->wd->movements].y = ev->cur.canvas.y;
979 if (abs((it->wd->history[it->wd->movements].x -
980 it->wd->history[0].x)) > 40)
981 it->wd->swipe = EINA_TRUE;
987 ecore_timer_del(it->long_timer);
988 it->long_timer = NULL;
990 evas_object_smart_callback_call(it->base.widget, SIG_DRAG, it);
993 if ((!it->down) /* || (it->wd->on_hold)*/ || (it->wd->longpressed))
997 ecore_timer_del(it->long_timer);
998 it->long_timer = NULL;
1000 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
1002 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
1003 it_scrl_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
1005 if (!it->wd->reorder_start_y)
1006 it->wd->reorder_start_y = it->block->y + it->y;
1010 else if (it_scrl_y + it->wd->reorder_it->h > oy + oh)
1011 y_pos = oy + oh - it->wd->reorder_it->h;
1016 _item_position(it, it->edit_obj, it->scrl_x, y_pos);
1018 _item_position(it, it->base.view, it->scrl_x, y_pos);
1019 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1020 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1024 if (!it->display_only)
1025 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1026 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1027 x = ev->cur.canvas.x - x;
1028 y = ev->cur.canvas.y - y;
1031 if (adx < 0) adx = -dx;
1034 if (ady < 0) ady = -dy;
1037 if ((adx > minw) || (ady > minh))
1039 it->dragging = EINA_TRUE;
1040 it->wd->dragging_queue = eina_list_append(it->wd->dragging_queue, it);
1043 ecore_timer_del(it->long_timer);
1044 it->long_timer = NULL;
1046 if (!it->wd->wasselected)
1051 evas_object_smart_callback_call(it->base.widget,
1052 SIG_DRAG_START_UP, it);
1056 evas_object_smart_callback_call(it->base.widget,
1057 SIG_DRAG_START_LEFT, it);
1059 evas_object_smart_callback_call(it->base.widget,
1060 SIG_DRAG_START_RIGHT, it);
1066 evas_object_smart_callback_call(it->base.widget,
1067 SIG_DRAG_START_DOWN, it);
1071 evas_object_smart_callback_call(it->base.widget,
1072 SIG_DRAG_START_LEFT, it);
1074 evas_object_smart_callback_call(it->base.widget,
1075 SIG_DRAG_START_RIGHT, it);
1082 _long_press(void *data)
1084 Elm_Genlist_Item *it = data, *it_tmp;
1085 Eina_List *list, *l;
1087 it->long_timer = NULL;
1088 if ((it->disabled) || (it->dragging) || (it->display_only) || (it->wd->rename_it))
1089 return ECORE_CALLBACK_CANCEL;
1090 it->wd->longpressed = EINA_TRUE;
1091 evas_object_smart_callback_call(it->base.widget, SIG_LONGPRESSED, it);
1092 if ((it->wd->reorder_mode) && (it->flags != ELM_GENLIST_ITEM_GROUP))
1094 it->wd->reorder_it = it;
1095 it->wd->reorder_start_y = 0;
1097 evas_object_raise(it->edit_obj);
1099 evas_object_raise(it->base.view);
1100 elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
1101 elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_FALSE);
1103 list = elm_genlist_realized_items_get(it->wd->obj);
1104 EINA_LIST_FOREACH(list, l, it_tmp)
1106 if (it != it_tmp) _item_unselect(it_tmp);
1110 EINA_LIST_FOREACH(it->items, l, it_tmp)
1112 if (elm_genlist_item_expanded_get(it_tmp))
1114 elm_genlist_item_expanded_set(it_tmp, EINA_FALSE);
1115 return ECORE_CALLBACK_RENEW;
1119 if (elm_genlist_item_expanded_get(it))
1121 elm_genlist_item_expanded_set(it, EINA_FALSE);
1122 return ECORE_CALLBACK_RENEW;
1125 edje_object_signal_emit(it->edit_obj, "elm,action,item,reorder_start", "elm");
1127 edje_object_signal_emit(it->base.view, "elm,state,reorder,enabled", "elm");
1129 return ECORE_CALLBACK_CANCEL;
1133 _swipe(Elm_Genlist_Item *it)
1138 if ((it->display_only) || (it->disabled)) return;
1139 it->wd->swipe = EINA_FALSE;
1140 for (i = 0; i < it->wd->movements; i++)
1142 sum += it->wd->history[i].x;
1143 if (abs(it->wd->history[0].y - it->wd->history[i].y) > 10) return;
1146 sum /= it->wd->movements;
1147 if (abs(sum - it->wd->history[0].x) <= 10) return;
1148 evas_object_smart_callback_call(it->base.widget, SIG_SWIPE, it);
1152 _swipe_cancel(void *data)
1154 Elm_Genlist_Item *it = data;
1156 if (!it) return ECORE_CALLBACK_CANCEL;
1157 it->wd->swipe = EINA_FALSE;
1158 it->wd->movements = 0;
1159 return ECORE_CALLBACK_RENEW;
1163 _multi_cancel(void *data)
1165 Widget_Data *wd = data;
1167 if (!wd) return ECORE_CALLBACK_CANCEL;
1168 wd->multi_timeout = EINA_TRUE;
1169 return ECORE_CALLBACK_RENEW;
1173 _multi_touch_gesture_eval(void *data)
1175 Elm_Genlist_Item *it = data;
1177 it->wd->multitouched = EINA_FALSE;
1178 if (it->wd->multi_timer)
1180 ecore_timer_del(it->wd->multi_timer);
1181 it->wd->multi_timer = NULL;
1183 if (it->wd->multi_timeout)
1185 it->wd->multi_timeout = EINA_FALSE;
1189 Evas_Coord minw = 0, minh = 0;
1190 Evas_Coord off_x, off_y, off_mx, off_my;
1192 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1193 off_x = abs(it->wd->cur_x - it->wd->prev_x);
1194 off_y = abs(it->wd->cur_y - it->wd->prev_y);
1195 off_mx = abs(it->wd->cur_mx - it->wd->prev_mx);
1196 off_my = abs(it->wd->cur_my - it->wd->prev_my);
1198 if (((off_x > minw) || (off_y > minh)) && ((off_mx > minw) || (off_my > minh)))
1200 if ((off_x + off_mx) > (off_y + off_my))
1202 if ((it->wd->cur_x > it->wd->prev_x) && (it->wd->cur_mx > it->wd->prev_mx))
1203 evas_object_smart_callback_call(it->base.widget,
1204 SIG_MULTI_SWIPE_RIGHT, it);
1205 else if ((it->wd->cur_x < it->wd->prev_x) && (it->wd->cur_mx < it->wd->prev_mx))
1206 evas_object_smart_callback_call(it->base.widget,
1207 SIG_MULTI_SWIPE_LEFT, it);
1208 else if (abs(it->wd->cur_x - it->wd->cur_mx) > abs(it->wd->prev_x - it->wd->prev_mx))
1209 evas_object_smart_callback_call(it->base.widget,
1210 SIG_MULTI_PINCH_OUT, it);
1212 evas_object_smart_callback_call(it->base.widget,
1213 SIG_MULTI_PINCH_IN, it);
1217 if ((it->wd->cur_y > it->wd->prev_y) && (it->wd->cur_my > it->wd->prev_my))
1218 evas_object_smart_callback_call(it->base.widget,
1219 SIG_MULTI_SWIPE_DOWN, it);
1220 else if ((it->wd->cur_y < it->wd->prev_y) && (it->wd->cur_my < it->wd->prev_my))
1221 evas_object_smart_callback_call(it->base.widget,
1222 SIG_MULTI_SWIPE_UP, it);
1223 else if (abs(it->wd->cur_y - it->wd->cur_my) > abs(it->wd->prev_y - it->wd->prev_my))
1224 evas_object_smart_callback_call(it->base.widget,
1225 SIG_MULTI_PINCH_OUT, it);
1227 evas_object_smart_callback_call(it->base.widget,
1228 SIG_MULTI_PINCH_IN, it);
1231 it->wd->multi_timeout = EINA_FALSE;
1235 _multi_down(void *data,
1236 Evas *evas __UNUSED__,
1237 Evas_Object *obj __UNUSED__,
1240 Elm_Genlist_Item *it = data;
1241 Evas_Event_Multi_Down *ev = event_info;
1243 if ((it->wd->multi_device != 0) || (it->wd->multitouched) || (it->wd->multi_timeout)) return;
1244 it->wd->multi_device = ev->device;
1245 it->wd->multi_down = EINA_TRUE;
1246 it->wd->multitouched = EINA_TRUE;
1247 it->wd->prev_mx = ev->canvas.x;
1248 it->wd->prev_my = ev->canvas.y;
1249 if (!it->wd->wasselected) _item_unselect(it);
1250 it->wd->wasselected = EINA_FALSE;
1251 it->wd->longpressed = EINA_FALSE;
1254 ecore_timer_del(it->long_timer);
1255 it->long_timer = NULL;
1259 it->dragging = EINA_FALSE;
1260 evas_object_smart_callback_call(it->base.widget, SIG_DRAG_STOP, it);
1262 if (it->swipe_timer)
1264 ecore_timer_del(it->swipe_timer);
1265 it->swipe_timer = NULL;
1267 if (it->wd->on_hold)
1269 it->wd->swipe = EINA_FALSE;
1270 it->wd->movements = 0;
1271 it->wd->on_hold = EINA_FALSE;
1276 _multi_up(void *data,
1277 Evas *evas __UNUSED__,
1278 Evas_Object *obj __UNUSED__,
1281 Elm_Genlist_Item *it = data;
1282 Evas_Event_Multi_Up *ev = event_info;
1284 if (it->wd->multi_device != ev->device) return;
1285 it->wd->multi_device = 0;
1286 it->wd->multi_down = EINA_FALSE;
1287 if (it->wd->mouse_down) return;
1288 _multi_touch_gesture_eval(data);
1292 _multi_move(void *data,
1293 Evas *evas __UNUSED__,
1294 Evas_Object *obj __UNUSED__,
1297 Elm_Genlist_Item *it = data;
1298 Evas_Event_Multi_Move *ev = event_info;
1300 if (it->wd->multi_device != ev->device) return;
1301 it->wd->cur_mx = ev->cur.canvas.x;
1302 it->wd->cur_my = ev->cur.canvas.y;
1306 _mouse_down(void *data,
1307 Evas *evas __UNUSED__,
1311 Elm_Genlist_Item *it = data;
1312 Evas_Event_Mouse_Down *ev = event_info;
1315 if (ev->button != 1) return;
1316 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1318 it->wd->on_hold = EINA_TRUE;
1320 it->down = EINA_TRUE;
1321 it->dragging = EINA_FALSE;
1322 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1323 it->dx = ev->canvas.x - x;
1324 it->dy = ev->canvas.y - y;
1325 it->wd->mouse_down = EINA_TRUE;
1326 if (!it->wd->multitouched)
1328 it->wd->prev_x = ev->canvas.x;
1329 it->wd->prev_y = ev->canvas.y;
1330 it->wd->multi_timeout = EINA_FALSE;
1331 if (it->wd->multi_timer) ecore_timer_del(it->wd->multi_timer);
1332 it->wd->multi_timer = ecore_timer_add(1, _multi_cancel, it->wd);
1334 it->wd->longpressed = EINA_FALSE;
1335 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1336 else it->wd->on_hold = EINA_FALSE;
1337 if (it->wd->on_hold) return;
1338 it->wd->wasselected = it->selected;
1339 _item_highlight(it);
1340 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
1341 if ((!it->disabled) && (!it->display_only))
1343 evas_object_smart_callback_call(it->base.widget, SIG_CLICKED_DOUBLE, it);
1344 evas_object_smart_callback_call(it->base.widget, SIG_ACTIVATED, it);
1346 if (it->long_timer) ecore_timer_del(it->long_timer);
1347 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
1348 it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
1350 it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press,
1353 it->long_timer = NULL;
1354 it->wd->swipe = EINA_FALSE;
1355 it->wd->movements = 0;
1359 _mouse_up(void *data,
1360 Evas *evas __UNUSED__,
1361 Evas_Object *obj __UNUSED__,
1364 Elm_Genlist_Item *it = data;
1365 Evas_Event_Mouse_Up *ev = event_info;
1366 Eina_Bool dragged = EINA_FALSE;
1368 if (ev->button != 1) return;
1369 it->down = EINA_FALSE;
1370 it->wd->mouse_down = EINA_FALSE;
1371 if (it->wd->multitouched)
1373 // in single selection modes, some multi touching can make multi highlighted items.
1374 // if a item not selected and highlighted, it should be unhighlighted.
1375 if ((!it->wd->multi) && (!it->selected) && (it->highlighted)) _item_unselect(it);
1376 if (it->wd->multi_down) return;
1377 _multi_touch_gesture_eval(data);
1380 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1381 else it->wd->on_hold = EINA_FALSE;
1384 ecore_timer_del(it->long_timer);
1385 it->long_timer = NULL;
1387 while (it->wd->dragging_queue)
1389 Elm_Genlist_Item *dragging_it = NULL;
1390 dragging_it = eina_list_data_get(it->wd->dragging_queue);
1391 dragging_it->dragging = EINA_FALSE;
1392 evas_object_smart_callback_call(dragging_it->base.widget, SIG_DRAG_STOP, dragging_it);
1393 if (dragging_it->want_unrealize)
1395 _item_unrealize(dragging_it, EINA_FALSE);
1396 if (dragging_it->block->want_unrealize)
1397 _item_block_unrealize(it->block);
1399 it->wd->dragging_queue = eina_list_remove_list(it->wd->dragging_queue,it->wd->dragging_queue);
1402 if (it->swipe_timer)
1404 ecore_timer_del(it->swipe_timer);
1405 it->swipe_timer = NULL;
1407 if (it->wd->multi_timer)
1409 ecore_timer_del(it->wd->multi_timer);
1410 it->wd->multi_timer = NULL;
1411 it->wd->multi_timeout = EINA_FALSE;
1413 if (it->wd->on_hold)
1415 if (it->wd->swipe) _swipe(data);
1416 it->wd->longpressed = EINA_FALSE;
1417 it->wd->on_hold = EINA_FALSE;
1420 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
1422 Evas_Coord it_scrl_y = ev->canvas.y - it->wd->reorder_it->dy;
1424 if (it->wd->reorder_rel && (it->wd->reorder_it->parent == it->wd->reorder_rel->parent))
1426 if (it_scrl_y <= it->wd->reorder_rel->scrl_y)
1427 _item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
1429 _item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
1433 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1434 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1436 it->wd->reorder_deleted = EINA_FALSE;
1437 edje_object_signal_emit(it->edit_obj, "elm,action,item,reorder_end", "elm");
1438 it->wd->reorder_it = it->wd->reorder_rel = NULL;
1439 elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
1440 elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_TRUE);
1443 if (it->wd->longpressed)
1445 it->wd->longpressed = EINA_FALSE;
1446 if (!it->wd->wasselected)
1448 it->wd->wasselected = EINA_FALSE;
1451 if ((it->disabled) || (dragged) || (it->display_only)) return;
1452 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1457 _item_highlight(it);
1460 else _item_unselect(it);
1466 Widget_Data *wd = it->wd;
1469 while (wd->selected) _item_unselect(wd->selected->data);
1474 const Eina_List *l, *l_next;
1475 Elm_Genlist_Item *it2;
1477 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
1478 if (it2 != it) _item_unselect(it2);
1479 //_item_highlight(it);
1482 _item_highlight(it);
1488 _signal_expand_toggle(void *data,
1489 Evas_Object *obj __UNUSED__,
1490 const char *emission __UNUSED__,
1491 const char *source __UNUSED__)
1493 Elm_Genlist_Item *it = data;
1496 evas_object_smart_callback_call(it->base.widget, SIG_CONTRACT_REQUEST, it);
1498 evas_object_smart_callback_call(it->base.widget, SIG_EXPAND_REQUEST, it);
1502 _signal_expand(void *data,
1503 Evas_Object *obj __UNUSED__,
1504 const char *emission __UNUSED__,
1505 const char *source __UNUSED__)
1507 Elm_Genlist_Item *it = data;
1510 evas_object_smart_callback_call(it->base.widget, SIG_EXPAND_REQUEST, it);
1514 _signal_contract(void *data,
1515 Evas_Object *obj __UNUSED__,
1516 const char *emission __UNUSED__,
1517 const char *source __UNUSED__)
1519 Elm_Genlist_Item *it = data;
1522 evas_object_smart_callback_call(it->base.widget, SIG_CONTRACT_REQUEST, it);
1526 _scr_hold_timer_cb(void *data)
1528 if (!data) return ECORE_CALLBACK_CANCEL;
1529 Widget_Data *wd = data;
1530 elm_smart_scroller_hold_set(wd->scr, EINA_FALSE);
1531 wd->scr_hold_timer = NULL;
1532 return ECORE_CALLBACK_CANCEL;
1536 _mode_finished_signal_cb(void *data,
1538 const char *emission __UNUSED__,
1539 const char *source __UNUSED__)
1543 Elm_Genlist_Item *it = data;
1544 if ((it->delete_me) || (!it->realized) || (!it->mode_view)) return;
1546 Evas *te = evas_object_evas_get(obj);
1548 evas_event_freeze(te);
1549 it->nocache = EINA_FALSE;
1550 _mode_item_unrealize(it);
1552 evas_object_raise(it->group_item->base.view);
1553 snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished", it->wd->mode_type);
1554 edje_object_signal_callback_del_full(obj, buf, "elm", _mode_finished_signal_cb, it);
1555 evas_event_thaw(te);
1556 evas_event_thaw_eval(te);
1560 _item_cache_clean(Widget_Data *wd)
1562 evas_event_freeze(evas_object_evas_get(wd->obj));
1563 while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max))
1567 itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache);
1568 wd->item_cache = eina_inlist_remove(wd->item_cache,
1569 wd->item_cache->last);
1570 wd->item_cache_count--;
1571 if (itc->spacer) evas_object_del(itc->spacer);
1572 if (itc->base_view) evas_object_del(itc->base_view);
1573 if (itc->item_style) eina_stringshare_del(itc->item_style);
1576 evas_event_thaw(evas_object_evas_get(wd->obj));
1577 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
1581 _item_cache_zero(Widget_Data *wd)
1583 int pmax = wd->item_cache_max;
1584 wd->item_cache_max = 0;
1585 _item_cache_clean(wd);
1586 wd->item_cache_max = pmax;
1590 _item_cache_add(Elm_Genlist_Item *it)
1594 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1595 if (it->wd->item_cache_max <= 0)
1597 evas_object_del(it->base.view);
1598 it->base.view = NULL;
1599 evas_object_del(it->spacer);
1601 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1602 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1606 it->wd->item_cache_count++;
1607 itc = calloc(1, sizeof(Item_Cache));
1610 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1611 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1614 it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache,
1615 EINA_INLIST_GET(itc));
1616 itc->spacer = it->spacer;
1618 itc->base_view = it->base.view;
1619 it->base.view = NULL;
1620 evas_object_hide(itc->base_view);
1621 evas_object_move(itc->base_view, -9999, -9999);
1622 itc->item_style = eina_stringshare_add(it->itc->item_style);
1623 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
1624 itc->compress = (it->wd->compress);
1625 itc->odd = (it->order_num_in & 0x1);
1626 itc->selected = it->selected;
1627 itc->disabled = it->disabled;
1628 itc->expanded = it->expanded;
1631 ecore_timer_del(it->long_timer);
1632 it->long_timer = NULL;
1634 if (it->swipe_timer)
1636 ecore_timer_del(it->swipe_timer);
1637 it->swipe_timer = NULL;
1639 // FIXME: other callbacks?
1640 edje_object_signal_callback_del_full(itc->base_view,
1641 "elm,action,expand,toggle",
1642 "elm", _signal_expand_toggle, it);
1643 edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand",
1645 _signal_expand, it);
1646 edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract",
1647 "elm", _signal_contract, it);
1648 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_DOWN,
1650 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP,
1652 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_MOVE,
1654 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_DOWN,
1656 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_UP,
1658 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_MOVE,
1660 _item_cache_clean(it->wd);
1661 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1662 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1666 _item_cache_find(Elm_Genlist_Item *it)
1669 Eina_Bool tree = 0, odd;
1671 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
1672 odd = (it->order_num_in & 0x1);
1673 EINA_INLIST_FOREACH(it->wd->item_cache, itc)
1675 if ((itc->selected) || (itc->disabled) || (itc->expanded))
1677 if ((itc->tree == tree) &&
1678 (itc->odd == odd) &&
1679 (itc->compress == it->wd->compress) &&
1680 (!strcmp(it->itc->item_style, itc->item_style)))
1682 it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
1683 EINA_INLIST_GET(itc));
1684 it->wd->item_cache_count--;
1692 _item_cache_free(Item_Cache *itc)
1694 if (itc->spacer) evas_object_del(itc->spacer);
1695 if (itc->base_view) evas_object_del(itc->base_view);
1696 if (itc->item_style) eina_stringshare_del(itc->item_style);
1701 _item_label_hook(Elm_Genlist_Item *it, const char *part)
1703 if (!it->itc->func.label_get) return NULL;
1704 return edje_object_part_text_get(it->base.view, part);
1708 _icon_focused(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1710 Elm_Genlist_Item *it = data;
1711 if (it) it->defer_unrealize = EINA_TRUE;
1715 _icon_unfocused(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1717 Elm_Genlist_Item *it = data;
1718 if (it) it->defer_unrealize = EINA_FALSE;
1722 _item_del_hook(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1724 Elm_Genlist_Item *it = event_info;
1726 if (it->wd->last_selected_item == it)
1727 it->wd->last_selected_item = NULL;
1731 _item_label_realize(Elm_Genlist_Item *it,
1732 Evas_Object *target,
1735 if (it->itc->func.label_get)
1740 *source = elm_widget_stringlist_get(edje_object_data_get(target, "labels"));
1741 EINA_LIST_FOREACH(*source, l, key)
1743 char *s = it->itc->func.label_get
1744 ((void *)it->base.data, it->base.widget, key);
1748 edje_object_part_text_set(target, key, s);
1753 edje_object_part_text_set(target, key, "");
1760 _item_icon_realize(Elm_Genlist_Item *it,
1761 Evas_Object *target,
1764 Eina_List *res = NULL;
1766 if (it->itc->func.icon_get)
1771 *source = elm_widget_stringlist_get(edje_object_data_get(target, "icons"));
1772 EINA_LIST_FOREACH(*source, l, key)
1774 Evas_Object *ic = it->itc->func.icon_get
1775 ((void *)it->base.data, it->base.widget, key);
1779 res = eina_list_append(res, ic);
1780 edje_object_part_swallow(target, key, ic);
1781 evas_object_show(ic);
1782 elm_widget_sub_object_add(it->base.widget, ic);
1783 evas_object_event_callback_add(ic, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, it);
1785 elm_widget_disabled_set(ic, EINA_TRUE);
1794 _item_state_realize(Elm_Genlist_Item *it,
1795 Evas_Object *target,
1798 if (it->itc->func.state_get)
1804 *source = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
1805 EINA_LIST_FOREACH(*source, l, key)
1807 Eina_Bool on = it->itc->func.state_get
1808 ((void *)it->base.data, it->base.widget, key);
1812 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
1813 edje_object_signal_emit(target, buf, "elm");
1817 snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
1818 edje_object_signal_emit(target, buf, "elm");
1825 _item_realize(Elm_Genlist_Item *it,
1829 Elm_Genlist_Item *it2;
1830 const char *stacking;
1831 const char *treesize;
1833 int depth, tsize = 20;
1834 Item_Cache *itc = NULL;
1836 if ((it->realized) || (it->delete_me)) return;
1837 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1838 it->order_num_in = in;
1839 if (it->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE) calc = EINA_FALSE;
1840 if ((it->nocache) && (!it->renamed))
1841 it->nocache = EINA_FALSE;
1843 itc = _item_cache_find(it);
1844 if (itc && (!it->wd->effect_mode))
1846 it->base.view = itc->base_view;
1847 itc->base_view = NULL;
1848 it->spacer = itc->spacer;
1853 it->base.view = edje_object_add(evas_object_evas_get(it->base.widget));
1854 edje_object_scale_set(it->base.view,
1855 elm_widget_scale_get(it->base.widget) *
1856 _elm_config->scale);
1857 evas_object_smart_member_add(it->base.view, it->wd->pan_smart);
1858 elm_widget_sub_object_add(it->base.widget, it->base.view);
1860 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS)
1861 strncpy(buf, "tree", sizeof(buf));
1862 else strncpy(buf, "item", sizeof(buf));
1863 if (it->wd->compress)
1864 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
1866 if (in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
1867 strncat(buf, "/", sizeof(buf) - strlen(buf));
1868 strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf));
1870 _elm_theme_object_set(it->base.widget, it->base.view, "genlist", buf,
1871 elm_widget_style_get(it->base.widget));
1872 edje_object_mirrored_set(it->base.view,
1873 elm_widget_mirrored_get(it->base.widget));
1875 evas_object_rectangle_add(evas_object_evas_get(it->base.widget));
1876 evas_object_color_set(it->spacer, 0, 0, 0, 0);
1877 elm_widget_sub_object_add(it->base.widget, it->spacer);
1879 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
1881 if (it2->parent->flags != ELM_GENLIST_ITEM_GROUP) depth += 1;
1883 it->expanded_depth = depth;
1884 treesize = edje_object_data_get(it->base.view, "treesize");
1885 if (treesize) tsize = atoi(treesize);
1886 evas_object_size_hint_min_set(it->spacer,
1887 (depth * tsize) * _elm_config->scale, 1);
1888 edje_object_part_swallow(it->base.view, "elm.swallow.pad", it->spacer);
1891 edje_object_signal_callback_add(it->base.view,
1892 "elm,action,expand,toggle",
1893 "elm", _signal_expand_toggle, it);
1894 edje_object_signal_callback_add(it->base.view, "elm,action,expand",
1895 "elm", _signal_expand, it);
1896 edje_object_signal_callback_add(it->base.view, "elm,action,contract",
1897 "elm", _signal_contract, it);
1898 stacking = edje_object_data_get(it->base.view, "stacking");
1901 if (!strcmp(stacking, "below")) evas_object_lower(it->base.view);
1902 else if (!strcmp(stacking, "above"))
1903 evas_object_raise(it->base.view);
1905 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_DOWN,
1907 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_UP,
1909 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_MOVE,
1911 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_DOWN,
1913 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_UP,
1915 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_MOVE,
1918 if ((!it->edit_obj) &&(it->wd->edit_mode) &&
1919 (it->flags != ELM_GENLIST_ITEM_GROUP) && (it->itc->edit_item_style))
1920 _effect_item_realize(it, EINA_FALSE);
1924 if ((it->selected) && (it->selected != itc->selected))
1926 edje_object_signal_emit(it->base.view,
1927 "elm,state,selected", "elm");
1929 edje_object_signal_emit(it->edit_obj,
1930 "elm,state,selected", "elm");
1932 if ((it->disabled) && (it->disabled != itc->disabled))
1934 edje_object_signal_emit(it->base.view,
1935 "elm,state,disabled", "elm");
1937 edje_object_signal_emit(it->edit_obj,
1938 "elm,state,disabled", "elm");
1940 if ((it->expanded) && (it->expanded != itc->expanded))
1942 edje_object_signal_emit(it->base.view,
1943 "elm,state,expanded", "elm");
1945 edje_object_signal_emit(it->edit_obj,
1946 "elm,state,expanded", "elm");
1953 edje_object_signal_emit(it->base.view,
1954 "elm,state,selected", "elm");
1956 edje_object_signal_emit(it->edit_obj,
1957 "elm,state,selected", "elm");
1961 edje_object_signal_emit(it->base.view,
1962 "elm,state,disabled", "elm");
1964 edje_object_signal_emit(it->edit_obj,
1965 "elm,state,disabled", "elm");
1969 edje_object_signal_emit(it->base.view,
1970 "elm,state,expanded", "elm");
1972 edje_object_signal_emit(it->edit_obj,
1973 "elm,state,expanded", "elm");
1978 if ((calc) && (it->wd->homogeneous) &&
1979 ((it->wd->item_width) ||
1980 ((it->wd->item_width) && (it->wd->group_item_width))))
1982 /* homogenous genlist shortcut */
1985 if (it->flags & ELM_GENLIST_ITEM_GROUP)
1987 it->w = it->minw = it->wd->group_item_width;
1988 it->h = it->minh = it->wd->group_item_height;
1992 it->w = it->minw = it->wd->item_width;
1993 it->h = it->minh = it->wd->item_height;
1995 it->mincalcd = EINA_TRUE;
2000 _item_label_realize(it, it->base.view, &it->labels);
2001 it->icon_objs = _item_icon_realize(it, it->base.view, &it->icons);
2002 _item_state_realize(it, it->base.view, &it->states);
2003 if (it->itc->func.icon_get) // for rename mode
2010 elm_widget_stringlist_get(edje_object_data_get(it->base.view, "renames"));
2011 EINA_LIST_FOREACH(it->icons, l, key)
2013 Evas_Object *ic = it->itc->func.icon_get
2014 ((void *)it->base.data, it->base.widget, l->data);
2017 it->icon_objs = eina_list_append(it->icon_objs, ic);
2018 edje_object_part_swallow(it->base.view, key, ic);
2019 evas_object_show(ic);
2020 elm_widget_sub_object_add(it->base.widget, ic);
2021 // FIXME: if entry calcuates its cursor position correctly and conformant works,
2022 // genlist does not need to handle this focus thing.
2023 evas_object_smart_callback_add(ic, "focused", _icon_focused, it);
2024 evas_object_smart_callback_add(ic, "unfocused", _icon_unfocused, it);
2029 if (!it->mincalcd || it->wd->pan_resize || ((it->wd->height_for_width) && (it->w != it->minw)))
2031 Evas_Coord mw = -1, mh = -1;
2033 if (it->wd->height_for_width) mw = it->wd->w; // TODO: Removed this. This was removed from upstream.
2035 if (!it->display_only)
2036 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2037 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
2038 edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw,
2040 if (!it->display_only)
2041 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2042 it->w = it->minw = mw;
2043 it->h = it->minh = mh;
2044 it->mincalcd = EINA_TRUE;
2046 if ((!it->wd->group_item_width) && (it->flags == ELM_GENLIST_ITEM_GROUP))
2048 it->wd->group_item_width = mw;
2049 it->wd->group_item_height = mh;
2051 else if ((!it->wd->item_width) && (it->flags == ELM_GENLIST_ITEM_NONE))
2053 it->wd->item_width = mw;
2054 it->wd->item_height = mh;
2057 if (!calc) evas_object_show(it->base.view);
2060 if (it->tooltip.content_cb)
2062 elm_widget_item_tooltip_content_cb_set(it,
2063 it->tooltip.content_cb,
2064 it->tooltip.data, NULL);
2065 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
2068 if (it->mouse_cursor)
2069 elm_widget_item_cursor_set(it, it->mouse_cursor);
2071 it->realized = EINA_TRUE;
2072 it->want_unrealize = EINA_FALSE;
2074 if (itc) _item_cache_free(itc);
2075 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2076 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2078 evas_object_smart_callback_call(it->base.widget, SIG_REALIZED, it);
2079 if ((!calc) && (it->wd->edit_mode) && (it->flags != ELM_GENLIST_ITEM_GROUP))
2081 if (it->itc->edit_item_style)
2083 if (!it->edit_obj) _effect_item_realize(it, EINA_FALSE);
2084 edje_object_message_signal_process(it->edit_obj);
2087 edje_object_message_signal_process(it->base.view);
2091 _item_unrealize(Elm_Genlist_Item *it,
2096 if (!it->realized) return;
2097 if (it->wd->reorder_it == it) return;
2098 if (it->defer_unrealize && !it->updateme) return;
2099 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2101 evas_object_smart_callback_call(it->base.widget, SIG_UNREALIZED, it);
2104 ecore_timer_del(it->long_timer);
2105 it->long_timer = NULL;
2109 evas_object_del(it->base.view);
2110 it->base.view = NULL;
2111 evas_object_del(it->spacer);
2116 edje_object_mirrored_set(it->base.view,
2117 elm_widget_mirrored_get(it->base.widget));
2118 edje_object_scale_set(it->base.view,
2119 elm_widget_scale_get(it->base.widget)
2120 * _elm_config->scale);
2121 _item_cache_add(it);
2123 elm_widget_stringlist_free(it->labels);
2125 elm_widget_stringlist_free(it->icons);
2127 elm_widget_stringlist_free(it->states);
2129 EINA_LIST_FREE(it->icon_objs, icon)
2130 evas_object_del(icon);
2132 _mode_item_unrealize(it);
2134 it->realized = EINA_FALSE;
2135 it->want_unrealize = EINA_FALSE;
2136 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2137 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2138 if (it->wd->edit_mode) _effect_item_unrealize(it);
2142 _item_block_recalc(Item_Block *itb,
2147 Elm_Genlist_Item *it;
2148 Evas_Coord minw = 0, minh = 0;
2149 Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE;
2152 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2154 EINA_LIST_FOREACH(itb->items, l, it)
2156 if (it->delete_me) continue;
2157 showme |= it->showme;
2162 if (!it->mincalcd) changed = EINA_TRUE;
2165 _item_realize(it, in, EINA_TRUE);
2166 _item_unrealize(it, EINA_TRUE);
2171 _item_realize(it, in, EINA_TRUE);
2172 _item_unrealize(it, EINA_TRUE);
2176 _item_realize(it, in, EINA_FALSE);
2178 if (minw < it->minw) minw = it->minw;
2186 itb->changed = EINA_FALSE;
2187 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2188 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2193 _item_block_realize(Item_Block *itb)
2195 if (itb->realized) return;
2196 itb->realized = EINA_TRUE;
2197 itb->want_unrealize = EINA_FALSE;
2201 _item_block_unrealize(Item_Block *itb)
2204 Elm_Genlist_Item *it;
2205 Eina_Bool dragging = EINA_FALSE;
2207 if (!itb->realized) return;
2208 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2209 EINA_LIST_FOREACH(itb->items, l, it)
2211 if (it->flags != ELM_GENLIST_ITEM_GROUP)
2215 dragging = EINA_TRUE;
2216 it->want_unrealize = EINA_TRUE;
2219 _item_unrealize(it, EINA_FALSE);
2224 itb->realized = EINA_FALSE;
2225 itb->want_unrealize = EINA_TRUE;
2228 itb->want_unrealize = EINA_FALSE;
2229 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2230 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2234 _get_space_for_reorder_item(Elm_Genlist_Item *it)
2236 Evas_Coord rox, roy, row, roh, oy, oh;
2237 Eina_Bool top = EINA_FALSE;
2238 Elm_Genlist_Item *reorder_it = it->wd->reorder_it;
2239 if (!reorder_it) return 0;
2241 evas_object_geometry_get(it->wd->pan_smart, NULL, &oy, NULL, &oh);
2242 evas_object_geometry_get(it->wd->reorder_it->base.view, &rox, &roy, &row, &roh);
2244 if ((it->wd->reorder_start_y < it->block->y) &&
2245 (roy - oy + (roh / 2) >= it->block->y - it->wd->pan_y))
2247 it->block->reorder_offset = it->wd->reorder_it->h * -1;
2248 if (it->block->count == 1)
2249 it->wd->reorder_rel = it;
2251 else if ((it->wd->reorder_start_y >= it->block->y) &&
2252 (roy - oy + (roh / 2) <= it->block->y - it->wd->pan_y))
2254 it->block->reorder_offset = it->wd->reorder_it->h;
2257 it->block->reorder_offset = 0;
2259 it->scrl_y += it->block->reorder_offset;
2261 top = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
2262 rox, roy + (roh / 2), row, 1));
2265 it->wd->reorder_rel = it;
2266 it->scrl_y += it->wd->reorder_it->h;
2267 return it->wd->reorder_it->h;
2274 _reorder_move_animator_cb(void *data)
2276 Elm_Genlist_Item *it = data;
2277 Eina_Bool down = EINA_FALSE;
2279 int y, dy = it->h / 10 * _elm_config->scale, diff;
2281 t = ((0.0 > (t = ecore_loop_time_get()-it->wd->start_time)) ? 0.0 : t);
2283 if (t <= REORDER_EFFECT_TIME) y = (1 * sin((t / REORDER_EFFECT_TIME) * (M_PI / 2)) * dy);
2286 diff = abs(it->old_scrl_y - it->scrl_y);
2287 if (diff > it->h) y = diff / 2;
2288 if (it->old_scrl_y < it->scrl_y)
2290 it->old_scrl_y += y;
2293 else if (it->old_scrl_y > it->scrl_y)
2295 it->old_scrl_y -= y;
2300 _item_position(it, it->edit_obj, it->scrl_x, it->old_scrl_y);
2302 _item_position(it, it->base.view, it->scrl_x, it->old_scrl_y);
2303 _group_items_recalc(it->wd);
2304 if ((it->wd->reorder_pan_move) ||
2305 (down && it->old_scrl_y >= it->scrl_y) ||
2306 (!down && it->old_scrl_y <= it->scrl_y))
2308 it->old_scrl_y = it->scrl_y;
2309 it->move_effect_enabled = EINA_FALSE;
2310 it->wd->reorder_move_animator = NULL;
2311 return ECORE_CALLBACK_CANCEL;
2313 return ECORE_CALLBACK_RENEW;
2317 _item_position(Elm_Genlist_Item *it,
2325 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2326 evas_object_resize(view, it->w, it->h);
2327 evas_object_move(view, it_x, it_y);
2328 evas_object_show(view);
2329 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2330 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2334 _item_block_position(Item_Block *itb,
2338 Elm_Genlist_Item *it;
2339 Elm_Genlist_Item *git;
2340 Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2341 Evas_Coord minh = 0;
2344 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2345 evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh);
2346 evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy,
2348 EINA_LIST_FOREACH(itb->items, l, it)
2350 if (it->delete_me) continue;
2351 else if (it->wd->reorder_it == it) continue;
2356 it->scrl_x = itb->x + it->x - it->wd->pan_x + ox;
2357 it->scrl_y = itb->y + it->y - it->wd->pan_y + oy;
2359 vis = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
2360 cvx, cvy, cvw, cvh));
2361 if (it->flags != ELM_GENLIST_ITEM_GROUP)
2363 if ((itb->realized))
2367 if (!it->realized) _item_realize(it, in, EINA_FALSE);
2370 if (it->wd->edit_mode) edje_object_signal_emit(it->edit_obj, "elm,state,rename,enabled", "elm");
2371 edje_object_signal_emit(it->base.view, "elm,state,rename,enabled", "elm");
2379 if (it->wd->reorder_mode)
2380 y += _get_space_for_reorder_item(it);
2381 git = it->group_item;
2384 git->scrl_x = it->scrl_x;
2385 if (git->scrl_y < oy)
2387 if ((git->scrl_y + git->h) > (it->scrl_y + it->h))
2388 git->scrl_y = (it->scrl_y + it->h) - git->h;
2389 git->want_realize = EINA_TRUE;
2391 if ((it->wd->reorder_it) && (it->old_scrl_y != it->scrl_y))
2393 if (!it->move_effect_enabled)
2395 it->move_effect_enabled = EINA_TRUE;
2396 it->wd->reorder_move_animator =
2398 _reorder_move_animator_cb, it);
2401 if (!it->move_effect_enabled)
2402 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))
2404 if (it->wd->edit_mode && it->itc->edit_item_style)
2406 _item_position(it, it->edit_obj, it->scrl_x, it->scrl_y);
2410 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)))
2413 _item_position(it, it->mode_view, it->scrl_x,
2416 _item_position(it, it->base.view, it->scrl_x,
2421 evas_object_resize(it->base.view, it->w, it->h);
2422 evas_object_move(it->base.view, it->scrl_x, it->scrl_y);
2423 evas_object_hide(it->base.view);
2430 if (!it->dragging && (!it->wd->item_moving_effect_timer)) _item_unrealize(it, EINA_FALSE);
2437 if (vis) it->want_realize = EINA_TRUE;
2439 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))
2441 it->old_scrl_y = it->scrl_y;
2446 if (!itb->wd->reorder_it) itb->minh = minh;
2447 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2448 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2452 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2454 Elm_Genlist_Item *it = data;
2456 it->mincalcd = EINA_FALSE;
2457 it->block->changeme = EINA_TRUE;
2458 if (it->wd->changed_job) ecore_job_del(it->wd->changed_job);
2459 it->wd->changed_job = ecore_job_add(_changed_job, it->wd);
2463 _group_items_recalc(void *data)
2465 Widget_Data *wd = data;
2467 Elm_Genlist_Item *git;
2469 evas_event_freeze(evas_object_evas_get(wd->obj));
2470 EINA_LIST_FOREACH(wd->group_items, l, git)
2472 if (git->want_realize)
2475 _item_realize(git, 0, EINA_FALSE);
2476 evas_object_resize(git->base.view, wd->minw, git->h);
2477 evas_object_move(git->base.view, git->scrl_x, git->scrl_y);
2478 evas_object_show(git->base.view);
2479 evas_object_raise(git->base.view);
2481 else if (!git->want_realize && git->realized)
2484 _item_unrealize(git, EINA_FALSE);
2487 evas_event_thaw(evas_object_evas_get(wd->obj));
2488 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2492 _must_recalc_idler(void *data)
2494 Widget_Data *wd = data;
2495 if (wd->calc_job) ecore_job_del(wd->calc_job);
2496 wd->calc_job = ecore_job_add(_calc_job, wd);
2497 wd->must_recalc_idler = NULL;
2498 return ECORE_CALLBACK_CANCEL;
2502 _calc_job(void *data)
2504 Widget_Data *wd = data;
2505 Item_Block *itb, *chb = NULL;
2506 Evas_Coord minw = -1, minh = 0, y = 0, ow;
2509 Eina_Bool minw_change = EINA_FALSE;
2510 Eina_Bool did_must_recalc = EINA_FALSE;
2513 t0 = ecore_time_get();
2514 evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h);
2518 evas_event_freeze(evas_object_evas_get(wd->obj));
2519 EINA_INLIST_FOREACH(wd->blocks, itb)
2521 Eina_Bool showme = EINA_FALSE;
2524 showme = itb->showme;
2525 itb->showme = EINA_FALSE;
2528 if (itb->realized) _item_block_unrealize(itb);
2530 if ((itb->changed) || ((itb->must_recalc) && (!did_must_recalc)))
2532 if (itb->must_recalc)
2535 Elm_Genlist_Item *it;
2536 EINA_LIST_FOREACH(itb->items, l, it)
2537 if (it->mincalcd) it->mincalcd = EINA_FALSE;
2538 itb->changed = EINA_TRUE;
2539 if (itb->must_recalc) did_must_recalc = EINA_TRUE;
2540 itb->must_recalc = EINA_FALSE;
2541 if (itb->realized) _item_block_unrealize(itb);
2543 showme = _item_block_recalc(itb, in, EINA_FALSE);
2549 if (minw == -1) minw = itb->minw;
2550 else if ((!itb->must_recalc) && (minw < itb->minw))
2553 minw_change = EINA_TRUE;
2559 if ((showme) && (wd->show_item) && (!wd->show_item->queued))
2561 wd->show_item->showme = EINA_FALSE;
2563 elm_smart_scroller_region_bring_in(wd->scr,
2565 wd->show_item->block->x,
2567 wd->show_item->block->y,
2568 wd->show_item->block->w,
2571 elm_smart_scroller_child_region_show(wd->scr,
2573 wd->show_item->block->x,
2575 wd->show_item->block->y,
2576 wd->show_item->block->w,
2578 wd->show_item = NULL;
2583 EINA_INLIST_FOREACH(wd->blocks, itb)
2589 if ((chb) && (EINA_INLIST_GET(chb)->next))
2591 EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb)
2593 if (itb->realized) _item_block_unrealize(itb);
2596 wd->realminw = minw;
2597 if (minw < wd->w) minw = wd->w;
2598 if ((minw != wd->minw) || (minh != wd->minh))
2602 if (wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE)
2603 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
2604 _sizing_eval(wd->obj);
2606 if ((wd->anchor_item) && (wd->anchor_item->block) && (!wd->auto_scrolled))
2608 Elm_Genlist_Item *it;
2611 it = wd->anchor_item;
2612 it_y = wd->anchor_y;
2613 elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x,
2614 it->block->y + it->y + it_y);
2615 wd->anchor_item = it;
2616 wd->anchor_y = it_y;
2620 t = ecore_time_get();
2621 if (did_must_recalc)
2623 if (!wd->must_recalc_idler)
2624 wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd);
2626 wd->calc_job = NULL;
2627 evas_object_smart_changed(wd->pan_smart);
2628 evas_event_thaw(evas_object_evas_get(wd->obj));
2629 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2633 _update_job(void *data)
2635 Widget_Data *wd = data;
2639 Eina_Bool position = EINA_FALSE, recalc = EINA_FALSE;
2641 wd->update_job = NULL;
2644 evas_event_freeze(evas_object_evas_get(wd->obj));
2645 EINA_INLIST_FOREACH(wd->blocks, itb)
2647 Evas_Coord itminw, itminh;
2648 Elm_Genlist_Item *it;
2654 _item_block_position(itb, num);
2658 recalc = EINA_FALSE;
2659 EINA_LIST_FOREACH(itb->items, l2, it)
2668 _item_unrealize(it, EINA_FALSE);
2669 _item_realize(it, num, EINA_FALSE);
2670 position = EINA_TRUE;
2674 _item_realize(it, num, EINA_TRUE);
2675 _item_unrealize(it, EINA_TRUE);
2677 if ((it->minw != itminw) || (it->minh != itminh))
2679 it->updateme = EINA_FALSE;
2683 itb->updateme = EINA_FALSE;
2686 position = EINA_TRUE;
2687 itb->changed = EINA_TRUE;
2688 _item_block_recalc(itb, num0, EINA_FALSE);
2689 _item_block_position(itb, num0);
2694 if (wd->calc_job) ecore_job_del(wd->calc_job);
2695 wd->calc_job = ecore_job_add(_calc_job, wd);
2697 evas_event_thaw(evas_object_evas_get(wd->obj));
2698 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2702 _changed_job(void *data)
2704 Widget_Data *wd = data; Eina_List *l2;
2706 int num, num0, position = 0;
2707 Eina_Bool width_changed = EINA_FALSE, height_changed = EINA_FALSE;
2709 wd->changed_job = NULL;
2711 EINA_INLIST_FOREACH(wd->blocks, itb)
2713 Evas_Coord itminw, itminh;
2714 Elm_Genlist_Item *it;
2720 _item_block_position(itb, num);
2724 width_changed = height_changed = EINA_FALSE;
2725 EINA_LIST_FOREACH(itb->items, l2, it)
2727 if ((!it->mincalcd) && (it->realized))
2729 Evas_Coord mw = -1, mh = -1;
2733 if (it->wd->height_for_width) mw = it->wd->w;
2734 if (!it->display_only)
2735 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2736 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
2737 edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw, mh);
2738 if (!it->display_only)
2739 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2740 it->w = it->minw = mw;
2741 it->h = it->minh = mh;
2742 it->mincalcd = EINA_TRUE;
2744 //if ((it->minw != itminw) || (it->minh != itminh))
2745 //if ((it->minh != itminh))
2747 if ((it->minw != itminw))
2748 width_changed = EINA_TRUE;
2749 if ((it->minh != itminh))
2750 height_changed = EINA_TRUE;
2752 if ((!it->wd->group_item_width) && (it->flags == ELM_GENLIST_ITEM_GROUP))
2754 it->wd->group_item_width = mw;
2755 it->wd->group_item_height = mh;
2757 else if ((!it->wd->item_width) && (it->flags == ELM_GENLIST_ITEM_NONE))
2759 it->wd->item_width = mw;
2760 it->wd->item_height = mh;
2765 itb->changeme = EINA_FALSE;
2766 // TODO: why this is separated.
2770 itb->changed = EINA_TRUE;
2771 _item_block_recalc(itb, num0, 0);
2772 _item_block_position(itb, num0);
2774 else if (width_changed)
2776 _item_block_position(itb, num0);
2781 if (wd->calc_job) ecore_job_del(wd->calc_job);
2782 wd->calc_job = ecore_job_add(_calc_job, wd);
2787 _pan_set(Evas_Object *obj,
2791 Pan *sd = evas_object_smart_data_get(obj);
2797 // Evas_Coord ow, oh;
2798 // evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2799 // ow = sd->wd->minw - ow;
2800 // if (ow < 0) ow = 0;
2801 // oh = sd->wd->minh - oh;
2802 // if (oh < 0) oh = 0;
2803 // if (x < 0) x = 0;
2804 // if (y < 0) y = 0;
2805 // if (x > ow) x = ow;
2806 // if (y > oh) y = oh;
2807 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
2812 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2814 if ((itb->y + itb->h) > y)
2816 Elm_Genlist_Item *it;
2819 EINA_LIST_FOREACH(itb->items, l2, it)
2821 if ((itb->y + it->y) >= y)
2823 sd->wd->anchor_item = it;
2824 sd->wd->anchor_y = -(itb->y + it->y - y);
2832 if (!sd->wd->reorder_move_animator) evas_object_smart_changed(obj);
2836 _pan_get(Evas_Object *obj,
2840 Pan *sd = evas_object_smart_data_get(obj);
2843 if (x) *x = sd->wd->pan_x;
2844 if (y) *y = sd->wd->pan_y;
2848 _pan_max_get(Evas_Object *obj,
2852 Pan *sd = evas_object_smart_data_get(obj);
2856 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2857 ow = sd->wd->minw - ow;
2859 oh = sd->wd->minh - oh;
2866 _pan_min_get(Evas_Object *obj __UNUSED__,
2875 _pan_child_size_get(Evas_Object *obj,
2879 Pan *sd = evas_object_smart_data_get(obj);
2882 if (w) *w = sd->wd->minw;
2883 if (h) *h = sd->wd->minh;
2887 _pan_add(Evas_Object *obj)
2890 Evas_Object_Smart_Clipped_Data *cd;
2893 cd = evas_object_smart_data_get(obj);
2896 sd->__clipped_data = *cd;
2898 evas_object_smart_data_set(obj, sd);
2902 _pan_del(Evas_Object *obj)
2904 Pan *sd = evas_object_smart_data_get(obj);
2909 ecore_job_del(sd->resize_job);
2910 sd->resize_job = NULL;
2916 _pan_resize_job(void *data)
2920 _sizing_eval(sd->wd->obj);
2921 sd->resize_job = NULL;
2925 _pan_resize(Evas_Object *obj,
2929 Pan *sd = evas_object_smart_data_get(obj);
2933 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2934 if ((ow == w) && (oh == h)) return;
2935 if ((sd->wd->height_for_width) && (ow != w))
2937 sd->wd->pan_resize = EINA_TRUE;
2938 if (sd->resize_job) ecore_job_del(sd->resize_job);
2939 sd->resize_job = ecore_job_add(_pan_resize_job, sd);
2941 sd->wd->pan_changed = EINA_TRUE;
2942 evas_object_smart_changed(obj);
2943 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2944 sd->wd->calc_job = NULL;
2948 _pan_calculate(Evas_Object *obj)
2950 Pan *sd = evas_object_smart_data_get(obj);
2952 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2954 Elm_Genlist_Item *git;
2958 evas_event_freeze(evas_object_evas_get(obj));
2960 if (sd->wd->pan_changed)
2963 sd->wd->pan_changed = EINA_FALSE;
2966 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
2967 sd->wd->prev_viewport_w = ow;
2968 evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
2969 EINA_LIST_FOREACH(sd->wd->group_items, l, git)
2971 git->want_realize = EINA_FALSE;
2973 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2975 itb->w = sd->wd->minw;
2976 if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox,
2977 itb->y - sd->wd->pan_y + oy,
2979 cvx, cvy, cvw, cvh))
2981 if ((!itb->realized) || (itb->changed))
2982 _item_block_realize(itb);
2983 _item_block_position(itb, in);
2987 if (itb->realized) _item_block_unrealize(itb);
2991 if ((!sd->wd->reorder_it) || (sd->wd->reorder_pan_move))
2992 _group_items_recalc(sd->wd);
2994 if ((sd->wd->reorder_mode) && (sd->wd->reorder_it))
2996 if (sd->wd->pan_y != sd->wd->old_pan_y)
2997 sd->wd->reorder_pan_move = EINA_TRUE;
2998 else sd->wd->reorder_pan_move = EINA_FALSE;
2999 evas_object_raise(sd->wd->reorder_it->edit_obj);
3000 sd->wd->old_pan_y = sd->wd->pan_y;
3001 sd->wd->start_time = ecore_loop_time_get();
3004 if (sd->wd->effect_mode &&
3005 ((sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND) ||
3006 (sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT) ||
3007 (sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE)))
3009 if (!sd->wd->item_moving_effect_timer)
3011 if (sd->wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE)
3012 _item_flip_effect_show(sd->wd->expand_item);
3014 evas_object_raise(sd->wd->alpha_bg);
3015 evas_object_show(sd->wd->alpha_bg);
3016 elm_smart_scroller_bounce_animator_disabled_set(sd->wd->scr, EINA_TRUE);
3017 sd->wd->start_time = current_time_get();
3018 sd->wd->item_moving_effect_timer = ecore_animator_add(_item_moving_effect_timer_cb, sd->wd);
3021 else _item_auto_scroll(sd->wd);
3022 sd->wd->pan_resize = EINA_FALSE;
3023 evas_event_thaw(evas_object_evas_get(obj));
3024 evas_event_thaw_eval(evas_object_evas_get(obj));
3028 _pan_move(Evas_Object *obj,
3029 Evas_Coord x __UNUSED__,
3030 Evas_Coord y __UNUSED__)
3032 Pan *sd = evas_object_smart_data_get(obj);
3036 sd->wd->pan_changed = EINA_TRUE;
3037 evas_object_smart_changed(obj);
3038 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
3039 sd->wd->calc_job = NULL;
3043 _hold_on(void *data __UNUSED__,
3045 void *event_info __UNUSED__)
3047 Widget_Data *wd = elm_widget_data_get(obj);
3049 elm_smart_scroller_hold_set(wd->scr, 1);
3053 _hold_off(void *data __UNUSED__,
3055 void *event_info __UNUSED__)
3057 Widget_Data *wd = elm_widget_data_get(obj);
3059 elm_smart_scroller_hold_set(wd->scr, 0);
3063 _freeze_on(void *data __UNUSED__,
3065 void *event_info __UNUSED__)
3067 Widget_Data *wd = elm_widget_data_get(obj);
3069 elm_smart_scroller_freeze_set(wd->scr, 1);
3073 _freeze_off(void *data __UNUSED__,
3075 void *event_info __UNUSED__)
3077 Widget_Data *wd = elm_widget_data_get(obj);
3079 elm_smart_scroller_freeze_set(wd->scr, 0);
3083 _scroll_edge_left(void *data,
3084 Evas_Object *scr __UNUSED__,
3085 void *event_info __UNUSED__)
3087 Evas_Object *obj = data;
3088 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_LEFT, NULL);
3092 _scroll_edge_right(void *data,
3093 Evas_Object *scr __UNUSED__,
3094 void *event_info __UNUSED__)
3096 Evas_Object *obj = data;
3097 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_RIGHT, NULL);
3101 _scroll_edge_top(void *data,
3102 Evas_Object *scr __UNUSED__,
3103 void *event_info __UNUSED__)
3105 Evas_Object *obj = data;
3106 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_TOP, NULL);
3110 _scroll_edge_bottom(void *data,
3111 Evas_Object *scr __UNUSED__,
3112 void *event_info __UNUSED__)
3114 Evas_Object *obj = data;
3115 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_BOTTOM, NULL);
3119 _mode_item_realize(Elm_Genlist_Item *it)
3123 if ((it->mode_view) || (it->delete_me)) return;
3125 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3126 it->mode_view = edje_object_add(evas_object_evas_get(it->base.widget));
3127 edje_object_scale_set(it->mode_view,
3128 elm_widget_scale_get(it->base.widget) *
3129 _elm_config->scale);
3130 evas_object_smart_member_add(it->mode_view, it->wd->pan_smart);
3131 elm_widget_sub_object_add(it->base.widget, it->mode_view);
3133 strncpy(buf, "item", sizeof(buf));
3134 if (it->wd->compress)
3135 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
3137 if (it->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
3138 strncat(buf, "/", sizeof(buf) - strlen(buf));
3139 strncat(buf, it->itc->mode_item_style, sizeof(buf) - strlen(buf));
3141 _elm_theme_object_set(it->base.widget, it->mode_view, "genlist", buf,
3142 elm_widget_style_get(it->base.widget));
3143 edje_object_mirrored_set(it->mode_view,
3144 elm_widget_mirrored_get(it->base.widget));
3146 /* signal callback add */
3147 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_DOWN,
3149 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_UP,
3151 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_MOVE,
3154 /* label_get, icon_get, state_get */
3155 _item_label_realize(it, it->mode_view, &it->mode_labels);
3156 if (it->itc->func.icon_get)
3162 elm_widget_stringlist_get(edje_object_data_get(it->mode_view,
3164 EINA_LIST_FOREACH(it->mode_icons, l, key)
3166 Evas_Object *ic = it->itc->func.icon_get
3167 ((void *)it->base.data, it->base.widget, l->data);
3171 it->mode_icon_objs = eina_list_append(it->mode_icon_objs, ic);
3172 edje_object_part_swallow(it->mode_view, key, ic);
3173 evas_object_show(ic);
3174 elm_widget_sub_object_add(it->base.widget, ic);
3176 elm_widget_disabled_set(ic, EINA_TRUE);
3180 _item_state_realize(it, it->mode_view, &it->mode_states);
3181 edje_object_part_swallow(it->mode_view,
3182 edje_object_data_get(it->mode_view, "mode_part"),
3185 it->want_unrealize = EINA_FALSE;
3186 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3187 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3191 _mode_item_unrealize(Elm_Genlist_Item *it)
3193 Widget_Data *wd = it->wd;
3195 if (!it->mode_view) return;
3197 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3198 elm_widget_stringlist_free(it->mode_labels);
3199 it->mode_labels = NULL;
3200 elm_widget_stringlist_free(it->mode_icons);
3201 it->mode_icons = NULL;
3202 elm_widget_stringlist_free(it->mode_states);
3204 EINA_LIST_FREE(it->mode_icon_objs, icon)
3205 evas_object_del(icon);
3207 edje_object_part_unswallow(it->mode_view, it->base.view);
3208 evas_object_smart_member_add(it->base.view, wd->pan_smart);
3209 evas_object_del(it->mode_view);
3210 it->mode_view = NULL;
3212 if (wd->mode_item == it)
3213 wd->mode_item = NULL;
3214 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3215 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3219 _item_mode_set(Elm_Genlist_Item *it)
3222 Widget_Data *wd = it->wd;
3227 it->nocache = EINA_TRUE;
3229 if (wd->scr_hold_timer)
3231 ecore_timer_del(wd->scr_hold_timer);
3232 wd->scr_hold_timer = NULL;
3234 elm_smart_scroller_hold_set(wd->scr, EINA_TRUE);
3235 wd->scr_hold_timer = ecore_timer_add(0.1, _scr_hold_timer_cb, wd);
3237 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3238 _mode_item_realize(it);
3240 evas_object_raise(it->group_item->base.view);
3241 _item_position(it, it->mode_view, it->scrl_x, it->scrl_y);
3242 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3243 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3245 snprintf(buf, sizeof(buf), "elm,state,%s,active", wd->mode_type);
3246 edje_object_signal_emit(it->mode_view, buf, "elm");
3250 _item_mode_unset(Widget_Data *wd)
3253 if (!wd->mode_item) return;
3254 char buf[1024], buf2[1024];
3255 Elm_Genlist_Item *it;
3258 it->nocache = EINA_TRUE;
3260 snprintf(buf, sizeof(buf), "elm,state,%s,passive", wd->mode_type);
3261 snprintf(buf2, sizeof(buf2), "elm,state,%s,passive,finished", wd->mode_type);
3263 edje_object_signal_emit(it->mode_view, buf, "elm");
3264 edje_object_signal_callback_add(it->mode_view, buf2, "elm", _mode_finished_signal_cb, it);
3266 wd->mode_item = NULL;
3271 _item_auto_scroll(void *data)
3273 Widget_Data *wd = data;
3276 if ((wd->expand_item) && (!wd->auto_scrolled))
3278 Elm_Genlist_Item *it;
3280 Evas_Coord ox, oy, ow, oh;
3281 evas_object_geometry_get(wd->obj, &ox, &oy, &ow, &oh);
3283 wd->auto_scrolled = EINA_TRUE;
3284 if (wd->expand_item->scrl_y > (oh + oy) / 2)
3286 EINA_LIST_FOREACH(wd->expand_item->items, l, it)
3288 elm_genlist_item_bring_in(it);
3294 elm_genlist_add(Evas_Object *parent)
3299 Evas_Coord minw, minh;
3300 static Evas_Smart *smart = NULL;
3304 static Evas_Smart_Class sc;
3306 evas_object_smart_clipped_smart_set(&_pan_sc);
3308 sc.name = "elm_genlist_pan";
3309 sc.version = EVAS_SMART_CLASS_VERSION;
3312 sc.resize = _pan_resize;
3313 sc.move = _pan_move;
3314 sc.calculate = _pan_calculate;
3315 if (!(smart = evas_smart_class_new(&sc))) return NULL;
3318 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
3320 ELM_SET_WIDTYPE(widtype, "genlist");
3321 elm_widget_type_set(obj, "genlist");
3322 elm_widget_sub_object_add(parent, obj);
3323 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
3324 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
3325 elm_widget_data_set(obj, wd);
3326 elm_widget_del_hook_set(obj, _del_hook);
3327 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
3328 elm_widget_theme_hook_set(obj, _theme_hook);
3329 elm_widget_can_focus_set(obj, EINA_TRUE);
3330 elm_widget_event_hook_set(obj, _event_hook);
3331 elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
3333 wd->scr = elm_smart_scroller_add(e);
3334 elm_smart_scroller_widget_set(wd->scr, obj);
3335 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
3336 elm_widget_style_get(obj));
3337 elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE,
3338 _elm_config->thumbscroll_bounce_enable);
3339 elm_widget_resize_object_set(obj, wd->scr);
3341 evas_object_smart_callback_add(wd->scr, "edge,left", _scroll_edge_left, obj);
3342 evas_object_smart_callback_add(wd->scr, "edge,right", _scroll_edge_right,
3344 evas_object_smart_callback_add(wd->scr, "edge,top", _scroll_edge_top, obj);
3345 evas_object_smart_callback_add(wd->scr, "edge,bottom", _scroll_edge_bottom,
3349 wd->mode = ELM_LIST_SCROLL;
3350 wd->max_items_per_block = MAX_ITEMS_PER_BLOCK;
3351 wd->item_cache_max = wd->max_items_per_block * 2;
3352 wd->longpress_timeout = _elm_config->longpress_timeout;
3353 wd->effect_mode = _elm_config->effect_enable;
3355 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
3356 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
3357 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
3358 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
3360 wd->pan_smart = evas_object_smart_add(e, smart);
3361 wd->pan = evas_object_smart_data_get(wd->pan_smart);
3364 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
3365 _pan_set, _pan_get, _pan_max_get,
3366 _pan_min_get, _pan_child_size_get);
3368 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
3370 evas_object_size_hint_min_set(obj, minw, minh);
3372 evas_object_smart_callbacks_descriptions_set(obj, _signals);
3373 _mirrored_set(obj, elm_widget_mirrored_get(obj));
3378 static Elm_Genlist_Item *
3379 _item_new(Widget_Data *wd,
3380 const Elm_Genlist_Item_Class *itc,
3382 Elm_Genlist_Item *parent,
3383 Elm_Genlist_Item_Flags flags,
3385 const void *func_data)
3387 Elm_Genlist_Item *it;
3389 it = elm_widget_item_new(wd->obj, Elm_Genlist_Item);
3390 if (!it) return NULL;
3393 it->base.data = data;
3394 it->parent = parent;
3396 it->func.func = func;
3397 it->func.data = func_data;
3398 it->mouse_cursor = NULL;
3399 it->expanded_depth = 0;
3400 elm_widget_item_text_get_hook_set(it, _item_label_hook);
3401 elm_widget_item_del_cb_set(it, _item_del_hook);
3405 if (it->parent->flags & ELM_GENLIST_ITEM_GROUP)
3406 it->group_item = parent;
3407 else if (it->parent->group_item)
3408 it->group_item = it->parent->group_item;
3414 _item_block_add(Widget_Data *wd,
3415 Elm_Genlist_Item *it)
3417 Item_Block *itb = NULL;
3424 itb = calloc(1, sizeof(Item_Block));
3427 if (!it->rel->block)
3430 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3431 itb->items = eina_list_append(itb->items, it);
3437 wd->blocks = eina_inlist_prepend_relative
3438 (wd->blocks, EINA_INLIST_GET(itb),
3439 EINA_INLIST_GET(it->rel->block));
3441 eina_list_prepend_relative(itb->items, it, it->rel);
3445 wd->blocks = eina_inlist_append_relative
3446 (wd->blocks, EINA_INLIST_GET(itb),
3447 EINA_INLIST_GET(it->rel->block));
3449 eina_list_append_relative(itb->items, it, it->rel);
3459 itb = (Item_Block *)(wd->blocks);
3460 if (itb->count >= wd->max_items_per_block)
3462 itb = calloc(1, sizeof(Item_Block));
3466 eina_inlist_prepend(wd->blocks,
3467 EINA_INLIST_GET(itb));
3472 itb = calloc(1, sizeof(Item_Block));
3476 eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
3478 itb->items = eina_list_prepend(itb->items, it);
3484 itb = (Item_Block *)(wd->blocks->last);
3485 if (itb->count >= wd->max_items_per_block)
3487 itb = calloc(1, sizeof(Item_Block));
3491 eina_inlist_append(wd->blocks,
3492 EINA_INLIST_GET(itb));
3497 itb = calloc(1, sizeof(Item_Block));
3501 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3503 itb->items = eina_list_append(itb->items, it);
3509 itb = it->rel->block;
3510 if (!itb) goto newblock;
3512 itb->items = eina_list_prepend_relative(itb->items, it, it->rel);
3514 itb->items = eina_list_append_relative(itb->items, it, it->rel);
3517 itb->changed = EINA_TRUE;
3519 if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job);
3520 itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd);
3523 it->rel->relcount--;
3524 if ((it->rel->delete_me) && (!it->rel->relcount))
3528 if (itb->count > itb->wd->max_items_per_block)
3532 Elm_Genlist_Item *it2;
3534 newc = itb->count / 2;
3535 itb2 = calloc(1, sizeof(Item_Block));
3539 eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
3540 EINA_INLIST_GET(itb));
3541 itb2->changed = EINA_TRUE;
3542 while ((itb->count > newc) && (itb->items))
3546 l = eina_list_last(itb->items);
3548 itb->items = eina_list_remove_list(itb->items, l);
3551 itb2->items = eina_list_prepend(itb2->items, it2);
3559 _queue_process(Widget_Data *wd)
3562 Eina_Bool showme = EINA_FALSE;
3565 t0 = ecore_time_get();
3566 //evas_event_freeze(evas_object_evas_get(wd->obj));
3567 for (n = 0; (wd->queue) && (n < 128); n++)
3569 Elm_Genlist_Item *it;
3571 it = wd->queue->data;
3572 wd->queue = eina_list_remove_list(wd->queue, wd->queue);
3573 it->queued = EINA_FALSE;
3574 _item_block_add(wd, it);
3575 t = ecore_time_get();
3576 if (it->block->changed)
3578 showme = _item_block_recalc(it->block, it->block->num, EINA_TRUE);
3579 it->block->changed = 0;
3581 if (showme) it->block->showme = EINA_TRUE;
3582 if (eina_inlist_count(wd->blocks) > 1)
3584 if ((t - t0) > (ecore_animator_frametime_get())) break;
3587 //evas_event_thaw(evas_object_evas_get(wd->obj));
3588 //evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3593 _idle_process(void *data, Eina_Bool *wakeup)
3595 Widget_Data *wd = data;
3598 //static double q_start = 0.0;
3599 //if (q_start == 0.0) q_start = ecore_time_get();
3601 if (_queue_process(wd) > 0) *wakeup = EINA_TRUE;
3605 //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start);
3607 return ECORE_CALLBACK_CANCEL;
3609 return ECORE_CALLBACK_RENEW;
3613 _item_idle_enterer(void *data)
3615 Widget_Data *wd = data;
3616 Eina_Bool wakeup = EINA_FALSE;
3617 Eina_Bool ok = _idle_process(data, &wakeup);
3622 if (wd->calc_job) ecore_job_del(wd->calc_job);
3623 wd->calc_job = ecore_job_add(_calc_job, wd);
3625 if (ok == ECORE_CALLBACK_CANCEL) wd->queue_idle_enterer = NULL;
3630 _item_queue(Widget_Data *wd,
3631 Elm_Genlist_Item *it)
3633 if (it->queued) return;
3634 it->queued = EINA_TRUE;
3635 wd->queue = eina_list_append(wd->queue, it);
3636 // FIXME: why does a freeze then thaw here cause some genlist
3637 // elm_genlist_item_append() to be much much slower?
3638 // evas_event_freeze(evas_object_evas_get(wd->obj));
3639 while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
3641 if (wd->queue_idle_enterer)
3643 ecore_idle_enterer_del(wd->queue_idle_enterer);
3644 wd->queue_idle_enterer = NULL;
3648 // evas_event_thaw(evas_object_evas_get(wd->obj));
3649 // evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3650 if (!wd->queue_idle_enterer)
3651 wd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, wd);
3655 _item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after)
3660 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3661 it->wd->reorder_deleted = EINA_TRUE;
3662 _item_block_del(it);
3664 it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
3666 it->rel->relcount++;
3667 it->before = EINA_FALSE;
3668 if (after->group_item) it->group_item = after->group_item;
3669 _item_queue(it->wd, it);
3671 // TODO: change this to smart callback
3672 if (it->itc->func.moved)
3673 it->itc->func.moved(it->base.widget, it, after, EINA_TRUE);
3677 _item_move_before(Elm_Genlist_Item *it, Elm_Genlist_Item *before)
3680 if (!before) return;
3682 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3683 it->wd->reorder_deleted = EINA_TRUE;
3684 _item_block_del(it);
3685 it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
3687 it->rel->relcount++;
3688 it->before = EINA_TRUE;
3689 if (before->group_item) it->group_item = before->group_item;
3690 _item_queue(it->wd, it);
3692 // TODO: change this to smart callback
3693 if (it->itc->func.moved)
3694 it->itc->func.moved(it->base.widget, it, before, EINA_FALSE);
3697 EAPI Elm_Genlist_Item *
3698 elm_genlist_item_append(Evas_Object *obj,
3699 const Elm_Genlist_Item_Class *itc,
3701 Elm_Genlist_Item *parent,
3702 Elm_Genlist_Item_Flags flags,
3704 const void *func_data)
3706 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3707 Widget_Data *wd = elm_widget_data_get(obj);
3708 if (!wd) return NULL;
3709 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3711 if (!it) return NULL;
3714 if (flags & ELM_GENLIST_ITEM_GROUP)
3715 wd->group_items = eina_list_append(wd->group_items, it);
3716 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
3721 Elm_Genlist_Item *it2 = NULL;
3722 Eina_List *ll = eina_list_last(it->parent->items);
3723 if (ll) it2 = ll->data;
3724 it->parent->items = eina_list_append(it->parent->items, it);
3725 if (!it2) it2 = it->parent;
3727 it2 = elm_genlist_item_prev_get(it2);
3729 eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3730 EINA_INLIST_GET(it2));
3732 it->rel->relcount++;
3734 it->before = EINA_FALSE;
3735 _item_queue(wd, it);
3739 EAPI Elm_Genlist_Item *
3740 elm_genlist_item_prepend(Evas_Object *obj,
3741 const Elm_Genlist_Item_Class *itc,
3743 Elm_Genlist_Item *parent,
3744 Elm_Genlist_Item_Flags flags,
3746 const void *func_data)
3748 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3749 Widget_Data *wd = elm_widget_data_get(obj);
3750 if (!wd) return NULL;
3751 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3753 if (!it) return NULL;
3756 if (flags & ELM_GENLIST_ITEM_GROUP)
3757 wd->group_items = eina_list_prepend(wd->group_items, it);
3758 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
3763 Elm_Genlist_Item *it2 = NULL;
3764 Eina_List *ll = it->parent->items;
3765 if (ll) it2 = ll->data;
3766 it->parent->items = eina_list_prepend(it->parent->items, it);
3767 if (!it2) it2 = it->parent;
3769 it2 = elm_genlist_item_next_get(it2);
3771 eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3772 EINA_INLIST_GET(it2));
3774 it->rel->relcount++;
3776 it->before = EINA_TRUE;
3777 _item_queue(wd, it);
3781 EAPI Elm_Genlist_Item *
3782 elm_genlist_item_insert_after(Evas_Object *obj,
3783 const Elm_Genlist_Item_Class *itc,
3785 Elm_Genlist_Item *parent,
3786 Elm_Genlist_Item *after,
3787 Elm_Genlist_Item_Flags flags,
3789 const void *func_data)
3791 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3792 EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
3793 Widget_Data *wd = elm_widget_data_get(obj);
3794 if (!wd) return NULL;
3795 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3797 if (!it) return NULL;
3798 /* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */
3799 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3803 if ((flags & ELM_GENLIST_ITEM_GROUP) &&
3804 (after->flags & ELM_GENLIST_ITEM_GROUP))
3805 wd->group_items = eina_list_append_relative(wd->group_items, it,
3810 it->parent->items = eina_list_append_relative(it->parent->items, it,
3813 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3814 EINA_INLIST_GET(after));
3816 it->rel->relcount++;
3817 it->before = EINA_FALSE;
3818 _item_queue(wd, it);
3822 EAPI Elm_Genlist_Item *
3823 elm_genlist_item_insert_before(Evas_Object *obj,
3824 const Elm_Genlist_Item_Class *itc,
3826 Elm_Genlist_Item *parent,
3827 Elm_Genlist_Item *before,
3828 Elm_Genlist_Item_Flags flags,
3830 const void *func_data)
3832 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3833 EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
3834 Widget_Data *wd = elm_widget_data_get(obj);
3835 if (!wd) return NULL;
3836 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3838 if (!it) return NULL;
3839 /* It makes no sense to insert before in an empty list with before != NULL, something really bad is happening in your app. */
3840 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3844 if ((flags & ELM_GENLIST_ITEM_GROUP) &&
3845 (before->flags & ELM_GENLIST_ITEM_GROUP))
3846 wd->group_items = eina_list_prepend_relative(wd->group_items, it,
3851 it->parent->items = eina_list_prepend_relative(it->parent->items, it,
3854 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3855 EINA_INLIST_GET(before));
3857 it->rel->relcount++;
3858 it->before = EINA_TRUE;
3859 _item_queue(wd, it);
3864 elm_genlist_clear(Evas_Object *obj)
3866 ELM_CHECK_WIDTYPE(obj, widtype);
3867 Widget_Data *wd = elm_widget_data_get(obj);
3869 if (wd->walking > 0)
3871 Elm_Genlist_Item *it;
3873 wd->clear_me = EINA_TRUE;
3874 EINA_INLIST_FOREACH(wd->items, it)
3876 it->delete_me = EINA_TRUE;
3880 evas_event_freeze(evas_object_evas_get(wd->obj));
3883 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
3884 it->nocache = EINA_TRUE;
3885 it->highlighted = EINA_FALSE;
3887 if (wd->anchor_item == it)
3889 wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3890 if (!wd->anchor_item)
3892 ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3895 wd->items = eina_inlist_remove(wd->items, wd->items);
3896 if (it->flags & ELM_GENLIST_ITEM_GROUP)
3897 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
3898 elm_widget_item_pre_notify_del(it);
3899 if (it->realized) _item_unrealize(it, EINA_FALSE);
3900 if (((wd->clear_me) || (!it->delete_me)) && (it->itc->func.del))
3901 it->itc->func.del((void *)it->base.data, it->base.widget);
3902 if (it->long_timer) ecore_timer_del(it->long_timer);
3903 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
3904 elm_widget_item_del(it);
3906 wd->clear_me = EINA_FALSE;
3907 wd->anchor_item = NULL;
3910 Item_Block *itb = (Item_Block *)(wd->blocks);
3912 wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
3913 if (itb->items) eina_list_free(itb->items);
3918 ecore_job_del(wd->calc_job);
3919 wd->calc_job = NULL;
3921 if (wd->queue_idle_enterer)
3923 ecore_idle_enterer_del(wd->queue_idle_enterer);
3924 wd->queue_idle_enterer = NULL;
3926 if (wd->must_recalc_idler)
3928 ecore_idler_del(wd->must_recalc_idler);
3929 wd->must_recalc_idler = NULL;
3933 eina_list_free(wd->queue);
3938 eina_list_free(wd->selected);
3939 wd->selected = NULL;
3941 if (wd->reorder_move_animator)
3943 ecore_animator_del(wd->reorder_move_animator);
3944 wd->reorder_move_animator = NULL;
3946 wd->show_item = NULL;
3954 evas_object_del(wd->alpha_bg);
3955 wd->alpha_bg = NULL;
3959 evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
3960 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
3963 elm_smart_scroller_child_region_show(wd->scr, 0, 0, 0, 0);
3964 evas_event_thaw(evas_object_evas_get(wd->obj));
3965 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3969 elm_genlist_multi_select_set(Evas_Object *obj,
3972 ELM_CHECK_WIDTYPE(obj, widtype);
3973 Widget_Data *wd = elm_widget_data_get(obj);
3979 elm_genlist_multi_select_get(const Evas_Object *obj)
3981 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3982 Widget_Data *wd = elm_widget_data_get(obj);
3983 if (!wd) return EINA_FALSE;
3987 EAPI Elm_Genlist_Item *
3988 elm_genlist_selected_item_get(const Evas_Object *obj)
3990 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3991 Widget_Data *wd = elm_widget_data_get(obj);
3992 if (!wd) return NULL;
3993 if (wd->selected) return wd->selected->data;
3997 EAPI const Eina_List *
3998 elm_genlist_selected_items_get(const Evas_Object *obj)
4000 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4001 Widget_Data *wd = elm_widget_data_get(obj);
4002 if (!wd) return NULL;
4003 return wd->selected;
4007 elm_genlist_realized_items_get(const Evas_Object *obj)
4009 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4010 Widget_Data *wd = elm_widget_data_get(obj);
4011 Eina_List *list = NULL;
4013 Eina_Bool done = EINA_FALSE;
4014 if (!wd) return NULL;
4015 EINA_INLIST_FOREACH(wd->blocks, itb)
4020 Elm_Genlist_Item *it;
4023 EINA_LIST_FOREACH(itb->items, l, it)
4025 if (it->realized) list = eina_list_append(list, it);
4036 EAPI Elm_Genlist_Item *
4037 elm_genlist_at_xy_item_get(const Evas_Object *obj,
4042 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4043 Widget_Data *wd = elm_widget_data_get(obj);
4044 Evas_Coord ox, oy, ow, oh;
4047 if (!wd) return NULL;
4048 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
4050 EINA_INLIST_FOREACH(wd->blocks, itb)
4053 Elm_Genlist_Item *it;
4055 if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
4056 oy + itb->y - itb->wd->pan_y,
4057 itb->w, itb->h, x, y, 1, 1))
4059 EINA_LIST_FOREACH(itb->items, l, it)
4061 Evas_Coord itx, ity;
4063 itx = ox + itb->x + it->x - itb->wd->pan_x;
4064 ity = oy + itb->y + it->y - itb->wd->pan_y;
4065 if (ELM_RECTS_INTERSECT(itx, ity, it->w, it->h, x, y, 1, 1))
4069 if (y <= (ity + (it->h / 4))) *posret = -1;
4070 else if (y >= (ity + it->h - (it->h / 4)))
4076 lasty = ity + it->h;
4081 if (y > lasty) *posret = 1;
4087 EAPI Elm_Genlist_Item *
4088 elm_genlist_first_item_get(const Evas_Object *obj)
4090 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4091 Widget_Data *wd = elm_widget_data_get(obj);
4092 if (!wd) return NULL;
4093 if (!wd->items) return NULL;
4094 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
4095 while ((it) && (it->delete_me))
4096 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
4100 EAPI Elm_Genlist_Item *
4101 elm_genlist_last_item_get(const Evas_Object *obj)
4103 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4104 Widget_Data *wd = elm_widget_data_get(obj);
4105 if (!wd) return NULL;
4106 if (!wd->items) return NULL;
4107 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
4108 while ((it) && (it->delete_me))
4109 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
4113 EAPI Elm_Genlist_Item *
4114 elm_genlist_item_next_get(const Elm_Genlist_Item *it)
4116 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4119 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
4120 if ((it) && (!it->delete_me)) break;
4122 return (Elm_Genlist_Item *)it;
4125 EAPI Elm_Genlist_Item *
4126 elm_genlist_item_prev_get(const Elm_Genlist_Item *it)
4128 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4131 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
4132 if ((it) && (!it->delete_me)) break;
4134 return (Elm_Genlist_Item *)it;
4138 elm_genlist_item_genlist_get(const Elm_Genlist_Item *it)
4140 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4141 return it->base.widget;
4144 EAPI Elm_Genlist_Item *
4145 elm_genlist_item_parent_get(const Elm_Genlist_Item *it)
4147 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4152 elm_genlist_item_subitems_clear(Elm_Genlist_Item *it)
4154 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4155 Elm_Genlist_Item *it2;
4158 if (!it->wd->effect_mode || !it->wd->move_effect_mode)
4159 _item_subitems_clear(it);
4162 if ((!it->wd->item_moving_effect_timer) && (it->flags != ELM_GENLIST_ITEM_GROUP) &&
4163 it->wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE )
4165 it->wd->expand_item = it;
4166 _item_flip_effect_show(it);
4167 evas_object_geometry_get(it->base.view, NULL, &y, NULL, &h);
4168 it->wd->expand_item_end = y + h;
4172 it2 = elm_genlist_item_next_get(it2);
4174 } while (it2->expanded_depth > it->expanded_depth);
4176 it->wd->expand_item_gap = it->wd->expand_item_end - it2->old_scrl_y;
4178 it->wd->expand_item_gap = 0;
4180 evas_object_raise(it->wd->alpha_bg);
4181 evas_object_show(it->wd->alpha_bg);
4183 it->wd->start_time = current_time_get();
4184 it->wd->item_moving_effect_timer = ecore_animator_add(_item_moving_effect_timer_cb, it->wd);
4187 _item_subitems_clear(it);
4192 elm_genlist_item_selected_set(Elm_Genlist_Item *it,
4195 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4196 Widget_Data *wd = elm_widget_data_get(it->base.widget);
4198 if ((it->delete_me) || (it->disabled)) return;
4199 selected = !!selected;
4200 if (it->selected == selected) return;
4206 while (wd->selected)
4207 _item_unselect(wd->selected->data);
4209 _item_highlight(it);
4217 elm_genlist_item_selected_get(const Elm_Genlist_Item *it)
4219 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4220 return it->selected;
4224 elm_genlist_item_expanded_set(Elm_Genlist_Item *it,
4227 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4228 if (it->flags != ELM_GENLIST_ITEM_SUBITEMS) return;
4229 if (it->expanded == expanded) return;
4230 it->expanded = expanded;
4231 it->wd->expand_item = it;
4233 if (it->wd->effect_mode && !it->wd->alpha_bg)
4234 it->wd->alpha_bg = _create_tray_alpha_bg(it->base.widget);
4238 it->wd->auto_scrolled = EINA_FALSE;
4239 it->wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND;
4241 edje_object_signal_emit(it->base.view, "elm,state,expanded", "elm");
4242 evas_object_smart_callback_call(it->base.widget, "expanded", it);
4246 it->wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT;
4248 edje_object_signal_emit(it->base.view, "elm,state,contracted", "elm");
4249 evas_object_smart_callback_call(it->base.widget, "contracted", it);
4254 elm_genlist_item_expanded_get(const Elm_Genlist_Item *it)
4256 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4257 return it->expanded;
4261 elm_genlist_item_expanded_depth_get(const Elm_Genlist_Item *it)
4263 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, 0);
4264 return it->expanded_depth;
4268 elm_genlist_item_disabled_set(Elm_Genlist_Item *it,
4271 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4274 if (it->disabled == disabled) return;
4275 if (it->delete_me) return;
4276 it->disabled = !!disabled;
4278 elm_genlist_item_selected_set(it, EINA_FALSE);
4283 edje_object_signal_emit(it->base.view, "elm,state,disabled", "elm");
4285 edje_object_signal_emit(it->edit_obj, "elm,state,disabled", "elm");
4289 edje_object_signal_emit(it->base.view, "elm,state,enabled", "elm");
4291 edje_object_signal_emit(it->edit_obj, "elm,state,enabled", "elm");
4293 EINA_LIST_FOREACH(it->icon_objs, l, obj)
4294 elm_widget_disabled_set(obj, disabled);
4299 elm_genlist_item_disabled_get(const Elm_Genlist_Item *it)
4301 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4302 if (it->delete_me) return EINA_FALSE;
4303 return it->disabled;
4307 elm_genlist_item_display_only_set(Elm_Genlist_Item *it,
4308 Eina_Bool display_only)
4310 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4311 if (it->display_only == display_only) return;
4312 if (it->delete_me) return;
4313 it->display_only = display_only;
4314 it->mincalcd = EINA_FALSE;
4315 it->updateme = EINA_TRUE;
4316 if (it->block) it->block->updateme = EINA_TRUE;
4317 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4318 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4322 elm_genlist_item_display_only_get(const Elm_Genlist_Item *it)
4324 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4325 if (it->delete_me) return EINA_FALSE;
4326 return it->display_only;
4330 elm_genlist_item_show(Elm_Genlist_Item *it)
4332 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4333 Evas_Coord gith = 0;
4334 if (it->delete_me) return;
4335 if ((it->queued) || (!it->mincalcd))
4337 it->wd->show_item = it;
4338 it->wd->bring_in = EINA_TRUE;
4339 it->showme = EINA_TRUE;
4342 if (it->wd->show_item)
4344 it->wd->show_item->showme = EINA_FALSE;
4345 it->wd->show_item = NULL;
4347 if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
4348 gith = it->group_item->h;
4349 elm_smart_scroller_child_region_show(it->wd->scr,
4350 it->x + it->block->x,
4351 it->y + it->block->y - gith,
4352 it->block->w, it->h);
4356 elm_genlist_item_bring_in(Elm_Genlist_Item *it)
4358 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4359 Evas_Coord gith = 0;
4360 if (it->delete_me) return;
4361 if ((it->queued) || (!it->mincalcd))
4363 it->wd->show_item = it;
4364 it->wd->bring_in = EINA_TRUE;
4365 it->showme = EINA_TRUE;
4368 if (it->wd->show_item)
4370 it->wd->show_item->showme = EINA_FALSE;
4371 it->wd->show_item = NULL;
4373 if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
4374 gith = it->group_item->h;
4375 elm_smart_scroller_region_bring_in(it->wd->scr,
4376 it->x + it->block->x,
4377 it->y + it->block->y - gith,
4378 it->block->w, it->h);
4382 elm_genlist_item_top_show(Elm_Genlist_Item *it)
4384 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4386 Evas_Coord gith = 0;
4388 if (it->delete_me) return;
4389 if ((it->queued) || (!it->mincalcd))
4391 it->wd->show_item = it;
4392 it->wd->bring_in = EINA_TRUE;
4393 it->showme = EINA_TRUE;
4396 if (it->wd->show_item)
4398 it->wd->show_item->showme = EINA_FALSE;
4399 it->wd->show_item = NULL;
4401 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4402 if (it->group_item) gith = it->group_item->h;
4403 elm_smart_scroller_child_region_show(it->wd->scr,
4404 it->x + it->block->x,
4405 it->y + it->block->y - gith,
4410 elm_genlist_item_top_bring_in(Elm_Genlist_Item *it)
4412 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4414 Evas_Coord gith = 0;
4416 if (it->delete_me) return;
4417 if ((it->queued) || (!it->mincalcd))
4419 it->wd->show_item = it;
4420 it->wd->bring_in = EINA_TRUE;
4421 it->showme = EINA_TRUE;
4424 if (it->wd->show_item)
4426 it->wd->show_item->showme = EINA_FALSE;
4427 it->wd->show_item = NULL;
4429 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4430 if (it->group_item) gith = it->group_item->h;
4431 elm_smart_scroller_region_bring_in(it->wd->scr,
4432 it->x + it->block->x,
4433 it->y + it->block->y - gith,
4438 elm_genlist_item_middle_show(Elm_Genlist_Item *it)
4440 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4443 if (it->delete_me) return;
4444 if ((it->queued) || (!it->mincalcd))
4446 it->wd->show_item = it;
4447 it->wd->bring_in = EINA_TRUE;
4448 it->showme = EINA_TRUE;
4451 if (it->wd->show_item)
4453 it->wd->show_item->showme = EINA_FALSE;
4454 it->wd->show_item = NULL;
4456 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4457 elm_smart_scroller_child_region_show(it->wd->scr,
4458 it->x + it->block->x,
4459 it->y + it->block->y - oh / 2 +
4460 it->h / 2, it->block->w, oh);
4464 elm_genlist_item_middle_bring_in(Elm_Genlist_Item *it)
4466 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4469 if (it->delete_me) return;
4470 if ((it->queued) || (!it->mincalcd))
4472 it->wd->show_item = it;
4473 it->wd->bring_in = EINA_TRUE;
4474 it->showme = EINA_TRUE;
4477 if (it->wd->show_item)
4479 it->wd->show_item->showme = EINA_FALSE;
4480 it->wd->show_item = NULL;
4482 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4483 elm_smart_scroller_region_bring_in(it->wd->scr,
4484 it->x + it->block->x,
4485 it->y + it->block->y - oh / 2 + it->h / 2,
4490 elm_genlist_item_del(Elm_Genlist_Item *it)
4492 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4493 if ((it->relcount > 0) || (it->walking > 0))
4495 elm_widget_item_pre_notify_del(it);
4496 elm_genlist_item_subitems_clear(it);
4497 it->delete_me = EINA_TRUE;
4498 if (it->wd->show_item == it) it->wd->show_item = NULL;
4500 it->wd->selected = eina_list_remove(it->wd->selected,
4504 if (it->realized) _item_unrealize(it, EINA_FALSE);
4505 it->block->changed = EINA_TRUE;
4506 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
4507 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
4509 if (it->itc->func.del)
4510 it->itc->func.del((void *)it->base.data, it->base.widget);
4517 elm_genlist_item_data_set(Elm_Genlist_Item *it,
4520 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4521 elm_widget_item_data_set(it, data);
4522 elm_genlist_item_update(it);
4526 elm_genlist_item_data_get(const Elm_Genlist_Item *it)
4528 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4529 return elm_widget_item_data_get(it);
4533 elm_genlist_item_icons_orphan(Elm_Genlist_Item *it)
4536 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4537 EINA_LIST_FREE(it->icon_objs, icon)
4539 elm_widget_sub_object_del(it->base.widget, icon);
4540 evas_object_smart_member_del(icon);
4541 evas_object_hide(icon);
4545 EAPI const Evas_Object *
4546 elm_genlist_item_object_get(const Elm_Genlist_Item *it)
4548 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4549 return it->base.view;
4553 elm_genlist_item_update(Elm_Genlist_Item *it)
4555 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4556 if (!it->block) return;
4557 if (it->delete_me) return;
4558 it->mincalcd = EINA_FALSE;
4559 it->updateme = EINA_TRUE;
4560 it->block->updateme = EINA_TRUE;
4561 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4562 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4563 it->defer_unrealize = EINA_FALSE;
4567 elm_genlist_item_item_class_update(Elm_Genlist_Item *it,
4568 const Elm_Genlist_Item_Class *itc)
4570 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4571 if (!it->block) return;
4572 EINA_SAFETY_ON_NULL_RETURN(itc);
4573 if (it->delete_me) return;
4575 it->nocache = EINA_TRUE;
4576 elm_genlist_item_update(it);
4579 EAPI const Elm_Genlist_Item_Class *
4580 elm_genlist_item_item_class_get(const Elm_Genlist_Item *it)
4582 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4583 if (it->delete_me) return NULL;
4586 static Evas_Object *
4587 _elm_genlist_item_label_create(void *data,
4589 void *item __UNUSED__)
4591 Evas_Object *label = elm_label_add(obj);
4594 elm_object_style_set(label, "tooltip");
4595 elm_object_text_set(label, data);
4600 _elm_genlist_item_label_del_cb(void *data,
4601 Evas_Object *obj __UNUSED__,
4602 void *event_info __UNUSED__)
4604 eina_stringshare_del(data);
4608 elm_genlist_item_tooltip_text_set(Elm_Genlist_Item *item,
4611 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4612 text = eina_stringshare_add(text);
4613 elm_genlist_item_tooltip_content_cb_set(item, _elm_genlist_item_label_create,
4615 _elm_genlist_item_label_del_cb);
4619 elm_genlist_item_tooltip_content_cb_set(Elm_Genlist_Item *item,
4620 Elm_Tooltip_Item_Content_Cb func,
4622 Evas_Smart_Cb del_cb)
4624 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(item, error);
4626 if ((item->tooltip.content_cb == func) && (item->tooltip.data == data))
4629 if (item->tooltip.del_cb)
4630 item->tooltip.del_cb((void *)item->tooltip.data,
4631 item->base.widget, item);
4633 item->tooltip.content_cb = func;
4634 item->tooltip.data = data;
4635 item->tooltip.del_cb = del_cb;
4637 if (item->base.view)
4639 elm_widget_item_tooltip_content_cb_set(item,
4640 item->tooltip.content_cb,
4641 item->tooltip.data, NULL);
4642 elm_widget_item_tooltip_style_set(item, item->tooltip.style);
4648 if (del_cb) del_cb((void *)data, NULL, NULL);
4652 elm_genlist_item_tooltip_unset(Elm_Genlist_Item *item)
4654 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4655 if ((item->base.view) && (item->tooltip.content_cb))
4656 elm_widget_item_tooltip_unset(item);
4658 if (item->tooltip.del_cb)
4659 item->tooltip.del_cb((void *)item->tooltip.data, item->base.widget, item);
4660 item->tooltip.del_cb = NULL;
4661 item->tooltip.content_cb = NULL;
4662 item->tooltip.data = NULL;
4663 if (item->tooltip.style)
4664 elm_genlist_item_tooltip_style_set(item, NULL);
4668 elm_genlist_item_tooltip_style_set(Elm_Genlist_Item *item,
4671 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4672 eina_stringshare_replace(&item->tooltip.style, style);
4673 if (item->base.view) elm_widget_item_tooltip_style_set(item, style);
4677 elm_genlist_item_tooltip_style_get(const Elm_Genlist_Item *item)
4679 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4680 return item->tooltip.style;
4684 elm_genlist_item_cursor_set(Elm_Genlist_Item *item,
4687 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4688 eina_stringshare_replace(&item->mouse_cursor, cursor);
4689 if (item->base.view) elm_widget_item_cursor_set(item, cursor);
4693 elm_genlist_item_cursor_get(const Elm_Genlist_Item *item)
4695 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4696 return elm_widget_item_cursor_get(item);
4700 elm_genlist_item_cursor_unset(Elm_Genlist_Item *item)
4702 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4703 if (!item->mouse_cursor)
4706 if (item->base.view)
4707 elm_widget_item_cursor_unset(item);
4709 eina_stringshare_del(item->mouse_cursor);
4710 item->mouse_cursor = NULL;
4714 elm_genlist_item_cursor_style_set(Elm_Genlist_Item *item,
4717 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4718 elm_widget_item_cursor_style_set(item, style);
4722 elm_genlist_item_cursor_style_get(const Elm_Genlist_Item *item)
4724 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4725 return elm_widget_item_cursor_style_get(item);
4729 elm_genlist_item_cursor_engine_only_set(Elm_Genlist_Item *item,
4730 Eina_Bool engine_only)
4732 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4733 elm_widget_item_cursor_engine_only_set(item, engine_only);
4737 elm_genlist_item_cursor_engine_only_get(const Elm_Genlist_Item *item)
4739 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
4740 return elm_widget_item_cursor_engine_only_get(item);
4744 elm_genlist_horizontal_mode_set(Evas_Object *obj,
4747 ELM_CHECK_WIDTYPE(obj, widtype);
4748 Widget_Data *wd = elm_widget_data_get(obj);
4750 if (wd->mode == mode) return;
4756 elm_genlist_horizontal_mode_get(const Evas_Object *obj)
4758 ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
4759 Widget_Data *wd = elm_widget_data_get(obj);
4760 if (!wd) return ELM_LIST_LAST;
4765 elm_genlist_always_select_mode_set(Evas_Object *obj,
4766 Eina_Bool always_select)
4768 ELM_CHECK_WIDTYPE(obj, widtype);
4769 Widget_Data *wd = elm_widget_data_get(obj);
4771 wd->always_select = always_select;
4775 elm_genlist_always_select_mode_get(const Evas_Object *obj)
4777 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4778 Widget_Data *wd = elm_widget_data_get(obj);
4779 if (!wd) return EINA_FALSE;
4780 return wd->always_select;
4784 elm_genlist_no_select_mode_set(Evas_Object *obj,
4785 Eina_Bool no_select)
4787 ELM_CHECK_WIDTYPE(obj, widtype);
4788 Widget_Data *wd = elm_widget_data_get(obj);
4790 wd->no_select = no_select;
4794 elm_genlist_no_select_mode_get(const Evas_Object *obj)
4796 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4797 Widget_Data *wd = elm_widget_data_get(obj);
4798 if (!wd) return EINA_FALSE;
4799 return wd->no_select;
4803 elm_genlist_compress_mode_set(Evas_Object *obj,
4806 ELM_CHECK_WIDTYPE(obj, widtype);
4807 Widget_Data *wd = elm_widget_data_get(obj);
4809 wd->compress = compress;
4813 elm_genlist_compress_mode_get(const Evas_Object *obj)
4815 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4816 Widget_Data *wd = elm_widget_data_get(obj);
4817 if (!wd) return EINA_FALSE;
4818 return wd->compress;
4822 elm_genlist_height_for_width_mode_set(Evas_Object *obj,
4823 Eina_Bool height_for_width)
4825 ELM_CHECK_WIDTYPE(obj, widtype);
4826 Widget_Data *wd = elm_widget_data_get(obj);
4828 wd->height_for_width = !!height_for_width;
4829 if (wd->height_for_width)
4831 elm_genlist_homogeneous_set(obj, EINA_FALSE);
4832 elm_genlist_compress_mode_set(obj, EINA_TRUE);
4837 elm_genlist_height_for_width_mode_get(const Evas_Object *obj)
4839 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4840 Widget_Data *wd = elm_widget_data_get(obj);
4841 if (!wd) return EINA_FALSE;
4842 return wd->height_for_width;
4846 elm_genlist_bounce_set(Evas_Object *obj,
4850 ELM_CHECK_WIDTYPE(obj, widtype);
4851 Widget_Data *wd = elm_widget_data_get(obj);
4853 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
4857 elm_genlist_bounce_get(const Evas_Object *obj,
4858 Eina_Bool *h_bounce,
4859 Eina_Bool *v_bounce)
4861 ELM_CHECK_WIDTYPE(obj, widtype);
4862 Widget_Data *wd = elm_widget_data_get(obj);
4864 elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce);
4868 elm_genlist_homogeneous_set(Evas_Object *obj,
4869 Eina_Bool homogeneous)
4871 ELM_CHECK_WIDTYPE(obj, widtype);
4872 Widget_Data *wd = elm_widget_data_get(obj);
4874 if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
4875 wd->homogeneous = homogeneous;
4879 elm_genlist_homogeneous_get(const Evas_Object *obj)
4881 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4882 Widget_Data *wd = elm_widget_data_get(obj);
4883 if (!wd) return EINA_FALSE;
4884 return wd->homogeneous;
4888 elm_genlist_block_count_set(Evas_Object *obj,
4891 ELM_CHECK_WIDTYPE(obj, widtype);
4892 Widget_Data *wd = elm_widget_data_get(obj);
4894 wd->max_items_per_block = n;
4895 wd->item_cache_max = wd->max_items_per_block * 2;
4896 _item_cache_clean(wd);
4900 elm_genlist_block_count_get(const Evas_Object *obj)
4902 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4903 Widget_Data *wd = elm_widget_data_get(obj);
4905 return wd->max_items_per_block;
4909 elm_genlist_longpress_timeout_set(Evas_Object *obj,
4912 ELM_CHECK_WIDTYPE(obj, widtype);
4913 Widget_Data *wd = elm_widget_data_get(obj);
4915 wd->longpress_timeout = timeout;
4919 elm_genlist_longpress_timeout_get(const Evas_Object *obj)
4921 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4922 Widget_Data *wd = elm_widget_data_get(obj);
4924 return wd->longpress_timeout;
4928 elm_genlist_scroller_policy_set(Evas_Object *obj,
4929 Elm_Scroller_Policy policy_h,
4930 Elm_Scroller_Policy policy_v)
4932 ELM_CHECK_WIDTYPE(obj, widtype);
4933 Widget_Data *wd = elm_widget_data_get(obj);
4934 if ((!wd) || (!wd->scr)) return;
4935 if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
4936 (policy_v >= ELM_SCROLLER_POLICY_LAST))
4938 elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
4942 elm_genlist_scroller_policy_get(const Evas_Object *obj,
4943 Elm_Scroller_Policy *policy_h,
4944 Elm_Scroller_Policy *policy_v)
4946 ELM_CHECK_WIDTYPE(obj, widtype);
4947 Widget_Data *wd = elm_widget_data_get(obj);
4948 Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
4949 if ((!wd) || (!wd->scr)) return;
4950 elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
4951 if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
4952 if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
4956 elm_genlist_realized_items_update(Evas_Object *obj)
4958 ELM_CHECK_WIDTYPE(obj, widtype);
4960 Eina_List *list, *l;
4961 Elm_Genlist_Item *it;
4963 list = elm_genlist_realized_items_get(obj);
4964 EINA_LIST_FOREACH(list, l, it)
4965 elm_genlist_item_update(it);
4969 elm_genlist_item_mode_set(Elm_Genlist_Item *it,
4970 const char *mode_type,
4973 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4974 Widget_Data *wd = it->wd;
4976 Elm_Genlist_Item *it2;
4979 if (!mode_type) return;
4980 if ((it->delete_me) || (it->disabled)) return;
4981 if (wd->edit_mode) return;
4983 if ((wd->mode_item == it) &&
4984 (!strcmp(mode_type, wd->mode_type)) &&
4987 if (!it->itc->mode_item_style) return;
4991 EINA_LIST_FOREACH(wd->selected, l, it2)
4993 elm_genlist_item_selected_set(it2, EINA_FALSE);
4997 it2 = elm_genlist_selected_item_get(wd->obj);
4998 if ((it2) && (it2->realized))
4999 elm_genlist_item_selected_set(it2, EINA_FALSE);
5002 if (((wd->mode_type) && (strcmp(mode_type, wd->mode_type))) ||
5004 ((it == wd->mode_item) && (!mode_set)))
5005 _item_mode_unset(wd);
5007 eina_stringshare_replace(&wd->mode_type, mode_type);
5008 if (mode_set) _item_mode_set(it);
5012 elm_genlist_mode_get(const Evas_Object *obj)
5014 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5015 Widget_Data *wd = elm_widget_data_get(obj);
5016 if (!wd) return NULL;
5017 return wd->mode_type;
5020 EAPI const Elm_Genlist_Item *
5021 elm_genlist_mode_item_get(const Evas_Object *obj)
5023 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5024 Widget_Data *wd = elm_widget_data_get(obj);
5025 if (!wd) return NULL;
5026 return wd->mode_item;
5030 elm_genlist_reorder_mode_set(Evas_Object *obj,
5031 Eina_Bool reorder_mode)
5033 ELM_CHECK_WIDTYPE(obj, widtype);
5034 Widget_Data *wd = elm_widget_data_get(obj);
5036 wd->reorder_mode = reorder_mode;
5040 elm_genlist_reorder_mode_get(const Evas_Object *obj)
5042 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5043 Widget_Data *wd = elm_widget_data_get(obj);
5044 if (!wd) return EINA_FALSE;
5045 return wd->reorder_mode;
5049 elm_genlist_item_move_after(Elm_Genlist_Item *it __UNUSED__, Elm_Genlist_Item *after __UNUSED__)
5055 elm_genlist_item_move_before(Elm_Genlist_Item *it __UNUSED__, Elm_Genlist_Item *before __UNUSED__)
5061 elm_genlist_effect_set(const Evas_Object *obj, Eina_Bool emode)
5063 ELM_CHECK_WIDTYPE(obj, widtype);
5064 Widget_Data *wd = elm_widget_data_get(obj);
5066 wd->effect_mode = emode;
5067 // wd->point_rect = evas_object_rectangle_add(evas_object_evas_get(wd->obj));
5068 // evas_object_resize(wd->point_rect, 10, 25);
5069 // evas_object_color_set(wd->point_rect, 255, 0, 0, 130);
5070 // evas_object_show(wd->point_rect);
5071 // evas_object_hide(wd->point_rect);
5075 _create_tray_alpha_bg(const Evas_Object *obj)
5077 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5078 Widget_Data *wd = elm_widget_data_get(obj);
5079 if (!wd) return NULL;
5081 Evas_Object *bg = NULL;
5082 Evas_Coord ox, oy, ow, oh;
5084 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
5085 bg = evas_object_rectangle_add(evas_object_evas_get(wd->obj));
5086 evas_object_color_set(bg,0,0,0,0);
5087 evas_object_resize(bg , ow, oh);
5088 evas_object_move(bg , ox, oy);
5089 evas_object_show(bg);
5090 evas_object_hide(bg);
5097 struct timeval timev;
5099 gettimeofday(&timev, NULL);
5100 return ((timev.tv_sec * 1000) + ((timev.tv_usec) / 1000));
5103 // added for item moving animation.
5105 _item_moving_effect_timer_cb(void *data)
5107 Widget_Data *wd = data;
5108 if (!wd) return EINA_FALSE;
5110 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
5111 Elm_Genlist_Item *it = NULL, *it2;
5113 double time = 0.3, t;
5115 Eina_Bool check, end = EINA_FALSE;
5118 t = ((0.0 > (t = current_time_get() - wd->start_time)) ? 0.0 : t) / 1000;
5120 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
5121 evas_output_viewport_get(evas_object_evas_get(wd->pan_smart), &cvx, &cvy, &cvw, &cvh);
5122 if (t > time) end = EINA_TRUE;
5124 it2 = elm_genlist_item_next_get(wd->expand_item);
5127 if (wd->expand_item->expanded_depth >= it2->expanded_depth) break;
5128 it2 = elm_genlist_item_next_get(it2);
5133 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5134 dy = it2->scrl_y - it2->old_scrl_y;
5135 else if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5136 dy = wd->expand_item_gap;
5140 y = ((1 - (1 - (t / time)) * (1 - (t /time))) * dy);
5149 EINA_INLIST_FOREACH(wd->blocks, itb)
5152 if (ELM_RECTS_INTERSECT(itb->x - wd->pan_x + ox,
5153 itb->y - wd->pan_y + oy,
5155 cvx, cvy, cvw, cvh))
5157 EINA_LIST_FOREACH(itb->items, l, it)
5159 if (it == it2) check = EINA_TRUE;
5160 if (!check) continue;
5162 if (!it->old_scrl_y)
5163 it->old_scrl_y = it->scrl_y;
5164 if (it->old_scrl_y + y < oy + oh)
5166 if (!it->realized) _item_realize(it, in, 0);
5168 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE && it->old_scrl_y + y < it->scrl_y)
5169 it->old_scrl_y = it->scrl_y - y;
5172 if (wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE ||
5173 (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE && it->old_scrl_y + y >= it->scrl_y))
5175 if (wd->edit_mode) _effect_item_controls(it, it->scrl_x, it->old_scrl_y + y);
5178 evas_object_resize(it->base.view, it->w, it->h);
5179 evas_object_move(it->base.view, it->scrl_x, it->old_scrl_y + y);
5180 evas_object_show(it->base.view);
5181 evas_object_raise(it->base.view);
5184 if (it->group_item) evas_object_raise(it->group_item->base.view);
5190 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5192 it = elm_genlist_item_prev_get(it2);
5195 if (it->expanded_depth <= it2->expanded_depth) break;
5196 if ((it->scrl_y < it2->old_scrl_y + y) && (it->expanded_depth > it2->expanded_depth))
5198 if (!it->effect_done)
5200 edje_object_signal_emit(it->base.view, "flip_item", "");
5201 evas_object_show(it->base.view);
5202 it->effect_done = EINA_TRUE;
5205 it = elm_genlist_item_prev_get(it);
5208 else if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5210 it = elm_genlist_item_prev_get(it2);
5213 if ((it->scrl_y > it2->old_scrl_y + y) && (it->expanded_depth > it2->expanded_depth))
5215 if (!it->effect_done)
5217 edje_object_signal_emit(it->base.view, "elm,state,hide", "");
5218 it->effect_done = EINA_TRUE;
5223 it = elm_genlist_item_prev_get(it);
5226 if (wd->calc_job) ecore_job_del(wd->calc_job);
5227 wd->calc_job = ecore_job_add(_calc_job, wd);
5232 int expand_order = 0;
5233 if (wd->expand_item) it = elm_genlist_item_next_get(wd->expand_item);
5237 it = elm_genlist_item_next_get(it);
5239 if (wd->expand_item) it = elm_genlist_item_next_get(wd->expand_item);
5243 if (wd->expand_item->expanded_depth >= it->expanded_depth) break;
5244 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5246 if (!it->effect_done)
5248 if (t >= (((expand_order - 1) * time) / expand_num))
5250 edje_object_signal_emit(it->base.view, "flip_item", "");
5251 evas_object_show(it->base.view);
5252 it->effect_done = EINA_TRUE;
5256 it = elm_genlist_item_next_get(it);
5262 if (wd->item_moving_effect_timer)
5264 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5265 _item_subitems_clear(wd->expand_item);
5266 EINA_INLIST_FOREACH(wd->blocks, itb)
5268 EINA_LIST_FOREACH(itb->items, l, it)
5270 it->effect_done = EINA_TRUE;
5271 it->old_scrl_y = it->scrl_y;
5275 wd->item_moving_effect_timer = NULL;
5277 _item_auto_scroll(wd);
5278 evas_object_lower(wd->alpha_bg);
5279 evas_object_hide(wd->alpha_bg);
5280 elm_smart_scroller_bounce_animator_disabled_set(wd->scr, EINA_FALSE);
5281 wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_NONE;
5283 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
5284 evas_object_smart_callback_call(wd->obj, "effect_done", NULL);
5285 return ECORE_CALLBACK_CANCEL;
5287 return ECORE_CALLBACK_RENEW;
5291 _emit_contract(Elm_Genlist_Item *it)
5293 Elm_Genlist_Item *it2;
5296 // printf("%p is emited contract\n", it);
5297 edje_object_signal_emit(it->base.view, "elm,state,contract_flip", "");
5298 it->effect_done = EINA_FALSE;
5300 EINA_LIST_FOREACH(it->items, l, it2)
5302 _emit_contract(it2);
5305 // added for item moving animation.
5307 _item_flip_effect_show(Elm_Genlist_Item *it)
5309 Elm_Genlist_Item *it2;
5311 Widget_Data *wd = it->wd;
5312 Eina_Bool check = EINA_FALSE;
5314 it2 = elm_genlist_item_next_get(it);
5317 if (it2->expanded_depth <= it->expanded_depth) check = EINA_TRUE;
5318 it2 = elm_genlist_item_next_get(it2);
5320 EINA_LIST_FOREACH(it->items, l, it2)
5322 if (it2->parent && it == it2->parent)
5324 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5325 edje_object_signal_emit(it2->base.view, "elm,state,hide", "");
5326 else if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5327 _emit_contract(it2);
5331 return ECORE_CALLBACK_CANCEL;
5336 _elm_genlist_pinch_zoom_execute(Evas_Object *obj, Eina_Bool emode)
5338 printf("!!! NOW FIXING \n");
5343 * Set pinch zoom mode
5345 * @param obj The genlist object
5347 * (EINA_TRUE = pinch contract (zoom in), EINA_FALSE = pinch expand (zoom out)
5352 elm_genlist_pinch_zoom_mode_set(Evas_Object *obj __UNUSED__, Eina_Bool emode __UNUSED__)
5354 printf("!!! NOW FIXING \n");
5358 * Get pinch zoom mode
5360 * @param obj The genlist object
5361 * @return The pinch mode
5362 * (EINA_TRUE = pinch contract (zoom in), EINA_FALSE = pinch expand (zoom out)
5367 elm_genlist_pinch_zoom_mode_get(const Evas_Object *obj __UNUSED__)
5369 printf("!!! NOW FIXING \n");
5374 elm_genlist_pinch_zoom_set(Evas_Object *obj __UNUSED__, Eina_Bool emode __UNUSED__)
5376 printf("!!! NOW FIXING \n");
5380 ////////////////////////////////////////////////////////////////////////
5382 ////////////////////////////////////////////////////////////////////////
5385 _effect_item_controls(Elm_Genlist_Item *it, int itx, int ity)
5387 if (!it->wd->edit_mode) return;
5388 evas_object_resize(it->edit_obj,it->w, it->h);
5389 evas_object_move(it->edit_obj, itx, ity);
5393 _effect_item_realize(Elm_Genlist_Item *it, Eina_Bool effect_on)
5395 if ((it->effect_item_realized) || (it->delete_me)) return;
5399 _mode_finished_signal_cb(it, (Evas_Object *)elm_genlist_item_object_get(it), NULL, NULL);
5401 it->edit_obj = edje_object_add(evas_object_evas_get(it->base.widget));
5402 edje_object_scale_set(it->edit_obj, elm_widget_scale_get(it->base.widget) *
5403 _elm_config->scale);
5404 evas_object_smart_member_add(it->edit_obj, it->wd->pan_smart);
5405 elm_widget_sub_object_add(it->base.widget, it->edit_obj);
5407 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) strncpy(buf, "tree", sizeof(buf));
5408 else strncpy(buf, "item", sizeof(buf));
5409 if (it->wd->compress) strncat(buf, "_compress", sizeof(buf) - strlen(buf));
5411 strncat(buf, "/", sizeof(buf) - strlen(buf));
5413 if (it->itc->edit_item_style && strcmp(it->itc->edit_item_style, "default"))
5415 strncat(buf, it->itc->edit_item_style, sizeof(buf) - strlen(buf));
5416 _elm_theme_object_set(it->base.widget, it->edit_obj, "genlist", buf, elm_widget_style_get(it->base.widget));
5420 _elm_theme_object_set(it->base.widget, it->edit_obj, "genlist", "item/edit_default", elm_widget_style_get(it->base.widget));
5423 if (it->wd->reorder_mode)
5425 if (effect_on) edje_object_signal_emit(it->edit_obj, "elm,state,reorder_enabled_effect", "elm");
5426 else edje_object_signal_emit(it->edit_obj, "elm,state,reorder_enabled", "elm");
5428 if (effect_on) edje_object_signal_emit(it->edit_obj, "elm,state,emode_enabled_effect", "elm");
5429 else edje_object_signal_emit(it->edit_obj, "elm,state,emode_enabled", "elm");
5431 if (it->disabled) edje_object_signal_emit(it->edit_obj, "elm,state,disabled", "elm");
5432 else edje_object_signal_emit(it->edit_obj, "elm,state,enabled", "elm");
5435 if ((it->wd->edit_mode))
5437 if (it->itc->func.icon_get)
5442 it->icons = elm_widget_stringlist_get(edje_object_data_get(it->edit_obj, "edit_icons"));
5443 EINA_LIST_FOREACH(it->icons, l, key)
5445 Evas_Object *ic = it->itc->func.icon_get
5446 ((void *)it->base.data, it->base.widget, l->data);
5450 it->edit_icon_objs = eina_list_append(it->edit_icon_objs, ic);
5451 edje_object_part_swallow(it->edit_obj, key, ic);
5452 evas_object_show(ic);
5453 elm_widget_sub_object_add(it->base.widget, ic);
5455 elm_widget_disabled_set(ic, EINA_TRUE);
5460 edje_object_part_swallow(it->edit_obj, "original_edc", it->base.view);
5461 _effect_item_controls(it,it->scrl_x, it->scrl_y);
5462 evas_object_show(it->edit_obj);
5464 it->effect_item_realized = EINA_TRUE;
5465 it->want_unrealize = EINA_FALSE;
5469 _effect_item_unrealize(Elm_Genlist_Item *it)
5473 if (!it->effect_item_realized) return;
5474 if (it->wd->reorder_it && it->wd->reorder_it == it) return;
5476 edje_object_signal_emit(it->edit_obj, "elm,state,reorder_disable_effect", "elm");
5477 edje_object_signal_emit(it->edit_obj, "elm,state,sel,disable", "elm");
5478 edje_object_message_signal_process(it->edit_obj);
5479 edje_object_part_unswallow(it->edit_obj, it->base.view);
5480 evas_object_smart_member_add(it->base.view, it->wd->pan_smart);
5481 elm_widget_sub_object_add(it->base.widget, it->base.view);
5482 // evas_object_smart_callback_call(it->edit_obj, "unrealized", it);
5483 // _item_cache_add(it);
5484 evas_object_del(it->edit_obj);
5485 it->edit_obj = NULL;
5486 EINA_LIST_FREE(it->edit_icon_objs, icon)
5487 evas_object_del(icon);
5489 // edje_object_signal_emit(it->edit_obj, "elm,state,edit_end,disable", "elm");
5490 it->effect_item_realized = EINA_FALSE;
5494 * Get Genlist edit mode
5496 * @param obj The genlist object
5497 * @return The edit mode status
5498 * (EINA_TRUE = edit mode, EINA_FALSE = normal mode
5503 elm_genlist_edit_mode_get(const Evas_Object *obj)
5505 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5506 Widget_Data *wd = elm_widget_data_get(obj);
5507 if (!wd) return EINA_FALSE;
5509 if (wd->edit_mode) return EINA_TRUE;
5510 else return EINA_FALSE;
5514 * Set Genlist edit mode
5516 * This sets Genlist edit mode.
5518 * @param obj The Genlist object
5519 * @param emode ELM_GENLIST_EDIT_MODE_{NONE & REORDER & INSERT & DELETE & SELECT & SELECT_ALL}
5520 * @param edit_class Genlist edit class (Elm_Genlist_Edit_Class structure)
5525 elm_genlist_edit_mode_set(Evas_Object *obj, Eina_Bool edit_mode)
5527 ELM_CHECK_WIDTYPE(obj, widtype);
5531 Elm_Genlist_Item *it;
5533 Widget_Data *wd = elm_widget_data_get(obj);
5535 if (wd->edit_mode == edit_mode) return;
5537 wd->edit_mode = edit_mode;
5540 EINA_INLIST_FOREACH(wd->blocks, itb)
5544 EINA_LIST_FOREACH(itb->items, l, it)
5546 if (it->flags != ELM_GENLIST_ITEM_GROUP && it->realized)
5548 _effect_item_unrealize(it);
5553 _item_cache_zero(wd);
5558 EINA_INLIST_FOREACH(wd->blocks, itb)
5562 EINA_LIST_FOREACH(itb->items, l, it)
5564 if (it->flags != ELM_GENLIST_ITEM_GROUP && it->realized)
5566 if(it->selected) _item_unselect(it);
5567 if (it->itc->edit_item_style) _effect_item_realize(it, EINA_TRUE);
5574 if (wd->calc_job) ecore_job_del(wd->calc_job);
5575 wd->calc_job = ecore_job_add(_calc_job, wd);
5579 * Set a given item's rename mode
5581 * This renames the item's label from genlist
5583 * @param it The item
5584 * @param renamed set if emode is EINA_TRUE, unset if emode is EINA_FALSE
5589 elm_genlist_item_rename_mode_set(Elm_Genlist_Item *it, Eina_Bool renamed)
5595 _item_unrealize(it, EINA_FALSE);
5596 it->renamed = EINA_TRUE;
5597 it->wd->rename_it = it;
5598 it->nocache = EINA_TRUE;
5599 if (it->selected) _item_unselect(it);
5601 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
5602 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
5608 it->renamed = EINA_FALSE;
5609 it->nocache = EINA_TRUE;
5610 it->wd->rename_it = NULL;
5611 _item_cache_zero(it->wd);
5612 elm_genlist_item_update(it);
5618 elm_genlist_item_rename_mode_get(Elm_Genlist_Item *item)
5620 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
5621 return item->renamed;