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;
1193 return ECORE_CALLBACK_CANCEL;
1197 _swipe(Elm_Genlist_Item *it)
1202 if ((it->display_only) || (it->disabled)) return;
1203 it->wd->swipe = EINA_FALSE;
1204 for (i = 0; i < it->wd->movements; i++)
1206 sum += it->wd->history[i].x;
1207 if (abs(it->wd->history[0].y - it->wd->history[i].y) > 10) return;
1210 sum /= it->wd->movements;
1211 if (abs(sum - it->wd->history[0].x) <= 10) return;
1212 evas_object_smart_callback_call(it->base.widget, SIG_SWIPE, it);
1216 _swipe_cancel(void *data)
1218 Elm_Genlist_Item *it = data;
1220 if (!it) return ECORE_CALLBACK_CANCEL;
1221 it->wd->swipe = EINA_FALSE;
1222 it->wd->movements = 0;
1223 return ECORE_CALLBACK_RENEW;
1227 _multi_cancel(void *data)
1229 Widget_Data *wd = data;
1231 if (!wd) return ECORE_CALLBACK_CANCEL;
1232 wd->multi_timeout = EINA_TRUE;
1233 return ECORE_CALLBACK_RENEW;
1237 _multi_touch_gesture_eval(void *data)
1239 Elm_Genlist_Item *it = data;
1241 it->wd->multitouched = EINA_FALSE;
1242 if (it->wd->multi_timer)
1244 ecore_timer_del(it->wd->multi_timer);
1245 it->wd->multi_timer = NULL;
1247 if (it->wd->multi_timeout)
1249 it->wd->multi_timeout = EINA_FALSE;
1253 Evas_Coord minw = 0, minh = 0;
1254 Evas_Coord off_x, off_y, off_mx, off_my;
1256 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1257 off_x = abs(it->wd->cur_x - it->wd->prev_x);
1258 off_y = abs(it->wd->cur_y - it->wd->prev_y);
1259 off_mx = abs(it->wd->cur_mx - it->wd->prev_mx);
1260 off_my = abs(it->wd->cur_my - it->wd->prev_my);
1262 if (((off_x > minw) || (off_y > minh)) && ((off_mx > minw) || (off_my > minh)))
1264 if ((off_x + off_mx) > (off_y + off_my))
1266 if ((it->wd->cur_x > it->wd->prev_x) && (it->wd->cur_mx > it->wd->prev_mx))
1267 evas_object_smart_callback_call(it->base.widget,
1268 SIG_MULTI_SWIPE_RIGHT, it);
1269 else if ((it->wd->cur_x < it->wd->prev_x) && (it->wd->cur_mx < it->wd->prev_mx))
1270 evas_object_smart_callback_call(it->base.widget,
1271 SIG_MULTI_SWIPE_LEFT, it);
1272 else if (abs(it->wd->cur_x - it->wd->cur_mx) > abs(it->wd->prev_x - it->wd->prev_mx))
1273 evas_object_smart_callback_call(it->base.widget,
1274 SIG_MULTI_PINCH_OUT, it);
1276 evas_object_smart_callback_call(it->base.widget,
1277 SIG_MULTI_PINCH_IN, it);
1281 if ((it->wd->cur_y > it->wd->prev_y) && (it->wd->cur_my > it->wd->prev_my))
1282 evas_object_smart_callback_call(it->base.widget,
1283 SIG_MULTI_SWIPE_DOWN, it);
1284 else if ((it->wd->cur_y < it->wd->prev_y) && (it->wd->cur_my < it->wd->prev_my))
1285 evas_object_smart_callback_call(it->base.widget,
1286 SIG_MULTI_SWIPE_UP, it);
1287 else if (abs(it->wd->cur_y - it->wd->cur_my) > abs(it->wd->prev_y - it->wd->prev_my))
1288 evas_object_smart_callback_call(it->base.widget,
1289 SIG_MULTI_PINCH_OUT, it);
1291 evas_object_smart_callback_call(it->base.widget,
1292 SIG_MULTI_PINCH_IN, it);
1295 it->wd->multi_timeout = EINA_FALSE;
1299 _multi_down(void *data,
1300 Evas *evas __UNUSED__,
1301 Evas_Object *obj __UNUSED__,
1304 Elm_Genlist_Item *it = data;
1305 Evas_Event_Multi_Down *ev = event_info;
1307 if ((it->wd->multi_device != 0) || (it->wd->multitouched) || (it->wd->multi_timeout)) return;
1308 it->wd->multi_device = ev->device;
1309 it->wd->multi_down = EINA_TRUE;
1310 it->wd->multitouched = EINA_TRUE;
1311 it->wd->prev_mx = ev->canvas.x;
1312 it->wd->prev_my = ev->canvas.y;
1313 if (!it->wd->wasselected)
1315 _item_unhighlight(it);
1318 it->wd->wasselected = EINA_FALSE;
1319 it->wd->longpressed = EINA_FALSE;
1322 ecore_timer_del(it->long_timer);
1323 it->long_timer = NULL;
1327 it->dragging = EINA_FALSE;
1328 evas_object_smart_callback_call(it->base.widget, SIG_DRAG_STOP, it);
1330 if (it->swipe_timer)
1332 ecore_timer_del(it->swipe_timer);
1333 it->swipe_timer = NULL;
1335 if (it->wd->on_hold)
1337 it->wd->swipe = EINA_FALSE;
1338 it->wd->movements = 0;
1339 it->wd->on_hold = EINA_FALSE;
1344 _multi_up(void *data,
1345 Evas *evas __UNUSED__,
1346 Evas_Object *obj __UNUSED__,
1349 Elm_Genlist_Item *it = data;
1350 Evas_Event_Multi_Up *ev = event_info;
1352 if (it->wd->multi_device != ev->device) return;
1353 it->wd->multi_device = 0;
1354 it->wd->multi_down = EINA_FALSE;
1355 if (it->wd->mouse_down) return;
1356 _multi_touch_gesture_eval(data);
1360 _multi_move(void *data,
1361 Evas *evas __UNUSED__,
1362 Evas_Object *obj __UNUSED__,
1365 Elm_Genlist_Item *it = data;
1366 Evas_Event_Multi_Move *ev = event_info;
1368 if (it->wd->multi_device != ev->device) return;
1369 it->wd->cur_mx = ev->cur.canvas.x;
1370 it->wd->cur_my = ev->cur.canvas.y;
1374 _mouse_down(void *data,
1375 Evas *evas __UNUSED__,
1379 Elm_Genlist_Item *it = data;
1380 Evas_Event_Mouse_Down *ev = event_info;
1383 if (ev->button != 1) return;
1384 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1386 it->wd->on_hold = EINA_TRUE;
1389 it->down = EINA_TRUE;
1390 it->dragging = EINA_FALSE;
1391 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1392 it->dx = ev->canvas.x - x;
1393 it->dy = ev->canvas.y - y;
1394 it->wd->mouse_down = EINA_TRUE;
1395 if (!it->wd->multitouched)
1397 it->wd->prev_x = ev->canvas.x;
1398 it->wd->prev_y = ev->canvas.y;
1399 it->wd->multi_timeout = EINA_FALSE;
1400 if (it->wd->multi_timer) ecore_timer_del(it->wd->multi_timer);
1401 it->wd->multi_timer = ecore_timer_add(1, _multi_cancel, it->wd);
1403 it->wd->longpressed = EINA_FALSE;
1404 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1405 else it->wd->on_hold = EINA_FALSE;
1406 if (it->wd->on_hold) return;
1407 it->wd->wasselected = it->selected;
1408 _item_highlight(it);
1409 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
1410 if ((!it->disabled) && (!it->display_only))
1412 evas_object_smart_callback_call(it->base.widget, SIG_CLICKED_DOUBLE, it);
1413 evas_object_smart_callback_call(it->base.widget, "clicked", it); // will be removed
1415 if (it->long_timer) ecore_timer_del(it->long_timer);
1416 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
1417 it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
1419 it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press,
1422 it->long_timer = NULL;
1423 it->wd->swipe = EINA_FALSE;
1424 it->wd->movements = 0;
1428 _mouse_up(void *data,
1429 Evas *evas __UNUSED__,
1430 Evas_Object *obj __UNUSED__,
1433 Elm_Genlist_Item *it = data;
1434 Evas_Event_Mouse_Up *ev = event_info;
1435 Eina_Bool dragged = EINA_FALSE;
1437 if (ev->button != 1) return;
1438 it->down = EINA_FALSE;
1439 it->wd->mouse_down = EINA_FALSE;
1440 if (it->wd->multitouched)
1442 if ((!it->wd->multi) && (!it->selected) && (it->highlighted)) _item_unhighlight(it);
1443 if (it->wd->multi_down) return;
1444 _multi_touch_gesture_eval(data);
1447 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1448 else it->wd->on_hold = EINA_FALSE;
1451 ecore_timer_del(it->long_timer);
1452 it->long_timer = NULL;
1456 it->dragging = EINA_FALSE;
1457 evas_object_smart_callback_call(it->base.widget, SIG_DRAG_STOP, it);
1460 if (it->swipe_timer)
1462 ecore_timer_del(it->swipe_timer);
1463 it->swipe_timer = NULL;
1465 if (it->wd->multi_timer)
1467 ecore_timer_del(it->wd->multi_timer);
1468 it->wd->multi_timer = NULL;
1469 it->wd->multi_timeout = EINA_FALSE;
1471 if (it->wd->on_hold)
1473 if (it->wd->swipe) _swipe(data);
1474 it->wd->longpressed = EINA_FALSE;
1475 it->wd->on_hold = EINA_FALSE;
1478 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
1480 Evas_Coord it_scrl_y = ev->canvas.y - it->wd->reorder_it->dy;
1482 if (it->wd->reorder_rel)
1484 if (it->wd->reorder_it->parent == it->wd->reorder_rel->parent)
1486 if (it_scrl_y <= it->wd->reorder_rel->scrl_y)
1487 _item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
1489 _item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
1493 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1494 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1497 it->wd->reorder_it = it->wd->reorder_rel = NULL;
1498 elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
1500 if (it->wd->longpressed)
1502 it->wd->longpressed = EINA_FALSE;
1503 if (!it->wd->wasselected)
1505 _item_unhighlight(it);
1508 it->wd->wasselected = EINA_FALSE;
1513 if (it->want_unrealize)
1515 _item_unrealize(it, EINA_FALSE);
1516 if (it->block->want_unrealize)
1517 _item_block_unrealize(it->block);
1520 if ((it->disabled) || (dragged) || (it->display_only)) return;
1521 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1526 _item_highlight(it);
1531 _item_unhighlight(it);
1539 Widget_Data *wd = it->wd;
1542 while (wd->selected)
1544 _item_unhighlight(wd->selected->data);
1545 _item_unselect(wd->selected->data);
1551 const Eina_List *l, *l_next;
1552 Elm_Genlist_Item *it2;
1554 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
1557 _item_unhighlight(it2);
1558 _item_unselect(it2);
1560 //_item_highlight(it);
1563 _item_highlight(it);
1569 _signal_expand_toggle(void *data,
1570 Evas_Object *obj __UNUSED__,
1571 const char *emission __UNUSED__,
1572 const char *source __UNUSED__)
1574 Elm_Genlist_Item *it = data;
1577 evas_object_smart_callback_call(it->base.widget, SIG_CONTRACT_REQUEST, it);
1579 evas_object_smart_callback_call(it->base.widget, SIG_EXPAND_REQUEST, it);
1583 _signal_expand(void *data,
1584 Evas_Object *obj __UNUSED__,
1585 const char *emission __UNUSED__,
1586 const char *source __UNUSED__)
1588 Elm_Genlist_Item *it = data;
1591 evas_object_smart_callback_call(it->base.widget, SIG_EXPAND_REQUEST, it);
1595 _signal_contract(void *data,
1596 Evas_Object *obj __UNUSED__,
1597 const char *emission __UNUSED__,
1598 const char *source __UNUSED__)
1600 Elm_Genlist_Item *it = data;
1603 evas_object_smart_callback_call(it->base.widget, SIG_CONTRACT_REQUEST, it);
1607 _scr_hold_timer_cb(void *data)
1609 if (!data) return ECORE_CALLBACK_CANCEL;
1610 Widget_Data *wd = data;
1611 elm_smart_scroller_hold_set(wd->scr, EINA_FALSE);
1612 wd->scr_hold_timer = NULL;
1613 return ECORE_CALLBACK_CANCEL;
1617 _mode_finished_signal_cb(void *data,
1619 const char *emission __UNUSED__,
1620 const char *source __UNUSED__)
1624 Elm_Genlist_Item *it = data;
1625 if ((it->delete_me) || (!it->realized) || (!it->mode_view)) return;
1627 Evas *te = evas_object_evas_get(obj);
1629 evas_event_freeze(te);
1630 it->nocache = EINA_FALSE;
1631 _mode_item_unrealize(it);
1632 snprintf(buf, sizeof(buf), "elm,state,%s,passive,finished", it->wd->mode_type);
1633 edje_object_signal_callback_del_full(obj, buf, "elm", _mode_finished_signal_cb, it);
1634 evas_event_thaw(te);
1635 evas_event_thaw_eval(te);
1639 _item_cache_clean(Widget_Data *wd)
1641 evas_event_freeze(evas_object_evas_get(wd->obj));
1642 while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max))
1646 itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache);
1647 wd->item_cache = eina_inlist_remove(wd->item_cache,
1648 wd->item_cache->last);
1649 wd->item_cache_count--;
1650 if (itc->spacer) evas_object_del(itc->spacer);
1651 if (itc->base_view) evas_object_del(itc->base_view);
1652 if (itc->item_style) eina_stringshare_del(itc->item_style);
1655 evas_event_thaw(evas_object_evas_get(wd->obj));
1656 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
1660 _item_cache_zero(Widget_Data *wd)
1662 int pmax = wd->item_cache_max;
1663 wd->item_cache_max = 0;
1664 _item_cache_clean(wd);
1665 wd->item_cache_max = pmax;
1669 _item_cache_add(Elm_Genlist_Item *it)
1673 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1674 if (it->wd->item_cache_max <= 0)
1676 evas_object_del(it->base.view);
1677 it->base.view = NULL;
1678 evas_object_del(it->spacer);
1680 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1681 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1685 it->wd->item_cache_count++;
1686 itc = calloc(1, sizeof(Item_Cache));
1687 it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache,
1688 EINA_INLIST_GET(itc));
1689 itc->spacer = it->spacer;
1691 itc->base_view = it->base.view;
1692 it->base.view = NULL;
1693 evas_object_hide(itc->base_view);
1694 evas_object_move(itc->base_view, -9999, -9999);
1695 itc->item_style = eina_stringshare_add(it->itc->item_style);
1696 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
1697 itc->compress = (it->wd->compress);
1698 itc->selected = it->selected;
1699 itc->disabled = it->disabled;
1700 itc->expanded = it->expanded;
1703 ecore_timer_del(it->long_timer);
1704 it->long_timer = NULL;
1706 if (it->swipe_timer)
1708 ecore_timer_del(it->swipe_timer);
1709 it->swipe_timer = NULL;
1711 // FIXME: other callbacks?
1712 edje_object_signal_callback_del_full(itc->base_view,
1713 "elm,action,expand,toggle",
1714 "elm", _signal_expand_toggle, it);
1715 edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand",
1717 _signal_expand, it);
1718 edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract",
1719 "elm", _signal_contract, it);
1720 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_DOWN,
1722 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP,
1724 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_MOVE,
1726 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_DOWN,
1728 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_UP,
1730 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_MOVE,
1732 _item_cache_clean(it->wd);
1733 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1734 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1738 _item_cache_find(Elm_Genlist_Item *it)
1743 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
1744 EINA_INLIST_FOREACH(it->wd->item_cache, itc)
1746 if ((itc->selected) || (itc->disabled) || (itc->expanded))
1748 if ((itc->tree == tree) &&
1749 (itc->compress == it->wd->compress) &&
1750 (!strcmp(it->itc->item_style, itc->item_style)))
1752 it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
1753 EINA_INLIST_GET(itc));
1754 it->wd->item_cache_count--;
1762 _elm_genlist_item_odd_even_update(Elm_Genlist_Item *it)
1764 if (!it->nostacking)
1766 if ((it->order_num_in & 0x1) ^ it->stacking_even)
1767 evas_object_lower(it->base.view);
1769 evas_object_raise(it->base.view);
1772 if (it->order_num_in & 0x1)
1773 edje_object_signal_emit(it->base.view, "elm,state,odd", "elm");
1775 edje_object_signal_emit(it->base.view, "elm,state,even", "elm");
1779 _elm_genlist_item_state_update(Elm_Genlist_Item *it, Item_Cache *itc)
1783 if (it->selected != itc->selected)
1786 edje_object_signal_emit(it->base.view,
1787 "elm,state,selected", "elm");
1789 if (it->disabled != itc->disabled)
1792 edje_object_signal_emit(it->base.view,
1793 "elm,state,disabled", "elm");
1795 if (it->expanded != itc->expanded)
1798 edje_object_signal_emit(it->base.view,
1799 "elm,state,expanded", "elm");
1805 edje_object_signal_emit(it->base.view,
1806 "elm,state,selected", "elm");
1808 edje_object_signal_emit(it->base.view,
1809 "elm,state,disabled", "elm");
1811 edje_object_signal_emit(it->base.view,
1812 "elm,state,expanded", "elm");
1817 _item_cache_free(Item_Cache *itc)
1819 if (itc->spacer) evas_object_del(itc->spacer);
1820 if (itc->base_view) evas_object_del(itc->base_view);
1821 if (itc->item_style) eina_stringshare_del(itc->item_style);
1826 _item_label_realize(Elm_Genlist_Item *it,
1827 Evas_Object *target,
1830 if (it->itc->func.label_get)
1835 *source = elm_widget_stringlist_get(edje_object_data_get(target, "labels"));
1836 EINA_LIST_FOREACH(*source, l, key)
1838 char *s = it->itc->func.label_get
1839 ((void *)it->base.data, it->base.widget, key);
1843 edje_object_part_text_set(target, key, s);
1848 edje_object_part_text_set(target, key, "");
1855 _item_icon_realize(Elm_Genlist_Item *it,
1856 Evas_Object *target,
1859 Eina_List *res = NULL;
1861 if (it->itc->func.icon_get)
1866 *source = elm_widget_stringlist_get(edje_object_data_get(target, "icons"));
1867 EINA_LIST_FOREACH(*source, l, key)
1869 Evas_Object *ic = it->itc->func.icon_get
1870 ((void *)it->base.data, it->base.widget, key);
1874 res = eina_list_append(res, ic);
1875 edje_object_part_swallow(target, key, ic);
1876 evas_object_show(ic);
1877 elm_widget_sub_object_add(it->base.widget, ic);
1879 elm_widget_disabled_set(ic, EINA_TRUE);
1888 _item_state_realize(Elm_Genlist_Item *it,
1889 Evas_Object *target,
1892 if (it->itc->func.state_get)
1898 *source = elm_widget_stringlist_get(edje_object_data_get(target, "states"));
1899 EINA_LIST_FOREACH(*source, l, key)
1901 Eina_Bool on = it->itc->func.state_get
1902 ((void *)it->base.data, it->base.widget, key);
1906 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
1907 edje_object_signal_emit(target, buf, "elm");
1911 snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
1912 edje_object_signal_emit(target, buf, "elm");
1919 _item_realize(Elm_Genlist_Item *it,
1923 Elm_Genlist_Item *it2;
1924 const char *treesize;
1926 int depth, tsize = 20;
1927 Item_Cache *itc = NULL;
1929 if (it->delete_me) return;
1930 evas_event_freeze(evas_object_evas_get(it->wd->obj));
1933 if (it->order_num_in != in)
1935 it->order_num_in = in;
1936 _elm_genlist_item_odd_even_update(it);
1937 _elm_genlist_item_state_update(it, NULL);
1939 evas_event_thaw(evas_object_evas_get(it->wd->obj));
1940 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
1943 it->order_num_in = in;
1946 it->nocache = EINA_FALSE;
1948 itc = _item_cache_find(it);
1951 it->base.view = itc->base_view;
1952 itc->base_view = NULL;
1953 it->spacer = itc->spacer;
1958 const char *stacking_even;
1959 const char *stacking;
1961 it->base.view = edje_object_add(evas_object_evas_get(it->base.widget));
1962 edje_object_scale_set(it->base.view,
1963 elm_widget_scale_get(it->base.widget) *
1964 _elm_config->scale);
1965 evas_object_smart_member_add(it->base.view, it->wd->pan_smart);
1966 elm_widget_sub_object_add(it->base.widget, it->base.view);
1968 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS)
1969 strncpy(buf, "tree", sizeof(buf));
1970 else strncpy(buf, "item", sizeof(buf));
1971 if (it->wd->compress)
1972 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
1974 strncat(buf, "/", sizeof(buf) - strlen(buf));
1975 strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf));
1977 _elm_theme_object_set(it->base.widget, it->base.view, "genlist", buf,
1978 elm_widget_style_get(it->base.widget));
1980 stacking_even = edje_object_data_get(it->base.view, "stacking_even");
1981 if (!stacking_even) stacking_even = "above";
1982 it->stacking_even = !!strcmp("above", stacking_even);
1984 stacking = edje_object_data_get(it->base.view, "stacking");
1985 if (!stacking) stacking = "yes";
1986 it->nostacking = !!strcmp("yes", stacking);
1988 edje_object_mirrored_set(it->base.view,
1989 elm_widget_mirrored_get(it->base.widget));
1991 evas_object_rectangle_add(evas_object_evas_get(it->base.widget));
1992 evas_object_color_set(it->spacer, 0, 0, 0, 0);
1993 elm_widget_sub_object_add(it->base.widget, it->spacer);
1996 _elm_genlist_item_odd_even_update(it);
1998 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
2000 if (it2->parent->flags != ELM_GENLIST_ITEM_GROUP) depth += 1;
2002 it->expanded_depth = depth;
2003 treesize = edje_object_data_get(it->base.view, "treesize");
2004 if (treesize) tsize = atoi(treesize);
2005 evas_object_size_hint_min_set(it->spacer,
2006 (depth * tsize) * _elm_config->scale, 1);
2007 edje_object_part_swallow(it->base.view, "elm.swallow.pad", it->spacer);
2010 edje_object_signal_callback_add(it->base.view,
2011 "elm,action,expand,toggle",
2012 "elm", _signal_expand_toggle, it);
2013 edje_object_signal_callback_add(it->base.view, "elm,action,expand",
2014 "elm", _signal_expand, it);
2015 edje_object_signal_callback_add(it->base.view, "elm,action,contract",
2016 "elm", _signal_contract, it);
2017 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_DOWN,
2019 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_UP,
2021 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_MOVE,
2023 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_DOWN,
2025 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_UP,
2027 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_MOVE,
2030 _elm_genlist_item_state_update(it, itc);
2033 if ((calc) && (it->wd->homogeneous) && ((it->wd->item_width) || ((it->wd->item_width) && (it->wd->group_item_width))))
2035 /* homogenous genlist shortcut */
2038 if (it->flags & ELM_GENLIST_ITEM_GROUP)
2040 it->w = it->minw = it->wd->group_item_width;
2041 it->h = it->minh = it->wd->group_item_height;
2045 it->w = it->minw = it->wd->item_width;
2046 it->h = it->minh = it->wd->item_height;
2048 it->mincalcd = EINA_TRUE;
2053 /* FIXME: If you see that assert, please notify us and we
2054 will clean our mess */
2055 assert(eina_list_count(it->icon_objs) == 0);
2057 _item_label_realize(it, it->base.view, &it->labels);
2058 it->icon_objs = _item_icon_realize(it, it->base.view, &it->icons);
2059 _item_state_realize(it, it->base.view, &it->states);
2063 Evas_Coord mw = -1, mh = -1;
2065 if (!it->display_only)
2066 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2067 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
2068 edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw,
2070 if (!it->display_only)
2071 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2072 it->w = it->minw = mw;
2073 it->h = it->minh = mh;
2074 it->mincalcd = EINA_TRUE;
2076 if ((!it->wd->group_item_width) && (it->flags == ELM_GENLIST_ITEM_GROUP))
2078 it->wd->group_item_width = mw;
2079 it->wd->group_item_height = mh;
2081 else if ((!it->wd->item_width) && (it->flags == ELM_GENLIST_ITEM_NONE))
2083 it->wd->item_width = mw;
2084 it->wd->item_height = mh;
2087 if (!calc) evas_object_show(it->base.view);
2090 if (it->tooltip.content_cb)
2092 elm_widget_item_tooltip_content_cb_set(it,
2093 it->tooltip.content_cb,
2094 it->tooltip.data, NULL);
2095 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
2098 if (it->mouse_cursor)
2099 elm_widget_item_cursor_set(it, it->mouse_cursor);
2101 it->realized = EINA_TRUE;
2102 it->want_unrealize = EINA_FALSE;
2104 if (itc) _item_cache_free(itc);
2105 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2106 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2107 if (!calc) evas_object_smart_callback_call(it->base.widget, SIG_REALIZED, it);
2111 _item_unrealize(Elm_Genlist_Item *it, Eina_Bool calc)
2115 if (!it->realized) return;
2116 if (it->wd->reorder_it == it) return;
2117 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2118 if (!calc) evas_object_smart_callback_call(it->base.widget, SIG_UNREALIZED, it);
2121 ecore_timer_del(it->long_timer);
2122 it->long_timer = NULL;
2126 evas_object_del(it->base.view);
2127 it->base.view = NULL;
2128 evas_object_del(it->spacer);
2133 edje_object_mirrored_set(it->base.view, elm_widget_mirrored_get(it->base.widget));
2134 edje_object_scale_set(it->base.view, elm_widget_scale_get(it->base.widget) * _elm_config->scale);
2135 _item_cache_add(it);
2137 elm_widget_stringlist_free(it->labels);
2139 elm_widget_stringlist_free(it->icons);
2141 elm_widget_stringlist_free(it->states);
2143 EINA_LIST_FREE(it->icon_objs, icon)
2144 evas_object_del(icon);
2146 _mode_item_unrealize(it);
2148 it->realized = EINA_FALSE;
2149 it->want_unrealize = EINA_FALSE;
2150 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2151 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2155 _item_block_recalc(Item_Block *itb,
2160 Elm_Genlist_Item *it;
2161 Evas_Coord minw = 0, minh = 0;
2162 Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE;
2165 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2167 EINA_LIST_FOREACH(itb->items, l, it)
2169 if (it->delete_me) continue;
2170 showme |= it->showme;
2175 if (!it->mincalcd) changed = EINA_TRUE;
2178 _item_realize(it, in, EINA_TRUE);
2179 _item_unrealize(it, EINA_TRUE);
2184 _item_realize(it, in, EINA_TRUE);
2185 _item_unrealize(it, EINA_TRUE);
2189 _item_realize(it, in, EINA_FALSE);
2191 if (minw < it->minw) minw = it->minw;
2199 itb->changed = EINA_FALSE;
2200 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2201 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2206 _item_block_realize(Item_Block *itb,
2211 Elm_Genlist_Item *it;
2213 if (itb->realized) return;
2214 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2215 EINA_LIST_FOREACH(itb->items, l, it)
2217 if (it->delete_me) continue;
2218 if (full) _item_realize(it, in, EINA_FALSE);
2221 itb->realized = EINA_TRUE;
2222 itb->want_unrealize = EINA_FALSE;
2223 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2224 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2228 _item_block_unrealize(Item_Block *itb)
2231 Elm_Genlist_Item *it;
2232 Eina_Bool dragging = EINA_FALSE;
2234 if (!itb->realized) return;
2235 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2236 EINA_LIST_FOREACH(itb->items, l, it)
2238 if (it->flags != ELM_GENLIST_ITEM_GROUP)
2242 dragging = EINA_TRUE;
2243 it->want_unrealize = EINA_TRUE;
2246 _item_unrealize(it, EINA_FALSE);
2251 itb->realized = EINA_FALSE;
2252 itb->want_unrealize = EINA_TRUE;
2255 itb->want_unrealize = EINA_FALSE;
2256 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2257 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2261 _get_space_for_reorder_item(Elm_Genlist_Item *it)
2263 Evas_Coord rox, roy, row, roh, oy, oh;
2264 Eina_Bool top = EINA_FALSE;
2265 Elm_Genlist_Item *reorder_it = it->wd->reorder_it;
2266 if (!reorder_it) return 0;
2268 evas_object_geometry_get(it->wd->pan_smart, NULL, &oy, NULL, &oh);
2269 evas_object_geometry_get(it->wd->reorder_it->base.view, &rox, &roy, &row, &roh);
2271 if ((it->wd->reorder_start_y < it->block->y) &&
2272 (roy - oy + (roh / 2) >= it->block->y - it->wd->pan_y))
2274 it->block->reorder_offset = it->wd->reorder_it->h * -1;
2275 if (it->block->count == 1)
2276 it->wd->reorder_rel = it;
2278 else if ((it->wd->reorder_start_y >= it->block->y) &&
2279 (roy - oy + (roh / 2) <= it->block->y - it->wd->pan_y))
2281 it->block->reorder_offset = it->wd->reorder_it->h;
2284 it->block->reorder_offset = 0;
2286 it->scrl_y += it->block->reorder_offset;
2288 top = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
2289 rox, roy + (roh / 2), row, 1));
2292 it->wd->reorder_rel = it;
2293 it->scrl_y += it->wd->reorder_it->h;
2294 return it->wd->reorder_it->h;
2301 _reorder_item_moving_effect_timer_cb(void *data)
2303 Elm_Genlist_Item *it = data;
2304 Eina_Bool down = EINA_FALSE;
2306 int y, dy = it->h / 10 * _elm_config->scale, diff;
2307 time = REORDER_EFFECT_TIME;
2309 t = ((0.0 > (t = ecore_loop_time_get()-it->wd->start_time)) ? 0.0 : t);
2311 if (t <= time) y = (1 * sin((t / time) * (M_PI / 2)) * dy);
2314 diff = abs(it->old_scrl_y - it->scrl_y);
2315 if (diff > it->h) y = diff / 2;
2317 if (it->old_scrl_y < it->scrl_y)
2319 it->old_scrl_y += y;
2322 else if (it->old_scrl_y > it->scrl_y)
2324 it->old_scrl_y -= y;
2327 _item_position(it, it->base.view, it->scrl_x, it->old_scrl_y);
2328 _group_items_recalc(it->wd);
2330 if ((it->wd->reorder_pan_move) ||
2331 (down && it->old_scrl_y >= it->scrl_y) ||
2332 (!down && it->old_scrl_y <= it->scrl_y))
2334 it->old_scrl_y = it->scrl_y;
2335 it->move_effect_enabled = EINA_FALSE;
2336 it->wd->item_moving_effect_timer = NULL;
2337 return ECORE_CALLBACK_CANCEL;
2339 return ECORE_CALLBACK_RENEW;
2343 _item_position(Elm_Genlist_Item *it, Evas_Object *view, Evas_Coord it_x, Evas_Coord it_y)
2348 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2349 evas_object_resize(view, it->w, it->h);
2350 evas_object_move(view, it_x, it_y);
2351 evas_object_show(view);
2352 evas_event_thaw(evas_object_evas_get(it->wd->obj));
2353 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
2357 _item_block_position(Item_Block *itb,
2361 Elm_Genlist_Item *it;
2362 Elm_Genlist_Item *git;
2363 Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2366 evas_event_freeze(evas_object_evas_get(itb->wd->obj));
2367 evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh);
2368 evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy,
2370 EINA_LIST_FOREACH(itb->items, l, it)
2372 if (it->delete_me) continue;
2373 else if (it->wd->reorder_it == it) continue;
2377 it->scrl_x = itb->x + it->x - it->wd->pan_x + ox;
2378 it->scrl_y = itb->y + it->y - it->wd->pan_y + oy;
2380 vis = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
2381 cvx, cvy, cvw, cvh));
2382 if (it->flags != ELM_GENLIST_ITEM_GROUP)
2384 if ((itb->realized) && (!it->realized))
2386 if (vis) _item_realize(it, in, EINA_FALSE);
2392 if (it->wd->reorder_mode)
2393 y += _get_space_for_reorder_item(it);
2394 git = it->group_item;
2397 if (git->scrl_y < oy)
2399 if ((git->scrl_y + git->h) > (it->scrl_y + it->h))
2400 git->scrl_y = (it->scrl_y + it->h) - git->h;
2401 git->want_realize = EINA_TRUE;
2403 if ((it->wd->reorder_it) && (it->old_scrl_y != it->scrl_y))
2405 if (!it->move_effect_enabled)
2407 it->move_effect_enabled = EINA_TRUE;
2408 it->wd->item_moving_effect_timer = ecore_animator_add(_reorder_item_moving_effect_timer_cb, it);
2411 if (!it->move_effect_enabled)
2415 _item_position(it, it->mode_view, it->scrl_x, it->scrl_y);
2417 _item_position(it, it->base.view, it->scrl_x, it->scrl_y);
2419 it->old_scrl_x = it->scrl_x;
2420 it->old_scrl_y = it->scrl_y;
2425 if (!it->dragging) _item_unrealize(it, EINA_FALSE);
2432 if (vis) it->want_realize = EINA_TRUE;
2436 evas_event_thaw(evas_object_evas_get(itb->wd->obj));
2437 evas_event_thaw_eval(evas_object_evas_get(itb->wd->obj));
2441 _group_items_recalc(void *data)
2443 Widget_Data *wd = data;
2445 Elm_Genlist_Item *git;
2447 evas_event_freeze(evas_object_evas_get(wd->obj));
2448 EINA_LIST_FOREACH(wd->group_items, l, git)
2450 if (git->want_realize)
2453 _item_realize(git, 0, EINA_FALSE);
2454 evas_object_resize(git->base.view, wd->minw, git->h);
2455 evas_object_move(git->base.view, git->scrl_x, git->scrl_y);
2456 evas_object_show(git->base.view);
2457 evas_object_raise(git->base.view);
2459 else if (!git->want_realize && git->realized)
2462 _item_unrealize(git, EINA_FALSE);
2465 evas_event_thaw(evas_object_evas_get(wd->obj));
2466 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2470 _must_recalc_idler(void *data)
2472 Widget_Data *wd = data;
2473 if (wd->calc_job) ecore_job_del(wd->calc_job);
2474 wd->calc_job = ecore_job_add(_calc_job, wd);
2475 wd->must_recalc_idler = NULL;
2476 return ECORE_CALLBACK_CANCEL;
2480 _calc_job(void *data)
2482 Widget_Data *wd = data;
2484 Evas_Coord minw = -1, minh = 0, y = 0, ow;
2485 Item_Block *chb = NULL;
2486 int in = 0, minw_change = 0;
2487 Eina_Bool changed = EINA_FALSE;
2489 Eina_Bool did_must_recalc = EINA_FALSE;
2492 t0 = ecore_time_get();
2493 evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h);
2497 evas_event_freeze(evas_object_evas_get(wd->obj));
2498 EINA_INLIST_FOREACH(wd->blocks, itb)
2500 Eina_Bool showme = EINA_FALSE;
2503 showme = itb->showme;
2504 itb->showme = EINA_FALSE;
2507 if (itb->realized) _item_block_unrealize(itb);
2509 if ((itb->changed) || (changed) ||
2510 ((itb->must_recalc) && (!did_must_recalc)))
2512 if ((changed) || (itb->must_recalc))
2515 Elm_Genlist_Item *it;
2516 EINA_LIST_FOREACH(itb->items, l, it)
2517 if (it->mincalcd) it->mincalcd = EINA_FALSE;
2518 itb->changed = EINA_TRUE;
2519 if (itb->must_recalc) did_must_recalc = EINA_TRUE;
2520 itb->must_recalc = EINA_FALSE;
2522 if (itb->realized) _item_block_unrealize(itb);
2523 showme = _item_block_recalc(itb, in, 0);
2529 if (minw == -1) minw = itb->minw;
2530 else if ((!itb->must_recalc) && (minw < itb->minw))
2539 if ((showme) && (wd->show_item) && (!wd->show_item->queued))
2541 wd->show_item->showme = EINA_FALSE;
2543 elm_smart_scroller_region_bring_in(wd->scr,
2545 wd->show_item->block->x,
2547 wd->show_item->block->y,
2548 wd->show_item->block->w,
2551 elm_smart_scroller_child_region_show(wd->scr,
2553 wd->show_item->block->x,
2555 wd->show_item->block->y,
2556 wd->show_item->block->w,
2558 wd->show_item = NULL;
2563 EINA_INLIST_FOREACH(wd->blocks, itb)
2569 if ((chb) && (EINA_INLIST_GET(chb)->next))
2571 EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb)
2573 if (itb->realized) _item_block_unrealize(itb);
2576 wd->realminw = minw;
2577 if (minw < wd->w) minw = wd->w;
2578 if ((minw != wd->minw) || (minh != wd->minh))
2582 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
2583 _sizing_eval(wd->obj);
2584 if ((wd->anchor_item) && (wd->anchor_item->block))
2586 Elm_Genlist_Item *it;
2589 it = wd->anchor_item;
2590 it_y = wd->anchor_y;
2591 elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x,
2592 it->block->y + it->y + it_y);
2593 wd->anchor_item = it;
2594 wd->anchor_y = it_y;
2597 t = ecore_time_get();
2598 if (did_must_recalc)
2600 if (!wd->must_recalc_idler)
2601 wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd);
2603 wd->calc_job = NULL;
2604 evas_object_smart_changed(wd->pan_smart);
2605 evas_event_thaw(evas_object_evas_get(wd->obj));
2606 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2610 _update_job(void *data)
2612 Widget_Data *wd = data;
2615 int num, num0, position = 0, recalc = 0;
2617 wd->update_job = NULL;
2620 evas_event_freeze(evas_object_evas_get(wd->obj));
2621 EINA_INLIST_FOREACH(wd->blocks, itb)
2623 Evas_Coord itminw, itminh;
2624 Elm_Genlist_Item *it;
2630 _item_block_position(itb, num);
2635 EINA_LIST_FOREACH(itb->items, l2, it)
2642 it->updateme = EINA_FALSE;
2645 _item_unrealize(it, EINA_FALSE);
2646 _item_realize(it, num, EINA_FALSE);
2651 _item_realize(it, num, EINA_TRUE);
2652 _item_unrealize(it, EINA_TRUE);
2654 if ((it->minw != itminw) || (it->minh != itminh))
2659 itb->updateme = EINA_FALSE;
2663 itb->changed = EINA_TRUE;
2664 _item_block_recalc(itb, num0, 0);
2665 _item_block_position(itb, num0);
2670 if (wd->calc_job) ecore_job_del(wd->calc_job);
2671 wd->calc_job = ecore_job_add(_calc_job, wd);
2673 evas_event_thaw(evas_object_evas_get(wd->obj));
2674 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
2678 _pan_set(Evas_Object *obj,
2682 Pan *sd = evas_object_smart_data_get(obj);
2685 // Evas_Coord ow, oh;
2686 // evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2687 // ow = sd->wd->minw - ow;
2688 // if (ow < 0) ow = 0;
2689 // oh = sd->wd->minh - oh;
2690 // if (oh < 0) oh = 0;
2691 // if (x < 0) x = 0;
2692 // if (y < 0) y = 0;
2693 // if (x > ow) x = ow;
2694 // if (y > oh) y = oh;
2695 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
2699 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2701 if ((itb->y + itb->h) > y)
2703 Elm_Genlist_Item *it;
2706 EINA_LIST_FOREACH(itb->items, l2, it)
2708 if ((itb->y + it->y) >= y)
2710 sd->wd->anchor_item = it;
2711 sd->wd->anchor_y = -(itb->y + it->y - y);
2718 if (!sd->wd->item_moving_effect_timer) evas_object_smart_changed(obj);
2722 _pan_get(Evas_Object *obj,
2726 Pan *sd = evas_object_smart_data_get(obj);
2728 if (x) *x = sd->wd->pan_x;
2729 if (y) *y = sd->wd->pan_y;
2733 _pan_max_get(Evas_Object *obj,
2737 Pan *sd = evas_object_smart_data_get(obj);
2740 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2741 ow = sd->wd->minw - ow;
2743 oh = sd->wd->minh - oh;
2750 _pan_min_get(Evas_Object *obj __UNUSED__,
2759 _pan_child_size_get(Evas_Object *obj,
2763 Pan *sd = evas_object_smart_data_get(obj);
2765 if (w) *w = sd->wd->minw;
2766 if (h) *h = sd->wd->minh;
2770 _pan_add(Evas_Object *obj)
2773 Evas_Object_Smart_Clipped_Data *cd;
2776 cd = evas_object_smart_data_get(obj);
2779 sd->__clipped_data = *cd;
2781 evas_object_smart_data_set(obj, sd);
2785 _pan_del(Evas_Object *obj)
2787 Pan *sd = evas_object_smart_data_get(obj);
2792 ecore_job_del(sd->resize_job);
2793 sd->resize_job = NULL;
2799 _pan_resize_job(void *data)
2802 _sizing_eval(sd->wd->obj);
2803 sd->resize_job = NULL;
2807 _pan_resize(Evas_Object *obj,
2811 Pan *sd = evas_object_smart_data_get(obj);
2814 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2815 if ((ow == w) && (oh == h)) return;
2816 if ((sd->wd->height_for_width) && (ow != w))
2818 if (sd->resize_job) ecore_job_del(sd->resize_job);
2819 sd->resize_job = ecore_job_add(_pan_resize_job, sd);
2821 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2822 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2826 _pan_calculate(Evas_Object *obj)
2828 Pan *sd = evas_object_smart_data_get(obj);
2830 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2832 Elm_Genlist_Item *git;
2835 evas_event_freeze(evas_object_evas_get(obj));
2836 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
2837 evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
2838 EINA_LIST_FOREACH(sd->wd->group_items, l, git)
2840 git->want_realize = EINA_FALSE;
2842 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2844 itb->w = sd->wd->minw;
2845 if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox,
2846 itb->y - sd->wd->pan_y + oy,
2848 cvx, cvy, cvw, cvh))
2850 if ((!itb->realized) || (itb->changed))
2851 _item_block_realize(itb, in, 0);
2852 _item_block_position(itb, in);
2856 if (itb->realized) _item_block_unrealize(itb);
2860 if ((!sd->wd->reorder_it) || (sd->wd->reorder_pan_move))
2861 _group_items_recalc(sd->wd);
2862 if ((sd->wd->reorder_mode) && (sd->wd->reorder_it))
2864 if (sd->wd->pan_y != sd->wd->old_pan_y)
2865 sd->wd->reorder_pan_move = EINA_TRUE;
2866 else sd->wd->reorder_pan_move = EINA_FALSE;
2867 evas_object_raise(sd->wd->reorder_it->base.view);
2868 sd->wd->old_pan_y = sd->wd->pan_y;
2869 sd->wd->start_time = ecore_loop_time_get();
2871 evas_event_thaw(evas_object_evas_get(obj));
2872 evas_event_thaw_eval(evas_object_evas_get(obj));
2876 _pan_move(Evas_Object *obj,
2877 Evas_Coord x __UNUSED__,
2878 Evas_Coord y __UNUSED__)
2880 Pan *sd = evas_object_smart_data_get(obj);
2882 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2883 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2887 _hold_on(void *data __UNUSED__,
2889 void *event_info __UNUSED__)
2891 Widget_Data *wd = elm_widget_data_get(obj);
2893 elm_smart_scroller_hold_set(wd->scr, 1);
2897 _hold_off(void *data __UNUSED__,
2899 void *event_info __UNUSED__)
2901 Widget_Data *wd = elm_widget_data_get(obj);
2903 elm_smart_scroller_hold_set(wd->scr, 0);
2907 _freeze_on(void *data __UNUSED__,
2909 void *event_info __UNUSED__)
2911 Widget_Data *wd = elm_widget_data_get(obj);
2913 elm_smart_scroller_freeze_set(wd->scr, 1);
2917 _freeze_off(void *data __UNUSED__,
2919 void *event_info __UNUSED__)
2921 Widget_Data *wd = elm_widget_data_get(obj);
2923 elm_smart_scroller_freeze_set(wd->scr, 0);
2927 _scroll_edge_left(void *data,
2928 Evas_Object *scr __UNUSED__,
2929 void *event_info __UNUSED__)
2931 Evas_Object *obj = data;
2932 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_LEFT, NULL);
2936 _scroll_edge_right(void *data,
2937 Evas_Object *scr __UNUSED__,
2938 void *event_info __UNUSED__)
2940 Evas_Object *obj = data;
2941 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_RIGHT, NULL);
2945 _scroll_edge_top(void *data,
2946 Evas_Object *scr __UNUSED__,
2947 void *event_info __UNUSED__)
2949 Evas_Object *obj = data;
2950 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_TOP, NULL);
2954 _scroll_edge_bottom(void *data,
2955 Evas_Object *scr __UNUSED__,
2956 void *event_info __UNUSED__)
2958 Evas_Object *obj = data;
2959 evas_object_smart_callback_call(obj, SIG_SCROLL_EDGE_BOTTOM, NULL);
2963 _mode_item_realize(Elm_Genlist_Item *it)
2967 if ((it->mode_view) || (it->delete_me)) return;
2969 evas_event_freeze(evas_object_evas_get(it->wd->obj));
2970 it->mode_view = edje_object_add(evas_object_evas_get(it->base.widget));
2971 edje_object_scale_set(it->mode_view,
2972 elm_widget_scale_get(it->base.widget) *
2973 _elm_config->scale);
2974 evas_object_smart_member_add(it->mode_view, it->wd->pan_smart);
2975 elm_widget_sub_object_add(it->base.widget, it->mode_view);
2977 strncpy(buf, "item", sizeof(buf));
2978 if (it->wd->compress)
2979 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
2981 if (it->order_num_in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
2982 strncat(buf, "/", sizeof(buf) - strlen(buf));
2983 strncat(buf, it->itc->mode_item_style, sizeof(buf) - strlen(buf));
2985 _elm_theme_object_set(it->base.widget, it->mode_view, "genlist", buf,
2986 elm_widget_style_get(it->base.widget));
2987 edje_object_mirrored_set(it->mode_view,
2988 elm_widget_mirrored_get(it->base.widget));
2990 /* signal callback add */
2991 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_DOWN,
2993 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_UP,
2995 evas_object_event_callback_add(it->mode_view, EVAS_CALLBACK_MOUSE_MOVE,
2998 /* label_get, icon_get, state_get */
2999 /* FIXME: If you see that assert, please notify us and we
3000 will clean our mess */
3001 assert(eina_list_count(it->mode_icon_objs) == 0);
3003 _item_label_realize(it, it->mode_view, &it->mode_labels);
3004 it->mode_icon_objs = _item_icon_realize(it,
3007 _item_state_realize(it, it->mode_view, &it->mode_states);
3009 edje_object_part_swallow(it->mode_view,
3010 edje_object_data_get(it->mode_view, "mode_part"),
3013 it->want_unrealize = EINA_FALSE;
3014 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3015 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3019 _mode_item_unrealize(Elm_Genlist_Item *it)
3021 Widget_Data *wd = it->wd;
3023 if (!it->mode_view) return;
3025 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3026 elm_widget_stringlist_free(it->mode_labels);
3027 it->mode_labels = NULL;
3028 elm_widget_stringlist_free(it->mode_icons);
3029 it->mode_icons = NULL;
3030 elm_widget_stringlist_free(it->mode_states);
3032 EINA_LIST_FREE(it->mode_icon_objs, icon)
3033 evas_object_del(icon);
3035 edje_object_part_unswallow(it->mode_view, it->base.view);
3036 evas_object_smart_member_add(it->base.view, wd->pan_smart);
3037 evas_object_del(it->mode_view);
3038 it->mode_view = NULL;
3040 if (wd->mode_item == it)
3041 wd->mode_item = NULL;
3042 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3043 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3047 _item_mode_set(Elm_Genlist_Item *it)
3050 Widget_Data *wd = it->wd;
3055 it->nocache = EINA_TRUE;
3057 if (wd->scr_hold_timer)
3059 ecore_timer_del(wd->scr_hold_timer);
3060 wd->scr_hold_timer = NULL;
3062 elm_smart_scroller_hold_set(wd->scr, EINA_TRUE);
3063 wd->scr_hold_timer = ecore_timer_add(0.1, _scr_hold_timer_cb, wd);
3065 evas_event_freeze(evas_object_evas_get(it->wd->obj));
3066 _mode_item_realize(it);
3067 _item_position(it, it->mode_view, it->scrl_x, it->scrl_y);
3068 evas_event_thaw(evas_object_evas_get(it->wd->obj));
3069 evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
3071 snprintf(buf, sizeof(buf), "elm,state,%s,active", wd->mode_type);
3072 edje_object_signal_emit(it->mode_view, buf, "elm");
3076 _item_mode_unset(Widget_Data *wd)
3079 if (!wd->mode_item) return;
3080 char buf[1024], buf2[1024];
3081 Elm_Genlist_Item *it;
3084 it->nocache = EINA_TRUE;
3086 snprintf(buf, sizeof(buf), "elm,state,%s,passive", wd->mode_type);
3087 snprintf(buf2, sizeof(buf2), "elm,state,%s,passive,finished", wd->mode_type);
3089 edje_object_signal_emit(it->mode_view, buf, "elm");
3090 edje_object_signal_callback_add(it->mode_view, buf2, "elm", _mode_finished_signal_cb, it);
3092 wd->mode_item = NULL;
3096 * Add a new Genlist object
3098 * @param parent The parent object
3099 * @return The new object or NULL if it cannot be created
3104 elm_genlist_add(Evas_Object *parent)
3109 Evas_Coord minw, minh;
3110 static Evas_Smart *smart = NULL;
3114 static Evas_Smart_Class sc;
3116 evas_object_smart_clipped_smart_set(&_pan_sc);
3118 sc.name = "elm_genlist_pan";
3119 sc.version = EVAS_SMART_CLASS_VERSION;
3122 sc.resize = _pan_resize;
3123 sc.move = _pan_move;
3124 sc.calculate = _pan_calculate;
3125 if (!(smart = evas_smart_class_new(&sc))) return NULL;
3128 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
3130 ELM_SET_WIDTYPE(widtype, "genlist");
3131 elm_widget_type_set(obj, "genlist");
3132 elm_widget_sub_object_add(parent, obj);
3133 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
3134 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
3135 elm_widget_data_set(obj, wd);
3136 elm_widget_del_hook_set(obj, _del_hook);
3137 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
3138 elm_widget_theme_hook_set(obj, _theme_hook);
3139 elm_widget_can_focus_set(obj, EINA_TRUE);
3140 elm_widget_event_hook_set(obj, _event_hook);
3141 elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
3143 wd->scr = elm_smart_scroller_add(e);
3144 elm_smart_scroller_widget_set(wd->scr, obj);
3145 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
3146 elm_widget_style_get(obj));
3147 elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE,
3148 _elm_config->thumbscroll_bounce_enable);
3149 elm_widget_resize_object_set(obj, wd->scr);
3151 evas_object_smart_callback_add(wd->scr, "edge,left", _scroll_edge_left, obj);
3152 evas_object_smart_callback_add(wd->scr, "edge,right", _scroll_edge_right,
3154 evas_object_smart_callback_add(wd->scr, "edge,top", _scroll_edge_top, obj);
3155 evas_object_smart_callback_add(wd->scr, "edge,bottom", _scroll_edge_bottom,
3159 wd->mode = ELM_LIST_SCROLL;
3160 wd->max_items_per_block = MAX_ITEMS_PER_BLOCK;
3161 wd->item_cache_max = wd->max_items_per_block * 2;
3162 wd->longpress_timeout = _elm_config->longpress_timeout;
3164 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
3165 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
3166 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
3167 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
3169 wd->pan_smart = evas_object_smart_add(e, smart);
3170 wd->pan = evas_object_smart_data_get(wd->pan_smart);
3173 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
3174 _pan_set, _pan_get, _pan_max_get,
3175 _pan_min_get, _pan_child_size_get);
3177 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
3179 evas_object_size_hint_min_set(obj, minw, minh);
3181 evas_object_smart_callbacks_descriptions_set(obj, _signals);
3183 _mirrored_set(obj, elm_widget_mirrored_get(obj));
3188 static Elm_Genlist_Item *
3189 _item_new(Widget_Data *wd,
3190 const Elm_Genlist_Item_Class *itc,
3192 Elm_Genlist_Item *parent,
3193 Elm_Genlist_Item_Flags flags,
3195 const void *func_data)
3197 Elm_Genlist_Item *it;
3199 it = elm_widget_item_new(wd->obj, Elm_Genlist_Item);
3200 if (!it) return NULL;
3203 it->base.data = data;
3204 it->parent = parent;
3206 it->func.func = func;
3207 it->func.data = func_data;
3208 it->mouse_cursor = NULL;
3209 it->expanded_depth = 0;
3214 _item_block_add(Widget_Data *wd,
3215 Elm_Genlist_Item *it)
3217 Item_Block *itb = NULL;
3224 itb = calloc(1, sizeof(Item_Block));
3227 if (!it->rel->block)
3230 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3231 itb->items = eina_list_append(itb->items, it);
3237 wd->blocks = eina_inlist_prepend_relative
3238 (wd->blocks, EINA_INLIST_GET(itb),
3239 EINA_INLIST_GET(it->rel->block));
3241 eina_list_prepend_relative(itb->items, it, it->rel);
3245 wd->blocks = eina_inlist_append_relative
3246 (wd->blocks, EINA_INLIST_GET(itb),
3247 EINA_INLIST_GET(it->rel->block));
3249 eina_list_append_relative(itb->items, it, it->rel);
3259 itb = (Item_Block *)(wd->blocks);
3260 if (itb->count >= wd->max_items_per_block)
3262 itb = calloc(1, sizeof(Item_Block));
3266 eina_inlist_prepend(wd->blocks,
3267 EINA_INLIST_GET(itb));
3272 itb = calloc(1, sizeof(Item_Block));
3276 eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
3278 itb->items = eina_list_prepend(itb->items, it);
3284 itb = (Item_Block *)(wd->blocks->last);
3285 if (itb->count >= wd->max_items_per_block)
3287 itb = calloc(1, sizeof(Item_Block));
3291 eina_inlist_append(wd->blocks,
3292 EINA_INLIST_GET(itb));
3297 itb = calloc(1, sizeof(Item_Block));
3301 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3303 itb->items = eina_list_append(itb->items, it);
3309 itb = it->rel->block;
3310 if (!itb) goto newblock;
3312 itb->items = eina_list_prepend_relative(itb->items, it, it->rel);
3314 itb->items = eina_list_append_relative(itb->items, it, it->rel);
3317 itb->changed = EINA_TRUE;
3319 if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job);
3320 itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd);
3323 it->rel->relcount--;
3324 if ((it->rel->delete_me) && (!it->rel->relcount))
3328 if (itb->count > itb->wd->max_items_per_block)
3332 Elm_Genlist_Item *it2;
3334 newc = itb->count / 2;
3335 itb2 = calloc(1, sizeof(Item_Block));
3339 eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
3340 EINA_INLIST_GET(itb));
3341 itb2->changed = EINA_TRUE;
3342 while ((itb->count > newc) && (itb->items))
3346 l = eina_list_last(itb->items);
3348 itb->items = eina_list_remove_list(itb->items, l);
3351 itb2->items = eina_list_prepend(itb2->items, it2);
3359 _queue_process(Widget_Data *wd)
3362 Eina_Bool showme = EINA_FALSE;
3365 t0 = ecore_time_get();
3366 evas_event_freeze(evas_object_evas_get(wd->obj));
3367 for (n = 0; (wd->queue) && (n < 128); n++)
3369 Elm_Genlist_Item *it;
3371 it = wd->queue->data;
3372 wd->queue = eina_list_remove_list(wd->queue, wd->queue);
3373 it->queued = EINA_FALSE;
3374 _item_block_add(wd, it);
3375 t = ecore_time_get();
3376 if (it->block->changed)
3378 showme = _item_block_recalc(it->block, it->block->num, 1);
3379 it->block->changed = 0;
3381 if (showme) it->block->showme = EINA_TRUE;
3382 if (eina_inlist_count(wd->blocks) > 1)
3384 if ((t - t0) > (ecore_animator_frametime_get())) break;
3387 evas_event_thaw(evas_object_evas_get(wd->obj));
3388 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3393 _idle_process(void *data, Eina_Bool *wakeup)
3395 Widget_Data *wd = data;
3398 //static double q_start = 0.0;
3399 //if (q_start == 0.0) q_start = ecore_time_get();
3401 if (_queue_process(wd) > 0) *wakeup = EINA_TRUE;
3405 //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start);
3407 return ECORE_CALLBACK_CANCEL;
3409 return ECORE_CALLBACK_RENEW;
3413 _item_idle_enterer(void *data)
3415 Widget_Data *wd = data;
3416 Eina_Bool wakeup = EINA_FALSE;
3417 Eina_Bool ok = _idle_process(data, &wakeup);
3422 if (wd->calc_job) ecore_job_del(wd->calc_job);
3423 wd->calc_job = ecore_job_add(_calc_job, wd);
3425 if (ok == ECORE_CALLBACK_CANCEL) wd->queue_idle_enterer = NULL;
3430 _item_queue(Widget_Data *wd,
3431 Elm_Genlist_Item *it)
3433 if (it->queued) return;
3434 it->queued = EINA_TRUE;
3435 wd->queue = eina_list_append(wd->queue, it);
3436 // FIXME: why does a freeze then thaw here cause some genlist
3437 // elm_genlist_item_append() to be much much slower?
3438 // evas_event_freeze(evas_object_evas_get(wd->obj));
3439 while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
3441 if (wd->queue_idle_enterer)
3443 ecore_idle_enterer_del(wd->queue_idle_enterer);
3444 wd->queue_idle_enterer = NULL;
3448 // evas_event_thaw(evas_object_evas_get(wd->obj));
3449 // evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3450 if (!wd->queue_idle_enterer)
3451 wd->queue_idle_enterer = ecore_idle_enterer_add(_item_idle_enterer, wd);
3455 _elm_genlist_item_compare(const void *data, const void *data1)
3457 Elm_Genlist_Item *item, *item1;
3458 item = ELM_GENLIST_ITEM_FROM_INLIST(data);
3459 item1 = ELM_GENLIST_ITEM_FROM_INLIST(data1);
3460 return _elm_genlist_item_compare_cb(item->base.data, item1->base.data);
3464 _item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after)
3469 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3470 _item_block_del(it);
3472 it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
3474 it->rel->relcount++;
3475 it->before = EINA_FALSE;
3476 if (after->group_item) it->group_item = after->group_item;
3477 _item_queue(it->wd, it);
3479 if (it->itc->func.moved)
3480 it->itc->func.moved(it->base.widget, it, after, EINA_TRUE);
3484 _item_move_before(Elm_Genlist_Item *it, Elm_Genlist_Item *before)
3487 if (!before) return;
3489 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
3490 _item_block_del(it);
3491 it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
3493 it->rel->relcount++;
3494 it->before = EINA_TRUE;
3495 if (before->group_item) it->group_item = before->group_item;
3496 _item_queue(it->wd, it);
3498 if (it->itc->func.moved)
3499 it->itc->func.moved(it->base.widget, it, before, EINA_FALSE);
3503 * Append item to the end of the genlist
3505 * This appends the given item to the end of the list or the end of
3506 * the children if the parent is given.
3508 * @param obj The genlist object
3509 * @param itc The item class for the item
3510 * @param data The item data
3511 * @param parent The parent item, or NULL if none
3512 * @param flags Item flags
3513 * @param func Convenience function called when item selected
3514 * @param func_data Data passed to @p func above.
3515 * @return A handle to the item added or NULL if not possible
3519 EAPI Elm_Genlist_Item *
3520 elm_genlist_item_append(Evas_Object *obj,
3521 const Elm_Genlist_Item_Class *itc,
3523 Elm_Genlist_Item *parent,
3524 Elm_Genlist_Item_Flags flags,
3526 const void *func_data)
3528 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3529 Widget_Data *wd = elm_widget_data_get(obj);
3530 if (!wd) return NULL;
3531 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3533 if (!it) return NULL;
3536 if (flags & ELM_GENLIST_ITEM_GROUP)
3537 wd->group_items = eina_list_append(wd->group_items, it);
3538 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
3543 Elm_Genlist_Item *it2 = NULL;
3544 Eina_List *ll = eina_list_last(it->parent->items);
3545 if (ll) it2 = ll->data;
3546 it->parent->items = eina_list_append(it->parent->items, it);
3547 if (!it2) it2 = it->parent;
3549 eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3550 EINA_INLIST_GET(it2));
3552 it->rel->relcount++;
3554 if (it->parent->flags & ELM_GENLIST_ITEM_GROUP)
3555 it->group_item = parent;
3556 else if (it->parent->group_item)
3557 it->group_item = it->parent->group_item;
3559 it->before = EINA_FALSE;
3560 _item_queue(wd, it);
3565 * Prepend item at start of the genlist
3567 * This adds an item to the beginning of the list or beginning of the
3568 * children of the parent if given.
3570 * @param obj The genlist object
3571 * @param itc The item class for the item
3572 * @param data The item data
3573 * @param parent The parent item, or NULL if none
3574 * @param flags Item flags
3575 * @param func Convenience function called when item selected
3576 * @param func_data Data passed to @p func above.
3577 * @return A handle to the item added or NULL if not possible
3581 EAPI Elm_Genlist_Item *
3582 elm_genlist_item_prepend(Evas_Object *obj,
3583 const Elm_Genlist_Item_Class *itc,
3585 Elm_Genlist_Item *parent,
3586 Elm_Genlist_Item_Flags flags,
3588 const void *func_data)
3590 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3591 Widget_Data *wd = elm_widget_data_get(obj);
3592 if (!wd) return NULL;
3593 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3595 if (!it) return NULL;
3598 if (flags & ELM_GENLIST_ITEM_GROUP)
3599 wd->group_items = eina_list_prepend(wd->group_items, it);
3600 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
3605 Elm_Genlist_Item *it2 = NULL;
3606 Eina_List *ll = it->parent->items;
3607 if (ll) it2 = ll->data;
3608 it->parent->items = eina_list_prepend(it->parent->items, it);
3609 if (!it2) it2 = it->parent;
3611 eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3612 EINA_INLIST_GET(it2));
3614 it->rel->relcount++;
3616 it->before = EINA_TRUE;
3617 _item_queue(wd, it);
3622 * Insert item before another in the genlist
3624 * This inserts an item before another in the list. It will be in the
3625 * same tree level or group as the item it is inseted before.
3627 * @param obj The genlist object
3628 * @param itc The item class for the item
3629 * @param data The item data
3630 * @param before The item to insert before
3631 * @param flags Item flags
3632 * @param func Convenience function called when item selected
3633 * @param func_data Data passed to @p func above.
3634 * @return A handle to the item added or NULL if not possible
3638 EAPI Elm_Genlist_Item *
3639 elm_genlist_item_insert_before(Evas_Object *obj,
3640 const Elm_Genlist_Item_Class *itc,
3642 Elm_Genlist_Item *parent,
3643 Elm_Genlist_Item *before,
3644 Elm_Genlist_Item_Flags flags,
3646 const void *func_data)
3648 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3649 EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
3650 Widget_Data *wd = elm_widget_data_get(obj);
3651 if (!wd) return NULL;
3652 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3654 if (!it) return NULL;
3657 it->parent->items = eina_list_prepend_relative(it->parent->items, it,
3660 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3661 EINA_INLIST_GET(before));
3663 it->rel->relcount++;
3664 it->before = EINA_TRUE;
3665 _item_queue(wd, it);
3670 * Insert a new item into the sorted genlist object
3672 * @param obj The genlist object
3673 * @param itc The item class for the item
3674 * @param data The item data
3675 * @param parent The parent item, or NULL if none
3676 * @param flags Item flags
3677 * @param comp The function called for the sort
3678 * @param func Convenience function called when item selected
3679 * @param func_data Data passed to @p func above.
3680 * @return A handle to the item added or NULL if not possible
3684 EAPI Elm_Genlist_Item *
3685 elm_genlist_item_sorted_insert(Evas_Object *obj,
3686 const Elm_Genlist_Item_Class *itc,
3688 Elm_Genlist_Item *parent,
3689 Elm_Genlist_Item_Flags flags,
3690 Eina_Compare_Cb comp,
3692 const void *func_data)
3694 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3695 Widget_Data *wd = elm_widget_data_get(obj);
3696 if (!wd) return NULL;
3697 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3699 if (!it) return NULL;
3701 _elm_genlist_item_compare_cb = comp;
3705 eina_list_sorted_insert(it->parent->items, comp, it);
3707 wd->items = eina_inlist_sorted_insert(wd->items, EINA_INLIST_GET(it),
3708 _elm_genlist_item_compare);
3709 if (EINA_INLIST_GET(it)->next)
3711 it->rel = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3712 it->rel->relcount++;
3713 it->before = EINA_TRUE;
3715 else if (EINA_INLIST_GET(it)->prev)
3717 it->rel = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3718 it->rel->relcount++;
3719 it->before = EINA_FALSE;
3721 _item_queue(wd, it);
3727 * Insert an item after another in the genlst
3729 * This inserts an item after another in the list. It will be in the
3730 * same tree level or group as the item it is inseted after.
3732 * @param obj The genlist object
3733 * @param itc The item class for the item
3734 * @param data The item data
3735 * @param after The item to insert after
3736 * @param flags Item flags
3737 * @param func Convenience function called when item selected
3738 * @param func_data Data passed to @p func above.
3739 * @return A handle to the item added or NULL if not possible
3743 EAPI Elm_Genlist_Item *
3744 elm_genlist_item_insert_after(Evas_Object *obj,
3745 const Elm_Genlist_Item_Class *itc,
3747 Elm_Genlist_Item *parent,
3748 Elm_Genlist_Item *after,
3749 Elm_Genlist_Item_Flags flags,
3751 const void *func_data)
3753 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3754 EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
3755 Widget_Data *wd = elm_widget_data_get(obj);
3756 if (!wd) return NULL;
3757 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3759 if (!it) return NULL;
3760 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3761 EINA_INLIST_GET(after));
3764 it->parent->items = eina_list_append_relative(it->parent->items, it,
3768 it->rel->relcount++;
3769 it->before = EINA_FALSE;
3770 _item_queue(wd, it);
3777 * This clears all items in the list, leaving it empty.
3779 * @param obj The genlist object
3784 elm_genlist_clear(Evas_Object *obj)
3786 ELM_CHECK_WIDTYPE(obj, widtype);
3787 Widget_Data *wd = elm_widget_data_get(obj);
3789 if (wd->walking > 0)
3791 Elm_Genlist_Item *it;
3793 wd->clear_me = EINA_TRUE;
3794 EINA_INLIST_FOREACH(wd->items, it)
3796 it->delete_me = EINA_TRUE;
3800 evas_event_freeze(evas_object_evas_get(wd->obj));
3803 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
3805 if (wd->anchor_item == it)
3807 wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3808 if (!wd->anchor_item)
3810 ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3812 wd->items = eina_inlist_remove(wd->items, wd->items);
3813 if (it->flags & ELM_GENLIST_ITEM_GROUP)
3814 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
3815 elm_widget_item_pre_notify_del(it);
3816 if (it->realized) _item_unrealize(it, EINA_FALSE);
3817 if (((wd->clear_me) || (!it->delete_me)) && (it->itc->func.del))
3818 it->itc->func.del((void *)it->base.data, it->base.widget);
3819 if (it->long_timer) ecore_timer_del(it->long_timer);
3820 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
3821 elm_widget_item_del(it);
3823 wd->clear_me = EINA_FALSE;
3824 wd->anchor_item = NULL;
3827 Item_Block *itb = (Item_Block *)(wd->blocks);
3829 wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
3830 if (itb->items) eina_list_free(itb->items);
3835 ecore_job_del(wd->calc_job);
3836 wd->calc_job = NULL;
3838 if (wd->queue_idle_enterer)
3840 ecore_idle_enterer_del(wd->queue_idle_enterer);
3841 wd->queue_idle_enterer = NULL;
3843 if (wd->must_recalc_idler)
3845 ecore_idler_del(wd->must_recalc_idler);
3846 wd->must_recalc_idler = NULL;
3850 eina_list_free(wd->queue);
3855 eina_list_free(wd->selected);
3856 wd->selected = NULL;
3858 if (wd->item_moving_effect_timer)
3860 ecore_animator_del(wd->item_moving_effect_timer);
3861 wd->item_moving_effect_timer = NULL;
3863 wd->show_item = NULL;
3871 evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
3872 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
3875 evas_event_thaw(evas_object_evas_get(wd->obj));
3876 evas_event_thaw_eval(evas_object_evas_get(wd->obj));
3880 * Enable or disable multi-select in the genlist
3882 * This enables (EINA_TRUE) or disables (EINA_FALSE) multi-select in
3883 * the list. This allows more than 1 item to be selected.
3885 * @param obj The genlist object
3886 * @param multi Multi-select enable/disable
3891 elm_genlist_multi_select_set(Evas_Object *obj,
3894 ELM_CHECK_WIDTYPE(obj, widtype);
3895 Widget_Data *wd = elm_widget_data_get(obj);
3901 * Gets if multi-select in genlist is enable or disable
3903 * @param obj The genlist object
3904 * @return Multi-select enable/disable
3905 * (EINA_TRUE = enabled/EINA_FALSE = disabled)
3910 elm_genlist_multi_select_get(const Evas_Object *obj)
3912 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3913 Widget_Data *wd = elm_widget_data_get(obj);
3914 if (!wd) return EINA_FALSE;
3919 * Get the selectd item in the genlist
3921 * This gets the selected item in the list (if multi-select is enabled
3922 * only the first item in the list is selected - which is not very
3923 * useful, so see elm_genlist_selected_items_get() for when
3924 * multi-select is used).
3926 * If no item is selected, NULL is returned.
3928 * @param obj The genlist object
3929 * @return The selected item, or NULL if none.
3933 EAPI Elm_Genlist_Item *
3934 elm_genlist_selected_item_get(const Evas_Object *obj)
3936 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3937 Widget_Data *wd = elm_widget_data_get(obj);
3938 if (!wd) return NULL;
3939 if (wd->selected) return wd->selected->data;
3944 * Get a list of selected items in the genlist
3946 * This returns a list of the selected items. This list pointer is
3947 * only valid so long as no items are selected or unselected (or
3948 * unselected implicitly by deletion). The list contains
3949 * Elm_Genlist_Item pointers.
3951 * @param obj The genlist object
3952 * @return The list of selected items, nor NULL if none are selected.
3956 EAPI const Eina_List *
3957 elm_genlist_selected_items_get(const Evas_Object *obj)
3959 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3960 Widget_Data *wd = elm_widget_data_get(obj);
3961 if (!wd) return NULL;
3962 return wd->selected;
3966 * Get a list of realized items in genlist
3968 * This returns a list of the realized items in the genlist. The list
3969 * contains Elm_Genlist_Item pointers. The list must be freed by the
3970 * caller when done with eina_list_free(). The item pointers in the
3971 * list are only valid so long as those items are not deleted or the
3972 * genlist is not deleted.
3974 * @param obj The genlist object
3975 * @return The list of realized items, nor NULL if none are realized.
3980 elm_genlist_realized_items_get(const Evas_Object *obj)
3982 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3983 Widget_Data *wd = elm_widget_data_get(obj);
3984 Eina_List *list = NULL;
3986 Eina_Bool done = EINA_FALSE;
3987 if (!wd) return NULL;
3988 EINA_INLIST_FOREACH(wd->blocks, itb)
3993 Elm_Genlist_Item *it;
3996 EINA_LIST_FOREACH(itb->items, l, it)
3998 if (it->realized) list = eina_list_append(list, it);
4010 * Get the item that is at the x, y canvas coords
4012 * This returns the item at the given coordinates (which are canvas
4013 * relative not object-relative). If an item is at that coordinate,
4014 * that item handle is returned, and if @p posret is not NULL, the
4015 * integer pointed to is set to a value of -1, 0 or 1, depending if
4016 * the coordinate is on the upper portion of that item (-1), on the
4017 * middle section (0) or on the lower part (1). If NULL is returned as
4018 * an item (no item found there), then posret may indicate -1 or 1
4019 * based if the coordinate is above or below all items respectively in
4022 * @param it The item
4023 * @param x The input x coordinate
4024 * @param y The input y coordinate
4025 * @param posret The position relative to the item returned here
4026 * @return The item at the coordinates or NULL if none
4030 EAPI Elm_Genlist_Item *
4031 elm_genlist_at_xy_item_get(const Evas_Object *obj,
4036 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4037 Widget_Data *wd = elm_widget_data_get(obj);
4038 Evas_Coord ox, oy, ow, oh;
4041 if (!wd) return NULL;
4042 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
4044 EINA_INLIST_FOREACH(wd->blocks, itb)
4047 Elm_Genlist_Item *it;
4049 if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
4050 oy + itb->y - itb->wd->pan_y,
4051 itb->w, itb->h, x, y, 1, 1))
4053 EINA_LIST_FOREACH(itb->items, l, it)
4055 Evas_Coord itx, ity;
4057 itx = ox + itb->x + it->x - itb->wd->pan_x;
4058 ity = oy + itb->y + it->y - itb->wd->pan_y;
4059 if (ELM_RECTS_INTERSECT(itx, ity, it->w, it->h, x, y, 1, 1))
4063 if (y <= (ity + (it->h / 4))) *posret = -1;
4064 else if (y >= (ity + it->h - (it->h / 4)))
4070 lasty = ity + it->h;
4075 if (y > lasty) *posret = 1;
4082 * Get the first item in the genlist
4084 * This returns the first item in the list.
4086 * @param obj The genlist object
4087 * @return The first item, or NULL if none
4091 EAPI Elm_Genlist_Item *
4092 elm_genlist_first_item_get(const Evas_Object *obj)
4094 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4095 Widget_Data *wd = elm_widget_data_get(obj);
4096 if (!wd) return NULL;
4097 if (!wd->items) return NULL;
4098 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
4099 while ((it) && (it->delete_me))
4100 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
4105 * Get the last item in the genlist
4107 * This returns the last item in the list.
4109 * @return The last item, or NULL if none
4113 EAPI Elm_Genlist_Item *
4114 elm_genlist_last_item_get(const Evas_Object *obj)
4116 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
4117 Widget_Data *wd = elm_widget_data_get(obj);
4118 if (!wd) return NULL;
4119 if (!wd->items) return NULL;
4120 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
4121 while ((it) && (it->delete_me))
4122 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
4127 * Get the next item in the genlist
4129 * This returns the item after the item @p it.
4131 * @param it The item
4132 * @return The item after @p it, or NULL if none
4136 EAPI Elm_Genlist_Item *
4137 elm_genlist_item_next_get(const Elm_Genlist_Item *it)
4139 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4142 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
4143 if ((it) && (!it->delete_me)) break;
4145 return (Elm_Genlist_Item *)it;
4149 * Get the previous item in the genlist
4151 * This returns the item before the item @p it.
4153 * @param it The item
4154 * @return The item before @p it, or NULL if none
4158 EAPI Elm_Genlist_Item *
4159 elm_genlist_item_prev_get(const Elm_Genlist_Item *it)
4161 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4164 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
4165 if ((it) && (!it->delete_me)) break;
4167 return (Elm_Genlist_Item *)it;
4171 * Get the genlist object from an item
4173 * This returns the genlist object itself that an item belongs to.
4175 * @param it The item
4176 * @return The genlist object
4181 elm_genlist_item_genlist_get(const Elm_Genlist_Item *it)
4183 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4184 return it->base.widget;
4188 * Get the parent item of the given item
4190 * This returns the parent item of the item @p it given.
4192 * @param it The item
4193 * @return The parent of the item or NULL if none
4197 EAPI Elm_Genlist_Item *
4198 elm_genlist_item_parent_get(const Elm_Genlist_Item *it)
4200 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4205 * Clear all sub-items (children) of the given item
4207 * This clears all items that are children (or their descendants) of the
4210 * @param it The item
4215 elm_genlist_item_subitems_clear(Elm_Genlist_Item *it)
4217 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4218 Eina_List *tl = NULL, *l;
4219 Elm_Genlist_Item *it2;
4221 EINA_LIST_FOREACH(it->items, l, it2)
4222 tl = eina_list_append(tl, it2);
4223 EINA_LIST_FREE(tl, it2)
4224 elm_genlist_item_del(it2);
4228 * Set the selected state of an item
4230 * This sets the selected state (1 selected, 0 not selected) of the given
4233 * @param it The item
4234 * @param selected The selected state
4239 elm_genlist_item_selected_set(Elm_Genlist_Item *it,
4242 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4243 Widget_Data *wd = elm_widget_data_get(it->base.widget);
4245 if ((it->delete_me) || (it->disabled)) return;
4246 selected = !!selected;
4247 if (it->selected == selected) return;
4253 while (wd->selected)
4255 _item_unhighlight(wd->selected->data);
4256 _item_unselect(wd->selected->data);
4259 _item_highlight(it);
4264 _item_unhighlight(it);
4270 * Get the selected state of an item
4272 * This gets the selected state of an item (1 selected, 0 not selected).
4274 * @param it The item
4275 * @return The selected state
4280 elm_genlist_item_selected_get(const Elm_Genlist_Item *it)
4282 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4283 return it->selected;
4287 * Sets the expanded state of an item (if it's a parent)
4289 * This expands or contracts a parent item (thus showing or hiding the
4292 * @param it The item
4293 * @param expanded The expanded state (1 expanded, 0 not expanded).
4298 elm_genlist_item_expanded_set(Elm_Genlist_Item *it,
4301 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4302 if (it->expanded == expanded) return;
4303 it->expanded = expanded;
4307 edje_object_signal_emit(it->base.view, "elm,state,expanded", "elm");
4308 evas_object_smart_callback_call(it->base.widget, SIG_EXPANDED, it);
4313 edje_object_signal_emit(it->base.view, "elm,state,contracted", "elm");
4314 evas_object_smart_callback_call(it->base.widget, SIG_CONTRACTED, it);
4319 * Get the expanded state of an item
4321 * This gets the expanded state of an item
4323 * @param it The item
4324 * @return Thre expanded state
4329 elm_genlist_item_expanded_get(const Elm_Genlist_Item *it)
4331 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4332 return it->expanded;
4336 * Get the depth of expanded item
4338 * @param it The genlist item object
4339 * @return The depth of expanded item
4344 elm_genlist_item_expanded_depth_get(const Elm_Genlist_Item *it)
4346 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, 0);
4347 return it->expanded_depth;
4351 * Sets the disabled state of an item.
4353 * A disabled item cannot be selected or unselected. It will also
4354 * change appearance to appear disabled. This sets the disabled state
4355 * (1 disabled, 0 not disabled).
4357 * @param it The item
4358 * @param disabled The disabled state
4363 elm_genlist_item_disabled_set(Elm_Genlist_Item *it,
4366 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4369 if (it->disabled == disabled) return;
4370 if (it->delete_me) return;
4371 it->disabled = !!disabled;
4373 elm_genlist_item_selected_set(it, EINA_FALSE);
4377 edje_object_signal_emit(it->base.view, "elm,state,disabled", "elm");
4379 edje_object_signal_emit(it->base.view, "elm,state,enabled", "elm");
4380 EINA_LIST_FOREACH(it->icon_objs, l, obj)
4381 elm_widget_disabled_set(obj, disabled);
4386 * Get the disabled state of an item
4388 * This gets the disabled state of the given item.
4390 * @param it The item
4391 * @return The disabled state
4396 elm_genlist_item_disabled_get(const Elm_Genlist_Item *it)
4398 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4399 if (it->delete_me) return EINA_FALSE;
4400 return it->disabled;
4404 * Sets the display only state of an item.
4406 * A display only item cannot be selected or unselected. It is for
4407 * display only and not selecting or otherwise clicking, dragging
4408 * etc. by the user, thus finger size rules will not be applied to
4411 * @param it The item
4412 * @param display_only The display only state
4417 elm_genlist_item_display_only_set(Elm_Genlist_Item *it,
4418 Eina_Bool display_only)
4420 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4421 if (it->display_only == display_only) return;
4422 if (it->delete_me) return;
4423 it->display_only = display_only;
4424 it->mincalcd = EINA_FALSE;
4425 it->updateme = EINA_TRUE;
4426 if (it->block) it->block->updateme = EINA_TRUE;
4427 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4428 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4432 * Get the display only state of an item
4434 * This gets the display only state of the given item.
4436 * @param it The item
4437 * @return The display only state
4442 elm_genlist_item_display_only_get(const Elm_Genlist_Item *it)
4444 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4445 if (it->delete_me) return EINA_FALSE;
4446 return it->display_only;
4450 * Show the given item
4452 * This causes genlist to jump to the given item @p it and show it (by
4453 * scrolling), if it is not fully visible.
4455 * @param it The item
4460 elm_genlist_item_show(Elm_Genlist_Item *it)
4462 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4463 Evas_Coord gith = 0;
4464 if (it->delete_me) return;
4465 if ((it->queued) || (!it->mincalcd))
4467 it->wd->show_item = it;
4468 it->wd->bring_in = EINA_TRUE;
4469 it->showme = EINA_TRUE;
4472 if (it->wd->show_item)
4474 it->wd->show_item->showme = EINA_FALSE;
4475 it->wd->show_item = NULL;
4477 if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
4478 gith = it->group_item->h;
4479 elm_smart_scroller_child_region_show(it->wd->scr,
4480 it->x + it->block->x,
4481 it->y + it->block->y - gith,
4482 it->block->w, it->h);
4486 * Bring in the given item
4488 * This causes genlist to jump to the given item @p it and show it (by
4489 * scrolling), if it is not fully visible. This may use animation to
4490 * do so and take a period of time
4492 * @param it The item
4497 elm_genlist_item_bring_in(Elm_Genlist_Item *it)
4499 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4500 Evas_Coord gith = 0;
4501 if (it->delete_me) return;
4502 if ((it->queued) || (!it->mincalcd))
4504 it->wd->show_item = it;
4505 it->wd->bring_in = EINA_TRUE;
4506 it->showme = EINA_TRUE;
4509 if (it->wd->show_item)
4511 it->wd->show_item->showme = EINA_FALSE;
4512 it->wd->show_item = NULL;
4514 if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
4515 gith = it->group_item->h;
4516 elm_smart_scroller_region_bring_in(it->wd->scr,
4517 it->x + it->block->x,
4518 it->y + it->block->y - gith,
4519 it->block->w, it->h);
4523 * Show the given item at the top
4525 * This causes genlist to jump to the given item @p it and show it (by
4526 * scrolling), if it is not fully visible.
4528 * @param it The item
4533 elm_genlist_item_top_show(Elm_Genlist_Item *it)
4535 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4537 Evas_Coord gith = 0;
4539 if (it->delete_me) return;
4540 if ((it->queued) || (!it->mincalcd))
4542 it->wd->show_item = it;
4543 it->wd->bring_in = EINA_TRUE;
4544 it->showme = EINA_TRUE;
4547 if (it->wd->show_item)
4549 it->wd->show_item->showme = EINA_FALSE;
4550 it->wd->show_item = NULL;
4552 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4553 if (it->group_item) gith = it->group_item->h;
4554 elm_smart_scroller_child_region_show(it->wd->scr,
4555 it->x + it->block->x,
4556 it->y + it->block->y - gith,
4561 * Bring in the given item at the top
4563 * This causes genlist to jump to the given item @p it and show it (by
4564 * scrolling), if it is not fully visible. This may use animation to
4565 * do so and take a period of time
4567 * @param it The item
4572 elm_genlist_item_top_bring_in(Elm_Genlist_Item *it)
4574 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4576 Evas_Coord gith = 0;
4578 if (it->delete_me) return;
4579 if ((it->queued) || (!it->mincalcd))
4581 it->wd->show_item = it;
4582 it->wd->bring_in = EINA_TRUE;
4583 it->showme = EINA_TRUE;
4586 if (it->wd->show_item)
4588 it->wd->show_item->showme = EINA_FALSE;
4589 it->wd->show_item = NULL;
4591 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4592 if (it->group_item) gith = it->group_item->h;
4593 elm_smart_scroller_region_bring_in(it->wd->scr,
4594 it->x + it->block->x,
4595 it->y + it->block->y - gith,
4600 * Show the given item at the middle
4602 * This causes genlist to jump to the given item @p it and show it (by
4603 * scrolling), if it is not fully visible.
4605 * @param it The item
4610 elm_genlist_item_middle_show(Elm_Genlist_Item *it)
4612 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4615 if (it->delete_me) return;
4616 if ((it->queued) || (!it->mincalcd))
4618 it->wd->show_item = it;
4619 it->wd->bring_in = EINA_TRUE;
4620 it->showme = EINA_TRUE;
4623 if (it->wd->show_item)
4625 it->wd->show_item->showme = EINA_FALSE;
4626 it->wd->show_item = NULL;
4628 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4629 elm_smart_scroller_child_region_show(it->wd->scr,
4630 it->x + it->block->x,
4631 it->y + it->block->y - oh / 2 +
4632 it->h / 2, it->block->w, oh);
4636 * Bring in the given item at the middle
4638 * This causes genlist to jump to the given item @p it and show it (by
4639 * scrolling), if it is not fully visible. This may use animation to
4640 * do so and take a period of time
4642 * @param it The item
4647 elm_genlist_item_middle_bring_in(Elm_Genlist_Item *it)
4649 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4652 if (it->delete_me) return;
4653 if ((it->queued) || (!it->mincalcd))
4655 it->wd->show_item = it;
4656 it->wd->bring_in = EINA_TRUE;
4657 it->showme = EINA_TRUE;
4660 if (it->wd->show_item)
4662 it->wd->show_item->showme = EINA_FALSE;
4663 it->wd->show_item = NULL;
4665 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4666 elm_smart_scroller_region_bring_in(it->wd->scr,
4667 it->x + it->block->x,
4668 it->y + it->block->y - oh / 2 + it->h / 2,
4673 * Delete a given item
4675 * This deletes the item from genlist and calls the genlist item del
4676 * class callback defined in the item class, if it is set. This clears all
4677 * subitems if it is a tree.
4679 * @param it The item
4684 elm_genlist_item_del(Elm_Genlist_Item *it)
4686 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4687 if ((it->relcount > 0) || (it->walking > 0))
4689 elm_widget_item_pre_notify_del(it);
4690 elm_genlist_item_subitems_clear(it);
4691 it->delete_me = EINA_TRUE;
4692 if (it->wd->show_item == it) it->wd->show_item = NULL;
4694 it->wd->selected = eina_list_remove(it->wd->selected,
4698 if (it->realized) _item_unrealize(it, EINA_FALSE);
4699 it->block->changed = EINA_TRUE;
4700 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
4701 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
4703 if (it->itc->func.del)
4704 it->itc->func.del((void *)it->base.data, it->base.widget);
4711 * Set the data item from the genlist item
4713 * This set the data value passed on the elm_genlist_item_append() and
4714 * related item addition calls. This function will also call
4715 * elm_genlist_item_update() so the item will be updated to reflect the
4718 * @param it The item
4719 * @param data The new data pointer to set
4724 elm_genlist_item_data_set(Elm_Genlist_Item *it,
4727 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4728 elm_widget_item_data_set(it, data);
4729 elm_genlist_item_update(it);
4733 * Get the data item from the genlist item
4735 * This returns the data value passed on the elm_genlist_item_append()
4736 * and related item addition calls and elm_genlist_item_data_set().
4738 * @param it The item
4739 * @return The data pointer provided when created
4744 elm_genlist_item_data_get(const Elm_Genlist_Item *it)
4746 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4747 return elm_widget_item_data_get(it);
4751 * Tells genlist to "orphan" icons fetchs by the item class
4753 * This instructs genlist to release references to icons in the item,
4754 * meaning that they will no longer be managed by genlist and are
4755 * floating "orphans" that can be re-used elsewhere if the user wants
4758 * @param it The item
4763 elm_genlist_item_icons_orphan(Elm_Genlist_Item *it)
4766 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4767 EINA_LIST_FREE(it->icon_objs, icon)
4769 elm_widget_sub_object_del(it->base.widget, icon);
4770 evas_object_smart_member_del(icon);
4771 evas_object_hide(icon);
4776 * Get the real evas object of the genlist item
4778 * This returns the actual evas object used for the specified genlist
4779 * item. This may be NULL as it may not be created, and may be deleted
4780 * at any time by genlist. Do not modify this object (move, resize,
4781 * show, hide etc.) as genlist is controlling it. This function is for
4782 * querying, emitting custom signals or hooking lower level callbacks
4783 * for events. Do not delete this object under any circumstances.
4785 * @param it The item
4786 * @return The object pointer
4790 EAPI const Evas_Object *
4791 elm_genlist_item_object_get(const Elm_Genlist_Item *it)
4793 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4794 return it->base.view;
4798 * Update the contents of an item
4800 * This updates an item by calling all the item class functions again
4801 * to get the icons, labels and states. Use this when the original
4802 * item data has changed and the changes are desired to be reflected.
4804 * @param it The item
4809 elm_genlist_item_update(Elm_Genlist_Item *it)
4811 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4812 if (!it->block) return;
4813 if (it->delete_me) return;
4814 it->mincalcd = EINA_FALSE;
4815 it->updateme = EINA_TRUE;
4816 it->block->updateme = EINA_TRUE;
4817 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4818 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4822 * Update the item class of an item
4824 * @param it The item
4825 * @parem itc The item class for the item
4830 elm_genlist_item_item_class_update(Elm_Genlist_Item *it,
4831 const Elm_Genlist_Item_Class *itc)
4833 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4834 if (!it->block) return;
4835 EINA_SAFETY_ON_NULL_RETURN(itc);
4836 if (it->delete_me) return;
4838 it->nocache = EINA_TRUE;
4839 elm_genlist_item_update(it);
4842 static Evas_Object *
4843 _elm_genlist_item_label_create(void *data,
4845 void *item __UNUSED__)
4847 Evas_Object *label = elm_label_add(obj);
4850 elm_object_style_set(label, "tooltip");
4851 elm_label_label_set(label, data);
4856 _elm_genlist_item_label_del_cb(void *data,
4857 Evas_Object *obj __UNUSED__,
4858 void *event_info __UNUSED__)
4860 eina_stringshare_del(data);
4864 * Set the text to be shown in the genlist item.
4866 * @param item Target item
4867 * @param text The text to set in the content
4869 * Setup the text as tooltip to object. The item can have only one
4870 * tooltip, so any previous tooltip data is removed.
4875 elm_genlist_item_tooltip_text_set(Elm_Genlist_Item *item,
4878 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4879 text = eina_stringshare_add(text);
4880 elm_genlist_item_tooltip_content_cb_set(item, _elm_genlist_item_label_create,
4882 _elm_genlist_item_label_del_cb);
4886 * Set the content to be shown in the tooltip item
4888 * Setup the tooltip to item. The item can have only one tooltip, so
4889 * any previous tooltip data is removed. @p func(with @p data) will be
4890 * called every time that need to show the tooltip and it should return a
4891 * valid Evas_Object. This object is then managed fully by tooltip
4892 * system and is deleted when the tooltip is gone.
4894 * @param item the genlist item being attached by a tooltip.
4895 * @param func the function used to create the tooltip contents.
4896 * @param data what to provide to @a func as callback data/context.
4897 * @param del_cb called when data is not needed anymore, either when
4898 * another callback replaces @func, the tooltip is unset with
4899 * elm_genlist_item_tooltip_unset() or the owner @a item
4900 * dies. This callback receives as the first parameter the
4901 * given @a data, and @c event_info is the item.
4906 elm_genlist_item_tooltip_content_cb_set(Elm_Genlist_Item *item,
4907 Elm_Tooltip_Item_Content_Cb func,
4909 Evas_Smart_Cb del_cb)
4911 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(item, error);
4913 if ((item->tooltip.content_cb == func) && (item->tooltip.data == data))
4916 if (item->tooltip.del_cb)
4917 item->tooltip.del_cb((void *)item->tooltip.data,
4918 item->base.widget, item);
4920 item->tooltip.content_cb = func;
4921 item->tooltip.data = data;
4922 item->tooltip.del_cb = del_cb;
4924 if (item->base.view)
4926 elm_widget_item_tooltip_content_cb_set(item,
4927 item->tooltip.content_cb,
4928 item->tooltip.data, NULL);
4929 elm_widget_item_tooltip_style_set(item, item->tooltip.style);
4935 if (del_cb) del_cb((void *)data, NULL, NULL);
4939 * Unset tooltip from item
4941 * @param item genlist item to remove previously set tooltip.
4943 * Remove tooltip from item. The callback provided as del_cb to
4944 * elm_genlist_item_tooltip_content_cb_set() will be called to notify
4945 * it is not used anymore.
4947 * @see elm_genlist_item_tooltip_content_cb_set()
4952 elm_genlist_item_tooltip_unset(Elm_Genlist_Item *item)
4954 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4955 if ((item->base.view) && (item->tooltip.content_cb))
4956 elm_widget_item_tooltip_unset(item);
4958 if (item->tooltip.del_cb)
4959 item->tooltip.del_cb((void *)item->tooltip.data, item->base.widget, item);
4960 item->tooltip.del_cb = NULL;
4961 item->tooltip.content_cb = NULL;
4962 item->tooltip.data = NULL;
4963 if (item->tooltip.style)
4964 elm_genlist_item_tooltip_style_set(item, NULL);
4968 * Sets a different style for this item tooltip.
4970 * @note before you set a style you should define a tooltip with
4971 * elm_genlist_item_tooltip_content_cb_set() or
4972 * elm_genlist_item_tooltip_text_set()
4974 * @param item genlist item with tooltip already set.
4975 * @param style the theme style to use (default, transparent, ...)
4980 elm_genlist_item_tooltip_style_set(Elm_Genlist_Item *item,
4983 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4984 eina_stringshare_replace(&item->tooltip.style, style);
4985 if (item->base.view) elm_widget_item_tooltip_style_set(item, style);
4989 * Get the style for this item tooltip.
4991 * @param item genlist item with tooltip already set.
4992 * @return style the theme style in use, defaults to "default". If the
4993 * object does not have a tooltip set, then NULL is returned.
4998 elm_genlist_item_tooltip_style_get(const Elm_Genlist_Item *item)
5000 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
5001 return item->tooltip.style;
5005 * Set the cursor to be shown when mouse is over the genlist item
5007 * @param item Target item
5008 * @param cursor the cursor name to be used.
5010 * @see elm_object_cursor_set()
5014 elm_genlist_item_cursor_set(Elm_Genlist_Item *item,
5017 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
5018 eina_stringshare_replace(&item->mouse_cursor, cursor);
5019 if (item->base.view) elm_widget_item_cursor_set(item, cursor);
5023 * Get the cursor to be shown when mouse is over the genlist item
5025 * @param item genlist item with cursor already set.
5026 * @return the cursor name.
5031 elm_genlist_item_cursor_get(const Elm_Genlist_Item *item)
5033 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
5034 return elm_widget_item_cursor_get(item);
5038 * Unset the cursor to be shown when mouse is over the genlist item
5040 * @param item Target item
5042 * @see elm_object_cursor_unset()
5046 elm_genlist_item_cursor_unset(Elm_Genlist_Item *item)
5048 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
5049 if (!item->mouse_cursor)
5052 if (item->base.view)
5053 elm_widget_item_cursor_unset(item);
5055 eina_stringshare_del(item->mouse_cursor);
5056 item->mouse_cursor = NULL;
5060 * Sets a different style for this item cursor.
5062 * @note before you set a style you should define a cursor with
5063 * elm_genlist_item_cursor_set()
5065 * @param item genlist item with cursor already set.
5066 * @param style the theme style to use (default, transparent, ...)
5071 elm_genlist_item_cursor_style_set(Elm_Genlist_Item *item,
5074 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
5075 elm_widget_item_cursor_style_set(item, style);
5079 * Get the style for this item cursor.
5081 * @param item genlist item with cursor already set.
5082 * @return style the theme style in use, defaults to "default". If the
5083 * object does not have a cursor set, then NULL is returned.
5088 elm_genlist_item_cursor_style_get(const Elm_Genlist_Item *item)
5090 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
5091 return elm_widget_item_cursor_style_get(item);
5095 * Set if the cursor set should be searched on the theme or should use
5096 * the provided by the engine, only.
5098 * @note before you set if should look on theme you should define a
5099 * cursor with elm_object_cursor_set(). By default it will only look
5100 * for cursors provided by the engine.
5102 * @param item widget item with cursor already set.
5103 * @param engine_only boolean to define it cursors should be looked
5104 * only between the provided by the engine or searched on widget's
5110 elm_genlist_item_cursor_engine_only_set(Elm_Genlist_Item *item,
5111 Eina_Bool engine_only)
5113 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
5114 elm_widget_item_cursor_engine_only_set(item, engine_only);
5118 * Get the cursor engine only usage for this item cursor.
5120 * @param item widget item with cursor already set.
5121 * @return engine_only boolean to define it cursors should be looked
5122 * only between the provided by the engine or searched on widget's
5123 * theme as well. If the object does not have a cursor set, then
5124 * EINA_FALSE is returned.
5129 elm_genlist_item_cursor_engine_only_get(const Elm_Genlist_Item *item)
5131 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
5132 return elm_widget_item_cursor_engine_only_get(item);
5136 * This sets the horizontal stretching mode
5138 * This sets the mode used for sizing items horizontally. Valid modes
5139 * are ELM_LIST_LIMIT and ELM_LIST_SCROLL. The default is
5140 * ELM_LIST_SCROLL. This mode means that if items are too wide to fit,
5141 * the scroller will scroll horizontally. Otherwise items are expanded
5142 * to fill the width of the viewport of the scroller. If it is
5143 * ELM_LIST_LIMIT, Items will be expanded to the viewport width and
5144 * limited to that size.
5146 * @param obj The genlist object
5147 * @param mode The mode to use
5152 elm_genlist_horizontal_mode_set(Evas_Object *obj,
5155 ELM_CHECK_WIDTYPE(obj, widtype);
5156 Widget_Data *wd = elm_widget_data_get(obj);
5158 if (wd->mode == mode) return;
5164 * Gets the horizontal stretching mode
5166 * @param obj The genlist object
5167 * @return The mode to use
5168 * (ELM_LIST_LIMIT, ELM_LIST_SCROLL)
5173 elm_genlist_horizontal_mode_get(const Evas_Object *obj)
5175 ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
5176 Widget_Data *wd = elm_widget_data_get(obj);
5177 if (!wd) return ELM_LIST_LAST;
5182 * Set the always select mode.
5184 * Items will only call their selection func and callback when first
5185 * becoming selected. Any further clicks will do nothing, unless you
5186 * enable always select with elm_genlist_always_select_mode_set().
5187 * This means even if selected, every click will make the selected
5188 * callbacks be called.
5190 * @param obj The genlist object
5191 * @param always_select The always select mode
5192 * (EINA_TRUE = on, EINA_FALSE = off)
5197 elm_genlist_always_select_mode_set(Evas_Object *obj,
5198 Eina_Bool always_select)
5200 ELM_CHECK_WIDTYPE(obj, widtype);
5201 Widget_Data *wd = elm_widget_data_get(obj);
5203 wd->always_select = always_select;
5207 * Get the always select mode.
5209 * @param obj The genlist object
5210 * @return The always select mode
5211 * (EINA_TRUE = on, EINA_FALSE = off)
5216 elm_genlist_always_select_mode_get(const Evas_Object *obj)
5218 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5219 Widget_Data *wd = elm_widget_data_get(obj);
5220 if (!wd) return EINA_FALSE;
5221 return wd->always_select;
5225 * Set no select mode
5227 * This will turn off the ability to select items entirely and they
5228 * will neither appear selected nor call selected callback functions.
5230 * @param obj The genlist object
5231 * @param no_select The no select mode
5232 * (EINA_TRUE = on, EINA_FALSE = off)
5237 elm_genlist_no_select_mode_set(Evas_Object *obj,
5238 Eina_Bool no_select)
5240 ELM_CHECK_WIDTYPE(obj, widtype);
5241 Widget_Data *wd = elm_widget_data_get(obj);
5243 wd->no_select = no_select;
5247 * Gets no select mode
5249 * @param obj The genlist object
5250 * @return The no select mode
5251 * (EINA_TRUE = on, EINA_FALSE = off)
5256 elm_genlist_no_select_mode_get(const Evas_Object *obj)
5258 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5259 Widget_Data *wd = elm_widget_data_get(obj);
5260 if (!wd) return EINA_FALSE;
5261 return wd->no_select;
5267 * This will enable the compress mode where items are "compressed"
5268 * horizontally to fit the genlist scrollable viewport width. This is
5269 * special for genlist. Do not rely on
5270 * elm_genlist_horizontal_mode_set() being set to ELM_LIST_COMPRESS to
5271 * work as genlist needs to handle it specially.
5273 * @param obj The genlist object
5274 * @param compress The compress mode
5275 * (EINA_TRUE = on, EINA_FALSE = off)
5280 elm_genlist_compress_mode_set(Evas_Object *obj,
5283 ELM_CHECK_WIDTYPE(obj, widtype);
5284 Widget_Data *wd = elm_widget_data_get(obj);
5286 wd->compress = compress;
5287 if (!compress) elm_genlist_homogeneous_set(obj, EINA_FALSE);
5291 * Get the compress mode
5293 * @param obj The genlist object
5294 * @return The compress mode
5295 * (EINA_TRUE = on, EINA_FALSE = off)
5300 elm_genlist_compress_mode_get(const Evas_Object *obj)
5302 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5303 Widget_Data *wd = elm_widget_data_get(obj);
5304 if (!wd) return EINA_FALSE;
5305 return wd->compress;
5309 * Set height-for-width mode
5311 * With height-for-width mode the item width will be fixed (restricted
5312 * to a minimum of) to the list width when calculating its size in
5313 * order to allow the height to be calculated based on it. This allows,
5314 * for instance, text block to wrap lines if the Edje part is
5315 * configured with "text.min: 0 1".
5317 * @note This mode will make list resize slower as it will have to
5318 * recalculate every item height again whenever the list width
5321 * @note When height-for-width mode is enabled, it also enables
5322 * compress mode (see elm_genlist_compress_mode_set()) and
5323 * disables homogeneous (see elm_genlist_homogeneous_set()).
5325 * @param obj The genlist object
5326 * @param setting The height-for-width mode (EINA_TRUE = on,
5332 elm_genlist_height_for_width_mode_set(Evas_Object *obj,
5333 Eina_Bool height_for_width)
5335 ELM_CHECK_WIDTYPE(obj, widtype);
5336 Widget_Data *wd = elm_widget_data_get(obj);
5338 wd->height_for_width = !!height_for_width;
5339 if (wd->height_for_width)
5341 elm_genlist_homogeneous_set(obj, EINA_FALSE);
5342 elm_genlist_compress_mode_set(obj, EINA_TRUE);
5347 * Get the height-for-width mode
5349 * @param obj The genlist object
5350 * @return The height-for-width mode (EINA_TRUE = on, EINA_FALSE =
5356 elm_genlist_height_for_width_mode_get(const Evas_Object *obj)
5358 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5359 Widget_Data *wd = elm_widget_data_get(obj);
5360 if (!wd) return EINA_FALSE;
5361 return wd->height_for_width;
5367 * This will enable or disable the scroller bounce mode for the
5368 * genlist. See elm_scroller_bounce_set() for details
5370 * @param obj The genlist object
5371 * @param h_bounce Allow bounce horizontally
5372 * @param v_bounce Allow bounce vertically
5377 elm_genlist_bounce_set(Evas_Object *obj,
5381 ELM_CHECK_WIDTYPE(obj, widtype);
5382 Widget_Data *wd = elm_widget_data_get(obj);
5384 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
5388 * Get the bounce mode
5390 * @param obj The genlist object
5391 * @param h_bounce Allow bounce horizontally
5392 * @param v_bounce Allow bounce vertically
5397 elm_genlist_bounce_get(const Evas_Object *obj,
5398 Eina_Bool *h_bounce,
5399 Eina_Bool *v_bounce)
5401 ELM_CHECK_WIDTYPE(obj, widtype);
5402 Widget_Data *wd = elm_widget_data_get(obj);
5404 elm_smart_scroller_bounce_allow_get(obj, h_bounce, v_bounce);
5408 * Set homogenous mode
5410 * This will enable the homogeneous mode where items are of the same
5411 * height and width so that genlist may do the lazy-loading at its
5412 * maximum. This implies 'compressed' mode.
5414 * @param obj The genlist object
5415 * @param homogeneous Assume the items within the genlist are of the
5416 * same height and width (EINA_TRUE = on, EINA_FALSE = off)
5421 elm_genlist_homogeneous_set(Evas_Object *obj,
5422 Eina_Bool homogeneous)
5424 ELM_CHECK_WIDTYPE(obj, widtype);
5425 Widget_Data *wd = elm_widget_data_get(obj);
5427 if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
5428 wd->homogeneous = homogeneous;
5432 * Get the homogenous mode
5434 * @param obj The genlist object
5435 * @return Assume the items within the genlist are of the same height
5436 * and width (EINA_TRUE = on, EINA_FALSE = off)
5441 elm_genlist_homogeneous_get(const Evas_Object *obj)
5443 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5444 Widget_Data *wd = elm_widget_data_get(obj);
5445 if (!wd) return EINA_FALSE;
5446 return wd->homogeneous;
5450 * Set the maximum number of items within an item block
5452 * This will configure the block count to tune to the target with
5453 * particular performance matrix.
5455 * @param obj The genlist object
5456 * @param n Maximum number of items within an item block
5461 elm_genlist_block_count_set(Evas_Object *obj,
5464 ELM_CHECK_WIDTYPE(obj, widtype);
5465 Widget_Data *wd = elm_widget_data_get(obj);
5467 wd->max_items_per_block = n;
5468 wd->item_cache_max = wd->max_items_per_block * 2;
5469 _item_cache_clean(wd);
5473 * Get the maximum number of items within an item block
5475 * @param obj The genlist object
5476 * @return Maximum number of items within an item block
5481 elm_genlist_block_count_get(const Evas_Object *obj)
5483 ELM_CHECK_WIDTYPE(obj, widtype) 0;
5484 Widget_Data *wd = elm_widget_data_get(obj);
5486 return wd->max_items_per_block;
5490 * Set the timeout in seconds for the longpress event
5492 * @param obj The genlist object
5493 * @param timeout timeout in seconds
5498 elm_genlist_longpress_timeout_set(Evas_Object *obj,
5501 ELM_CHECK_WIDTYPE(obj, widtype);
5502 Widget_Data *wd = elm_widget_data_get(obj);
5504 wd->longpress_timeout = timeout;
5508 * Get the timeout in seconds for the longpress event
5510 * @param obj The genlist object
5511 * @return timeout in seconds
5516 elm_genlist_longpress_timeout_get(const Evas_Object *obj)
5518 ELM_CHECK_WIDTYPE(obj, widtype) 0;
5519 Widget_Data *wd = elm_widget_data_get(obj);
5521 return wd->longpress_timeout;
5525 * Set the scrollbar policy
5527 * This sets the scrollbar visibility policy for the given genlist
5528 * scroller. ELM_SMART_SCROLLER_POLICY_AUTO means the scrollbar is
5529 * made visible if it is needed, and otherwise kept hidden.
5530 * ELM_SMART_SCROLLER_POLICY_ON turns it on all the time, and
5531 * ELM_SMART_SCROLLER_POLICY_OFF always keeps it off. This applies
5532 * respectively for the horizontal and vertical scrollbars.
5534 * @param obj The genlist object
5535 * @param policy_h Horizontal scrollbar policy
5536 * @param policy_v Vertical scrollbar policy
5541 elm_genlist_scroller_policy_set(Evas_Object *obj,
5542 Elm_Scroller_Policy policy_h,
5543 Elm_Scroller_Policy policy_v)
5545 ELM_CHECK_WIDTYPE(obj, widtype);
5546 Widget_Data *wd = elm_widget_data_get(obj);
5548 if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
5549 (policy_v >= ELM_SCROLLER_POLICY_LAST))
5552 elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
5556 * Get the scrollbar policy
5558 * @param obj The genlist object
5559 * @param policy_h Horizontal scrollbar policy
5560 * @param policy_v Vertical scrollbar policy
5565 elm_genlist_scroller_policy_get(const Evas_Object *obj,
5566 Elm_Scroller_Policy *policy_h,
5567 Elm_Scroller_Policy *policy_v)
5569 ELM_CHECK_WIDTYPE(obj, widtype);
5570 Widget_Data *wd = elm_widget_data_get(obj);
5571 Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
5572 if ((!wd) || (!wd->scr)) return;
5573 elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
5574 if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
5575 if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
5579 * Update the contents of all realized items
5581 * This updates all realized items by calling all the item class functions again
5582 * to get the icons, labels and states. Use this when the original
5583 * item data has changed and the changes are desired to be reflected.
5585 * @param it The item
5590 elm_genlist_realized_items_update(Evas_Object *obj)
5592 ELM_CHECK_WIDTYPE(obj, widtype);
5594 Eina_List *list, *l;
5595 Elm_Genlist_Item *it;
5597 list = elm_genlist_realized_items_get(obj);
5598 EINA_LIST_FOREACH(list, l, it)
5599 elm_genlist_item_update(it);
5603 * Set genlist item mode
5605 * @param item The genlist item
5606 * @param mode Mode name
5607 * @param mode_set Boolean to define set or unset mode.
5612 elm_genlist_item_mode_set(Elm_Genlist_Item *it,
5613 const char *mode_type,
5616 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
5617 Widget_Data *wd = it->wd;
5619 Elm_Genlist_Item *it2;
5622 if (!mode_type) return;
5623 if ((it->delete_me) || (it->disabled)) return;
5625 if ((wd->mode_item == it) &&
5626 (!strcmp(mode_type, wd->mode_type)) &&
5629 if (!it->itc->mode_item_style) return;
5633 EINA_LIST_FOREACH(wd->selected, l, it2)
5635 elm_genlist_item_selected_set(it2, EINA_FALSE);
5639 it2 = elm_genlist_selected_item_get(wd->obj);
5640 if ((it2) && (it2->realized))
5641 elm_genlist_item_selected_set(it2, EINA_FALSE);
5644 if (((wd->mode_type) && (strcmp(mode_type, wd->mode_type))) ||
5646 ((it == wd->mode_item) && (!mode_set)))
5647 _item_mode_unset(wd);
5649 eina_stringshare_replace(&wd->mode_type, mode_type);
5650 if (mode_set) _item_mode_set(it);
5654 * Get active genlist mode type
5656 * @param obj The genlist object
5661 elm_genlist_mode_get(const Evas_Object *obj)
5663 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5664 Widget_Data *wd = elm_widget_data_get(obj);
5665 if (!wd) return NULL;
5666 return wd->mode_type;
5670 * Get active genlist mode item
5672 * @param obj The genlist object
5676 EAPI const Elm_Genlist_Item *
5677 elm_genlist_mode_item_get(const Evas_Object *obj)
5679 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5680 Widget_Data *wd = elm_widget_data_get(obj);
5681 if (!wd) return NULL;
5682 return wd->mode_item;
5688 * @param obj The genlist object
5689 * @param reorder_mode The reorder mode
5690 * (EINA_TRUE = on, EINA_FALSE = off)
5695 elm_genlist_reorder_mode_set(Evas_Object *obj,
5696 Eina_Bool reorder_mode)
5698 ELM_CHECK_WIDTYPE(obj, widtype);
5699 Widget_Data *wd = elm_widget_data_get(obj);
5701 wd->reorder_mode = reorder_mode;
5705 * Get the reorder mode
5707 * @param obj The genlist object
5708 * @return The reorder mode
5709 * (EINA_TRUE = on, EINA_FALSE = off)
5714 elm_genlist_reorder_mode_get(const Evas_Object *obj)
5716 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5717 Widget_Data *wd = elm_widget_data_get(obj);
5718 if (!wd) return EINA_FALSE;
5719 return wd->reorder_mode;