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 // TIZEN_ONLY(20180326) : Atspi: enhance finding next and prev item on screen's edge
210 int scroll_delta_y_backup;
212 Elm_Gen_Item *aligned_item;
213 //TIZEN_ONLY(20161104) : Accessibility : synchronized highlight of atspi and item align feature for wearable profile
214 Elm_Gen_Item *currently_highlighted_item;
217 Eina_List *filter_queue;
218 Eina_List *filtered_list;
220 unsigned int processed_count;
221 unsigned int filtered_count;
222 Ecore_Idle_Enterer *queue_filter_enterer;
224 Elm_Genlist_Item_Scrollto_Type focus_scrollto_type;
226 Eina_Bool unhighlight_skip: 1;
227 Elm_Gen_Item *adjusted_item;
228 Eina_Bool bottom_margin_enabled : 1;
229 Eina_Bool unhighlighted : 1;
230 Evas_Object *focus_bg;
232 Eina_Bool focus_on_selection_enabled : 1;
235 typedef struct _Item_Block Item_Block;
236 typedef struct _Item_Cache Item_Cache;
237 typedef struct _Elm_Genlist_Filter Elm_Genlist_Filter;
239 struct Elm_Gen_Item_Type
243 Elm_Genlist_Data *wsd;
247 Evas_Coord w, h, minw, minh;
248 Elm_Gen_Item *group_item;
249 Elm_Genlist_Item_Type type;
250 Eina_List *deco_it_texts, *deco_it_contents;
251 Eina_List *deco_all_texts, *deco_all_contents;
252 Eina_List *flip_contents, *flip_content_objs;
253 Ecore_Timer *swipe_timer;
254 Evas_Coord scrl_x, scrl_y, old_scrl_y;
257 Eina_List *rel_revs; // FIXME: find better way not to use this
258 Evas_Object *deco_it_view;
262 // TIZEN ONLY(20150701) : Banded Color UX Feature
263 int banded_color_index;
264 Evas_Object *banded_bg;
265 Ecore_Animator *banded_anim;
268 Eina_Bool decorate_all_item_realized : 1;
269 Eina_Bool tree_effect_finished : 1; /* tree effect */
270 Eina_Bool move_effect_enabled : 1;
271 Eina_Bool tree_effect_hide_me : 1; /* item hide for
274 Eina_Bool stacking_even : 1;
275 Eina_Bool want_realize : 1;
276 Eina_Bool nocache_once : 1; /* do not use cache for
277 * this item only once */
278 Eina_Bool nostacking : 1;
279 Eina_Bool expanded : 1;
280 Eina_Bool mincalcd : 1;
281 Eina_Bool updateme : 1;
282 Eina_Bool nocache : 1; /* do not use cache for this item */
283 Eina_Bool queued : 1;
284 Eina_Bool before : 1;
285 Eina_Bool show_me : 1;
287 Eina_Bool is_prepend : 1;
288 Eina_Bool calc_done : 1;
290 Evas_Coord reorder_offset;
292 Ecore_Timer *highlight_timer;
293 Eina_Bool multiline : 1;
294 Eina_Bool resized : 1;
306 Elm_Genlist_Data *sd;
308 Evas_Coord x, y, w, h, minw, minh;
310 int item_position_stamp;
312 Eina_Bool position_update : 1;
313 Eina_Bool want_unrealize : 1;
314 Eina_Bool must_recalc : 1;
315 Eina_Bool realized : 1;
316 Eina_Bool updateme : 1;
317 Eina_Bool changed : 1;
318 Eina_Bool show_me : 1;
320 Eina_Bool calc_done : 1;
327 Evas_Object *base_view, *spacer;
329 const Elm_Genlist_Item_Class *item_class; // it->itc
331 Eina_Bool selected : 1; // it->selected
332 Eina_Bool disabled : 1; // it->disabled
333 Eina_Bool expanded : 1; // it->item->expanded
334 Eina_Bool tree : 1; // it->group
335 Eina_List *contents; // content objects for reusing
338 typedef struct _Elm_Genlist_Pan_Data Elm_Genlist_Pan_Data;
339 struct _Elm_Genlist_Pan_Data
342 Elm_Genlist_Data *wsd;
343 Ecore_Job *resize_job;
347 * Structure added to genlist for internal filter iterator implementation
348 * Can be extended to genlist as a whole in future if needed.
350 struct _Elm_Genlist_Filter
352 Eina_Iterator iterator;
353 const Eina_Inlist *head;
354 const Eina_Inlist *current;
362 #define GL_IT(_it) (_it->item)
364 #define ELM_GENLIST_DATA_GET(o, sd) \
365 Elm_Genlist_Data * sd = eo_data_scope_get(o, ELM_GENLIST_CLASS)
367 #define ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd) \
368 Elm_Genlist_Data * sd = GL_IT(it)->wsd
370 #define ELM_GENLIST_PAN_DATA_GET(o, sd) \
371 Elm_Genlist_Pan_Data * sd = eo_data_scope_get(o, ELM_GENLIST_PAN_CLASS)
373 #define ELM_GENLIST_DATA_GET_OR_RETURN(o, ptr) \
374 ELM_GENLIST_DATA_GET(o, ptr); \
375 if (EINA_UNLIKELY(!ptr)) \
377 CRI("No widget data for object %p (%s)", \
378 o, evas_object_type_get(o)); \
382 #define ELM_GENLIST_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
383 ELM_GENLIST_DATA_GET(o, ptr); \
384 if (EINA_UNLIKELY(!ptr)) \
386 CRI("No widget data for object %p (%s)", \
387 o, evas_object_type_get(o)); \
391 #define ELM_GENLIST_CHECK(obj) \
392 if (EINA_UNLIKELY(!eo_isa((obj), ELM_GENLIST_CLASS))) \
395 #define ELM_GENLIST_ITEM_CHECK(it) \
396 ELM_WIDGET_ITEM_CHECK_OR_RETURN(it->base, ); \
397 ELM_GENLIST_CHECK(it->base->widget);
399 #define ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, ...) \
400 ELM_WIDGET_ITEM_CHECK_OR_RETURN(it->base, __VA_ARGS__); \
401 ELM_GENLIST_CHECK(it->base->widget) __VA_ARGS__;
403 #define ELM_GENLIST_ITEM_CHECK_OR_GOTO(it, label) \
404 ELM_WIDGET_ITEM_CHECK_OR_GOTO(it->base, label); \
405 if (!it->base->widget || !eo_isa \
406 ((it->base->widget), ELM_GENLIST_CLASS)) goto label;
408 #define ELM_GENLIST_ITEM_DATA_GET(o, sd) \
409 Elm_Gen_Item* sd = eo_data_scope_get(o, ELM_GENLIST_ITEM_CLASS)
411 #define ELM_GENLIST_FILTER_ITERATOR_ITEM_GET(ptr, \
412 type) ((type *)((char *)ptr - \
413 offsetof(type, __in_list)))