2012-07-31 15:06:06 -07:00
# ifndef ELM_WIDGET_GENLIST_H
# define ELM_WIDGET_GENLIST_H
# include "elm_gen_common.h"
2012-11-25 22:32:53 -08:00
# include "Elementary.h"
2012-07-31 15:06:06 -07:00
2014-08-07 09:26:47 -07:00
/* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR
* CODE . THIS IS ELEMENTARY ' S INTERNAL WIDGET API ( for now ) AND IS NOT
* FINAL . CALL elm_widget_api_check ( ELM_INTERNAL_API_VERSION ) TO CHECK
* IT AT RUNTIME .
*/
2012-07-31 15:06:06 -07:00
/**
* @ addtogroup Widget
* @ {
*
* @ section elm - genlist - class The Elementary Genlist Class
*
* Elementary , besides having the @ ref Genlist widget , exposes its
* foundation - - the Elementary Genlist Class - - in order to create
* other widgets which are a genlist with some more logic on top .
*/
/**
* Base widget smart data extended with genlist instance data .
*/
2014-04-01 03:55:08 -07:00
typedef struct _Elm_Genlist_Data Elm_Genlist_Data ;
2012-07-31 15:06:06 -07:00
typedef enum
{
ELM_GENLIST_TREE_EFFECT_NONE = 0 ,
ELM_GENLIST_TREE_EFFECT_EXPAND = 1 ,
ELM_GENLIST_TREE_EFFECT_CONTRACT = 2
} Elm_Genlist_Item_Move_Effect_Mode ;
2014-04-01 03:55:08 -07:00
struct _Elm_Genlist_Data
2012-07-31 15:06:06 -07:00
{
Eina_Inlist_Sorted_State * state ;
Evas_Object * hit_rect ;
Evas_Object * pan_obj ;
2013-06-22 23:17:39 -07:00
Evas_Object * stack [ 2 ] ; // stacking markers in pan
2012-11-25 22:32:53 -08:00
Evas_Object * obj ; // the object itself
2012-07-31 15:06:06 -07:00
Eina_List * selected ; /* a list of
* selected
* items */
2014-03-23 07:37:47 -07:00
Eina_List * deselecting ; /* a list of items currently being deselected */
2012-07-31 15:06:06 -07:00
Eina_List * group_items ; /* a list of
* groups index
* items */
Eina_Inlist * items ; /* an inlist of all items */
Elm_Gen_Item * reorder_it ; /* item currently
* being
* repositioned */
Elm_Object_Item * last_selected_item ;
2014-03-08 08:04:34 -08:00
Elm_Object_Item * focused_item ; /**< a focused item by keypad arrow or mouse. This is set to NULL if widget looses focus. */
Elm_Object_Item * last_focused_item ; /**< This records the last focused item when widget looses focus. This is required to set the focus on last focused item when widgets gets focus. */
2012-07-31 15:06:06 -07:00
Ecore_Job * calc_job ;
2013-04-17 09:30:34 -07:00
int walking ;
2012-07-31 15:06:06 -07:00
int minw , minh ;
unsigned int item_count ;
Evas_Coord pan_x , pan_y ;
Elm_Object_Select_Mode select_mode ;
2013-11-03 06:58:57 -08:00
Elm_Object_Multi_Select_Mode multi_select_mode ; /**< select mode for multiple selection */
2012-07-31 15:06:06 -07:00
Eina_Inlist * blocks ; /* an inlist of all
* blocks . a block
* consists of a
* certain number of
* items . maximum
* number of items in
* a block is
* ' max_items_per_block ' . */
2013-04-02 18:42:51 -07:00
Evas_Coord reorder_old_pan_y , w , h , realminw ;
Evas_Coord prev_viewport_w ; /* previous scrollable
* interface ' s
* viewport size .
* This is used only
* when genlist is in
* a compress mode . */
2012-07-31 15:06:06 -07:00
Ecore_Job * update_job ;
Ecore_Idle_Enterer * queue_idle_enterer ;
Ecore_Idler * must_recalc_idler ;
Eina_List * queue ;
Elm_Gen_Item * show_item , * anchor_item , * mode_item ,
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
* reorder_rel , * expanded_item , * pin_item ;
2012-07-31 15:06:06 -07:00
Eina_Inlist * item_cache ; /* an inlist of
* edje object it
* cache . */
Evas_Coord anchor_y ;
Evas_Coord reorder_start_y ; /* reorder
* it ' s
* initial y
* coordinate
* in the
* pan . */
Elm_List_Mode mode ;
Ecore_Timer * multi_timer , * scr_hold_timer ;
Ecore_Animator * reorder_move_animator ;
const char * decorate_it_type ;
double start_time ;
Evas_Coord prev_x , prev_y , prev_mx , prev_my ;
Evas_Coord cur_x , cur_y , cur_mx , cur_my ;
struct
{
Evas_Coord x , y ;
} history [ SWIPE_MOVES ] ;
int multi_device ;
int item_cache_count ;
2013-01-25 23:11:38 -08:00
/* maximum number of cached items. (max_items_per_block * 2) */
int item_cache_max ;
2012-07-31 15:06:06 -07:00
int movements ;
/* maximum number of items per block */
int max_items_per_block ;
/* longpress timeout. this value comes from _elm_config by
* default . this can be changed by
* elm_genlist_longpress_timeout_set ( ) */
double longpress_timeout ;
Eina_Compare_Cb item_compare_cb ;
Eina_Compare_Cb item_compare_data_cb ;
/* a scrollto type which remembers where to scroll ex) in, top,
* middle */
Elm_Genlist_Item_Scrollto_Type scroll_to_type ;
2014-03-08 11:46:24 -08:00
Evas_Object * event_block_rect ; /**< This object blocks the event in some cases. For example, when the tree effect is running and not finished, this object blocks events to the genlist. */
2012-07-31 15:06:06 -07:00
Eina_List * move_items ; /* items move for
* tree effect */
Elm_Gen_Item * expanded_next_item ;
Elm_Genlist_Item_Move_Effect_Mode move_effect_mode ;
2014-04-23 07:02:57 -07:00
int reorder_fast ;
2012-07-31 15:06:06 -07:00
2015-09-23 04:50:05 -07:00
Eina_List * filter_queue ;
Eina_List * filtered_list ;
void * filter_data ;
unsigned int processed_count ;
unsigned int filtered_count ;
2017-02-21 20:53:03 -08:00
unsigned int top_level_parent_items ;
2015-09-23 04:50:05 -07:00
Ecore_Idle_Enterer * queue_filter_enterer ;
2015-12-01 23:23:39 -08:00
Eina_Hash * size_caches ;
2015-09-23 04:50:05 -07:00
2017-11-11 09:26:53 -08:00
Eina_Hash * content_item_map ;
Eo * provider ;
2018-03-11 13:08:42 -07:00
Elm_Gen_Item * focus_on_realization ;
2017-11-11 09:26:53 -08:00
2018-05-29 21:37:35 -07:00
Eina_Bool scr_minw : 1 ; /* a flag for determining
* minimum width to limit
* as their content size */
Eina_Bool scr_minh : 1 ; /* a flag for determining
* minimum height to limit
* as their content size */
2018-05-29 21:44:34 -07:00
Eina_Bool filter : 1 ;
2013-02-20 02:00:49 -08:00
Eina_Bool focus_on_selection_enabled : 1 ;
2012-07-31 15:06:06 -07:00
Eina_Bool tree_effect_enabled : 1 ;
Eina_Bool auto_scroll_enabled : 1 ;
Eina_Bool decorate_all_mode : 1 ;
Eina_Bool height_for_width : 1 ;
Eina_Bool reorder_pan_move : 1 ;
Eina_Bool multi_timeout : 1 ;
Eina_Bool multi_touched : 1 ;
Eina_Bool reorder_mode : 1 ; /* a flag
* for
* reorder
* mode
* enable / disable */
/* this flag means genlist is supposed to be scrolled. if this flag
2014-08-13 03:50:38 -07:00
* is set to @ c EINA_TRUE , genlist checks whether it ' s ok to scroll
2012-07-31 15:06:06 -07:00
* genlist now or not . */
Eina_Bool check_scroll : 1 ;
Eina_Bool pan_changed : 1 ;
Eina_Bool wasselected : 1 ;
Eina_Bool homogeneous : 1 ;
Eina_Bool longpressed : 1 ;
/* a flag for items can be highlighted or not. by default this flag
* is true . */
Eina_Bool mouse_down : 1 ;
Eina_Bool multi_down : 1 ;
Eina_Bool on_sub_del : 1 ;
Eina_Bool highlight : 1 ;
Eina_Bool h_bounce : 1 ;
Eina_Bool v_bounce : 1 ;
Eina_Bool bring_in : 1 ; /* a flag to
* describe the
* scroll
* animation . ( show ,
* bring in ) */
2014-08-13 03:50:38 -07:00
/* this is set to @c EINA_TRUE when the item is re-queued. this
2012-07-31 15:06:06 -07:00
* happens when the item is un - queued but the rel item is still in
* the queue . this item will be processed later . */
Eina_Bool requeued : 1 ;
Eina_Bool on_hold : 1 ;
Eina_Bool multi : 1 ; /* a flag for item
* multi
* selection */
Eina_Bool swipe : 1 ;
2014-04-23 22:12:52 -07:00
/**< value whether item loop feature is enabled or not. */
Eina_Bool item_loop_enable : 1 ;
2014-07-21 23:11:17 -07:00
Eina_Bool item_looping_on : 1 ;
2016-01-28 17:07:34 -08:00
Eina_Bool tree_effect_animator : 1 ;
Genlist Item Pin Feature
Summary:
**@feature** T6241
This feature enables genlist to pin an item to viewport which will
be available always for user to view/select.
**Use Case**:
In a big list of music, most times when user finds a song which they
like, before playing that they may want to go through the entire list
to check whether there is some other good songs, but
after seeing the entire list user have to again scroll back to the
position of item which they liked to play it then.
In this case item pinning can be used, so that the item
which they want to keep for future selection can be pinned
and then it will remain in viewport, finally when user want to do
operation on item, it will be readily available in viewport.
Signed-off-by: Godly T.Alias <godlytalias@yahoo.co.in>
Test Plan: Elementary Test -> Genlist -> Double click on items to enable/disable pinning
Reviewers: raster, cedric, prince.dubey, SanghyeonLee
Subscribers: rajeshps, jpeg, shilpasingh
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D5340
2017-11-01 00:11:30 -07:00
Eina_Bool pin_item_top : 1 ;
2012-07-31 15:06:06 -07:00
} ;
typedef struct _Item_Block Item_Block ;
typedef struct _Item_Cache Item_Cache ;
2015-12-01 23:23:39 -08:00
typedef struct _Item_Size Item_Size ;
2012-07-31 15:06:06 -07:00
struct Elm_Gen_Item_Type
{
Elm_Gen_Item * it ;
2014-04-01 03:55:08 -07:00
Elm_Genlist_Data * wsd ;
2012-07-31 15:06:06 -07:00
Item_Block * block ;
Eina_List * items ;
Evas_Coord w , h , minw , minh ;
Elm_Gen_Item * group_item ;
Elm_Genlist_Item_Type type ;
2015-01-10 00:27:48 -08:00
Eina_List * deco_it_texts , * deco_it_contents ;
Eina_List * deco_all_texts , * deco_all_contents ;
2015-01-01 23:48:29 -08:00
Eina_List * flip_contents ;
2012-07-31 15:06:06 -07:00
Ecore_Timer * swipe_timer ;
Evas_Coord scrl_x , scrl_y , old_scrl_y ;
Elm_Gen_Item * rel ;
2013-03-29 06:23:38 -07:00
Eina_List * rel_revs ; // FIXME: find better way not to use this
2012-07-31 15:06:06 -07:00
Evas_Object * deco_it_view ;
int expanded_depth ;
2017-02-23 00:10:16 -08:00
int order_num_in ; // Written by _item_order_update()
2012-07-31 15:06:06 -07:00
Eina_Bool decorate_all_item_realized : 1 ;
Eina_Bool tree_effect_finished : 1 ; /* tree effect */
Eina_Bool move_effect_enabled : 1 ;
Eina_Bool tree_effect_hide_me : 1 ; /* item hide for
* tree effect */
Eina_Bool stacking_even : 1 ;
Eina_Bool want_realize : 1 ;
Eina_Bool nocache_once : 1 ; /* do not use cache for
* this item only once */
Eina_Bool nostacking : 1 ;
Eina_Bool expanded : 1 ;
Eina_Bool mincalcd : 1 ;
Eina_Bool updateme : 1 ;
Eina_Bool nocache : 1 ; /* do not use cache for this item */
Eina_Bool queued : 1 ;
Eina_Bool before : 1 ;
Eina_Bool show_me : 1 ;
} ;
struct _Item_Block
{
EINA_INLIST ;
int count ;
2017-02-23 00:10:16 -08:00
int vis_count ;
2012-07-31 15:06:06 -07:00
int num ;
int reorder_offset ;
2014-04-01 03:55:08 -07:00
Elm_Genlist_Data * sd ;
2012-07-31 15:06:06 -07:00
Eina_List * items ;
Evas_Coord x , y , w , h , minw , minh ;
int position ;
int item_position_stamp ;
2018-08-02 06:42:06 -07:00
Eo * adapter ;
2012-07-31 15:06:06 -07:00
Eina_Bool position_update : 1 ;
Eina_Bool want_unrealize : 1 ;
Eina_Bool must_recalc : 1 ;
Eina_Bool realized : 1 ;
Eina_Bool updateme : 1 ;
Eina_Bool changed : 1 ;
Eina_Bool show_me : 1 ;
} ;
struct _Item_Cache
{
EINA_INLIST ;
Evas_Object * base_view , * spacer ;
2016-05-11 04:32:55 -07:00
const Elm_Genlist_Item_Class * item_class ; // it->itc
2012-07-31 15:06:06 -07:00
Eina_Bool tree : 1 ; // it->group
2016-02-12 11:14:13 -08:00
Eina_List * contents ; // content objects for reusing
2012-07-31 15:06:06 -07:00
} ;
2015-12-01 23:23:39 -08:00
struct _Item_Size
{
2016-01-21 23:55:37 -08:00
const Elm_Genlist_Item_Class * itc ;
Evas_Coord minw ;
Evas_Coord minh ;
int expanded_depth ;
2015-12-01 23:23:39 -08:00
} ;
2014-04-01 03:55:08 -07:00
typedef struct _Elm_Genlist_Pan_Data Elm_Genlist_Pan_Data ;
struct _Elm_Genlist_Pan_Data
2012-07-31 15:06:06 -07:00
{
2012-11-25 22:32:53 -08:00
Evas_Object * wobj ;
2014-04-01 03:55:08 -07:00
Elm_Genlist_Data * wsd ;
2012-07-31 15:06:06 -07:00
Ecore_Job * resize_job ;
} ;
2015-09-23 04:50:05 -07:00
/**
* Structure added to genlist for internal filter iterator implementation
* Can be extended to genlist as a whole in future if needed .
*/
typedef struct _Elm_Genlist_Filter Elm_Genlist_Filter ;
struct _Elm_Genlist_Filter
{
Eina_Iterator iterator ;
const Eina_Inlist * head ;
const Eina_Inlist * current ;
2015-11-10 22:30:58 -08:00
Evas_Object * obj ;
2015-09-23 04:50:05 -07:00
} ;
2015-09-24 00:42:37 -07:00
# define ELM_GENLIST_FILTER_ITERATOR_ITEM_GET(ptr, \
2015-09-23 04:50:05 -07:00
type ) ( ( type * ) ( ( char * ) ptr - \
offsetof ( type , __in_list ) ) )
2012-07-31 15:06:06 -07:00
/**
* @ }
*/
# define ELM_GENLIST_DATA_GET(o, sd) \
2016-08-15 06:44:41 -07:00
Elm_Genlist_Data * sd = efl_data_scope_get ( o , ELM_GENLIST_CLASS )
2012-07-31 15:06:06 -07:00
2013-05-02 11:13:36 -07:00
# define ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd) \
2017-02-22 22:52:31 -08:00
Elm_Genlist_Data * sd = it - > item - > wsd
2013-05-02 11:13:36 -07:00
2012-07-31 15:06:06 -07:00
# define ELM_GENLIST_PAN_DATA_GET(o, sd) \
2016-08-15 06:44:41 -07:00
Elm_Genlist_Pan_Data * sd = efl_data_scope_get ( o , ELM_GENLIST_PAN_CLASS )
2012-07-31 15:06:06 -07:00
# define ELM_GENLIST_DATA_GET_OR_RETURN(o, ptr) \
ELM_GENLIST_DATA_GET ( o , ptr ) ; \
2014-01-15 10:33:40 -08:00
if ( EINA_UNLIKELY ( ! ptr ) ) \
2012-07-31 15:06:06 -07:00
{ \
2018-01-31 19:16:28 -08:00
ERR ( " No widget data for object %p (%s) " , \
2014-01-15 10:33:40 -08:00
o , evas_object_type_get ( o ) ) ; \
2012-07-31 15:06:06 -07:00
return ; \
}
# define ELM_GENLIST_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
ELM_GENLIST_DATA_GET ( o , ptr ) ; \
2014-01-15 10:33:40 -08:00
if ( EINA_UNLIKELY ( ! ptr ) ) \
2012-07-31 15:06:06 -07:00
{ \
2018-01-31 19:16:28 -08:00
ERR ( " No widget data for object %p (%s) " , \
2014-01-15 10:33:40 -08:00
o , evas_object_type_get ( o ) ) ; \
2012-07-31 15:06:06 -07:00
return val ; \
}
2014-01-15 10:33:40 -08:00
# define ELM_GENLIST_CHECK(obj) \
2016-08-15 06:44:41 -07:00
if ( EINA_UNLIKELY ( ! efl_isa ( ( obj ) , ELM_GENLIST_CLASS ) ) ) \
2012-07-31 15:06:06 -07:00
return
# define ELM_GENLIST_ITEM_CHECK(it) \
2014-09-27 22:15:28 -07:00
ELM_WIDGET_ITEM_CHECK_OR_RETURN ( it - > base , ) ; \
ELM_GENLIST_CHECK ( it - > base - > widget ) ;
2012-07-31 15:06:06 -07:00
# define ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, ...) \
2014-09-27 22:15:28 -07:00
ELM_WIDGET_ITEM_CHECK_OR_RETURN ( it - > base , __VA_ARGS__ ) ; \
ELM_GENLIST_CHECK ( it - > base - > widget ) __VA_ARGS__ ;
2012-07-31 15:06:06 -07:00
# define ELM_GENLIST_ITEM_CHECK_OR_GOTO(it, label) \
2014-09-27 22:15:28 -07:00
ELM_WIDGET_ITEM_CHECK_OR_GOTO ( it - > base , label ) ; \
2016-08-15 06:44:41 -07:00
if ( ! it - > base - > widget | | ! efl_isa \
2014-09-27 22:15:28 -07:00
( ( it - > base - > widget ) , ELM_GENLIST_CLASS ) ) goto label ;
# define ELM_GENLIST_ITEM_DATA_GET(o, sd) \
2016-08-15 06:44:41 -07:00
Elm_Gen_Item * sd = efl_data_scope_get ( o , ELM_GENLIST_ITEM_CLASS )
2012-07-31 15:06:06 -07:00
# endif