3 #include <Elementary.h>
4 #include <Elementary_Cursor.h>
8 #define MAX_ITEMS_PER_BLOCK 32
9 #define REORDER_EFFECT_TIME 0.5
12 * @defgroup Genlist Genlist
14 * The aim was to have more expansive list than the simple list in
15 * Elementary that could have more flexible items and allow many more entries
16 * while still being fast and low on memory usage. At the same time it was
17 * also made to be able to do tree structures. But the price to pay is more
18 * complex when it comes to usage. If all you want is a simple list with
19 * icons and a single label, use the normal List object.
21 * Genlist has a fairly large API, mostly because it's relatively complex,
22 * trying to be both expansive, powerful and efficient. First we will begin
23 * an overview on the theory behind genlist.
25 * Evas tracks every object you create. Every time it processes an event
26 * (mouse move, down, up etc.) it needs to walk through objects and find out
27 * what event that affects. Even worse every time it renders display updates,
28 * in order to just calculate what to re-draw, it needs to walk through many
29 * many many objects. Thus, the more objects you keep active, the more
30 * overhead Evas has in just doing its work. It is advisable to keep your
31 * active objects to the minimum working set you need. Also remember that
32 * object creation and deletion carries an overhead, so there is a
33 * middle-ground, which is not easily determined. But don't keep massive lists
34 * of objects you can't see or use. Genlist does this with list objects. It
35 * creates and destroys them dynamically as you scroll around. It groups them
36 * into blocks so it can determine the visibility etc. of a whole block at
37 * once as opposed to having to walk the whole list. This 2-level list allows
38 * for very large numbers of items to be in the list (tests have used up to
39 * 2,000,000 items). Also genlist employs a queue for adding items. As items
40 * may be different sizes, every item added needs to be calculated as to its
41 * size and thus this presents a lot of overhead on populating the list, this
42 * genlist employs a queue. Any item added is queued and spooled off over
43 * time, actually appearing some time later, so if your list has many members
44 * you may find it takes a while for them to all appear, with your process
45 * consuming a lot of CPU while it is busy spooling.
47 * Genlist also implements a tree structure, but it does so with callbacks to
48 * the application, with the application filling in tree structures when
49 * requested (allowing for efficient building of a very deep tree that could
50 * even be used for file-management). See the above smart signal callbacks for
53 * An item in the genlist world can have 0 or more text labels (they can be
54 * regular text or textblock - that's up to the style to determine), 0 or
55 * more icons (which are simply objects swallowed into the genlist item) and
56 * 0 or more boolean states that can be used for check, radio or other
57 * indicators by the edje theme style. An item may be one of several styles
58 * (Elementary provides 4 by default - "default", "double_label", "group_index"
59 * and "icon_top_text_bottom", but this can be extended by system or
60 * application custom themes/overlays/extensions).
62 * In order to implement the ability to add and delete items on the fly,
63 * Genlist implements a class/callback system where the application provides
64 * a structure with information about that type of item (genlist may contain
65 * multiple different items with different classes, states and styles).
66 * Genlist will call the functions in this struct (methods) when an item is
67 * "realized" (that is created dynamically while scrolling). All objects will
68 * simply be deleted when no longer needed with evas_object_del(). The
69 * Elm_Genlist_Item_Class structure contains the following members:
71 * item_style - This is a constant string and simply defines the name of the
72 * item style. It must be specified and the default should be "default".
74 * func.label_get - This function is called when an actual item object is
75 * created. The data parameter is the data parameter passed to
76 * elm_genlist_item_append() and related item creation functions. The obj
77 * parameter is the genlist object and the part parameter is the string name
78 * of the text part in the edje design that is listed as one of the possible
79 * labels that can be set. This function must return a strudup()'ed string as
80 * the caller will free() it when done.
82 * func.icon_get - This function is called when an actual item object is
83 * created. The data parameter is the data parameter passed to
84 * elm_genlist_item_append() and related item creation functions. The obj
85 * parameter is the genlist object and the part parameter is the string name
86 * of the icon part in the edje design that is listed as one of the possible
87 * icons that can be set. This must return NULL for no object or a valid
88 * object. The object will be deleted by genlist on shutdown or when the item
91 * func.state_get - This function is called when an actual item object is
92 * created. The data parameter is the data parameter passed to
93 * elm_genlist_item_append() and related item creation functions. The obj
94 * parameter is the genlist object and the part parameter is the string name
95 * of the state part in the edje design that is listed as one of the possible
96 * states that can be set. Return 0 for false or 1 for true. Genlist will
97 * emit a signal to the edje object with "elm,state,XXX,active" "elm" when
98 * true (the default is false), where XXX is the name of the part.
100 * func.del - This is called when elm_genlist_item_del() is called on an
101 * item, elm_genlist_clear() is called on the genlist, or
102 * elm_genlist_item_subitems_clear() is called to clear sub-items. This is
103 * intended for use when actual genlist items are deleted, so any backing
104 * data attached to the item (e.g. its data parameter on creation) can be
107 * Items can be added by several calls. All of them return a Elm_Genlist_Item
108 * handle that is an internal member inside the genlist. They all take a data
109 * parameter that is meant to be used for a handle to the applications
110 * internal data (eg the struct with the original item data). The parent
111 * parameter is the parent genlist item this belongs to if it is a tree or
112 * an indexed group, and NULL if there is no parent. The flags can be a bitmask
113 * of ELM_GENLIST_ITEM_NONE, ELM_GENLIST_ITEM_SUBITEMS and
114 * ELM_GENLIST_ITEM_GROUP. If ELM_GENLIST_ITEM_SUBITEMS is set then this item
115 * is displayed as an item that is able to expand and have child items.
116 * If ELM_GENLIST_ITEM_GROUP is set then this item is group idex item that is
117 * displayed at the top until the next group comes. The func parameter is a
118 * convenience callback that is called when the item is selected and the data
119 * parameter will be the func_data parameter, obj be the genlist object and
120 * event_info will be the genlist item.
122 * elm_genlist_item_append() appends an item to the end of the list, or if
123 * there is a parent, to the end of all the child items of the parent.
124 * elm_genlist_item_prepend() is the same but prepends to the beginning of
125 * the list or children list. elm_genlist_item_insert_before() inserts at
126 * item before another item and elm_genlist_item_insert_after() inserts after
127 * the indicated item.
129 * The application can clear the list with elm_genlist_clear() which deletes
130 * all the items in the list and elm_genlist_item_del() will delete a specific
131 * item. elm_genlist_item_subitems_clear() will clear all items that are
132 * children of the indicated parent item.
134 * If the application wants multiple items to be able to be selected,
135 * elm_genlist_multi_select_set() can enable this. If the list is
136 * single-selection only (the default), then elm_genlist_selected_item_get()
137 * will return the selected item, if any, or NULL I none is selected. If the
138 * list is multi-select then elm_genlist_selected_items_get() will return a
139 * list (that is only valid as long as no items are modified (added, deleted,
140 * selected or unselected)).
142 * To help inspect list items you can jump to the item at the top of the list
143 * with elm_genlist_first_item_get() which will return the item pointer, and
144 * similarly elm_genlist_last_item_get() gets the item at the end of the list.
145 * elm_genlist_item_next_get() and elm_genlist_item_prev_get() get the next
146 * and previous items respectively relative to the indicated item. Using
147 * these calls you can walk the entire item list/tree. Note that as a tree
148 * the items are flattened in the list, so elm_genlist_item_parent_get() will
149 * let you know which item is the parent (and thus know how to skip them if
152 * There are also convenience functions. elm_genlist_item_genlist_get() will
153 * return the genlist object the item belongs to. elm_genlist_item_show()
154 * will make the scroller scroll to show that specific item so its visible.
155 * elm_genlist_item_data_get() returns the data pointer set by the item
156 * creation functions.
158 * If an item changes (state of boolean changes, label or icons change),
159 * then use elm_genlist_item_update() to have genlist update the item with
160 * the new state. Genlist will re-realize the item thus call the functions
161 * in the _Elm_Genlist_Item_Class for that item.
163 * To programmatically (un)select an item use elm_genlist_item_selected_set().
164 * To get its selected state use elm_genlist_item_selected_get(). Similarly
165 * to expand/contract an item and get its expanded state, use
166 * elm_genlist_item_expanded_set() and elm_genlist_item_expanded_get(). And
167 * again to make an item disabled (unable to be selected and appear
168 * differently) use elm_genlist_item_disabled_set() to set this and
169 * elm_genlist_item_disabled_get() to get the disabled state.
171 * In general to indicate how the genlist should expand items horizontally to
172 * fill the list area, use elm_genlist_horizontal_mode_set(). Valid modes are
173 * ELM_LIST_LIMIT and ELM_LIST_SCROLL . The default is ELM_LIST_SCROLL. This
174 * mode means that if items are too wide to fit, the scroller will scroll
175 * horizontally. Otherwise items are expanded to fill the width of the
176 * viewport of the scroller. If it is ELM_LIST_LIMIT, items will be expanded
177 * to the viewport width and limited to that size. This can be combined with
178 * a different style that uses edjes' ellipsis feature (cutting text off like
181 * Items will only call their selection func and callback when first becoming
182 * selected. Any further clicks will do nothing, unless you enable always
183 * select with elm_genlist_always_select_mode_set(). This means even if
184 * selected, every click will make the selected callbacks be called.
185 * elm_genlist_no_select_mode_set() will turn off the ability to select
186 * items entirely and they will neither appear selected nor call selected
187 * callback functions.
189 * Remember that you can create new styles and add your own theme augmentation
190 * per application with elm_theme_extension_add(). If you absolutely must
191 * have a specific style that overrides any theme the user or system sets up
192 * you can use elm_theme_overlay_add() to add such a file.
196 typedef struct _Widget_Data Widget_Data;
197 typedef struct _Item_Block Item_Block;
198 typedef struct _Pan Pan;
199 typedef struct _Item_Cache Item_Cache;
203 Evas_Object *obj, *scr, *pan_smart;
204 Eina_Inlist *items, *blocks;
205 Eina_List *group_items;
207 Evas_Coord pan_x, pan_y, old_pan_y, w, h, minw, minh, realminw, prev_viewport_w;
208 Ecore_Job *calc_job, *update_job;
209 Ecore_Idle_Enterer *queue_idle_enterer;
210 Ecore_Idler *must_recalc_idler;
211 Eina_List *queue, *selected;
212 Elm_Genlist_Item *show_item, *last_selected_item, *anchor_item, *mode_item, *reorder_it, *reorder_rel;
213 Eina_Inlist *item_cache;
214 Evas_Coord anchor_y, reorder_start_y;
216 Ecore_Timer *multi_timer, *scr_hold_timer;
217 Ecore_Animator *item_moving_effect_timer;
218 const char *mode_type;
219 unsigned int start_time;
220 Evas_Coord prev_x, prev_y, prev_mx, prev_my;
221 Evas_Coord cur_x, cur_y, cur_mx, cur_my;
222 Eina_Bool mouse_down : 1;
223 Eina_Bool multi_down : 1;
224 Eina_Bool multi_timeout : 1;
225 Eina_Bool multitouched : 1;
226 Eina_Bool on_hold : 1;
228 Eina_Bool always_select : 1;
229 Eina_Bool longpressed : 1;
230 Eina_Bool wasselected : 1;
231 Eina_Bool no_select : 1;
232 Eina_Bool bring_in : 1;
233 Eina_Bool compress : 1;
234 Eina_Bool height_for_width : 1;
235 Eina_Bool homogeneous : 1;
236 Eina_Bool clear_me : 1;
238 Eina_Bool reorder_mode : 1;
239 Eina_Bool reorder_pan_move : 1;
243 } history[SWIPE_MOVES];
245 int item_cache_count;
251 int group_item_width;
252 int group_item_height;
253 int max_items_per_block;
254 double longpress_timeout;
265 Evas_Coord x, y, w, h, minw, minh;
266 Eina_Bool want_unrealize : 1;
267 Eina_Bool realized : 1;
268 Eina_Bool changed : 1;
269 Eina_Bool updateme : 1;
270 Eina_Bool showme : 1;
271 Eina_Bool must_recalc : 1;
274 struct _Elm_Genlist_Item
276 Elm_Widget_Item base;
281 Evas_Coord x, y, w, h, minw, minh;
282 const Elm_Genlist_Item_Class *itc;
283 Elm_Genlist_Item *parent;
284 Elm_Genlist_Item *group_item;
285 Elm_Genlist_Item_Flags flags;
293 Eina_List *labels, *icons, *states, *icon_objs;
294 Eina_List *mode_labels, *mode_icons, *mode_states, *mode_icon_objs;
295 Ecore_Timer *long_timer;
296 Ecore_Timer *swipe_timer;
298 Evas_Coord scrl_x, scrl_y, old_scrl_x, old_scrl_y;
300 Elm_Genlist_Item *rel;
301 Evas_Object *mode_view;
306 Elm_Tooltip_Item_Content_Cb content_cb;
307 Evas_Smart_Cb del_cb;
311 const char *mouse_cursor;
318 Eina_Bool before : 1;
320 Eina_Bool want_unrealize : 1;
321 Eina_Bool want_realize : 1;
322 Eina_Bool realized : 1;
323 Eina_Bool selected : 1;
324 Eina_Bool highlighted : 1;
325 Eina_Bool expanded : 1;
326 Eina_Bool disabled : 1;
327 Eina_Bool display_only : 1;
328 Eina_Bool mincalcd : 1;
329 Eina_Bool queued : 1;
330 Eina_Bool showme : 1;
331 Eina_Bool delete_me : 1;
333 Eina_Bool dragging : 1;
334 Eina_Bool updateme : 1;
335 Eina_Bool nocache : 1;
336 Eina_Bool stacking_even : 1;
337 Eina_Bool nostacking : 1;
338 Eina_Bool move_effect_enabled : 1;
345 Evas_Object *base_view, *spacer;
347 const char *item_style; // it->itc->item_style
348 Eina_Bool tree : 1; // it->flags & ELM_GENLIST_ITEM_SUBITEMS
349 Eina_Bool compress : 1; // it->wd->compress
351 Eina_Bool selected : 1; // it->selected
352 Eina_Bool disabled : 1; // it->disabled
353 Eina_Bool expanded : 1; // it->expanded
356 #define ELM_GENLIST_ITEM_FROM_INLIST(item) \
357 ((item) ? EINA_INLIST_CONTAINER_GET(item, Elm_Genlist_Item) : NULL)
361 Evas_Object_Smart_Clipped_Data __clipped_data;
363 Ecore_Job *resize_job;
366 static const char *widtype = NULL;
367 static void _item_cache_zero(Widget_Data *wd);
368 static void _del_hook(Evas_Object *obj);
369 static void _mirrored_set(Evas_Object *obj,
371 static void _theme_hook(Evas_Object *obj);
372 static void _show_region_hook(void *data,
374 static void _sizing_eval(Evas_Object *obj);
375 static void _item_unrealize(Elm_Genlist_Item *it, Eina_Bool calc);
376 static void _item_block_unrealize(Item_Block *itb);
377 static void _calc_job(void *data);
378 static void _on_focus_hook(void *data,
380 static Eina_Bool _item_multi_select_up(Widget_Data *wd);
381 static Eina_Bool _item_multi_select_down(Widget_Data *wd);
382 static Eina_Bool _item_single_select_up(Widget_Data *wd);
383 static Eina_Bool _item_single_select_down(Widget_Data *wd);
384 static Eina_Bool _event_hook(Evas_Object *obj,
386 Evas_Callback_Type type,
388 static void _signal_emit_hook(Evas_Object *obj,
389 const char *emission,
391 static Eina_Bool _deselect_all_items(Widget_Data *wd);
392 static void _pan_calculate(Evas_Object *obj);
393 static void _item_position(Elm_Genlist_Item *it, Evas_Object *obj, Evas_Coord it_x, Evas_Coord it_y);
394 static void _mode_item_realize(Elm_Genlist_Item *it);
395 static void _mode_item_unrealize(Elm_Genlist_Item *it);
396 static void _item_mode_set(Elm_Genlist_Item *it);
397 static void _item_mode_unset(Widget_Data *wd);
398 static void _group_items_recalc(void *data);
399 static void _item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after);
400 static void _item_move_before(Elm_Genlist_Item *it, Elm_Genlist_Item *before);
402 static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
404 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
405 static const char SIG_SELECTED[] = "selected";
406 static const char SIG_UNSELECTED[] = "unselected";
407 static const char SIG_EXPANDED[] = "expanded";
408 static const char SIG_CONTRACTED[] = "contracted";
409 static const char SIG_EXPAND_REQUEST[] = "expand,request";
410 static const char SIG_CONTRACT_REQUEST[] = "contract,request";
411 static const char SIG_REALIZED[] = "realized";
412 static const char SIG_UNREALIZED[] = "unrealized";
413 static const char SIG_DRAG_START_UP[] = "drag,start,up";
414 static const char SIG_DRAG_START_DOWN[] = "drag,start,down";
415 static const char SIG_DRAG_START_LEFT[] = "drag,start,left";
416 static const char SIG_DRAG_START_RIGHT[] = "drag,start,right";
417 static const char SIG_DRAG_STOP[] = "drag,stop";
418 static const char SIG_DRAG[] = "drag";
419 static const char SIG_LONGPRESSED[] = "longpressed";
420 static const char SIG_SCROLL_EDGE_TOP[] = "scroll,edge,top";
421 static const char SIG_SCROLL_EDGE_BOTTOM[] = "scroll,edge,bottom";
422 static const char SIG_SCROLL_EDGE_LEFT[] = "scroll,edge,left";
423 static const char SIG_SCROLL_EDGE_RIGHT[] = "scroll,edge,right";
424 static const char SIG_MULTI_SWIPE_LEFT[] = "multi,swipe,left";
425 static const char SIG_MULTI_SWIPE_RIGHT[] = "multi,swipe,right";
426 static const char SIG_MULTI_SWIPE_UP[] = "multi,swipe,up";
427 static const char SIG_MULTI_SWIPE_DOWN[] = "multi,swipe,down";
428 static const char SIG_MULTI_PINCH_OUT[] = "multi,pinch,out";
429 static const char SIG_MULTI_PINCH_IN[] = "multi,pinch,in";
430 static const char SIG_SWIPE[] = "swipe";
432 static const Evas_Smart_Cb_Description _signals[] = {
433 {SIG_CLICKED_DOUBLE, ""},
435 {SIG_UNSELECTED, ""},
437 {SIG_CONTRACTED, ""},
438 {SIG_EXPAND_REQUEST, ""},
439 {SIG_CONTRACT_REQUEST, ""},
441 {SIG_UNREALIZED, ""},
442 {SIG_DRAG_START_UP, ""},
443 {SIG_DRAG_START_DOWN, ""},
444 {SIG_DRAG_START_LEFT, ""},
445 {SIG_DRAG_START_RIGHT, ""},
448 {SIG_LONGPRESSED, ""},
449 {SIG_SCROLL_EDGE_TOP, ""},
450 {SIG_SCROLL_EDGE_BOTTOM, ""},
451 {SIG_SCROLL_EDGE_LEFT, ""},
452 {SIG_SCROLL_EDGE_RIGHT, ""},
453 {SIG_MULTI_SWIPE_LEFT, ""},
454 {SIG_MULTI_SWIPE_RIGHT, ""},
455 {SIG_MULTI_SWIPE_UP, ""},
456 {SIG_MULTI_SWIPE_DOWN, ""},
457 {SIG_MULTI_PINCH_OUT, ""},
458 {SIG_MULTI_PINCH_IN, ""},
463 static Eina_Compare_Cb _elm_genlist_item_compare_cb;
466 _event_hook(Evas_Object *obj,
467 Evas_Object *src __UNUSED__,
468 Evas_Callback_Type type,
471 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
472 Evas_Event_Key_Down *ev = event_info;
473 Widget_Data *wd = elm_widget_data_get(obj);
474 if (!wd) return EINA_FALSE;
475 if (!wd->items) return EINA_FALSE;
476 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
477 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
479 Elm_Genlist_Item *it = NULL;
482 Evas_Coord step_x = 0;
483 Evas_Coord step_y = 0;
486 Evas_Coord page_x = 0;
487 Evas_Coord page_y = 0;
489 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
490 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
491 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
492 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
494 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
498 else if ((!strcmp(ev->keyname, "Right")) ||
499 (!strcmp(ev->keyname, "KP_Right")))
503 else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
505 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
506 (_item_multi_select_up(wd)))
507 || (_item_single_select_up(wd)))
509 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
515 else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
517 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
518 (_item_multi_select_down(wd)))
519 || (_item_single_select_down(wd)))
521 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
527 else if ((!strcmp(ev->keyname, "Home")) ||
528 (!strcmp(ev->keyname, "KP_Home")))
530 it = elm_genlist_first_item_get(obj);
531 elm_genlist_item_bring_in(it);
532 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
535 else if ((!strcmp(ev->keyname, "End")) ||
536 (!strcmp(ev->keyname, "KP_End")))
538 it = elm_genlist_last_item_get(obj);
539 elm_genlist_item_bring_in(it);
540 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
543 else if ((!strcmp(ev->keyname, "Prior")) ||
544 (!strcmp(ev->keyname, "KP_Prior")))
547 y -= -(page_y * v_h) / 100;
551 else if ((!strcmp(ev->keyname, "Next")) ||
552 (!strcmp(ev->keyname, "KP_Next")))
555 y += -(page_y * v_h) / 100;
559 else if (((!strcmp(ev->keyname, "Return")) ||
560 (!strcmp(ev->keyname, "KP_Enter")) ||
561 (!strcmp(ev->keyname, "space")))
562 && (!wd->multi) && (wd->selected))
564 it = elm_genlist_selected_item_get(obj);
565 elm_genlist_item_expanded_set(it,
566 !elm_genlist_item_expanded_get(it));
568 else if (!strcmp(ev->keyname, "Escape"))
570 if (!_deselect_all_items(wd)) return EINA_FALSE;
571 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
574 else return EINA_FALSE;
576 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
577 elm_smart_scroller_child_pos_set(wd->scr, x, y);
582 _deselect_all_items(Widget_Data *wd)
584 if (!wd->selected) return EINA_FALSE;
586 elm_genlist_item_selected_set(wd->selected->data, EINA_FALSE);
592 _item_multi_select_up(Widget_Data *wd)
594 if (!wd->selected) return EINA_FALSE;
595 if (!wd->multi) return EINA_FALSE;
597 Elm_Genlist_Item *prev = elm_genlist_item_prev_get(wd->last_selected_item);
598 if (!prev) return EINA_TRUE;
600 if (elm_genlist_item_selected_get(prev))
602 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
603 wd->last_selected_item = prev;
604 elm_genlist_item_show(wd->last_selected_item);
608 elm_genlist_item_selected_set(prev, EINA_TRUE);
609 elm_genlist_item_show(prev);
615 _item_multi_select_down(Widget_Data *wd)
617 if (!wd->selected) return EINA_FALSE;
618 if (!wd->multi) return EINA_FALSE;
620 Elm_Genlist_Item *next = elm_genlist_item_next_get(wd->last_selected_item);
621 if (!next) return EINA_TRUE;
623 if (elm_genlist_item_selected_get(next))
625 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
626 wd->last_selected_item = next;
627 elm_genlist_item_show(wd->last_selected_item);
631 elm_genlist_item_selected_set(next, EINA_TRUE);
632 elm_genlist_item_show(next);
638 _item_single_select_up(Widget_Data *wd)
640 Elm_Genlist_Item *prev;
643 prev = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
644 while ((prev) && (prev->delete_me))
645 prev = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
647 else prev = elm_genlist_item_prev_get(wd->last_selected_item);
649 if (!prev) return EINA_FALSE;
651 _deselect_all_items(wd);
653 elm_genlist_item_selected_set(prev, EINA_TRUE);
654 elm_genlist_item_show(prev);
659 _item_single_select_down(Widget_Data *wd)
661 Elm_Genlist_Item *next;
664 next = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
665 while ((next) && (next->delete_me))
666 next = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
668 else next = elm_genlist_item_next_get(wd->last_selected_item);
670 if (!next) return EINA_FALSE;
672 _deselect_all_items(wd);
674 elm_genlist_item_selected_set(next, EINA_TRUE);
675 elm_genlist_item_show(next);
680 _on_focus_hook(void *data __UNUSED__,
683 Widget_Data *wd = elm_widget_data_get(obj);
685 if (elm_widget_focus_get(obj))
687 edje_object_signal_emit(wd->obj, "elm,action,focus", "elm");
688 evas_object_focus_set(wd->obj, EINA_TRUE);
689 if ((wd->selected) && (!wd->last_selected_item))
690 wd->last_selected_item = eina_list_data_get(wd->selected);
694 edje_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
695 evas_object_focus_set(wd->obj, EINA_FALSE);
700 _del_hook(Evas_Object *obj)
702 Widget_Data *wd = elm_widget_data_get(obj);
704 _item_cache_zero(wd);
705 if (wd->calc_job) ecore_job_del(wd->calc_job);
706 if (wd->update_job) ecore_job_del(wd->update_job);
707 if (wd->queue_idle_enterer) ecore_idle_enterer_del(wd->queue_idle_enterer);
708 if (wd->must_recalc_idler) ecore_idler_del(wd->must_recalc_idler);
709 if (wd->multi_timer) ecore_timer_del(wd->multi_timer);
710 if (wd->mode_type) eina_stringshare_del(wd->mode_type);
711 if (wd->scr_hold_timer) ecore_timer_del(wd->scr_hold_timer);
716 _del_pre_hook(Evas_Object *obj)
718 Widget_Data *wd = elm_widget_data_get(obj);
720 evas_object_del(wd->pan_smart);
721 wd->pan_smart = NULL;
722 elm_genlist_clear(obj);
726 _mirrored_set(Evas_Object *obj,
729 Widget_Data *wd = elm_widget_data_get(obj);
731 _item_cache_zero(wd);
732 elm_smart_scroller_mirrored_set(wd->scr, rtl);
736 _theme_hook(Evas_Object *obj)
738 Widget_Data *wd = elm_widget_data_get(obj);
741 evas_event_freeze(evas_object_evas_get(wd->obj));
742 _item_cache_zero(wd);
743 _elm_widget_mirrored_reload(obj);
744 _mirrored_set(obj, elm_widget_mirrored_get(obj));
745 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
746 elm_widget_style_get(obj));
747 edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
748 wd->item_width = wd->item_height = 0;
749 wd->group_item_width = wd->group_item_height = 0;
750 wd->minw = wd->minh = wd->realminw = 0;
751 EINA_INLIST_FOREACH(wd->blocks, itb)
754 Elm_Genlist_Item *it;
756 if (itb->realized) _item_block_unrealize(itb);
757 EINA_LIST_FOREACH(itb->items, l, it)
758 it->mincalcd = EINA_FALSE;
760 itb->changed = EINA_TRUE;
762 if (wd->calc_job) ecore_job_del(wd->calc_job);
763 wd->calc_job = ecore_job_add(_calc_job, wd);
765 evas_event_thaw(evas_object_evas_get(wd->obj));
766 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
770 _show_region_hook(void *data,
773 Widget_Data *wd = elm_widget_data_get(data);
774 Evas_Coord x, y, w, h;
776 elm_widget_show_region_get(obj, &x, &y, &w, &h);
777 //x & y are screen coordinates, Add with pan coordinates
780 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
784 _sizing_eval(Evas_Object *obj)
786 Widget_Data *wd = elm_widget_data_get(obj);
787 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
789 evas_object_size_hint_min_get(wd->scr, &minw, &minh);
790 evas_object_size_hint_max_get(wd->scr, &maxw, &maxh);
792 if (wd->height_for_width)
796 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
797 if ((vw != 0) && (vw != wd->prev_viewport_w))
801 wd->prev_viewport_w = vw;
802 EINA_INLIST_FOREACH(wd->blocks, itb)
804 itb->must_recalc = EINA_TRUE;
806 if (wd->calc_job) ecore_job_del(wd->calc_job);
807 wd->calc_job = ecore_job_add(_calc_job, wd);
810 if (wd->mode == ELM_LIST_LIMIT)
812 Evas_Coord vmw, vmh, vw, vh;
816 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
817 if ((minw > 0) && (vw < minw)) vw = minw;
818 else if ((maxw > 0) && (vw > maxw))
820 edje_object_size_min_calc
821 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
828 edje_object_size_min_calc
829 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
833 evas_object_size_hint_min_set(obj, minw, minh);
834 evas_object_size_hint_max_set(obj, maxw, maxh);
838 _signal_emit_hook(Evas_Object *obj,
839 const char *emission,
842 Widget_Data *wd = elm_widget_data_get(obj);
843 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
848 _item_highlight(Elm_Genlist_Item *it)
850 const char *selectraise;
851 if ((it->wd->no_select) || (it->delete_me) || (it->highlighted) ||
852 (it->disabled) || (it->display_only) || (it->mode_view))
854 edje_object_signal_emit(it->base.view, "elm,state,selected", "elm");
855 selectraise = edje_object_data_get(it->base.view, "selectraise");
856 if ((selectraise) && (!strcmp(selectraise, "on")))
858 evas_object_raise(it->base.view);
859 if ((it->group_item) && (it->group_item->realized))
860 evas_object_raise(it->group_item->base.view);
862 it->highlighted = EINA_TRUE;
866 _item_unhighlight(Elm_Genlist_Item *it)
868 const char *stacking, *selectraise;
869 if ((it->delete_me) || (!it->highlighted)) return;
870 edje_object_signal_emit(it->base.view, "elm,state,unselected", "elm");
871 stacking = edje_object_data_get(it->base.view, "stacking");
872 selectraise = edje_object_data_get(it->base.view, "selectraise");
875 if ((it->order_num_in & 0x1) ^ it->stacking_even) evas_object_lower(it->base.view);
876 else evas_object_raise(it->base.view);
878 it->highlighted = EINA_FALSE;
882 _item_block_del(Elm_Genlist_Item *it)
885 Item_Block *itb = it->block;
887 itb->items = eina_list_remove(itb->items, it);
889 itb->changed = EINA_TRUE;
890 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
891 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
894 il = EINA_INLIST_GET(itb);
895 Item_Block *itbn = (Item_Block *)(il->next);
897 it->parent->items = eina_list_remove(it->parent->items, it);
899 it->wd->blocks = eina_inlist_remove(it->wd->blocks, il);
901 if (itbn) itbn->changed = EINA_TRUE;
905 if (itb->count < itb->wd->max_items_per_block/2)
907 il = EINA_INLIST_GET(itb);
908 Item_Block *itbp = (Item_Block *)(il->prev);
909 Item_Block *itbn = (Item_Block *)(il->next);
910 if ((itbp) && ((itbp->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
912 Elm_Genlist_Item *it2;
914 EINA_LIST_FREE(itb->items, it2)
917 itbp->items = eina_list_append(itbp->items, it2);
919 itbp->changed = EINA_TRUE;
921 it->wd->blocks = eina_inlist_remove(it->wd->blocks,
922 EINA_INLIST_GET(itb));
925 else if ((itbn) && ((itbn->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
929 Eina_List *last = eina_list_last(itb->items);
930 Elm_Genlist_Item *it2 = last->data;
933 itb->items = eina_list_remove_list(itb->items, last);
934 itbn->items = eina_list_prepend(itbn->items, it2);
936 itbn->changed = EINA_TRUE;
939 eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb));
947 _item_del(Elm_Genlist_Item *it)
949 Evas_Object *tob = it->wd->obj;
951 evas_event_freeze(evas_object_evas_get(tob));
952 elm_widget_item_pre_notify_del(it);
953 elm_genlist_item_subitems_clear(it);
954 it->wd->walking -= it->walking;
955 if (it->wd->show_item == it) it->wd->show_item = NULL;
956 if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it);
957 if (it->realized) _item_unrealize(it, EINA_FALSE);
958 if (it->block) _item_block_del(it);
959 if ((!it->delete_me) && (it->itc->func.del))
960 it->itc->func.del((void *)it->base.data, it->base.widget);
961 it->delete_me = EINA_TRUE;
963 it->wd->queue = eina_list_remove(it->wd->queue, it);
964 if (it->wd->anchor_item == it)
966 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
967 if (!it->wd->anchor_item)
968 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
970 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
972 it->parent->items = eina_list_remove(it->parent->items, it);
973 if (it->flags & ELM_GENLIST_ITEM_GROUP)
974 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
975 if (it->long_timer) ecore_timer_del(it->long_timer);
976 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
978 if (it->tooltip.del_cb)
979 it->tooltip.del_cb((void *)it->tooltip.data, it->base.widget, it);
981 evas_event_thaw(evas_object_evas_get(tob));
982 evas_event_thaw_eval(evas_object_evas_get(tob));
984 elm_widget_item_del(it);
988 _item_select(Elm_Genlist_Item *it)
990 if ((it->wd->no_select) || (it->delete_me) || (it->mode_view)) return;
993 if (it->wd->always_select) goto call;
996 it->selected = EINA_TRUE;
997 it->wd->selected = eina_list_append(it->wd->selected, it);
1001 if (it->func.func) it->func.func((void *)it->func.data, it->base.widget, it);
1003 evas_object_smart_callback_call(it->base.widget, SIG_SELECTED, it);
1006 if ((it->wd->clear_me) && (!it->wd->walking))
1007 elm_genlist_clear(it->base.widget);
1010 if ((!it->walking) && (it->delete_me))
1012 if (!it->relcount) _item_del(it);
1015 it->wd->last_selected_item = it;
1019 _item_unselect(Elm_Genlist_Item *it)
1021 if ((it->delete_me) || (!it->selected)) return;
1022 it->selected = EINA_FALSE;
1023 it->wd->selected = eina_list_remove(it->wd->selected, it);
1024 evas_object_smart_callback_call(it->base.widget, SIG_UNSELECTED, it);
1028 _mouse_move(void *data,
1029 Evas *evas __UNUSED__,
1033 Elm_Genlist_Item *it = data;
1034 Evas_Event_Mouse_Move *ev = event_info;
1035 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
1036 Evas_Coord ox, oy, ow, oh, it_scrl_y, y_pos;
1038 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1040 if (!it->wd->on_hold)
1042 it->wd->on_hold = EINA_TRUE;
1043 if (!it->wd->wasselected)
1045 _item_unhighlight(it);
1050 if (it->wd->multitouched)
1052 it->wd->cur_x = ev->cur.canvas.x;
1053 it->wd->cur_y = ev->cur.canvas.y;
1056 if ((it->dragging) && (it->down))
1058 if (it->wd->movements == SWIPE_MOVES) it->wd->swipe = EINA_TRUE;
1061 it->wd->history[it->wd->movements].x = ev->cur.canvas.x;
1062 it->wd->history[it->wd->movements].y = ev->cur.canvas.y;
1063 if (abs((it->wd->history[it->wd->movements].x -
1064 it->wd->history[0].x)) > 40)
1065 it->wd->swipe = EINA_TRUE;
1067 it->wd->movements++;
1071 ecore_timer_del(it->long_timer);
1072 it->long_timer = NULL;
1074 evas_object_smart_callback_call(it->base.widget, SIG_DRAG, it);
1077 if ((!it->down) /* || (it->wd->on_hold)*/ || (it->wd->longpressed))
1081 ecore_timer_del(it->long_timer);
1082 it->long_timer = NULL;
1084 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
1086 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
1087 it_scrl_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
1089 if (!it->wd->reorder_start_y)
1090 it->wd->reorder_start_y = it->block->y + it->y;
1092 if (it_scrl_y < oy) y_pos = oy;
1093 else if (it_scrl_y + it->wd->reorder_it->h > oy+oh)
1094 y_pos = oy + oh - it->wd->reorder_it->h;
1095 else y_pos = it_scrl_y;
1097 _item_position(it, it->base.view, it->scrl_x, y_pos);
1099 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1100 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1104 if (!it->display_only)
1105 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1106 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1107 x = ev->cur.canvas.x - x;
1108 y = ev->cur.canvas.y - y;
1111 if (adx < 0) adx = -dx;
1114 if (ady < 0) ady = -dy;
1117 if ((adx > minw) || (ady > minh))
1119 it->dragging = EINA_TRUE;
1122 ecore_timer_del(it->long_timer);
1123 it->long_timer = NULL;
1125 if (!it->wd->wasselected)
1127 _item_unhighlight(it);
1133 evas_object_smart_callback_call(it->base.widget,
1134 SIG_DRAG_START_UP, it);
1138 evas_object_smart_callback_call(it->base.widget,
1139 SIG_DRAG_START_LEFT, it);
1141 evas_object_smart_callback_call(it->base.widget,
1142 SIG_DRAG_START_RIGHT, it);
1148 evas_object_smart_callback_call(it->base.widget,
1149 SIG_DRAG_START_DOWN, it);
1153 evas_object_smart_callback_call(it->base.widget,
1154 SIG_DRAG_START_LEFT, it);
1156 evas_object_smart_callback_call(it->base.widget,
1157 SIG_DRAG_START_RIGHT, it);
1164 _long_press(void *data)
1166 Elm_Genlist_Item *it = data, *it_tmp;
1167 Eina_List *list, *l;
1169 it->long_timer = NULL;
1170 if ((it->disabled) || (it->dragging) || (it->display_only))
1171 return ECORE_CALLBACK_CANCEL;
1172 it->wd->longpressed = EINA_TRUE;
1173 evas_object_smart_callback_call(it->base.widget, SIG_LONGPRESSED, it);
1174 if ((it->wd->reorder_mode) && (it->flags != ELM_GENLIST_ITEM_GROUP))
1176 it->wd->reorder_it = it;
1177 it->wd->reorder_start_y = 0;
1179 evas_object_raise(it->base.view);
1180 elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
1182 list = elm_genlist_realized_items_get(it->wd->obj);
1183 EINA_LIST_FOREACH(list, l, it_tmp)
1185 if (it != it_tmp) _item_unselect(it_tmp);
1187 if (elm_genlist_item_expanded_get(it))
1189 elm_genlist_item_expanded_set(it, EINA_FALSE);
1190 return ECORE_CALLBACK_RENEW;
1192 edje_object_signal_emit(it->base.view, "elm,state,reorder,enable", "elm");
1194 return ECORE_CALLBACK_CANCEL;
1198 _swipe(Elm_Genlist_Item *it)
1203 if ((it->display_only) || (it->disabled)) return;
1204 it->wd->swipe = EINA_FALSE;
1205 for (i = 0; i < it->wd->movements; i++)
1207 sum += it->wd->history[i].x;
1208 if (abs(it->wd->history[0].y - it->wd->history[i].y) > 10) return;
1211 sum /= it->wd->movements;
1212 if (abs(sum - it->wd->history[0].x) <= 10) return;
1213 evas_object_smart_callback_call(it->base.widget, SIG_SWIPE, it);
1217 _swipe_cancel(void *data)
1219 Elm_Genlist_Item *it = data;
1221 if (!it) return ECORE_CALLBACK_CANCEL;
1222 it->wd->swipe = EINA_FALSE;
1223 it->wd->movements = 0;
1224 return ECORE_CALLBACK_RENEW;
1228 _multi_cancel(void *data)
1230 Widget_Data *wd = data;
1232 if (!wd) return ECORE_CALLBACK_CANCEL;
1233 wd->multi_timeout = EINA_TRUE;
1234 return ECORE_CALLBACK_RENEW;
1238 _multi_touch_gesture_eval(void *data)
1240 Elm_Genlist_Item *it = data;
1242 it->wd->multitouched = EINA_FALSE;
1243 if (it->wd->multi_timer)
1245 ecore_timer_del(it->wd->multi_timer);
1246 it->wd->multi_timer = NULL;
1248 if (it->wd->multi_timeout)
1250 it->wd->multi_timeout = EINA_FALSE;
1254 Evas_Coord minw = 0, minh = 0;
1255 Evas_Coord off_x, off_y, off_mx, off_my;
1257 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1258 off_x = abs(it->wd->cur_x - it->wd->prev_x);
1259 off_y = abs(it->wd->cur_y - it->wd->prev_y);
1260 off_mx = abs(it->wd->cur_mx - it->wd->prev_mx);
1261 off_my = abs(it->wd->cur_my - it->wd->prev_my);
1263 if (((off_x > minw) || (off_y > minh)) && ((off_mx > minw) || (off_my > minh)))
1265 if ((off_x + off_mx) > (off_y + off_my))
1267 if ((it->wd->cur_x > it->wd->prev_x) && (it->wd->cur_mx > it->wd->prev_mx))
1268 evas_object_smart_callback_call(it->base.widget,
1269 SIG_MULTI_SWIPE_RIGHT, it);
1270 else if ((it->wd->cur_x < it->wd->prev_x) && (it->wd->cur_mx < it->wd->prev_mx))
1271 evas_object_smart_callback_call(it->base.widget,
1272 SIG_MULTI_SWIPE_LEFT, it);
1273 else if (abs(it->wd->cur_x - it->wd->cur_mx) > abs(it->wd->prev_x - it->wd->prev_mx))
1274 evas_object_smart_callback_call(it->base.widget,
1275 SIG_MULTI_PINCH_OUT, it);
1277 evas_object_smart_callback_call(it->base.widget,
1278 SIG_MULTI_PINCH_IN, it);
1282 if ((it->wd->cur_y > it->wd->prev_y) && (it->wd->cur_my > it->wd->prev_my))
1283 evas_object_smart_callback_call(it->base.widget,
1284 SIG_MULTI_SWIPE_DOWN, it);
1285 else if ((it->wd->cur_y < it->wd->prev_y) && (it->wd->cur_my < it->wd->prev_my))
1286 evas_object_smart_callback_call(it->base.widget,
1287 SIG_MULTI_SWIPE_UP, it);
1288 else if (abs(it->wd->cur_y - it->wd->cur_my) > abs(it->wd->prev_y - it->wd->prev_my))
1289 evas_object_smart_callback_call(it->base.widget,
1290 SIG_MULTI_PINCH_OUT, it);
1292 evas_object_smart_callback_call(it->base.widget,
1293 SIG_MULTI_PINCH_IN, it);
1296 it->wd->multi_timeout = EINA_FALSE;
1300 _multi_down(void *data,
1301 Evas *evas __UNUSED__,
1302 Evas_Object *obj __UNUSED__,
1305 Elm_Genlist_Item *it = data;
1306 Evas_Event_Multi_Down *ev = event_info;
1308 if ((it->wd->multi_device != 0) || (it->wd->multitouched) || (it->wd->multi_timeout)) return;
1309 it->wd->multi_device = ev->device;
1310 it->wd->multi_down = EINA_TRUE;
1311 it->wd->multitouched = EINA_TRUE;
1312 it->wd->prev_mx = ev->canvas.x;
1313 it->wd->prev_my = ev->canvas.y;
1314 if (!it->wd->wasselected)
1316 _item_unhighlight(it);
1319 it->wd->wasselected = EINA_FALSE;
1320 it->wd->longpressed = EINA_FALSE;
1323 ecore_timer_del(it->long_timer);
1324 it->long_timer = NULL;
1328 it->dragging = EINA_FALSE;
1329 evas_object_smart_callback_call(it->base.widget, SIG_DRAG_STOP, it);
1331 if (it->swipe_timer)
1333 ecore_timer_del(it->swipe_timer);
1334 it->swipe_timer = NULL;
1336 if (it->wd->on_hold)
1338 it->wd->swipe = EINA_FALSE;
1339 it->wd->movements = 0;
1340 it->wd->on_hold = EINA_FALSE;
1345 _multi_up(void *data,
1346 Evas *evas __UNUSED__,
1347 Evas_Object *obj __UNUSED__,
1350 Elm_Genlist_Item *it = data;
1351 Evas_Event_Multi_Up *ev = event_info;
1353 if (it->wd->multi_device != ev->device) return;
1354 it->wd->multi_device = 0;
1355 it->wd->multi_down = EINA_FALSE;
1356 if (it->wd->mouse_down) return;
1357 _multi_touch_gesture_eval(data);
1361 _multi_move(void *data,
1362 Evas *evas __UNUSED__,
1363 Evas_Object *obj __UNUSED__,
1366 Elm_Genlist_Item *it = data;
1367 Evas_Event_Multi_Move *ev = event_info;
1369 if (it->wd->multi_device != ev->device) return;
1370 it->wd->cur_mx = ev->cur.canvas.x;
1371 it->wd->cur_my = ev->cur.canvas.y;
1375 _mouse_down(void *data,
1376 Evas *evas __UNUSED__,
1380 Elm_Genlist_Item *it = data;
1381 Evas_Event_Mouse_Down *ev = event_info;
1384 if (ev->button != 1) return;
1385 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1387 it->wd->on_hold = EINA_TRUE;
1390 it->down = EINA_TRUE;
1391 it->dragging = EINA_FALSE;
1392 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1393 it->dx = ev->canvas.x - x;
1394 it->dy = ev->canvas.y - y;
1395 it->wd->mouse_down = EINA_TRUE;
1396 if (!it->wd->multitouched)
1398 it->wd->prev_x = ev->canvas.x;
1399 it->wd->prev_y = ev->canvas.y;
1400 it->wd->multi_timeout = EINA_FALSE;
1401 if (it->wd->multi_timer) ecore_timer_del(it->wd->multi_timer);
1402 it->wd->multi_timer = ecore_timer_add(1, _multi_cancel, it->wd);
1404 it->wd->longpressed = EINA_FALSE;
1405 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1406 else it->wd->on_hold = EINA_FALSE;
1407 if (it->wd->on_hold) return;
1408 it->wd->wasselected = it->selected;
1409 _item_highlight(it);
1410 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
1411 if ((!it->disabled) && (!it->display_only))
1413 evas_object_smart_callback_call(it->base.widget, SIG_CLICKED_DOUBLE, it);
1414 evas_object_smart_callback_call(it->base.widget, "clicked", it); // will be removed
1416 if (it->long_timer) ecore_timer_del(it->long_timer);
1417 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
1418 it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
1420 it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press,
1423 it->long_timer = NULL;
1424 it->wd->swipe = EINA_FALSE;
1425 it->wd->movements = 0;
1429 _mouse_up(void *data,
1430 Evas *evas __UNUSED__,
1431 Evas_Object *obj __UNUSED__,
1434 Elm_Genlist_Item *it = data;
1435 Evas_Event_Mouse_Up *ev = event_info;
1436 Eina_Bool dragged = EINA_FALSE;
1438 if (ev->button != 1) return;
1439 it->down = EINA_FALSE;
1440 it->wd->mouse_down = EINA_FALSE;
1441 if (it->wd->multitouched)
1443 if ((!it->wd->multi) && (!it->selected) && (it->highlighted)) _item_unhighlight(it);
1444 if (it->wd->multi_down) return;
1445 _multi_touch_gesture_eval(data);
1448 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1449 else it->wd->on_hold = EINA_FALSE;
1452 ecore_timer_del(it->long_timer);
1453 it->long_timer = NULL;
1457 it->dragging = EINA_FALSE;
1458 evas_object_smart_callback_call(it->base.widget, SIG_DRAG_STOP, it);
1461 if (it->swipe_timer)
1463 ecore_timer_del(it->swipe_timer);
1464 it->swipe_timer = NULL;
1466 if (it->wd->multi_timer)
1468 ecore_timer_del(it->wd->multi_timer);
1469 it->wd->multi_timer = NULL;
1470 it->wd->multi_timeout = EINA_FALSE;
1472 if (it->wd->on_hold)
1474 if (it->wd->swipe) _swipe(data);
1475 it->wd->longpressed = EINA_FALSE;
1476 it->wd->on_hold = EINA_FALSE;
1479 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
1481 Evas_Coord it_scrl_y = ev->canvas.y - it->wd->reorder_it->dy;
1483 if (it->wd->reorder_rel)
1485 if (it->wd->reorder_it->parent == it->wd->reorder_rel->parent)
1487 if (it_scrl_y <= it->wd->reorder_rel->scrl_y)
1488 _item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
1490 _item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
1494 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1495 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1498 edje_object_signal_emit(it->base.view, "elm,state,reorder,disable", "elm");
1499 it->wd->reorder_it = it->wd->reorder_rel = NULL;
1500 elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
1502 if (it->wd->longpressed)
1504 it->wd->longpressed = EINA_FALSE;
1505 if (!it->wd->wasselected)
1507 _item_unhighlight(it);
1510 it->wd->wasselected = EINA_FALSE;
1515 if (it->want_unrealize)
1517 _item_unrealize(it, EINA_FALSE);
1518 if (it->block->want_unrealize)
1519 _item_block_unrealize(it->block);
1522 if ((it->disabled) || (dragged) || (it->display_only)) return;
1523 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1528 _item_highlight(it);
1533 _item_unhighlight(it);
1541 Widget_Data *wd = it->wd;
1544 while (wd->selected)
1546 _item_unhighlight(wd->selected->data);
1547 _item_unselect(wd->selected->data);
1553 const Eina_List *l, *l_next;
1554 Elm_Genlist_Item *it2;
1556 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
1559 _item_unhighlight(it2);
1560 _item_unselect(it2);
1562 //_item_highlight(it);
1565 _item_highlight(it);
1571 _signal_expand_toggle(void *data,
1572 Evas_Object *obj __UNUSED__,
1573 const char *emission __UNUSED__,
1574 const char *source __UNUSED__)
1576 Elm_Genlist_Item *it = data;
1579 evas_object_smart_callback_call(it->base.widget, SIG_CONTRACT_REQUEST, it);
1581 evas_object_smart_callback_call(it->base.widget, SIG_EXPAND_REQUEST, it);
1585 _signal_expand(void *data,
1586 Evas_Object *obj __UNUSED__,
1587 const char *emission __UNUSED__,
1588 const char *source __UNUSED__)
1590 Elm_Genlist_Item *it = data;
1593 evas_object_smart_callback_call(it->base.widget, SIG_EXPAND_REQUEST, it);
1597 _signal_contract(void *data,
1598 Evas_Object *obj __UNUSED__,
1599 const char *emission __UNUSED__,
1600 const char *source __UNUSED__)
1602 Elm_Genlist_Item *it = data;
1605 evas_object_smart_callback_call(it->base.widget, SIG_CONTRACT_REQUEST, it);
1609 _scr_hold_timer_cb(void *data)
1611 if (!data) return ECORE_CALLBACK_CANCEL;
1612 Widget_Data *wd = data;
1613 elm_smart_scroller_hold_set(wd->scr, EINA_FALSE);
1614 wd->scr_hold_timer = NULL;
1615 return ECORE_CALLBACK_CANCEL;
1619 _mode_finished_signal_cb(void *data,
1621 const char *emission __UNUSED__,
1622 const char *source __UNUSED__)
1626 Elm_Genlist_Item *it = data;
1627 if ((it->delete_me) || (!it->realized) || (!it->mode_view)) return;
1629 Evas *te = evas_object_evas_get(obj);
1631 evas_event_freeze(te);
1632 it->nocache = EINA_FALSE;
1633 _mode_item_unrealize(it);
1634 snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished", it->wd->mode_type);
1635 edje_object_signal_callback_del_full(obj, buf, "elm", _mode_finished_signal_cb, it);
1636 evas_event_thaw(te);
1637 evas_event_thaw_eval(te);
1641 _item_cache_clean(Widget_Data *wd)
1643 evas_event_freeze(evas_object_evas_get(wd->obj));
1644 while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max))
1648 itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache);
1649 wd->item_cache = eina_inlist_remove(wd->item_cache,
1650 wd->item_cache->last);
1651 wd->item_cache_count--;
1652 if (itc->spacer) evas_object_del(itc->spacer);
1653 if (itc->base_view) evas_object_del(itc->base_view);
1654 if (itc->item_style) eina_stringshare_del(itc->item_style);
1657 evas_event_thaw(evas_object_evas_get(wd->obj));
1658 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
1662 _item_cache_zero(Widget_Data *wd)
1664 int pmax = wd->item_cache_max;
1665 wd->item_cache_max = 0;
1666 _item_cache_clean(wd);
1667 wd->item_cache_max = pmax;
1671 _item_cache_add(Elm_Genlist_Item *it)
1675 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1676 if (it->wd->item_cache_max <= 0)
1678 evas_object_del(it->base.view);
1679 it->base.view = NULL;
1680 evas_object_del(it->spacer);
1682 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1683 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1687 it->wd->item_cache_count++;
1688 itc = calloc(1, sizeof(Item_Cache));
1689 it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache,
1690 EINA_INLIST_GET(itc));
1691 itc->spacer = it->spacer;
1693 itc->base_view = it->base.view;
1694 it->base.view = NULL;
1695 evas_object_hide(itc->base_view);
1696 evas_object_move(itc->base_view, -9999, -9999);
1697 itc->item_style = eina_stringshare_add(it->itc->item_style);
1698 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
1699 itc->compress = (it->wd->compress);
1700 itc->selected = it->selected;
1701 itc->disabled = it->disabled;
1702 itc->expanded = it->expanded;
1705 ecore_timer_del(it->long_timer);
1706 it->long_timer = NULL;
1708 if (it->swipe_timer)
1710 ecore_timer_del(it->swipe_timer);
1711 it->swipe_timer = NULL;
1713 // FIXME: other callbacks?
1714 edje_object_signal_callback_del_full(itc->base_view,
1715 "elm,action,expand,toggle",
1716 "elm", _signal_expand_toggle, it);
1717 edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand",
1719 _signal_expand, it);
1720 edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract",
1721 "elm", _signal_contract, it);
1722 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_DOWN,
1724 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP,
1726 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_MOVE,
1728 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_DOWN,
1730 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_UP,
1732 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_MOVE,
1734 _item_cache_clean(it->wd);
1735 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1736 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1740 _item_cache_find(Elm_Genlist_Item *it)
1745 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
1746 EINA_INLIST_FOREACH(it->wd->item_cache, itc)
1748 if ((itc->selected) || (itc->disabled) || (itc->expanded))
1750 if ((itc->tree == tree) &&
1751 (itc->compress == it->wd->compress) &&
1752 (!strcmp(it->itc->item_style, itc->item_style)))
1754 it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
1755 EINA_INLIST_GET(itc));
1756 it->wd->item_cache_count--;
1764 _elm_genlist_item_odd_even_update(Elm_Genlist_Item *it)
1766 if (!it->nostacking)
1768 if ((it->order_num_in & 0x1) ^ it->stacking_even)
1769 evas_object_lower(it->base.view);
1771 evas_object_raise(it->base.view);
1774 if (it->order_num_in & 0x1)
1775 edje_object_signal_emit(it->base.view, "elm,state,odd", "elm");
1777 edje_object_signal_emit(it->base.view, "elm,state,even", "elm");
1781 _elm_genlist_item_state_update(Elm_Genlist_Item *it, Item_Cache *itc)
1785 if (it->selected != itc->selected)
1788 edje_object_signal_emit(it->base.view,
1789 "elm,state,selected", "elm");
1791 if (it->disabled != itc->disabled)
1794 edje_object_signal_emit(it->base.view,
1795 "elm,state,disabled", "elm");
1797 if (it->expanded != itc->expanded)
1800 edje_object_signal_emit(it->base.view,
1801 "elm,state,expanded", "elm");
1807 edje_object_signal_emit(it->base.view,
1808 "elm,state,selected", "elm");
1810 edje_object_signal_emit(it->base.view,
1811 "elm,state,disabled", "elm");
1813 edje_object_signal_emit(it->base.view,
1814 "elm,state,expanded", "elm");
1819 _item_cache_free(Item_Cache *itc)
1821 if (itc->spacer) evas_object_del(itc->spacer);
1822 if (itc->base_view) evas_object_del(itc->base_view);
1823 if (itc->item_style) eina_stringshare_del(itc->item_style);
1828 _item_label_realize(Elm_Genlist_Item *it,
1829 Evas_Object *target,
1832 if (it->itc->func.label_get)
1837 *source = elm_widget_stringlist_get(edje_object_data_get(target, "labels"));
1838 EINA_LIST_FOREACH(*source, l, key)
1840 char *s = it->itc->func.label_get
1841 ((void *)it->base.data, it->base.widget, key);
1845 edje_object_part_text_set(target, key, s);
1850 edje_object_part_text_set(target, key, "");
1857 _item_icon_realize(Elm_Genlist_Item *it,
1858 Evas_Object *target,
1861 Eina_List *res = NULL;
1863 if (it->itc->func.icon_get)
1868 *source = elm_widget_stringlist_get(edje_object_data_get(target, "icons"));
1869 EINA_LIST_FOREACH(*source, l, key)
1871 Evas_Object *ic = it->itc->func.icon_get
1872 ((void *)it->base.data, it->base.widget, key);
1876 res = eina_list_append(res, ic);
1877 edje_object_part_swallow(target, key, ic);
1878 evas_object_show(ic);
1879 elm_widget_sub_object_add(it->base.widget, ic);
1881 elm_widget_disabled_set(ic, EINA_TRUE);
1890 _item_state_realize(Elm_Genlist_Item *it,
1891 Evas_Object *target,
1894 if (it->itc->func.state_get)
1900 *source = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
1901 EINA_LIST_FOREACH(*source, l, key)
1903 Eina_Bool on = it->itc->func.state_get
1904 ((void *)it->base.data, it->base.widget, key);
1908 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
1909 edje_object_signal_emit(target, buf, "elm");
1913 snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
1914 edje_object_signal_emit(target, buf, "elm");
1921 _item_realize(Elm_Genlist_Item *it,
1925 Elm_Genlist_Item *it2;
1926 const char *treesize;
1928 int depth, tsize = 20;
1929 Item_Cache *itc = NULL;
1931 if (it->delete_me) return;
1932 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1935 if (it->order_num_in != in)
1937 it->order_num_in = in;
1938 _elm_genlist_item_odd_even_update(it);
1939 _elm_genlist_item_state_update(it, NULL);
1941 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1942 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1945 it->order_num_in = in;
1948 it->nocache = EINA_FALSE;
1950 itc = _item_cache_find(it);
1953 it->base.view = itc->base_view;
1954 itc->base_view = NULL;
1955 it->spacer = itc->spacer;
1960 const char *stacking_even;
1961 const char *stacking;
1963 it->base.view = edje_object_add(evas_object_evas_get(it->base.widget));
1964 edje_object_scale_set(it->base.view,
1965 elm_widget_scale_get(it->base.widget) *
1966 _elm_config->scale);
1967 evas_object_smart_member_add(it->base.view, it->wd->pan_smart);
1968 elm_widget_sub_object_add(it->base.widget, it->base.view);
1970 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS)
1971 strncpy(buf, "tree", sizeof(buf));
1972 else strncpy(buf, "item", sizeof(buf));
1973 if (it->wd->compress)
1974 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
1976 strncat(buf, "/", sizeof(buf) - strlen(buf));
1977 strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf));
1979 _elm_theme_object_set(it->base.widget, it->base.view, "genlist", buf,
1980 elm_widget_style_get(it->base.widget));
1982 stacking_even = edje_object_data_get(it->base.view, "stacking_even");
1983 if (!stacking_even) stacking_even = "above";
1984 it->stacking_even = !!strcmp("above", stacking_even);
1986 stacking = edje_object_data_get(it->base.view, "stacking");
1987 if (!stacking) stacking = "yes";
1988 it->nostacking = !!strcmp("yes", stacking);
1990 edje_object_mirrored_set(it->base.view,
1991 elm_widget_mirrored_get(it->base.widget));
1993 evas_object_rectangle_add(evas_object_evas_get(it->base.widget));
1994 evas_object_color_set(it->spacer, 0, 0, 0, 0);
1995 elm_widget_sub_object_add(it->base.widget, it->spacer);
1998 _elm_genlist_item_odd_even_update(it);
2000 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
2002 if (it2->parent->flags != ELM_GENLIST_ITEM_GROUP) depth += 1;
2004 it->expanded_depth = depth;
2005 treesize = edje_object_data_get(it->base.view, "treesize");
2006 if (treesize) tsize = atoi(treesize);
2007 evas_object_size_hint_min_set(it->spacer,
2008 (depth * tsize) * _elm_config->scale, 1);
2009 edje_object_part_swallow(it->base.view, "elm.swallow.pad", it->spacer);
2012 edje_object_signal_callback_add(it->base.view,
2013 "elm,action,expand,toggle",
2014 "elm", _signal_expand_toggle, it);
2015 edje_object_signal_callback_add(it->base.view, "elm,action,expand",
2016 "elm", _signal_expand, it);
2017 edje_object_signal_callback_add(it->base.view, "elm,action,contract",
2018 "elm", _signal_contract, it);
2019 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_DOWN,
2021 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_UP,
2023 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_MOVE,
2025 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_DOWN,
2027 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_UP,
2029 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_MOVE,
2032 _elm_genlist_item_state_update(it, itc);
2035 if ((calc) && (it->wd->homogeneous) && ((it->wd->item_width) || ((it->wd->item_width) && (it->wd->group_item_width))))
2037 /* homogenous genlist shortcut */
2040 if (it->flags & ELM_GENLIST_ITEM_GROUP)
2042 it->w = it->minw = it->wd->group_item_width;
2043 it->h = it->minh = it->wd->group_item_height;
2047 it->w = it->minw = it->wd->item_width;
2048 it->h = it->minh = it->wd->item_height;
2050 it->mincalcd = EINA_TRUE;
2055 /* FIXME: If you see that assert, please notify us and we
2056 will clean our mess */
2057 assert(eina_list_count(it->icon_objs) == 0);
2059 _item_label_realize(it, it->base.view, &it->labels);
2060 it->icon_objs = _item_icon_realize(it, it->base.view, &it->icons);
2061 _item_state_realize(it, it->base.view, &it->states);
2065 Evas_Coord mw = -1, mh = -1;
2067 if (!it->display_only)
2068 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2069 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
2070 edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw,
2072 if (!it->display_only)
2073 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2074 it->w = it->minw = mw;
2075 it->h = it->minh = mh;
2076 it->mincalcd = EINA_TRUE;
2078 if ((!it->wd->group_item_width) && (it->flags == ELM_GENLIST_ITEM_GROUP))
2080 it->wd->group_item_width = mw;
2081 it->wd->group_item_height = mh;
2083 else if ((!it->wd->item_width) && (it->flags == ELM_GENLIST_ITEM_NONE))
2085 it->wd->item_width = mw;
2086 it->wd->item_height = mh;
2089 if (!calc) evas_object_show(it->base.view);
2092 if (it->tooltip.content_cb)
2094 elm_widget_item_tooltip_content_cb_set(it,
2095 it->tooltip.content_cb,
2096 it->tooltip.data, NULL);
2097 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
2100 if (it->mouse_cursor)
2101 elm_widget_item_cursor_set(it, it->mouse_cursor);
2103 it->realized = EINA_TRUE;
2104 it->want_unrealize = EINA_FALSE;
2106 if (itc) _item_cache_free(itc);
2107 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2108 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2109 if (!calc) evas_object_smart_callback_call(it->base.widget, SIG_REALIZED, it);
2113 _item_unrealize(Elm_Genlist_Item *it, Eina_Bool calc)
2117 if (!it->realized) return;
2118 if (it->wd->reorder_it == it) return;
2119 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2120 if (!calc) evas_object_smart_callback_call(it->base.widget, SIG_UNREALIZED, it);
2123 ecore_timer_del(it->long_timer);
2124 it->long_timer = NULL;
2128 evas_object_del(it->base.view);
2129 it->base.view = NULL;
2130 evas_object_del(it->spacer);
2135 edje_object_mirrored_set(it->base.view, elm_widget_mirrored_get(it->base.widget));
2136 edje_object_scale_set(it->base.view, elm_widget_scale_get(it->base.widget) * _elm_config->scale);
2137 _item_cache_add(it);
2139 elm_widget_stringlist_free(it->labels);
2141 elm_widget_stringlist_free(it->icons);
2143 elm_widget_stringlist_free(it->states);
2145 EINA_LIST_FREE(it->icon_objs, icon)
2146 evas_object_del(icon);
2148 _mode_item_unrealize(it);
2150 it->realized = EINA_FALSE;
2151 it->want_unrealize = EINA_FALSE;
2152 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2153 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2157 _item_block_recalc(Item_Block *itb,
2162 Elm_Genlist_Item *it;
2163 Evas_Coord minw = 0, minh = 0;
2164 Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE;
2167 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2169 EINA_LIST_FOREACH(itb->items, l, it)
2171 if (it->delete_me) continue;
2172 showme |= it->showme;
2177 if (!it->mincalcd) changed = EINA_TRUE;
2180 _item_realize(it, in, EINA_TRUE);
2181 _item_unrealize(it, EINA_TRUE);
2186 _item_realize(it, in, EINA_TRUE);
2187 _item_unrealize(it, EINA_TRUE);
2191 _item_realize(it, in, EINA_FALSE);
2193 if (minw < it->minw) minw = it->minw;
2201 itb->changed = EINA_FALSE;
2202 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2203 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2208 _item_block_realize(Item_Block *itb,
2213 Elm_Genlist_Item *it;
2215 if (itb->realized) return;
2216 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2217 EINA_LIST_FOREACH(itb->items, l, it)
2219 if (it->delete_me) continue;
2220 if (full) _item_realize(it, in, EINA_FALSE);
2223 itb->realized = EINA_TRUE;
2224 itb->want_unrealize = EINA_FALSE;
2225 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2226 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2230 _item_block_unrealize(Item_Block *itb)
2233 Elm_Genlist_Item *it;
2234 Eina_Bool dragging = EINA_FALSE;
2236 if (!itb->realized) return;
2237 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2238 EINA_LIST_FOREACH(itb->items, l, it)
2240 if (it->flags != ELM_GENLIST_ITEM_GROUP)
2244 dragging = EINA_TRUE;
2245 it->want_unrealize = EINA_TRUE;
2248 _item_unrealize(it, EINA_FALSE);
2253 itb->realized = EINA_FALSE;
2254 itb->want_unrealize = EINA_TRUE;
2257 itb->want_unrealize = EINA_FALSE;
2258 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2259 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2263 _get_space_for_reorder_item(Elm_Genlist_Item *it)
2265 Evas_Coord rox, roy, row, roh, oy, oh;
2266 Eina_Bool top = EINA_FALSE;
2267 Elm_Genlist_Item *reorder_it = it->wd->reorder_it;
2268 if (!reorder_it) return 0;
2270 evas_object_geometry_get(it->wd->pan_smart, NULL, &oy, NULL, &oh);
2271 evas_object_geometry_get(it->wd->reorder_it->base.view, &rox, &roy, &row, &roh);
2273 if ((it->wd->reorder_start_y < it->block->y) &&
2274 (roy - oy + (roh / 2) >= it->block->y - it->wd->pan_y))
2276 it->block->reorder_offset = it->wd->reorder_it->h * -1;
2277 if (it->block->count == 1)
2278 it->wd->reorder_rel = it;
2280 else if ((it->wd->reorder_start_y >= it->block->y) &&
2281 (roy - oy + (roh / 2) <= it->block->y - it->wd->pan_y))
2283 it->block->reorder_offset = it->wd->reorder_it->h;
2286 it->block->reorder_offset = 0;
2288 it->scrl_y += it->block->reorder_offset;
2290 top = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
2291 rox, roy + (roh / 2), row, 1));
2294 it->wd->reorder_rel = it;
2295 it->scrl_y += it->wd->reorder_it->h;
2296 return it->wd->reorder_it->h;
2303 _reorder_item_moving_effect_timer_cb(void *data)
2305 Elm_Genlist_Item *it = data;
2306 Eina_Bool down = EINA_FALSE;
2308 int y, dy = it->h / 10 * _elm_config->scale, diff;
2309 time = REORDER_EFFECT_TIME;
2311 t = ((0.0 > (t = ecore_loop_time_get()-it->wd->start_time)) ? 0.0 : t);
2313 if (t <= time) y = (1 * sin((t / time) * (M_PI / 2)) * dy);
2316 diff = abs(it->old_scrl_y - it->scrl_y);
2317 if (diff > it->h) y = diff / 2;
2319 if (it->old_scrl_y < it->scrl_y)
2321 it->old_scrl_y += y;
2324 else if (it->old_scrl_y > it->scrl_y)
2326 it->old_scrl_y -= y;
2329 _item_position(it, it->base.view, it->scrl_x, it->old_scrl_y);
2330 _group_items_recalc(it->wd);
2332 if ((it->wd->reorder_pan_move) ||
2333 (down && it->old_scrl_y >= it->scrl_y) ||
2334 (!down && it->old_scrl_y <= it->scrl_y))
2336 it->old_scrl_y = it->scrl_y;
2337 it->move_effect_enabled = EINA_FALSE;
2338 it->wd->item_moving_effect_timer = NULL;
2339 return ECORE_CALLBACK_CANCEL;
2341 return ECORE_CALLBACK_RENEW;
2345 _item_position(Elm_Genlist_Item *it, Evas_Object *view, Evas_Coord it_x, Evas_Coord it_y)
2350 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2351 evas_object_resize(view, it->w, it->h);
2352 evas_object_move(view, it_x, it_y);
2353 evas_object_show(view);
2354 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2355 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2359 _item_block_position(Item_Block *itb,
2363 Elm_Genlist_Item *it;
2364 Elm_Genlist_Item *git;
2365 Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2368 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2369 evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh);
2370 evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy,
2372 EINA_LIST_FOREACH(itb->items, l, it)
2374 if (it->delete_me) continue;
2375 else if (it->wd->reorder_it == it) continue;
2379 it->scrl_x = itb->x + it->x - it->wd->pan_x + ox;
2380 it->scrl_y = itb->y + it->y - it->wd->pan_y + oy;
2382 vis = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
2383 cvx, cvy, cvw, cvh));
2384 if (it->flags != ELM_GENLIST_ITEM_GROUP)
2386 if ((itb->realized) && (!it->realized))
2388 if (vis) _item_realize(it, in, EINA_FALSE);
2394 if (it->wd->reorder_mode)
2395 y += _get_space_for_reorder_item(it);
2396 git = it->group_item;
2399 if (git->scrl_y < oy)
2401 if ((git->scrl_y + git->h) > (it->scrl_y + it->h))
2402 git->scrl_y = (it->scrl_y + it->h) - git->h;
2403 git->want_realize = EINA_TRUE;
2405 if ((it->wd->reorder_it) && (it->old_scrl_y != it->scrl_y))
2407 if (!it->move_effect_enabled)
2409 it->move_effect_enabled = EINA_TRUE;
2410 it->wd->item_moving_effect_timer = ecore_animator_add(_reorder_item_moving_effect_timer_cb, it);
2413 if (!it->move_effect_enabled)
2417 _item_position(it, it->mode_view, it->scrl_x, it->scrl_y);
2419 _item_position(it, it->base.view, it->scrl_x, it->scrl_y);
2421 it->old_scrl_x = it->scrl_x;
2422 it->old_scrl_y = it->scrl_y;
2427 if (!it->dragging) _item_unrealize(it, EINA_FALSE);
2434 if (vis) it->want_realize = EINA_TRUE;
2438 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2439 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2443 _group_items_recalc(void *data)
2445 Widget_Data *wd = data;
2447 Elm_Genlist_Item *git;
2449 evas_event_freeze(evas_object_evas_get(wd->obj));
2450 EINA_LIST_FOREACH(wd->group_items, l, git)
2452 if (git->want_realize)
2455 _item_realize(git, 0, EINA_FALSE);
2456 evas_object_resize(git->base.view, wd->minw, git->h);
2457 evas_object_move(git->base.view, git->scrl_x, git->scrl_y);
2458 evas_object_show(git->base.view);
2459 evas_object_raise(git->base.view);
2461 else if (!git->want_realize && git->realized)
2464 _item_unrealize(git, EINA_FALSE);
2467 evas_event_thaw(evas_object_evas_get(wd->obj));
2468 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2472 _must_recalc_idler(void *data)
2474 Widget_Data *wd = data;
2475 if (wd->calc_job) ecore_job_del(wd->calc_job);
2476 wd->calc_job = ecore_job_add(_calc_job, wd);
2477 wd->must_recalc_idler = NULL;
2478 return ECORE_CALLBACK_CANCEL;
2482 _calc_job(void *data)
2484 Widget_Data *wd = data;
2486 Evas_Coord minw = -1, minh = 0, y = 0, ow;
2487 Item_Block *chb = NULL;
2488 int in = 0, minw_change = 0;
2489 Eina_Bool changed = EINA_FALSE;
2491 Eina_Bool did_must_recalc = EINA_FALSE;
2494 t0 = ecore_time_get();
2495 evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h);
2499 evas_event_freeze(evas_object_evas_get(wd->obj));
2500 EINA_INLIST_FOREACH(wd->blocks, itb)
2502 Eina_Bool showme = EINA_FALSE;
2505 showme = itb->showme;
2506 itb->showme = EINA_FALSE;
2509 if (itb->realized) _item_block_unrealize(itb);
2511 if ((itb->changed) || (changed) ||
2512 ((itb->must_recalc) && (!did_must_recalc)))
2514 if ((changed) || (itb->must_recalc))
2517 Elm_Genlist_Item *it;
2518 EINA_LIST_FOREACH(itb->items, l, it)
2519 if (it->mincalcd) it->mincalcd = EINA_FALSE;
2520 itb->changed = EINA_TRUE;
2521 if (itb->must_recalc) did_must_recalc = EINA_TRUE;
2522 itb->must_recalc = EINA_FALSE;
2524 if (itb->realized) _item_block_unrealize(itb);
2525 showme = _item_block_recalc(itb, in, 0);
2531 if (minw == -1) minw = itb->minw;
2532 else if ((!itb->must_recalc) && (minw < itb->minw))
2541 if ((showme) && (wd->show_item) && (!wd->show_item->queued))
2543 wd->show_item->showme = EINA_FALSE;
2545 elm_smart_scroller_region_bring_in(wd->scr,
2547 wd->show_item->block->x,
2549 wd->show_item->block->y,
2550 wd->show_item->block->w,
2553 elm_smart_scroller_child_region_show(wd->scr,
2555 wd->show_item->block->x,
2557 wd->show_item->block->y,
2558 wd->show_item->block->w,
2560 wd->show_item = NULL;
2565 EINA_INLIST_FOREACH(wd->blocks, itb)
2571 if ((chb) && (EINA_INLIST_GET(chb)->next))
2573 EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb)
2575 if (itb->realized) _item_block_unrealize(itb);
2578 wd->realminw = minw;
2579 if (minw < wd->w) minw = wd->w;
2580 if ((minw != wd->minw) || (minh != wd->minh))
2584 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
2585 _sizing_eval(wd->obj);
2586 if ((wd->anchor_item) && (wd->anchor_item->block))
2588 Elm_Genlist_Item *it;
2591 it = wd->anchor_item;
2592 it_y = wd->anchor_y;
2593 elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x,
2594 it->block->y + it->y + it_y);
2595 wd->anchor_item = it;
2596 wd->anchor_y = it_y;
2599 t = ecore_time_get();
2600 if (did_must_recalc)
2602 if (!wd->must_recalc_idler)
2603 wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd);
2605 wd->calc_job = NULL;
2606 evas_object_smart_changed(wd->pan_smart);
2607 evas_event_thaw(evas_object_evas_get(wd->obj));
2608 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2612 _update_job(void *data)
2614 Widget_Data *wd = data;
2617 int num, num0, position = 0, recalc = 0;
2619 wd->update_job = NULL;
2622 evas_event_freeze(evas_object_evas_get(wd->obj));
2623 EINA_INLIST_FOREACH(wd->blocks, itb)
2625 Evas_Coord itminw, itminh;
2626 Elm_Genlist_Item *it;
2632 _item_block_position(itb, num);
2637 EINA_LIST_FOREACH(itb->items, l2, it)
2644 it->updateme = EINA_FALSE;
2647 _item_unrealize(it, EINA_FALSE);
2648 _item_realize(it, num, EINA_FALSE);
2653 _item_realize(it, num, EINA_TRUE);
2654 _item_unrealize(it, EINA_TRUE);
2656 if ((it->minw != itminw) || (it->minh != itminh))
2661 itb->updateme = EINA_FALSE;
2665 itb->changed = EINA_TRUE;
2666 _item_block_recalc(itb, num0, 0);
2667 _item_block_position(itb, num0);
2672 if (wd->calc_job) ecore_job_del(wd->calc_job);
2673 wd->calc_job = ecore_job_add(_calc_job, wd);
2675 evas_event_thaw(evas_object_evas_get(wd->obj));
2676 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2680 _pan_set(Evas_Object *obj,
2684 Pan *sd = evas_object_smart_data_get(obj);
2687 // Evas_Coord ow, oh;
2688 // evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2689 // ow = sd->wd->minw - ow;
2690 // if (ow < 0) ow = 0;
2691 // oh = sd->wd->minh - oh;
2692 // if (oh < 0) oh = 0;
2693 // if (x < 0) x = 0;
2694 // if (y < 0) y = 0;
2695 // if (x > ow) x = ow;
2696 // if (y > oh) y = oh;
2697 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
2701 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2703 if ((itb->y + itb->h) > y)
2705 Elm_Genlist_Item *it;
2708 EINA_LIST_FOREACH(itb->items, l2, it)
2710 if ((itb->y + it->y) >= y)
2712 sd->wd->anchor_item = it;
2713 sd->wd->anchor_y = -(itb->y + it->y - y);
2720 if (!sd->wd->item_moving_effect_timer) evas_object_smart_changed(obj);
2724 _pan_get(Evas_Object *obj,
2728 Pan *sd = evas_object_smart_data_get(obj);
2730 if (x) *x = sd->wd->pan_x;
2731 if (y) *y = sd->wd->pan_y;
2735 _pan_max_get(Evas_Object *obj,
2739 Pan *sd = evas_object_smart_data_get(obj);
2742 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2743 ow = sd->wd->minw - ow;
2745 oh = sd->wd->minh - oh;
2752 _pan_min_get(Evas_Object *obj __UNUSED__,
2761 _pan_child_size_get(Evas_Object *obj,
2765 Pan *sd = evas_object_smart_data_get(obj);
2767 if (w) *w = sd->wd->minw;
2768 if (h) *h = sd->wd->minh;
2772 _pan_add(Evas_Object *obj)
2775 Evas_Object_Smart_Clipped_Data *cd;
2778 cd = evas_object_smart_data_get(obj);
2781 sd->__clipped_data = *cd;
2783 evas_object_smart_data_set(obj, sd);
2787 _pan_del(Evas_Object *obj)
2789 Pan *sd = evas_object_smart_data_get(obj);
2794 ecore_job_del(sd->resize_job);
2795 sd->resize_job = NULL;
2801 _pan_resize_job(void *data)
2804 _sizing_eval(sd->wd->obj);
2805 sd->resize_job = NULL;
2809 _pan_resize(Evas_Object *obj,
2813 Pan *sd = evas_object_smart_data_get(obj);
2816 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2817 if ((ow == w) && (oh == h)) return;
2818 if ((sd->wd->height_for_width) && (ow != w))
2820 if (sd->resize_job) ecore_job_del(sd->resize_job);
2821 sd->resize_job = ecore_job_add(_pan_resize_job, sd);
2823 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2824 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2828 _pan_calculate(Evas_Object *obj)
2830 Pan *sd = evas_object_smart_data_get(obj);
2832 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2834 Elm_Genlist_Item *git;
2837 evas_event_freeze(evas_object_evas_get(obj));
2838 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
2839 evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
2840 EINA_LIST_FOREACH(sd->wd->group_items, l, git)
2842 git->want_realize = EINA_FALSE;
2844 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2846 itb->w = sd->wd->minw;
2847 if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox,
2848 itb->y - sd->wd->pan_y + oy,
2850 cvx, cvy, cvw, cvh))
2852 if ((!itb->realized) || (itb->changed))
2853 _item_block_realize(itb, in, 0);
2854 _item_block_position(itb, in);
2858 if (itb->realized) _item_block_unrealize(itb);
2862 if ((!sd->wd->reorder_it) || (sd->wd->reorder_pan_move))
2863 _group_items_recalc(sd->wd);
2864 if ((sd->wd->reorder_mode) && (sd->wd->reorder_it))
2866 if (sd->wd->pan_y != sd->wd->old_pan_y)
2867 sd->wd->reorder_pan_move = EINA_TRUE;
2868 else sd->wd->reorder_pan_move = EINA_FALSE;
2869 evas_object_raise(sd->wd->reorder_it->base.view);
2870 sd->wd->old_pan_y = sd->wd->pan_y;
2871 sd->wd->start_time = ecore_loop_time_get();
2873 evas_event_thaw(evas_object_evas_get(obj));
2874 evas_event_thaw_eval(evas_object_evas_get(obj));
2878 _pan_move(Evas_Object *obj,
2879 Evas_Coord x __UNUSED__,
2880 Evas_Coord y __UNUSED__)
2882 Pan *sd = evas_object_smart_data_get(obj);
2884 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2885 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2889 _hold_on(void *data __UNUSED__,
2891 void *event_info __UNUSED__)
2893 Widget_Data *wd = elm_widget_data_get(obj);
2895 elm_smart_scroller_hold_set(wd->scr, 1);
2899 _hold_off(void *data __UNUSED__,
2901 void *event_info __UNUSED__)
2903 Widget_Data *wd = elm_widget_data_get(obj);
2905 elm_smart_scroller_hold_set(wd->scr, 0);
2909 _freeze_on(void *data __UNUSED__,
2911 void *event_info __UNUSED__)
2913 Widget_Data *wd = elm_widget_data_get(obj);
2915 elm_smart_scroller_freeze_set(wd->scr, 1);
2919 _freeze_off(void *data __UNUSED__,
2921 void *event_info __UNUSED__)
2923 Widget_Data *wd = elm_widget_data_get(obj);
2925 elm_smart_scroller_freeze_set(wd->scr, 0);
2929 _scroll_edge_left(void *data,
2930 Evas_Object *scr __UNUSED__,
2931 void *event_info __UNUSED__)
2933 Evas_Object *obj = data;
2934 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_LEFT, NULL);
2938 _scroll_edge_right(void *data,
2939 Evas_Object *scr __UNUSED__,
2940 void *event_info __UNUSED__)
2942 Evas_Object *obj = data;
2943 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_RIGHT, NULL);
2947 _scroll_edge_top(void *data,
2948 Evas_Object *scr __UNUSED__,
2949 void *event_info __UNUSED__)
2951 Evas_Object *obj = data;
2952 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_TOP, NULL);
2956 _scroll_edge_bottom(void *data,
2957 Evas_Object *scr __UNUSED__,
2958 void *event_info __UNUSED__)
2960 Evas_Object *obj = data;
2961 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_BOTTOM, NULL);
2965 _mode_item_realize(Elm_Genlist_Item *it)
2969 if ((it->mode_view) || (it->delete_me)) return;
2971 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2972 it->mode_view = edje_object_add(evas_object_evas_get(it->base.widget));
2973 edje_object_scale_set(it->mode_view,
2974 elm_widget_scale_get(it->base.widget) *
2975 _elm_config->scale);
2976 evas_object_smart_member_add(it->mode_view, it->wd->pan_smart);
2977 elm_widget_sub_object_add(it->base.widget, it->mode_view);
2979 strncpy(buf, "item", sizeof(buf));
2980 if (it->wd->compress)
2981 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
2983 if (it->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
2984 strncat(buf, "/", sizeof(buf) - strlen(buf));
2985 strncat(buf, it->itc->mode_item_style, sizeof(buf) - strlen(buf));
2987 _elm_theme_object_set(it->base.widget, it->mode_view, "genlist", buf,
2988 elm_widget_style_get(it->base.widget));
2989 edje_object_mirrored_set(it->mode_view,
2990 elm_widget_mirrored_get(it->base.widget));
2992 /* signal callback add */
2993 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_DOWN,
2995 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_UP,
2997 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_MOVE,
3000 /* label_get, icon_get, state_get */
3001 /* FIXME: If you see that assert, please notify us and we
3002 will clean our mess */
3003 assert(eina_list_count(it->mode_icon_objs) == 0);
3005 _item_label_realize(it, it->mode_view, &it->mode_labels);
3006 it->mode_icon_objs = _item_icon_realize(it,
3009 _item_state_realize(it, it->mode_view, &it->mode_states);
3011 edje_object_part_swallow(it->mode_view,
3012 edje_object_data_get(it->mode_view, "mode_part"),
3015 it->want_unrealize = EINA_FALSE;
3016 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3017 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3021 _mode_item_unrealize(Elm_Genlist_Item *it)
3023 Widget_Data *wd = it->wd;
3025 if (!it->mode_view) return;
3027 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3028 elm_widget_stringlist_free(it->mode_labels);
3029 it->mode_labels = NULL;
3030 elm_widget_stringlist_free(it->mode_icons);
3031 it->mode_icons = NULL;
3032 elm_widget_stringlist_free(it->mode_states);
3034 EINA_LIST_FREE(it->mode_icon_objs, icon)
3035 evas_object_del(icon);
3037 edje_object_part_unswallow(it->mode_view, it->base.view);
3038 evas_object_smart_member_add(it->base.view, wd->pan_smart);
3039 evas_object_del(it->mode_view);
3040 it->mode_view = NULL;
3042 if (wd->mode_item == it)
3043 wd->mode_item = NULL;
3044 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3045 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3049 _item_mode_set(Elm_Genlist_Item *it)
3052 Widget_Data *wd = it->wd;
3057 it->nocache = EINA_TRUE;
3059 if (wd->scr_hold_timer)
3061 ecore_timer_del(wd->scr_hold_timer);
3062 wd->scr_hold_timer = NULL;
3064 elm_smart_scroller_hold_set(wd->scr, EINA_TRUE);
3065 wd->scr_hold_timer = ecore_timer_add(0.1, _scr_hold_timer_cb, wd);
3067 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3068 _mode_item_realize(it);
3069 _item_position(it, it->mode_view, it->scrl_x, it->scrl_y);
3070 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3071 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3073 snprintf(buf, sizeof(buf), "elm,state,%s,active", wd->mode_type);
3074 edje_object_signal_emit(it->mode_view, buf, "elm");
3078 _item_mode_unset(Widget_Data *wd)
3081 if (!wd->mode_item) return;
3082 char buf[1024], buf2[1024];
3083 Elm_Genlist_Item *it;
3086 it->nocache = EINA_TRUE;
3088 snprintf(buf, sizeof(buf), "elm,state,%s,passive", wd->mode_type);
3089 snprintf(buf2, sizeof(buf2), "elm,state,%s,passive,finished", wd->mode_type);
3091 edje_object_signal_emit(it->mode_view, buf, "elm");
3092 edje_object_signal_callback_add(it->mode_view, buf2, "elm", _mode_finished_signal_cb, it);
3094 wd->mode_item = NULL;
3098 * Add a new Genlist object
3100 * @param parent The parent object
3101 * @return The new object or NULL if it cannot be created
3106 elm_genlist_add(Evas_Object *parent)
3111 Evas_Coord minw, minh;
3112 static Evas_Smart *smart = NULL;
3116 static Evas_Smart_Class sc;
3118 evas_object_smart_clipped_smart_set(&_pan_sc);
3120 sc.name = "elm_genlist_pan";
3121 sc.version = EVAS_SMART_CLASS_VERSION;
3124 sc.resize = _pan_resize;
3125 sc.move = _pan_move;
3126 sc.calculate = _pan_calculate;
3127 if (!(smart = evas_smart_class_new(&sc))) return NULL;
3130 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
3132 ELM_SET_WIDTYPE(widtype, "genlist");
3133 elm_widget_type_set(obj, "genlist");
3134 elm_widget_sub_object_add(parent, obj);
3135 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
3136 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
3137 elm_widget_data_set(obj, wd);
3138 elm_widget_del_hook_set(obj, _del_hook);
3139 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
3140 elm_widget_theme_hook_set(obj, _theme_hook);
3141 elm_widget_can_focus_set(obj, EINA_TRUE);
3142 elm_widget_event_hook_set(obj, _event_hook);
3143 elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
3145 wd->scr = elm_smart_scroller_add(e);
3146 elm_smart_scroller_widget_set(wd->scr, obj);
3147 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
3148 elm_widget_style_get(obj));
3149 elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE,
3150 _elm_config->thumbscroll_bounce_enable);
3151 elm_widget_resize_object_set(obj, wd->scr);
3153 evas_object_smart_callback_add(wd->scr, "edge,left", _scroll_edge_left, obj);
3154 evas_object_smart_callback_add(wd->scr, "edge,right", _scroll_edge_right,
3156 evas_object_smart_callback_add(wd->scr, "edge,top", _scroll_edge_top, obj);
3157 evas_object_smart_callback_add(wd->scr, "edge,bottom", _scroll_edge_bottom,
3161 wd->mode = ELM_LIST_SCROLL;
3162 wd->max_items_per_block = MAX_ITEMS_PER_BLOCK;
3163 wd->item_cache_max = wd->max_items_per_block * 2;
3164 wd->longpress_timeout = _elm_config->longpress_timeout;
3166 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
3167 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
3168 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
3169 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
3171 wd->pan_smart = evas_object_smart_add(e, smart);
3172 wd->pan = evas_object_smart_data_get(wd->pan_smart);
3175 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
3176 _pan_set, _pan_get, _pan_max_get,
3177 _pan_min_get, _pan_child_size_get);
3179 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
3181 evas_object_size_hint_min_set(obj, minw, minh);
3183 evas_object_smart_callbacks_descriptions_set(obj, _signals);
3185 _mirrored_set(obj, elm_widget_mirrored_get(obj));
3190 static Elm_Genlist_Item *
3191 _item_new(Widget_Data *wd,
3192 const Elm_Genlist_Item_Class *itc,
3194 Elm_Genlist_Item *parent,
3195 Elm_Genlist_Item_Flags flags,
3197 const void *func_data)
3199 Elm_Genlist_Item *it;
3201 it = elm_widget_item_new(wd->obj, Elm_Genlist_Item);
3202 if (!it) return NULL;
3205 it->base.data = data;
3206 it->parent = parent;
3208 it->func.func = func;
3209 it->func.data = func_data;
3210 it->mouse_cursor = NULL;
3211 it->expanded_depth = 0;
3216 _item_block_add(Widget_Data *wd,
3217 Elm_Genlist_Item *it)
3219 Item_Block *itb = NULL;
3226 itb = calloc(1, sizeof(Item_Block));
3229 if (!it->rel->block)
3232 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3233 itb->items = eina_list_append(itb->items, it);
3239 wd->blocks = eina_inlist_prepend_relative
3240 (wd->blocks, EINA_INLIST_GET(itb),
3241 EINA_INLIST_GET(it->rel->block));
3243 eina_list_prepend_relative(itb->items, it, it->rel);
3247 wd->blocks = eina_inlist_append_relative
3248 (wd->blocks, EINA_INLIST_GET(itb),
3249 EINA_INLIST_GET(it->rel->block));
3251 eina_list_append_relative(itb->items, it, it->rel);
3261 itb = (Item_Block *)(wd->blocks);
3262 if (itb->count >= wd->max_items_per_block)
3264 itb = calloc(1, sizeof(Item_Block));
3268 eina_inlist_prepend(wd->blocks,
3269 EINA_INLIST_GET(itb));
3274 itb = calloc(1, sizeof(Item_Block));
3278 eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
3280 itb->items = eina_list_prepend(itb->items, it);
3286 itb = (Item_Block *)(wd->blocks->last);
3287 if (itb->count >= wd->max_items_per_block)
3289 itb = calloc(1, sizeof(Item_Block));
3293 eina_inlist_append(wd->blocks,
3294 EINA_INLIST_GET(itb));
3299 itb = calloc(1, sizeof(Item_Block));
3303 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3305 itb->items = eina_list_append(itb->items, it);
3311 itb = it->rel->block;
3312 if (!itb) goto newblock;
3314 itb->items = eina_list_prepend_relative(itb->items, it, it->rel);
3316 itb->items = eina_list_append_relative(itb->items, it, it->rel);
3319 itb->changed = EINA_TRUE;
3321 if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job);
3322 itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd);
3325 it->rel->relcount--;
3326 if ((it->rel->delete_me) && (!it->rel->relcount))
3330 if (itb->count > itb->wd->max_items_per_block)
3334 Elm_Genlist_Item *it2;
3336 newc = itb->count / 2;
3337 itb2 = calloc(1, sizeof(Item_Block));
3341 eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
3342 EINA_INLIST_GET(itb));
3343 itb2->changed = EINA_TRUE;
3344 while ((itb->count > newc) && (itb->items))
3348 l = eina_list_last(itb->items);
3350 itb->items = eina_list_remove_list(itb->items, l);
3353 itb2->items = eina_list_prepend(itb2->items, it2);
3361 _queue_process(Widget_Data *wd)
3364 Eina_Bool showme = EINA_FALSE;
3367 t0 = ecore_time_get();
3368 evas_event_freeze(evas_object_evas_get(wd->obj));
3369 for (n = 0; (wd->queue) && (n < 128); n++)
3371 Elm_Genlist_Item *it;
3373 it = wd->queue->data;
3374 wd->queue = eina_list_remove_list(wd->queue, wd->queue);
3375 it->queued = EINA_FALSE;
3376 _item_block_add(wd, it);
3377 t = ecore_time_get();
3378 if (it->block->changed)
3380 showme = _item_block_recalc(it->block, it->block->num, 1);
3381 it->block->changed = 0;
3383 if (showme) it->block->showme = EINA_TRUE;
3384 if (eina_inlist_count(wd->blocks) > 1)
3386 if ((t - t0) > (ecore_animator_frametime_get())) break;
3389 evas_event_thaw(evas_object_evas_get(wd->obj));
3390 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3395 _idle_process(void *data, Eina_Bool *wakeup)
3397 Widget_Data *wd = data;
3400 //static double q_start = 0.0;
3401 //if (q_start == 0.0) q_start = ecore_time_get();
3403 if (_queue_process(wd) > 0) *wakeup = EINA_TRUE;
3407 //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start);
3409 return ECORE_CALLBACK_CANCEL;
3411 return ECORE_CALLBACK_RENEW;
3415 _item_idle_enterer(void *data)
3417 Widget_Data *wd = data;
3418 Eina_Bool wakeup = EINA_FALSE;
3419 Eina_Bool ok = _idle_process(data, &wakeup);
3424 if (wd->calc_job) ecore_job_del(wd->calc_job);
3425 wd->calc_job = ecore_job_add(_calc_job, wd);
3427 if (ok == ECORE_CALLBACK_CANCEL) wd->queue_idle_enterer = NULL;
3432 _item_queue(Widget_Data *wd,
3433 Elm_Genlist_Item *it)
3435 if (it->queued) return;
3436 it->queued = EINA_TRUE;
3437 wd->queue = eina_list_append(wd->queue, it);
3438 // FIXME: why does a freeze then thaw here cause some genlist
3439 // elm_genlist_item_append() to be much much slower?
3440 // evas_event_freeze(evas_object_evas_get(wd->obj));
3441 while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
3443 if (wd->queue_idle_enterer)
3445 ecore_idle_enterer_del(wd->queue_idle_enterer);
3446 wd->queue_idle_enterer = NULL;
3450 // evas_event_thaw(evas_object_evas_get(wd->obj));
3451 // evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3452 if (!wd->queue_idle_enterer)
3453 wd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, wd);
3457 _elm_genlist_item_compare(const void *data, const void *data1)
3459 Elm_Genlist_Item *item, *item1;
3460 item = ELM_GENLIST_ITEM_FROM_INLIST(data);
3461 item1 = ELM_GENLIST_ITEM_FROM_INLIST(data1);
3462 return _elm_genlist_item_compare_cb(item->base.data, item1->base.data);
3466 _item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after)
3471 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3472 _item_block_del(it);
3474 it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
3476 it->rel->relcount++;
3477 it->before = EINA_FALSE;
3478 if (after->group_item) it->group_item = after->group_item;
3479 _item_queue(it->wd, it);
3481 if (it->itc->func.moved)
3482 it->itc->func.moved(it->base.widget, it, after, EINA_TRUE);
3486 _item_move_before(Elm_Genlist_Item *it, Elm_Genlist_Item *before)
3489 if (!before) return;
3491 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3492 _item_block_del(it);
3493 it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
3495 it->rel->relcount++;
3496 it->before = EINA_TRUE;
3497 if (before->group_item) it->group_item = before->group_item;
3498 _item_queue(it->wd, it);
3500 if (it->itc->func.moved)
3501 it->itc->func.moved(it->base.widget, it, before, EINA_FALSE);
3505 * Append item to the end of the genlist
3507 * This appends the given item to the end of the list or the end of
3508 * the children if the parent is given.
3510 * @param obj The genlist object
3511 * @param itc The item class for the item
3512 * @param data The item data
3513 * @param parent The parent item, or NULL if none
3514 * @param flags Item flags
3515 * @param func Convenience function called when item selected
3516 * @param func_data Data passed to @p func above.
3517 * @return A handle to the item added or NULL if not possible
3521 EAPI Elm_Genlist_Item *
3522 elm_genlist_item_append(Evas_Object *obj,
3523 const Elm_Genlist_Item_Class *itc,
3525 Elm_Genlist_Item *parent,
3526 Elm_Genlist_Item_Flags flags,
3528 const void *func_data)
3530 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3531 Widget_Data *wd = elm_widget_data_get(obj);
3532 if (!wd) return NULL;
3533 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3535 if (!it) return NULL;
3538 if (flags & ELM_GENLIST_ITEM_GROUP)
3539 wd->group_items = eina_list_append(wd->group_items, it);
3540 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
3545 Elm_Genlist_Item *it2 = NULL;
3546 Eina_List *ll = eina_list_last(it->parent->items);
3547 if (ll) it2 = ll->data;
3548 it->parent->items = eina_list_append(it->parent->items, it);
3549 if (!it2) it2 = it->parent;
3551 eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3552 EINA_INLIST_GET(it2));
3554 it->rel->relcount++;
3556 if (it->parent->flags & ELM_GENLIST_ITEM_GROUP)
3557 it->group_item = parent;
3558 else if (it->parent->group_item)
3559 it->group_item = it->parent->group_item;
3561 it->before = EINA_FALSE;
3562 _item_queue(wd, it);
3567 * Prepend item at start of the genlist
3569 * This adds an item to the beginning of the list or beginning of the
3570 * children of the parent if given.
3572 * @param obj The genlist object
3573 * @param itc The item class for the item
3574 * @param data The item data
3575 * @param parent The parent item, or NULL if none
3576 * @param flags Item flags
3577 * @param func Convenience function called when item selected
3578 * @param func_data Data passed to @p func above.
3579 * @return A handle to the item added or NULL if not possible
3583 EAPI Elm_Genlist_Item *
3584 elm_genlist_item_prepend(Evas_Object *obj,
3585 const Elm_Genlist_Item_Class *itc,
3587 Elm_Genlist_Item *parent,
3588 Elm_Genlist_Item_Flags flags,
3590 const void *func_data)
3592 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3593 Widget_Data *wd = elm_widget_data_get(obj);
3594 if (!wd) return NULL;
3595 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3597 if (!it) return NULL;
3600 if (flags & ELM_GENLIST_ITEM_GROUP)
3601 wd->group_items = eina_list_prepend(wd->group_items, it);
3602 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
3607 Elm_Genlist_Item *it2 = NULL;
3608 Eina_List *ll = it->parent->items;
3609 if (ll) it2 = ll->data;
3610 it->parent->items = eina_list_prepend(it->parent->items, it);
3611 if (!it2) it2 = it->parent;
3613 eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3614 EINA_INLIST_GET(it2));
3616 it->rel->relcount++;
3618 it->before = EINA_TRUE;
3619 _item_queue(wd, it);
3624 * Insert item before another in the genlist
3626 * This inserts an item before another in the list. It will be in the
3627 * same tree level or group as the item it is inseted before.
3629 * @param obj The genlist object
3630 * @param itc The item class for the item
3631 * @param data The item data
3632 * @param before The item to insert before
3633 * @param flags Item flags
3634 * @param func Convenience function called when item selected
3635 * @param func_data Data passed to @p func above.
3636 * @return A handle to the item added or NULL if not possible
3640 EAPI Elm_Genlist_Item *
3641 elm_genlist_item_insert_before(Evas_Object *obj,
3642 const Elm_Genlist_Item_Class *itc,
3644 Elm_Genlist_Item *parent,
3645 Elm_Genlist_Item *before,
3646 Elm_Genlist_Item_Flags flags,
3648 const void *func_data)
3650 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3651 EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
3652 Widget_Data *wd = elm_widget_data_get(obj);
3653 if (!wd) return NULL;
3654 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3656 if (!it) return NULL;
3659 it->parent->items = eina_list_prepend_relative(it->parent->items, it,
3662 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3663 EINA_INLIST_GET(before));
3665 it->rel->relcount++;
3666 it->before = EINA_TRUE;
3667 _item_queue(wd, it);
3672 * Insert a new item into the sorted genlist object
3674 * @param obj The genlist object
3675 * @param itc The item class for the item
3676 * @param data The item data
3677 * @param parent The parent item, or NULL if none
3678 * @param flags Item flags
3679 * @param comp The function called for the sort
3680 * @param func Convenience function called when item selected
3681 * @param func_data Data passed to @p func above.
3682 * @return A handle to the item added or NULL if not possible
3686 EAPI Elm_Genlist_Item *
3687 elm_genlist_item_sorted_insert(Evas_Object *obj,
3688 const Elm_Genlist_Item_Class *itc,
3690 Elm_Genlist_Item *parent,
3691 Elm_Genlist_Item_Flags flags,
3692 Eina_Compare_Cb comp,
3694 const void *func_data)
3696 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3697 Widget_Data *wd = elm_widget_data_get(obj);
3698 if (!wd) return NULL;
3699 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3701 if (!it) return NULL;
3703 _elm_genlist_item_compare_cb = comp;
3707 eina_list_sorted_insert(it->parent->items, comp, it);
3709 wd->items = eina_inlist_sorted_insert(wd->items, EINA_INLIST_GET(it),
3710 _elm_genlist_item_compare);
3711 if (EINA_INLIST_GET(it)->next)
3713 it->rel = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3714 it->rel->relcount++;
3715 it->before = EINA_TRUE;
3717 else if (EINA_INLIST_GET(it)->prev)
3719 it->rel = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3720 it->rel->relcount++;
3721 it->before = EINA_FALSE;
3723 _item_queue(wd, it);
3729 * Insert an item after another in the genlst
3731 * This inserts an item after another in the list. It will be in the
3732 * same tree level or group as the item it is inseted after.
3734 * @param obj The genlist object
3735 * @param itc The item class for the item
3736 * @param data The item data
3737 * @param after The item to insert after
3738 * @param flags Item flags
3739 * @param func Convenience function called when item selected
3740 * @param func_data Data passed to @p func above.
3741 * @return A handle to the item added or NULL if not possible
3745 EAPI Elm_Genlist_Item *
3746 elm_genlist_item_insert_after(Evas_Object *obj,
3747 const Elm_Genlist_Item_Class *itc,
3749 Elm_Genlist_Item *parent,
3750 Elm_Genlist_Item *after,
3751 Elm_Genlist_Item_Flags flags,
3753 const void *func_data)
3755 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3756 EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
3757 Widget_Data *wd = elm_widget_data_get(obj);
3758 if (!wd) return NULL;
3759 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3761 if (!it) return NULL;
3762 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3763 EINA_INLIST_GET(after));
3766 it->parent->items = eina_list_append_relative(it->parent->items, it,
3770 it->rel->relcount++;
3771 it->before = EINA_FALSE;
3772 _item_queue(wd, it);
3779 * This clears all items in the list, leaving it empty.
3781 * @param obj The genlist object
3786 elm_genlist_clear(Evas_Object *obj)
3788 ELM_CHECK_WIDTYPE(obj, widtype);
3789 Widget_Data *wd = elm_widget_data_get(obj);
3791 if (wd->walking > 0)
3793 Elm_Genlist_Item *it;
3795 wd->clear_me = EINA_TRUE;
3796 EINA_INLIST_FOREACH(wd->items, it)
3798 it->delete_me = EINA_TRUE;
3802 evas_event_freeze(evas_object_evas_get(wd->obj));
3805 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
3807 if (wd->anchor_item == it)
3809 wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3810 if (!wd->anchor_item)
3812 ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3814 wd->items = eina_inlist_remove(wd->items, wd->items);
3815 if (it->flags & ELM_GENLIST_ITEM_GROUP)
3816 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
3817 elm_widget_item_pre_notify_del(it);
3818 if (it->realized) _item_unrealize(it, EINA_FALSE);
3819 if (((wd->clear_me) || (!it->delete_me)) && (it->itc->func.del))
3820 it->itc->func.del((void *)it->base.data, it->base.widget);
3821 if (it->long_timer) ecore_timer_del(it->long_timer);
3822 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
3823 elm_widget_item_del(it);
3825 wd->clear_me = EINA_FALSE;
3826 wd->anchor_item = NULL;
3829 Item_Block *itb = (Item_Block *)(wd->blocks);
3831 wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
3832 if (itb->items) eina_list_free(itb->items);
3837 ecore_job_del(wd->calc_job);
3838 wd->calc_job = NULL;
3840 if (wd->queue_idle_enterer)
3842 ecore_idle_enterer_del(wd->queue_idle_enterer);
3843 wd->queue_idle_enterer = NULL;
3845 if (wd->must_recalc_idler)
3847 ecore_idler_del(wd->must_recalc_idler);
3848 wd->must_recalc_idler = NULL;
3852 eina_list_free(wd->queue);
3857 eina_list_free(wd->selected);
3858 wd->selected = NULL;
3860 if (wd->item_moving_effect_timer)
3862 ecore_animator_del(wd->item_moving_effect_timer);
3863 wd->item_moving_effect_timer = NULL;
3865 wd->show_item = NULL;
3873 evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
3874 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
3877 evas_event_thaw(evas_object_evas_get(wd->obj));
3878 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3882 * Enable or disable multi-select in the genlist
3884 * This enables (EINA_TRUE) or disables (EINA_FALSE) multi-select in
3885 * the list. This allows more than 1 item to be selected.
3887 * @param obj The genlist object
3888 * @param multi Multi-select enable/disable
3893 elm_genlist_multi_select_set(Evas_Object *obj,
3896 ELM_CHECK_WIDTYPE(obj, widtype);
3897 Widget_Data *wd = elm_widget_data_get(obj);
3903 * Gets if multi-select in genlist is enable or disable
3905 * @param obj The genlist object
3906 * @return Multi-select enable/disable
3907 * (EINA_TRUE = enabled/EINA_FALSE = disabled)
3912 elm_genlist_multi_select_get(const Evas_Object *obj)
3914 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3915 Widget_Data *wd = elm_widget_data_get(obj);
3916 if (!wd) return EINA_FALSE;
3921 * Get the selectd item in the genlist
3923 * This gets the selected item in the list (if multi-select is enabled
3924 * only the first item in the list is selected - which is not very
3925 * useful, so see elm_genlist_selected_items_get() for when
3926 * multi-select is used).
3928 * If no item is selected, NULL is returned.
3930 * @param obj The genlist object
3931 * @return The selected item, or NULL if none.
3935 EAPI Elm_Genlist_Item *
3936 elm_genlist_selected_item_get(const Evas_Object *obj)
3938 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3939 Widget_Data *wd = elm_widget_data_get(obj);
3940 if (!wd) return NULL;
3941 if (wd->selected) return wd->selected->data;
3946 * Get a list of selected items in the genlist
3948 * This returns a list of the selected items. This list pointer is
3949 * only valid so long as no items are selected or unselected (or
3950 * unselected implicitly by deletion). The list contains
3951 * Elm_Genlist_Item pointers.
3953 * @param obj The genlist object
3954 * @return The list of selected items, nor NULL if none are selected.
3958 EAPI const Eina_List *
3959 elm_genlist_selected_items_get(const Evas_Object *obj)
3961 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3962 Widget_Data *wd = elm_widget_data_get(obj);
3963 if (!wd) return NULL;
3964 return wd->selected;
3968 * Get a list of realized items in genlist
3970 * This returns a list of the realized items in the genlist. The list
3971 * contains Elm_Genlist_Item pointers. The list must be freed by the
3972 * caller when done with eina_list_free(). The item pointers in the
3973 * list are only valid so long as those items are not deleted or the
3974 * genlist is not deleted.
3976 * @param obj The genlist object
3977 * @return The list of realized items, nor NULL if none are realized.
3982 elm_genlist_realized_items_get(const Evas_Object *obj)
3984 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3985 Widget_Data *wd = elm_widget_data_get(obj);
3986 Eina_List *list = NULL;
3988 Eina_Bool done = EINA_FALSE;
3989 if (!wd) return NULL;
3990 EINA_INLIST_FOREACH(wd->blocks, itb)
3995 Elm_Genlist_Item *it;
3998 EINA_LIST_FOREACH(itb->items, l, it)
4000 if (it->realized) list = eina_list_append(list, it);
4012 * Get the item that is at the x, y canvas coords
4014 * This returns the item at the given coordinates (which are canvas
4015 * relative not object-relative). If an item is at that coordinate,
4016 * that item handle is returned, and if @p posret is not NULL, the
4017 * integer pointed to is set to a value of -1, 0 or 1, depending if
4018 * the coordinate is on the upper portion of that item (-1), on the
4019 * middle section (0) or on the lower part (1). If NULL is returned as
4020 * an item (no item found there), then posret may indicate -1 or 1
4021 * based if the coordinate is above or below all items respectively in
4024 * @param it The item
4025 * @param x The input x coordinate
4026 * @param y The input y coordinate
4027 * @param posret The position relative to the item returned here
4028 * @return The item at the coordinates or NULL if none
4032 EAPI Elm_Genlist_Item *
4033 elm_genlist_at_xy_item_get(const Evas_Object *obj,
4038 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4039 Widget_Data *wd = elm_widget_data_get(obj);
4040 Evas_Coord ox, oy, ow, oh;
4043 if (!wd) return NULL;
4044 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
4046 EINA_INLIST_FOREACH(wd->blocks, itb)
4049 Elm_Genlist_Item *it;
4051 if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
4052 oy + itb->y - itb->wd->pan_y,
4053 itb->w, itb->h, x, y, 1, 1))
4055 EINA_LIST_FOREACH(itb->items, l, it)
4057 Evas_Coord itx, ity;
4059 itx = ox + itb->x + it->x - itb->wd->pan_x;
4060 ity = oy + itb->y + it->y - itb->wd->pan_y;
4061 if (ELM_RECTS_INTERSECT(itx, ity, it->w, it->h, x, y, 1, 1))
4065 if (y <= (ity + (it->h / 4))) *posret = -1;
4066 else if (y >= (ity + it->h - (it->h / 4)))
4072 lasty = ity + it->h;
4077 if (y > lasty) *posret = 1;
4084 * Get the first item in the genlist
4086 * This returns the first item in the list.
4088 * @param obj The genlist object
4089 * @return The first item, or NULL if none
4093 EAPI Elm_Genlist_Item *
4094 elm_genlist_first_item_get(const Evas_Object *obj)
4096 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4097 Widget_Data *wd = elm_widget_data_get(obj);
4098 if (!wd) return NULL;
4099 if (!wd->items) return NULL;
4100 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
4101 while ((it) && (it->delete_me))
4102 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
4107 * Get the last item in the genlist
4109 * This returns the last item in the list.
4111 * @return The last item, or NULL if none
4115 EAPI Elm_Genlist_Item *
4116 elm_genlist_last_item_get(const Evas_Object *obj)
4118 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4119 Widget_Data *wd = elm_widget_data_get(obj);
4120 if (!wd) return NULL;
4121 if (!wd->items) return NULL;
4122 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
4123 while ((it) && (it->delete_me))
4124 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
4129 * Get the next item in the genlist
4131 * This returns the item after the item @p it.
4133 * @param it The item
4134 * @return The item after @p it, or NULL if none
4138 EAPI Elm_Genlist_Item *
4139 elm_genlist_item_next_get(const Elm_Genlist_Item *it)
4141 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4144 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
4145 if ((it) && (!it->delete_me)) break;
4147 return (Elm_Genlist_Item *)it;
4151 * Get the previous item in the genlist
4153 * This returns the item before the item @p it.
4155 * @param it The item
4156 * @return The item before @p it, or NULL if none
4160 EAPI Elm_Genlist_Item *
4161 elm_genlist_item_prev_get(const Elm_Genlist_Item *it)
4163 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4166 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
4167 if ((it) && (!it->delete_me)) break;
4169 return (Elm_Genlist_Item *)it;
4173 * Get the genlist object from an item
4175 * This returns the genlist object itself that an item belongs to.
4177 * @param it The item
4178 * @return The genlist object
4183 elm_genlist_item_genlist_get(const Elm_Genlist_Item *it)
4185 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4186 return it->base.widget;
4190 * Get the parent item of the given item
4192 * This returns the parent item of the item @p it given.
4194 * @param it The item
4195 * @return The parent of the item or NULL if none
4199 EAPI Elm_Genlist_Item *
4200 elm_genlist_item_parent_get(const Elm_Genlist_Item *it)
4202 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4207 * Clear all sub-items (children) of the given item
4209 * This clears all items that are children (or their descendants) of the
4212 * @param it The item
4217 elm_genlist_item_subitems_clear(Elm_Genlist_Item *it)
4219 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4220 Eina_List *tl = NULL, *l;
4221 Elm_Genlist_Item *it2;
4223 EINA_LIST_FOREACH(it->items, l, it2)
4224 tl = eina_list_append(tl, it2);
4225 EINA_LIST_FREE(tl, it2)
4226 elm_genlist_item_del(it2);
4230 * Set the selected state of an item
4232 * This sets the selected state (1 selected, 0 not selected) of the given
4235 * @param it The item
4236 * @param selected The selected state
4241 elm_genlist_item_selected_set(Elm_Genlist_Item *it,
4244 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4245 Widget_Data *wd = elm_widget_data_get(it->base.widget);
4247 if ((it->delete_me) || (it->disabled)) return;
4248 selected = !!selected;
4249 if (it->selected == selected) return;
4255 while (wd->selected)
4257 _item_unhighlight(wd->selected->data);
4258 _item_unselect(wd->selected->data);
4261 _item_highlight(it);
4266 _item_unhighlight(it);
4272 * Get the selected state of an item
4274 * This gets the selected state of an item (1 selected, 0 not selected).
4276 * @param it The item
4277 * @return The selected state
4282 elm_genlist_item_selected_get(const Elm_Genlist_Item *it)
4284 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4285 return it->selected;
4289 * Sets the expanded state of an item (if it's a parent)
4291 * This expands or contracts a parent item (thus showing or hiding the
4294 * @param it The item
4295 * @param expanded The expanded state (1 expanded, 0 not expanded).
4300 elm_genlist_item_expanded_set(Elm_Genlist_Item *it,
4303 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4304 if (it->expanded == expanded) return;
4305 it->expanded = expanded;
4309 edje_object_signal_emit(it->base.view, "elm,state,expanded", "elm");
4310 evas_object_smart_callback_call(it->base.widget, SIG_EXPANDED, it);
4315 edje_object_signal_emit(it->base.view, "elm,state,contracted", "elm");
4316 evas_object_smart_callback_call(it->base.widget, SIG_CONTRACTED, it);
4321 * Get the expanded state of an item
4323 * This gets the expanded state of an item
4325 * @param it The item
4326 * @return Thre expanded state
4331 elm_genlist_item_expanded_get(const Elm_Genlist_Item *it)
4333 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4334 return it->expanded;
4338 * Get the depth of expanded item
4340 * @param it The genlist item object
4341 * @return The depth of expanded item
4346 elm_genlist_item_expanded_depth_get(const Elm_Genlist_Item *it)
4348 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, 0);
4349 return it->expanded_depth;
4353 * Sets the disabled state of an item.
4355 * A disabled item cannot be selected or unselected. It will also
4356 * change appearance to appear disabled. This sets the disabled state
4357 * (1 disabled, 0 not disabled).
4359 * @param it The item
4360 * @param disabled The disabled state
4365 elm_genlist_item_disabled_set(Elm_Genlist_Item *it,
4368 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4371 if (it->disabled == disabled) return;
4372 if (it->delete_me) return;
4373 it->disabled = !!disabled;
4375 elm_genlist_item_selected_set(it, EINA_FALSE);
4379 edje_object_signal_emit(it->base.view, "elm,state,disabled", "elm");
4381 edje_object_signal_emit(it->base.view, "elm,state,enabled", "elm");
4382 EINA_LIST_FOREACH(it->icon_objs, l, obj)
4383 elm_widget_disabled_set(obj, disabled);
4388 * Get the disabled state of an item
4390 * This gets the disabled state of the given item.
4392 * @param it The item
4393 * @return The disabled state
4398 elm_genlist_item_disabled_get(const Elm_Genlist_Item *it)
4400 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4401 if (it->delete_me) return EINA_FALSE;
4402 return it->disabled;
4406 * Sets the display only state of an item.
4408 * A display only item cannot be selected or unselected. It is for
4409 * display only and not selecting or otherwise clicking, dragging
4410 * etc. by the user, thus finger size rules will not be applied to
4413 * @param it The item
4414 * @param display_only The display only state
4419 elm_genlist_item_display_only_set(Elm_Genlist_Item *it,
4420 Eina_Bool display_only)
4422 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4423 if (it->display_only == display_only) return;
4424 if (it->delete_me) return;
4425 it->display_only = display_only;
4426 it->mincalcd = EINA_FALSE;
4427 it->updateme = EINA_TRUE;
4428 if (it->block) it->block->updateme = EINA_TRUE;
4429 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4430 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4434 * Get the display only state of an item
4436 * This gets the display only state of the given item.
4438 * @param it The item
4439 * @return The display only state
4444 elm_genlist_item_display_only_get(const Elm_Genlist_Item *it)
4446 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4447 if (it->delete_me) return EINA_FALSE;
4448 return it->display_only;
4452 * Show the given item
4454 * This causes genlist to jump to the given item @p it and show it (by
4455 * scrolling), if it is not fully visible.
4457 * @param it The item
4462 elm_genlist_item_show(Elm_Genlist_Item *it)
4464 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4465 Evas_Coord gith = 0;
4466 if (it->delete_me) return;
4467 if ((it->queued) || (!it->mincalcd))
4469 it->wd->show_item = it;
4470 it->wd->bring_in = EINA_TRUE;
4471 it->showme = EINA_TRUE;
4474 if (it->wd->show_item)
4476 it->wd->show_item->showme = EINA_FALSE;
4477 it->wd->show_item = NULL;
4479 if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
4480 gith = it->group_item->h;
4481 elm_smart_scroller_child_region_show(it->wd->scr,
4482 it->x + it->block->x,
4483 it->y + it->block->y - gith,
4484 it->block->w, it->h);
4488 * Bring in the given item
4490 * This causes genlist to jump to the given item @p it and show it (by
4491 * scrolling), if it is not fully visible. This may use animation to
4492 * do so and take a period of time
4494 * @param it The item
4499 elm_genlist_item_bring_in(Elm_Genlist_Item *it)
4501 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4502 Evas_Coord gith = 0;
4503 if (it->delete_me) return;
4504 if ((it->queued) || (!it->mincalcd))
4506 it->wd->show_item = it;
4507 it->wd->bring_in = EINA_TRUE;
4508 it->showme = EINA_TRUE;
4511 if (it->wd->show_item)
4513 it->wd->show_item->showme = EINA_FALSE;
4514 it->wd->show_item = NULL;
4516 if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
4517 gith = it->group_item->h;
4518 elm_smart_scroller_region_bring_in(it->wd->scr,
4519 it->x + it->block->x,
4520 it->y + it->block->y - gith,
4521 it->block->w, it->h);
4525 * Show the given item at the top
4527 * This causes genlist to jump to the given item @p it and show it (by
4528 * scrolling), if it is not fully visible.
4530 * @param it The item
4535 elm_genlist_item_top_show(Elm_Genlist_Item *it)
4537 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4539 Evas_Coord gith = 0;
4541 if (it->delete_me) return;
4542 if ((it->queued) || (!it->mincalcd))
4544 it->wd->show_item = it;
4545 it->wd->bring_in = EINA_TRUE;
4546 it->showme = EINA_TRUE;
4549 if (it->wd->show_item)
4551 it->wd->show_item->showme = EINA_FALSE;
4552 it->wd->show_item = NULL;
4554 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4555 if (it->group_item) gith = it->group_item->h;
4556 elm_smart_scroller_child_region_show(it->wd->scr,
4557 it->x + it->block->x,
4558 it->y + it->block->y - gith,
4563 * Bring in the given item at the top
4565 * This causes genlist to jump to the given item @p it and show it (by
4566 * scrolling), if it is not fully visible. This may use animation to
4567 * do so and take a period of time
4569 * @param it The item
4574 elm_genlist_item_top_bring_in(Elm_Genlist_Item *it)
4576 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4578 Evas_Coord gith = 0;
4580 if (it->delete_me) return;
4581 if ((it->queued) || (!it->mincalcd))
4583 it->wd->show_item = it;
4584 it->wd->bring_in = EINA_TRUE;
4585 it->showme = EINA_TRUE;
4588 if (it->wd->show_item)
4590 it->wd->show_item->showme = EINA_FALSE;
4591 it->wd->show_item = NULL;
4593 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4594 if (it->group_item) gith = it->group_item->h;
4595 elm_smart_scroller_region_bring_in(it->wd->scr,
4596 it->x + it->block->x,
4597 it->y + it->block->y - gith,
4602 * Show the given item at the middle
4604 * This causes genlist to jump to the given item @p it and show it (by
4605 * scrolling), if it is not fully visible.
4607 * @param it The item
4612 elm_genlist_item_middle_show(Elm_Genlist_Item *it)
4614 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4617 if (it->delete_me) return;
4618 if ((it->queued) || (!it->mincalcd))
4620 it->wd->show_item = it;
4621 it->wd->bring_in = EINA_TRUE;
4622 it->showme = EINA_TRUE;
4625 if (it->wd->show_item)
4627 it->wd->show_item->showme = EINA_FALSE;
4628 it->wd->show_item = NULL;
4630 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4631 elm_smart_scroller_child_region_show(it->wd->scr,
4632 it->x + it->block->x,
4633 it->y + it->block->y - oh / 2 +
4634 it->h / 2, it->block->w, oh);
4638 * Bring in the given item at the middle
4640 * This causes genlist to jump to the given item @p it and show it (by
4641 * scrolling), if it is not fully visible. This may use animation to
4642 * do so and take a period of time
4644 * @param it The item
4649 elm_genlist_item_middle_bring_in(Elm_Genlist_Item *it)
4651 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4654 if (it->delete_me) return;
4655 if ((it->queued) || (!it->mincalcd))
4657 it->wd->show_item = it;
4658 it->wd->bring_in = EINA_TRUE;
4659 it->showme = EINA_TRUE;
4662 if (it->wd->show_item)
4664 it->wd->show_item->showme = EINA_FALSE;
4665 it->wd->show_item = NULL;
4667 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4668 elm_smart_scroller_region_bring_in(it->wd->scr,
4669 it->x + it->block->x,
4670 it->y + it->block->y - oh / 2 + it->h / 2,
4675 * Delete a given item
4677 * This deletes the item from genlist and calls the genlist item del
4678 * class callback defined in the item class, if it is set. This clears all
4679 * subitems if it is a tree.
4681 * @param it The item
4686 elm_genlist_item_del(Elm_Genlist_Item *it)
4688 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4689 if ((it->relcount > 0) || (it->walking > 0))
4691 elm_widget_item_pre_notify_del(it);
4692 elm_genlist_item_subitems_clear(it);
4693 it->delete_me = EINA_TRUE;
4694 if (it->wd->show_item == it) it->wd->show_item = NULL;
4696 it->wd->selected = eina_list_remove(it->wd->selected,
4700 if (it->realized) _item_unrealize(it, EINA_FALSE);
4701 it->block->changed = EINA_TRUE;
4702 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
4703 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
4705 if (it->itc->func.del)
4706 it->itc->func.del((void *)it->base.data, it->base.widget);
4713 * Set the data item from the genlist item
4715 * This set the data value passed on the elm_genlist_item_append() and
4716 * related item addition calls. This function will also call
4717 * elm_genlist_item_update() so the item will be updated to reflect the
4720 * @param it The item
4721 * @param data The new data pointer to set
4726 elm_genlist_item_data_set(Elm_Genlist_Item *it,
4729 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4730 elm_widget_item_data_set(it, data);
4731 elm_genlist_item_update(it);
4735 * Get the data item from the genlist item
4737 * This returns the data value passed on the elm_genlist_item_append()
4738 * and related item addition calls and elm_genlist_item_data_set().
4740 * @param it The item
4741 * @return The data pointer provided when created
4746 elm_genlist_item_data_get(const Elm_Genlist_Item *it)
4748 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4749 return elm_widget_item_data_get(it);
4753 * Tells genlist to "orphan" icons fetchs by the item class
4755 * This instructs genlist to release references to icons in the item,
4756 * meaning that they will no longer be managed by genlist and are
4757 * floating "orphans" that can be re-used elsewhere if the user wants
4760 * @param it The item
4765 elm_genlist_item_icons_orphan(Elm_Genlist_Item *it)
4768 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4769 EINA_LIST_FREE(it->icon_objs, icon)
4771 elm_widget_sub_object_del(it->base.widget, icon);
4772 evas_object_smart_member_del(icon);
4773 evas_object_hide(icon);
4778 * Get the real evas object of the genlist item
4780 * This returns the actual evas object used for the specified genlist
4781 * item. This may be NULL as it may not be created, and may be deleted
4782 * at any time by genlist. Do not modify this object (move, resize,
4783 * show, hide etc.) as genlist is controlling it. This function is for
4784 * querying, emitting custom signals or hooking lower level callbacks
4785 * for events. Do not delete this object under any circumstances.
4787 * @param it The item
4788 * @return The object pointer
4792 EAPI const Evas_Object *
4793 elm_genlist_item_object_get(const Elm_Genlist_Item *it)
4795 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4796 return it->base.view;
4800 * Update the contents of an item
4802 * This updates an item by calling all the item class functions again
4803 * to get the icons, labels and states. Use this when the original
4804 * item data has changed and the changes are desired to be reflected.
4806 * @param it The item
4811 elm_genlist_item_update(Elm_Genlist_Item *it)
4813 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4814 if (!it->block) return;
4815 if (it->delete_me) return;
4816 it->mincalcd = EINA_FALSE;
4817 it->updateme = EINA_TRUE;
4818 it->block->updateme = EINA_TRUE;
4819 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4820 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4824 * Update the item class of an item
4826 * @param it The item
4827 * @parem itc The item class for the item
4832 elm_genlist_item_item_class_update(Elm_Genlist_Item *it,
4833 const Elm_Genlist_Item_Class *itc)
4835 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4836 if (!it->block) return;
4837 EINA_SAFETY_ON_NULL_RETURN(itc);
4838 if (it->delete_me) return;
4840 it->nocache = EINA_TRUE;
4841 elm_genlist_item_update(it);
4844 static Evas_Object *
4845 _elm_genlist_item_label_create(void *data,
4847 void *item __UNUSED__)
4849 Evas_Object *label = elm_label_add(obj);
4852 elm_object_style_set(label, "tooltip");
4853 elm_label_label_set(label, data);
4858 _elm_genlist_item_label_del_cb(void *data,
4859 Evas_Object *obj __UNUSED__,
4860 void *event_info __UNUSED__)
4862 eina_stringshare_del(data);
4866 * Set the text to be shown in the genlist item.
4868 * @param item Target item
4869 * @param text The text to set in the content
4871 * Setup the text as tooltip to object. The item can have only one
4872 * tooltip, so any previous tooltip data is removed.
4877 elm_genlist_item_tooltip_text_set(Elm_Genlist_Item *item,
4880 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4881 text = eina_stringshare_add(text);
4882 elm_genlist_item_tooltip_content_cb_set(item, _elm_genlist_item_label_create,
4884 _elm_genlist_item_label_del_cb);
4888 * Set the content to be shown in the tooltip item
4890 * Setup the tooltip to item. The item can have only one tooltip, so
4891 * any previous tooltip data is removed. @p func(with @p data) will be
4892 * called every time that need to show the tooltip and it should return a
4893 * valid Evas_Object. This object is then managed fully by tooltip
4894 * system and is deleted when the tooltip is gone.
4896 * @param item the genlist item being attached by a tooltip.
4897 * @param func the function used to create the tooltip contents.
4898 * @param data what to provide to @a func as callback data/context.
4899 * @param del_cb called when data is not needed anymore, either when
4900 * another callback replaces @func, the tooltip is unset with
4901 * elm_genlist_item_tooltip_unset() or the owner @a item
4902 * dies. This callback receives as the first parameter the
4903 * given @a data, and @c event_info is the item.
4908 elm_genlist_item_tooltip_content_cb_set(Elm_Genlist_Item *item,
4909 Elm_Tooltip_Item_Content_Cb func,
4911 Evas_Smart_Cb del_cb)
4913 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(item, error);
4915 if ((item->tooltip.content_cb == func) && (item->tooltip.data == data))
4918 if (item->tooltip.del_cb)
4919 item->tooltip.del_cb((void *)item->tooltip.data,
4920 item->base.widget, item);
4922 item->tooltip.content_cb = func;
4923 item->tooltip.data = data;
4924 item->tooltip.del_cb = del_cb;
4926 if (item->base.view)
4928 elm_widget_item_tooltip_content_cb_set(item,
4929 item->tooltip.content_cb,
4930 item->tooltip.data, NULL);
4931 elm_widget_item_tooltip_style_set(item, item->tooltip.style);
4937 if (del_cb) del_cb((void *)data, NULL, NULL);
4941 * Unset tooltip from item
4943 * @param item genlist item to remove previously set tooltip.
4945 * Remove tooltip from item. The callback provided as del_cb to
4946 * elm_genlist_item_tooltip_content_cb_set() will be called to notify
4947 * it is not used anymore.
4949 * @see elm_genlist_item_tooltip_content_cb_set()
4954 elm_genlist_item_tooltip_unset(Elm_Genlist_Item *item)
4956 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4957 if ((item->base.view) && (item->tooltip.content_cb))
4958 elm_widget_item_tooltip_unset(item);
4960 if (item->tooltip.del_cb)
4961 item->tooltip.del_cb((void *)item->tooltip.data, item->base.widget, item);
4962 item->tooltip.del_cb = NULL;
4963 item->tooltip.content_cb = NULL;
4964 item->tooltip.data = NULL;
4965 if (item->tooltip.style)
4966 elm_genlist_item_tooltip_style_set(item, NULL);
4970 * Sets a different style for this item tooltip.
4972 * @note before you set a style you should define a tooltip with
4973 * elm_genlist_item_tooltip_content_cb_set() or
4974 * elm_genlist_item_tooltip_text_set()
4976 * @param item genlist item with tooltip already set.
4977 * @param style the theme style to use (default, transparent, ...)
4982 elm_genlist_item_tooltip_style_set(Elm_Genlist_Item *item,
4985 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4986 eina_stringshare_replace(&item->tooltip.style, style);
4987 if (item->base.view) elm_widget_item_tooltip_style_set(item, style);
4991 * Get the style for this item tooltip.
4993 * @param item genlist item with tooltip already set.
4994 * @return style the theme style in use, defaults to "default". If the
4995 * object does not have a tooltip set, then NULL is returned.
5000 elm_genlist_item_tooltip_style_get(const Elm_Genlist_Item *item)
5002 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
5003 return item->tooltip.style;
5007 * Set the cursor to be shown when mouse is over the genlist item
5009 * @param item Target item
5010 * @param cursor the cursor name to be used.
5012 * @see elm_object_cursor_set()
5016 elm_genlist_item_cursor_set(Elm_Genlist_Item *item,
5019 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
5020 eina_stringshare_replace(&item->mouse_cursor, cursor);
5021 if (item->base.view) elm_widget_item_cursor_set(item, cursor);
5025 * Get the cursor to be shown when mouse is over the genlist item
5027 * @param item genlist item with cursor already set.
5028 * @return the cursor name.
5033 elm_genlist_item_cursor_get(const Elm_Genlist_Item *item)
5035 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
5036 return elm_widget_item_cursor_get(item);
5040 * Unset the cursor to be shown when mouse is over the genlist item
5042 * @param item Target item
5044 * @see elm_object_cursor_unset()
5048 elm_genlist_item_cursor_unset(Elm_Genlist_Item *item)
5050 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
5051 if (!item->mouse_cursor)
5054 if (item->base.view)
5055 elm_widget_item_cursor_unset(item);
5057 eina_stringshare_del(item->mouse_cursor);
5058 item->mouse_cursor = NULL;
5062 * Sets a different style for this item cursor.
5064 * @note before you set a style you should define a cursor with
5065 * elm_genlist_item_cursor_set()
5067 * @param item genlist item with cursor already set.
5068 * @param style the theme style to use (default, transparent, ...)
5073 elm_genlist_item_cursor_style_set(Elm_Genlist_Item *item,
5076 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
5077 elm_widget_item_cursor_style_set(item, style);
5081 * Get the style for this item cursor.
5083 * @param item genlist item with cursor already set.
5084 * @return style the theme style in use, defaults to "default". If the
5085 * object does not have a cursor set, then NULL is returned.
5090 elm_genlist_item_cursor_style_get(const Elm_Genlist_Item *item)
5092 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
5093 return elm_widget_item_cursor_style_get(item);
5097 * Set if the cursor set should be searched on the theme or should use
5098 * the provided by the engine, only.
5100 * @note before you set if should look on theme you should define a
5101 * cursor with elm_object_cursor_set(). By default it will only look
5102 * for cursors provided by the engine.
5104 * @param item widget item with cursor already set.
5105 * @param engine_only boolean to define it cursors should be looked
5106 * only between the provided by the engine or searched on widget's
5112 elm_genlist_item_cursor_engine_only_set(Elm_Genlist_Item *item,
5113 Eina_Bool engine_only)
5115 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
5116 elm_widget_item_cursor_engine_only_set(item, engine_only);
5120 * Get the cursor engine only usage for this item cursor.
5122 * @param item widget item with cursor already set.
5123 * @return engine_only boolean to define it cursors should be looked
5124 * only between the provided by the engine or searched on widget's
5125 * theme as well. If the object does not have a cursor set, then
5126 * EINA_FALSE is returned.
5131 elm_genlist_item_cursor_engine_only_get(const Elm_Genlist_Item *item)
5133 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
5134 return elm_widget_item_cursor_engine_only_get(item);
5138 * This sets the horizontal stretching mode
5140 * This sets the mode used for sizing items horizontally. Valid modes
5141 * are ELM_LIST_LIMIT and ELM_LIST_SCROLL. The default is
5142 * ELM_LIST_SCROLL. This mode means that if items are too wide to fit,
5143 * the scroller will scroll horizontally. Otherwise items are expanded
5144 * to fill the width of the viewport of the scroller. If it is
5145 * ELM_LIST_LIMIT, Items will be expanded to the viewport width and
5146 * limited to that size.
5148 * @param obj The genlist object
5149 * @param mode The mode to use
5154 elm_genlist_horizontal_mode_set(Evas_Object *obj,
5157 ELM_CHECK_WIDTYPE(obj, widtype);
5158 Widget_Data *wd = elm_widget_data_get(obj);
5160 if (wd->mode == mode) return;
5166 * Gets the horizontal stretching mode
5168 * @param obj The genlist object
5169 * @return The mode to use
5170 * (ELM_LIST_LIMIT, ELM_LIST_SCROLL)
5175 elm_genlist_horizontal_mode_get(const Evas_Object *obj)
5177 ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
5178 Widget_Data *wd = elm_widget_data_get(obj);
5179 if (!wd) return ELM_LIST_LAST;
5184 * Set the always select mode.
5186 * Items will only call their selection func and callback when first
5187 * becoming selected. Any further clicks will do nothing, unless you
5188 * enable always select with elm_genlist_always_select_mode_set().
5189 * This means even if selected, every click will make the selected
5190 * callbacks be called.
5192 * @param obj The genlist object
5193 * @param always_select The always select mode
5194 * (EINA_TRUE = on, EINA_FALSE = off)
5199 elm_genlist_always_select_mode_set(Evas_Object *obj,
5200 Eina_Bool always_select)
5202 ELM_CHECK_WIDTYPE(obj, widtype);
5203 Widget_Data *wd = elm_widget_data_get(obj);
5205 wd->always_select = always_select;
5209 * Get the always select mode.
5211 * @param obj The genlist object
5212 * @return The always select mode
5213 * (EINA_TRUE = on, EINA_FALSE = off)
5218 elm_genlist_always_select_mode_get(const Evas_Object *obj)
5220 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5221 Widget_Data *wd = elm_widget_data_get(obj);
5222 if (!wd) return EINA_FALSE;
5223 return wd->always_select;
5227 * Set no select mode
5229 * This will turn off the ability to select items entirely and they
5230 * will neither appear selected nor call selected callback functions.
5232 * @param obj The genlist object
5233 * @param no_select The no select mode
5234 * (EINA_TRUE = on, EINA_FALSE = off)
5239 elm_genlist_no_select_mode_set(Evas_Object *obj,
5240 Eina_Bool no_select)
5242 ELM_CHECK_WIDTYPE(obj, widtype);
5243 Widget_Data *wd = elm_widget_data_get(obj);
5245 wd->no_select = no_select;
5249 * Gets no select mode
5251 * @param obj The genlist object
5252 * @return The no select mode
5253 * (EINA_TRUE = on, EINA_FALSE = off)
5258 elm_genlist_no_select_mode_get(const Evas_Object *obj)
5260 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5261 Widget_Data *wd = elm_widget_data_get(obj);
5262 if (!wd) return EINA_FALSE;
5263 return wd->no_select;
5269 * This will enable the compress mode where items are "compressed"
5270 * horizontally to fit the genlist scrollable viewport width. This is
5271 * special for genlist. Do not rely on
5272 * elm_genlist_horizontal_mode_set() being set to ELM_LIST_COMPRESS to
5273 * work as genlist needs to handle it specially.
5275 * @param obj The genlist object
5276 * @param compress The compress mode
5277 * (EINA_TRUE = on, EINA_FALSE = off)
5282 elm_genlist_compress_mode_set(Evas_Object *obj,
5285 ELM_CHECK_WIDTYPE(obj, widtype);
5286 Widget_Data *wd = elm_widget_data_get(obj);
5288 wd->compress = compress;
5289 if (!compress) elm_genlist_homogeneous_set(obj, EINA_FALSE);
5293 * Get the compress mode
5295 * @param obj The genlist object
5296 * @return The compress mode
5297 * (EINA_TRUE = on, EINA_FALSE = off)
5302 elm_genlist_compress_mode_get(const Evas_Object *obj)
5304 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5305 Widget_Data *wd = elm_widget_data_get(obj);
5306 if (!wd) return EINA_FALSE;
5307 return wd->compress;
5311 * Set height-for-width mode
5313 * With height-for-width mode the item width will be fixed (restricted
5314 * to a minimum of) to the list width when calculating its size in
5315 * order to allow the height to be calculated based on it. This allows,
5316 * for instance, text block to wrap lines if the Edje part is
5317 * configured with "text.min: 0 1".
5319 * @note This mode will make list resize slower as it will have to
5320 * recalculate every item height again whenever the list width
5323 * @note When height-for-width mode is enabled, it also enables
5324 * compress mode (see elm_genlist_compress_mode_set()) and
5325 * disables homogeneous (see elm_genlist_homogeneous_set()).
5327 * @param obj The genlist object
5328 * @param setting The height-for-width mode (EINA_TRUE = on,
5334 elm_genlist_height_for_width_mode_set(Evas_Object *obj,
5335 Eina_Bool height_for_width)
5337 ELM_CHECK_WIDTYPE(obj, widtype);
5338 Widget_Data *wd = elm_widget_data_get(obj);
5340 wd->height_for_width = !!height_for_width;
5341 if (wd->height_for_width)
5343 elm_genlist_homogeneous_set(obj, EINA_FALSE);
5344 elm_genlist_compress_mode_set(obj, EINA_TRUE);
5349 * Get the height-for-width mode
5351 * @param obj The genlist object
5352 * @return The height-for-width mode (EINA_TRUE = on, EINA_FALSE =
5358 elm_genlist_height_for_width_mode_get(const Evas_Object *obj)
5360 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5361 Widget_Data *wd = elm_widget_data_get(obj);
5362 if (!wd) return EINA_FALSE;
5363 return wd->height_for_width;
5369 * This will enable or disable the scroller bounce mode for the
5370 * genlist. See elm_scroller_bounce_set() for details
5372 * @param obj The genlist object
5373 * @param h_bounce Allow bounce horizontally
5374 * @param v_bounce Allow bounce vertically
5379 elm_genlist_bounce_set(Evas_Object *obj,
5383 ELM_CHECK_WIDTYPE(obj, widtype);
5384 Widget_Data *wd = elm_widget_data_get(obj);
5386 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
5390 * Get the bounce mode
5392 * @param obj The genlist object
5393 * @param h_bounce Allow bounce horizontally
5394 * @param v_bounce Allow bounce vertically
5399 elm_genlist_bounce_get(const Evas_Object *obj,
5400 Eina_Bool *h_bounce,
5401 Eina_Bool *v_bounce)
5403 ELM_CHECK_WIDTYPE(obj, widtype);
5404 Widget_Data *wd = elm_widget_data_get(obj);
5406 elm_smart_scroller_bounce_allow_get(obj, h_bounce, v_bounce);
5410 * Set homogenous mode
5412 * This will enable the homogeneous mode where items are of the same
5413 * height and width so that genlist may do the lazy-loading at its
5414 * maximum. This implies 'compressed' mode.
5416 * @param obj The genlist object
5417 * @param homogeneous Assume the items within the genlist are of the
5418 * same height and width (EINA_TRUE = on, EINA_FALSE = off)
5423 elm_genlist_homogeneous_set(Evas_Object *obj,
5424 Eina_Bool homogeneous)
5426 ELM_CHECK_WIDTYPE(obj, widtype);
5427 Widget_Data *wd = elm_widget_data_get(obj);
5429 if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
5430 wd->homogeneous = homogeneous;
5434 * Get the homogenous mode
5436 * @param obj The genlist object
5437 * @return Assume the items within the genlist are of the same height
5438 * and width (EINA_TRUE = on, EINA_FALSE = off)
5443 elm_genlist_homogeneous_get(const Evas_Object *obj)
5445 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5446 Widget_Data *wd = elm_widget_data_get(obj);
5447 if (!wd) return EINA_FALSE;
5448 return wd->homogeneous;
5452 * Set the maximum number of items within an item block
5454 * This will configure the block count to tune to the target with
5455 * particular performance matrix.
5457 * @param obj The genlist object
5458 * @param n Maximum number of items within an item block
5463 elm_genlist_block_count_set(Evas_Object *obj,
5466 ELM_CHECK_WIDTYPE(obj, widtype);
5467 Widget_Data *wd = elm_widget_data_get(obj);
5469 wd->max_items_per_block = n;
5470 wd->item_cache_max = wd->max_items_per_block * 2;
5471 _item_cache_clean(wd);
5475 * Get the maximum number of items within an item block
5477 * @param obj The genlist object
5478 * @return Maximum number of items within an item block
5483 elm_genlist_block_count_get(const Evas_Object *obj)
5485 ELM_CHECK_WIDTYPE(obj, widtype) 0;
5486 Widget_Data *wd = elm_widget_data_get(obj);
5488 return wd->max_items_per_block;
5492 * Set the timeout in seconds for the longpress event
5494 * @param obj The genlist object
5495 * @param timeout timeout in seconds
5500 elm_genlist_longpress_timeout_set(Evas_Object *obj,
5503 ELM_CHECK_WIDTYPE(obj, widtype);
5504 Widget_Data *wd = elm_widget_data_get(obj);
5506 wd->longpress_timeout = timeout;
5510 * Get the timeout in seconds for the longpress event
5512 * @param obj The genlist object
5513 * @return timeout in seconds
5518 elm_genlist_longpress_timeout_get(const Evas_Object *obj)
5520 ELM_CHECK_WIDTYPE(obj, widtype) 0;
5521 Widget_Data *wd = elm_widget_data_get(obj);
5523 return wd->longpress_timeout;
5527 * Set the scrollbar policy
5529 * This sets the scrollbar visibility policy for the given genlist
5530 * scroller. ELM_SMART_SCROLLER_POLICY_AUTO means the scrollbar is
5531 * made visible if it is needed, and otherwise kept hidden.
5532 * ELM_SMART_SCROLLER_POLICY_ON turns it on all the time, and
5533 * ELM_SMART_SCROLLER_POLICY_OFF always keeps it off. This applies
5534 * respectively for the horizontal and vertical scrollbars.
5536 * @param obj The genlist object
5537 * @param policy_h Horizontal scrollbar policy
5538 * @param policy_v Vertical scrollbar policy
5543 elm_genlist_scroller_policy_set(Evas_Object *obj,
5544 Elm_Scroller_Policy policy_h,
5545 Elm_Scroller_Policy policy_v)
5547 ELM_CHECK_WIDTYPE(obj, widtype);
5548 Widget_Data *wd = elm_widget_data_get(obj);
5550 if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
5551 (policy_v >= ELM_SCROLLER_POLICY_LAST))
5554 elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
5558 * Get the scrollbar policy
5560 * @param obj The genlist object
5561 * @param policy_h Horizontal scrollbar policy
5562 * @param policy_v Vertical scrollbar policy
5567 elm_genlist_scroller_policy_get(const Evas_Object *obj,
5568 Elm_Scroller_Policy *policy_h,
5569 Elm_Scroller_Policy *policy_v)
5571 ELM_CHECK_WIDTYPE(obj, widtype);
5572 Widget_Data *wd = elm_widget_data_get(obj);
5573 Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
5574 if ((!wd) || (!wd->scr)) return;
5575 elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
5576 if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
5577 if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
5581 * Update the contents of all realized items
5583 * This updates all realized items by calling all the item class functions again
5584 * to get the icons, labels and states. Use this when the original
5585 * item data has changed and the changes are desired to be reflected.
5587 * @param it The item
5592 elm_genlist_realized_items_update(Evas_Object *obj)
5594 ELM_CHECK_WIDTYPE(obj, widtype);
5596 Eina_List *list, *l;
5597 Elm_Genlist_Item *it;
5599 list = elm_genlist_realized_items_get(obj);
5600 EINA_LIST_FOREACH(list, l, it)
5601 elm_genlist_item_update(it);
5605 * Set genlist item mode
5607 * @param item The genlist item
5608 * @param mode Mode name
5609 * @param mode_set Boolean to define set or unset mode.
5614 elm_genlist_item_mode_set(Elm_Genlist_Item *it,
5615 const char *mode_type,
5618 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
5619 Widget_Data *wd = it->wd;
5621 Elm_Genlist_Item *it2;
5624 if (!mode_type) return;
5625 if ((it->delete_me) || (it->disabled)) return;
5627 if ((wd->mode_item == it) &&
5628 (!strcmp(mode_type, wd->mode_type)) &&
5631 if (!it->itc->mode_item_style) return;
5635 EINA_LIST_FOREACH(wd->selected, l, it2)
5637 elm_genlist_item_selected_set(it2, EINA_FALSE);
5641 it2 = elm_genlist_selected_item_get(wd->obj);
5642 if ((it2) && (it2->realized))
5643 elm_genlist_item_selected_set(it2, EINA_FALSE);
5646 if (((wd->mode_type) && (strcmp(mode_type, wd->mode_type))) ||
5648 ((it == wd->mode_item) && (!mode_set)))
5649 _item_mode_unset(wd);
5651 eina_stringshare_replace(&wd->mode_type, mode_type);
5652 if (mode_set) _item_mode_set(it);
5656 * Get active genlist mode type
5658 * @param obj The genlist object
5663 elm_genlist_mode_get(const Evas_Object *obj)
5665 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5666 Widget_Data *wd = elm_widget_data_get(obj);
5667 if (!wd) return NULL;
5668 return wd->mode_type;
5672 * Get active genlist mode item
5674 * @param obj The genlist object
5678 EAPI const Elm_Genlist_Item *
5679 elm_genlist_mode_item_get(const Evas_Object *obj)
5681 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5682 Widget_Data *wd = elm_widget_data_get(obj);
5683 if (!wd) return NULL;
5684 return wd->mode_item;
5690 * @param obj The genlist object
5691 * @param reorder_mode The reorder mode
5692 * (EINA_TRUE = on, EINA_FALSE = off)
5697 elm_genlist_reorder_mode_set(Evas_Object *obj,
5698 Eina_Bool reorder_mode)
5700 ELM_CHECK_WIDTYPE(obj, widtype);
5701 Widget_Data *wd = elm_widget_data_get(obj);
5703 wd->reorder_mode = reorder_mode;
5707 * Get the reorder mode
5709 * @param obj The genlist object
5710 * @return The reorder mode
5711 * (EINA_TRUE = on, EINA_FALSE = off)
5716 elm_genlist_reorder_mode_get(const Evas_Object *obj)
5718 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5719 Widget_Data *wd = elm_widget_data_get(obj);
5720 if (!wd) return EINA_FALSE;
5721 return wd->reorder_mode;