1 #ifndef ELM_WIDGET_GENLIST_H
2 #define ELM_WIDGET_GENLIST_H
4 #include "elm_gen_common.h"
5 #include "Elementary.h"
6 #define BANDED_MAX_ITEMS 20
8 /* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR
9 * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT
10 * FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK
19 * @section elm-genlist-class The Elementary Genlist Class
21 * Elementary, besides having the @ref Elm_Genlist widget, exposes its
22 * foundation -- the Elementary Genlist Class -- in order to create
23 * other widgets which are a genlist with some more logic on top.
27 * Base widget smart data extended with genlist instance data.
29 typedef struct _Elm_Genlist_Data Elm_Genlist_Data;
33 ELM_GENLIST_TREE_EFFECT_NONE = 0,
34 ELM_GENLIST_TREE_EFFECT_EXPAND = 1,
35 ELM_GENLIST_TREE_EFFECT_CONTRACT = 2
36 } Elm_Genlist_Item_Move_Effect_Mode;
38 struct _Elm_Genlist_Data
40 Eina_Inlist_Sorted_State *state;
41 Evas_Object *hit_rect;
44 Evas_Object *focused_content;
45 Elm_Gen_Item *focused_item;
47 //Evas_Object *stack[2]; // stacking markers in pan
48 Evas_Object *obj; // the object itself
50 Eina_List *selected; /* a list of
53 //Eina_List *deselecting; /* a list of items currently being deselected */
54 Eina_List *group_items; /* a list of
57 Eina_Inlist *items; /* an inlist of all items */
58 //Elm_Gen_Item *reorder_it; /* item currently
66 Eina_List *move_items;
70 Elm_Object_Item *last_selected_item;
73 Eina_Bool scr_minw : 1;
74 Eina_Bool scr_minh : 1;
75 unsigned int item_count;
76 Evas_Coord pan_x, pan_y;
77 Elm_Object_Select_Mode select_mode;
81 Eina_List *blocks_realized;
82 Eina_Inlist *blocks; /* an inlist of all
89 * 'max_items_per_block'. */
90 Evas_Coord prev_viewport_w;
91 Ecore_Idle_Enterer *queue_idle_enterer;
93 Elm_Gen_Item *show_item, *mode_item, *expanded_item;
94 Eina_Inlist *item_cache; /* an inlist of
99 Ecore_Timer *scr_hold_timer;
100 const char *decorate_it_type;
102 Evas_Coord prev_x, prev_y, prev_mx, prev_my;
103 Evas_Coord cur_x, cur_y, cur_mx, cur_my;
105 int item_cache_count;
106 int item_cache_max; /* maximum
110 /* maximum number of items per block */
111 int max_items_per_block;
113 /* longpress timeout. this value comes from _elm_config by
114 * default. this can be changed by
115 * elm_genlist_longpress_timeout_set() */
116 double longpress_timeout;
117 Eina_Compare_Cb item_compare_cb;
118 Eina_Compare_Cb item_compare_data_cb;
120 /* a scrollto type which remembers where to scroll ex) in, top,
122 Elm_Genlist_Item_Scrollto_Type scroll_to_type;
124 Evas_Object *g_layer;
125 Elm_Gen_Item *g_item;
127 Eina_Bool select_on_focus_enabled : 1;
128 Eina_Bool decorate_all_mode : 1;
129 Eina_Bool reorder_mode : 1; /* a flag
134 Eina_Bool reorder_force : 1; /* a flag
138 /* this flag means genlist is supposed to be scrolled. if this flag
139 * is set to EINA_TRUE, genlist checks whether it's ok to scroll
140 * genlist now or not. */
142 Eina_Bool homogeneous : 1;
143 Eina_Bool realization_mode : 1;
144 Eina_Hash *size_caches;
146 Eina_Bool on_sub_del : 1;
148 /* a flag for items can be highlighted or not. by default this flag
150 Eina_Bool highlight : 1;
151 Eina_Bool h_bounce : 1;
152 Eina_Bool v_bounce : 1;
153 Eina_Bool bring_in : 1; /* a flag to
159 /* this is set to EINA_TRUE when the item is re-queued. this
160 * happens when the item is un-queued but the rel item is still in
161 * the queue. this item will be processed later. */
162 Eina_Bool requeued : 1;
163 Eina_Bool multi : 1; /* a flag for item
166 Eina_Bool sorting : 1;
167 Evas_Coord finger_minw, finger_minh;
169 Eina_Bool calc_done : 1;
170 Eina_Bool was_selected : 1;
171 Ecore_Job *dummy_job;
172 Ecore_Timer *scr_timer;
173 Eina_Bool no_cache : 1;
174 Elm_Gen_Item *key_down_item;
175 Eina_Bool on_hold : 1; /* a flag for check
179 /* this is genlist item Fx effect on Add/Remove */
180 Eina_Bool fx_mode : 1;
184 Eina_List *pending_items;
185 Ecore_Animator *anim;
191 Ecore_Animator *anim;
195 // TIZEN ONLY(20150701) : Banded Color UX Feature
197 Elm_Gen_Item *top_drawn_item;
198 Evas_Object *banded_bg_rect; /* banded color
202 Eina_Bool banded_bg_on : 1;
205 Eina_Bool is_access : 1;
206 Elm_Gen_Item *highlighted_item;
207 Evas_Coord viewport_w, viewport_h;
208 Elm_Gen_Item *atspi_item_to_highlight;
209 Elm_Gen_Item *aligned_item;
210 //TIZEN_ONLY(20161104) : Accessibility : synchronized highlight of atspi and item align feature for wearable profile
211 Elm_Gen_Item *currently_highlighted_item;
214 Eina_List *filter_queue;
215 Eina_List *filtered_list;
217 unsigned int processed_count;
218 unsigned int filtered_count;
219 Ecore_Idle_Enterer *queue_filter_enterer;
221 Elm_Genlist_Item_Scrollto_Type focus_scrollto_type;
223 Eina_Bool unhighlight_skip: 1;
224 Elm_Gen_Item *adjusted_item;
225 Eina_Bool bottom_margin_enabled : 1;
226 Eina_Bool unhighlighted : 1;
227 Evas_Object *focus_bg;
229 Eina_Bool focus_on_selection_enabled : 1;
232 typedef struct _Item_Block Item_Block;
233 typedef struct _Item_Cache Item_Cache;
234 typedef struct _Elm_Genlist_Filter Elm_Genlist_Filter;
236 struct Elm_Gen_Item_Type
240 Elm_Genlist_Data *wsd;
244 Evas_Coord w, h, minw, minh;
245 Elm_Gen_Item *group_item;
246 Elm_Genlist_Item_Type type;
247 Eina_List *deco_it_texts, *deco_it_contents;
248 Eina_List *deco_all_texts, *deco_all_contents;
249 Eina_List *flip_contents, *flip_content_objs;
250 Ecore_Timer *swipe_timer;
251 Evas_Coord scrl_x, scrl_y, old_scrl_y;
254 Eina_List *rel_revs; // FIXME: find better way not to use this
255 Evas_Object *deco_it_view;
259 // TIZEN ONLY(20150701) : Banded Color UX Feature
260 int banded_color_index;
261 Evas_Object *banded_bg;
262 Ecore_Animator *banded_anim;
265 Eina_Bool decorate_all_item_realized : 1;
266 Eina_Bool tree_effect_finished : 1; /* tree effect */
267 Eina_Bool move_effect_enabled : 1;
268 Eina_Bool tree_effect_hide_me : 1; /* item hide for
271 Eina_Bool stacking_even : 1;
272 Eina_Bool want_realize : 1;
273 Eina_Bool nocache_once : 1; /* do not use cache for
274 * this item only once */
275 Eina_Bool nostacking : 1;
276 Eina_Bool expanded : 1;
277 Eina_Bool mincalcd : 1;
278 Eina_Bool updateme : 1;
279 Eina_Bool nocache : 1; /* do not use cache for this item */
280 Eina_Bool queued : 1;
281 Eina_Bool before : 1;
282 Eina_Bool show_me : 1;
284 Eina_Bool is_prepend : 1;
285 Eina_Bool calc_done : 1;
287 Evas_Coord reorder_offset;
289 Ecore_Timer *highlight_timer;
290 Eina_Bool multiline : 1;
291 Eina_Bool resized : 1;
303 Elm_Genlist_Data *sd;
305 Evas_Coord x, y, w, h, minw, minh;
307 int item_position_stamp;
309 Eina_Bool position_update : 1;
310 Eina_Bool want_unrealize : 1;
311 Eina_Bool must_recalc : 1;
312 Eina_Bool realized : 1;
313 Eina_Bool updateme : 1;
314 Eina_Bool changed : 1;
315 Eina_Bool show_me : 1;
317 Eina_Bool calc_done : 1;
324 Evas_Object *base_view, *spacer;
326 const Elm_Genlist_Item_Class *item_class; // it->itc
328 Eina_Bool selected : 1; // it->selected
329 Eina_Bool disabled : 1; // it->disabled
330 Eina_Bool expanded : 1; // it->item->expanded
331 Eina_Bool tree : 1; // it->group
332 Eina_List *contents; // content objects for reusing
335 typedef struct _Elm_Genlist_Pan_Data Elm_Genlist_Pan_Data;
336 struct _Elm_Genlist_Pan_Data
339 Elm_Genlist_Data *wsd;
340 Ecore_Job *resize_job;
344 * Structure added to genlist for internal filter iterator implementation
345 * Can be extended to genlist as a whole in future if needed.
347 struct _Elm_Genlist_Filter
349 Eina_Iterator iterator;
350 const Eina_Inlist *head;
351 const Eina_Inlist *current;
359 #define GL_IT(_it) (_it->item)
361 #define ELM_GENLIST_DATA_GET(o, sd) \
362 Elm_Genlist_Data * sd = eo_data_scope_get(o, ELM_GENLIST_CLASS)
364 #define ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd) \
365 Elm_Genlist_Data * sd = GL_IT(it)->wsd
367 #define ELM_GENLIST_PAN_DATA_GET(o, sd) \
368 Elm_Genlist_Pan_Data * sd = eo_data_scope_get(o, ELM_GENLIST_PAN_CLASS)
370 #define ELM_GENLIST_DATA_GET_OR_RETURN(o, ptr) \
371 ELM_GENLIST_DATA_GET(o, ptr); \
372 if (EINA_UNLIKELY(!ptr)) \
374 CRI("No widget data for object %p (%s)", \
375 o, evas_object_type_get(o)); \
379 #define ELM_GENLIST_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
380 ELM_GENLIST_DATA_GET(o, ptr); \
381 if (EINA_UNLIKELY(!ptr)) \
383 CRI("No widget data for object %p (%s)", \
384 o, evas_object_type_get(o)); \
388 #define ELM_GENLIST_CHECK(obj) \
389 if (EINA_UNLIKELY(!eo_isa((obj), ELM_GENLIST_CLASS))) \
392 #define ELM_GENLIST_ITEM_CHECK(it) \
393 ELM_WIDGET_ITEM_CHECK_OR_RETURN(it->base, ); \
394 ELM_GENLIST_CHECK(it->base->widget);
396 #define ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, ...) \
397 ELM_WIDGET_ITEM_CHECK_OR_RETURN(it->base, __VA_ARGS__); \
398 ELM_GENLIST_CHECK(it->base->widget) __VA_ARGS__;
400 #define ELM_GENLIST_ITEM_CHECK_OR_GOTO(it, label) \
401 ELM_WIDGET_ITEM_CHECK_OR_GOTO(it->base, label); \
402 if (!it->base->widget || !eo_isa \
403 ((it->base->widget), ELM_GENLIST_CLASS)) goto label;
405 #define ELM_GENLIST_ITEM_DATA_GET(o, sd) \
406 Elm_Gen_Item* sd = eo_data_scope_get(o, ELM_GENLIST_ITEM_CLASS)
408 #define ELM_GENLIST_FILTER_ITERATOR_ITEM_GET(ptr, \
409 type) ((type *)((char *)ptr - \
410 offsetof(type, __in_list)))