2 #include <Elementary.h>
3 #include <Elementary_Cursor.h>
7 #define MAX_ITEMS_PER_BLOCK 32
8 #define REORDER_EFFECT_TIME 0.5
10 typedef struct _Widget_Data Widget_Data;
11 typedef struct _Item_Block Item_Block;
12 typedef struct _Pan Pan;
13 typedef struct _Item_Cache Item_Cache;
14 typedef enum _Elm_Genlist_Item_Move_effect_Mode
16 ELM_GENLIST_ITEM_MOVE_EFFECT_NONE = 0,
17 ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND = (1 << 0),
18 ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT = (1 << 1),
19 ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE = (1 << 2),
20 } Elm_Genlist_Item_Move_effect_Mode;
24 Evas_Object *obj, *scr, *pan_smart;
25 Eina_Inlist *items, *blocks;
26 Eina_List *group_items;
28 Evas_Coord pan_x, pan_y, w, h, minw, minh, realminw, prev_viewport_w;
29 Ecore_Job *calc_job, *update_job;
30 Ecore_Idle_Enterer *queue_idle_enterer;
31 Ecore_Idler *must_recalc_idler;
32 Eina_List *queue, *selected;
33 Elm_Genlist_Item *show_item, *last_selected_item, *anchor_item, *mode_item, *reorder_it, *reorder_rel, *expand_item;
34 Eina_Inlist *item_cache;
35 Evas_Coord anchor_y, reorder_start_y;
37 Ecore_Timer *multi_timer, *scr_hold_timer;
38 const char *mode_type;
39 unsigned int start_time;
40 Evas_Coord prev_x, prev_y, prev_mx, prev_my;
41 Evas_Coord cur_x, cur_y, cur_mx, cur_my;
42 Eina_Bool mouse_down : 1;
43 Eina_Bool multi_down : 1;
44 Eina_Bool multi_timeout : 1;
45 Eina_Bool multitouched : 1;
46 Eina_Bool on_hold : 1;
48 Eina_Bool always_select : 1;
49 Eina_Bool longpressed : 1;
50 Eina_Bool wasselected : 1;
51 Eina_Bool no_select : 1;
52 Eina_Bool bring_in : 1;
53 Eina_Bool compress : 1;
54 Eina_Bool height_for_width : 1;
55 Eina_Bool homogeneous : 1;
56 Eina_Bool clear_me : 1;
58 Eina_Bool reorder_mode : 1;
59 Eina_Bool reorder_pan_move : 1;
60 Eina_List *dragging_queue;
64 } history[SWIPE_MOVES];
73 int group_item_height;
74 int max_items_per_block;
75 double longpress_timeout;
78 Eina_Bool reorder_deleted : 1;
79 Eina_Bool effect_mode : 1;
80 Eina_Bool auto_scrolled : 1;
82 Ecore_Animator *item_moving_effect_timer;
83 Evas_Object *alpha_bg;
84 Evas_Coord expand_item_end;
85 Evas_Coord expand_item_gap;
87 Ecore_Job *changed_job;
88 Elm_Genlist_Item *rename_it;
99 Evas_Coord x, y, w, h, minw, minh;
100 Eina_Bool want_unrealize : 1;
101 Eina_Bool realized : 1;
102 Eina_Bool changed : 1;
103 Eina_Bool updateme : 1;
104 Eina_Bool changeme : 1;
105 Eina_Bool showme : 1;
106 Eina_Bool must_recalc : 1;
109 struct _Elm_Genlist_Item
111 Elm_Widget_Item base;
116 Evas_Coord x, y, w, h, minw, minh;
117 const Elm_Genlist_Item_Class *itc;
118 Elm_Genlist_Item *parent;
119 Elm_Genlist_Item *group_item;
120 Elm_Genlist_Item_Flags flags;
128 Eina_List *labels, *icons, *states, *icon_objs;
129 Eina_List *mode_labels, *mode_icons, *mode_states, *mode_icon_objs;
130 Ecore_Timer *long_timer;
131 Ecore_Timer *swipe_timer;
133 Evas_Coord scrl_x, scrl_y;
135 Elm_Genlist_Item *rel;
136 Evas_Object *mode_view;
141 Elm_Tooltip_Item_Content_Cb content_cb;
142 Evas_Smart_Cb del_cb;
146 const char *mouse_cursor;
153 Eina_Bool before : 1;
155 Eina_Bool want_unrealize : 1;
156 Eina_Bool want_realize : 1;
157 Eina_Bool realized : 1;
158 Eina_Bool selected : 1;
159 Eina_Bool highlighted : 1;
160 Eina_Bool expanded : 1;
161 Eina_Bool disabled : 1;
162 Eina_Bool display_only : 1;
163 Eina_Bool mincalcd : 1;
164 Eina_Bool queued : 1;
165 Eina_Bool showme : 1;
166 Eina_Bool delete_me : 1;
168 Eina_Bool dragging : 1;
169 Eina_Bool updateme : 1;
170 Eina_Bool nocache : 1;
173 Eina_Bool move_effect_me : 1;
174 Eina_Bool effect_done : 1;
175 Eina_Bool reordering : 1;
176 Eina_Bool renamed : 1;
177 Eina_Bool effect_item_realized : 1;
178 Eina_List *edit_icon_objs;
179 Evas_Object *edit_obj;
181 Ecore_Animator *item_moving_effect_timer;
182 Evas_Coord old_scrl_y;
189 Evas_Object *base_view, *spacer;
191 const char *item_style; // it->itc->item_style
192 Eina_Bool tree : 1; // it->flags & ELM_GENLIST_ITEM_SUBITEMS
193 Eina_Bool compress : 1; // it->wd->compress
194 Eina_Bool odd : 1; // in & 0x1
196 Eina_Bool selected : 1; // it->selected
197 Eina_Bool disabled : 1; // it->disabled
198 Eina_Bool expanded : 1; // it->expanded
201 #define ELM_GENLIST_ITEM_FROM_INLIST(item) \
202 ((item) ? EINA_INLIST_CONTAINER_GET(item, Elm_Genlist_Item) : NULL)
206 Evas_Object_Smart_Clipped_Data __clipped_data;
208 Ecore_Job *resize_job;
211 static const char *widtype = NULL;
212 static void _item_cache_zero(Widget_Data *wd);
213 static void _del_hook(Evas_Object *obj);
214 static void _mirrored_set(Evas_Object *obj,
216 static void _theme_hook(Evas_Object *obj);
217 static void _show_region_hook(void *data,
219 static void _sizing_eval(Evas_Object *obj);
220 static void _item_realize(Elm_Genlist_Item *it,
223 static void _item_unrealize(Elm_Genlist_Item *it,
225 static void _item_block_unrealize(Item_Block *itb);
226 static void _calc_job(void *data);
227 static void _on_focus_hook(void *data,
229 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
230 static void _changed_job(void *data);
231 static Eina_Bool _item_multi_select_up(Widget_Data *wd);
232 static Eina_Bool _item_multi_select_down(Widget_Data *wd);
233 static Eina_Bool _item_single_select_up(Widget_Data *wd);
234 static Eina_Bool _item_single_select_down(Widget_Data *wd);
235 static Eina_Bool _event_hook(Evas_Object *obj,
237 Evas_Callback_Type type,
239 static void _signal_emit_hook(Evas_Object *obj,
240 const char *emission,
242 static Eina_Bool _deselect_all_items(Widget_Data *wd);
243 static void _pan_calculate(Evas_Object *obj);
244 static void _item_position(Elm_Genlist_Item *it, Evas_Object *obj);
245 static void _mode_item_realize(Elm_Genlist_Item *it);
246 static void _mode_item_unrealize(Elm_Genlist_Item *it);
247 static void _item_mode_set(Elm_Genlist_Item *it);
248 static void _item_mode_unset(Widget_Data *wd);
249 static void _group_items_recalc(void *data);
251 // TODO : refactoring
252 static Evas_Object* _create_tray_alpha_bg(const Evas_Object *obj);
253 static unsigned int current_time_get();
254 static Eina_Bool _item_moving_effect_timer_cb(void *data);
255 static int _item_flip_effect_show(Elm_Genlist_Item *it);
256 static void _effect_item_controls(Elm_Genlist_Item *it, int itx, int ity);
257 static void _effect_item_realize(Elm_Genlist_Item *it, Eina_Bool effect_on);
258 static void _effect_item_unrealize(Elm_Genlist_Item *it);
259 static void _effect_item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after);
260 static void _effect_item_move_before(Elm_Genlist_Item *it, Elm_Genlist_Item *before);
261 static void _item_auto_scroll(void *data);
263 static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
265 static const char SIG_ACTIVATED[] = "activated";
266 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
267 static const char SIG_SELECTED[] = "selected";
268 static const char SIG_UNSELECTED[] = "unselected";
269 static const char SIG_EXPANDED[] = "expanded";
270 static const char SIG_CONTRACTED[] = "contracted";
271 static const char SIG_EXPAND_REQUEST[] = "expand,request";
272 static const char SIG_CONTRACT_REQUEST[] = "contract,request";
273 static const char SIG_REALIZED[] = "realized";
274 static const char SIG_UNREALIZED[] = "unrealized";
275 static const char SIG_DRAG_START_UP[] = "drag,start,up";
276 static const char SIG_DRAG_START_DOWN[] = "drag,start,down";
277 static const char SIG_DRAG_START_LEFT[] = "drag,start,left";
278 static const char SIG_DRAG_START_RIGHT[] = "drag,start,right";
279 static const char SIG_DRAG_STOP[] = "drag,stop";
280 static const char SIG_DRAG[] = "drag";
281 static const char SIG_LONGPRESSED[] = "longpressed";
282 static const char SIG_SCROLL_EDGE_TOP[] = "scroll,edge,top";
283 static const char SIG_SCROLL_EDGE_BOTTOM[] = "scroll,edge,bottom";
284 static const char SIG_SCROLL_EDGE_LEFT[] = "scroll,edge,left";
285 static const char SIG_SCROLL_EDGE_RIGHT[] = "scroll,edge,right";
286 static const char SIG_MULTI_SWIPE_LEFT[] = "multi,swipe,left";
287 static const char SIG_MULTI_SWIPE_RIGHT[] = "multi,swipe,right";
288 static const char SIG_MULTI_SWIPE_UP[] = "multi,swipe,up";
289 static const char SIG_MULTI_SWIPE_DOWN[] = "multi,swipe,down";
290 static const char SIG_MULTI_PINCH_OUT[] = "multi,pinch,out";
291 static const char SIG_MULTI_PINCH_IN[] = "multi,pinch,in";
292 static const char SIG_SWIPE[] = "swipe";
294 static const Evas_Smart_Cb_Description _signals[] = {
295 {SIG_CLICKED_DOUBLE, ""},
298 {SIG_UNSELECTED, ""},
300 {SIG_CONTRACTED, ""},
301 {SIG_EXPAND_REQUEST, ""},
302 {SIG_CONTRACT_REQUEST, ""},
304 {SIG_UNREALIZED, ""},
305 {SIG_DRAG_START_UP, ""},
306 {SIG_DRAG_START_DOWN, ""},
307 {SIG_DRAG_START_LEFT, ""},
308 {SIG_DRAG_START_RIGHT, ""},
311 {SIG_LONGPRESSED, ""},
312 {SIG_SCROLL_EDGE_TOP, ""},
313 {SIG_SCROLL_EDGE_BOTTOM, ""},
314 {SIG_SCROLL_EDGE_LEFT, ""},
315 {SIG_SCROLL_EDGE_RIGHT, ""},
316 {SIG_MULTI_SWIPE_LEFT, ""},
317 {SIG_MULTI_SWIPE_RIGHT, ""},
318 {SIG_MULTI_SWIPE_UP, ""},
319 {SIG_MULTI_SWIPE_DOWN, ""},
320 {SIG_MULTI_PINCH_OUT, ""},
321 {SIG_MULTI_PINCH_IN, ""},
327 _event_hook(Evas_Object *obj,
328 Evas_Object *src __UNUSED__,
329 Evas_Callback_Type type,
332 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
333 Evas_Event_Key_Down *ev = event_info;
334 Widget_Data *wd = elm_widget_data_get(obj);
335 if (!wd) return EINA_FALSE;
336 if (!wd->items) return EINA_FALSE;
337 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
338 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
340 Elm_Genlist_Item *it = NULL;
343 Evas_Coord step_x = 0;
344 Evas_Coord step_y = 0;
347 Evas_Coord page_x = 0;
348 Evas_Coord page_y = 0;
350 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
351 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
352 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
353 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
355 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
359 else if ((!strcmp(ev->keyname, "Right")) ||
360 (!strcmp(ev->keyname, "KP_Right")))
364 else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
366 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
367 (_item_multi_select_up(wd)))
368 || (_item_single_select_up(wd)))
370 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
376 else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
378 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
379 (_item_multi_select_down(wd)))
380 || (_item_single_select_down(wd)))
382 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
388 else if ((!strcmp(ev->keyname, "Home")) ||
389 (!strcmp(ev->keyname, "KP_Home")))
391 it = elm_genlist_first_item_get(obj);
392 elm_genlist_item_bring_in(it);
393 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
396 else if ((!strcmp(ev->keyname, "End")) ||
397 (!strcmp(ev->keyname, "KP_End")))
399 it = elm_genlist_last_item_get(obj);
400 elm_genlist_item_bring_in(it);
401 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
404 else if ((!strcmp(ev->keyname, "Prior")) ||
405 (!strcmp(ev->keyname, "KP_Prior")))
408 y -= -(page_y * v_h) / 100;
412 else if ((!strcmp(ev->keyname, "Next")) ||
413 (!strcmp(ev->keyname, "KP_Next")))
416 y += -(page_y * v_h) / 100;
420 else if (((!strcmp(ev->keyname, "Return")) ||
421 (!strcmp(ev->keyname, "KP_Enter")) ||
422 (!strcmp(ev->keyname, "space")))
423 && (!wd->multi) && (wd->selected))
425 it = elm_genlist_selected_item_get(obj);
426 elm_genlist_item_expanded_set(it,
427 !elm_genlist_item_expanded_get(it));
428 evas_object_smart_callback_call(it->base.widget, SIG_ACTIVATED, it);
430 else if (!strcmp(ev->keyname, "Escape"))
432 if (!_deselect_all_items(wd)) return EINA_FALSE;
433 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
436 else return EINA_FALSE;
438 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
439 elm_smart_scroller_child_pos_set(wd->scr, x, y);
444 _deselect_all_items(Widget_Data *wd)
446 if (!wd->selected) return EINA_FALSE;
448 elm_genlist_item_selected_set(wd->selected->data, EINA_FALSE);
454 _item_multi_select_up(Widget_Data *wd)
456 if (!wd->selected) return EINA_FALSE;
457 if (!wd->multi) return EINA_FALSE;
459 Elm_Genlist_Item *prev = elm_genlist_item_prev_get(wd->last_selected_item);
460 if (!prev) return EINA_TRUE;
462 if (elm_genlist_item_selected_get(prev))
464 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
465 wd->last_selected_item = prev;
466 elm_genlist_item_show(wd->last_selected_item);
470 elm_genlist_item_selected_set(prev, EINA_TRUE);
471 elm_genlist_item_show(prev);
477 _item_multi_select_down(Widget_Data *wd)
479 if (!wd->selected) return EINA_FALSE;
480 if (!wd->multi) return EINA_FALSE;
482 Elm_Genlist_Item *next = elm_genlist_item_next_get(wd->last_selected_item);
483 if (!next) return EINA_TRUE;
485 if (elm_genlist_item_selected_get(next))
487 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
488 wd->last_selected_item = next;
489 elm_genlist_item_show(wd->last_selected_item);
493 elm_genlist_item_selected_set(next, EINA_TRUE);
494 elm_genlist_item_show(next);
500 _item_single_select_up(Widget_Data *wd)
502 Elm_Genlist_Item *prev;
505 prev = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
506 while ((prev) && (prev->delete_me))
507 prev = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
509 else prev = elm_genlist_item_prev_get(wd->last_selected_item);
511 if (!prev) return EINA_FALSE;
513 _deselect_all_items(wd);
515 elm_genlist_item_selected_set(prev, EINA_TRUE);
516 elm_genlist_item_show(prev);
521 _item_single_select_down(Widget_Data *wd)
523 Elm_Genlist_Item *next;
526 next = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
527 while ((next) && (next->delete_me))
528 next = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
530 else next = elm_genlist_item_next_get(wd->last_selected_item);
532 if (!next) return EINA_FALSE;
534 _deselect_all_items(wd);
536 elm_genlist_item_selected_set(next, EINA_TRUE);
537 elm_genlist_item_show(next);
542 _on_focus_hook(void *data __UNUSED__,
545 Widget_Data *wd = elm_widget_data_get(obj);
547 if (elm_widget_focus_get(obj))
549 elm_object_signal_emit(wd->obj, "elm,action,focus", "elm");
550 evas_object_focus_set(wd->obj, EINA_TRUE);
551 if ((wd->selected) && (!wd->last_selected_item))
552 wd->last_selected_item = eina_list_data_get(wd->selected);
556 elm_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
557 evas_object_focus_set(wd->obj, EINA_FALSE);
562 _del_hook(Evas_Object *obj)
564 Widget_Data *wd = elm_widget_data_get(obj);
566 _item_cache_zero(wd);
567 if (wd->calc_job) ecore_job_del(wd->calc_job);
568 if (wd->update_job) ecore_job_del(wd->update_job);
569 if (wd->queue_idle_enterer) ecore_idle_enterer_del(wd->queue_idle_enterer);
570 if (wd->changed_job) ecore_job_del(wd->changed_job);
571 if (wd->must_recalc_idler) ecore_idler_del(wd->must_recalc_idler);
572 if (wd->multi_timer) ecore_timer_del(wd->multi_timer);
573 if (wd->mode_type) eina_stringshare_del(wd->mode_type);
574 if (wd->scr_hold_timer) ecore_timer_del(wd->scr_hold_timer);
578 elm_genlist_clear(obj);
584 _del_pre_hook(Evas_Object *obj)
586 Widget_Data *wd = elm_widget_data_get(obj);
588 if (wd->edit_mode) elm_genlist_edit_mode_set(wd->obj, EINA_FALSE);
589 evas_object_del(wd->pan_smart);
590 wd->pan_smart = NULL;
591 elm_genlist_clear(obj);
595 _mirrored_set(Evas_Object *obj,
598 Widget_Data *wd = elm_widget_data_get(obj);
600 _item_cache_zero(wd);
601 elm_smart_scroller_mirrored_set(wd->scr, rtl);
605 _theme_hook(Evas_Object *obj)
607 Widget_Data *wd = elm_widget_data_get(obj);
610 evas_event_freeze(evas_object_evas_get(wd->obj));
611 _item_cache_zero(wd);
612 _elm_widget_mirrored_reload(obj);
613 _mirrored_set(obj, elm_widget_mirrored_get(obj));
614 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
615 elm_widget_style_get(obj));
616 // edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
617 wd->item_width = wd->item_height = 0;
618 wd->group_item_width = wd->group_item_height = 0;
619 wd->minw = wd->minh = wd->realminw = 0;
620 EINA_INLIST_FOREACH(wd->blocks, itb)
623 Elm_Genlist_Item *it;
625 if (itb->realized) _item_block_unrealize(itb);
626 EINA_LIST_FOREACH(itb->items, l, it)
627 it->mincalcd = EINA_FALSE;
629 itb->changed = EINA_TRUE;
631 if (wd->calc_job) ecore_job_del(wd->calc_job);
632 wd->calc_job = ecore_job_add(_calc_job, wd);
634 evas_event_thaw(evas_object_evas_get(wd->obj));
635 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
639 _show_region_hook(void *data,
642 Widget_Data *wd = elm_widget_data_get(data);
643 Evas_Coord x, y, w, h;
645 elm_widget_show_region_get(obj, &x, &y, &w, &h);
646 //x & y are screen coordinates, Add with pan coordinates
649 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
653 _sizing_eval(Evas_Object *obj)
655 Widget_Data *wd = elm_widget_data_get(obj);
656 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
658 evas_object_size_hint_min_get(wd->scr, &minw, &minh);
659 evas_object_size_hint_max_get(wd->scr, &maxw, &maxh);
661 if (wd->height_for_width)
665 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
666 if ((vw != 0) && (vw != wd->prev_viewport_w))
670 wd->prev_viewport_w = vw;
671 EINA_INLIST_FOREACH(wd->blocks, itb)
673 itb->must_recalc = EINA_TRUE;
675 if (wd->calc_job) ecore_job_del(wd->calc_job);
676 wd->calc_job = ecore_job_add(_calc_job, wd);
679 if (wd->mode == ELM_LIST_LIMIT)
681 Evas_Coord vmw, vmh, vw, vh;
685 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
686 if ((minw > 0) && (vw < minw)) vw = minw;
687 else if ((maxw > 0) && (vw > maxw))
689 edje_object_size_min_calc
690 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
697 edje_object_size_min_calc
698 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
702 evas_object_size_hint_min_set(obj, minw, minh);
703 evas_object_size_hint_max_set(obj, maxw, maxh);
707 _signal_emit_hook(Evas_Object *obj,
708 const char *emission,
711 Widget_Data *wd = elm_widget_data_get(obj);
712 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
717 _item_highlight(Elm_Genlist_Item *it)
719 const char *selectraise;
720 if ((it->wd->no_select) || (it->delete_me) || (it->highlighted) ||
721 (it->disabled) || (it->display_only) || (it->mode_view))
723 edje_object_signal_emit(it->base.view, "elm,state,selected", "elm");
724 if (it->edit_obj) edje_object_signal_emit(it->edit_obj, "elm,state,selected", "elm");
725 selectraise = edje_object_data_get(it->base.view, "selectraise");
726 if ((selectraise) && (!strcmp(selectraise, "on")))
728 if (it->edit_obj) evas_object_raise(it->edit_obj);
729 else evas_object_raise(it->base.view);
730 if ((it->group_item) && (it->group_item->realized))
731 evas_object_raise(it->group_item->base.view);
733 it->highlighted = EINA_TRUE;
737 _item_block_del(Elm_Genlist_Item *it)
740 Item_Block *itb = it->block;
742 itb->items = eina_list_remove(itb->items, it);
744 itb->changed = EINA_TRUE;
745 if (!it->wd->reorder_deleted)
747 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
748 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
752 il = EINA_INLIST_GET(itb);
753 Item_Block *itbn = (Item_Block *)(il->next);
755 it->parent->items = eina_list_remove(it->parent->items, it);
757 it->wd->blocks = eina_inlist_remove(it->wd->blocks, il);
759 if (itbn) itbn->changed = EINA_TRUE;
763 if (itb->count < itb->wd->max_items_per_block/2)
765 il = EINA_INLIST_GET(itb);
766 Item_Block *itbp = (Item_Block *)(il->prev);
767 Item_Block *itbn = (Item_Block *)(il->next);
768 if ((itbp) && ((itbp->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
770 Elm_Genlist_Item *it2;
772 EINA_LIST_FREE(itb->items, it2)
775 itbp->items = eina_list_append(itbp->items, it2);
777 itbp->changed = EINA_TRUE;
779 it->wd->blocks = eina_inlist_remove(it->wd->blocks,
780 EINA_INLIST_GET(itb));
783 else if ((itbn) && ((itbn->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
787 Eina_List *last = eina_list_last(itb->items);
788 Elm_Genlist_Item *it2 = last->data;
791 itb->items = eina_list_remove_list(itb->items, last);
792 itbn->items = eina_list_prepend(itbn->items, it2);
794 itbn->changed = EINA_TRUE;
797 eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb));
805 _item_subitems_clear(Elm_Genlist_Item *it)
808 Eina_List *tl = NULL, *l;
809 Elm_Genlist_Item *it2;
811 EINA_LIST_FOREACH(it->items, l, it2)
812 tl = eina_list_append(tl, it2);
814 EINA_LIST_FREE(tl, it2)
815 elm_genlist_item_del(it2);
819 _item_del(Elm_Genlist_Item *it)
821 Evas_Object *tob = it->wd->obj;
823 evas_event_freeze(evas_object_evas_get(tob));
824 elm_widget_item_pre_notify_del(it);
825 elm_genlist_item_subitems_clear(it);
826 it->wd->walking -= it->walking;
827 if (it->wd->show_item == it) it->wd->show_item = NULL;
828 if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it);
829 if (it->realized) _item_unrealize(it, EINA_FALSE);
830 if (it->effect_item_realized) _effect_item_unrealize(it);
831 if (it->block) _item_block_del(it);
832 if ((!it->delete_me) && (it->itc->func.del))
833 it->itc->func.del((void *)it->base.data, it->base.widget);
834 it->delete_me = EINA_TRUE;
836 it->wd->queue = eina_list_remove(it->wd->queue, it);
838 if (it->wd->anchor_item == it)
840 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
841 if (!it->wd->anchor_item)
842 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
845 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
847 it->parent->items = eina_list_remove(it->parent->items, it);
848 if (it->flags & ELM_GENLIST_ITEM_GROUP)
849 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
850 if (it->long_timer) ecore_timer_del(it->long_timer);
851 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
853 if (it->tooltip.del_cb)
854 it->tooltip.del_cb((void *)it->tooltip.data, it->base.widget, it);
856 evas_event_thaw(evas_object_evas_get(tob));
857 evas_event_thaw_eval(evas_object_evas_get(tob));
859 elm_widget_item_del(it);
863 _item_select(Elm_Genlist_Item *it)
865 if ((it->wd->no_select) || (it->delete_me) || (it->mode_view)) return;
868 if (it->wd->always_select) goto call;
871 it->selected = EINA_TRUE;
872 it->wd->selected = eina_list_append(it->wd->selected, it);
878 Evas_Object *baseobj = it->base.widget;
879 const char *objtype = NULL;
880 it->func.func((void *)it->func.data, it->base.widget, it);
881 objtype = evas_object_type_get(baseobj);
882 if ((!objtype) || (!strcmp(objtype,""))) return;
885 evas_object_smart_callback_call(it->base.widget, SIG_SELECTED, it);
888 if ((it->wd->clear_me) && (!it->wd->walking))
890 elm_genlist_clear(it->base.widget);
895 if ((!it->walking) && (it->delete_me))
897 if (!it->relcount) _item_del(it);
900 if (it && it->wd) it->wd->last_selected_item = it; // TODO: Remove 'if'?
904 _item_unselect(Elm_Genlist_Item *it)
906 const char *stacking, *selectraise;
908 if ((it->delete_me) || (!it->highlighted)) return;
909 edje_object_signal_emit(it->base.view, "elm,state,unselected", "elm");
910 if (it->edit_obj) edje_object_signal_emit(it->edit_obj, "elm,state,unselected", "elm");
911 stacking = edje_object_data_get(it->base.view, "stacking");
912 selectraise = edje_object_data_get(it->base.view, "selectraise");
913 if ((selectraise) && (!strcmp(selectraise, "on")))
915 if ((stacking) && (!strcmp(stacking, "below")))
916 evas_object_lower(it->base.view);
918 it->highlighted = EINA_FALSE;
921 it->selected = EINA_FALSE;
922 it->wd->selected = eina_list_remove(it->wd->selected, it);
923 evas_object_smart_callback_call(it->base.widget, SIG_UNSELECTED, it);
928 _mouse_move(void *data,
929 Evas *evas __UNUSED__,
933 Elm_Genlist_Item *it = data;
934 Evas_Event_Mouse_Move *ev = event_info;
935 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
937 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
939 if (!it->wd->on_hold)
941 it->wd->on_hold = EINA_TRUE;
942 if (!it->wd->wasselected)
946 if (it->wd->multitouched)
948 it->wd->cur_x = ev->cur.canvas.x;
949 it->wd->cur_y = ev->cur.canvas.y;
952 if ((it->dragging) && (it->down))
954 if (it->wd->movements == SWIPE_MOVES) it->wd->swipe = EINA_TRUE;
957 it->wd->history[it->wd->movements].x = ev->cur.canvas.x;
958 it->wd->history[it->wd->movements].y = ev->cur.canvas.y;
959 if (abs((it->wd->history[it->wd->movements].x -
960 it->wd->history[0].x)) > 40)
961 it->wd->swipe = EINA_TRUE;
967 ecore_timer_del(it->long_timer);
968 it->long_timer = NULL;
970 evas_object_smart_callback_call(it->base.widget, SIG_DRAG, it);
973 if ((!it->down) /* || (it->wd->on_hold)*/ || (it->wd->longpressed))
977 ecore_timer_del(it->long_timer);
978 it->long_timer = NULL;
980 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
982 Evas_Coord ox,oy,oh,ow;
983 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
984 int it_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
985 if (!it->wd->reorder_start_y) it->wd->reorder_start_y = it->block->y + it->y;
987 if (it_y < oy) _effect_item_controls(it, it->scrl_x, oy);
988 else if (it_y + it->wd->reorder_it->h > oy+oh) _effect_item_controls(it, it->scrl_x, oy + oh - it->wd->reorder_it->h);
989 else _effect_item_controls(it, it->scrl_x, it_y);
991 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
992 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
996 if (!it->display_only)
997 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
998 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
999 x = ev->cur.canvas.x - x;
1000 y = ev->cur.canvas.y - y;
1003 if (adx < 0) adx = -dx;
1006 if (ady < 0) ady = -dy;
1009 if ((adx > minw) || (ady > minh))
1011 it->dragging = EINA_TRUE;
1012 it->wd->dragging_queue = eina_list_append(it->wd->dragging_queue, it);
1015 ecore_timer_del(it->long_timer);
1016 it->long_timer = NULL;
1018 if (!it->wd->wasselected)
1023 evas_object_smart_callback_call(it->base.widget,
1024 SIG_DRAG_START_UP, it);
1028 evas_object_smart_callback_call(it->base.widget,
1029 SIG_DRAG_START_LEFT, it);
1031 evas_object_smart_callback_call(it->base.widget,
1032 SIG_DRAG_START_RIGHT, it);
1038 evas_object_smart_callback_call(it->base.widget,
1039 SIG_DRAG_START_DOWN, it);
1043 evas_object_smart_callback_call(it->base.widget,
1044 SIG_DRAG_START_LEFT, it);
1046 evas_object_smart_callback_call(it->base.widget,
1047 SIG_DRAG_START_RIGHT, it);
1054 _long_press(void *data)
1056 Elm_Genlist_Item *it = data;
1057 Elm_Genlist_Item *it_tmp;
1058 static Eina_Bool done = EINA_FALSE;
1059 //static Eina_Bool contracted = EINA_FALSE;
1063 it->long_timer = NULL;
1064 if ((it->disabled) || (it->dragging) || (it->display_only) || (it->wd->rename_it))
1065 return ECORE_CALLBACK_CANCEL;
1066 it->wd->longpressed = EINA_TRUE;
1067 evas_object_smart_callback_call(it->base.widget, SIG_LONGPRESSED, it);
1068 if ((it->wd->reorder_mode) && (it->flags != ELM_GENLIST_ITEM_GROUP))
1070 it->wd->reorder_it = it;
1071 it->wd->reorder_start_y = 0;
1072 evas_object_raise(it->edit_obj);
1073 elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
1074 edje_object_signal_emit(it->edit_obj, "elm,action,item,reorder_start", "elm");
1076 EINA_INLIST_FOREACH(it->wd->blocks, itb)
1081 EINA_LIST_FOREACH(itb->items, l, it_tmp)
1083 if (it_tmp->flags != ELM_GENLIST_ITEM_GROUP && it_tmp->realized)
1085 _item_unselect(it_tmp);
1097 EINA_LIST_FOREACH(it->items, l, it_tmp)
1099 if (elm_genlist_item_expanded_get(it_tmp))
1101 elm_genlist_item_expanded_set(it_tmp, EINA_FALSE);
1102 return ECORE_CALLBACK_RENEW;
1106 if (elm_genlist_item_expanded_get(it)) {
1107 elm_genlist_item_expanded_set(it, EINA_FALSE);
1108 return ECORE_CALLBACK_RENEW;
1112 return ECORE_CALLBACK_CANCEL;
1116 _swipe(Elm_Genlist_Item *it)
1121 if ((it->display_only) || (it->disabled)) return;
1122 it->wd->swipe = EINA_FALSE;
1123 for (i = 0; i < it->wd->movements; i++)
1125 sum += it->wd->history[i].x;
1126 if (abs(it->wd->history[0].y - it->wd->history[i].y) > 10) return;
1129 sum /= it->wd->movements;
1130 if (abs(sum - it->wd->history[0].x) <= 10) return;
1131 evas_object_smart_callback_call(it->base.widget, SIG_SWIPE, it);
1135 _swipe_cancel(void *data)
1137 Elm_Genlist_Item *it = data;
1139 if (!it) return ECORE_CALLBACK_CANCEL;
1140 it->wd->swipe = EINA_FALSE;
1141 it->wd->movements = 0;
1142 return ECORE_CALLBACK_RENEW;
1146 _multi_cancel(void *data)
1148 Widget_Data *wd = data;
1150 if (!wd) return ECORE_CALLBACK_CANCEL;
1151 wd->multi_timeout = EINA_TRUE;
1152 return ECORE_CALLBACK_RENEW;
1156 _multi_touch_gesture_eval(void *data)
1158 Elm_Genlist_Item *it = data;
1160 it->wd->multitouched = EINA_FALSE;
1161 if (it->wd->multi_timer)
1163 ecore_timer_del(it->wd->multi_timer);
1164 it->wd->multi_timer = NULL;
1166 if (it->wd->multi_timeout)
1168 it->wd->multi_timeout = EINA_FALSE;
1172 Evas_Coord minw = 0, minh = 0;
1173 Evas_Coord off_x, off_y, off_mx, off_my;
1175 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1176 off_x = abs(it->wd->cur_x - it->wd->prev_x);
1177 off_y = abs(it->wd->cur_y - it->wd->prev_y);
1178 off_mx = abs(it->wd->cur_mx - it->wd->prev_mx);
1179 off_my = abs(it->wd->cur_my - it->wd->prev_my);
1181 if (((off_x > minw) || (off_y > minh)) && ((off_mx > minw) || (off_my > minh)))
1183 if ((off_x + off_mx) > (off_y + off_my))
1185 if ((it->wd->cur_x > it->wd->prev_x) && (it->wd->cur_mx > it->wd->prev_mx))
1186 evas_object_smart_callback_call(it->base.widget,
1187 SIG_MULTI_SWIPE_RIGHT, it);
1188 else if ((it->wd->cur_x < it->wd->prev_x) && (it->wd->cur_mx < it->wd->prev_mx))
1189 evas_object_smart_callback_call(it->base.widget,
1190 SIG_MULTI_SWIPE_LEFT, it);
1191 else if (abs(it->wd->cur_x - it->wd->cur_mx) > abs(it->wd->prev_x - it->wd->prev_mx))
1192 evas_object_smart_callback_call(it->base.widget,
1193 SIG_MULTI_PINCH_OUT, it);
1195 evas_object_smart_callback_call(it->base.widget,
1196 SIG_MULTI_PINCH_IN, it);
1200 if ((it->wd->cur_y > it->wd->prev_y) && (it->wd->cur_my > it->wd->prev_my))
1201 evas_object_smart_callback_call(it->base.widget,
1202 SIG_MULTI_SWIPE_DOWN, it);
1203 else if ((it->wd->cur_y < it->wd->prev_y) && (it->wd->cur_my < it->wd->prev_my))
1204 evas_object_smart_callback_call(it->base.widget,
1205 SIG_MULTI_SWIPE_UP, it);
1206 else if (abs(it->wd->cur_y - it->wd->cur_my) > abs(it->wd->prev_y - it->wd->prev_my))
1207 evas_object_smart_callback_call(it->base.widget,
1208 SIG_MULTI_PINCH_OUT, it);
1210 evas_object_smart_callback_call(it->base.widget,
1211 SIG_MULTI_PINCH_IN, it);
1214 it->wd->multi_timeout = EINA_FALSE;
1218 _multi_down(void *data,
1219 Evas *evas __UNUSED__,
1220 Evas_Object *obj __UNUSED__,
1223 Elm_Genlist_Item *it = data;
1224 Evas_Event_Multi_Down *ev = event_info;
1226 if ((it->wd->multi_device != 0) || (it->wd->multitouched) || (it->wd->multi_timeout)) return;
1227 it->wd->multi_device = ev->device;
1228 it->wd->multi_down = EINA_TRUE;
1229 it->wd->multitouched = EINA_TRUE;
1230 it->wd->prev_mx = ev->canvas.x;
1231 it->wd->prev_my = ev->canvas.y;
1232 if (!it->wd->wasselected) _item_unselect(it);
1233 it->wd->wasselected = EINA_FALSE;
1234 it->wd->longpressed = EINA_FALSE;
1237 ecore_timer_del(it->long_timer);
1238 it->long_timer = NULL;
1242 it->dragging = EINA_FALSE;
1243 evas_object_smart_callback_call(it->base.widget, SIG_DRAG_STOP, it);
1245 if (it->swipe_timer)
1247 ecore_timer_del(it->swipe_timer);
1248 it->swipe_timer = NULL;
1250 if (it->wd->on_hold)
1252 it->wd->swipe = EINA_FALSE;
1253 it->wd->movements = 0;
1254 it->wd->on_hold = EINA_FALSE;
1259 _multi_up(void *data,
1260 Evas *evas __UNUSED__,
1261 Evas_Object *obj __UNUSED__,
1264 Elm_Genlist_Item *it = data;
1265 Evas_Event_Multi_Up *ev = event_info;
1267 if (it->wd->multi_device != ev->device) return;
1268 it->wd->multi_device = 0;
1269 it->wd->multi_down = EINA_FALSE;
1270 if (it->wd->mouse_down) return;
1271 _multi_touch_gesture_eval(data);
1275 _multi_move(void *data,
1276 Evas *evas __UNUSED__,
1277 Evas_Object *obj __UNUSED__,
1280 Elm_Genlist_Item *it = data;
1281 Evas_Event_Multi_Move *ev = event_info;
1283 if (it->wd->multi_device != ev->device) return;
1284 it->wd->cur_mx = ev->cur.canvas.x;
1285 it->wd->cur_my = ev->cur.canvas.y;
1289 _mouse_down(void *data,
1290 Evas *evas __UNUSED__,
1294 Elm_Genlist_Item *it = data;
1295 Evas_Event_Mouse_Down *ev = event_info;
1298 if (ev->button != 1) return;
1299 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1301 it->wd->on_hold = EINA_TRUE;
1303 it->down = EINA_TRUE;
1304 it->dragging = EINA_FALSE;
1305 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1306 it->dx = ev->canvas.x - x;
1307 it->dy = ev->canvas.y - y;
1308 it->wd->mouse_down = EINA_TRUE;
1309 if (!it->wd->multitouched)
1311 it->wd->prev_x = ev->canvas.x;
1312 it->wd->prev_y = ev->canvas.y;
1313 it->wd->multi_timeout = EINA_FALSE;
1314 if (it->wd->multi_timer) ecore_timer_del(it->wd->multi_timer);
1315 it->wd->multi_timer = ecore_timer_add(1, _multi_cancel, it->wd);
1317 it->wd->longpressed = EINA_FALSE;
1318 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1319 else it->wd->on_hold = EINA_FALSE;
1320 if (it->wd->on_hold) return;
1321 it->wd->wasselected = it->selected;
1322 _item_highlight(it);
1323 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
1324 if ((!it->disabled) && (!it->display_only))
1326 evas_object_smart_callback_call(it->base.widget, SIG_CLICKED_DOUBLE, it);
1327 evas_object_smart_callback_call(it->base.widget, SIG_ACTIVATED, it);
1329 if (it->long_timer) ecore_timer_del(it->long_timer);
1330 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
1331 it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
1333 it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press,
1336 it->long_timer = NULL;
1337 it->wd->swipe = EINA_FALSE;
1338 it->wd->movements = 0;
1342 _mouse_up(void *data,
1343 Evas *evas __UNUSED__,
1344 Evas_Object *obj __UNUSED__,
1347 Elm_Genlist_Item *it = data;
1348 Evas_Event_Mouse_Up *ev = event_info;
1349 Eina_Bool dragged = EINA_FALSE;
1351 if (ev->button != 1) return;
1352 it->down = EINA_FALSE;
1353 it->wd->mouse_down = EINA_FALSE;
1354 if (it->wd->multitouched)
1356 // in single selection modes, some multi touching can make multi highlighted items.
1357 // if a item not selected and highlighted, it should be unhighlighted.
1358 if ((!it->wd->multi) && (!it->selected) && (it->highlighted)) _item_unselect(it);
1359 if (it->wd->multi_down) return;
1360 _multi_touch_gesture_eval(data);
1363 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1364 else it->wd->on_hold = EINA_FALSE;
1367 ecore_timer_del(it->long_timer);
1368 it->long_timer = NULL;
1370 while (it->wd->dragging_queue)
1372 Elm_Genlist_Item *dragging_it = NULL;
1373 dragging_it = eina_list_data_get(it->wd->dragging_queue);
1374 dragging_it->dragging = EINA_FALSE;
1375 evas_object_smart_callback_call(dragging_it->base.widget, SIG_DRAG_STOP, dragging_it);
1376 if (dragging_it->want_unrealize)
1378 _item_unrealize(dragging_it, EINA_FALSE);
1379 if (dragging_it->block->want_unrealize)
1380 _item_block_unrealize(it->block);
1382 it->wd->dragging_queue = eina_list_remove_list(it->wd->dragging_queue,it->wd->dragging_queue);
1385 if (it->swipe_timer)
1387 ecore_timer_del(it->swipe_timer);
1388 it->swipe_timer = NULL;
1390 if (it->wd->multi_timer)
1392 ecore_timer_del(it->wd->multi_timer);
1393 it->wd->multi_timer = NULL;
1394 it->wd->multi_timeout = EINA_FALSE;
1396 if (it->wd->on_hold)
1398 if (it->wd->swipe) _swipe(data);
1399 it->wd->longpressed = EINA_FALSE;
1400 it->wd->on_hold = EINA_FALSE;
1403 if (it->wd->reorder_mode)
1405 Evas_Coord rox, roy, row, roh;
1406 Elm_Genlist_Item *reorder_it = it->wd->reorder_it;
1409 Evas_Coord ox,oy,oh,ow;
1410 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
1411 evas_object_geometry_get(it->wd->reorder_it->base.view, &rox, &roy, &row, &roh);
1412 if (it->wd->reorder_rel)
1414 if (it->wd->reorder_it->parent == it->wd->reorder_rel->parent) // todo : refactoring
1416 if (roy + oy <= it->wd->reorder_rel->scrl_y)
1417 _effect_item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
1419 _effect_item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
1422 it->wd->reorder_deleted = EINA_FALSE;
1423 it->wd->reorder_it = it->wd->reorder_rel = NULL;
1424 elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
1425 edje_object_signal_emit(it->edit_obj, "elm,action,item,reorder_end", "elm");
1428 if (it->wd->longpressed)
1430 it->wd->longpressed = EINA_FALSE;
1431 if (!it->wd->wasselected)
1433 it->wd->wasselected = EINA_FALSE;
1436 if ((it->disabled) || (dragged) || (it->display_only)) return;
1437 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1442 _item_highlight(it);
1445 else _item_unselect(it);
1451 Widget_Data *wd = it->wd;
1454 while (wd->selected) _item_unselect(wd->selected->data);
1459 const Eina_List *l, *l_next;
1460 Elm_Genlist_Item *it2;
1462 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
1463 if (it2 != it) _item_unselect(it2);
1464 //_item_highlight(it);
1467 _item_highlight(it);
1473 _signal_expand_toggle(void *data,
1474 Evas_Object *obj __UNUSED__,
1475 const char *emission __UNUSED__,
1476 const char *source __UNUSED__)
1478 Elm_Genlist_Item *it = data;
1481 evas_object_smart_callback_call(it->base.widget, SIG_CONTRACT_REQUEST, it);
1483 evas_object_smart_callback_call(it->base.widget, SIG_EXPAND_REQUEST, it);
1487 _signal_expand(void *data,
1488 Evas_Object *obj __UNUSED__,
1489 const char *emission __UNUSED__,
1490 const char *source __UNUSED__)
1492 Elm_Genlist_Item *it = data;
1495 evas_object_smart_callback_call(it->base.widget, SIG_EXPAND_REQUEST, it);
1499 _signal_contract(void *data,
1500 Evas_Object *obj __UNUSED__,
1501 const char *emission __UNUSED__,
1502 const char *source __UNUSED__)
1504 Elm_Genlist_Item *it = data;
1507 evas_object_smart_callback_call(it->base.widget, SIG_CONTRACT_REQUEST, it);
1511 _scr_hold_timer_cb(void *data)
1513 if (!data) return ECORE_CALLBACK_CANCEL;
1514 Widget_Data *wd = data;
1515 elm_smart_scroller_hold_set(wd->scr, EINA_FALSE);
1516 wd->scr_hold_timer = NULL;
1517 return ECORE_CALLBACK_CANCEL;
1521 _mode_finished_signal_cb(void *data,
1523 const char *emission __UNUSED__,
1524 const char *source __UNUSED__)
1528 Elm_Genlist_Item *it = data;
1529 if ((it->delete_me) || (!it->realized) || (!it->mode_view)) return;
1531 Evas *te = evas_object_evas_get(obj);
1533 evas_event_freeze(te);
1534 it->nocache = EINA_FALSE;
1535 _mode_item_unrealize(it);
1536 snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished", it->wd->mode_type);
1537 edje_object_signal_callback_del_full(obj, buf, "elm", _mode_finished_signal_cb, it);
1538 evas_event_thaw(te);
1539 evas_event_thaw_eval(te);
1543 _item_cache_clean(Widget_Data *wd)
1545 evas_event_freeze(evas_object_evas_get(wd->obj));
1546 while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max))
1550 itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache);
1551 wd->item_cache = eina_inlist_remove(wd->item_cache,
1552 wd->item_cache->last);
1553 wd->item_cache_count--;
1554 if (itc->spacer) evas_object_del(itc->spacer);
1555 if (itc->base_view) evas_object_del(itc->base_view);
1556 if (itc->item_style) eina_stringshare_del(itc->item_style);
1559 evas_event_thaw(evas_object_evas_get(wd->obj));
1560 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
1564 _item_cache_zero(Widget_Data *wd)
1566 int pmax = wd->item_cache_max;
1567 wd->item_cache_max = 0;
1568 _item_cache_clean(wd);
1569 wd->item_cache_max = pmax;
1573 _item_cache_add(Elm_Genlist_Item *it)
1577 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1578 if (it->wd->item_cache_max <= 0)
1580 evas_object_del(it->base.view);
1581 it->base.view = NULL;
1582 evas_object_del(it->spacer);
1584 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1585 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1589 it->wd->item_cache_count++;
1590 itc = calloc(1, sizeof(Item_Cache));
1593 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1594 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1597 it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache,
1598 EINA_INLIST_GET(itc));
1599 itc->spacer = it->spacer;
1601 itc->base_view = it->base.view;
1602 it->base.view = NULL;
1603 evas_object_hide(itc->base_view);
1604 evas_object_move(itc->base_view, -9999, -9999);
1605 itc->item_style = eina_stringshare_add(it->itc->item_style);
1606 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
1607 itc->compress = (it->wd->compress);
1608 itc->odd = (it->order_num_in & 0x1);
1609 itc->selected = it->selected;
1610 itc->disabled = it->disabled;
1611 itc->expanded = it->expanded;
1614 ecore_timer_del(it->long_timer);
1615 it->long_timer = NULL;
1617 if (it->swipe_timer)
1619 ecore_timer_del(it->swipe_timer);
1620 it->swipe_timer = NULL;
1622 // FIXME: other callbacks?
1623 edje_object_signal_callback_del_full(itc->base_view,
1624 "elm,action,expand,toggle",
1625 "elm", _signal_expand_toggle, it);
1626 edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand",
1628 _signal_expand, it);
1629 edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract",
1630 "elm", _signal_contract, it);
1631 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_DOWN,
1633 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP,
1635 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_MOVE,
1637 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_DOWN,
1639 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_UP,
1641 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_MOVE,
1643 _item_cache_clean(it->wd);
1644 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1645 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1649 _item_cache_find(Elm_Genlist_Item *it)
1652 Eina_Bool tree = 0, odd;
1654 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
1655 odd = (it->order_num_in & 0x1);
1656 EINA_INLIST_FOREACH(it->wd->item_cache, itc)
1658 if ((itc->selected) || (itc->disabled) || (itc->expanded))
1660 if ((itc->tree == tree) &&
1661 (itc->odd == odd) &&
1662 (itc->compress == it->wd->compress) &&
1663 (!strcmp(it->itc->item_style, itc->item_style)))
1665 it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
1666 EINA_INLIST_GET(itc));
1667 it->wd->item_cache_count--;
1675 _item_cache_free(Item_Cache *itc)
1677 if (itc->spacer) evas_object_del(itc->spacer);
1678 if (itc->base_view) evas_object_del(itc->base_view);
1679 if (itc->item_style) eina_stringshare_del(itc->item_style);
1684 _item_realize(Elm_Genlist_Item *it,
1688 Elm_Genlist_Item *it2;
1689 const char *stacking;
1690 const char *treesize;
1692 int depth, tsize = 20;
1693 Item_Cache *itc = NULL;
1695 if ((it->realized) || (it->delete_me)) return;
1696 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1697 it->order_num_in = in;
1698 if (it->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE) calc = EINA_FALSE;
1699 if ((it->nocache) && (!it->renamed))
1700 it->nocache = EINA_FALSE;
1702 itc = _item_cache_find(it);
1703 if (itc && (!it->wd->effect_mode))
1705 it->base.view = itc->base_view;
1706 itc->base_view = NULL;
1707 it->spacer = itc->spacer;
1712 it->base.view = edje_object_add(evas_object_evas_get(it->base.widget));
1713 edje_object_scale_set(it->base.view,
1714 elm_widget_scale_get(it->base.widget) *
1715 _elm_config->scale);
1716 evas_object_smart_member_add(it->base.view, it->wd->pan_smart);
1717 elm_widget_sub_object_add(it->base.widget, it->base.view);
1719 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS)
1720 strncpy(buf, "tree", sizeof(buf));
1721 else strncpy(buf, "item", sizeof(buf));
1722 if (it->wd->compress)
1723 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
1725 if (in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
1726 strncat(buf, "/", sizeof(buf) - strlen(buf));
1727 strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf));
1729 _elm_theme_object_set(it->base.widget, it->base.view, "genlist", buf,
1730 elm_widget_style_get(it->base.widget));
1731 edje_object_mirrored_set(it->base.view,
1732 elm_widget_mirrored_get(it->base.widget));
1734 evas_object_rectangle_add(evas_object_evas_get(it->base.widget));
1735 evas_object_color_set(it->spacer, 0, 0, 0, 0);
1736 elm_widget_sub_object_add(it->base.widget, it->spacer);
1738 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
1740 if (it2->parent->flags != ELM_GENLIST_ITEM_GROUP) depth += 1;
1742 it->expanded_depth = depth;
1743 treesize = edje_object_data_get(it->base.view, "treesize");
1744 if (treesize) tsize = atoi(treesize);
1745 evas_object_size_hint_min_set(it->spacer,
1746 (depth * tsize) * _elm_config->scale, 1);
1747 edje_object_part_swallow(it->base.view, "elm.swallow.pad", it->spacer);
1750 edje_object_signal_callback_add(it->base.view,
1751 "elm,action,expand,toggle",
1752 "elm", _signal_expand_toggle, it);
1753 edje_object_signal_callback_add(it->base.view, "elm,action,expand",
1754 "elm", _signal_expand, it);
1755 edje_object_signal_callback_add(it->base.view, "elm,action,contract",
1756 "elm", _signal_contract, it);
1757 stacking = edje_object_data_get(it->base.view, "stacking");
1760 if (!strcmp(stacking, "below")) evas_object_lower(it->base.view);
1761 else if (!strcmp(stacking, "above"))
1762 evas_object_raise(it->base.view);
1764 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_DOWN,
1766 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_UP,
1768 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_MOVE,
1770 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_DOWN,
1772 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_UP,
1774 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_MOVE,
1777 if ((!it->edit_obj) &&(it->wd->edit_mode) &&
1778 (it->flags != ELM_GENLIST_ITEM_GROUP) && (it->itc->edit_item_style))
1779 _effect_item_realize(it, EINA_FALSE);
1783 if ((it->selected) && (it->selected != itc->selected))
1785 edje_object_signal_emit(it->base.view,
1786 "elm,state,selected", "elm");
1788 edje_object_signal_emit(it->edit_obj,
1789 "elm,state,selected", "elm");
1791 if ((it->disabled) && (it->disabled != itc->disabled))
1793 edje_object_signal_emit(it->base.view,
1794 "elm,state,disabled", "elm");
1796 edje_object_signal_emit(it->edit_obj,
1797 "elm,state,disabled", "elm");
1799 if ((it->expanded) && (it->expanded != itc->expanded))
1801 edje_object_signal_emit(it->base.view,
1802 "elm,state,expanded", "elm");
1804 edje_object_signal_emit(it->edit_obj,
1805 "elm,state,expanded", "elm");
1812 edje_object_signal_emit(it->base.view,
1813 "elm,state,selected", "elm");
1815 edje_object_signal_emit(it->edit_obj,
1816 "elm,state,selected", "elm");
1820 edje_object_signal_emit(it->base.view,
1821 "elm,state,disabled", "elm");
1823 edje_object_signal_emit(it->edit_obj,
1824 "elm,state,disabled", "elm");
1828 edje_object_signal_emit(it->base.view,
1829 "elm,state,expanded", "elm");
1831 edje_object_signal_emit(it->edit_obj,
1832 "elm,state,expanded", "elm");
1837 if ((calc) && (it->wd->homogeneous) &&
1838 ((it->wd->item_width) ||
1839 ((it->wd->item_width) && (it->wd->group_item_width))))
1841 /* homogenous genlist shortcut */
1844 if (it->flags & ELM_GENLIST_ITEM_GROUP)
1846 it->w = it->minw = it->wd->group_item_width;
1847 it->h = it->minh = it->wd->group_item_height;
1851 it->w = it->minw = it->wd->item_width;
1852 it->h = it->minh = it->wd->item_height;
1854 it->mincalcd = EINA_TRUE;
1859 if (it->itc->func.label_get)
1865 elm_widget_stringlist_get(edje_object_data_get(it->base.view,
1867 EINA_LIST_FOREACH(it->labels, l, key)
1869 char *s = it->itc->func.label_get
1870 ((void *)it->base.data, it->base.widget, l->data);
1874 edje_object_part_text_set(it->base.view, l->data, s);
1878 edje_object_part_text_set(it->base.view, l->data, "");
1881 if (it->itc->func.icon_get)
1887 elm_widget_stringlist_get(edje_object_data_get(it->base.view,
1889 EINA_LIST_FOREACH(it->icons, l, key)
1891 Evas_Object *ic = it->itc->func.icon_get
1892 ((void *)it->base.data, it->base.widget, l->data);
1896 it->icon_objs = eina_list_append(it->icon_objs, ic);
1897 edje_object_part_swallow(it->base.view, key, ic);
1898 evas_object_show(ic);
1899 elm_widget_sub_object_add(it->base.widget, ic);
1900 evas_object_event_callback_add(ic, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, it);
1902 elm_widget_disabled_set(ic, EINA_TRUE);
1908 elm_widget_stringlist_get(edje_object_data_get(it->base.view, "renames"));
1909 EINA_LIST_FOREACH(it->icons, l, key)
1911 Evas_Object *ic = it->itc->func.icon_get
1912 ((void *)it->base.data, it->base.widget, l->data);
1915 it->icon_objs = eina_list_append(it->icon_objs, ic);
1916 edje_object_part_swallow(it->base.view, key, ic);
1917 evas_object_show(ic);
1918 elm_widget_sub_object_add(it->base.widget, ic);
1923 if (it->itc->func.state_get)
1929 elm_widget_stringlist_get(edje_object_data_get(it->base.view,
1931 EINA_LIST_FOREACH(it->states, l, key)
1933 Eina_Bool on = it->itc->func.state_get
1934 ((void *)it->base.data, it->base.widget, l->data);
1938 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
1939 edje_object_signal_emit(it->base.view, buf, "elm");
1943 snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
1944 edje_object_signal_emit(it->base.view, buf, "elm");
1950 Evas_Coord mw = -1, mh = -1;
1952 if (it->wd->height_for_width) mw = it->wd->w; // TODO: Removed this. This was removed from upstream.
1954 if (!it->display_only)
1955 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1956 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
1957 edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw,
1959 if (!it->display_only)
1960 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1961 it->w = it->minw = mw;
1962 it->h = it->minh = mh;
1963 it->mincalcd = EINA_TRUE;
1965 if ((!it->wd->group_item_width) && (it->flags == ELM_GENLIST_ITEM_GROUP))
1967 it->wd->group_item_width = mw;
1968 it->wd->group_item_height = mh;
1970 else if ((!it->wd->item_width) && (it->flags == ELM_GENLIST_ITEM_NONE))
1972 it->wd->item_width = mw;
1973 it->wd->item_height = mh;
1976 if (!calc) evas_object_show(it->base.view);
1979 if (it->tooltip.content_cb)
1981 elm_widget_item_tooltip_content_cb_set(it,
1982 it->tooltip.content_cb,
1983 it->tooltip.data, NULL);
1984 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
1987 if (it->mouse_cursor)
1988 elm_widget_item_cursor_set(it, it->mouse_cursor);
1990 it->realized = EINA_TRUE;
1991 it->want_unrealize = EINA_FALSE;
1993 if (itc) _item_cache_free(itc);
1994 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1995 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1997 evas_object_smart_callback_call(it->base.widget, SIG_REALIZED, it);
1998 if ((!calc) && (it->wd->edit_mode) && (it->flags != ELM_GENLIST_ITEM_GROUP))
2000 if (it->itc->edit_item_style)
2002 if (!it->edit_obj) _effect_item_realize(it, EINA_FALSE);
2003 edje_object_message_signal_process(it->edit_obj);
2006 edje_object_message_signal_process(it->base.view);
2010 _item_unrealize(Elm_Genlist_Item *it,
2015 if (!it->realized) return;
2016 if (it->wd->reorder_it == it) return;
2017 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2019 evas_object_smart_callback_call(it->base.widget, SIG_UNREALIZED, it);
2022 ecore_timer_del(it->long_timer);
2023 it->long_timer = NULL;
2027 evas_object_del(it->base.view);
2028 it->base.view = NULL;
2029 evas_object_del(it->spacer);
2034 edje_object_mirrored_set(it->base.view, elm_widget_mirrored_get(it->base.widget));
2035 _item_cache_add(it);
2037 elm_widget_stringlist_free(it->labels);
2039 elm_widget_stringlist_free(it->icons);
2041 elm_widget_stringlist_free(it->states);
2043 EINA_LIST_FREE(it->icon_objs, icon)
2044 evas_object_del(icon);
2046 _mode_item_unrealize(it);
2048 it->realized = EINA_FALSE;
2049 it->want_unrealize = EINA_FALSE;
2050 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2051 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2052 if (it->wd->edit_mode) _effect_item_unrealize(it);
2056 _item_block_recalc(Item_Block *itb,
2061 Elm_Genlist_Item *it;
2062 Evas_Coord minw = 0, minh = 0;
2063 Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE;
2066 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2068 EINA_LIST_FOREACH(itb->items, l, it)
2070 if (it->delete_me) continue;
2071 showme |= it->showme;
2076 if (!it->mincalcd) changed = EINA_TRUE;
2079 _item_realize(it, in, EINA_TRUE);
2080 _item_unrealize(it, EINA_TRUE);
2085 _item_realize(it, in, EINA_TRUE);
2086 _item_unrealize(it, EINA_TRUE);
2090 _item_realize(it, in, EINA_FALSE);
2092 if (minw < it->minw) minw = it->minw;
2100 itb->changed = EINA_FALSE;
2101 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2102 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2107 _item_block_realize(Item_Block *itb,
2112 Elm_Genlist_Item *it;
2114 if (itb->realized) return;
2115 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2116 EINA_LIST_FOREACH(itb->items, l, it)
2118 if (it->delete_me) continue;
2119 if (full) _item_realize(it, in, EINA_FALSE);
2122 itb->realized = EINA_TRUE;
2123 itb->want_unrealize = EINA_FALSE;
2124 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2125 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2129 _item_block_unrealize(Item_Block *itb)
2132 Elm_Genlist_Item *it;
2133 Eina_Bool dragging = EINA_FALSE;
2135 if (!itb->realized) return;
2136 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2137 EINA_LIST_FOREACH(itb->items, l, it)
2139 if (it->flags != ELM_GENLIST_ITEM_GROUP)
2143 dragging = EINA_TRUE;
2144 it->want_unrealize = EINA_TRUE;
2147 _item_unrealize(it, EINA_FALSE);
2152 itb->realized = EINA_FALSE;
2153 itb->want_unrealize = EINA_TRUE;
2156 itb->want_unrealize = EINA_FALSE;
2157 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2158 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2162 _get_space_for_reorder_item(Elm_Genlist_Item *it)
2164 Evas_Coord rox, roy, row, roh;
2165 Eina_Bool top = EINA_FALSE;
2166 Elm_Genlist_Item *reorder_it = it->wd->reorder_it;
2167 if (!reorder_it) return 0;
2169 Evas_Coord ox,oy,oh,ow;
2170 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
2171 evas_object_geometry_get(it->wd->reorder_it->base.view, &rox, &roy, &row, &roh);
2173 if ((it->wd->reorder_start_y < it->block->y) && (roy - oy + roh/2 >= it->block->y - it->wd->pan_y))
2175 it->block->reorder_offset = it->wd->reorder_it->h * -1;
2176 if (it->block->count == 1)
2177 it->wd->reorder_rel = it;
2179 else if ((it->wd->reorder_start_y >= it->block->y) && (roy - oy + roh/2 <= it->block->y - it->wd->pan_y))
2181 it->block->reorder_offset = it->wd->reorder_it->h;
2184 it->block->reorder_offset = 0;
2186 it->scrl_y += it->block->reorder_offset;
2188 top = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
2189 rox, roy+roh/2, row, 1));
2192 it->wd->reorder_rel = it;
2193 it->scrl_y+=it->wd->reorder_it->h;
2194 return it->wd->reorder_it->h;
2201 _reorder_item_moving_effect_timer_cb(void *data)
2203 Elm_Genlist_Item *it = data;
2204 Eina_Bool down = EINA_FALSE;
2205 double time = 0.4, t;
2207 t = ((0.0 > (t = current_time_get() - it->wd->start_time)) ? 0.0 : t) / 1000;
2210 y = (1 * sin((t / time) * (M_PI / 2)) * dy);
2214 if (it->old_scrl_y < it->scrl_y)
2216 it->old_scrl_y += y;
2219 else if (it->old_scrl_y > it->scrl_y)
2221 it->old_scrl_y -= y;
2225 _effect_item_controls(it, it->scrl_x, it->old_scrl_y);
2227 _group_items_recalc(it->wd);
2228 if (!it->wd->reorder_it || it->wd->reorder_pan_move)
2230 it->old_scrl_y = it->scrl_y;
2231 it->move_effect_me = EINA_FALSE;
2232 it->wd->item_moving_effect_timer = NULL;
2233 return ECORE_CALLBACK_CANCEL;
2235 if ((down && it->old_scrl_y >= it->scrl_y) || (!down && it->old_scrl_y <= it->scrl_y))
2237 it->old_scrl_y = it->scrl_y;
2238 it->move_effect_me = EINA_FALSE;
2239 it->wd->item_moving_effect_timer = NULL;
2240 return ECORE_CALLBACK_CANCEL;
2242 return ECORE_CALLBACK_RENEW;
2246 _item_position(Elm_Genlist_Item *it, Evas_Object *view)
2251 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2252 evas_object_resize(view, it->w, it->h);
2253 evas_object_move(view, it->scrl_x, it->scrl_y);
2254 evas_object_show(view);
2255 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2256 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2260 _item_block_position(Item_Block *itb,
2264 Elm_Genlist_Item *it;
2265 Elm_Genlist_Item *git;
2266 Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2269 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2270 evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh);
2271 evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy,
2273 EINA_LIST_FOREACH(itb->items, l, it)
2275 if (it->delete_me) continue;
2276 else if (it->wd->reorder_it == it) continue;
2281 it->scrl_x = itb->x + it->x - it->wd->pan_x + ox;
2282 it->scrl_y = itb->y + it->y - it->wd->pan_y + oy;
2284 vis = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
2285 cvx, cvy, cvw, cvh));
2286 if (it->flags != ELM_GENLIST_ITEM_GROUP || (it->wd->reorder_it ))
2288 if ((itb->realized))
2292 if (!it->realized) _item_realize(it, in, EINA_FALSE);
2295 if (it->wd->edit_mode) edje_object_signal_emit(it->edit_obj, "elm,state,rename,enabled", "elm");
2296 edje_object_signal_emit(it->base.view, "elm,state,rename,enabled", "elm");
2304 if (it->wd->reorder_mode)
2305 y += _get_space_for_reorder_item(it);
2306 git = it->group_item;
2309 git->scrl_x = it->scrl_x;
2310 if (git->scrl_y < oy)
2312 if ((git->scrl_y + git->h) > (it->scrl_y + it->h))
2313 git->scrl_y = (it->scrl_y + it->h) - git->h;
2314 git->want_realize = EINA_TRUE;
2316 if (it->wd->reorder_it && !it->wd->reorder_pan_move && it->old_scrl_y && it->old_scrl_y != it->scrl_y)
2318 if (!it->move_effect_me)
2320 it->move_effect_me = EINA_TRUE;
2321 it->item_moving_effect_timer = ecore_animator_add(_reorder_item_moving_effect_timer_cb, it);
2325 if (!it->move_effect_me )
2326 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))
2328 if (it->wd->edit_mode && it->itc->edit_item_style)
2330 _effect_item_controls(it, it->scrl_x, it->scrl_y);
2334 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)))
2337 _item_position(it, it->mode_view);
2339 _item_position(it, it->base.view);
2343 evas_object_resize(it->base.view, it->w, it->h);
2344 evas_object_move(it->base.view, it->scrl_x, it->scrl_y);
2345 evas_object_hide(it->base.view);
2352 if (!it->dragging) _item_unrealize(it, EINA_FALSE);
2359 if (vis) it->want_realize = EINA_TRUE;
2361 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))
2363 it->old_scrl_y = it->scrl_y;
2367 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2368 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2372 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2374 Elm_Genlist_Item *it = data;
2376 it->mincalcd = EINA_FALSE;
2377 it->block->changeme = EINA_TRUE;
2378 if (it->wd->changed_job) ecore_job_del(it->wd->changed_job);
2379 it->wd->changed_job = ecore_job_add(_changed_job, it->wd);
2383 _group_items_recalc(void *data)
2385 Widget_Data *wd = data;
2387 Elm_Genlist_Item *git;
2389 evas_event_freeze(evas_object_evas_get(wd->obj));
2390 EINA_LIST_FOREACH(wd->group_items, l, git)
2392 if (git->want_realize)
2395 _item_realize(git, 0, EINA_FALSE);
2396 evas_object_resize(git->base.view, wd->minw, git->h);
2397 evas_object_move(git->base.view, git->scrl_x, git->scrl_y);
2398 evas_object_show(git->base.view);
2399 evas_object_raise(git->base.view);
2401 else if (!git->want_realize && git->realized)
2404 _item_unrealize(git, EINA_FALSE);
2407 evas_event_thaw(evas_object_evas_get(wd->obj));
2408 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2412 _must_recalc_idler(void *data)
2414 Widget_Data *wd = data;
2415 if (wd->calc_job) ecore_job_del(wd->calc_job);
2416 wd->calc_job = ecore_job_add(_calc_job, wd);
2417 wd->must_recalc_idler = NULL;
2418 return ECORE_CALLBACK_CANCEL;
2422 _calc_job(void *data)
2424 Widget_Data *wd = data;
2425 Item_Block *itb, *chb = NULL;
2426 Evas_Coord minw = -1, minh = 0, y = 0, ow;
2427 int in = 0, minw_change = 0;
2428 Eina_Bool changed = EINA_FALSE;
2430 Eina_Bool did_must_recalc = EINA_FALSE;
2433 t0 = ecore_time_get();
2434 evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h);
2438 evas_event_freeze(evas_object_evas_get(wd->obj));
2439 EINA_INLIST_FOREACH(wd->blocks, itb)
2441 Eina_Bool showme = EINA_FALSE;
2444 showme = itb->showme;
2445 itb->showme = EINA_FALSE;
2448 if (itb->realized) _item_block_unrealize(itb);
2450 if ((itb->changed) || (changed) ||
2451 ((itb->must_recalc) && (!did_must_recalc)))
2453 if ((changed) || (itb->must_recalc))
2456 Elm_Genlist_Item *it;
2457 EINA_LIST_FOREACH(itb->items, l, it)
2458 if (it->mincalcd) it->mincalcd = EINA_FALSE;
2459 itb->changed = EINA_TRUE;
2460 if (itb->must_recalc) did_must_recalc = EINA_TRUE;
2461 itb->must_recalc = EINA_FALSE;
2463 if (itb->realized) _item_block_unrealize(itb);
2464 showme = _item_block_recalc(itb, in, EINA_FALSE);
2470 if (minw == -1) minw = itb->minw;
2471 else if ((!itb->must_recalc) && (minw < itb->minw))
2474 minw_change = EINA_TRUE;
2480 if ((showme) && (wd->show_item) && (!wd->show_item->queued))
2482 wd->show_item->showme = EINA_FALSE;
2484 elm_smart_scroller_region_bring_in(wd->scr,
2486 wd->show_item->block->x,
2488 wd->show_item->block->y,
2489 wd->show_item->block->w,
2492 elm_smart_scroller_child_region_show(wd->scr,
2494 wd->show_item->block->x,
2496 wd->show_item->block->y,
2497 wd->show_item->block->w,
2499 wd->show_item = NULL;
2504 EINA_INLIST_FOREACH(wd->blocks, itb)
2510 if ((chb) && (EINA_INLIST_GET(chb)->next))
2512 EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb)
2514 if (itb->realized) _item_block_unrealize(itb);
2517 wd->realminw = minw;
2518 if (minw < wd->w) minw = wd->w;
2519 if ((minw != wd->minw) || (minh != wd->minh))
2523 if (wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE)
2524 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
2525 _sizing_eval(wd->obj);
2527 if ((wd->anchor_item) && (wd->anchor_item->block) && (!wd->auto_scrolled))
2529 Elm_Genlist_Item *it;
2532 it = wd->anchor_item;
2533 it_y = wd->anchor_y;
2534 elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x,
2535 it->block->y + it->y + it_y);
2536 wd->anchor_item = it;
2537 wd->anchor_y = it_y;
2541 t = ecore_time_get();
2542 if (did_must_recalc)
2544 if (!wd->must_recalc_idler)
2545 wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd);
2547 wd->calc_job = NULL;
2548 evas_object_smart_changed(wd->pan_smart);
2549 evas_event_thaw(evas_object_evas_get(wd->obj));
2550 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2554 _update_job(void *data)
2556 Widget_Data *wd = data;
2560 Eina_Bool position = EINA_FALSE, recalc = EINA_FALSE;
2562 wd->update_job = NULL;
2565 evas_event_freeze(evas_object_evas_get(wd->obj));
2566 EINA_INLIST_FOREACH(wd->blocks, itb)
2568 Evas_Coord itminw, itminh;
2569 Elm_Genlist_Item *it;
2575 _item_block_position(itb, num);
2579 recalc = EINA_FALSE;
2580 EINA_LIST_FOREACH(itb->items, l2, it)
2587 it->updateme = EINA_FALSE;
2590 _item_unrealize(it, EINA_FALSE);
2591 _item_realize(it, num, EINA_FALSE);
2592 position = EINA_TRUE;
2596 _item_realize(it, num, EINA_TRUE);
2597 _item_unrealize(it, EINA_TRUE);
2599 if ((it->minw != itminw) || (it->minh != itminh))
2604 itb->updateme = EINA_FALSE;
2607 position = EINA_TRUE;
2608 itb->changed = EINA_TRUE;
2609 _item_block_recalc(itb, num0, EINA_FALSE);
2610 _item_block_position(itb, num0);
2615 if (wd->calc_job) ecore_job_del(wd->calc_job);
2616 wd->calc_job = ecore_job_add(_calc_job, wd);
2618 evas_event_thaw(evas_object_evas_get(wd->obj));
2619 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2623 _changed_job(void *data)
2625 Widget_Data *wd = data; Eina_List *l2;
2627 int num, num0, position = 0;
2628 Eina_Bool width_changed = EINA_FALSE, height_changed = EINA_FALSE;
2630 wd->changed_job = NULL;
2632 EINA_INLIST_FOREACH(wd->blocks, itb)
2634 Evas_Coord itminw, itminh;
2635 Elm_Genlist_Item *it;
2641 _item_block_position(itb, num);
2645 width_changed = height_changed = EINA_FALSE;
2646 EINA_LIST_FOREACH(itb->items, l2, it)
2648 if ((!it->mincalcd) && (it->realized))
2650 Evas_Coord mw = -1, mh = -1;
2654 if (it->wd->height_for_width) mw = it->wd->w;
2655 if (!it->display_only)
2656 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2657 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
2658 edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw, mh);
2659 if (!it->display_only)
2660 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2661 it->w = it->minw = mw;
2662 it->h = it->minh = mh;
2663 it->mincalcd = EINA_TRUE;
2665 //if ((it->minw != itminw) || (it->minh != itminh))
2666 //if ((it->minh != itminh))
2668 if ((it->minw != itminw))
2669 width_changed = EINA_TRUE;
2670 if ((it->minh != itminh))
2671 height_changed = EINA_TRUE;
2673 if ((!it->wd->group_item_width) && (it->flags == ELM_GENLIST_ITEM_GROUP))
2675 it->wd->group_item_width = mw;
2676 it->wd->group_item_height = mh;
2678 else if ((!it->wd->item_width) && (it->flags == ELM_GENLIST_ITEM_NONE))
2680 it->wd->item_width = mw;
2681 it->wd->item_height = mh;
2686 itb->changeme = EINA_FALSE;
2687 // TODO: why this is separated.
2691 itb->changed = EINA_TRUE;
2692 _item_block_recalc(itb, num0, 0);
2693 _item_block_position(itb, num0);
2695 else if (width_changed)
2697 _item_block_position(itb, num0);
2702 if (wd->calc_job) ecore_job_del(wd->calc_job);
2703 wd->calc_job = ecore_job_add(_calc_job, wd);
2708 _pan_set(Evas_Object *obj,
2712 Pan *sd = evas_object_smart_data_get(obj);
2717 // Evas_Coord ow, oh;
2718 // evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2719 // ow = sd->wd->minw - ow;
2720 // if (ow < 0) ow = 0;
2721 // oh = sd->wd->minh - oh;
2722 // if (oh < 0) oh = 0;
2723 // if (x < 0) x = 0;
2724 // if (y < 0) y = 0;
2725 // if (x > ow) x = ow;
2726 // if (y > oh) y = oh;
2727 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
2732 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2734 if ((itb->y + itb->h) > y)
2736 Elm_Genlist_Item *it;
2739 EINA_LIST_FOREACH(itb->items, l2, it)
2741 if ((itb->y + it->y) >= y)
2743 sd->wd->anchor_item = it;
2744 sd->wd->anchor_y = -(itb->y + it->y - y);
2752 if(!sd->wd->item_moving_effect_timer) evas_object_smart_changed(obj);
2756 _pan_get(Evas_Object *obj,
2760 Pan *sd = evas_object_smart_data_get(obj);
2762 if (x) *x = sd->wd->pan_x;
2763 if (y) *y = sd->wd->pan_y;
2767 _pan_max_get(Evas_Object *obj,
2771 Pan *sd = evas_object_smart_data_get(obj);
2774 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2775 ow = sd->wd->minw - ow;
2777 oh = sd->wd->minh - oh;
2784 _pan_min_get(Evas_Object *obj __UNUSED__,
2793 _pan_child_size_get(Evas_Object *obj,
2797 Pan *sd = evas_object_smart_data_get(obj);
2799 if (w) *w = sd->wd->minw;
2800 if (h) *h = sd->wd->minh;
2804 _pan_add(Evas_Object *obj)
2807 Evas_Object_Smart_Clipped_Data *cd;
2810 cd = evas_object_smart_data_get(obj);
2813 sd->__clipped_data = *cd;
2815 evas_object_smart_data_set(obj, sd);
2819 _pan_del(Evas_Object *obj)
2821 Pan *sd = evas_object_smart_data_get(obj);
2826 ecore_job_del(sd->resize_job);
2827 sd->resize_job = NULL;
2833 _pan_resize_job(void *data)
2836 _sizing_eval(sd->wd->obj);
2837 sd->resize_job = NULL;
2841 _pan_resize(Evas_Object *obj,
2845 Pan *sd = evas_object_smart_data_get(obj);
2848 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2849 if ((ow == w) && (oh == h)) return;
2850 if ((sd->wd->height_for_width) && (ow != w))
2852 if (sd->resize_job) ecore_job_del(sd->resize_job);
2853 sd->resize_job = ecore_job_add(_pan_resize_job, sd);
2855 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2856 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2860 _pan_calculate(Evas_Object *obj)
2862 Pan *sd = evas_object_smart_data_get(obj);
2864 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2865 static Evas_Coord old_pan_y = 0;
2867 Elm_Genlist_Item *git;
2870 evas_event_freeze(evas_object_evas_get(obj));
2871 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
2872 evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
2873 EINA_LIST_FOREACH(sd->wd->group_items, l, git)
2875 git->want_realize = EINA_FALSE;
2877 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2879 itb->w = sd->wd->minw;
2880 if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox,
2881 itb->y - sd->wd->pan_y + oy,
2883 cvx, cvy, cvw, cvh))
2885 if ((!itb->realized) || (itb->changed))
2886 _item_block_realize(itb, in, 0);
2887 _item_block_position(itb, in);
2891 if (itb->realized) _item_block_unrealize(itb);
2895 if ((!sd->wd->reorder_it) || (sd->wd->reorder_pan_move))
2896 _group_items_recalc(sd->wd);
2898 if ((sd->wd->reorder_mode) && (sd->wd->reorder_it))
2900 if (sd->wd->pan_y != old_pan_y) sd->wd->reorder_pan_move = EINA_TRUE;
2901 else sd->wd->reorder_pan_move = EINA_FALSE;
2902 evas_object_raise(sd->wd->reorder_it->edit_obj);
2903 old_pan_y = sd->wd->pan_y;
2906 if (sd->wd->effect_mode &&
2907 ((sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND) ||
2908 (sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT) ||
2909 (sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE)))
2911 if (!sd->wd->item_moving_effect_timer)
2913 if (sd->wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE)
2914 _item_flip_effect_show(sd->wd->expand_item);
2916 evas_object_raise(sd->wd->alpha_bg);
2917 evas_object_show(sd->wd->alpha_bg);
2918 elm_smart_scroller_bounce_animator_disabled_set(sd->wd->scr, EINA_TRUE);
2919 sd->wd->start_time = current_time_get();
2920 sd->wd->item_moving_effect_timer = ecore_animator_add(_item_moving_effect_timer_cb, sd->wd);
2923 else _item_auto_scroll(sd->wd);
2924 evas_event_thaw(evas_object_evas_get(obj));
2925 evas_event_thaw_eval(evas_object_evas_get(obj));
2929 _pan_move(Evas_Object *obj,
2930 Evas_Coord x __UNUSED__,
2931 Evas_Coord y __UNUSED__)
2933 Pan *sd = evas_object_smart_data_get(obj);
2935 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2936 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2940 _hold_on(void *data __UNUSED__,
2942 void *event_info __UNUSED__)
2944 Widget_Data *wd = elm_widget_data_get(obj);
2946 elm_smart_scroller_hold_set(wd->scr, 1);
2950 _hold_off(void *data __UNUSED__,
2952 void *event_info __UNUSED__)
2954 Widget_Data *wd = elm_widget_data_get(obj);
2956 elm_smart_scroller_hold_set(wd->scr, 0);
2960 _freeze_on(void *data __UNUSED__,
2962 void *event_info __UNUSED__)
2964 Widget_Data *wd = elm_widget_data_get(obj);
2966 elm_smart_scroller_freeze_set(wd->scr, 1);
2970 _freeze_off(void *data __UNUSED__,
2972 void *event_info __UNUSED__)
2974 Widget_Data *wd = elm_widget_data_get(obj);
2976 elm_smart_scroller_freeze_set(wd->scr, 0);
2980 _scroll_edge_left(void *data,
2981 Evas_Object *scr __UNUSED__,
2982 void *event_info __UNUSED__)
2984 Evas_Object *obj = data;
2985 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_LEFT, NULL);
2989 _scroll_edge_right(void *data,
2990 Evas_Object *scr __UNUSED__,
2991 void *event_info __UNUSED__)
2993 Evas_Object *obj = data;
2994 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_RIGHT, NULL);
2998 _scroll_edge_top(void *data,
2999 Evas_Object *scr __UNUSED__,
3000 void *event_info __UNUSED__)
3002 Evas_Object *obj = data;
3003 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_TOP, NULL);
3007 _scroll_edge_bottom(void *data,
3008 Evas_Object *scr __UNUSED__,
3009 void *event_info __UNUSED__)
3011 Evas_Object *obj = data;
3012 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_BOTTOM, NULL);
3016 _mode_item_realize(Elm_Genlist_Item *it)
3020 if ((it->mode_view) || (it->delete_me)) return;
3022 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3023 it->mode_view = edje_object_add(evas_object_evas_get(it->base.widget));
3024 edje_object_scale_set(it->mode_view,
3025 elm_widget_scale_get(it->base.widget) *
3026 _elm_config->scale);
3027 evas_object_smart_member_add(it->mode_view, it->wd->pan_smart);
3028 elm_widget_sub_object_add(it->base.widget, it->mode_view);
3030 strncpy(buf, "item", sizeof(buf));
3031 if (it->wd->compress)
3032 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
3034 if (it->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
3035 strncat(buf, "/", sizeof(buf) - strlen(buf));
3036 strncat(buf, it->itc->mode_item_style, sizeof(buf) - strlen(buf));
3038 _elm_theme_object_set(it->base.widget, it->mode_view, "genlist", buf,
3039 elm_widget_style_get(it->base.widget));
3040 edje_object_mirrored_set(it->mode_view,
3041 elm_widget_mirrored_get(it->base.widget));
3043 /* signal callback add */
3044 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_DOWN,
3046 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_UP,
3048 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_MOVE,
3051 /* label_get, icon_get, state_get */
3052 if (it->itc->func.label_get)
3058 elm_widget_stringlist_get(edje_object_data_get(it->mode_view,
3060 EINA_LIST_FOREACH(it->mode_labels, l, key)
3062 char *s = it->itc->func.label_get
3063 ((void *)it->base.data, it->base.widget, l->data);
3067 edje_object_part_text_set(it->mode_view, l->data, s);
3072 if (it->itc->func.icon_get)
3078 elm_widget_stringlist_get(edje_object_data_get(it->mode_view,
3080 EINA_LIST_FOREACH(it->mode_icons, l, key)
3082 Evas_Object *ic = it->itc->func.icon_get
3083 ((void *)it->base.data, it->base.widget, l->data);
3087 it->mode_icon_objs = eina_list_append(it->mode_icon_objs, ic);
3088 edje_object_part_swallow(it->mode_view, key, ic);
3089 evas_object_show(ic);
3090 elm_widget_sub_object_add(it->base.widget, ic);
3092 elm_widget_disabled_set(ic, EINA_TRUE);
3096 if (it->itc->func.state_get)
3102 elm_widget_stringlist_get(edje_object_data_get(it->mode_view,
3104 EINA_LIST_FOREACH(it->mode_states, l, key)
3106 Eina_Bool on = it->itc->func.state_get
3107 ((void *)it->base.data, it->base.widget, l->data);
3111 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
3112 edje_object_signal_emit(it->mode_view, buf, "elm");
3117 edje_object_part_swallow(it->mode_view,
3118 edje_object_data_get(it->mode_view, "mode_part"),
3121 it->want_unrealize = EINA_FALSE;
3122 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3123 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3127 _mode_item_unrealize(Elm_Genlist_Item *it)
3129 Widget_Data *wd = it->wd;
3131 if (!it->mode_view) return;
3133 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3134 elm_widget_stringlist_free(it->mode_labels);
3135 it->mode_labels = NULL;
3136 elm_widget_stringlist_free(it->mode_icons);
3137 it->mode_icons = NULL;
3138 elm_widget_stringlist_free(it->mode_states);
3140 EINA_LIST_FREE(it->mode_icon_objs, icon)
3141 evas_object_del(icon);
3143 edje_object_part_unswallow(it->mode_view, it->base.view);
3144 evas_object_smart_member_add(it->base.view, wd->pan_smart);
3145 evas_object_del(it->mode_view);
3146 it->mode_view = NULL;
3148 if (wd->mode_item == it)
3149 wd->mode_item = NULL;
3150 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3151 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3155 _item_mode_set(Elm_Genlist_Item *it)
3158 Widget_Data *wd = it->wd;
3163 it->nocache = EINA_TRUE;
3165 if (wd->scr_hold_timer)
3167 ecore_timer_del(wd->scr_hold_timer);
3168 wd->scr_hold_timer = NULL;
3170 elm_smart_scroller_hold_set(wd->scr, EINA_TRUE);
3171 wd->scr_hold_timer = ecore_timer_add(0.1, _scr_hold_timer_cb, wd);
3173 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3174 _mode_item_realize(it);
3175 _item_position(it, it->mode_view);
3176 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3177 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3179 snprintf(buf, sizeof(buf), "elm,state,%s,active", wd->mode_type);
3180 edje_object_signal_emit(it->mode_view, buf, "elm");
3184 _item_mode_unset(Widget_Data *wd)
3187 if (!wd->mode_item) return;
3188 char buf[1024], buf2[1024];
3189 Elm_Genlist_Item *it;
3192 it->nocache = EINA_TRUE;
3194 snprintf(buf, sizeof(buf), "elm,state,%s,passive", wd->mode_type);
3195 snprintf(buf2, sizeof(buf2), "elm,state,%s,passive,finished", wd->mode_type);
3197 edje_object_signal_emit(it->mode_view, buf, "elm");
3198 edje_object_signal_callback_add(it->mode_view, buf2, "elm", _mode_finished_signal_cb, it);
3200 wd->mode_item = NULL;
3204 elm_genlist_add(Evas_Object *parent)
3209 Evas_Coord minw, minh;
3210 static Evas_Smart *smart = NULL;
3214 static Evas_Smart_Class sc;
3216 evas_object_smart_clipped_smart_set(&_pan_sc);
3218 sc.name = "elm_genlist_pan";
3219 sc.version = EVAS_SMART_CLASS_VERSION;
3222 sc.resize = _pan_resize;
3223 sc.move = _pan_move;
3224 sc.calculate = _pan_calculate;
3225 if (!(smart = evas_smart_class_new(&sc))) return NULL;
3228 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
3230 ELM_SET_WIDTYPE(widtype, "genlist");
3231 elm_widget_type_set(obj, "genlist");
3232 elm_widget_sub_object_add(parent, obj);
3233 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
3234 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
3235 elm_widget_data_set(obj, wd);
3236 elm_widget_del_hook_set(obj, _del_hook);
3237 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
3238 elm_widget_theme_hook_set(obj, _theme_hook);
3239 elm_widget_can_focus_set(obj, EINA_TRUE);
3240 elm_widget_event_hook_set(obj, _event_hook);
3241 elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
3243 wd->scr = elm_smart_scroller_add(e);
3244 elm_smart_scroller_widget_set(wd->scr, obj);
3245 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
3246 elm_widget_style_get(obj));
3247 elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE,
3248 _elm_config->thumbscroll_bounce_enable);
3249 elm_widget_resize_object_set(obj, wd->scr);
3251 evas_object_smart_callback_add(wd->scr, "edge,left", _scroll_edge_left, obj);
3252 evas_object_smart_callback_add(wd->scr, "edge,right", _scroll_edge_right,
3254 evas_object_smart_callback_add(wd->scr, "edge,top", _scroll_edge_top, obj);
3255 evas_object_smart_callback_add(wd->scr, "edge,bottom", _scroll_edge_bottom,
3259 wd->mode = ELM_LIST_SCROLL;
3260 wd->max_items_per_block = MAX_ITEMS_PER_BLOCK;
3261 wd->item_cache_max = wd->max_items_per_block * 2;
3262 wd->longpress_timeout = _elm_config->longpress_timeout;
3263 wd->effect_mode = _elm_config->effect_enable;
3265 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
3266 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
3267 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
3268 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
3270 wd->pan_smart = evas_object_smart_add(e, smart);
3271 wd->pan = evas_object_smart_data_get(wd->pan_smart);
3274 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
3275 _pan_set, _pan_get, _pan_max_get,
3276 _pan_min_get, _pan_child_size_get);
3278 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
3280 evas_object_size_hint_min_set(obj, minw, minh);
3282 evas_object_smart_callbacks_descriptions_set(obj, _signals);
3283 _mirrored_set(obj, elm_widget_mirrored_get(obj));
3288 static Elm_Genlist_Item *
3289 _item_new(Widget_Data *wd,
3290 const Elm_Genlist_Item_Class *itc,
3292 Elm_Genlist_Item *parent,
3293 Elm_Genlist_Item_Flags flags,
3295 const void *func_data)
3297 Elm_Genlist_Item *it;
3299 it = elm_widget_item_new(wd->obj, Elm_Genlist_Item);
3300 if (!it) return NULL;
3303 it->base.data = data;
3304 it->parent = parent;
3306 it->func.func = func;
3307 it->func.data = func_data;
3308 it->mouse_cursor = NULL;
3309 it->expanded_depth = 0;
3313 if (it->parent->flags & ELM_GENLIST_ITEM_GROUP)
3314 it->group_item = parent;
3315 else if (it->parent->group_item)
3316 it->group_item = it->parent->group_item;
3322 _item_block_add(Widget_Data *wd,
3323 Elm_Genlist_Item *it)
3325 Item_Block *itb = NULL;
3332 itb = calloc(1, sizeof(Item_Block));
3335 if (!it->rel->block)
3338 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3339 itb->items = eina_list_append(itb->items, it);
3345 wd->blocks = eina_inlist_prepend_relative
3346 (wd->blocks, EINA_INLIST_GET(itb),
3347 EINA_INLIST_GET(it->rel->block));
3349 eina_list_prepend_relative(itb->items, it, it->rel);
3353 wd->blocks = eina_inlist_append_relative
3354 (wd->blocks, EINA_INLIST_GET(itb),
3355 EINA_INLIST_GET(it->rel->block));
3357 eina_list_append_relative(itb->items, it, it->rel);
3367 itb = (Item_Block *)(wd->blocks);
3368 if (itb->count >= wd->max_items_per_block)
3370 itb = calloc(1, sizeof(Item_Block));
3374 eina_inlist_prepend(wd->blocks,
3375 EINA_INLIST_GET(itb));
3380 itb = calloc(1, sizeof(Item_Block));
3384 eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
3386 itb->items = eina_list_prepend(itb->items, it);
3392 itb = (Item_Block *)(wd->blocks->last);
3393 if (itb->count >= wd->max_items_per_block)
3395 itb = calloc(1, sizeof(Item_Block));
3399 eina_inlist_append(wd->blocks,
3400 EINA_INLIST_GET(itb));
3405 itb = calloc(1, sizeof(Item_Block));
3409 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3411 itb->items = eina_list_append(itb->items, it);
3417 itb = it->rel->block;
3418 if (!itb) goto newblock;
3420 itb->items = eina_list_prepend_relative(itb->items, it, it->rel);
3422 itb->items = eina_list_append_relative(itb->items, it, it->rel);
3425 itb->changed = EINA_TRUE;
3427 if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job);
3428 itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd);
3431 it->rel->relcount--;
3432 if ((it->rel->delete_me) && (!it->rel->relcount))
3436 if (itb->count > itb->wd->max_items_per_block)
3440 Elm_Genlist_Item *it2;
3442 newc = itb->count / 2;
3443 itb2 = calloc(1, sizeof(Item_Block));
3447 eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
3448 EINA_INLIST_GET(itb));
3449 itb2->changed = EINA_TRUE;
3450 while ((itb->count > newc) && (itb->items))
3454 l = eina_list_last(itb->items);
3456 itb->items = eina_list_remove_list(itb->items, l);
3459 itb2->items = eina_list_prepend(itb2->items, it2);
3467 _queue_process(Widget_Data *wd)
3470 Eina_Bool showme = EINA_FALSE;
3473 t0 = ecore_time_get();
3474 //evas_event_freeze(evas_object_evas_get(wd->obj));
3475 for (n = 0; (wd->queue) && (n < 128); n++)
3477 Elm_Genlist_Item *it;
3479 it = wd->queue->data;
3480 wd->queue = eina_list_remove_list(wd->queue, wd->queue);
3481 it->queued = EINA_FALSE;
3482 _item_block_add(wd, it);
3483 t = ecore_time_get();
3484 if (it->block->changed)
3486 showme = _item_block_recalc(it->block, it->block->num, EINA_TRUE);
3487 it->block->changed = 0;
3489 if (showme) it->block->showme = EINA_TRUE;
3490 if (eina_inlist_count(wd->blocks) > 1)
3492 if ((t - t0) > (ecore_animator_frametime_get())) break;
3495 //evas_event_thaw(evas_object_evas_get(wd->obj));
3496 //evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3501 _idle_process(void *data, Eina_Bool *wakeup)
3503 Widget_Data *wd = data;
3506 //static double q_start = 0.0;
3507 //if (q_start == 0.0) q_start = ecore_time_get();
3509 if (_queue_process(wd) > 0) *wakeup = EINA_TRUE;
3513 //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start);
3515 return ECORE_CALLBACK_CANCEL;
3517 return ECORE_CALLBACK_RENEW;
3521 _item_idle_enterer(void *data)
3523 Widget_Data *wd = data;
3524 Eina_Bool wakeup = EINA_FALSE;
3525 Eina_Bool ok = _idle_process(data, &wakeup);
3530 if (wd->calc_job) ecore_job_del(wd->calc_job);
3531 wd->calc_job = ecore_job_add(_calc_job, wd);
3533 if (ok == ECORE_CALLBACK_CANCEL) wd->queue_idle_enterer = NULL;
3538 _item_queue(Widget_Data *wd,
3539 Elm_Genlist_Item *it)
3541 if (it->queued) return;
3542 it->queued = EINA_TRUE;
3543 wd->queue = eina_list_append(wd->queue, it);
3544 // FIXME: why does a freeze then thaw here cause some genlist
3545 // elm_genlist_item_append() to be much much slower?
3546 // evas_event_freeze(evas_object_evas_get(wd->obj));
3547 while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
3549 if (wd->queue_idle_enterer)
3551 ecore_idle_enterer_del(wd->queue_idle_enterer);
3552 wd->queue_idle_enterer = NULL;
3556 // evas_event_thaw(evas_object_evas_get(wd->obj));
3557 // evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3558 if (!wd->queue_idle_enterer)
3559 wd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, wd);
3562 EAPI Elm_Genlist_Item *
3563 elm_genlist_item_append(Evas_Object *obj,
3564 const Elm_Genlist_Item_Class *itc,
3566 Elm_Genlist_Item *parent,
3567 Elm_Genlist_Item_Flags flags,
3569 const void *func_data)
3571 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3572 Widget_Data *wd = elm_widget_data_get(obj);
3573 if (!wd) return NULL;
3574 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3576 if (!it) return NULL;
3579 if (flags & ELM_GENLIST_ITEM_GROUP)
3580 wd->group_items = eina_list_append(wd->group_items, it);
3581 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
3586 Elm_Genlist_Item *it2 = NULL;
3587 Eina_List *ll = eina_list_last(it->parent->items);
3588 if (ll) it2 = ll->data;
3589 it->parent->items = eina_list_append(it->parent->items, it);
3590 if (!it2) it2 = it->parent;
3592 it2 = elm_genlist_item_prev_get(it2);
3594 eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3595 EINA_INLIST_GET(it2));
3597 it->rel->relcount++;
3599 it->before = EINA_FALSE;
3600 _item_queue(wd, it);
3604 EAPI Elm_Genlist_Item *
3605 elm_genlist_item_prepend(Evas_Object *obj,
3606 const Elm_Genlist_Item_Class *itc,
3608 Elm_Genlist_Item *parent,
3609 Elm_Genlist_Item_Flags flags,
3611 const void *func_data)
3613 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3614 Widget_Data *wd = elm_widget_data_get(obj);
3615 if (!wd) return NULL;
3616 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3618 if (!it) return NULL;
3621 if (flags & ELM_GENLIST_ITEM_GROUP)
3622 wd->group_items = eina_list_prepend(wd->group_items, it);
3623 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
3628 Elm_Genlist_Item *it2 = NULL;
3629 Eina_List *ll = it->parent->items;
3630 if (ll) it2 = ll->data;
3631 it->parent->items = eina_list_prepend(it->parent->items, it);
3632 if (!it2) it2 = it->parent;
3634 it2 = elm_genlist_item_next_get(it2);
3636 eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3637 EINA_INLIST_GET(it2));
3639 it->rel->relcount++;
3641 it->before = EINA_TRUE;
3642 _item_queue(wd, it);
3646 EAPI Elm_Genlist_Item *
3647 elm_genlist_item_insert_after(Evas_Object *obj,
3648 const Elm_Genlist_Item_Class *itc,
3650 Elm_Genlist_Item *parent,
3651 Elm_Genlist_Item *after,
3652 Elm_Genlist_Item_Flags flags,
3654 const void *func_data)
3656 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3657 EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
3658 Widget_Data *wd = elm_widget_data_get(obj);
3659 if (!wd) return NULL;
3660 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3662 if (!it) return NULL;
3663 /* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */
3664 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3668 if ((flags & ELM_GENLIST_ITEM_GROUP) &&
3669 (after->flags & ELM_GENLIST_ITEM_GROUP))
3670 wd->group_items = eina_list_append_relative(wd->group_items, it,
3675 it->parent->items = eina_list_append_relative(it->parent->items, it,
3678 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3679 EINA_INLIST_GET(after));
3681 it->rel->relcount++;
3682 it->before = EINA_FALSE;
3683 _item_queue(wd, it);
3687 EAPI Elm_Genlist_Item *
3688 elm_genlist_item_insert_before(Evas_Object *obj,
3689 const Elm_Genlist_Item_Class *itc,
3691 Elm_Genlist_Item *parent,
3692 Elm_Genlist_Item *before,
3693 Elm_Genlist_Item_Flags flags,
3695 const void *func_data)
3697 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3698 EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
3699 Widget_Data *wd = elm_widget_data_get(obj);
3700 if (!wd) return NULL;
3701 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3703 if (!it) return NULL;
3704 /* It makes no sense to insert before in an empty list with before != NULL, something really bad is happening in your app. */
3705 EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
3709 if ((flags & ELM_GENLIST_ITEM_GROUP) &&
3710 (before->flags & ELM_GENLIST_ITEM_GROUP))
3711 wd->group_items = eina_list_prepend_relative(wd->group_items, it,
3716 it->parent->items = eina_list_prepend_relative(it->parent->items, it,
3719 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3720 EINA_INLIST_GET(before));
3722 it->rel->relcount++;
3723 it->before = EINA_TRUE;
3724 _item_queue(wd, it);
3729 elm_genlist_clear(Evas_Object *obj)
3731 ELM_CHECK_WIDTYPE(obj, widtype);
3732 Widget_Data *wd = elm_widget_data_get(obj);
3734 if (wd->walking > 0)
3736 Elm_Genlist_Item *it;
3738 wd->clear_me = EINA_TRUE;
3739 EINA_INLIST_FOREACH(wd->items, it)
3741 it->delete_me = EINA_TRUE;
3745 evas_event_freeze(evas_object_evas_get(wd->obj));
3748 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
3749 it->nocache = EINA_TRUE;
3750 it->highlighted = EINA_FALSE;
3752 if (wd->anchor_item == it)
3754 wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3755 if (!wd->anchor_item)
3757 ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3760 wd->items = eina_inlist_remove(wd->items, wd->items);
3761 if (it->flags & ELM_GENLIST_ITEM_GROUP)
3762 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
3763 elm_widget_item_pre_notify_del(it);
3764 if (it->realized) _item_unrealize(it, EINA_FALSE);
3765 if (((wd->clear_me) || (!it->delete_me)) && (it->itc->func.del))
3766 it->itc->func.del((void *)it->base.data, it->base.widget);
3767 if (it->long_timer) ecore_timer_del(it->long_timer);
3768 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
3769 elm_widget_item_del(it);
3771 wd->clear_me = EINA_FALSE;
3772 wd->anchor_item = NULL;
3775 Item_Block *itb = (Item_Block *)(wd->blocks);
3777 wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
3778 if (itb->items) eina_list_free(itb->items);
3783 ecore_job_del(wd->calc_job);
3784 wd->calc_job = NULL;
3786 if (wd->queue_idle_enterer)
3788 ecore_idle_enterer_del(wd->queue_idle_enterer);
3789 wd->queue_idle_enterer = NULL;
3791 if (wd->must_recalc_idler)
3793 ecore_idler_del(wd->must_recalc_idler);
3794 wd->must_recalc_idler = NULL;
3798 eina_list_free(wd->queue);
3803 eina_list_free(wd->selected);
3804 wd->selected = NULL;
3806 if (wd->item_moving_effect_timer)
3808 ecore_animator_del(wd->item_moving_effect_timer);
3809 wd->item_moving_effect_timer = NULL;
3811 wd->show_item = NULL;
3818 evas_object_del(wd->alpha_bg);
3819 wd->alpha_bg = NULL;
3823 evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
3824 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
3827 evas_event_thaw(evas_object_evas_get(wd->obj));
3828 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3832 elm_genlist_multi_select_set(Evas_Object *obj,
3835 ELM_CHECK_WIDTYPE(obj, widtype);
3836 Widget_Data *wd = elm_widget_data_get(obj);
3842 elm_genlist_multi_select_get(const Evas_Object *obj)
3844 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3845 Widget_Data *wd = elm_widget_data_get(obj);
3846 if (!wd) return EINA_FALSE;
3850 EAPI Elm_Genlist_Item *
3851 elm_genlist_selected_item_get(const Evas_Object *obj)
3853 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3854 Widget_Data *wd = elm_widget_data_get(obj);
3855 if (!wd) return NULL;
3856 if (wd->selected) return wd->selected->data;
3860 EAPI const Eina_List *
3861 elm_genlist_selected_items_get(const Evas_Object *obj)
3863 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3864 Widget_Data *wd = elm_widget_data_get(obj);
3865 if (!wd) return NULL;
3866 return wd->selected;
3870 elm_genlist_realized_items_get(const Evas_Object *obj)
3872 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3873 Widget_Data *wd = elm_widget_data_get(obj);
3874 Eina_List *list = NULL;
3876 Eina_Bool done = EINA_FALSE;
3877 if (!wd) return NULL;
3878 EINA_INLIST_FOREACH(wd->blocks, itb)
3883 Elm_Genlist_Item *it;
3886 EINA_LIST_FOREACH(itb->items, l, it)
3888 if (it->realized) list = eina_list_append(list, it);
3899 EAPI Elm_Genlist_Item *
3900 elm_genlist_at_xy_item_get(const Evas_Object *obj,
3905 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3906 Widget_Data *wd = elm_widget_data_get(obj);
3907 Evas_Coord ox, oy, ow, oh;
3910 if (!wd) return NULL;
3911 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
3913 EINA_INLIST_FOREACH(wd->blocks, itb)
3916 Elm_Genlist_Item *it;
3918 if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
3919 oy + itb->y - itb->wd->pan_y,
3920 itb->w, itb->h, x, y, 1, 1))
3922 EINA_LIST_FOREACH(itb->items, l, it)
3924 Evas_Coord itx, ity;
3926 itx = ox + itb->x + it->x - itb->wd->pan_x;
3927 ity = oy + itb->y + it->y - itb->wd->pan_y;
3928 if (ELM_RECTS_INTERSECT(itx, ity, it->w, it->h, x, y, 1, 1))
3932 if (y <= (ity + (it->h / 4))) *posret = -1;
3933 else if (y >= (ity + it->h - (it->h / 4)))
3939 lasty = ity + it->h;
3944 if (y > lasty) *posret = 1;
3950 EAPI Elm_Genlist_Item *
3951 elm_genlist_first_item_get(const Evas_Object *obj)
3953 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3954 Widget_Data *wd = elm_widget_data_get(obj);
3955 if (!wd) return NULL;
3956 if (!wd->items) return NULL;
3957 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
3958 while ((it) && (it->delete_me))
3959 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3963 EAPI Elm_Genlist_Item *
3964 elm_genlist_last_item_get(const Evas_Object *obj)
3966 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3967 Widget_Data *wd = elm_widget_data_get(obj);
3968 if (!wd) return NULL;
3969 if (!wd->items) return NULL;
3970 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
3971 while ((it) && (it->delete_me))
3972 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3976 EAPI Elm_Genlist_Item *
3977 elm_genlist_item_next_get(const Elm_Genlist_Item *it)
3979 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3982 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3983 if ((it) && (!it->delete_me)) break;
3985 return (Elm_Genlist_Item *)it;
3988 EAPI Elm_Genlist_Item *
3989 elm_genlist_item_prev_get(const Elm_Genlist_Item *it)
3991 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3994 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3995 if ((it) && (!it->delete_me)) break;
3997 return (Elm_Genlist_Item *)it;
4001 elm_genlist_item_genlist_get(const Elm_Genlist_Item *it)
4003 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4004 return it->base.widget;
4007 EAPI Elm_Genlist_Item *
4008 elm_genlist_item_parent_get(const Elm_Genlist_Item *it)
4010 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4015 elm_genlist_item_subitems_clear(Elm_Genlist_Item *it)
4017 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4018 Elm_Genlist_Item *it2;
4021 if (!it->wd->effect_mode || !it->wd->move_effect_mode)
4022 _item_subitems_clear(it);
4025 if ((!it->wd->item_moving_effect_timer) && (it->flags != ELM_GENLIST_ITEM_GROUP) &&
4026 it->wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE )
4028 it->wd->expand_item = it;
4029 _item_flip_effect_show(it);
4030 evas_object_geometry_get(it->base.view, NULL, &y, NULL, &h);
4031 it->wd->expand_item_end = y + h;
4035 it2 = elm_genlist_item_next_get(it2);
4037 } while (it2->expanded_depth > it->expanded_depth);
4039 it->wd->expand_item_gap = it->wd->expand_item_end - it2->old_scrl_y;
4041 it->wd->expand_item_gap = 0;
4043 evas_object_raise(it->wd->alpha_bg);
4044 evas_object_show(it->wd->alpha_bg);
4046 it->wd->start_time = current_time_get();
4047 it->wd->item_moving_effect_timer = ecore_animator_add(_item_moving_effect_timer_cb, it->wd);
4050 _item_subitems_clear(it);
4055 elm_genlist_item_selected_set(Elm_Genlist_Item *it,
4058 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4059 Widget_Data *wd = elm_widget_data_get(it->base.widget);
4061 if ((it->delete_me) || (it->disabled)) return;
4062 selected = !!selected;
4063 if (it->selected == selected) return;
4069 while (wd->selected)
4070 _item_unselect(wd->selected->data);
4072 _item_highlight(it);
4080 elm_genlist_item_selected_get(const Elm_Genlist_Item *it)
4082 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4083 return it->selected;
4087 elm_genlist_item_expanded_set(Elm_Genlist_Item *it,
4090 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4091 if (it->flags != ELM_GENLIST_ITEM_SUBITEMS) return;
4092 if (it->expanded == expanded) return;
4093 it->expanded = expanded;
4094 it->wd->expand_item = it;
4096 if (it->wd->effect_mode && !it->wd->alpha_bg)
4097 it->wd->alpha_bg = _create_tray_alpha_bg(it->base.widget);
4101 it->wd->auto_scrolled = EINA_FALSE;
4102 it->wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND;
4104 edje_object_signal_emit(it->base.view, "elm,state,expanded", "elm");
4105 evas_object_smart_callback_call(it->base.widget, "expanded", it);
4109 it->wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT;
4111 edje_object_signal_emit(it->base.view, "elm,state,contracted", "elm");
4112 evas_object_smart_callback_call(it->base.widget, "contracted", it);
4117 elm_genlist_item_expanded_get(const Elm_Genlist_Item *it)
4119 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4120 return it->expanded;
4124 elm_genlist_item_expanded_depth_get(const Elm_Genlist_Item *it)
4126 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, 0);
4127 return it->expanded_depth;
4131 elm_genlist_item_disabled_set(Elm_Genlist_Item *it,
4134 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4137 if (it->disabled == disabled) return;
4138 if (it->delete_me) return;
4139 it->disabled = disabled;
4141 elm_genlist_item_selected_set(it, EINA_FALSE);
4146 edje_object_signal_emit(it->base.view, "elm,state,disabled", "elm");
4148 edje_object_signal_emit(it->edit_obj, "elm,state,disabled", "elm");
4152 edje_object_signal_emit(it->base.view, "elm,state,enabled", "elm");
4154 edje_object_signal_emit(it->edit_obj, "elm,state,enabled", "elm");
4156 EINA_LIST_FOREACH(it->icon_objs, l, obj)
4157 elm_widget_disabled_set(obj, disabled);
4162 elm_genlist_item_disabled_get(const Elm_Genlist_Item *it)
4164 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4165 if (it->delete_me) return EINA_FALSE;
4166 return it->disabled;
4170 elm_genlist_item_display_only_set(Elm_Genlist_Item *it,
4171 Eina_Bool display_only)
4173 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4174 if (it->display_only == display_only) return;
4175 if (it->delete_me) return;
4176 it->display_only = display_only;
4177 it->mincalcd = EINA_FALSE;
4178 it->updateme = EINA_TRUE;
4179 if (it->block) it->block->updateme = EINA_TRUE;
4180 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4181 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4185 elm_genlist_item_display_only_get(const Elm_Genlist_Item *it)
4187 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4188 if (it->delete_me) return EINA_FALSE;
4189 return it->display_only;
4193 elm_genlist_item_show(Elm_Genlist_Item *it)
4195 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4196 Evas_Coord gith = 0;
4197 if (it->delete_me) return;
4198 if ((it->queued) || (!it->mincalcd))
4200 it->wd->show_item = it;
4201 it->wd->bring_in = EINA_TRUE;
4202 it->showme = EINA_TRUE;
4205 if (it->wd->show_item)
4207 it->wd->show_item->showme = EINA_FALSE;
4208 it->wd->show_item = NULL;
4210 if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
4211 gith = it->group_item->h;
4212 elm_smart_scroller_child_region_show(it->wd->scr,
4213 it->x + it->block->x,
4214 it->y + it->block->y - gith,
4215 it->block->w, it->h);
4219 elm_genlist_item_bring_in(Elm_Genlist_Item *it)
4221 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4222 Evas_Coord gith = 0;
4223 if (it->delete_me) return;
4224 if ((it->queued) || (!it->mincalcd))
4226 it->wd->show_item = it;
4227 it->wd->bring_in = EINA_TRUE;
4228 it->showme = EINA_TRUE;
4231 if (it->wd->show_item)
4233 it->wd->show_item->showme = EINA_FALSE;
4234 it->wd->show_item = NULL;
4236 if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
4237 gith = it->group_item->h;
4238 elm_smart_scroller_region_bring_in(it->wd->scr,
4239 it->x + it->block->x,
4240 it->y + it->block->y - gith,
4241 it->block->w, it->h);
4245 elm_genlist_item_top_show(Elm_Genlist_Item *it)
4247 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4249 Evas_Coord gith = 0;
4251 if (it->delete_me) return;
4252 if ((it->queued) || (!it->mincalcd))
4254 it->wd->show_item = it;
4255 it->wd->bring_in = EINA_TRUE;
4256 it->showme = EINA_TRUE;
4259 if (it->wd->show_item)
4261 it->wd->show_item->showme = EINA_FALSE;
4262 it->wd->show_item = NULL;
4264 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4265 if (it->group_item) gith = it->group_item->h;
4266 elm_smart_scroller_child_region_show(it->wd->scr,
4267 it->x + it->block->x,
4268 it->y + it->block->y - gith,
4273 elm_genlist_item_top_bring_in(Elm_Genlist_Item *it)
4275 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4277 Evas_Coord gith = 0;
4279 if (it->delete_me) return;
4280 if ((it->queued) || (!it->mincalcd))
4282 it->wd->show_item = it;
4283 it->wd->bring_in = EINA_TRUE;
4284 it->showme = EINA_TRUE;
4287 if (it->wd->show_item)
4289 it->wd->show_item->showme = EINA_FALSE;
4290 it->wd->show_item = NULL;
4292 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4293 if (it->group_item) gith = it->group_item->h;
4294 elm_smart_scroller_region_bring_in(it->wd->scr,
4295 it->x + it->block->x,
4296 it->y + it->block->y - gith,
4301 elm_genlist_item_middle_show(Elm_Genlist_Item *it)
4303 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4306 if (it->delete_me) return;
4307 if ((it->queued) || (!it->mincalcd))
4309 it->wd->show_item = it;
4310 it->wd->bring_in = EINA_TRUE;
4311 it->showme = EINA_TRUE;
4314 if (it->wd->show_item)
4316 it->wd->show_item->showme = EINA_FALSE;
4317 it->wd->show_item = NULL;
4319 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4320 elm_smart_scroller_child_region_show(it->wd->scr,
4321 it->x + it->block->x,
4322 it->y + it->block->y - oh / 2 +
4323 it->h / 2, it->block->w, oh);
4327 elm_genlist_item_middle_bring_in(Elm_Genlist_Item *it)
4329 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4332 if (it->delete_me) return;
4333 if ((it->queued) || (!it->mincalcd))
4335 it->wd->show_item = it;
4336 it->wd->bring_in = EINA_TRUE;
4337 it->showme = EINA_TRUE;
4340 if (it->wd->show_item)
4342 it->wd->show_item->showme = EINA_FALSE;
4343 it->wd->show_item = NULL;
4345 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4346 elm_smart_scroller_region_bring_in(it->wd->scr,
4347 it->x + it->block->x,
4348 it->y + it->block->y - oh / 2 + it->h / 2,
4353 elm_genlist_item_del(Elm_Genlist_Item *it)
4355 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4356 if ((it->relcount > 0) || (it->walking > 0))
4358 elm_widget_item_pre_notify_del(it);
4359 elm_genlist_item_subitems_clear(it);
4360 it->delete_me = EINA_TRUE;
4361 if (it->wd->show_item == it) it->wd->show_item = NULL;
4363 it->wd->selected = eina_list_remove(it->wd->selected,
4367 if (it->realized) _item_unrealize(it, EINA_FALSE);
4368 it->block->changed = EINA_TRUE;
4369 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
4370 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
4372 if (it->itc->func.del)
4373 it->itc->func.del((void *)it->base.data, it->base.widget);
4380 elm_genlist_item_data_set(Elm_Genlist_Item *it,
4383 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4384 elm_widget_item_data_set(it, data);
4385 elm_genlist_item_update(it);
4389 elm_genlist_item_data_get(const Elm_Genlist_Item *it)
4391 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4392 return elm_widget_item_data_get(it);
4396 elm_genlist_item_icons_orphan(Elm_Genlist_Item *it)
4399 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4400 EINA_LIST_FREE(it->icon_objs, icon)
4402 elm_widget_sub_object_del(it->base.widget, icon);
4403 evas_object_smart_member_del(icon);
4404 evas_object_hide(icon);
4408 EAPI const Evas_Object *
4409 elm_genlist_item_object_get(const Elm_Genlist_Item *it)
4411 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4412 return it->base.view;
4416 elm_genlist_item_update(Elm_Genlist_Item *it)
4418 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4419 if (!it->block) return;
4420 if (it->delete_me) return;
4421 it->mincalcd = EINA_FALSE;
4422 it->updateme = EINA_TRUE;
4423 it->block->updateme = EINA_TRUE;
4424 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4425 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4429 elm_genlist_item_item_class_update(Elm_Genlist_Item *it,
4430 const Elm_Genlist_Item_Class *itc)
4432 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4433 if (!it->block) return;
4434 EINA_SAFETY_ON_NULL_RETURN(itc);
4435 if (it->delete_me) return;
4437 it->nocache = EINA_TRUE;
4438 elm_genlist_item_update(it);
4441 EAPI const Elm_Genlist_Item_Class *
4442 elm_genlist_item_item_class_get(const Elm_Genlist_Item *it)
4444 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4445 if (it->delete_me) return NULL;
4448 static Evas_Object *
4449 _elm_genlist_item_label_create(void *data,
4451 void *item __UNUSED__)
4453 Evas_Object *label = elm_label_add(obj);
4456 elm_object_style_set(label, "tooltip");
4457 elm_object_text_set(label, data);
4462 _elm_genlist_item_label_del_cb(void *data,
4463 Evas_Object *obj __UNUSED__,
4464 void *event_info __UNUSED__)
4466 eina_stringshare_del(data);
4470 elm_genlist_item_tooltip_text_set(Elm_Genlist_Item *item,
4473 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4474 text = eina_stringshare_add(text);
4475 elm_genlist_item_tooltip_content_cb_set(item, _elm_genlist_item_label_create,
4477 _elm_genlist_item_label_del_cb);
4481 elm_genlist_item_tooltip_content_cb_set(Elm_Genlist_Item *item,
4482 Elm_Tooltip_Item_Content_Cb func,
4484 Evas_Smart_Cb del_cb)
4486 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(item, error);
4488 if ((item->tooltip.content_cb == func) && (item->tooltip.data == data))
4491 if (item->tooltip.del_cb)
4492 item->tooltip.del_cb((void *)item->tooltip.data,
4493 item->base.widget, item);
4495 item->tooltip.content_cb = func;
4496 item->tooltip.data = data;
4497 item->tooltip.del_cb = del_cb;
4499 if (item->base.view)
4501 elm_widget_item_tooltip_content_cb_set(item,
4502 item->tooltip.content_cb,
4503 item->tooltip.data, NULL);
4504 elm_widget_item_tooltip_style_set(item, item->tooltip.style);
4510 if (del_cb) del_cb((void *)data, NULL, NULL);
4514 elm_genlist_item_tooltip_unset(Elm_Genlist_Item *item)
4516 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4517 if ((item->base.view) && (item->tooltip.content_cb))
4518 elm_widget_item_tooltip_unset(item);
4520 if (item->tooltip.del_cb)
4521 item->tooltip.del_cb((void *)item->tooltip.data, item->base.widget, item);
4522 item->tooltip.del_cb = NULL;
4523 item->tooltip.content_cb = NULL;
4524 item->tooltip.data = NULL;
4525 if (item->tooltip.style)
4526 elm_genlist_item_tooltip_style_set(item, NULL);
4530 elm_genlist_item_tooltip_style_set(Elm_Genlist_Item *item,
4533 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4534 eina_stringshare_replace(&item->tooltip.style, style);
4535 if (item->base.view) elm_widget_item_tooltip_style_set(item, style);
4539 elm_genlist_item_tooltip_style_get(const Elm_Genlist_Item *item)
4541 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4542 return item->tooltip.style;
4546 elm_genlist_item_cursor_set(Elm_Genlist_Item *item,
4549 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4550 eina_stringshare_replace(&item->mouse_cursor, cursor);
4551 if (item->base.view) elm_widget_item_cursor_set(item, cursor);
4555 elm_genlist_item_cursor_get(const Elm_Genlist_Item *item)
4557 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4558 return elm_widget_item_cursor_get(item);
4562 elm_genlist_item_cursor_unset(Elm_Genlist_Item *item)
4564 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4565 if (!item->mouse_cursor)
4568 if (item->base.view)
4569 elm_widget_item_cursor_unset(item);
4571 eina_stringshare_del(item->mouse_cursor);
4572 item->mouse_cursor = NULL;
4576 elm_genlist_item_cursor_style_set(Elm_Genlist_Item *item,
4579 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4580 elm_widget_item_cursor_style_set(item, style);
4584 elm_genlist_item_cursor_style_get(const Elm_Genlist_Item *item)
4586 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4587 return elm_widget_item_cursor_style_get(item);
4591 elm_genlist_item_cursor_engine_only_set(Elm_Genlist_Item *item,
4592 Eina_Bool engine_only)
4594 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4595 elm_widget_item_cursor_engine_only_set(item, engine_only);
4599 elm_genlist_item_cursor_engine_only_get(const Elm_Genlist_Item *item)
4601 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
4602 return elm_widget_item_cursor_engine_only_get(item);
4606 elm_genlist_horizontal_mode_set(Evas_Object *obj,
4609 ELM_CHECK_WIDTYPE(obj, widtype);
4610 Widget_Data *wd = elm_widget_data_get(obj);
4612 if (wd->mode == mode) return;
4618 elm_genlist_horizontal_mode_get(const Evas_Object *obj)
4620 ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
4621 Widget_Data *wd = elm_widget_data_get(obj);
4622 if (!wd) return ELM_LIST_LAST;
4627 elm_genlist_always_select_mode_set(Evas_Object *obj,
4628 Eina_Bool always_select)
4630 ELM_CHECK_WIDTYPE(obj, widtype);
4631 Widget_Data *wd = elm_widget_data_get(obj);
4633 wd->always_select = always_select;
4637 elm_genlist_always_select_mode_get(const Evas_Object *obj)
4639 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4640 Widget_Data *wd = elm_widget_data_get(obj);
4641 if (!wd) return EINA_FALSE;
4642 return wd->always_select;
4646 elm_genlist_no_select_mode_set(Evas_Object *obj,
4647 Eina_Bool no_select)
4649 ELM_CHECK_WIDTYPE(obj, widtype);
4650 Widget_Data *wd = elm_widget_data_get(obj);
4652 wd->no_select = no_select;
4656 elm_genlist_no_select_mode_get(const Evas_Object *obj)
4658 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4659 Widget_Data *wd = elm_widget_data_get(obj);
4660 if (!wd) return EINA_FALSE;
4661 return wd->no_select;
4665 elm_genlist_compress_mode_set(Evas_Object *obj,
4668 ELM_CHECK_WIDTYPE(obj, widtype);
4669 Widget_Data *wd = elm_widget_data_get(obj);
4671 wd->compress = compress;
4675 elm_genlist_compress_mode_get(const Evas_Object *obj)
4677 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4678 Widget_Data *wd = elm_widget_data_get(obj);
4679 if (!wd) return EINA_FALSE;
4680 return wd->compress;
4684 elm_genlist_height_for_width_mode_set(Evas_Object *obj,
4685 Eina_Bool height_for_width)
4687 ELM_CHECK_WIDTYPE(obj, widtype);
4688 Widget_Data *wd = elm_widget_data_get(obj);
4690 wd->height_for_width = !!height_for_width;
4691 if (wd->height_for_width)
4693 elm_genlist_homogeneous_set(obj, EINA_FALSE);
4694 elm_genlist_compress_mode_set(obj, EINA_TRUE);
4699 elm_genlist_height_for_width_mode_get(const Evas_Object *obj)
4701 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4702 Widget_Data *wd = elm_widget_data_get(obj);
4703 if (!wd) return EINA_FALSE;
4704 return wd->height_for_width;
4708 elm_genlist_bounce_set(Evas_Object *obj,
4712 ELM_CHECK_WIDTYPE(obj, widtype);
4713 Widget_Data *wd = elm_widget_data_get(obj);
4715 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
4719 elm_genlist_bounce_get(const Evas_Object *obj,
4720 Eina_Bool *h_bounce,
4721 Eina_Bool *v_bounce)
4723 ELM_CHECK_WIDTYPE(obj, widtype);
4724 Widget_Data *wd = elm_widget_data_get(obj);
4726 elm_smart_scroller_bounce_allow_get(obj, h_bounce, v_bounce);
4730 elm_genlist_homogeneous_set(Evas_Object *obj,
4731 Eina_Bool homogeneous)
4733 ELM_CHECK_WIDTYPE(obj, widtype);
4734 Widget_Data *wd = elm_widget_data_get(obj);
4736 if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
4737 wd->homogeneous = homogeneous;
4741 elm_genlist_homogeneous_get(const Evas_Object *obj)
4743 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4744 Widget_Data *wd = elm_widget_data_get(obj);
4745 if (!wd) return EINA_FALSE;
4746 return wd->homogeneous;
4750 elm_genlist_block_count_set(Evas_Object *obj,
4753 ELM_CHECK_WIDTYPE(obj, widtype);
4754 Widget_Data *wd = elm_widget_data_get(obj);
4756 wd->max_items_per_block = n;
4757 wd->item_cache_max = wd->max_items_per_block * 2;
4758 _item_cache_clean(wd);
4762 elm_genlist_block_count_get(const Evas_Object *obj)
4764 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4765 Widget_Data *wd = elm_widget_data_get(obj);
4767 return wd->max_items_per_block;
4771 elm_genlist_longpress_timeout_set(Evas_Object *obj,
4774 ELM_CHECK_WIDTYPE(obj, widtype);
4775 Widget_Data *wd = elm_widget_data_get(obj);
4777 wd->longpress_timeout = timeout;
4781 elm_genlist_longpress_timeout_get(const Evas_Object *obj)
4783 ELM_CHECK_WIDTYPE(obj, widtype) 0;
4784 Widget_Data *wd = elm_widget_data_get(obj);
4786 return wd->longpress_timeout;
4790 elm_genlist_scroller_policy_set(Evas_Object *obj,
4791 Elm_Scroller_Policy policy_h,
4792 Elm_Scroller_Policy policy_v)
4794 ELM_CHECK_WIDTYPE(obj, widtype);
4795 Widget_Data *wd = elm_widget_data_get(obj);
4797 if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
4798 (policy_v >= ELM_SCROLLER_POLICY_LAST))
4801 elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
4805 elm_genlist_scroller_policy_get(const Evas_Object *obj,
4806 Elm_Scroller_Policy *policy_h,
4807 Elm_Scroller_Policy *policy_v)
4809 ELM_CHECK_WIDTYPE(obj, widtype);
4810 Widget_Data *wd = elm_widget_data_get(obj);
4811 Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
4812 if ((!wd) || (!wd->scr)) return;
4813 elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
4814 if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
4815 if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
4819 elm_genlist_realized_items_update(Evas_Object *obj)
4821 ELM_CHECK_WIDTYPE(obj, widtype);
4823 Eina_List *list, *l;
4824 Elm_Genlist_Item *it;
4826 list = elm_genlist_realized_items_get(obj);
4827 EINA_LIST_FOREACH(list, l, it)
4828 elm_genlist_item_update(it);
4832 * Set genlist item mode
4834 * @param item The genlist item
4835 * @param mode Mode name
4836 * @param mode_set Boolean to define set or unset mode.
4841 elm_genlist_item_mode_set(Elm_Genlist_Item *it,
4842 const char *mode_type,
4845 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4846 Widget_Data *wd = it->wd;
4848 Elm_Genlist_Item *it2;
4851 if (!mode_type) return;
4852 if ((it->delete_me) || (it->disabled)) return;
4853 if (wd->edit_mode) return;
4855 if ((wd->mode_item == it) &&
4856 (!strcmp(mode_type, wd->mode_type)) &&
4859 if (!it->itc->mode_item_style) return;
4863 EINA_LIST_FOREACH(wd->selected, l, it2)
4865 elm_genlist_item_selected_set(it2, EINA_FALSE);
4869 it2 = elm_genlist_selected_item_get(wd->obj);
4870 if ((it2) && (it2->realized))
4871 elm_genlist_item_selected_set(it2, EINA_FALSE);
4874 if (((wd->mode_type) && (strcmp(mode_type, wd->mode_type))) ||
4876 ((it == wd->mode_item) && (!mode_set)))
4877 _item_mode_unset(wd);
4879 eina_stringshare_replace(&wd->mode_type, mode_type);
4880 if (mode_set) _item_mode_set(it);
4884 * Get active genlist mode type
4886 * @param obj The genlist object
4891 elm_genlist_mode_get(const Evas_Object *obj)
4893 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4894 Widget_Data *wd = elm_widget_data_get(obj);
4895 if (!wd) return NULL;
4896 return wd->mode_type;
4900 * Get active genlist mode item
4902 * @param obj The genlist object
4906 EAPI const Elm_Genlist_Item *
4907 elm_genlist_mode_item_get(const Evas_Object *obj)
4909 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4910 Widget_Data *wd = elm_widget_data_get(obj);
4911 if (!wd) return NULL;
4912 return wd->mode_item;
4918 * @param obj The genlist object
4919 * @param reorder_mode The reorder mode
4920 * (EINA_TRUE = on, EINA_FALSE = off)
4925 elm_genlist_reorder_mode_set(Evas_Object *obj,
4926 Eina_Bool reorder_mode)
4928 ELM_CHECK_WIDTYPE(obj, widtype);
4929 Widget_Data *wd = elm_widget_data_get(obj);
4931 wd->reorder_mode = reorder_mode;
4935 * Get the reorder mode
4937 * @param obj The genlist object
4938 * @return The reorder mode
4939 * (EINA_TRUE = on, EINA_FALSE = off)
4944 elm_genlist_reorder_mode_get(const Evas_Object *obj)
4946 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4947 Widget_Data *wd = elm_widget_data_get(obj);
4948 if (!wd) return EINA_FALSE;
4949 return wd->reorder_mode;
4953 elm_genlist_item_move_after(Elm_Genlist_Item *it __UNUSED__, Elm_Genlist_Item *after __UNUSED__)
4959 elm_genlist_item_move_before(Elm_Genlist_Item *it __UNUSED__, Elm_Genlist_Item *before __UNUSED__)
4965 _effect_item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after)
4970 // printf("MOVE AFTER : it = %d after = %d \n", it->num, after->num);
4971 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
4972 it->wd->reorder_deleted = EINA_TRUE;
4973 _item_block_del(it);
4975 it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
4977 it->rel->relcount++;
4978 it->before = EINA_FALSE;
4979 _item_queue(it->wd, it);
4981 if (it->itc->func.moved)
4982 it->itc->func.moved(it->base.widget, it, after, EINA_TRUE);
4986 _effect_item_move_before(Elm_Genlist_Item *it, Elm_Genlist_Item *before)
4989 if (!before) return;
4991 // printf("MOVE BEFORE : it = %d before = %d \n", it->num, before->num);
4992 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
4993 it->wd->reorder_deleted = EINA_TRUE;
4994 _item_block_del(it);
4995 it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
4997 it->rel->relcount++;
4998 it->before = EINA_TRUE;
4999 _item_queue(it->wd, it);
5001 if (it->itc->func.moved)
5002 it->itc->func.moved(it->base.widget, it, before, EINA_FALSE);
5006 elm_genlist_effect_set(const Evas_Object *obj, Eina_Bool emode)
5008 ELM_CHECK_WIDTYPE(obj, widtype);
5009 Widget_Data *wd = elm_widget_data_get(obj);
5011 wd->effect_mode = emode;
5012 // wd->point_rect = evas_object_rectangle_add(evas_object_evas_get(wd->obj));
5013 // evas_object_resize(wd->point_rect, 10, 25);
5014 // evas_object_color_set(wd->point_rect, 255, 0, 0, 130);
5015 // evas_object_show(wd->point_rect);
5016 // evas_object_hide(wd->point_rect);
5020 _create_tray_alpha_bg(const Evas_Object *obj)
5022 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5023 Widget_Data *wd = elm_widget_data_get(obj);
5024 if (!wd) return NULL;
5026 Evas_Object *bg = NULL;
5027 Evas_Coord ox, oy, ow, oh;
5029 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
5030 bg = evas_object_rectangle_add(evas_object_evas_get(wd->obj));
5031 evas_object_color_set(bg,0,0,0,0);
5032 evas_object_resize(bg , ow, oh);
5033 evas_object_move(bg , ox, oy);
5034 evas_object_show(bg);
5035 evas_object_hide(bg);
5042 struct timeval timev;
5044 gettimeofday(&timev, NULL);
5045 return ((timev.tv_sec * 1000) + ((timev.tv_usec) / 1000));
5048 // added for item moving animation.
5050 _item_moving_effect_timer_cb(void *data)
5052 Widget_Data *wd = data;
5053 if (!wd) return EINA_FALSE;
5055 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
5056 Elm_Genlist_Item *it = NULL, *it2;
5058 double time = 0.3, t;
5060 Eina_Bool check, end = EINA_FALSE;
5063 t = ((0.0 > (t = current_time_get() - wd->start_time)) ? 0.0 : t) / 1000;
5065 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
5066 evas_output_viewport_get(evas_object_evas_get(wd->pan_smart), &cvx, &cvy, &cvw, &cvh);
5067 if (t > time) end = EINA_TRUE;
5069 it2 = elm_genlist_item_next_get(wd->expand_item);
5072 if (wd->expand_item->expanded_depth >= it2->expanded_depth) break;
5073 it2 = elm_genlist_item_next_get(it2);
5078 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5079 dy = it2->scrl_y - it2->old_scrl_y;
5080 else if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5081 dy = wd->expand_item_gap;
5085 y = ((1 - (1 - (t / time)) * (1 - (t /time))) * dy);
5094 EINA_INLIST_FOREACH(wd->blocks, itb)
5097 if (ELM_RECTS_INTERSECT(itb->x - wd->pan_x + ox,
5098 itb->y - wd->pan_y + oy,
5100 cvx, cvy, cvw, cvh))
5102 EINA_LIST_FOREACH(itb->items, l, it)
5104 if (it == it2) check = EINA_TRUE;
5105 if (!check) continue;
5107 if (!it->old_scrl_y)
5108 it->old_scrl_y = it->scrl_y;
5109 if (it->old_scrl_y + y < oy + oh)
5111 if (!it->realized) _item_realize(it, in, 0);
5113 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE && it->old_scrl_y + y < it->scrl_y)
5114 it->old_scrl_y = it->scrl_y - y;
5117 if (wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE ||
5118 (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE && it->old_scrl_y + y >= it->scrl_y))
5120 if (wd->edit_mode) _effect_item_controls(it, it->scrl_x, it->old_scrl_y + y);
5123 evas_object_resize(it->base.view, it->w, it->h);
5124 evas_object_move(it->base.view, it->scrl_x, it->old_scrl_y + y);
5125 evas_object_show(it->base.view);
5126 evas_object_raise(it->base.view);
5129 if (it->group_item) evas_object_raise(it->group_item->base.view);
5135 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5137 it = elm_genlist_item_prev_get(it2);
5140 if (it->expanded_depth <= it2->expanded_depth) break;
5141 if ((it->scrl_y < it2->old_scrl_y + y) && (it->expanded_depth > it2->expanded_depth))
5143 if (!it->effect_done)
5145 edje_object_signal_emit(it->base.view, "flip_item", "");
5146 evas_object_show(it->base.view);
5147 it->effect_done = EINA_TRUE;
5150 it = elm_genlist_item_prev_get(it);
5153 else if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5155 it = elm_genlist_item_prev_get(it2);
5158 if ((it->scrl_y > it2->old_scrl_y + y) && (it->expanded_depth > it2->expanded_depth))
5160 if (!it->effect_done)
5162 edje_object_signal_emit(it->base.view, "elm,state,hide", "");
5163 it->effect_done = EINA_TRUE;
5168 it = elm_genlist_item_prev_get(it);
5175 int expand_order = 0;
5176 if (wd->expand_item) it = elm_genlist_item_next_get(wd->expand_item);
5180 it = elm_genlist_item_next_get(it);
5182 if (wd->expand_item) it = elm_genlist_item_next_get(wd->expand_item);
5186 if (wd->expand_item->expanded_depth >= it->expanded_depth) break;
5187 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5189 if (!it->effect_done)
5191 if (t >= (((expand_order - 1) * time) / expand_num))
5193 edje_object_signal_emit(it->base.view, "flip_item", "");
5194 evas_object_show(it->base.view);
5195 it->effect_done = EINA_TRUE;
5199 it = elm_genlist_item_next_get(it);
5205 if (wd->item_moving_effect_timer)
5207 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5208 _item_subitems_clear(wd->expand_item);
5209 EINA_INLIST_FOREACH(wd->blocks, itb)
5211 EINA_LIST_FOREACH(itb->items, l, it)
5213 it->effect_done = EINA_TRUE;
5214 it->old_scrl_y = it->scrl_y;
5218 wd->item_moving_effect_timer = NULL;
5220 _item_auto_scroll(wd);
5221 evas_object_lower(wd->alpha_bg);
5222 evas_object_hide(wd->alpha_bg);
5223 if (wd->calc_job) ecore_job_del(wd->calc_job);
5224 wd->calc_job = ecore_job_add(_calc_job, wd);
5225 elm_smart_scroller_bounce_animator_disabled_set(wd->scr, EINA_FALSE);
5226 wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_NONE;
5228 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
5229 evas_object_smart_callback_call(wd->obj, "effect_done", NULL);
5230 return ECORE_CALLBACK_CANCEL;
5232 return ECORE_CALLBACK_RENEW;
5236 _emit_contract(Elm_Genlist_Item *it)
5238 Elm_Genlist_Item *it2;
5241 // printf("%p is emited contract\n", it);
5242 edje_object_signal_emit(it->base.view, "elm,state,contract_flip", "");
5243 it->effect_done = EINA_FALSE;
5245 EINA_LIST_FOREACH(it->items, l, it2)
5247 _emit_contract(it2);
5250 // added for item moving animation.
5252 _item_flip_effect_show(Elm_Genlist_Item *it)
5254 Elm_Genlist_Item *it2;
5256 Widget_Data *wd = it->wd;
5257 Eina_Bool check = EINA_FALSE;
5259 it2 = elm_genlist_item_next_get(it);
5262 if (it2->expanded_depth <= it->expanded_depth) check = EINA_TRUE;
5263 it2 = elm_genlist_item_next_get(it2);
5265 EINA_LIST_FOREACH(it->items, l, it2)
5267 if (it2->parent && it == it2->parent)
5269 if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5270 edje_object_signal_emit(it2->base.view, "elm,state,hide", "");
5271 else if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5272 _emit_contract(it2);
5276 return ECORE_CALLBACK_CANCEL;
5281 _elm_genlist_pinch_zoom_execute(Evas_Object *obj, Eina_Bool emode)
5283 printf("!!! NOW FIXING \n");
5288 * Set pinch zoom mode
5290 * @param obj The genlist object
5292 * (EINA_TRUE = pinch contract (zoom in), EINA_FALSE = pinch expand (zoom out)
5297 elm_genlist_pinch_zoom_mode_set(Evas_Object *obj __UNUSED__, Eina_Bool emode __UNUSED__)
5299 printf("!!! NOW FIXING \n");
5303 * Get pinch zoom mode
5305 * @param obj The genlist object
5306 * @return The pinch mode
5307 * (EINA_TRUE = pinch contract (zoom in), EINA_FALSE = pinch expand (zoom out)
5312 elm_genlist_pinch_zoom_mode_get(const Evas_Object *obj __UNUSED__)
5314 printf("!!! NOW FIXING \n");
5319 elm_genlist_pinch_zoom_set(Evas_Object *obj __UNUSED__, Eina_Bool emode __UNUSED__)
5321 printf("!!! NOW FIXING \n");
5325 ////////////////////////////////////////////////////////////////////////
5327 ////////////////////////////////////////////////////////////////////////
5330 _effect_item_controls(Elm_Genlist_Item *it, int itx, int ity)
5332 if (!it->wd->edit_mode) return;
5333 evas_object_resize(it->edit_obj,it->w, it->h);
5334 evas_object_move(it->edit_obj, itx, ity);
5338 _effect_item_realize(Elm_Genlist_Item *it, Eina_Bool effect_on)
5340 if ((it->effect_item_realized) || (it->delete_me)) return;
5344 _mode_finished_signal_cb(it, (Evas_Object *)elm_genlist_item_object_get(it), NULL, NULL);
5346 it->edit_obj = edje_object_add(evas_object_evas_get(it->base.widget));
5347 edje_object_scale_set(it->edit_obj, elm_widget_scale_get(it->base.widget) *
5348 _elm_config->scale);
5349 evas_object_smart_member_add(it->edit_obj, it->wd->pan_smart);
5350 elm_widget_sub_object_add(it->base.widget, it->edit_obj);
5352 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) strncpy(buf, "tree", sizeof(buf));
5353 else strncpy(buf, "item", sizeof(buf));
5354 if (it->wd->compress) strncat(buf, "_compress", sizeof(buf) - strlen(buf));
5356 strncat(buf, "/", sizeof(buf) - strlen(buf));
5358 if (it->itc->edit_item_style && strcmp(it->itc->edit_item_style, "default"))
5360 strncat(buf, it->itc->edit_item_style, sizeof(buf) - strlen(buf));
5361 _elm_theme_object_set(it->base.widget, it->edit_obj, "genlist", buf, elm_widget_style_get(it->base.widget));
5365 _elm_theme_object_set(it->base.widget, it->edit_obj, "genlist", "item/edit_default", elm_widget_style_get(it->base.widget));
5368 if (it->wd->reorder_mode)
5370 if (effect_on) edje_object_signal_emit(it->edit_obj, "elm,state,reorder_enabled_effect", "elm");
5371 else edje_object_signal_emit(it->edit_obj, "elm,state,reorder_enabled", "elm");
5373 if (effect_on) edje_object_signal_emit(it->edit_obj, "elm,state,emode_enabled_effect", "elm");
5374 else edje_object_signal_emit(it->edit_obj, "elm,state,emode_enabled", "elm");
5376 if (it->disabled) edje_object_signal_emit(it->edit_obj, "elm,state,disabled", "elm");
5377 else edje_object_signal_emit(it->edit_obj, "elm,state,enabled", "elm");
5380 if ((it->wd->edit_mode))
5382 if (it->itc->func.icon_get)
5387 it->icons = elm_widget_stringlist_get(edje_object_data_get(it->edit_obj, "edit_icons"));
5388 EINA_LIST_FOREACH(it->icons, l, key)
5390 Evas_Object *ic = it->itc->func.icon_get
5391 ((void *)it->base.data, it->base.widget, l->data);
5395 it->edit_icon_objs = eina_list_append(it->edit_icon_objs, ic);
5396 edje_object_part_swallow(it->edit_obj, key, ic);
5397 evas_object_show(ic);
5398 elm_widget_sub_object_add(it->base.widget, ic);
5400 elm_widget_disabled_set(ic, EINA_TRUE);
5405 edje_object_part_swallow(it->edit_obj, "original_edc", it->base.view);
5406 _effect_item_controls(it,it->scrl_x, it->scrl_y);
5407 evas_object_show(it->edit_obj);
5409 it->effect_item_realized = EINA_TRUE;
5410 it->want_unrealize = EINA_FALSE;
5414 _effect_item_unrealize(Elm_Genlist_Item *it)
5418 if (!it->effect_item_realized) return;
5419 if (it->wd->reorder_it && it->wd->reorder_it == it) return;
5421 edje_object_signal_emit(it->edit_obj, "elm,state,reorder_disable_effect", "elm");
5422 edje_object_signal_emit(it->edit_obj, "elm,state,sel,disable", "elm");
5423 edje_object_message_signal_process(it->edit_obj);
5424 edje_object_part_unswallow(it->edit_obj, it->base.view);
5425 evas_object_smart_member_add(it->base.view, it->wd->pan_smart);
5426 elm_widget_sub_object_add(it->base.widget, it->base.view);
5427 // evas_object_smart_callback_call(it->edit_obj, "unrealized", it);
5428 // _item_cache_add(it);
5429 evas_object_del(it->edit_obj);
5430 it->edit_obj = NULL;
5431 EINA_LIST_FREE(it->edit_icon_objs, icon)
5432 evas_object_del(icon);
5434 // edje_object_signal_emit(it->edit_obj, "elm,state,edit_end,disable", "elm");
5435 it->effect_item_realized = EINA_FALSE;
5439 * Get Genlist edit mode
5441 * @param obj The genlist object
5442 * @return The edit mode status
5443 * (EINA_TRUE = edit mode, EINA_FALSE = normal mode
5448 elm_genlist_edit_mode_get(const Evas_Object *obj)
5450 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5451 Widget_Data *wd = elm_widget_data_get(obj);
5452 if (!wd) return EINA_FALSE;
5454 if (wd->edit_mode) return EINA_TRUE;
5455 else return EINA_FALSE;
5459 * Set Genlist edit mode
5461 * This sets Genlist edit mode.
5463 * @param obj The Genlist object
5464 * @param emode ELM_GENLIST_EDIT_MODE_{NONE & REORDER & INSERT & DELETE & SELECT & SELECT_ALL}
5465 * @param edit_class Genlist edit class (Elm_Genlist_Edit_Class structure)
5470 elm_genlist_edit_mode_set(Evas_Object *obj, Eina_Bool edit_mode)
5472 ELM_CHECK_WIDTYPE(obj, widtype);
5476 Elm_Genlist_Item *it;
5478 Widget_Data *wd = elm_widget_data_get(obj);
5480 if (wd->edit_mode == edit_mode) return;
5482 wd->edit_mode = edit_mode;
5485 EINA_INLIST_FOREACH(wd->blocks, itb)
5489 EINA_LIST_FOREACH(itb->items, l, it)
5491 if (it->flags != ELM_GENLIST_ITEM_GROUP && it->realized)
5493 _effect_item_unrealize(it);
5498 _item_cache_zero(wd);
5503 EINA_INLIST_FOREACH(wd->blocks, itb)
5507 EINA_LIST_FOREACH(itb->items, l, it)
5509 if (it->flags != ELM_GENLIST_ITEM_GROUP && it->realized)
5511 if(it->selected) _item_unselect(it);
5512 if (it->itc->edit_item_style) _effect_item_realize(it, EINA_TRUE);
5519 if (wd->calc_job) ecore_job_del(wd->calc_job);
5520 wd->calc_job = ecore_job_add(_calc_job, wd);
5524 * Set a given item's rename mode
5526 * This renames the item's label from genlist
5528 * @param it The item
5529 * @param renamed set if emode is EINA_TRUE, unset if emode is EINA_FALSE
5534 elm_genlist_item_rename_mode_set(Elm_Genlist_Item *it, Eina_Bool renamed)
5540 _item_unrealize(it, EINA_FALSE);
5541 it->renamed = EINA_TRUE;
5542 it->wd->rename_it = it;
5543 it->nocache = EINA_TRUE;
5544 if (it->selected) _item_unselect(it);
5546 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
5547 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
5553 it->renamed = EINA_FALSE;
5554 it->nocache = EINA_TRUE;
5555 it->wd->rename_it = NULL;
5556 _item_cache_zero(it->wd);
5557 elm_genlist_item_update(it);
5563 elm_genlist_item_rename_mode_get(Elm_Genlist_Item *item)
5565 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
5566 return item->renamed;
5570 _item_auto_scroll(void *data)
5572 Widget_Data *wd = data;
5575 if ((wd->expand_item) && (!wd->auto_scrolled))
5577 Elm_Genlist_Item *it;
5579 Evas_Coord ox, oy, ow, oh;
5580 evas_object_geometry_get(wd->obj, &ox, &oy, &ow, &oh);
5582 wd->auto_scrolled = EINA_TRUE;
5583 if (wd->expand_item->scrl_y > (oh + oy) / 2)
5585 EINA_LIST_FOREACH(wd->expand_item->items, l, it)
5587 elm_genlist_item_bring_in(it);