1 #include <Elementary.h>
2 #include <Elementary_Cursor.h>
6 #define MAX_ITEMS_PER_BLOCK 32
7 #define LONGPRESS_TIMEOUT 0.2
10 * @defgroup Genlist Genlist
12 * The aim was to have more expansive list than the simple list in
13 * Elementary that could have more flexible items and allow many more entries
14 * while still being fast and low on memory usage. At the same time it was
15 * also made to be able to do tree structures. But the price to pay is more
16 * complex when it comes to usage. If all you want is a simple list with
17 * icons and a single label, use the normal List object.
19 * Signals that you can add callbacks for are:
21 * clicked - This is called when a user has double-clicked an item. The
22 * event_info parameter is the genlist item that was double-clicked.
24 * selected - This is called when a user has made an item selected. The
25 * event_info parameter is the genlist item that was selected.
27 * unselected - This is called when a user has made an item unselected. The
28 * event_info parameter is the genlist item that was unselected.
30 * expanded - This is called when elm_genlist_item_expanded_set() is called
31 * and the item is now meant to be expanded. The event_info parameter is the
32 * genlist item that was indicated to expand. It is the job of this callback
33 * to then fill in the child items.
35 * contracted - This is called when elm_genlist_item_expanded_set() is called
36 * and the item is now meant to be contracted. The event_info parameter is
37 * the genlist item that was indicated to contract. It is the job of this
38 * callback to then delete the child items.
40 * expand,request - This is called when a user has indicated they want to
41 * expand a tree branch item. The callback should decide if the item can
42 * expand (has any children) and then call elm_genlist_item_expanded_set()
43 * appropriately to set the state. The event_info parameter is the genlist
44 * item that was indicated to expand.
46 * contract,request - This is called when a user has indicated they want to
47 * contract a tree branch item. The callback should decide if the item can
48 * contract (has any children) and then call elm_genlist_item_expanded_set()
49 * appropriately to set the state. The event_info parameter is the genlist
50 * item that was indicated to contract.
52 * realized - This is called when the item in the list is created as a real
53 * evas object. event_info parameter is the genlist item that was created.
54 * The object may be deleted at any time, so it is up to the caller to
55 * not use the object pointer from elm_genlist_item_object_get() in a way
56 * where it may point to freed objects.
58 * unrealized - This is called just before an item is unrealized. After
59 * this call icon objects provided will be deleted and the item object
60 * itself delete or be put into a floating cache.
62 * drag,start,up - This is called when the item in the list has been dragged
65 * drag,start,down - This is called when the item in the list has been dragged
66 * (not scrolled) down.
68 * drag,start,left - This is called when the item in the list has been dragged
69 * (not scrolled) left.
71 * drag,start,right - This is called when the item in the list has been dragged
72 * (not scrolled) right.
74 * drag,stop - This is called when the item in the list has stopped being
77 * drag - This is called when the item in the list is being dragged.
79 * longpressed - This is called when the item is pressed for a certain amount
80 * of time. By default it's 1 second.
82 * scroll,edge,top - This is called when the genlist is scrolled until the top
85 * scroll,edge,bottom - This is called when the genlist is scrolled until the
88 * scroll,edge,left - This is called when the genlist is scrolled until the
91 * scroll,edge,right - This is called when the genlist is scrolled until the
94 * multi,swipe,left - This is called when the genlist is multi-touch swiped
97 * multi,swipe,right - This is called when the genlist is multi-touch swiped
100 * multi,swipe,up - This is called when the genlist is multi-touch swiped
103 * multi,swipe,down - This is called when the genlist is multi-touch swiped
106 * multi,pinch,out - This is called when the genlist is multi-touch pinched
109 * multi,pinch,in - This is called when the genlist is multi-touch pinched
112 * Genlist has a fairly large API, mostly because it's relatively complex,
113 * trying to be both expansive, powerful and efficient. First we will begin
114 * an overview on the theory behind genlist.
116 * Evas tracks every object you create. Every time it processes an event
117 * (mouse move, down, up etc.) it needs to walk through objects and find out
118 * what event that affects. Even worse every time it renders display updates,
119 * in order to just calculate what to re-draw, it needs to walk through many
120 * many many objects. Thus, the more objects you keep active, the more
121 * overhead Evas has in just doing its work. It is advisable to keep your
122 * active objects to the minimum working set you need. Also remember that
123 * object creation and deletion carries an overhead, so there is a
124 * middle-ground, which is not easily determined. But don't keep massive lists
125 * of objects you can't see or use. Genlist does this with list objects. It
126 * creates and destroys them dynamically as you scroll around. It groups them
127 * into blocks so it can determine the visibility etc. of a whole block at
128 * once as opposed to having to walk the whole list. This 2-level list allows
129 * for very large numbers of items to be in the list (tests have used up to
130 * 2,000,000 items). Also genlist employs a queue for adding items. As items
131 * may be different sizes, every item added needs to be calculated as to its
132 * size and thus this presents a lot of overhead on populating the list, this
133 * genlist employs a queue. Any item added is queued and spooled off over
134 * time, actually appearing some time later, so if your list has many members
135 * you may find it takes a while for them to all appear, with your process
136 * consuming a lot of CPU while it is busy spooling.
138 * Genlist also implements a tree structure, but it does so with callbacks to
139 * the application, with the application filling in tree structures when
140 * requested (allowing for efficient building of a very deep tree that could
141 * even be used for file-management). See the above smart signal callbacks for
144 * An item in the genlist world can have 0 or more text labels (they can be
145 * regular text or textblock ??that's up to the style to determine), 0 or
146 * more icons (which are simply objects swallowed into the genlist item) and
147 * 0 or more boolean states that can be used for check, radio or other
148 * indicators by the edje theme style. An item may be one of several styles
149 * (Elementary provides 4 by default - ?
\9cdefault?? ?
\9cdouble_label?? "group_index"
150 * and "icon_top_text_bottom", but this can be extended by system or
151 * application custom themes/overlays/extensions).
153 * In order to implement the ability to add and delete items on the fly,
154 * Genlist implements a class/callback system where the application provides
155 * a structure with information about that type of item (genlist may contain
156 * multiple different items with different classes, states and styles).
157 * Genlist will call the functions in this struct (methods) when an item is
158 * ?
\9crealized??(that is created dynamically while scrolling). All objects will
159 * simply be deleted when no longer needed with evas_object_del(). The
160 * Elm_Genlist_Item_Class structure contains the following members:
162 * item_style - This is a constant string and simply defines the name of the
163 * item style. It must be specified and the default should be ?
\9cdefault??
165 * func.label_get - This function is called when an actual item object is
166 * created. The data parameter is the data parameter passed to
167 * elm_genlist_item_append() and related item creation functions. The obj
168 * parameter is the genlist object and the part parameter is the string name
169 * of the text part in the edje design that is listed as one of the possible
170 * labels that can be set. This function must return a strudup()'ed string as
171 * the caller will free() it when done.
173 * func.icon_get - This function is called when an actual item object is
174 * created. The data parameter is the data parameter passed to
175 * elm_genlist_item_append() and related item creation functions. The obj
176 * parameter is the genlist object and the part parameter is the string name
177 * of the icon part in the edje design that is listed as one of the possible
178 * icons that can be set. This must return NULL for no object or a valid
179 * object. The object will be deleted by genlist on shutdown or when the item
182 * func.state_get - This function is called when an actual item object is
183 * created. The data parameter is the data parameter passed to
184 * elm_genlist_item_append() and related item creation functions. The obj
185 * parameter is the genlist object and the part parameter is the string name
186 * of the state part in the edje design that is listed as one of the possible
187 * states that can be set. Return 0 for false or 1 for true. Genlist will
188 * emit a signal to the edje object with ?
\9celm,state,XXX,active???
\9celm??when
189 * true (the default is false), where XXX is the name of the part.
191 * func.del - This is called when elm_genlist_item_del() is called on an
192 * item, elm_genlist_clear() is called on the genlist, or
193 * elm_genlist_item_subitems_clear() is called to clear sub-items. This is
194 * intended for use when actual genlist items are deleted, so any backing
195 * data attached to the item (e.g. its data parameter on creation) can be
198 * Items can be added by several calls. All of them return a Elm_Genlist_Item
199 * handle that is an internal member inside the genlist. They all take a data
200 * parameter that is meant to be used for a handle to the applications
201 * internal data (eg the struct with the original item data). The parent
202 * parameter is the parent genlist item this belongs to if it is a tree or
203 * an indexed group, and NULL if there is no parent. The flags can be a bitmask
204 * of ELM_GENLIST_ITEM_NONE, ELM_GENLIST_ITEM_SUBITEMS and
205 * ELM_GENLIST_ITEM_GROUP. If ELM_GENLIST_ITEM_SUBITEMS is set then this item
206 * is displayed as an item that is able to expand and have child items.
207 * If ELM_GENLIST_ITEM_GROUP is set then this item is group idex item that is
208 * displayed at the top until the next group comes. The func parameter is a
209 * convenience callback that is called when the item is selected and the data
210 * parameter will be the func_data parameter, obj be the genlist object and
211 * event_info will be the genlist item.
213 * elm_genlist_item_append() appends an item to the end of the list, or if
214 * there is a parent, to the end of all the child items of the parent.
215 * elm_genlist_item_prepend() is the same but prepends to the beginning of
216 * the list or children list. elm_genlist_item_insert_before() inserts at
217 * item before another item and elm_genlist_item_insert_after() inserts after
218 * the indicated item.
220 * The application can clear the list with elm_genlist_clear() which deletes
221 * all the items in the list and elm_genlist_item_del() will delete a specific
222 * item. elm_genlist_item_subitems_clear() will clear all items that are
223 * children of the indicated parent item.
225 * If the application wants multiple items to be able to be selected,
226 * elm_genlist_multi_select_set() can enable this. If the list is
227 * single-selection only (the default), then elm_genlist_selected_item_get()
228 * will return the selected item, if any, or NULL I none is selected. If the
229 * list is multi-select then elm_genlist_selected_items_get() will return a
230 * list (that is only valid as long as no items are modified (added, deleted,
231 * selected or unselected)).
233 * To help inspect list items you can jump to the item at the top of the list
234 * with elm_genlist_first_item_get() which will return the item pointer, and
235 * similarly elm_genlist_last_item_get() gets the item at the end of the list.
236 * elm_genlist_item_next_get() and elm_genlist_item_prev_get() get the next
237 * and previous items respectively relative to the indicated item. Using
238 * these calls you can walk the entire item list/tree. Note that as a tree
239 * the items are flattened in the list, so elm_genlist_item_parent_get() will
240 * let you know which item is the parent (and thus know how to skip them if
243 * There are also convenience functions. elm_genlist_item_genlist_get() will
244 * return the genlist object the item belongs to. elm_genlist_item_show()
245 * will make the scroller scroll to show that specific item so its visible.
246 * elm_genlist_item_data_get() returns the data pointer set by the item
247 * creation functions.
249 * If an item changes (state of boolean changes, label or icons change),
250 * then use elm_genlist_item_update() to have genlist update the item with
251 * the new state. Genlist will re-realize the item thus call the functions
252 * in the _Elm_Genlist_Item_Class for that item.
254 * To programmatically (un)select an item use elm_genlist_item_selected_set().
255 * To get its selected state use elm_genlist_item_selected_get(). Similarly
256 * to expand/contract an item and get its expanded state, use
257 * elm_genlist_item_expanded_set() and elm_genlist_item_expanded_get(). And
258 * again to make an item disabled (unable to be selected and appear
259 * differently) use elm_genlist_item_disabled_set() to set this and
260 * elm_genlist_item_disabled_get() to get the disabled state.
262 * In general to indicate how the genlist should expand items horizontally to
263 * fill the list area, use elm_genlist_horizontal_mode_set(). Valid modes are
264 * ELM_LIST_LIMIT and ELM_LIST_SCROLL . The default is ELM_LIST_SCROLL. This
265 * mode means that if items are too wide to fit, the scroller will scroll
266 * horizontally. Otherwise items are expanded to fill the width of the
267 * viewport of the scroller. If it is ELM_LIST_LIMIT, items will be expanded
268 * to the viewport width and limited to that size. This can be combined with
269 * a different style that uses edjes' ellipsis feature (cutting text off like
270 * this: ?
\9ctex...??.
272 * Items will only call their selection func and callback when first becoming
273 * selected. Any further clicks will do nothing, unless you enable always
274 * select with elm_genlist_always_select_mode_set(). This means even if
275 * selected, every click will make the selected callbacks be called.
276 * elm_genlist_no_select_mode_set() will turn off the ability to select
277 * items entirely and they will neither appear selected nor call selected
278 * callback functions.
280 * Remember that you can create new styles and add your own theme augmentation
281 * per application with elm_theme_extension_add(). If you absolutely must
282 * have a specific style that overrides any theme the user or system sets up
283 * you can use elm_theme_overlay_add() to add such a file.
286 typedef struct _Widget_Data Widget_Data;
287 typedef struct _Item_Block Item_Block;
288 typedef struct _Pan Pan;
289 typedef struct _Item_Cache Item_Cache;
290 typedef struct _Edit_Data Edit_Data;
292 typedef enum _Elm_Genlist_Item_Move_effect_Mode
294 ELM_GENLIST_ITEM_MOVE_EFFECT_NONE = 0,
295 ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND = (1 << 0),
296 ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT = (1 << 1),
297 ELM_GENLIST_ITEM_MOVE_EFFECT_EDIT_MODE = (1 << 2),
298 } Elm_Genlist_Item_Move_effect_Mode;
302 Evas_Object *obj, *scr, *pan_smart;
303 Eina_Inlist *items, *blocks;
304 Eina_List *group_items;
306 Evas_Coord pan_x, pan_y, w, h, minw, minh, realminw, prev_viewport_w;
307 Ecore_Job *calc_job, *update_job;
308 Ecore_Idler *queue_idler;
309 Ecore_Idler *must_recalc_idler;
310 Eina_List *queue, *selected;
311 Elm_Genlist_Item *show_item;
312 Elm_Genlist_Item *last_selected_item;
313 Eina_Inlist *item_cache;
314 Elm_Genlist_Item *anchor_item;
315 Elm_Genlist_Item *reorder_it, *reorder_rel;
318 Ecore_Timer *multi_timer;
319 Evas_Coord prev_x, prev_y, prev_mx, prev_my;
320 Evas_Coord cur_x, cur_y, cur_mx, cur_my;
321 Evas_Coord reorder_start_y;
322 Eina_Bool mouse_down : 1;
323 Eina_Bool multi_down : 1;
324 Eina_Bool multi_timeout : 1;
325 Eina_Bool multitouched : 1;
326 Ecore_Animator *item_moving_effect_timer;
327 Evas_Object *alpha_bg;
328 Elm_Genlist_Item *expand_item;
329 Evas_Coord expand_item_end;
330 Evas_Coord expand_item_gap;
331 Eina_Bool on_hold : 1;
333 Eina_Bool always_select : 1;
334 Eina_Bool longpressed : 1;
335 Eina_Bool wasselected : 1;
336 Eina_Bool no_select : 1;
337 Eina_Bool bring_in : 1;
338 Eina_Bool compress : 1;
339 Eina_Bool height_for_width : 1;
340 Eina_Bool homogeneous : 1;
341 Eina_Bool clear_me : 1;
346 } history[SWIPE_MOVES];
348 int item_cache_count;
354 int max_items_per_block;
355 int move_effect_mode;
356 unsigned int start_time;
357 double longpress_timeout;
359 // TODO : refactoring
360 Eina_Bool reorder_mode : 1;
361 Eina_Bool reorder_pan_move : 1;
362 Eina_Bool effect_mode : 1;
363 Eina_Bool select_all_check : 1;
366 Eina_List *edit_field;
367 Elm_Genlist_Item *select_all_item;
368 Eina_List *sweeped_items;
369 Ecore_Timer *scr_hold_timer;
371 int group_item_width;
372 int group_item_height;
383 Evas_Coord x, y, w, h, minw, minh;
384 Eina_Bool want_unrealize : 1;
385 Eina_Bool realized : 1;
386 Eina_Bool changed : 1;
387 Eina_Bool updateme : 1;
388 Eina_Bool showme : 1;
389 Eina_Bool must_recalc : 1;
392 struct _Elm_Genlist_Item
394 Elm_Widget_Item base;
399 Evas_Coord x, y, w, h, minw, minh;
400 const Elm_Genlist_Item_Class *itc;
401 Elm_Genlist_Item *parent;
402 Elm_Genlist_Item *group_item;
403 Elm_Genlist_Item_Flags flags;
411 Eina_List *labels, *icons, *states, *icon_objs;
412 Ecore_Timer *long_timer;
413 Ecore_Timer *swipe_timer;
414 Ecore_Animator *item_moving_effect_timer;
416 Evas_Coord scrl_x, scrl_y;
417 Evas_Coord old_scrl_x, old_scrl_y;
418 Evas_Coord pad_left, pad_right;
420 Elm_Genlist_Item *rel;
425 Elm_Tooltip_Item_Content_Cb content_cb;
426 Evas_Smart_Cb del_cb;
430 const char *mouse_cursor;
438 Eina_Bool before : 1;
440 Eina_Bool want_unrealize : 1;
441 Eina_Bool want_realize : 1;
442 Eina_Bool realized : 1;
443 Eina_Bool selected : 1;
444 Eina_Bool hilighted : 1;
445 Eina_Bool expanded : 1;
446 Eina_Bool disabled : 1;
447 Eina_Bool display_only : 1;
448 Eina_Bool mincalcd : 1;
449 Eina_Bool queued : 1;
450 Eina_Bool showme : 1;
451 Eina_Bool delete_me : 1;
453 Eina_Bool dragging : 1;
454 Eina_Bool updateme : 1;
457 Eina_Bool move_effect_me : 1;
458 Eina_Bool effect_done : 1;
459 Eina_List *edit_icon_objs;
460 Evas_Object *edit_obj;
461 Eina_Bool reordering : 1;
462 Eina_Bool edit_select_check: 1;
463 Eina_Bool renamed : 1;
464 Eina_Bool effect_item_realized : 1;
465 Eina_Bool sweeped : 1;
466 Eina_Bool wassweeped : 1;
467 Eina_List *sweep_labels, *sweep_icons, *sweep_icon_objs;
475 Evas_Object *base_view, *spacer;
477 const char *item_style; // it->itc->item_style
478 Eina_Bool tree : 1; // it->flags & ELM_GENLIST_ITEM_SUBITEMS
479 Eina_Bool compress : 1; // it->wd->compress
480 Eina_Bool odd : 1; // in & 0x1
482 Eina_Bool selected : 1; // it->selected
483 Eina_Bool disabled : 1; // it->disabled
484 Eina_Bool expanded : 1; // it->expanded
489 Elm_Genlist_Edit_Class *ec;
490 Elm_Genlist_Item *del_item;
491 Elm_Genlist_Item *reorder_item;
492 Elm_Genlist_Item *reorder_rel;
493 Evas_Object *del_confirm;
496 #define ELM_GENLIST_ITEM_FROM_INLIST(item) \
497 ((item) ? EINA_INLIST_CONTAINER_GET(item, Elm_Genlist_Item) : NULL)
501 Evas_Object_Smart_Clipped_Data __clipped_data;
503 Ecore_Job *resize_job;
506 static const char *widtype = NULL;
507 static void _item_cache_zero(Widget_Data *wd);
508 static void _del_hook(Evas_Object *obj);
509 static void _theme_hook(Evas_Object *obj);
510 //static void _show_region_hook(void *data, Evas_Object *obj);
511 static void _sizing_eval(Evas_Object *obj);
512 static void _item_unrealize(Elm_Genlist_Item *it);
513 static void _item_block_unrealize(Item_Block *itb);
514 static void _calc_job(void *data);
515 static void _on_focus_hook(void *data,
517 static Eina_Bool _item_multi_select_up(Widget_Data *wd);
518 static Eina_Bool _item_multi_select_down(Widget_Data *wd);
519 static Eina_Bool _item_single_select_up(Widget_Data *wd);
520 static Eina_Bool _item_single_select_down(Widget_Data *wd);
521 static Eina_Bool _event_hook(Evas_Object *obj,
523 Evas_Callback_Type type,
525 static Eina_Bool _deselect_all_items(Widget_Data *wd);
526 static void _pan_calculate(Evas_Object *obj);
527 static Evas_Object* _create_tray_alpha_bg(const Evas_Object *obj);
528 static unsigned int current_time_get();
529 static Eina_Bool _item_moving_effect_timer_cb(void *data);
530 static int _item_flip_effect_show(Elm_Genlist_Item *it);
531 static void _effect_item_controls(Elm_Genlist_Item *it, int itx, int ity);
532 static void _effect_item_realize(Elm_Genlist_Item *it);
533 static void _effect_item_unrealize(Elm_Genlist_Item *it);
535 // TODO : refactoring
536 static void _item_slide(Elm_Genlist_Item *it, Eina_Bool slide_to_right);
537 static void _sweep_finish(void *data, Evas_Object *o, const char *emission, const char *source);
538 static void _create_sweep_objs(Elm_Genlist_Item *it);
539 static void _delete_sweep_objs(Elm_Genlist_Item *it);
540 static void _effect_item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after);
541 static void _effect_item_move_before(Elm_Genlist_Item *it, Elm_Genlist_Item *before);
543 static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
546 _event_hook(Evas_Object *obj,
547 Evas_Object *src __UNUSED__,
548 Evas_Callback_Type type,
551 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
552 Evas_Event_Key_Down *ev = event_info;
553 Widget_Data *wd = elm_widget_data_get(obj);
554 if (!wd) return EINA_FALSE;
555 if (!wd->items) return EINA_FALSE;
556 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
557 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
559 Elm_Genlist_Item *it = NULL;
562 Evas_Coord step_x = 0;
563 Evas_Coord step_y = 0;
566 Evas_Coord page_x = 0;
567 Evas_Coord page_y = 0;
569 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
570 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
571 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
572 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
574 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
578 else if ((!strcmp(ev->keyname, "Right")) ||
579 (!strcmp(ev->keyname, "KP_Right")))
583 else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
585 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
586 (_item_multi_select_up(wd)))
587 || (_item_single_select_up(wd)))
589 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
595 else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
597 if (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
598 (_item_multi_select_down(wd)))
599 || (_item_single_select_down(wd)))
601 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
607 else if ((!strcmp(ev->keyname, "Home")) ||
608 (!strcmp(ev->keyname, "KP_Home")))
610 it = elm_genlist_first_item_get(obj);
611 elm_genlist_item_bring_in(it);
612 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
615 else if ((!strcmp(ev->keyname, "End")) ||
616 (!strcmp(ev->keyname, "KP_End")))
618 it = elm_genlist_last_item_get(obj);
619 elm_genlist_item_bring_in(it);
620 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
623 else if ((!strcmp(ev->keyname, "Prior")) ||
624 (!strcmp(ev->keyname, "KP_Prior")))
627 y -= -(page_y * v_h) / 100;
631 else if ((!strcmp(ev->keyname, "Next")) ||
632 (!strcmp(ev->keyname, "KP_Next")))
635 y += -(page_y * v_h) / 100;
639 else if(((!strcmp(ev->keyname, "Return")) ||
640 (!strcmp(ev->keyname, "KP_Enter")) ||
641 (!strcmp(ev->keyname, "space")))
642 && (!wd->multi) && (wd->selected))
644 Elm_Genlist_Item *it = elm_genlist_selected_item_get(obj);
645 elm_genlist_item_expanded_set(it,
646 !elm_genlist_item_expanded_get(it));
648 else if (!strcmp(ev->keyname, "Escape"))
650 if (!_deselect_all_items(wd)) return EINA_FALSE;
651 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
654 else return EINA_FALSE;
656 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
657 elm_smart_scroller_child_pos_set(wd->scr, x, y);
662 _deselect_all_items(Widget_Data *wd)
664 if (!wd->selected) return EINA_FALSE;
666 elm_genlist_item_selected_set(wd->selected->data, EINA_FALSE);
672 _item_multi_select_up(Widget_Data *wd)
674 if (!wd->selected) return EINA_FALSE;
675 if (!wd->multi) return EINA_FALSE;
677 Elm_Genlist_Item *prev = elm_genlist_item_prev_get(wd->last_selected_item);
678 if (!prev) return EINA_TRUE;
680 if (elm_genlist_item_selected_get(prev))
682 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
683 wd->last_selected_item = prev;
684 elm_genlist_item_show(wd->last_selected_item);
688 elm_genlist_item_selected_set(prev, EINA_TRUE);
689 elm_genlist_item_show(prev);
695 _item_multi_select_down(Widget_Data *wd)
697 if (!wd->selected) return EINA_FALSE;
698 if (!wd->multi) return EINA_FALSE;
700 Elm_Genlist_Item *next = elm_genlist_item_next_get(wd->last_selected_item);
701 if (!next) return EINA_TRUE;
703 if (elm_genlist_item_selected_get(next))
705 elm_genlist_item_selected_set(wd->last_selected_item, EINA_FALSE);
706 wd->last_selected_item = next;
707 elm_genlist_item_show(wd->last_selected_item);
711 elm_genlist_item_selected_set(next, EINA_TRUE);
712 elm_genlist_item_show(next);
718 _item_single_select_up(Widget_Data *wd)
720 Elm_Genlist_Item *prev;
723 prev = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
724 while ((prev) && (prev->delete_me))
725 prev = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
727 else prev = elm_genlist_item_prev_get(wd->last_selected_item);
729 if (!prev) return EINA_FALSE;
731 _deselect_all_items(wd);
733 elm_genlist_item_selected_set(prev, EINA_TRUE);
734 elm_genlist_item_show(prev);
739 _item_single_select_down(Widget_Data *wd)
741 Elm_Genlist_Item *next;
744 next = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
745 while ((next) && (next->delete_me))
746 next = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
748 else next = elm_genlist_item_next_get(wd->last_selected_item);
750 if (!next) return EINA_FALSE;
752 _deselect_all_items(wd);
754 elm_genlist_item_selected_set(next, EINA_TRUE);
755 elm_genlist_item_show(next);
760 _on_focus_hook(void *data __UNUSED__,
763 Widget_Data *wd = elm_widget_data_get(obj);
765 if (elm_widget_focus_get(obj))
767 edje_object_signal_emit(wd->obj, "elm,action,focus", "elm");
768 evas_object_focus_set(wd->obj, EINA_TRUE);
769 if ((wd->selected) && (!wd->last_selected_item))
770 wd->last_selected_item = eina_list_data_get(wd->selected);
774 edje_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
775 evas_object_focus_set(wd->obj, EINA_FALSE);
780 _del_hook(Evas_Object *obj)
782 Widget_Data *wd = elm_widget_data_get(obj);
784 _item_cache_zero(wd);
785 if (wd->calc_job) ecore_job_del(wd->calc_job);
786 if (wd->update_job) ecore_job_del(wd->update_job);
787 if (wd->must_recalc_idler) ecore_idler_del(wd->must_recalc_idler);
788 if (wd->multi_timer) ecore_timer_del(wd->multi_timer);
789 if (wd->scr_hold_timer) ecore_timer_del(wd->scr_hold_timer);
794 _del_pre_hook(Evas_Object *obj)
796 Widget_Data *wd = elm_widget_data_get(obj);
798 evas_object_del(wd->pan_smart);
799 wd->pan_smart = NULL;
800 elm_genlist_clear(obj);
804 _theme_hook(Evas_Object *obj)
806 Widget_Data *wd = elm_widget_data_get(obj);
809 _item_cache_zero(wd);
810 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
811 elm_widget_style_get(obj));
812 // edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
813 wd->item_width = wd->item_height = 0;
814 wd->minw = wd->minh = wd->realminw = 0;
815 EINA_INLIST_FOREACH(wd->blocks, itb)
818 Elm_Genlist_Item *it;
820 if (itb->realized) _item_block_unrealize(itb);
821 EINA_LIST_FOREACH(itb->items, l, it)
822 it->mincalcd = EINA_FALSE;
824 itb->changed = EINA_TRUE;
826 if (wd->calc_job) ecore_job_del(wd->calc_job);
827 wd->calc_job = ecore_job_add(_calc_job, wd);
833 _show_region_hook(void *data, Evas_Object *obj)
835 Widget_Data *wd = elm_widget_data_get(data);
836 Evas_Coord x, y, w, h;
838 elm_widget_show_region_get(obj, &x, &y, &w, &h);
839 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
844 _sizing_eval(Evas_Object *obj)
846 Widget_Data *wd = elm_widget_data_get(obj);
847 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
849 evas_object_size_hint_min_get(wd->scr, &minw, &minh);
850 evas_object_size_hint_max_get(wd->scr, &maxw, &maxh);
852 if (wd->height_for_width)
856 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
857 if ((vw != 0) && (vw != wd->prev_viewport_w))
861 wd->prev_viewport_w = vw;
862 EINA_INLIST_FOREACH(wd->blocks, itb)
864 itb->must_recalc = EINA_TRUE;
866 if (wd->calc_job) ecore_job_del(wd->calc_job);
867 wd->calc_job = ecore_job_add(_calc_job, wd);
870 if (wd->mode == ELM_LIST_LIMIT)
872 Evas_Coord vmw, vmh, vw, vh;
876 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
877 if ((minw > 0) && (vw < minw)) vw = minw;
878 else if ((maxw > 0) && (vw > maxw))
880 edje_object_size_min_calc
881 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
888 edje_object_size_min_calc
889 (elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
893 evas_object_size_hint_min_set(obj, minw, minh);
894 evas_object_size_hint_max_set(obj, maxw, maxh);
898 _item_hilight(Elm_Genlist_Item *it)
900 const char *selectraise;
901 if ((it->wd->no_select) || (it->delete_me) || (it->hilighted) ||
902 (it->disabled)) return;
903 if ((!it->sweeped) && (!it->wd->edit_mode))
904 edje_object_signal_emit(it->base.view, "elm,state,selected", "elm");
905 selectraise = edje_object_data_get(it->base.view, "selectraise");
906 if ((selectraise) && (!strcmp(selectraise, "on")))
908 if (!it->wd->edit_mode) evas_object_raise(it->base.view);
909 if ((it->group_item) && (it->group_item->realized))
910 evas_object_raise(it->group_item->base.view);
912 it->hilighted = EINA_TRUE;
913 if (it->wd->select_all_item) evas_object_raise(it->wd->select_all_item->base.view);
918 _item_block_del(Elm_Genlist_Item *it)
921 Item_Block *itb = it->block;
923 itb->items = eina_list_remove(itb->items, it);
925 itb->changed = EINA_TRUE;
926 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
927 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
930 il = EINA_INLIST_GET(itb);
931 Item_Block *itbn = (Item_Block *)(il->next);
933 it->parent->items = eina_list_remove(it->parent->items, it);
935 it->wd->blocks = eina_inlist_remove(it->wd->blocks, il);
937 if (itbn) itbn->changed = EINA_TRUE;
941 if (itb->count < itb->wd->max_items_per_block/2)
943 il = EINA_INLIST_GET(itb);
944 Item_Block *itbp = (Item_Block *)(il->prev);
945 Item_Block *itbn = (Item_Block *)(il->next);
946 if ((itbp) && ((itbp->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
948 Elm_Genlist_Item *it2;
950 EINA_LIST_FREE(itb->items, it2)
953 itbp->items = eina_list_append(itbp->items, it2);
955 itbp->changed = EINA_TRUE;
957 it->wd->blocks = eina_inlist_remove(it->wd->blocks,
958 EINA_INLIST_GET(itb));
961 else if ((itbn) && ((itbn->count + itb->count) < itb->wd->max_items_per_block + itb->wd->max_items_per_block/2))
965 Eina_List *last = eina_list_last(itb->items);
966 Elm_Genlist_Item *it2 = last->data;
969 itb->items = eina_list_remove_list(itb->items, last);
970 itbn->items = eina_list_prepend(itbn->items, it2);
972 itbn->changed = EINA_TRUE;
975 eina_inlist_remove(it->wd->blocks, EINA_INLIST_GET(itb));
983 _item_subitems_clear(Elm_Genlist_Item *it)
986 Eina_List *tl = NULL, *l;
987 Elm_Genlist_Item *it2;
989 EINA_LIST_FOREACH(it->items, l, it2)
990 tl = eina_list_append(tl, it2);
992 EINA_LIST_FREE(tl, it2)
993 elm_genlist_item_del(it2);
997 _item_del(Elm_Genlist_Item *it)
999 elm_widget_item_pre_notify_del(it);
1000 elm_genlist_item_subitems_clear(it);
1001 it->wd->walking -= it->walking;
1002 if (it->wd->show_item == it) it->wd->show_item = NULL;
1003 if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it);
1004 if (it->realized) _item_unrealize(it);
1005 if (it->effect_item_realized) _effect_item_unrealize(it);
1006 if (it->block) _item_block_del(it);
1007 if ((!it->delete_me) && (it->itc->func.del))
1008 it->itc->func.del((void *)it->base.data, it->base.widget);
1009 it->delete_me = EINA_TRUE;
1011 it->wd->queue = eina_list_remove(it->wd->queue, it);
1012 if (it->wd->anchor_item == it)
1014 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
1015 if (!it->wd->anchor_item)
1016 it->wd->anchor_item = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
1018 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
1020 it->parent->items = eina_list_remove(it->parent->items, it);
1021 if (it->flags & ELM_GENLIST_ITEM_GROUP)
1022 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
1023 if (it->long_timer) ecore_timer_del(it->long_timer);
1024 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
1026 if (it->tooltip.del_cb)
1027 it->tooltip.del_cb((void *)it->tooltip.data, it->base.widget, it);
1029 elm_widget_item_del(it);
1030 it->wd->total_num--; // todo : remove
1034 _item_select(Elm_Genlist_Item *it)
1036 if ((it->wd->no_select) || (it->delete_me)) return;
1037 if (it == it->wd->select_all_item) return;
1040 if (it->wd->always_select) goto call;
1043 it->selected = EINA_TRUE;
1044 it->wd->selected = eina_list_append(it->wd->selected, it);
1048 if (it->func.func) it->func.func((void *)it->func.data, it->base.widget, it);
1050 evas_object_smart_callback_call(it->base.widget, "selected", it);
1053 if ((it->wd->clear_me) && (!it->wd->walking))
1054 elm_genlist_clear(it->base.widget);
1057 if ((!it->walking) && (it->delete_me))
1059 if (!it->relcount) _item_del(it);
1062 it->wd->last_selected_item = it;
1066 _item_unselect(Elm_Genlist_Item *it)
1068 const char *stacking, *selectraise;
1070 if (it == it->wd->select_all_item) return;
1071 if ((it->delete_me) || (!it->hilighted)) return;
1073 edje_object_signal_emit(it->base.view, "elm,state,unselected", "elm");
1074 stacking = edje_object_data_get(it->base.view, "stacking");
1075 selectraise = edje_object_data_get(it->base.view, "selectraise");
1076 if ((selectraise) && (!strcmp(selectraise, "on")))
1078 if ((stacking) && (!strcmp(stacking, "below")))
1079 evas_object_lower(it->base.view);
1081 it->hilighted = EINA_FALSE;
1084 it->selected = EINA_FALSE;
1085 it->wd->selected = eina_list_remove(it->wd->selected, it);
1086 evas_object_smart_callback_call(it->base.widget, "unselected", it);
1091 _mouse_move(void *data,
1092 Evas *evas __UNUSED__,
1096 Elm_Genlist_Item *it = data;
1097 Evas_Event_Mouse_Move *ev = event_info;
1098 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
1100 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1102 if (!it->wd->on_hold)
1104 it->wd->on_hold = EINA_TRUE;
1105 if (!it->wd->wasselected)
1109 if (it->wd->multitouched)
1111 it->wd->cur_x = ev->cur.canvas.x;
1112 it->wd->cur_y = ev->cur.canvas.y;
1115 if ((it->dragging) && (it->down))
1117 if (it->wd->movements == SWIPE_MOVES) it->wd->swipe = EINA_TRUE;
1120 it->wd->history[it->wd->movements].x = ev->cur.canvas.x;
1121 it->wd->history[it->wd->movements].y = ev->cur.canvas.y;
1122 if (abs((it->wd->history[it->wd->movements].x -
1123 it->wd->history[0].x)) > 40)
1124 it->wd->swipe = EINA_TRUE;
1126 it->wd->movements++;
1130 ecore_timer_del(it->long_timer);
1131 it->long_timer = NULL;
1133 evas_object_smart_callback_call(it->base.widget, "drag", it);
1136 if ((!it->down) /* || (it->wd->on_hold)*/ || (it->wd->longpressed))
1140 ecore_timer_del(it->long_timer);
1141 it->long_timer = NULL;
1143 if (it->wd->reorder_mode && it->wd->reorder_it)
1145 Evas_Coord ox,oy,oh,ow, sel_all_h = 0;
1146 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
1147 int it_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
1148 if (!it->wd->reorder_start_y) it->wd->reorder_start_y = it->block->y + it->y;
1150 evas_object_resize(it->base.view, it->w-(it->pad_left+it->pad_right), it->h);
1151 if (it->wd->select_all_item)
1152 sel_all_h = it->wd->select_all_item->h;
1153 if (it_y < oy + sel_all_h)
1155 evas_object_move(it->base.view, it->scrl_x+it->pad_left,oy + sel_all_h);
1156 _effect_item_controls(it, it->scrl_x, oy + sel_all_h);
1158 else if (it_y + it->wd->reorder_it->h > oy+oh)
1160 evas_object_move(it->base.view, it->scrl_x+it->pad_left, oy + oh - it->wd->reorder_it->h);
1161 _effect_item_controls(it, it->scrl_x, oy + oh - it->wd->reorder_it->h);
1165 evas_object_move(it->base.view, it->scrl_x+it->pad_left, it_y);
1166 _effect_item_controls(it, it->scrl_x, it_y);
1168 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1169 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1173 if (!it->display_only)
1174 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1175 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1176 x = ev->cur.canvas.x - x;
1177 y = ev->cur.canvas.y - y;
1180 if (adx < 0) adx = -dx;
1183 if (ady < 0) ady = -dy;
1186 if ((adx > minw) || (ady > minh))
1188 it->dragging = EINA_TRUE;
1191 ecore_timer_del(it->long_timer);
1192 it->long_timer = NULL;
1194 if (!it->wd->wasselected)
1199 evas_object_smart_callback_call(it->base.widget,
1200 "drag,start,up", it);
1205 evas_object_smart_callback_call(it->base.widget,
1206 "drag,start,left", it);
1207 _item_slide(it, EINA_FALSE);
1211 evas_object_smart_callback_call(it->base.widget,
1212 "drag,start,right", it);
1213 _item_slide(it, EINA_TRUE);
1220 evas_object_smart_callback_call(it->base.widget,
1221 "drag,start,down", it);
1226 evas_object_smart_callback_call(it->base.widget,
1227 "drag,start,left", it);
1228 _item_slide(it, EINA_FALSE);
1232 evas_object_smart_callback_call(it->base.widget,
1233 "drag,start,right", it);
1234 _item_slide(it, EINA_TRUE);
1242 _long_press(void *data)
1244 Elm_Genlist_Item *it = data , *it_tmp;
1245 static Eina_Bool done = EINA_FALSE;
1246 //static Eina_Bool contracted = EINA_FALSE;
1250 it->long_timer = NULL;
1251 if ((it->disabled) || (it->dragging) || (it->display_only))
1252 return ECORE_CALLBACK_CANCEL;
1253 it->wd->longpressed = EINA_TRUE;
1254 evas_object_smart_callback_call(it->base.widget, "longpressed", it);
1255 if (it->wd->reorder_mode && it != it->wd->select_all_item)
1257 it->wd->reorder_it = it;
1258 it->wd->reorder_start_y = 0;
1259 elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
1260 edje_object_signal_emit(it->edit_obj, "elm,action,item,reorder_start", "elm");
1262 EINA_INLIST_FOREACH(it->wd->blocks, itb)
1267 EINA_LIST_FOREACH(itb->items, l, it_tmp)
1269 if (it_tmp->flags != ELM_GENLIST_ITEM_GROUP && it_tmp->realized)
1271 _item_unselect(it_tmp);
1283 EINA_LIST_FOREACH(it->items, l, it_tmp)
1285 if (elm_genlist_item_expanded_get(it_tmp))
1287 elm_genlist_item_expanded_set(it_tmp, EINA_FALSE);
1288 // contracted = EINA_TRUE;
1289 return ECORE_CALLBACK_RENEW;
1293 if (elm_genlist_item_expanded_get(it)) {
1294 elm_genlist_item_expanded_set(it, EINA_FALSE);
1295 return ECORE_CALLBACK_RENEW;
1299 return ECORE_CALLBACK_CANCEL;
1303 _swipe(Elm_Genlist_Item *it)
1308 it->wd->swipe = EINA_FALSE;
1309 for (i = 0; i < it->wd->movements; i++)
1311 sum += it->wd->history[i].x;
1312 if (abs(it->wd->history[0].y - it->wd->history[i].y) > 10) return;
1315 sum /= it->wd->movements;
1316 if (abs(sum - it->wd->history[0].x) <= 10) return;
1317 evas_object_smart_callback_call(it->base.widget, "swipe", it);
1321 _swipe_cancel(void *data)
1323 Elm_Genlist_Item *it = data;
1325 if (!it) return ECORE_CALLBACK_CANCEL;
1326 it->wd->swipe = EINA_FALSE;
1327 it->wd->movements = 0;
1328 return ECORE_CALLBACK_RENEW;
1332 _multi_cancel(void *data)
1334 Widget_Data *wd = data;
1336 if (!wd) return ECORE_CALLBACK_CANCEL;
1337 wd->multi_timeout = EINA_TRUE;
1338 return ECORE_CALLBACK_RENEW;
1342 _multi_touch_gesture_eval(void *data)
1344 Elm_Genlist_Item *it = data;
1346 it->wd->multitouched = EINA_FALSE;
1347 if (it->wd->multi_timer)
1349 ecore_timer_del(it->wd->multi_timer);
1350 it->wd->multi_timer = NULL;
1352 if (it->wd->multi_timeout)
1354 it->wd->multi_timeout = EINA_FALSE;
1358 Evas_Coord minw = 0, minh = 0;
1359 Evas_Coord off_x, off_y, off_mx, off_my;
1361 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1362 off_x = abs(it->wd->cur_x - it->wd->prev_x);
1363 off_y = abs(it->wd->cur_y - it->wd->prev_y);
1364 off_mx = abs(it->wd->cur_mx - it->wd->prev_mx);
1365 off_my = abs(it->wd->cur_my - it->wd->prev_my);
1367 if (((off_x > minw) || (off_y > minh)) && ((off_mx > minw) || (off_my > minh)))
1369 if ((off_x + off_mx) > (off_y + off_my))
1371 if ((it->wd->cur_x > it->wd->prev_x) && (it->wd->cur_mx > it->wd->prev_mx))
1372 evas_object_smart_callback_call(it->base.widget,
1373 "multi,swipe,right", it);
1374 else if ((it->wd->cur_x < it->wd->prev_x) && (it->wd->cur_mx < it->wd->prev_mx))
1375 evas_object_smart_callback_call(it->base.widget,
1376 "multi,swipe,left", it);
1377 else if (abs(it->wd->cur_x - it->wd->cur_mx) > abs(it->wd->prev_x - it->wd->prev_mx))
1378 evas_object_smart_callback_call(it->base.widget,
1379 "multi,pinch,out", it);
1381 evas_object_smart_callback_call(it->base.widget,
1382 "multi,pinch,in", it);
1386 if ((it->wd->cur_y > it->wd->prev_y) && (it->wd->cur_my > it->wd->prev_my))
1387 evas_object_smart_callback_call(it->base.widget,
1388 "multi,swipe,down", it);
1389 else if ((it->wd->cur_y < it->wd->prev_y) && (it->wd->cur_my < it->wd->prev_my))
1390 evas_object_smart_callback_call(it->base.widget,
1391 "multi,swipe,up", it);
1392 else if (abs(it->wd->cur_y - it->wd->cur_my) > abs(it->wd->prev_y - it->wd->prev_my))
1393 evas_object_smart_callback_call(it->base.widget,
1394 "multi,pinch,out", it);
1396 evas_object_smart_callback_call(it->base.widget,
1397 "multi,pinch,in", it);
1400 it->wd->multi_timeout = EINA_FALSE;
1404 _multi_down(void *data,
1405 Evas *evas __UNUSED__,
1406 Evas_Object *obj __UNUSED__,
1409 Elm_Genlist_Item *it = data;
1410 Evas_Event_Multi_Down *ev = event_info;
1412 if ((it->wd->multi_device != 0) || (it->wd->multitouched) || (it->wd->multi_timeout)) return;
1413 it->wd->multi_device = ev->device;
1414 it->wd->multi_down = EINA_TRUE;
1415 it->wd->multitouched = EINA_TRUE;
1416 it->wd->prev_mx = ev->canvas.x;
1417 it->wd->prev_my = ev->canvas.y;
1418 if (!it->wd->wasselected) _item_unselect(it);
1419 it->wd->wasselected = EINA_FALSE;
1420 it->wd->longpressed = EINA_FALSE;
1423 ecore_timer_del(it->long_timer);
1424 it->long_timer = NULL;
1428 it->dragging = EINA_FALSE;
1429 evas_object_smart_callback_call(it->base.widget, "drag,stop", it);
1431 if (it->swipe_timer)
1433 ecore_timer_del(it->swipe_timer);
1434 it->swipe_timer = NULL;
1436 if (it->wd->on_hold)
1438 it->wd->swipe = EINA_FALSE;
1439 it->wd->movements = 0;
1440 it->wd->on_hold = EINA_FALSE;
1445 _multi_up(void *data,
1446 Evas *evas __UNUSED__,
1447 Evas_Object *obj __UNUSED__,
1450 Elm_Genlist_Item *it = data;
1451 Evas_Event_Multi_Up *ev = event_info;
1453 if (it->wd->multi_device != ev->device) return;
1454 it->wd->multi_device = 0;
1455 it->wd->multi_down = EINA_FALSE;
1456 if (it->wd->mouse_down) return;
1457 _multi_touch_gesture_eval(data);
1461 _multi_move(void *data,
1462 Evas *evas __UNUSED__,
1463 Evas_Object *obj __UNUSED__,
1466 Elm_Genlist_Item *it = data;
1467 Evas_Event_Multi_Move *ev = event_info;
1469 if (it->wd->multi_device != ev->device) return;
1470 it->wd->cur_mx = ev->cur.canvas.x;
1471 it->wd->cur_my = ev->cur.canvas.y;
1475 _mouse_down(void *data,
1476 Evas *evas __UNUSED__,
1480 Elm_Genlist_Item *it = data;
1481 Evas_Event_Mouse_Down *ev = event_info;
1484 if (ev->button != 1) return;
1485 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1487 it->wd->on_hold = EINA_TRUE;
1490 if (it->wd->edit_field && !it->renamed)
1491 elm_genlist_item_rename_mode_set(it, 0);
1492 it->down = EINA_TRUE;
1493 it->dragging = EINA_FALSE;
1494 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
1495 it->dx = ev->canvas.x - x;
1496 it->dy = ev->canvas.y - y;
1497 it->wd->mouse_down = EINA_TRUE;
1498 if (!it->wd->multitouched)
1500 it->wd->prev_x = ev->canvas.x;
1501 it->wd->prev_y = ev->canvas.y;
1502 it->wd->multi_timeout = EINA_FALSE;
1503 if (it->wd->multi_timer) ecore_timer_del(it->wd->multi_timer);
1504 it->wd->multi_timer = ecore_timer_add(1, _multi_cancel, it->wd);
1506 it->wd->longpressed = EINA_FALSE;
1507 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1508 else it->wd->on_hold = EINA_FALSE;
1509 if (it->wd->on_hold) return;
1510 it->wd->wasselected = it->selected;
1512 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
1513 evas_object_smart_callback_call(it->base.widget, "clicked", it);
1514 if (it->long_timer) ecore_timer_del(it->long_timer);
1515 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
1516 it->swipe_timer = ecore_timer_add(0.4, _swipe_cancel, it);
1518 it->long_timer = ecore_timer_add(it->wd->longpress_timeout, _long_press,
1521 it->long_timer = NULL;
1522 it->wd->swipe = EINA_FALSE;
1523 it->wd->movements = 0;
1527 _mouse_up(void *data,
1528 Evas *evas __UNUSED__,
1529 Evas_Object *obj __UNUSED__,
1532 Elm_Genlist_Item *it = data;
1533 Evas_Event_Mouse_Up *ev = event_info;
1534 Eina_Bool dragged = EINA_FALSE;
1536 if (ev->button != 1) return;
1537 it->down = EINA_FALSE;
1538 it->wd->mouse_down = EINA_FALSE;
1539 if (it->wd->multitouched)
1541 if (it->wd->multi_down) return;
1542 _multi_touch_gesture_eval(data);
1545 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
1546 else it->wd->on_hold = EINA_FALSE;
1549 ecore_timer_del(it->long_timer);
1550 it->long_timer = NULL;
1554 it->dragging = EINA_FALSE;
1555 evas_object_smart_callback_call(it->base.widget, "drag,stop", it);
1558 if (it->swipe_timer)
1560 ecore_timer_del(it->swipe_timer);
1561 it->swipe_timer = NULL;
1563 if (it->wd->multi_timer)
1565 ecore_timer_del(it->wd->multi_timer);
1566 it->wd->multi_timer = NULL;
1567 it->wd->multi_timeout = EINA_FALSE;
1569 if (it->wd->on_hold)
1571 if (it->wd->swipe) _swipe(data);
1572 it->wd->longpressed = EINA_FALSE;
1573 it->wd->on_hold = EINA_FALSE;
1576 if (it->wd->reorder_mode)
1578 Evas_Coord rox, roy, row, roh, sel_all_h;
1579 Elm_Genlist_Item *reorder_it = it->wd->reorder_it;
1582 Evas_Coord ox,oy,oh,ow;
1583 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
1584 evas_object_geometry_get(it->wd->reorder_it->base.view, &rox, &roy, &row, &roh);
1585 if (it->wd->select_all_item) sel_all_h = it->wd->select_all_item->h;
1586 if (it->wd->reorder_it->parent == it->wd->reorder_rel->parent) // todo : refactoring
1588 if (it->wd->reorder_rel)
1590 if (roy + oy - sel_all_h <= it->wd->reorder_rel->scrl_y)
1591 _effect_item_move_before(it->wd->reorder_it, it->wd->reorder_rel);
1593 _effect_item_move_after(it->wd->reorder_it, it->wd->reorder_rel);
1596 it->wd->reorder_it = it->wd->reorder_rel = NULL;
1597 elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
1598 edje_object_signal_emit(it->edit_obj, "elm,action,item,reorder_end", "elm");
1600 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1601 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1604 if (it->wd->longpressed)
1606 it->wd->longpressed = EINA_FALSE;
1607 if (!it->wd->wasselected)
1609 it->wd->wasselected = EINA_FALSE;
1614 if (it->want_unrealize)
1616 _item_unrealize(it);
1617 if (it->block->want_unrealize)
1618 _item_block_unrealize(it->block);
1621 if ((it->disabled) || (dragged) || (it->display_only)) return;
1622 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1625 if ((!it->selected) && (!it->sweeped))
1630 else _item_unselect(it);
1636 Widget_Data *wd = it->wd;
1639 while (wd->selected) _item_unselect(wd->selected->data);
1644 const Eina_List *l, *l_next;
1645 Elm_Genlist_Item *it2;
1647 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, it2)
1648 if (it2 != it) _item_unselect(it2);
1649 //_item_hilight(it);
1661 _signal_expand_toggle(void *data,
1662 Evas_Object *obj __UNUSED__,
1663 const char *emission __UNUSED__,
1664 const char *source __UNUSED__)
1666 Elm_Genlist_Item *it = data;
1669 evas_object_smart_callback_call(it->base.widget, "contract,request", it);
1671 evas_object_smart_callback_call(it->base.widget, "expand,request", it);
1675 _signal_expand(void *data,
1676 Evas_Object *obj __UNUSED__,
1677 const char *emission __UNUSED__,
1678 const char *source __UNUSED__)
1680 Elm_Genlist_Item *it = data;
1683 evas_object_smart_callback_call(it->base.widget, "expand,request", it);
1687 _signal_contract(void *data,
1688 Evas_Object *obj __UNUSED__,
1689 const char *emission __UNUSED__,
1690 const char *source __UNUSED__)
1692 Elm_Genlist_Item *it = data;
1695 evas_object_smart_callback_call(it->base.widget, "contract,request", it);
1699 _item_cache_clean(Widget_Data *wd)
1701 while ((wd->item_cache) && (wd->item_cache_count > wd->item_cache_max))
1705 itc = EINA_INLIST_CONTAINER_GET(wd->item_cache->last, Item_Cache);
1706 wd->item_cache = eina_inlist_remove(wd->item_cache,
1707 wd->item_cache->last);
1708 wd->item_cache_count--;
1709 if (itc->spacer) evas_object_del(itc->spacer);
1710 if (itc->base_view) evas_object_del(itc->base_view);
1711 if (itc->item_style) eina_stringshare_del(itc->item_style);
1717 _item_cache_zero(Widget_Data *wd)
1719 int pmax = wd->item_cache_max;
1720 wd->item_cache_max = 0;
1721 _item_cache_clean(wd);
1722 wd->item_cache_max = pmax;
1726 _item_cache_add(Elm_Genlist_Item *it)
1730 if (it->wd->item_cache_max <= 0)
1732 evas_object_del(it->base.view);
1733 it->base.view = NULL;
1734 evas_object_del(it->spacer);
1739 it->wd->item_cache_count++;
1740 itc = calloc(1, sizeof(Item_Cache));
1741 it->wd->item_cache = eina_inlist_prepend(it->wd->item_cache,
1742 EINA_INLIST_GET(itc));
1743 itc->spacer = it->spacer;
1745 itc->base_view = it->base.view;
1746 it->base.view = NULL;
1747 evas_object_hide(itc->base_view);
1748 evas_object_move(itc->base_view, -9999, -9999);
1749 itc->item_style = eina_stringshare_add(it->itc->item_style);
1750 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) itc->tree = 1;
1751 itc->compress = (it->wd->compress);
1752 itc->odd = (it->order_num_in & 0x1);
1753 itc->selected = it->selected;
1754 itc->disabled = it->disabled;
1755 itc->expanded = it->expanded;
1758 ecore_timer_del(it->long_timer);
1759 it->long_timer = NULL;
1761 if (it->swipe_timer)
1763 ecore_timer_del(it->swipe_timer);
1764 it->swipe_timer = NULL;
1766 // FIXME: other callbacks?
1767 edje_object_signal_callback_del_full(itc->base_view,
1768 "elm,action,expand,toggle",
1769 "elm", _signal_expand_toggle, it);
1770 edje_object_signal_callback_del_full(itc->base_view, "elm,action,expand",
1772 _signal_expand, it);
1773 edje_object_signal_callback_del_full(itc->base_view, "elm,action,contract",
1774 "elm", _signal_contract, it);
1775 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_DOWN,
1777 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_UP,
1779 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MOUSE_MOVE,
1781 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_DOWN,
1783 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_UP,
1785 evas_object_event_callback_del_full(itc->base_view, EVAS_CALLBACK_MULTI_MOVE,
1787 _item_cache_clean(it->wd);
1791 _item_cache_find(Elm_Genlist_Item *it)
1794 Eina_Bool tree = 0, odd;
1796 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) tree = 1;
1797 odd = (it->order_num_in & 0x1);
1798 EINA_INLIST_FOREACH(it->wd->item_cache, itc)
1800 if ((itc->selected) || (itc->disabled) || (itc->expanded))
1802 if ((itc->tree == tree) &&
1803 (itc->odd == odd) &&
1804 (itc->compress == it->wd->compress) &&
1805 (!strcmp(it->itc->item_style, itc->item_style)))
1807 it->wd->item_cache = eina_inlist_remove(it->wd->item_cache,
1808 EINA_INLIST_GET(itc));
1809 it->wd->item_cache_count--;
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_realize(Elm_Genlist_Item *it,
1830 if ((it->realized) || (it->delete_me)) return;
1832 Elm_Genlist_Item *it2;
1833 const char *stacking;
1834 const char *treesize;
1836 int depth, tsize = 20;
1839 it->order_num_in = in;
1841 itc = _item_cache_find(it);
1842 if (!it->wd->effect_mode && itc)
1844 it->base.view = itc->base_view;
1845 itc->base_view = NULL;
1846 it->spacer = itc->spacer;
1851 it->base.view = edje_object_add(evas_object_evas_get(it->base.widget));
1852 edje_object_scale_set(it->base.view,
1853 elm_widget_scale_get(it->base.widget) *
1854 _elm_config->scale);
1855 evas_object_smart_member_add(it->base.view, it->wd->pan_smart);
1856 elm_widget_sub_object_add(it->base.widget, it->base.view);
1858 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS)
1859 strncpy(buf, "tree", sizeof(buf));
1860 else strncpy(buf, "item", sizeof(buf));
1861 if (it->wd->compress)
1862 strncat(buf, "_compress", sizeof(buf) - strlen(buf));
1864 if (in & 0x1) strncat(buf, "_odd", sizeof(buf) - strlen(buf));
1865 strncat(buf, "/", sizeof(buf) - strlen(buf));
1866 strncat(buf, it->itc->item_style, sizeof(buf) - strlen(buf));
1868 _elm_theme_object_set(it->base.widget, it->base.view, "genlist", buf,
1869 elm_widget_style_get(it->base.widget));
1871 evas_object_rectangle_add(evas_object_evas_get(it->base.widget));
1872 evas_object_color_set(it->spacer, 0, 0, 0, 0);
1873 elm_widget_sub_object_add(it->base.widget, it->spacer);
1875 for (it2 = it, depth = 0; it2->parent; it2 = it2->parent)
1877 if (it2->parent->flags != ELM_GENLIST_ITEM_GROUP) depth += 1;
1879 it->expanded_depth = depth;
1880 treesize = edje_object_data_get(it->base.view, "treesize");
1881 if (treesize) tsize = atoi(treesize);
1882 evas_object_size_hint_min_set(it->spacer,
1883 (depth * tsize) * _elm_config->scale, 1);
1884 edje_object_part_swallow(it->base.view, "elm.swallow.pad", it->spacer);
1887 edje_object_signal_callback_add(it->base.view,
1888 "elm,action,expand,toggle",
1889 "elm", _signal_expand_toggle, it);
1890 edje_object_signal_callback_add(it->base.view, "elm,action,expand",
1891 "elm", _signal_expand, it);
1892 edje_object_signal_callback_add(it->base.view, "elm,action,contract",
1893 "elm", _signal_contract, it);
1894 stacking = edje_object_data_get(it->base.view, "stacking");
1897 if (!strcmp(stacking, "below")) evas_object_lower(it->base.view);
1898 else if (!strcmp(stacking, "above"))
1899 evas_object_raise(it->base.view);
1901 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_DOWN,
1903 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_UP,
1905 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MOUSE_MOVE,
1907 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_DOWN,
1909 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_UP,
1911 evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_MULTI_MOVE,
1915 if (it->selected != itc->selected)
1917 if ((it->selected) && (!it->sweeped))
1918 edje_object_signal_emit(it->base.view,
1919 "elm,state,selected", "elm");
1921 if (it->disabled != itc->disabled)
1924 edje_object_signal_emit(it->base.view,
1925 "elm,state,disabled", "elm");
1927 if (it->expanded != itc->expanded)
1930 edje_object_signal_emit(it->base.view,
1931 "elm,state,expanded", "elm");
1936 if ((it->selected) && (!it->sweeped))
1937 edje_object_signal_emit(it->base.view,
1938 "elm,state,selected", "elm");
1940 edje_object_signal_emit(it->base.view,
1941 "elm,state,disabled", "elm");
1943 edje_object_signal_emit(it->base.view,
1944 "elm,state,expanded", "elm");
1948 if ((calc) && (it->wd->homogeneous) && (it->wd->item_width) && it->wd->group_item_width )
1950 /* homogenous genlist shortcut */
1951 if ((it->flags & ELM_GENLIST_ITEM_GROUP) && (!it->mincalcd))
1953 it->w = it->minw = it->wd->group_item_width;
1954 it->h = it->minh = it->wd->group_item_height;
1955 it->mincalcd = EINA_TRUE;
1957 else if (!it->mincalcd)
1959 it->w = it->minw = it->wd->item_width;
1960 it->h = it->minh = it->wd->item_height;
1961 it->mincalcd = EINA_TRUE;
1966 if (it->itc->func.label_get)
1972 elm_widget_stringlist_get(edje_object_data_get(it->base.view,
1974 EINA_LIST_FOREACH(it->labels, l, key)
1976 char *s = it->itc->func.label_get
1977 ((void *)it->base.data, it->base.widget, l->data);
1981 edje_object_part_text_set(it->base.view, l->data, s);
1985 edje_object_part_text_set(it->base.view, l->data, "");
1988 if (it->itc->func.icon_get)
1994 elm_widget_stringlist_get(edje_object_data_get(it->base.view,
1996 EINA_LIST_FOREACH(it->icons, l, key)
1998 Evas_Object *ic = it->itc->func.icon_get
1999 ((void *)it->base.data, it->base.widget, l->data);
2003 it->icon_objs = eina_list_append(it->icon_objs, ic);
2004 edje_object_part_swallow(it->base.view, key, ic);
2005 evas_object_show(ic);
2006 elm_widget_sub_object_add(it->base.widget, ic);
2010 if (it->itc->func.state_get)
2016 elm_widget_stringlist_get(edje_object_data_get(it->base.view,
2018 EINA_LIST_FOREACH(it->states, l, key)
2020 Eina_Bool on = it->itc->func.state_get
2021 ((void *)it->base.data, it->base.widget, l->data);
2025 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
2026 edje_object_signal_emit(it->base.view, buf, "elm");
2030 snprintf(buf, sizeof(buf), "elm,state,%s,passive", key);
2031 edje_object_signal_emit(it->base.view, buf, "elm");
2037 _create_sweep_objs(it);
2041 Evas_Coord mw = -1, mh = -1;
2043 if (it->wd->height_for_width) mw = it->wd->w;
2045 if (!it->display_only)
2046 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2047 if (it->wd->height_for_width) mw = it->wd->prev_viewport_w;
2048 edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw,
2050 if (!it->display_only)
2051 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
2052 it->w = it->minw = mw;
2053 it->h = it->minh = mh;
2054 it->mincalcd = EINA_TRUE;
2056 if ((it->wd->homogeneous) && (it->flags & ELM_GENLIST_ITEM_GROUP))
2058 it->wd->group_item_width = mw;
2059 it->wd->group_item_height = mh;
2061 else if ((it->wd->homogeneous))
2062 // if ((!in) && (it->wd->homogeneous))
2064 it->wd->item_width = mw;
2065 it->wd->item_height = mh;
2067 if ((!in) && (it->wd->homogeneous) && (!it->wd->group_item_width))
2069 it->wd->group_item_width = mw;
2070 it->wd->group_item_height = mh;
2073 if (!calc) evas_object_show(it->base.view);
2076 if (it->tooltip.content_cb)
2078 elm_widget_item_tooltip_content_cb_set(it,
2079 it->tooltip.content_cb,
2080 it->tooltip.data, NULL);
2081 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
2084 if (it->mouse_cursor)
2085 elm_widget_item_cursor_set(it, it->mouse_cursor);
2087 it->realized = EINA_TRUE;
2088 it->want_unrealize = EINA_FALSE;
2090 if (itc) _item_cache_free(itc);
2091 evas_object_smart_callback_call(it->base.widget, "realized", it);
2093 if ((it->wd->edit_mode) && (it->flags != ELM_GENLIST_ITEM_GROUP)) _effect_item_realize(it);
2097 _item_unrealize(Elm_Genlist_Item *it)
2101 if (!it->realized) return;
2102 if (it->wd->reorder_it && it->wd->reorder_it == it) return;
2104 evas_object_smart_callback_call(it->base.widget, "unrealized", it);
2107 ecore_timer_del(it->long_timer);
2108 it->long_timer = NULL;
2110 if (it->sweeped || it->wassweeped)
2112 it->sweeped = EINA_FALSE;
2113 it->wassweeped = EINA_FALSE;
2114 it->wd->sweeped_items = eina_list_remove(it->wd->sweeped_items, it);
2115 _delete_sweep_objs(it);
2116 evas_object_del(it->base.view);
2117 it->base.view = NULL;
2118 evas_object_del(it->spacer);
2122 _item_cache_add(it);
2123 elm_widget_stringlist_free(it->labels);
2125 elm_widget_stringlist_free(it->icons);
2127 elm_widget_stringlist_free(it->states);
2129 EINA_LIST_FREE(it->icon_objs, icon)
2130 evas_object_del(icon);
2133 it->realized = EINA_FALSE;
2134 it->want_unrealize = EINA_FALSE;
2136 if (it->wd->edit_mode != ELM_GENLIST_EDIT_MODE_NONE) _effect_item_unrealize(it);
2140 _item_block_recalc(Item_Block *itb,
2146 Elm_Genlist_Item *it;
2147 Evas_Coord minw = 0, minh = 0;
2148 Eina_Bool showme = EINA_FALSE, changed = EINA_FALSE;
2152 EINA_LIST_FOREACH(itb->items, l, it)
2154 if (it->delete_me) continue;
2155 showme |= it->showme;
2160 if (!it->mincalcd) changed = EINA_TRUE;
2163 _item_realize(it, in, 1);
2164 _item_unrealize(it);
2169 _item_realize(it, in, 1);
2170 _item_unrealize(it);
2174 _item_realize(it, in, 0);
2176 if (minw < it->minw) minw = it->minw;
2184 itb->changed = EINA_FALSE;
2185 /* force an evas norender to garbage collect deleted objects */
2186 if (norender) evas_norender(evas_object_evas_get(itb->wd->obj));
2191 _item_block_realize(Item_Block *itb,
2196 Elm_Genlist_Item *it;
2198 if (itb->realized) return;
2199 EINA_LIST_FOREACH(itb->items, l, it)
2201 if (it->delete_me) continue;
2202 if (full) _item_realize(it, in, 0);
2205 itb->realized = EINA_TRUE;
2206 itb->want_unrealize = EINA_FALSE;
2210 _item_block_unrealize(Item_Block *itb)
2213 Elm_Genlist_Item *it;
2214 Eina_Bool dragging = EINA_FALSE;
2216 if (!itb->realized) return;
2217 EINA_LIST_FOREACH(itb->items, l, it)
2219 if (it->flags != ELM_GENLIST_ITEM_GROUP)
2223 dragging = EINA_TRUE;
2224 it->want_unrealize = EINA_TRUE;
2227 _item_unrealize(it);
2232 itb->realized = EINA_FALSE;
2233 itb->want_unrealize = EINA_TRUE;
2236 itb->want_unrealize = EINA_FALSE;
2240 _get_space_for_reorder_item(Elm_Genlist_Item *it)
2242 Evas_Coord rox, roy, row, roh;
2243 Eina_Bool top = EINA_FALSE;
2244 Elm_Genlist_Item *reorder_it = it->wd->reorder_it;
2245 if (!reorder_it) return 0;
2247 Evas_Coord ox,oy,oh,ow;
2248 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
2249 evas_object_geometry_get(it->wd->reorder_it->base.view, &rox, &roy, &row, &roh);
2251 if ((it->wd->reorder_start_y < it->block->y) && (roy - oy + roh/2 >= it->block->y - it->wd->pan_y))
2253 it->block->reorder_offset = it->wd->reorder_it->h * -1;
2254 if (it->block->count == 1)
2255 it->wd->reorder_rel = it;
2257 else if ((it->wd->reorder_start_y >= it->block->y) && (roy - oy + roh/2 <= it->block->y - it->wd->pan_y))
2259 it->block->reorder_offset = it->wd->reorder_it->h;
2262 it->block->reorder_offset = 0;
2264 it->scrl_y += it->block->reorder_offset;
2266 top = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
2267 rox, roy+roh/2, row, 1));
2270 it->wd->reorder_rel = it;
2271 it->scrl_y+=it->wd->reorder_it->h;
2272 return it->wd->reorder_it->h;
2279 _reorder_item_moving_effect_timer_cb(void *data)
2281 Elm_Genlist_Item *it = data;
2282 Eina_Bool down = EINA_FALSE;
2283 double time = 0.4, t;
2285 t = ((0.0 > (t = current_time_get() - it->wd->start_time)) ? 0.0 : t) / 1000;
2288 y = (1 * sin((t / time) * (M_PI / 2)) * dy);
2292 if (it->old_scrl_y < it->scrl_y)
2294 it->old_scrl_y += y;
2297 else if (it->old_scrl_y > it->scrl_y)
2299 it->old_scrl_y -= y;
2303 evas_object_resize(it->base.view, it->w-(it->pad_left+it->pad_right), it->h);
2304 evas_object_move(it->base.view, it->scrl_x+it->pad_left, it->old_scrl_y);
2305 evas_object_show(it->base.view);
2307 _effect_item_controls(it, it->scrl_x, it->old_scrl_y);
2309 if (!it->wd->reorder_it || it->wd->reorder_pan_move)
2311 it->old_scrl_y = it->scrl_y;
2312 it->move_effect_me = EINA_FALSE;
2313 return ECORE_CALLBACK_CANCEL;
2315 if ((down && it->old_scrl_y >= it->scrl_y) || (!down && it->old_scrl_y <= it->scrl_y))
2317 it->old_scrl_y = it->scrl_y;
2318 it->move_effect_me = EINA_FALSE;
2319 return ECORE_CALLBACK_CANCEL;
2321 return ECORE_CALLBACK_RENEW;
2325 _item_block_position(Item_Block *itb,
2329 Elm_Genlist_Item *it;
2330 Elm_Genlist_Item *git;
2331 Evas_Coord y = 0, ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2333 Elm_Genlist_Item *select_all_item = NULL;
2335 evas_object_geometry_get(itb->wd->pan_smart, &ox, &oy, &ow, &oh);
2336 evas_output_viewport_get(evas_object_evas_get(itb->wd->obj), &cvx, &cvy,
2339 if (itb->wd->select_all_item &&
2340 (itb->wd->edit_mode & ELM_GENLIST_EDIT_MODE_SELECT || itb->wd->edit_mode & ELM_GENLIST_EDIT_MODE_SELECTALL))
2342 if (itb->wd->select_all_check)
2343 edje_object_signal_emit(itb->wd->select_all_item->base.view, "elm,state,del_confirm", "elm");
2345 edje_object_signal_emit(itb->wd->select_all_item->base.view, "elm,state,del,animated,enable", "elm");
2347 select_all_item = itb->wd->select_all_item;
2349 evas_object_resize(select_all_item->base.view, itb->w, select_all_item->h);
2350 evas_object_move(select_all_item->base.view, ox, oy);
2351 evas_object_raise(select_all_item->base.view);
2353 y = select_all_item->h;
2356 EINA_LIST_FOREACH(itb->items, l, it)
2358 if (it->delete_me) continue;
2359 else if (it->wd->reorder_it && it->wd->reorder_it == it) continue;
2364 it->scrl_x = itb->x + it->x - it->wd->pan_x + ox;
2365 it->scrl_y = itb->y + it->y - it->wd->pan_y + oy;
2367 if (it->flags != ELM_GENLIST_ITEM_GROUP || (it->wd->reorder_it ))
2368 vis = (ELM_RECTS_INTERSECT(it->scrl_x, it->scrl_y, it->w, it->h,
2369 cvx, cvy, cvw, cvh));
2370 if (it->flags != ELM_GENLIST_ITEM_GROUP || (it->wd->reorder_it ))
2372 if ((itb->realized) && (!it->realized))
2374 if (vis) _item_realize(it, in, 0);
2380 if(it->wd->reorder_mode)
2381 y += _get_space_for_reorder_item(it);
2382 git = it->group_item;
2385 if (git->scrl_y < oy)
2387 if ((git->scrl_y + git->h) > (it->scrl_y + it->h))
2388 git->scrl_y = (it->scrl_y + it->h) - git->h;
2389 git->want_realize = EINA_TRUE;
2390 if(select_all_item) git->scrl_y = select_all_item->h;
2392 if (it->wd->reorder_it && !it->wd->reorder_pan_move && it->old_scrl_y && it->old_scrl_y != it->scrl_y)
2394 if (!it->move_effect_me)
2396 it->move_effect_me = EINA_TRUE;
2397 it->item_moving_effect_timer = ecore_animator_add(_reorder_item_moving_effect_timer_cb, it);
2401 if (!it->move_effect_me )
2402 if (!it->wd->effect_mode || (it->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_NONE) || (it->parent == it->wd->expand_item))
2404 _effect_item_controls(it, it->scrl_x, it->scrl_y);
2405 evas_object_resize(it->base.view, it->w-(it->pad_left+it->pad_right), it->h);
2406 evas_object_move(it->base.view, it->scrl_x+it->pad_left, it->scrl_y);
2407 if(!it->wd->effect_mode || (it->expanded_depth == 0) || (it->parent != it->wd->expand_item) || it->effect_done)
2408 evas_object_show(it->base.view);
2410 evas_object_hide(it->base.view);
2411 it->old_scrl_x = it->scrl_x;
2412 it->old_scrl_y = it->scrl_y;
2417 if (!it->dragging) _item_unrealize(it);
2424 if (vis) it->want_realize = EINA_TRUE;
2432 _group_items_recalc(void *data)
2434 Widget_Data *wd = data;
2436 Elm_Genlist_Item *git;
2438 EINA_LIST_FOREACH(wd->group_items, l, git)
2440 if (git->want_realize)
2443 _item_realize(git, 0, 0);
2444 evas_object_resize(git->base.view, wd->minw, git->h);
2445 evas_object_move(git->base.view, git->scrl_x, git->scrl_y);
2446 evas_object_show(git->base.view);
2447 evas_object_raise(git->base.view);
2449 else if (!git->want_realize && git->realized)
2452 _item_unrealize(git);
2458 _must_recalc_idler(void *data)
2460 Widget_Data *wd = data;
2461 if (wd->calc_job) ecore_job_del(wd->calc_job);
2462 wd->calc_job = ecore_job_add(_calc_job, wd);
2463 wd->must_recalc_idler = NULL;
2464 return ECORE_CALLBACK_CANCEL;
2468 _calc_job(void *data)
2470 Widget_Data *wd = data;
2472 Evas_Coord minw = -1, minh = 0, y = 0, ow;
2473 Item_Block *chb = NULL;
2474 int in = 0, minw_change = 0;
2475 Eina_Bool changed = EINA_FALSE;
2477 Eina_Bool did_must_recalc = EINA_FALSE;
2480 t0 = ecore_time_get();
2481 evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h);
2485 // if (wd->height_for_width) changed = EINA_TRUE;
2488 EINA_INLIST_FOREACH(wd->blocks, itb)
2490 Eina_Bool showme = EINA_FALSE;
2493 showme = itb->showme;
2494 itb->showme = EINA_FALSE;
2497 if (itb->realized) _item_block_unrealize(itb);
2499 if ((itb->changed) || (changed) ||
2500 ((itb->must_recalc) && (!did_must_recalc)))
2502 if ((changed) || (itb->must_recalc))
2505 Elm_Genlist_Item *it;
2506 EINA_LIST_FOREACH(itb->items, l, it)
2507 if (it->mincalcd) it->mincalcd = EINA_FALSE;
2508 itb->changed = EINA_TRUE;
2509 if (itb->must_recalc) did_must_recalc = EINA_TRUE;
2510 itb->must_recalc = EINA_FALSE;
2512 if (itb->realized) _item_block_unrealize(itb);
2513 showme = _item_block_recalc(itb, in, 0, 1);
2519 if (minw == -1) minw = itb->minw;
2520 else if ((!itb->must_recalc) && (minw < itb->minw))
2529 if ((showme) && (wd->show_item))
2531 wd->show_item->showme = EINA_FALSE;
2533 elm_smart_scroller_region_bring_in(wd->scr,
2535 wd->show_item->block->x,
2537 wd->show_item->block->y,
2538 wd->show_item->block->w,
2541 elm_smart_scroller_child_region_show(wd->scr,
2543 wd->show_item->block->x,
2545 wd->show_item->block->y,
2546 wd->show_item->block->w,
2548 wd->show_item = NULL;
2553 EINA_INLIST_FOREACH(wd->blocks, itb)
2559 if ((chb) && (EINA_INLIST_GET(chb)->next))
2561 EINA_INLIST_FOREACH(EINA_INLIST_GET(chb)->next, itb)
2563 if (itb->realized) _item_block_unrealize(itb);
2566 wd->realminw = minw;
2567 if (minw < wd->w) minw = wd->w;
2568 if ((minw != wd->minw) || (minh != wd->minh)|| wd->select_all_item)
2572 if (wd->select_all_item)
2573 wd->minh += wd->select_all_item->h;
2574 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
2575 _sizing_eval(wd->obj);
2576 if ((wd->anchor_item) && (wd->anchor_item->block))
2578 Elm_Genlist_Item *it;
2581 it = wd->anchor_item;
2582 it_y = wd->anchor_y;
2583 elm_smart_scroller_child_pos_set(wd->scr, wd->pan_x,
2584 it->block->y + it->y + it_y);
2585 wd->anchor_item = it;
2586 wd->anchor_y = it_y;
2589 t = ecore_time_get();
2590 if (did_must_recalc)
2592 if (!wd->must_recalc_idler)
2593 wd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, wd);
2595 wd->calc_job = NULL;
2596 evas_object_smart_changed(wd->pan_smart);
2600 _update_job(void *data)
2602 Widget_Data *wd = data;
2605 int num, num0, position = 0, recalc = 0;
2607 wd->update_job = NULL;
2609 EINA_INLIST_FOREACH(wd->blocks, itb)
2611 Evas_Coord itminw, itminh;
2612 Elm_Genlist_Item *it;
2618 _item_block_position(itb, num);
2623 EINA_LIST_FOREACH(itb->items, l2, it)
2630 it->updateme = EINA_FALSE;
2633 _item_unrealize(it);
2634 _item_realize(it, num, 0);
2639 _item_realize(it, num, 1);
2640 _item_unrealize(it);
2642 if ((it->minw != itminw) || (it->minh != itminh))
2647 itb->updateme = EINA_FALSE;
2651 itb->changed = EINA_TRUE;
2652 _item_block_recalc(itb, num0, 0, 1);
2653 _item_block_position(itb, num0);
2658 if (wd->calc_job) ecore_job_del(wd->calc_job);
2659 wd->calc_job = ecore_job_add(_calc_job, wd);
2664 _pan_set(Evas_Object *obj,
2668 Pan *sd = evas_object_smart_data_get(obj);
2671 // Evas_Coord ow, oh;
2672 // evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2673 // ow = sd->wd->minw - ow;
2674 // if (ow < 0) ow = 0;
2675 // oh = sd->wd->minh - oh;
2676 // if (oh < 0) oh = 0;
2677 // if (x < 0) x = 0;
2678 // if (y < 0) y = 0;
2679 // if (x > ow) x = ow;
2680 // if (y > oh) y = oh;
2681 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
2685 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2687 if ((itb->y + itb->h) > y)
2689 Elm_Genlist_Item *it;
2692 EINA_LIST_FOREACH(itb->items, l2, it)
2694 if ((itb->y + it->y) >= y)
2696 sd->wd->anchor_item = it;
2697 sd->wd->anchor_y = -(itb->y + it->y - y);
2704 evas_object_smart_changed(obj);
2708 _pan_get(Evas_Object *obj,
2712 Pan *sd = evas_object_smart_data_get(obj);
2714 if (x) *x = sd->wd->pan_x;
2715 if (y) *y = sd->wd->pan_y;
2719 _pan_max_get(Evas_Object *obj,
2723 Pan *sd = evas_object_smart_data_get(obj);
2726 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2727 ow = sd->wd->minw - ow;
2729 oh = sd->wd->minh - oh;
2736 _pan_min_get(Evas_Object *obj __UNUSED__,
2745 _pan_child_size_get(Evas_Object *obj,
2749 Pan *sd = evas_object_smart_data_get(obj);
2751 if (w) *w = sd->wd->minw;
2752 if (h) *h = sd->wd->minh;
2756 _pan_add(Evas_Object *obj)
2759 Evas_Object_Smart_Clipped_Data *cd;
2762 cd = evas_object_smart_data_get(obj);
2765 sd->__clipped_data = *cd;
2767 evas_object_smart_data_set(obj, sd);
2771 _pan_del(Evas_Object *obj)
2773 Pan *sd = evas_object_smart_data_get(obj);
2778 ecore_job_del(sd->resize_job);
2779 sd->resize_job = NULL;
2785 _pan_resize_job(void *data)
2788 _sizing_eval(sd->wd->obj);
2789 sd->resize_job = NULL;
2793 _pan_resize(Evas_Object *obj,
2797 Pan *sd = evas_object_smart_data_get(obj);
2800 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
2801 if ((ow == w) && (oh == h)) return;
2802 if ((sd->wd->height_for_width) && (ow != w))
2804 if (sd->resize_job) ecore_job_del(sd->resize_job);
2805 sd->resize_job = ecore_job_add(_pan_resize_job, sd);
2807 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2808 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2812 _pan_calculate(Evas_Object *obj)
2814 Pan *sd = evas_object_smart_data_get(obj);
2816 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
2817 static Evas_Coord old_pan_y = 0;
2819 Elm_Genlist_Item *git;
2822 evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
2823 evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh);
2824 EINA_LIST_FOREACH(sd->wd->group_items, l, git)
2826 git->want_realize = EINA_FALSE;
2828 EINA_INLIST_FOREACH(sd->wd->blocks, itb)
2830 itb->w = sd->wd->minw;
2831 if (ELM_RECTS_INTERSECT(itb->x - sd->wd->pan_x + ox,
2832 itb->y - sd->wd->pan_y + oy,
2834 cvx, cvy, cvw, cvh))
2836 if ((!itb->realized) || (itb->changed))
2837 _item_block_realize(itb, in, 0);
2838 _item_block_position(itb, in);
2842 if (itb->realized) _item_block_unrealize(itb);
2846 if (!sd->wd->reorder_it || sd->wd->reorder_pan_move)
2847 _group_items_recalc(sd->wd);
2849 if (sd->wd->reorder_mode && sd->wd->reorder_it)
2851 if (sd->wd->pan_y != old_pan_y) sd->wd->reorder_pan_move = EINA_TRUE;
2852 else sd->wd->reorder_pan_move = EINA_FALSE;
2853 evas_object_raise(sd->wd->reorder_it->base.view);
2854 old_pan_y = sd->wd->pan_y;
2857 if (sd->wd->effect_mode &&
2858 (sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND || sd->wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT))
2860 _item_flip_effect_show(sd->wd->expand_item);
2861 evas_object_raise(sd->wd->alpha_bg);
2862 evas_object_show(sd->wd->alpha_bg);
2863 sd->wd->start_time = current_time_get();
2864 sd->wd->item_moving_effect_timer = ecore_animator_add(_item_moving_effect_timer_cb, sd->wd);
2866 if (sd->wd->select_all_item) evas_object_raise(sd->wd->select_all_item->base.view);
2870 _pan_move(Evas_Object *obj,
2871 Evas_Coord x __UNUSED__,
2872 Evas_Coord y __UNUSED__)
2874 Pan *sd = evas_object_smart_data_get(obj);
2876 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
2877 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
2881 _hold_on(void *data __UNUSED__,
2883 void *event_info __UNUSED__)
2885 Widget_Data *wd = elm_widget_data_get(obj);
2887 elm_smart_scroller_hold_set(wd->scr, 1);
2891 _hold_off(void *data __UNUSED__,
2893 void *event_info __UNUSED__)
2895 Widget_Data *wd = elm_widget_data_get(obj);
2897 elm_smart_scroller_hold_set(wd->scr, 0);
2901 _freeze_on(void *data __UNUSED__,
2903 void *event_info __UNUSED__)
2905 Widget_Data *wd = elm_widget_data_get(obj);
2907 elm_smart_scroller_freeze_set(wd->scr, 1);
2911 _freeze_off(void *data __UNUSED__,
2913 void *event_info __UNUSED__)
2915 Widget_Data *wd = elm_widget_data_get(obj);
2917 elm_smart_scroller_freeze_set(wd->scr, 0);
2921 _scroll_edge_left(void *data,
2922 Evas_Object *scr __UNUSED__,
2923 void *event_info __UNUSED__)
2925 Evas_Object *obj = data;
2926 evas_object_smart_callback_call(obj, "scroll,edge,left", NULL);
2930 _scroll_edge_right(void *data,
2931 Evas_Object *scr __UNUSED__,
2932 void *event_info __UNUSED__)
2934 Evas_Object *obj = data;
2935 evas_object_smart_callback_call(obj, "scroll,edge,right", NULL);
2939 _scroll_edge_top(void *data,
2940 Evas_Object *scr __UNUSED__,
2941 void *event_info __UNUSED__)
2943 Evas_Object *obj = data;
2944 evas_object_smart_callback_call(obj, "scroll,edge,top", NULL);
2948 _scroll_edge_bottom(void *data,
2949 Evas_Object *scr __UNUSED__,
2950 void *event_info __UNUSED__)
2952 Evas_Object *obj = data;
2953 evas_object_smart_callback_call(obj, "scroll,edge,bottom", NULL);
2957 * Add a new Genlist object
2959 * @param parent The parent object
2960 * @return The new object or NULL if it cannot be created
2965 elm_genlist_add(Evas_Object *parent)
2970 Evas_Coord minw, minh;
2971 static Evas_Smart *smart = NULL;
2973 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
2977 static Evas_Smart_Class sc;
2979 evas_object_smart_clipped_smart_set(&_pan_sc);
2981 sc.name = "elm_genlist_pan";
2982 sc.version = EVAS_SMART_CLASS_VERSION;
2985 sc.resize = _pan_resize;
2986 sc.move = _pan_move;
2987 sc.calculate = _pan_calculate;
2988 if (!(smart = evas_smart_class_new(&sc))) return NULL;
2990 wd = ELM_NEW(Widget_Data);
2991 e = evas_object_evas_get(parent);
2992 if (!e) return NULL;
2993 obj = elm_widget_add(e);
2994 ELM_SET_WIDTYPE(widtype, "genlist");
2995 elm_widget_type_set(obj, "genlist");
2996 elm_widget_sub_object_add(parent, obj);
2997 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
2998 elm_widget_data_set(obj, wd);
2999 elm_widget_del_hook_set(obj, _del_hook);
3000 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
3001 elm_widget_theme_hook_set(obj, _theme_hook);
3002 elm_widget_can_focus_set(obj, EINA_TRUE);
3003 elm_widget_event_hook_set(obj, _event_hook);
3005 wd->scr = elm_smart_scroller_add(e);
3006 elm_smart_scroller_widget_set(wd->scr, obj);
3007 elm_smart_scroller_object_theme_set(obj, wd->scr, "genlist", "base",
3008 elm_widget_style_get(obj));
3009 elm_smart_scroller_bounce_allow_set(wd->scr, EINA_FALSE,
3010 _elm_config->thumbscroll_bounce_enable);
3011 elm_widget_resize_object_set(obj, wd->scr);
3013 evas_object_smart_callback_add(wd->scr, "edge,left", _scroll_edge_left, obj);
3014 evas_object_smart_callback_add(wd->scr, "edge,right", _scroll_edge_right,
3016 evas_object_smart_callback_add(wd->scr, "edge,top", _scroll_edge_top, obj);
3017 evas_object_smart_callback_add(wd->scr, "edge,bottom", _scroll_edge_bottom,
3021 wd->mode = ELM_LIST_SCROLL;
3022 wd->max_items_per_block = MAX_ITEMS_PER_BLOCK;
3023 wd->item_cache_max = wd->max_items_per_block * 2;
3024 wd->longpress_timeout = _elm_config->longpress_timeout;
3025 //wd->effect_mode = _elm_config->effect_enable;
3026 //wd->effect_mode = EINA_TRUE;
3028 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
3029 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
3030 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
3031 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
3033 wd->pan_smart = evas_object_smart_add(e, smart);
3034 wd->pan = evas_object_smart_data_get(wd->pan_smart);
3037 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
3038 _pan_set, _pan_get, _pan_max_get,
3039 _pan_min_get, _pan_child_size_get);
3041 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
3043 evas_object_size_hint_min_set(obj, minw, minh);
3049 static Elm_Genlist_Item *
3050 _item_new(Widget_Data *wd,
3051 const Elm_Genlist_Item_Class *itc,
3053 Elm_Genlist_Item *parent,
3054 Elm_Genlist_Item_Flags flags,
3056 const void *func_data)
3058 Elm_Genlist_Item *it;
3060 it = elm_widget_item_new(wd->obj, Elm_Genlist_Item);
3061 if (!it) return NULL;
3064 it->base.data = data;
3065 it->parent = parent;
3067 it->func.func = func;
3068 it->func.data = func_data;
3069 it->mouse_cursor = NULL;
3070 it->expanded_depth = 0;
3071 if (it->parent && it->parent->edit_select_check) it->edit_select_check = EINA_TRUE;
3077 _item_block_add(Widget_Data *wd,
3078 Elm_Genlist_Item *it)
3080 Item_Block *itb = NULL;
3087 itb = calloc(1, sizeof(Item_Block));
3090 if (!it->rel->block)
3093 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3094 itb->items = eina_list_append(itb->items, it);
3100 wd->blocks = eina_inlist_prepend_relative
3101 (wd->blocks, EINA_INLIST_GET(itb),
3102 EINA_INLIST_GET(it->rel->block));
3104 eina_list_prepend_relative(itb->items, it, it->rel);
3108 wd->blocks = eina_inlist_append_relative
3109 (wd->blocks, EINA_INLIST_GET(itb),
3110 EINA_INLIST_GET(it->rel->block));
3112 eina_list_append_relative(itb->items, it, it->rel);
3122 itb = (Item_Block *)(wd->blocks);
3123 if (itb->count >= wd->max_items_per_block)
3125 itb = calloc(1, sizeof(Item_Block));
3129 eina_inlist_prepend(wd->blocks,
3130 EINA_INLIST_GET(itb));
3135 itb = calloc(1, sizeof(Item_Block));
3139 eina_inlist_prepend(wd->blocks, EINA_INLIST_GET(itb));
3141 itb->items = eina_list_prepend(itb->items, it);
3147 itb = (Item_Block *)(wd->blocks->last);
3148 if (itb->count >= wd->max_items_per_block)
3150 itb = calloc(1, sizeof(Item_Block));
3154 eina_inlist_append(wd->blocks,
3155 EINA_INLIST_GET(itb));
3160 itb = calloc(1, sizeof(Item_Block));
3164 eina_inlist_append(wd->blocks, EINA_INLIST_GET(itb));
3166 itb->items = eina_list_append(itb->items, it);
3172 itb = it->rel->block;
3173 if (!itb) goto newblock;
3175 itb->items = eina_list_prepend_relative(itb->items, it, it->rel);
3177 itb->items = eina_list_append_relative(itb->items, it, it->rel);
3180 itb->changed = EINA_TRUE;
3182 if (itb->wd->calc_job) ecore_job_del(itb->wd->calc_job);
3183 itb->wd->calc_job = ecore_job_add(_calc_job, itb->wd);
3186 it->rel->relcount--;
3187 if ((it->rel->delete_me) && (!it->rel->relcount))
3191 if (itb->count > itb->wd->max_items_per_block)
3195 Elm_Genlist_Item *it2;
3197 newc = itb->count / 2;
3198 itb2 = calloc(1, sizeof(Item_Block));
3202 eina_inlist_append_relative(wd->blocks, EINA_INLIST_GET(itb2),
3203 EINA_INLIST_GET(itb));
3204 itb2->changed = EINA_TRUE;
3205 while ((itb->count > newc) && (itb->items))
3209 l = eina_list_last(itb->items);
3211 itb->items = eina_list_remove_list(itb->items, l);
3214 itb2->items = eina_list_prepend(itb2->items, it2);
3222 _queue_proecess(Widget_Data *wd,
3226 Eina_Bool showme = EINA_FALSE;
3229 t0 = ecore_time_get();
3230 for (n = 0; (wd->queue) && (n < 128); n++)
3232 Elm_Genlist_Item *it;
3234 it = wd->queue->data;
3235 wd->queue = eina_list_remove_list(wd->queue, wd->queue);
3236 it->queued = EINA_FALSE;
3237 it->num = ++wd->total_num; // todo : remov
3238 _item_block_add(wd, it);
3239 t = ecore_time_get();
3240 if (it->block->changed)
3242 showme = _item_block_recalc(it->block, it->block->num, 1,
3244 it->block->changed = 0;
3246 if (showme) it->block->showme = EINA_TRUE;
3247 if (eina_inlist_count(wd->blocks) > 1)
3249 if ((t - t0) > (ecore_animator_frametime_get())) break;
3256 _item_idler(void *data)
3258 Widget_Data *wd = data;
3261 //static double q_start = 0.0;
3262 //if (q_start == 0.0) q_start = ecore_time_get();
3265 if (_queue_proecess(wd, 1) > 0)
3267 if (wd->calc_job) ecore_job_del(wd->calc_job);
3268 wd->calc_job = ecore_job_add(_calc_job, wd);
3273 //printf("PROCESS TIME: %3.3f\n", ecore_time_get() - q_start);
3275 wd->queue_idler = NULL;
3276 return ECORE_CALLBACK_CANCEL;
3278 return ECORE_CALLBACK_RENEW;
3282 _item_queue(Widget_Data *wd,
3283 Elm_Genlist_Item *it)
3285 if (it->queued) return;
3286 it->queued = EINA_TRUE;
3287 wd->queue = eina_list_append(wd->queue, it);
3288 while ((wd->queue) && ((!wd->blocks) || (!wd->blocks->next)))
3290 if (wd->queue_idler)
3292 ecore_idler_del(wd->queue_idler);
3293 wd->queue_idler = NULL;
3295 _queue_proecess(wd, 0);
3297 if (!wd->queue_idler) wd->queue_idler = ecore_idler_add(_item_idler, wd);
3301 * Append item to the end of the genlist
3303 * This appends the given item to the end of the list or the end of
3304 * the children if the parent is given.
3306 * @param obj The genlist object
3307 * @param itc The item class for the item
3308 * @param data The item data
3309 * @param parent The parent item, or NULL if none
3310 * @param flags Item flags
3311 * @param func Convenience function called when item selected
3312 * @param func_data Data passed to @p func above.
3313 * @return A handle to the item added or NULL if not possible
3317 EAPI Elm_Genlist_Item *
3318 elm_genlist_item_append(Evas_Object *obj,
3319 const Elm_Genlist_Item_Class *itc,
3321 Elm_Genlist_Item *parent,
3322 Elm_Genlist_Item_Flags flags,
3324 const void *func_data)
3326 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3327 Widget_Data *wd = elm_widget_data_get(obj);
3328 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3330 if (!wd) return NULL;
3331 if (!it) return NULL;
3334 if (flags & ELM_GENLIST_ITEM_GROUP)
3335 wd->group_items = eina_list_append(wd->group_items, it);
3336 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
3341 Elm_Genlist_Item *it2 = NULL;
3342 Eina_List *ll = eina_list_last(it->parent->items);
3343 if (ll) it2 = ll->data;
3344 it->parent->items = eina_list_append(it->parent->items, it);
3345 if (!it2) it2 = it->parent;
3347 eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3348 EINA_INLIST_GET(it2));
3350 it->rel->relcount++;
3352 if (it->parent->flags & ELM_GENLIST_ITEM_GROUP)
3353 it->group_item = parent;
3354 else if (it->parent->group_item)
3355 it->group_item = it->parent->group_item;
3357 it->before = EINA_FALSE;
3358 _item_queue(wd, it);
3363 * Prepend item at start of the genlist
3365 * This adds an item to the beginning of the list or beginning of the
3366 * children of the parent if given.
3368 * @param obj The genlist object
3369 * @param itc The item class for the item
3370 * @param data The item data
3371 * @param parent The parent item, or NULL if none
3372 * @param flags Item flags
3373 * @param func Convenience function called when item selected
3374 * @param func_data Data passed to @p func above.
3375 * @return A handle to the item added or NULL if not possible
3379 EAPI Elm_Genlist_Item *
3380 elm_genlist_item_prepend(Evas_Object *obj,
3381 const Elm_Genlist_Item_Class *itc,
3383 Elm_Genlist_Item *parent,
3384 Elm_Genlist_Item_Flags flags,
3386 const void *func_data)
3388 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3389 Widget_Data *wd = elm_widget_data_get(obj);
3390 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3392 if (!wd) return NULL;
3393 if (!it) return NULL;
3396 if (flags & ELM_GENLIST_ITEM_GROUP)
3397 wd->group_items = eina_list_prepend(wd->group_items, it);
3398 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
3403 Elm_Genlist_Item *it2 = NULL;
3404 Eina_List *ll = it->parent->items;
3405 if (ll) it2 = ll->data;
3406 it->parent->items = eina_list_prepend(it->parent->items, it);
3407 if (!it2) it2 = it->parent;
3409 eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3410 EINA_INLIST_GET(it2));
3412 it->rel->relcount++;
3414 it->before = EINA_TRUE;
3415 _item_queue(wd, it);
3420 * Insert item before another in the genlist
3422 * This inserts an item before another in the list. It will be in the
3423 * same tree level or group as the item it is inseted before.
3425 * @param obj The genlist object
3426 * @param itc The item class for the item
3427 * @param data The item data
3428 * @param before The item to insert before
3429 * @param flags Item flags
3430 * @param func Convenience function called when item selected
3431 * @param func_data Data passed to @p func above.
3432 * @return A handle to the item added or NULL if not possible
3436 EAPI Elm_Genlist_Item *
3437 elm_genlist_item_insert_before(Evas_Object *obj,
3438 const Elm_Genlist_Item_Class *itc,
3440 Elm_Genlist_Item *parent,
3441 Elm_Genlist_Item *before,
3442 Elm_Genlist_Item_Flags flags,
3444 const void *func_data)
3446 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3447 EINA_SAFETY_ON_NULL_RETURN_VAL(before, NULL);
3448 Widget_Data *wd = elm_widget_data_get(obj);
3449 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3451 if (!wd) return NULL;
3452 if (!it) return NULL;
3455 it->parent->items = eina_list_prepend_relative(it->parent->items, it,
3458 wd->items = eina_inlist_prepend_relative(wd->items, EINA_INLIST_GET(it),
3459 EINA_INLIST_GET(before));
3461 it->rel->relcount++;
3462 it->before = EINA_TRUE;
3463 _item_queue(wd, it);
3468 * Insert an item after another in the genlst
3470 * This inserts an item after another in the list. It will be in the
3471 * same tree level or group as the item it is inseted after.
3473 * @param obj The genlist object
3474 * @param itc The item class for the item
3475 * @param data The item data
3476 * @param after The item to insert after
3477 * @param flags Item flags
3478 * @param func Convenience function called when item selected
3479 * @param func_data Data passed to @p func above.
3480 * @return A handle to the item added or NULL if not possible
3484 EAPI Elm_Genlist_Item *
3485 elm_genlist_item_insert_after(Evas_Object *obj,
3486 const Elm_Genlist_Item_Class *itc,
3488 Elm_Genlist_Item *parent,
3489 Elm_Genlist_Item *after,
3490 Elm_Genlist_Item_Flags flags,
3492 const void *func_data)
3494 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3495 EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
3496 Widget_Data *wd = elm_widget_data_get(obj);
3497 Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
3499 if (!wd) return NULL;
3500 if (!it) return NULL;
3501 wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
3502 EINA_INLIST_GET(after));
3505 it->parent->items = eina_list_append_relative(it->parent->items, it,
3509 it->rel->relcount++;
3510 it->before = EINA_FALSE;
3511 _item_queue(wd, it);
3518 * This clears all items in the list, leaving it empty.
3520 * @param obj The genlist object
3525 elm_genlist_clear(Evas_Object *obj)
3527 ELM_CHECK_WIDTYPE(obj, widtype);
3528 Widget_Data *wd = elm_widget_data_get(obj);
3530 if (wd->walking > 0)
3532 Elm_Genlist_Item *it;
3534 wd->clear_me = EINA_TRUE;
3535 EINA_INLIST_FOREACH(wd->items, it)
3537 it->delete_me = EINA_TRUE;
3541 wd->clear_me = EINA_FALSE;
3544 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
3546 if (wd->anchor_item == it)
3548 wd->anchor_item = (Elm_Genlist_Item *)(EINA_INLIST_GET(it)->next);
3549 if (!wd->anchor_item)
3551 (Elm_Genlist_Item *)(EINA_INLIST_GET(it)->prev);
3553 wd->items = eina_inlist_remove(wd->items, wd->items);
3554 if (it->flags & ELM_GENLIST_ITEM_GROUP)
3555 it->wd->group_items = eina_list_remove(it->wd->group_items, it);
3556 elm_widget_item_pre_notify_del(it);
3557 if (it->realized) _item_unrealize(it);
3558 if (it->itc->func.del)
3559 it->itc->func.del((void *)it->base.data, it->base.widget);
3560 if (it->long_timer) ecore_timer_del(it->long_timer);
3561 if (it->swipe_timer) ecore_timer_del(it->swipe_timer);
3562 elm_widget_item_del(it);
3564 wd->anchor_item = NULL;
3567 Item_Block *itb = (Item_Block *)(wd->blocks);
3569 wd->blocks = eina_inlist_remove(wd->blocks, wd->blocks);
3570 if (itb->items) eina_list_free(itb->items);
3575 ecore_job_del(wd->calc_job);
3576 wd->calc_job = NULL;
3578 if (wd->queue_idler)
3580 ecore_idler_del(wd->queue_idler);
3581 wd->queue_idler = NULL;
3583 if (wd->must_recalc_idler)
3585 ecore_idler_del(wd->must_recalc_idler);
3586 wd->must_recalc_idler = NULL;
3590 eina_list_free(wd->queue);
3595 eina_list_free(wd->selected);
3596 wd->selected = NULL;
3598 wd->show_item = NULL;
3605 evas_object_del(wd->alpha_bg);
3606 wd->alpha_bg = NULL;
3610 evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
3611 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
3617 * Enable or disable multi-select in the genlist
3619 * This enables (EINA_TRUE) or disableds (EINA_FALSE) multi-select in
3620 * the list. This allows more than 1 item to be selected.
3622 * @param obj The genlist object
3623 * @param multi Multi-select enable/disable
3628 elm_genlist_multi_select_set(Evas_Object *obj,
3631 ELM_CHECK_WIDTYPE(obj, widtype);
3632 Widget_Data *wd = elm_widget_data_get(obj);
3638 * Gets if multi-select in genlist is enable or disable
3640 * @param obj The genlist object
3641 * @return Multi-select enable/disable
3642 * (EINA_TRUE = enabled/EINA_FALSE = disabled)
3647 elm_genlist_multi_select_get(const Evas_Object *obj)
3649 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3650 Widget_Data *wd = elm_widget_data_get(obj);
3651 if (!wd) return EINA_FALSE;
3656 * Get the selectd item in the genlist
3658 * This gets the selected item in the list (if multi-select is enabled
3659 * only the first item in the list is selected - which is not very
3660 * useful, so see elm_genlist_selected_items_get() for when
3661 * multi-select is used).
3663 * If no item is selected, NULL is returned.
3665 * @param obj The genlist object
3666 * @return The selected item, or NULL if none.
3670 EAPI Elm_Genlist_Item *
3671 elm_genlist_selected_item_get(const Evas_Object *obj)
3673 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3674 Widget_Data *wd = elm_widget_data_get(obj);
3675 if (!wd) return NULL;
3676 if (wd->selected) return wd->selected->data;
3681 * Get a list of selected items in the genlist
3683 * This returns a list of the selected items. This list pointer is
3684 * only valid so long as no items are selected or unselected (or
3685 * unselected implicitly by deletion). The list contains
3686 * Elm_Genlist_Item pointers.
3688 * @param obj The genlist object
3689 * @return The list of selected items, nor NULL if none are selected.
3693 EAPI const Eina_List *
3694 elm_genlist_selected_items_get(const Evas_Object *obj)
3696 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3697 Widget_Data *wd = elm_widget_data_get(obj);
3698 if (!wd) return NULL;
3699 return wd->selected;
3703 * Get a list of realized items in genlist
3705 * This returns a list of the realized items in the genlist. The list
3706 * contains Elm_Genlist_Item pointers. The list must be freed by the
3707 * caller when done with eina_list_free(). The item pointers in the
3708 * list are only valid so long as those items are not deleted or the
3709 * genlist is not deleted.
3711 * @param obj The genlist object
3712 * @return The list of realized items, nor NULL if none are realized.
3717 elm_genlist_realized_items_get(const Evas_Object *obj)
3719 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3720 Widget_Data *wd = elm_widget_data_get(obj);
3721 Eina_List *list = NULL;
3723 Eina_Bool done = EINA_FALSE;
3724 if (!wd) return NULL;
3725 EINA_INLIST_FOREACH(wd->blocks, itb)
3730 Elm_Genlist_Item *it;
3733 EINA_LIST_FOREACH(itb->items, l, it)
3735 if (it->realized) list = eina_list_append(list, it);
3747 * Get the item that is at the x, y canvas coords
3749 * This returns the item at the given coordinates (which are canvas
3750 * relative not object-relative). If an item is at that coordinate,
3751 * that item handle is returned, and if @p posret is not NULL, the
3752 * integer pointed to is set to a value of -1, 0 or 1, depending if
3753 * the coordinate is on the upper portion of that item (-1), on the
3754 * middle section (0) or on the lower part (1). If NULL is returned as
3755 * an item (no item found there), then posret may indicate -1 or 1
3756 * based if the coordinate is above or below all items respectively in
3759 * @param it The item
3760 * @param x The input x coordinate
3761 * @param y The input y coordinate
3762 * @param posret The position relative to the item returned here
3763 * @return The item at the coordinates or NULL if none
3767 EAPI Elm_Genlist_Item *
3768 elm_genlist_at_xy_item_get(const Evas_Object *obj,
3773 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3774 Widget_Data *wd = elm_widget_data_get(obj);
3775 Evas_Coord ox, oy, ow, oh;
3778 if (!wd) return NULL;
3779 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
3781 EINA_INLIST_FOREACH(wd->blocks, itb)
3784 Elm_Genlist_Item *it;
3786 if (!ELM_RECTS_INTERSECT(ox + itb->x - itb->wd->pan_x,
3787 oy + itb->y - itb->wd->pan_y,
3788 itb->w, itb->h, x, y, 1, 1))
3790 EINA_LIST_FOREACH(itb->items, l, it)
3792 Evas_Coord itx, ity;
3794 itx = ox + itb->x + it->x - itb->wd->pan_x;
3795 ity = oy + itb->y + it->y - itb->wd->pan_y;
3796 if (ELM_RECTS_INTERSECT(itx, ity, it->w, it->h, x, y, 1, 1))
3800 if (y <= (ity + (it->h / 4))) *posret = -1;
3801 else if (y >= (ity + it->h - (it->h / 4)))
3807 lasty = ity + it->h;
3812 if (y > lasty) *posret = 1;
3819 * Get the first item in the genlist
3821 * This returns the first item in the list.
3823 * @param obj The genlist object
3824 * @return The first item, or NULL if none
3828 EAPI Elm_Genlist_Item *
3829 elm_genlist_first_item_get(const Evas_Object *obj)
3831 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3832 Widget_Data *wd = elm_widget_data_get(obj);
3833 if (!wd) return NULL;
3834 if (!wd->items) return NULL;
3835 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items);
3836 while ((it) && (it->delete_me))
3837 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3842 * Get the last item in the genlist
3844 * This returns the last item in the list.
3846 * @return The last item, or NULL if none
3850 EAPI Elm_Genlist_Item *
3851 elm_genlist_last_item_get(const Evas_Object *obj)
3853 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3854 Widget_Data *wd = elm_widget_data_get(obj);
3855 if (!wd) return NULL;
3856 if (!wd->items) return NULL;
3857 Elm_Genlist_Item *it = ELM_GENLIST_ITEM_FROM_INLIST(wd->items->last);
3858 while ((it) && (it->delete_me))
3859 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3864 * Get the next item in the genlist
3866 * This returns the item after the item @p it.
3868 * @param it The item
3869 * @return The item after @p it, or NULL if none
3873 EAPI Elm_Genlist_Item *
3874 elm_genlist_item_next_get(const Elm_Genlist_Item *it)
3876 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3879 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
3880 if ((it) && (!it->delete_me)) break;
3882 return (Elm_Genlist_Item *)it;
3886 * Get the previous item in the genlist
3888 * This returns the item before the item @p it.
3890 * @param it The item
3891 * @return The item before @p it, or NULL if none
3895 EAPI Elm_Genlist_Item *
3896 elm_genlist_item_prev_get(const Elm_Genlist_Item *it)
3898 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3901 it = ELM_GENLIST_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
3902 if ((it) && (!it->delete_me)) break;
3904 return (Elm_Genlist_Item *)it;
3908 * Get the genlist object from an item
3910 * This returns the genlist object itself that an item belongs to.
3912 * @param it The item
3913 * @return The genlist object
3918 elm_genlist_item_genlist_get(const Elm_Genlist_Item *it)
3920 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3921 return it->base.widget;
3925 * Get the parent item of the given item
3927 * This returns the parent item of the item @p it given.
3929 * @param it The item
3930 * @return The parent of the item or NULL if none
3934 EAPI Elm_Genlist_Item *
3935 elm_genlist_item_parent_get(const Elm_Genlist_Item *it)
3937 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
3942 * Clear all sub-items (children) of the given item
3944 * This clears all items that are children (or their descendants) of the
3947 * @param it The item
3952 elm_genlist_item_subitems_clear(Elm_Genlist_Item *it)
3954 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
3955 Elm_Genlist_Item *it2;
3958 if(!it->wd->effect_mode)
3959 _item_subitems_clear(it);
3962 if(!it->wd->item_moving_effect_timer)
3964 it->wd->expand_item = it;
3965 _item_flip_effect_show(it);
3966 evas_object_geometry_get(it->base.view, NULL, &y, NULL, &h);
3967 it->wd->expand_item_end = y + h;
3971 it2 = elm_genlist_item_next_get(it2);
3973 } while (it2->expanded_depth > it->expanded_depth);
3975 it->wd->expand_item_gap = it->wd->expand_item_end - it2->old_scrl_y;
3977 it->wd->expand_item_gap = 0;
3979 evas_object_raise(it->wd->alpha_bg);
3980 evas_object_show(it->wd->alpha_bg);
3982 it->wd->start_time = current_time_get();
3983 it->wd->item_moving_effect_timer = ecore_animator_add(_item_moving_effect_timer_cb, it->wd);
3986 _item_subitems_clear(it);
3991 * Set the selected state of an item
3993 * This sets the selected state (1 selected, 0 not selected) of the given
3996 * @param it The item
3997 * @param selected The selected state
4002 elm_genlist_item_selected_set(Elm_Genlist_Item *it,
4005 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4006 Widget_Data *wd = elm_widget_data_get(it->base.widget);
4008 if (it->delete_me) return;
4009 selected = !!selected;
4010 if (it->selected == selected) return;
4016 while (wd->selected)
4017 _item_unselect(wd->selected->data);
4027 * Get the selected state of an item
4029 * This gets the selected state of an item (1 selected, 0 not selected).
4031 * @param it The item
4032 * @return The selected state
4037 elm_genlist_item_selected_get(const Elm_Genlist_Item *it)
4039 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4040 return it->selected;
4044 * Sets the expanded state of an item (if it's a parent)
4046 * This expands or contracts a parent item (thus showing or hiding the
4049 * @param it The item
4050 * @param expanded The expanded state (1 expanded, 0 not expanded).
4055 elm_genlist_item_expanded_set(Elm_Genlist_Item *it,
4058 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4059 if (it->expanded == expanded) return;
4060 it->expanded = expanded;
4061 it->wd->expand_item = it;
4063 if(it->wd->effect_mode && !it->wd->alpha_bg)
4064 it->wd->alpha_bg = _create_tray_alpha_bg(it->base.widget);
4068 it->wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND;
4070 edje_object_signal_emit(it->base.view, "elm,state,expanded", "elm");
4071 evas_object_smart_callback_call(it->base.widget, "expanded", it);
4075 it->wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT;
4077 edje_object_signal_emit(it->base.view, "elm,state,contracted", "elm");
4078 evas_object_smart_callback_call(it->base.widget, "contracted", it);
4083 * Get the expanded state of an item
4085 * This gets the expanded state of an item
4087 * @param it The item
4088 * @return Thre expanded state
4093 elm_genlist_item_expanded_get(const Elm_Genlist_Item *it)
4095 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4096 return it->expanded;
4100 * Get the depth of expanded item
4102 * @param it The genlist item object
4103 * @return The depth of expanded item
4108 elm_genlist_item_expanded_depth_get(const Elm_Genlist_Item *it)
4110 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, 0);
4111 return it->expanded_depth;
4115 * Sets the disabled state of an item.
4117 * A disabled item cannot be selected or unselected. It will also
4118 * change appearance to appear disabled. This sets the disabled state
4119 * (1 disabled, 0 not disabled).
4121 * @param it The item
4122 * @param disabled The disabled state
4127 elm_genlist_item_disabled_set(Elm_Genlist_Item *it,
4130 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4131 if (it->disabled == disabled) return;
4132 if (it->delete_me) return;
4133 it->disabled = disabled;
4137 edje_object_signal_emit(it->base.view, "elm,state,disabled", "elm");
4139 edje_object_signal_emit(it->base.view, "elm,state,enabled", "elm");
4144 * Get the disabled state of an item
4146 * This gets the disabled state of the given item.
4148 * @param it The item
4149 * @return The disabled state
4154 elm_genlist_item_disabled_get(const Elm_Genlist_Item *it)
4156 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4157 if (it->delete_me) return EINA_FALSE;
4158 return it->disabled;
4162 * Sets the display only state of an item.
4164 * A display only item cannot be selected or unselected. It is for
4165 * display only and not selecting or otherwise clicking, dragging
4166 * etc. by the user, thus finger size rules will not be applied to
4169 * @param it The item
4170 * @param display_only The display only state
4175 elm_genlist_item_display_only_set(Elm_Genlist_Item *it,
4176 Eina_Bool display_only)
4178 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4179 if (!it->block) return;
4180 if (it->display_only == display_only) return;
4181 if (it->delete_me) return;
4182 it->display_only = display_only;
4183 it->mincalcd = EINA_FALSE;
4184 it->updateme = EINA_TRUE;
4185 it->block->updateme = EINA_TRUE;
4186 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4187 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4191 * Get the display only state of an item
4193 * This gets the display only state of the given item.
4195 * @param it The item
4196 * @return The display only state
4201 elm_genlist_item_display_only_get(const Elm_Genlist_Item *it)
4203 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
4204 if (it->delete_me) return EINA_FALSE;
4205 return it->display_only;
4209 * Show the given item
4211 * This causes genlist to jump to the given item @p it and show it (by
4212 * scrolling), if it is not fully visible.
4214 * @param it The item
4219 elm_genlist_item_show(Elm_Genlist_Item *it)
4221 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4222 Evas_Coord gith = 0;
4223 if (it->delete_me) return;
4224 if ((it->queued) || (!it->mincalcd))
4226 it->wd->show_item = it;
4227 it->wd->bring_in = EINA_TRUE;
4228 it->showme = EINA_TRUE;
4231 if (it->wd->show_item)
4233 it->wd->show_item->showme = EINA_FALSE;
4234 it->wd->show_item = NULL;
4236 if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
4237 gith = it->group_item->h;
4238 elm_smart_scroller_child_region_show(it->wd->scr,
4239 it->x + it->block->x,
4240 it->y + it->block->y - gith,
4241 it->block->w, it->h);
4245 * Bring in the given item
4247 * This causes genlist to jump to the given item @p it and show it (by
4248 * scrolling), if it is not fully visible. This may use animation to
4249 * do so and take a period of time
4251 * @param it The item
4256 elm_genlist_item_bring_in(Elm_Genlist_Item *it)
4258 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4259 Evas_Coord gith = 0;
4260 if (it->delete_me) return;
4261 if ((it->queued) || (!it->mincalcd))
4263 it->wd->show_item = it;
4264 it->wd->bring_in = EINA_TRUE;
4265 it->showme = EINA_TRUE;
4268 if (it->wd->show_item)
4270 it->wd->show_item->showme = EINA_FALSE;
4271 it->wd->show_item = NULL;
4273 if ((it->group_item) && (it->wd->pan_y > (it->y + it->block->y)))
4274 gith = it->group_item->h;
4275 elm_smart_scroller_region_bring_in(it->wd->scr,
4276 it->x + it->block->x,
4277 it->y + it->block->y - gith,
4278 it->block->w, it->h);
4282 * Show the given item at the top
4284 * This causes genlist to jump to the given item @p it and show it (by
4285 * scrolling), if it is not fully visible.
4287 * @param it The item
4292 elm_genlist_item_top_show(Elm_Genlist_Item *it)
4294 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4296 Evas_Coord gith = 0;
4298 if (it->delete_me) return;
4299 if ((it->queued) || (!it->mincalcd))
4301 it->wd->show_item = it;
4302 it->wd->bring_in = EINA_TRUE;
4303 it->showme = EINA_TRUE;
4306 if (it->wd->show_item)
4308 it->wd->show_item->showme = EINA_FALSE;
4309 it->wd->show_item = NULL;
4311 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4312 if (it->group_item) gith = it->group_item->h;
4313 elm_smart_scroller_child_region_show(it->wd->scr,
4314 it->x + it->block->x,
4315 it->y + it->block->y - gith,
4320 * Bring in the given item at the top
4322 * This causes genlist to jump to the given item @p it and show it (by
4323 * scrolling), if it is not fully visible. This may use animation to
4324 * do so and take a period of time
4326 * @param it The item
4331 elm_genlist_item_top_bring_in(Elm_Genlist_Item *it)
4333 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4335 Evas_Coord gith = 0;
4337 if (it->delete_me) return;
4338 if ((it->queued) || (!it->mincalcd))
4340 it->wd->show_item = it;
4341 it->wd->bring_in = EINA_TRUE;
4342 it->showme = EINA_TRUE;
4345 if (it->wd->show_item)
4347 it->wd->show_item->showme = EINA_FALSE;
4348 it->wd->show_item = NULL;
4350 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4351 if (it->group_item) gith = it->group_item->h;
4352 elm_smart_scroller_region_bring_in(it->wd->scr,
4353 it->x + it->block->x,
4354 it->y + it->block->y - gith,
4359 * Show the given item at the middle
4361 * This causes genlist to jump to the given item @p it and show it (by
4362 * scrolling), if it is not fully visible.
4364 * @param it The item
4369 elm_genlist_item_middle_show(Elm_Genlist_Item *it)
4371 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4374 if (it->delete_me) return;
4375 if ((it->queued) || (!it->mincalcd))
4377 it->wd->show_item = it;
4378 it->wd->bring_in = EINA_TRUE;
4379 it->showme = EINA_TRUE;
4382 if (it->wd->show_item)
4384 it->wd->show_item->showme = EINA_FALSE;
4385 it->wd->show_item = NULL;
4387 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4388 elm_smart_scroller_child_region_show(it->wd->scr,
4389 it->x + it->block->x,
4390 it->y + it->block->y - oh / 2 +
4391 it->h / 2, it->block->w, oh);
4395 * Bring in the given item at the middle
4397 * This causes genlist to jump to the given item @p it and show it (by
4398 * scrolling), if it is not fully visible. This may use animation to
4399 * do so and take a period of time
4401 * @param it The item
4406 elm_genlist_item_middle_bring_in(Elm_Genlist_Item *it)
4408 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4411 if (it->delete_me) return;
4412 if ((it->queued) || (!it->mincalcd))
4414 it->wd->show_item = it;
4415 it->wd->bring_in = EINA_TRUE;
4416 it->showme = EINA_TRUE;
4419 if (it->wd->show_item)
4421 it->wd->show_item->showme = EINA_FALSE;
4422 it->wd->show_item = NULL;
4424 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
4425 elm_smart_scroller_region_bring_in(it->wd->scr,
4426 it->x + it->block->x,
4427 it->y + it->block->y - oh / 2 + it->h / 2,
4432 * Delete a given item
4434 * This deletes the item from genlist and calls the genlist item del
4435 * class callback defined in the item class, if it is set. This clears all
4436 * subitems if it is a tree.
4438 * @param it The item
4443 elm_genlist_item_del(Elm_Genlist_Item *it)
4445 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4446 if ((it->relcount > 0) || (it->walking > 0))
4448 elm_widget_item_pre_notify_del(it);
4449 elm_genlist_item_subitems_clear(it);
4450 it->delete_me = EINA_TRUE;
4451 if (it->wd->show_item == it) it->wd->show_item = NULL;
4453 it->wd->selected = eina_list_remove(it->wd->selected,
4457 if (it->realized) _item_unrealize(it);
4458 if (it->effect_item_realized) _effect_item_unrealize(it);
4459 it->block->changed = EINA_TRUE;
4460 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
4461 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
4463 if (it->itc->func.del)
4464 it->itc->func.del((void *)it->base.data, it->base.widget);
4471 * Set the data item from the genlist item
4473 * This set the data value passed on the elm_genlist_item_append() and
4474 * related item addition calls. This function will also call
4475 * elm_genlist_item_update() so the item will be updated to reflect the
4478 * @param it The item
4479 * @param data The new data pointer to set
4484 elm_genlist_item_data_set(Elm_Genlist_Item *it,
4487 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4488 elm_widget_item_data_set(it, data);
4489 elm_genlist_item_update(it);
4493 * Get the data item from the genlist item
4495 * This returns the data value passed on the elm_genlist_item_append()
4496 * and related item addition calls and elm_genlist_item_data_set().
4498 * @param it The item
4499 * @return The data pointer provided when created
4504 elm_genlist_item_data_get(const Elm_Genlist_Item *it)
4506 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4507 return elm_widget_item_data_get(it);
4511 * Tells genlist to "orphan" icons fetchs by the item class
4513 * This instructs genlist to release references to icons in the item,
4514 * meaning that they will no longer be managed by genlist and are
4515 * floating "orphans" that can be re-used elsewhere if the user wants
4518 * @param it The item
4523 elm_genlist_item_icons_orphan(Elm_Genlist_Item *it)
4526 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4527 EINA_LIST_FREE(it->icon_objs, icon)
4529 elm_widget_sub_object_del(it->base.widget, icon);
4530 evas_object_smart_member_del(icon);
4531 evas_object_hide(icon);
4536 * Get the real evas object of the genlist item
4538 * This returns the actual evas object used for the specified genlist
4539 * item. This may be NULL as it may not be created, and may be deleted
4540 * at any time by genlist. Do not modify this object (move, resize,
4541 * show, hide etc.) as genlist is controlling it. This function is for
4542 * querying, emitting custom signals or hooking lower level callbacks
4543 * for events. Do not delete this object under any circumstances.
4545 * @param it The item
4546 * @return The object pointer
4550 EAPI const Evas_Object *
4551 elm_genlist_item_object_get(const Elm_Genlist_Item *it)
4553 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
4554 return it->base.view;
4558 * Update the contents of an item
4560 * This updates an item by calling all the item class functions again
4561 * to get the icons, labels and states. Use this when the original
4562 * item data has changed and the changes are desired to be reflected.
4564 * @param it The item
4569 elm_genlist_item_update(Elm_Genlist_Item *it)
4571 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4572 if (!it->block) return;
4573 if (it->delete_me) return;
4574 it->mincalcd = EINA_FALSE;
4575 it->updateme = EINA_TRUE;
4576 it->block->updateme = EINA_TRUE;
4577 if (it->wd->update_job) ecore_job_del(it->wd->update_job);
4578 it->wd->update_job = ecore_job_add(_update_job, it->wd);
4582 * Update the item class of an item
4584 * @param it The item
4585 * @parem itc The item class for the item
4590 elm_genlist_item_item_class_update(Elm_Genlist_Item *it,
4591 const Elm_Genlist_Item_Class *itc)
4593 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
4594 if (!it->block) return;
4595 EINA_SAFETY_ON_NULL_RETURN(itc);
4596 if (it->delete_me) return;
4598 elm_genlist_item_update(it);
4601 static Evas_Object *
4602 _elm_genlist_item_label_create(void *data,
4604 void *item __UNUSED__)
4606 Evas_Object *label = elm_label_add(obj);
4609 elm_object_style_set(label, "tooltip");
4610 elm_label_label_set(label, data);
4615 _elm_genlist_item_label_del_cb(void *data,
4616 Evas_Object *obj __UNUSED__,
4617 void *event_info __UNUSED__)
4619 eina_stringshare_del(data);
4623 * Set the text to be shown in the genlist item.
4625 * @param item Target item
4626 * @param text The text to set in the content
4628 * Setup the text as tooltip to object. The item can have only one
4629 * tooltip, so any previous tooltip data is removed.
4634 elm_genlist_item_tooltip_text_set(Elm_Genlist_Item *item,
4637 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4638 text = eina_stringshare_add(text);
4639 elm_genlist_item_tooltip_content_cb_set(item, _elm_genlist_item_label_create,
4641 _elm_genlist_item_label_del_cb);
4645 * Set the content to be shown in the tooltip item
4647 * Setup the tooltip to item. The item can have only one tooltip, so
4648 * any previous tooltip data is removed. @p func(with @p data) will be
4649 * called every time that need to show the tooltip and it should return a
4650 * valid Evas_Object. This object is then managed fully by tooltip
4651 * system and is deleted when the tooltip is gone.
4653 * @param item the genlist item being attached by a tooltip.
4654 * @param func the function used to create the tooltip contents.
4655 * @param data what to provide to @a func as callback data/context.
4656 * @param del_cb called when data is not needed anymore, either when
4657 * another callback replaces @func, the tooltip is unset with
4658 * elm_genlist_item_tooltip_unset() or the owner @a item
4659 * dies. This callback receives as the first parameter the
4660 * given @a data, and @c event_info is the item.
4665 elm_genlist_item_tooltip_content_cb_set(Elm_Genlist_Item *item,
4666 Elm_Tooltip_Item_Content_Cb func,
4668 Evas_Smart_Cb del_cb)
4670 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(item, error);
4672 if ((item->tooltip.content_cb == func) && (item->tooltip.data == data))
4675 if (item->tooltip.del_cb)
4676 item->tooltip.del_cb((void *)item->tooltip.data,
4677 item->base.widget, item);
4679 item->tooltip.content_cb = func;
4680 item->tooltip.data = data;
4681 item->tooltip.del_cb = del_cb;
4683 if (item->base.view)
4685 elm_widget_item_tooltip_content_cb_set(item,
4686 item->tooltip.content_cb,
4687 item->tooltip.data, NULL);
4688 elm_widget_item_tooltip_style_set(item, item->tooltip.style);
4694 if (del_cb) del_cb((void *)data, NULL, NULL);
4698 * Unset tooltip from item
4700 * @param item genlist item to remove previously set tooltip.
4702 * Remove tooltip from item. The callback provided as del_cb to
4703 * elm_genlist_item_tooltip_content_cb_set() will be called to notify
4704 * it is not used anymore.
4706 * @see elm_genlist_item_tooltip_content_cb_set()
4711 elm_genlist_item_tooltip_unset(Elm_Genlist_Item *item)
4713 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4714 if ((item->base.view) && (item->tooltip.content_cb))
4715 elm_widget_item_tooltip_unset(item);
4717 if (item->tooltip.del_cb)
4718 item->tooltip.del_cb((void *)item->tooltip.data, item->base.widget, item);
4719 item->tooltip.del_cb = NULL;
4720 item->tooltip.content_cb = NULL;
4721 item->tooltip.data = NULL;
4722 if (item->tooltip.style)
4723 elm_genlist_item_tooltip_style_set(item, NULL);
4727 * Sets a different style for this item tooltip.
4729 * @note before you set a style you should define a tooltip with
4730 * elm_genlist_item_tooltip_content_cb_set() or
4731 * elm_genlist_item_tooltip_text_set()
4733 * @param item genlist item with tooltip already set.
4734 * @param style the theme style to use (default, transparent, ...)
4739 elm_genlist_item_tooltip_style_set(Elm_Genlist_Item *item,
4742 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4743 eina_stringshare_replace(&item->tooltip.style, style);
4744 if (item->base.view) elm_widget_item_tooltip_style_set(item, style);
4748 * Get the style for this item tooltip.
4750 * @param item genlist item with tooltip already set.
4751 * @return style the theme style in use, defaults to "default". If the
4752 * object does not have a tooltip set, then NULL is returned.
4757 elm_genlist_item_tooltip_style_get(const Elm_Genlist_Item *item)
4759 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4760 return item->tooltip.style;
4764 * Set the cursor to be shown when mouse is over the genlist item
4766 * @param item Target item
4767 * @param cursor the cursor name to be used.
4769 * @see elm_object_cursor_set()
4773 elm_genlist_item_cursor_set(Elm_Genlist_Item *item,
4776 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4777 eina_stringshare_replace(&item->mouse_cursor, cursor);
4778 if (item->base.view) elm_widget_item_cursor_set(item, cursor);
4782 * Get the cursor to be shown when mouse is over the genlist item
4784 * @param item genlist item with cursor already set.
4785 * @return the cursor name.
4790 elm_genlist_item_cursor_get(const Elm_Genlist_Item *item)
4792 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4793 return elm_widget_item_cursor_get(item);
4797 * Unset the cursor to be shown when mouse is over the genlist item
4799 * @param item Target item
4801 * @see elm_object_cursor_unset()
4805 elm_genlist_item_cursor_unset(Elm_Genlist_Item *item)
4807 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4808 if (!item->mouse_cursor)
4811 if (item->base.view)
4812 elm_widget_item_cursor_unset(item);
4814 eina_stringshare_del(item->mouse_cursor);
4815 item->mouse_cursor = NULL;
4819 * Sets a different style for this item cursor.
4821 * @note before you set a style you should define a cursor with
4822 * elm_genlist_item_cursor_set()
4824 * @param item genlist item with cursor already set.
4825 * @param style the theme style to use (default, transparent, ...)
4830 elm_genlist_item_cursor_style_set(Elm_Genlist_Item *item,
4833 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4834 elm_widget_item_cursor_style_set(item, style);
4838 * Get the style for this item cursor.
4840 * @param item genlist item with cursor already set.
4841 * @return style the theme style in use, defaults to "default". If the
4842 * object does not have a cursor set, then NULL is returned.
4847 elm_genlist_item_cursor_style_get(const Elm_Genlist_Item *item)
4849 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, NULL);
4850 return elm_widget_item_cursor_style_get(item);
4854 * Set if the cursor set should be searched on the theme or should use
4855 * the provided by the engine, only.
4857 * @note before you set if should look on theme you should define a
4858 * cursor with elm_object_cursor_set(). By default it will only look
4859 * for cursors provided by the engine.
4861 * @param item widget item with cursor already set.
4862 * @param engine_only boolean to define it cursors should be looked
4863 * only between the provided by the engine or searched on widget's
4869 elm_genlist_item_cursor_engine_only_set(Elm_Genlist_Item *item,
4870 Eina_Bool engine_only)
4872 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item);
4873 elm_widget_item_cursor_engine_only_set(item, engine_only);
4877 * Get the cursor engine only usage for this item cursor.
4879 * @param item widget item with cursor already set.
4880 * @return engine_only boolean to define it cursors should be looked
4881 * only between the provided by the engine or searched on widget's
4882 * theme as well. If the object does not have a cursor set, then
4883 * EINA_FALSE is returned.
4888 elm_genlist_item_cursor_engine_only_get(const Elm_Genlist_Item *item)
4890 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(item, EINA_FALSE);
4891 return elm_widget_item_cursor_engine_only_get(item);
4895 * This sets the horizontal stretching mode
4897 * This sets the mode used for sizing items horizontally. Valid modes
4898 * are ELM_LIST_LIMIT and ELM_LIST_SCROLL. The default is
4899 * ELM_LIST_SCROLL. This mode means that if items are too wide to fit,
4900 * the scroller will scroll horizontally. Otherwise items are expanded
4901 * to fill the width of the viewport of the scroller. If it is
4902 * ELM_LIST_LIMIT, Items will be expanded to the viewport width and
4903 * limited to that size.
4905 * @param obj The genlist object
4906 * @param mode The mode to use
4911 elm_genlist_horizontal_mode_set(Evas_Object *obj,
4914 ELM_CHECK_WIDTYPE(obj, widtype);
4915 Widget_Data *wd = elm_widget_data_get(obj);
4917 if (wd->mode == mode) return;
4923 * Gets the horizontal stretching mode
4925 * @param obj The genlist object
4926 * @return The mode to use
4927 * (ELM_LIST_LIMIT, ELM_LIST_SCROLL)
4932 elm_genlist_horizontal_mode_get(const Evas_Object *obj)
4934 ELM_CHECK_WIDTYPE(obj, widtype) ELM_LIST_LAST;
4935 Widget_Data *wd = elm_widget_data_get(obj);
4936 if (!wd) return ELM_LIST_LAST;
4941 * Set the always select mode.
4943 * Items will only call their selection func and callback when first
4944 * becoming selected. Any further clicks will do nothing, unless you
4945 * enable always select with elm_genlist_always_select_mode_set().
4946 * This means even if selected, every click will make the selected
4947 * callbacks be called.
4949 * @param obj The genlist object
4950 * @param always_select The always select mode
4951 * (EINA_TRUE = on, EINA_FALSE = off)
4956 elm_genlist_always_select_mode_set(Evas_Object *obj,
4957 Eina_Bool always_select)
4959 ELM_CHECK_WIDTYPE(obj, widtype);
4960 Widget_Data *wd = elm_widget_data_get(obj);
4962 wd->always_select = always_select;
4966 * Get the always select mode.
4968 * @param obj The genlist object
4969 * @return The always select mode
4970 * (EINA_TRUE = on, EINA_FALSE = off)
4975 elm_genlist_always_select_mode_get(const Evas_Object *obj)
4977 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4978 Widget_Data *wd = elm_widget_data_get(obj);
4979 if (!wd) return EINA_FALSE;
4980 return wd->always_select;
4984 * Set no select mode
4986 * This will turn off the ability to select items entirely and they
4987 * will neither appear selected nor call selected callback functions.
4989 * @param obj The genlist object
4990 * @param no_select The no select mode
4991 * (EINA_TRUE = on, EINA_FALSE = off)
4996 elm_genlist_no_select_mode_set(Evas_Object *obj,
4997 Eina_Bool no_select)
4999 ELM_CHECK_WIDTYPE(obj, widtype);
5000 Widget_Data *wd = elm_widget_data_get(obj);
5002 wd->no_select = no_select;
5006 * Gets no select mode
5008 * @param obj The genlist object
5009 * @return The no select mode
5010 * (EINA_TRUE = on, EINA_FALSE = off)
5015 elm_genlist_no_select_mode_get(const Evas_Object *obj)
5017 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5018 Widget_Data *wd = elm_widget_data_get(obj);
5019 if (!wd) return EINA_FALSE;
5020 return wd->no_select;
5026 * This will enable the compress mode where items are "compressed"
5027 * horizontally to fit the genlist scrollable viewport width. This is
5028 * special for genlist. Do not rely on
5029 * elm_genlist_horizontal_mode_set() being set to ELM_LIST_COMPRESS to
5030 * work as genlist needs to handle it specially.
5032 * @param obj The genlist object
5033 * @param compress The compress mode
5034 * (EINA_TRUE = on, EINA_FALSE = off)
5039 elm_genlist_compress_mode_set(Evas_Object *obj,
5042 ELM_CHECK_WIDTYPE(obj, widtype);
5043 Widget_Data *wd = elm_widget_data_get(obj);
5045 wd->compress = compress;
5049 * Get the compress mode
5051 * @param obj The genlist object
5052 * @return The compress mode
5053 * (EINA_TRUE = on, EINA_FALSE = off)
5058 elm_genlist_compress_mode_get(const Evas_Object *obj)
5060 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5061 Widget_Data *wd = elm_widget_data_get(obj);
5062 if (!wd) return EINA_FALSE;
5063 return wd->compress;
5067 * Set height-for-width mode
5069 * With height-for-width mode the item width will be fixed (restricted
5070 * to a minimum of) to the list width when calculating its size in
5071 * order to allow the height to be calculated based on it. This allows,
5072 * for instance, text block to wrap lines if the Edje part is
5073 * configured with "text.min: 0 1".
5075 * @note This mode will make list resize slower as it will have to
5076 * recalculate every item height again whenever the list width
5079 * @note When height-for-width mode is enabled, it also enables
5080 * compress mode (see elm_genlist_compress_mode_set()) and
5081 * disables homogeneous (see elm_genlist_homogeneous_set()).
5083 * @param obj The genlist object
5084 * @param setting The height-for-width mode (EINA_TRUE = on,
5090 elm_genlist_height_for_width_mode_set(Evas_Object *obj,
5091 Eina_Bool height_for_width)
5093 ELM_CHECK_WIDTYPE(obj, widtype);
5094 Widget_Data *wd = elm_widget_data_get(obj);
5096 wd->height_for_width = !!height_for_width;
5097 if (wd->height_for_width)
5099 elm_genlist_homogeneous_set(obj, EINA_FALSE);
5100 elm_genlist_compress_mode_set(obj, EINA_TRUE);
5105 * Get the height-for-width mode
5107 * @param obj The genlist object
5108 * @return The height-for-width mode (EINA_TRUE = on, EINA_FALSE =
5114 elm_genlist_height_for_width_mode_get(const Evas_Object *obj)
5116 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5117 Widget_Data *wd = elm_widget_data_get(obj);
5118 if (!wd) return EINA_FALSE;
5119 return wd->height_for_width;
5125 * This will enable or disable the scroller bounce mode for the
5126 * genlist. See elm_scroller_bounce_set() for details
5128 * @param obj The genlist object
5129 * @param h_bounce Allow bounce horizontally
5130 * @param v_bounce Allow bounce vertically
5135 elm_genlist_bounce_set(Evas_Object *obj,
5139 ELM_CHECK_WIDTYPE(obj, widtype);
5140 Widget_Data *wd = elm_widget_data_get(obj);
5142 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
5146 * Get the bounce mode
5148 * @param obj The genlist object
5149 * @param h_bounce Allow bounce horizontally
5150 * @param v_bounce Allow bounce vertically
5155 elm_genlist_bounce_get(const Evas_Object *obj,
5156 Eina_Bool *h_bounce,
5157 Eina_Bool *v_bounce)
5159 ELM_CHECK_WIDTYPE(obj, widtype);
5160 Widget_Data *wd = elm_widget_data_get(obj);
5162 elm_smart_scroller_bounce_allow_get(obj, h_bounce, v_bounce);
5166 * Set homogenous mode
5168 * This will enable the homogeneous mode where items are of the same
5169 * height and width so that genlist may do the lazy-loading at its
5170 * maximum. This implies 'compressed' mode.
5172 * @param obj The genlist object
5173 * @param homogeneous Assume the items within the genlist are of the
5174 * same height and width (EINA_TRUE = on, EINA_FALSE = off)
5179 elm_genlist_homogeneous_set(Evas_Object *obj,
5180 Eina_Bool homogeneous)
5182 ELM_CHECK_WIDTYPE(obj, widtype);
5183 Widget_Data *wd = elm_widget_data_get(obj);
5185 if (homogeneous) elm_genlist_compress_mode_set(obj, EINA_TRUE);
5186 wd->homogeneous = homogeneous;
5190 * Get the homogenous mode
5192 * @param obj The genlist object
5193 * @return Assume the items within the genlist are of the same height
5194 * and width (EINA_TRUE = on, EINA_FALSE = off)
5199 elm_genlist_homogeneous_get(const Evas_Object *obj)
5201 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5202 Widget_Data *wd = elm_widget_data_get(obj);
5203 if (!wd) return EINA_FALSE;
5204 return wd->homogeneous;
5208 * Set the maximum number of items within an item block
5210 * This will configure the block count to tune to the target with
5211 * particular performance matrix.
5213 * @param obj The genlist object
5214 * @param n Maximum number of items within an item block
5219 elm_genlist_block_count_set(Evas_Object *obj,
5222 ELM_CHECK_WIDTYPE(obj, widtype);
5223 Widget_Data *wd = elm_widget_data_get(obj);
5225 wd->max_items_per_block = n;
5226 wd->item_cache_max = wd->max_items_per_block * 2;
5227 _item_cache_clean(wd);
5231 * Get the maximum number of items within an item block
5233 * @param obj The genlist object
5234 * @return Maximum number of items within an item block
5239 elm_genlist_block_count_get(const Evas_Object *obj)
5241 ELM_CHECK_WIDTYPE(obj, widtype) 0;
5242 Widget_Data *wd = elm_widget_data_get(obj);
5244 return wd->max_items_per_block;
5248 * Set the timeout in seconds for the longpress event
5250 * @param obj The genlist object
5251 * @param timeout timeout in seconds
5256 elm_genlist_longpress_timeout_set(Evas_Object *obj,
5259 ELM_CHECK_WIDTYPE(obj, widtype);
5260 Widget_Data *wd = elm_widget_data_get(obj);
5262 wd->longpress_timeout = timeout;
5266 * Get the timeout in seconds for the longpress event
5268 * @param obj The genlist object
5269 * @return timeout in seconds
5274 elm_genlist_longpress_timeout_get(const Evas_Object *obj)
5276 ELM_CHECK_WIDTYPE(obj, widtype) 0;
5277 Widget_Data *wd = elm_widget_data_get(obj);
5279 return wd->longpress_timeout;
5283 * Set the scrollbar policy
5285 * This sets the scrollbar visibility policy for the given genlist
5286 * scroller. ELM_SMART_SCROLLER_POLICY_AUTO means the scrollbar is
5287 * made visible if it is needed, and otherwise kept hidden.
5288 * ELM_SMART_SCROLLER_POLICY_ON turns it on all the time, and
5289 * ELM_SMART_SCROLLER_POLICY_OFF always keeps it off. This applies
5290 * respectively for the horizontal and vertical scrollbars.
5292 * @param obj The genlist object
5293 * @param policy_h Horizontal scrollbar policy
5294 * @param policy_v Vertical scrollbar policy
5299 elm_genlist_scroller_policy_set(Evas_Object *obj,
5300 Elm_Scroller_Policy policy_h,
5301 Elm_Scroller_Policy policy_v)
5303 ELM_CHECK_WIDTYPE(obj, widtype);
5304 Widget_Data *wd = elm_widget_data_get(obj);
5306 if ((policy_h >= ELM_SCROLLER_POLICY_LAST) ||
5307 (policy_v >= ELM_SCROLLER_POLICY_LAST))
5310 elm_smart_scroller_policy_set(wd->scr, policy_h, policy_v);
5314 * Get the scrollbar policy
5316 * @param obj The genlist object
5317 * @param policy_h Horizontal scrollbar policy
5318 * @param policy_v Vertical scrollbar policy
5323 elm_genlist_scroller_policy_get(const Evas_Object *obj,
5324 Elm_Scroller_Policy *policy_h,
5325 Elm_Scroller_Policy *policy_v)
5327 ELM_CHECK_WIDTYPE(obj, widtype);
5328 Widget_Data *wd = elm_widget_data_get(obj);
5329 Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
5330 if ((!wd) || (!wd->scr)) return;
5331 elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
5332 if (policy_h) *policy_h = (Elm_Scroller_Policy)s_policy_h;
5333 if (policy_v) *policy_v = (Elm_Scroller_Policy)s_policy_v;
5336 /****************************************************************************/
5341 * @param obj The genlist object
5342 * @param reorder_mode The reorder mode
5343 * (EINA_TRUE = on, EINA_FALSE = off)
5348 elm_genlist_reorder_mode_set(Evas_Object *obj,
5349 Eina_Bool reorder_mode)
5351 ELM_CHECK_WIDTYPE(obj, widtype);
5352 Widget_Data *wd = elm_widget_data_get(obj);
5354 wd->reorder_mode = reorder_mode;
5358 * Get the reorder mode
5360 * @param obj The genlist object
5361 * @return The reorder mode
5362 * (EINA_TRUE = on, EINA_FALSE = off)
5367 elm_genlist_reorder_mode_get(const Evas_Object *obj)
5369 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
5370 Widget_Data *wd = elm_widget_data_get(obj);
5371 if (!wd) return EINA_FALSE;
5372 return wd->reorder_mode;
5376 elm_genlist_item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after)
5382 elm_genlist_item_move_before(Elm_Genlist_Item *it, Elm_Genlist_Item *before)
5388 _effect_item_move_after(Elm_Genlist_Item *it, Elm_Genlist_Item *after)
5393 if (it->wd->ed->ec->move)
5394 it->wd->ed->ec->move(it->base.widget, it, it->wd->ed->reorder_rel, EINA_TRUE);
5396 printf("MOVE AFTER : %d after = %d \n", (int)elm_genlist_item_data_get(it)+1, (int)elm_genlist_item_data_get(after)+1);
5397 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
5398 _item_block_del(it);
5400 it->wd->items = eina_inlist_append_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(after));
5402 it->rel->relcount++;
5403 it->before = EINA_FALSE;
5404 _item_queue(it->wd, it);
5408 _effect_item_move_before(Elm_Genlist_Item *it, Elm_Genlist_Item *before)
5411 if (!before) return;
5413 if (it->wd->ed->ec->move)
5414 it->wd->ed->ec->move(it->base.widget, it, it->wd->ed->reorder_rel, EINA_TRUE);
5416 printf("MOVE BEFORE : %d before = %d \n", (int)elm_genlist_item_data_get(it)+1, (int)elm_genlist_item_data_get(before)+1);
5417 it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
5418 _item_block_del(it);
5419 it->wd->items = eina_inlist_prepend_relative(it->wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(before));
5421 it->rel->relcount++;
5422 it->before = EINA_TRUE;
5423 _item_queue(it->wd, it);
5427 elm_genlist_effect_set(const Evas_Object *obj, Eina_Bool emode)
5429 ELM_CHECK_WIDTYPE(obj, widtype);
5430 Widget_Data *wd = elm_widget_data_get(obj);
5432 wd->effect_mode = emode;
5433 // wd->point_rect = evas_object_rectangle_add(evas_object_evas_get(wd->obj));
5434 // evas_object_resize(wd->point_rect, 10, 25);
5435 // evas_object_color_set(wd->point_rect, 255, 0, 0, 130);
5436 // evas_object_show(wd->point_rect);
5437 // evas_object_hide(wd->point_rect);
5441 _create_tray_alpha_bg(const Evas_Object *obj)
5443 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
5444 Widget_Data *wd = elm_widget_data_get(obj);
5445 if (!wd) return NULL;
5447 Evas_Object *bg = NULL;
5448 Evas_Coord ox, oy, ow, oh;
5450 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
5451 bg = evas_object_rectangle_add(evas_object_evas_get(wd->obj));
5452 evas_object_color_set(bg,0,0,0,0);
5453 evas_object_resize(bg , ow, oh);
5454 evas_object_move(bg , ox, oy);
5455 evas_object_show(bg);
5456 evas_object_hide(bg);
5463 struct timeval timev;
5465 gettimeofday(&timev, NULL);
5466 return ((timev.tv_sec * 1000) + ((timev.tv_usec) / 1000));
5469 // added for item moving animation.
5471 _item_moving_effect_timer_cb(void *data)
5473 Widget_Data *wd = data;
5474 if (!wd) return EINA_FALSE;
5476 Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh;
5477 Elm_Genlist_Item *it, *it2;
5479 double time = 0.4, t;
5481 Eina_Bool check, end = EINA_FALSE;
5482 // static Eina_Bool first = EINA_TRUE;
5485 t = ((0.0 > (t = current_time_get() - wd->start_time)) ? 0.0 : t) / 1000;
5487 evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh);
5488 evas_output_viewport_get(evas_object_evas_get(wd->pan_smart), &cvx, &cvy, &cvw, &cvh);
5490 EINA_INLIST_FOREACH(wd->blocks, itb)
5493 if (ELM_RECTS_INTERSECT(itb->x - wd->pan_x + ox,
5494 itb->y - wd->pan_y + oy,
5496 cvx, cvy, cvw, cvh))
5498 EINA_LIST_FOREACH(itb->items, l, it)
5503 if(it2->parent == wd->expand_item) check = EINA_TRUE;
5508 // printf("item : %p - ", it);
5511 //printf(" s: %d %d ", oy, oh);
5512 if(wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5513 dy = it->scrl_y - it->old_scrl_y;
5514 else if(wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5516 // printf("%d %d\n", it->old_scrl_y, wd->expand_item_end);
5517 if(wd->expand_item_end < it->old_scrl_y)
5518 dy = wd->expand_item_gap;
5520 // printf(" dy - %d -", dy);
5522 y = (1 * sin((t / time) * (M_PI / 2)) * dy);
5528 //printf("s : %d os : %d y : %d t : %2.2f time : %2.2f dy : %d\n", it->scrl_y, it->old_scrl_y, y, t, time, dy);
5530 if (!it->old_scrl_y)
5531 it->old_scrl_y = it->scrl_y;
5534 //printf(" %d | ", it->old_scrl_y + y);
5535 if (it->old_scrl_y + y < oy + oh)
5537 // printf("%p in pan | ", it);
5538 //if (!it->realized) printf("%p is not realized %d :: \n", it, it->old_scrl_y + y);
5540 if (!it->realized) _item_realize(it, in, 0);
5542 /* else if(first && wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5544 printf("1 . %p ::%d %d %d\n", it, it->old_scrl_y, (wd->expand_item_end + wd->expand_item_gap) , (oy + oh));
5545 it->old_scrl_y = it->old_scrl_y - ((wd->expand_item_end - wd->expand_item_gap) - (oy + oh));
5546 wd->expand_item_gap = wd->expand_item_gap + ((wd->expand_item_end - wd->expand_item_gap) - (oy + oh));
5547 printf("2 . %p ::%d %d %d\n", it, it->old_scrl_y, (wd->expand_item_end + wd->expand_item_gap) , (oy + oh));
5551 // printf("%p :: %d\n", it, it->old_scrl_y + y);
5552 evas_object_resize(it->base.view, it->w-(it->pad_left+it->pad_right), it->h);
5553 evas_object_move(it->base.view, it->scrl_x+it->pad_left, it->old_scrl_y + y);
5554 evas_object_show(it->base.view);
5555 evas_object_raise(it->base.view);
5557 if(wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5559 it2 = elm_genlist_item_prev_get(it);
5562 if((it2->scrl_y < it->old_scrl_y + y) && (it2->expanded_depth > it->expanded_depth))
5564 if(!it2->effect_done)
5566 //edje_object_signal_emit(it2->base.view, "elm,state,expand_flip", "");
5567 evas_object_move(it2->base.view, it2->scrl_x, it2->scrl_y);
5568 evas_object_show(it2->base.view);
5569 it2->effect_done = EINA_TRUE;
5573 it2 = elm_genlist_item_prev_get(it2);
5576 else if(wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5578 it2 = elm_genlist_item_prev_get(it);
5581 if((it2->scrl_y > it->old_scrl_y + y) && (it2->expanded_depth > it->expanded_depth))
5583 if(!it2->effect_done)
5585 edje_object_signal_emit(it2->base.view, "elm,state,hide", "");
5586 it2->effect_done = EINA_TRUE;
5591 it2 = elm_genlist_item_prev_get(it2);
5597 // first = EINA_FALSE;
5601 if (wd->item_moving_effect_timer)
5603 if(wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5604 _item_subitems_clear(wd->expand_item);
5605 wd->move_effect_mode = ELM_GENLIST_ITEM_MOVE_EFFECT_NONE;
5606 EINA_INLIST_FOREACH(wd->blocks, itb)
5608 EINA_LIST_FOREACH(itb->items, l, it)
5610 it->effect_done = EINA_TRUE;
5611 it->list_expanded = 0;
5612 it->old_scrl_y = it->scrl_y;
5616 //evas_render(evas_object_evas_get(wd->obj));
5617 wd->item_moving_effect_timer = NULL;
5618 // first = EINA_TRUE;
5620 evas_object_lower(wd->alpha_bg);
5621 evas_object_hide(wd->alpha_bg);
5623 return ECORE_CALLBACK_CANCEL;
5625 return ECORE_CALLBACK_RENEW;
5629 _emit_contract(Elm_Genlist_Item *it)
5631 Elm_Genlist_Item *it2;
5634 // printf("%p is emited contract\n", it);
5635 edje_object_signal_emit(it->base.view, "elm,state,contract_flip", "");
5636 it->effect_done = EINA_FALSE;
5638 EINA_LIST_FOREACH(it->items, l, it2)
5640 _emit_contract(it2);
5643 // added for item moving animation.
5645 _item_flip_effect_show(Elm_Genlist_Item *it)
5647 Elm_Genlist_Item *it2;
5649 Widget_Data *wd = it->wd;
5650 Eina_Bool check = EINA_FALSE;
5652 it2 = elm_genlist_item_next_get(it);
5655 if(it2->expanded_depth <= it->expanded_depth) check = EINA_TRUE;
5656 it2 = elm_genlist_item_next_get(it2);
5658 EINA_LIST_FOREACH(it->items, l, it2)
5660 if (it2->parent && it == it2->parent)
5662 if(wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND)
5664 // edje_object_signal_emit(it2->base.view, "elm,state,expand_flip", "");
5665 edje_object_signal_emit(it2->base.view, "flip_item", "");
5667 evas_object_move(it2->base.view, -9999, -9999);
5669 evas_object_show(it2->base.view);
5671 else if(wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT)
5672 _emit_contract(it2);
5676 return ECORE_CALLBACK_CANCEL;
5680 _elm_genlist_pinch_zoom_execute(Evas_Object *obj, Eina_Bool emode)
5682 printf("!!! NOW FIXING \n");
5686 * Set pinch zoom mode
5688 * @param obj The genlist object
5690 * (EINA_TRUE = pinch contract (zoom in), EINA_FALSE = pinch expand (zoom out)
5695 elm_genlist_pinch_zoom_mode_set(Evas_Object *obj, Eina_Bool emode)
5697 printf("!!! NOW FIXING \n");
5701 * Get pinch zoom mode
5703 * @param obj The genlist object
5704 * @return The pinch mode
5705 * (EINA_TRUE = pinch contract (zoom in), EINA_FALSE = pinch expand (zoom out)
5710 elm_genlist_pinch_zoom_mode_get(const Evas_Object *obj)
5712 printf("!!! NOW FIXING \n");
5717 elm_genlist_pinch_zoom_set(Evas_Object *obj, Eina_Bool emode)
5719 printf("!!! NOW FIXING \n");
5723 ////////////////////////////////////////////////////////////////////////
5725 ////////////////////////////////////////////////////////////////////////
5727 _effect_item_update(Elm_Genlist_Item *it)
5729 if (it->edit_select_check)
5731 edje_object_signal_emit(it->edit_obj, "elm,state,del_confirm", "elm");
5735 edje_object_signal_emit(it->edit_obj, "elm,state,del,enable", "elm");
5740 _edit_item_checkbox_set(Elm_Genlist_Item *it, Eina_Bool edit_select_check_state)
5743 if (edit_select_check_state)
5745 it->edit_select_check = EINA_TRUE;
5746 edje_object_signal_emit(it->edit_obj, "elm,state,del_confirm", "elm");
5750 it->edit_select_check = EINA_FALSE;
5751 edje_object_signal_emit(it->edit_obj, "elm,state,del,enable", "elm");
5753 if (it->wd->ed->ec->item_selected)
5754 it->wd->ed->ec->item_selected(it->base.data, it, it->edit_select_check);
5758 _edit_subitems_checkbox_set(Elm_Genlist_Item *it)
5761 Eina_List *tl = NULL, *l;
5762 Elm_Genlist_Item *it2;
5764 EINA_LIST_FOREACH(it->items, l, it2)
5765 tl = eina_list_append(tl, it2);
5766 EINA_LIST_FREE(tl, it2)
5767 if(it2->parent) _edit_item_checkbox_set(it2, it2->parent->edit_select_check);
5771 _edit_parent_items_checkbox_set(Elm_Genlist_Item *it)
5774 Elm_Genlist_Item *tmp_it;
5775 Eina_Bool parent_check = EINA_TRUE;
5777 EINA_INLIST_FOREACH(it->wd->items, tmp_it)
5779 if (tmp_it->parent && it->parent)
5780 if(tmp_it->parent == it->parent && tmp_it->edit_select_check == EINA_FALSE) parent_check = EINA_FALSE;
5784 if (parent_check) it->parent->edit_select_check = EINA_TRUE;
5785 else it->parent->edit_select_check = EINA_FALSE;
5790 _effect_item_update(it->parent);
5791 return _edit_parent_items_checkbox_set(it->parent);
5796 _checkbox_item_select_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
5798 Elm_Genlist_Item *it = data, *tmp_it;
5799 Eina_Bool parent_check = EINA_TRUE, old_check_state;
5800 int check_cnt = 0, total_cnt = 0;
5803 _edit_item_checkbox_set(it, !it->edit_select_check);
5804 _edit_subitems_checkbox_set(it);
5805 _edit_parent_items_checkbox_set(it);
5807 it->wd->ed->del_item = it;
5809 EINA_INLIST_FOREACH(it->wd->items, tmp_it)
5811 if (tmp_it->edit_select_check) check_cnt++;
5815 if (it->wd->select_all_item)
5817 old_check_state = it->wd->select_all_check;
5818 if (check_cnt == total_cnt) it->wd->select_all_check = EINA_TRUE;
5819 else it->wd->select_all_check = EINA_FALSE;
5821 if (check_cnt == total_cnt)
5823 it->wd->select_all_check = EINA_TRUE;
5824 edje_object_signal_emit(it->wd->select_all_item->base.view, "elm,state,del_confirm", "elm");
5828 it->wd->select_all_check = EINA_FALSE;
5829 edje_object_signal_emit(it->wd->select_all_item->base.view, "elm,state,del,animated,enable", "elm");
5831 if (old_check_state != it->wd->select_all_check && it->wd->ed->ec->item_selected)
5832 it->wd->ed->ec->item_selected(it->wd->select_all_item->base.data, it->wd->select_all_item, it->wd->select_all_check);
5837 _select_all_down(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
5839 Elm_Genlist_Item *select_all_it = data, *it;
5840 Eina_Bool old_check_state;
5841 Widget_Data *wd = select_all_it->wd;
5844 wd->select_all_check = !wd->select_all_check;
5845 if (wd->select_all_check)
5846 edje_object_signal_emit(select_all_it->base.view, "elm,state,del_confirm", "elm");
5848 edje_object_signal_emit(select_all_it->base.view, "elm,state,del,animated,enable", "elm");
5850 EINA_INLIST_FOREACH(wd->items, it)
5852 old_check_state = it->edit_select_check;
5853 if (wd->select_all_check) it->edit_select_check = EINA_TRUE;
5854 else it->edit_select_check = EINA_FALSE;
5856 // TODO : check this
5857 if (old_check_state != it->edit_select_check && it->wd->ed->ec->item_selected)
5858 it->wd->ed->ec->item_selected(it->base.data, it, it->edit_select_check);
5861 if (wd->ed->ec->item_selected)
5862 wd->ed->ec->item_selected(select_all_it->base.data, select_all_it, wd->select_all_check);
5864 if (wd->calc_job) ecore_job_del(wd->calc_job);
5865 wd->calc_job = ecore_job_add(_calc_job, wd);
5870 _effect_item_controls(Elm_Genlist_Item *it, int itx, int ity)
5872 if (it->wd->edit_mode == ELM_GENLIST_EDIT_MODE_NONE)
5874 evas_object_resize(it->edit_obj,it->w, it->h);
5875 evas_object_move(it->edit_obj, itx, ity);
5876 evas_object_raise(it->edit_obj);
5878 if (it->wd->select_all_check)
5879 it->edit_select_check = EINA_TRUE;
5882 if (it->edit_select_check) edje_object_signal_emit(it->edit_obj, "elm,state,del_confirm", "elm");
5884 edje_object_signal_emit(it->edit_obj, "elm,state,del,enable", "elm");
5889 _effect_item_realize(Elm_Genlist_Item *it)
5891 if ((it->effect_item_realized) || (it->delete_me)) return;
5892 int itmode = 0, pad = 0;
5893 const char *pad_str;
5895 it->pad_left = it->pad_right = 0;
5897 if (it->itc->func.editmode_get)
5898 itmode = it->itc->func.editmode_get(it->base.data, it->base.widget, it->wd->edit_mode);
5899 itmode &= it->wd->edit_mode;
5901 if (itmode & ELM_GENLIST_EDIT_MODE_SELECTALL)
5902 itmode |= ELM_GENLIST_EDIT_MODE_SELECT;
5904 it->edit_obj = edje_object_add(evas_object_evas_get(it->base.widget));
5905 edje_object_scale_set(it->edit_obj, elm_widget_scale_get(it->base.widget) *
5906 _elm_config->scale);
5907 evas_object_smart_member_add(it->edit_obj, it->wd->pan_smart);
5908 elm_widget_sub_object_add(it->base.widget, it->edit_obj);
5910 if (it->flags & ELM_GENLIST_ITEM_SUBITEMS) strncpy(buf, "tree", sizeof(buf));
5911 else strncpy(buf, "item", sizeof(buf));
5912 if (it->wd->compress) strncat(buf, "_compress", sizeof(buf) - strlen(buf));
5914 strncat(buf, "/", sizeof(buf) - strlen(buf));
5916 if (it->wd->ed && it->wd->ed->ec->item_style && strcmp(it->wd->ed->ec->item_style, "default"))
5918 strncat(buf, it->wd->ed->ec->item_style, sizeof(buf) - strlen(buf));
5919 _elm_theme_object_set(it->base.widget, it->edit_obj, "genlist", buf, elm_widget_style_get(it->base.widget));
5923 _elm_theme_object_set(it->base.widget, it->edit_obj, "genlist", "item/edit_control", elm_widget_style_get(it->base.widget));
5926 pad_str = edje_object_data_get(it->edit_obj, "icon_width");
5927 if (pad_str) pad = atoi(pad_str);
5929 if ((itmode & ELM_GENLIST_EDIT_MODE_DELETE) || (itmode & ELM_GENLIST_EDIT_MODE_SELECT))
5931 edje_object_signal_emit(it->edit_obj, "elm,state,del,enable", "elm");
5932 edje_object_signal_callback_del(it->edit_obj, "elm,action,item,delete",
5933 "elm", _checkbox_item_select_cb);
5935 edje_object_signal_callback_add(it->edit_obj, "elm,action,item,delete",
5936 "elm", _checkbox_item_select_cb, it);
5937 it->pad_left += pad * _elm_config->scale;
5941 edje_object_signal_emit(it->edit_obj, "elm,state,del,disable", "elm");
5943 edje_object_signal_callback_del(it->edit_obj, "elm,action,item,delete",
5944 "elm", _checkbox_item_select_cb);
5947 if ((it->wd->edit_mode) || (!it->wd->edit_mode && it->renamed))
5949 if (it->itc->func.icon_get)
5954 it->icons = elm_widget_stringlist_get(edje_object_data_get(it->edit_obj, "icons"));
5955 EINA_LIST_FOREACH(it->icons, l, key)
5957 Evas_Object *ic = it->itc->func.icon_get
5958 (it->base.data, it->base.widget, l->data);
5962 it->edit_icon_objs = eina_list_append(it->edit_icon_objs, ic);
5963 edje_object_part_swallow(it->edit_obj, key, ic);
5964 evas_object_show(ic);
5965 elm_widget_sub_object_add(it->base.widget, ic);
5971 _effect_item_controls(it,it->scrl_x, it->scrl_y);
5972 evas_object_show(it->edit_obj);
5974 it->effect_item_realized = EINA_TRUE;
5975 it->want_unrealize = EINA_FALSE;
5979 _effect_item_unrealize(Elm_Genlist_Item *it)
5981 Evas_Object *icon, *editfield;
5983 if (!it->effect_item_realized) return;
5984 if (it->wd->reorder_it && it->wd->reorder_it == it) return;
5986 it->pad_left = it->pad_right = 0;
5987 // evas_object_smart_callback_call(it->edit_obj, "unrealized", it);
5988 // _item_cache_add(it);
5989 evas_object_del(it->edit_obj);
5990 it->edit_obj = NULL;
5991 EINA_LIST_FREE(it->edit_icon_objs, icon)
5992 evas_object_del(icon);
5994 EINA_LIST_FREE(it->wd->edit_field, editfield)
5995 evas_object_del(editfield);
5997 edje_object_signal_emit(it->edit_obj, "elm,state,edit_end,disable", "elm");
5998 it->effect_item_realized = EINA_FALSE;
6002 elm_genlist_set_edit_mode(Evas_Object *obj, int emode, Elm_Genlist_Edit_Class *edit_class)
6004 fprintf(stderr, "=================> Caution!!! <========================\n");
6005 fprintf(stderr, "==> elm_genlist_set_edit_mode() is deprecated. <=======\n");
6006 fprintf(stderr, "==> Please use elm_genlist_edit_mode_set() instead. <==\n");
6007 fprintf(stderr, "=======================================================\n");
6009 elm_genlist_edit_mode_set(obj, emode, edit_class);
6013 * Set Genlist edit mode
6015 * This sets Genlist edit mode.
6017 * @param obj The Genlist object
6018 * @param emode ELM_GENLIST_EDIT_MODE_{NONE & REORDER & INSERT & DELETE & SELECT & SELECT_ALL}
6019 * @param edit_class Genlist edit class (Elm_Genlist_Edit_Class structure)
6024 elm_genlist_edit_mode_set(Evas_Object *obj, int emode, Elm_Genlist_Edit_Class *edit_class)
6026 ELM_CHECK_WIDTYPE(obj, widtype);
6029 Eina_Bool done = EINA_FALSE;
6030 static Elm_Genlist_Item_Class itc;
6032 Elm_Genlist_Item *it;
6034 Widget_Data *wd = elm_widget_data_get(obj);
6036 if (wd->edit_mode == emode) return;
6038 wd->edit_mode = emode;
6040 if (wd->edit_mode & ELM_GENLIST_EDIT_MODE_SELECTALL)
6041 wd->edit_mode |= ELM_GENLIST_EDIT_MODE_SELECT;
6044 if (wd->edit_mode == ELM_GENLIST_EDIT_MODE_NONE)
6046 EINA_INLIST_FOREACH(wd->blocks, itb)
6051 EINA_LIST_FOREACH(itb->items, l, it)
6053 if (it->flags != ELM_GENLIST_ITEM_GROUP && it->realized)
6055 it->pad_left = it->pad_right = 0;
6056 if (it->realized) _effect_item_unrealize(it);
6065 if (wd->ed) free (wd->ed);
6067 wd->reorder_mode = EINA_FALSE;
6068 if (wd->select_all_item)
6070 wd->select_all_check = EINA_FALSE;
6071 edje_object_signal_callback_del(wd->select_all_item->base.view, "elm,action,select,press", "elm", _select_all_down);
6072 elm_widget_item_pre_notify_del(wd->select_all_item);
6073 _item_unrealize(wd->select_all_item);
6074 elm_widget_item_del(wd->select_all_item);
6076 EINA_INLIST_FOREACH(wd->items, it)
6078 if (wd->select_all_check) it->edit_select_check = EINA_TRUE;
6079 else it->edit_select_check = EINA_FALSE;
6082 wd->select_all_item = NULL;
6086 if (wd->edit_mode & ELM_GENLIST_EDIT_MODE_REORDER)
6087 wd->reorder_mode = EINA_TRUE;
6090 wd->ed = calloc(1, sizeof(Edit_Data));
6092 wd->ed->ec = edit_class;
6094 EINA_INLIST_FOREACH(wd->blocks, itb)
6099 EINA_LIST_FOREACH(itb->items, l, it)
6101 if (it->flags != ELM_GENLIST_ITEM_GROUP && it->realized)
6103 if(it->selected) _item_unselect(it);
6104 _effect_item_realize(it);
6114 if (wd->edit_mode & ELM_GENLIST_EDIT_MODE_SELECTALL)
6116 if (edit_class->select_all_item_style && strcmp(edit_class->select_all_item_style, "default"))
6117 itc.item_style = edit_class->select_all_item_style;
6119 itc.item_style = "select_all";
6120 itc.func.label_get = NULL;
6121 itc.func.icon_get = NULL;
6122 itc.func.del = NULL;
6123 itc.func.editmode_get = NULL;
6124 wd->select_all_item = _item_new(wd, &itc, (void *)(edit_class->select_all_data), NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
6127 if (!wd->select_all_item) return;
6129 _item_realize(wd->select_all_item, 0, 0);
6130 edje_object_signal_callback_add(wd->select_all_item->base.view, "elm,action,select,press", "elm", _select_all_down, wd->select_all_item);
6132 wd->select_all_item->rel = NULL;
6133 wd->select_all_item->block = NULL;
6137 if (wd->calc_job) ecore_job_del(wd->calc_job);
6138 wd->calc_job = ecore_job_add(_calc_job, wd);
6142 * Delete selected items in genlist edit mode.
6144 * @param obj The genlist object
6149 elm_genlist_edit_selected_items_del(Evas_Object *obj)
6151 ELM_CHECK_WIDTYPE(obj, widtype);
6152 Widget_Data *wd = elm_widget_data_get(obj);
6154 if (!wd->blocks) return;
6155 Elm_Genlist_Item *it;
6156 Eina_List *edit_selected_list, *l;
6159 edit_selected_list = elm_genlist_edit_selected_items_get(obj);
6160 cnt = eina_list_count(edit_selected_list);
6161 printf("elm_genlist_edit_selected_items_del items selected counts = %d \n", cnt);
6163 EINA_LIST_FOREACH(edit_selected_list, l, it)
6165 elm_genlist_item_del(it);
6167 eina_list_free(edit_selected_list);
6169 evas_render(evas_object_evas_get(wd->obj));
6170 if (wd->calc_job) ecore_job_del(wd->calc_job);
6171 wd->calc_job = ecore_job_add(_calc_job, wd);
6175 elm_genlist_selected_items_del(Evas_Object *obj)
6177 fprintf(stderr, "=================> Caution!!! <========================\n");
6178 fprintf(stderr, "==> elm_genlist_selected_items_del() is deprecated. <=======\n");
6179 fprintf(stderr, "==> Please use elm_genlist_edit_selected_items_del() instead. <==\n");
6180 fprintf(stderr, "=======================================================\n");
6181 elm_genlist_edit_selected_items_del(obj);
6185 * Get a list of selected items in genlist
6187 * This returns a list of the selected items in the genlist. The list
6188 * contains Elm_Genlist_Item pointers. The list must be freed by the
6189 * caller when done with eina_list_free(). The item pointers in the list
6190 * are only vallid so long as those items are not deleted or the genlist is
6193 * @param obj The genlist object
6194 * @return The list of selected items, nor NULL if none are selected.
6199 elm_genlist_edit_selected_items_get(const Evas_Object *obj)
6201 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
6202 Widget_Data *wd = elm_widget_data_get(obj);
6203 Eina_List *list = NULL;
6204 Elm_Genlist_Item *it;
6205 if (!wd) return NULL;
6207 EINA_INLIST_FOREACH(wd->items, it)
6209 if (it->edit_select_check) list = eina_list_append(list, it);
6215 // TODO : add cooment
6217 elm_genlist_edit_item_select_set(Elm_Genlist_Item *it,
6220 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
6221 Widget_Data *wd = elm_widget_data_get(it->base.widget);
6223 selected = !!selected;
6224 if (it->edit_select_check == selected) return;
6226 it->edit_select_check = selected;
6227 _edit_item_checkbox_set(it, it->edit_select_check);
6228 _edit_subitems_checkbox_set(it);
6229 _edit_parent_items_checkbox_set(it);
6232 // TODO : add cooment
6234 elm_genlist_edit_item_select_get(const Elm_Genlist_Item *it)
6236 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
6237 return it->edit_select_check;
6241 * Set a given item's rename mode
6243 * This renames the item's label from genlist
6245 * @param it The item
6246 * @param emode set if emode is EINA_TRUE, unset if emode is EINA_FALSE
6251 elm_genlist_item_rename_mode_set(Elm_Genlist_Item *it, int emode)
6255 const Eina_List *l, *list, *l2;
6256 const char *label, *rename_swallow_part;
6258 Eina_Bool done = EINA_FALSE;
6259 int label_cnt = 0 , swallow_part_cnt = 0;
6262 Evas_Object *editfield;
6263 Evas_Object *entry = NULL;
6264 int edit_field_cnt = 0;
6267 EINA_INLIST_FOREACH(it->wd->blocks, itb)
6272 Elm_Genlist_Item *it;
6274 EINA_LIST_FOREACH(itb->items, l, it)
6278 it->renamed = EINA_FALSE;
6280 EINA_LIST_FOREACH(it->wd->edit_field, l2, editfield)
6282 entry = elm_editfield_entry_get(editfield);
6283 const char *text = elm_entry_entry_get(entry);
6285 if (it->itc->func.label_changed)
6286 it->itc->func.label_changed(it->base.data, it, text, edit_field_cnt++);
6288 Ecore_IMF_Context *imf = elm_entry_imf_context_get(entry);
6289 ecore_imf_context_input_panel_hide(imf);
6291 EINA_LIST_FREE(it->wd->edit_field, editfield)
6292 evas_object_del(editfield);
6294 if (it->wd->edit_mode)
6296 edje_object_signal_emit(it->edit_obj, "elm,state,edit_end,enable", "elm");
6297 edje_object_signal_emit(it->edit_obj, "elm,state,rename,disable", "elm");
6299 if(!it->wd->edit_mode) _effect_item_unrealize(it);
6300 elm_genlist_item_update(it);
6313 it->renamed = EINA_TRUE;
6314 if (it->wd->edit_mode == ELM_GENLIST_EDIT_MODE_NONE)
6316 it->wd->edit_mode = 0xF0;
6317 _effect_item_realize(it);
6318 it->wd->edit_mode = ELM_GENLIST_EDIT_MODE_NONE;
6321 EINA_LIST_FOREACH(it->labels, list, label)
6323 edje_object_signal_emit(it->edit_obj, "elm,state,rename,enable", "elm");
6324 edje_object_signal_emit(it->edit_obj, "elm,state,ins,disable", "elm");
6325 edje_object_signal_emit(it->edit_obj, "elm,state,del,disable", "elm");
6326 edje_object_signal_emit(it->edit_obj, "elm,state,edit_end,disable", "elm");
6328 if (it->itc->func.label_get)
6330 swallow_part_cnt = 0;
6332 Eina_List *rename = elm_widget_stringlist_get(edje_object_data_get(it->edit_obj, "rename"));
6333 EINA_LIST_FOREACH(rename, l, rename_swallow_part)
6335 if (label_cnt == swallow_part_cnt)
6337 editfield = elm_editfield_add(it->base.widget);
6338 it->wd->edit_field = eina_list_append(it->wd->edit_field, editfield);
6340 elm_editfield_entry_single_line_set(editfield, EINA_TRUE);
6341 elm_editfield_eraser_set(editfield, EINA_TRUE);
6342 edje_object_part_swallow(it->edit_obj, rename_swallow_part, editfield);
6343 elm_widget_sub_object_add(it->edit_obj, editfield);
6345 evas_object_show(editfield);
6347 s = it->itc->func.label_get((void *)it->base.data, it->base.widget, list->data);
6350 Evas_Object *entry = elm_editfield_entry_get(editfield);
6351 elm_entry_entry_set(entry,s);
6355 elm_editfield_guide_text_set(editfield, "Text Input");
6366 static void _sweep_finish(void *data, Evas_Object *o, const char *emission, const char *source)
6368 Elm_Genlist_Item *it = data;
6370 _delete_sweep_objs(it);
6374 _scr_hold_timer_cb(void *data)
6376 Elm_Genlist_Item *it = data;
6377 elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
6378 it->wd->scr_hold_timer = NULL;
6379 return ECORE_CALLBACK_CANCEL;
6383 _delete_sweep_objs(Elm_Genlist_Item *it)
6387 elm_widget_stringlist_free(it->sweep_labels);
6388 it->sweep_labels = NULL;
6389 elm_widget_stringlist_free(it->sweep_icons);
6390 it->sweep_icons = NULL;
6391 EINA_LIST_FREE(it->sweep_icon_objs, ic)
6392 evas_object_del(ic);
6396 _create_sweep_objs(Elm_Genlist_Item *it)
6402 if (it->itc->func.label_get)
6405 elm_widget_stringlist_get(edje_object_data_get(it->base.view,
6407 EINA_LIST_FOREACH(it->sweep_labels, l, key)
6409 char *s = it->itc->func.label_get
6410 ((void *)it->base.data, it->base.widget, l->data);
6414 edje_object_part_text_set(it->base.view, l->data, s);
6419 if (it->itc->func.icon_get)
6422 elm_widget_stringlist_get(edje_object_data_get(it->base.view,
6424 EINA_LIST_FOREACH(it->sweep_icons, l, key)
6426 ic = it->itc->func.icon_get
6427 ((void *)it->base.data, it->base.widget, l->data);
6431 it->sweep_icon_objs = eina_list_append(it->sweep_icon_objs, ic);
6432 edje_object_part_swallow(it->base.view, key, ic);
6433 evas_object_show(ic);
6434 elm_widget_sub_object_add(it->base.widget, ic);
6441 _item_slide(Elm_Genlist_Item *it, Eina_Bool slide_to_right)
6444 Elm_Genlist_Item *it2;
6445 const char *allow_slide;
6447 allow_slide = edje_object_data_get(it->base.view, "allow_slide");
6448 if ((!allow_slide) || (atoi(allow_slide) != 1))
6453 if (it->sweeped) return;
6454 if (it->wd->scr_hold_timer)
6456 ecore_timer_del(it->wd->scr_hold_timer);
6457 it->wd->scr_hold_timer = NULL;
6459 elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
6460 it->wd->scr_hold_timer = ecore_timer_add(0.1, _scr_hold_timer_cb, it);
6462 _delete_sweep_objs(it);
6463 _create_sweep_objs(it);
6464 edje_object_signal_emit(it->base.view, "elm,state,slide,right", "elm");
6465 it->wd->sweeped_items = eina_list_append(it->wd->sweeped_items, it);
6466 it->wassweeped = EINA_TRUE;
6467 it->sweeped = EINA_TRUE;
6469 EINA_LIST_FOREACH(it->wd->sweeped_items, l, it2)
6473 it2->sweeped = EINA_FALSE;
6474 edje_object_signal_emit(it2->base.view, "elm,state,slide,left", "elm");
6475 edje_object_signal_callback_add(it2->base.view, "elm,action,sweep,left,finish", "elm", _sweep_finish, it2);
6476 it2->wd->sweeped_items = eina_list_remove(it2->wd->sweeped_items, it2);
6482 if (!it->sweeped) return;
6483 edje_object_signal_emit(it->base.view, "elm,state,slide,left", "elm");
6484 edje_object_signal_callback_add(it->base.view, "elm,action,sweep,left,finish", "elm", _sweep_finish, it);
6485 it->wd->sweeped_items = eina_list_remove(it->wd->sweeped_items, it);
6486 it->sweeped = EINA_FALSE;