2012-07-31 15:06:36 -07:00
# ifndef ELM_WIDGET_LIST_H
# define ELM_WIDGET_LIST_H
# include "elm_interface_scrollable.h"
# include "elm_widget_layout.h"
2019-03-05 14:00:37 -08:00
# include "elm_list_eo.h"
# include "elm_list_item_eo.h"
2012-07-31 15:06:36 -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:36 -07:00
/**
* @ addtogroup Widget
* @ {
*
* @ section elm - list - class The Elementary List Class
*
* Elementary , besides having the @ ref List widget , exposes its
* foundation - - the Elementary List Class - - in order to create
* other widgets which are a list with some more logic on top .
*/
# define ELM_LIST_SWIPE_MOVES 12
2014-09-27 22:15:48 -07:00
typedef struct _Elm_List_Item_Data Elm_List_Item_Data ;
2012-07-31 15:06:36 -07:00
/**
* Base widget smart data extended with list instance data .
*/
2014-03-31 05:59:55 -07:00
typedef struct _Elm_List_Data Elm_List_Data ;
struct _Elm_List_Data
2012-07-31 15:06:36 -07:00
{
Evas_Object * box , * hit_rect ;
2018-05-23 23:37:09 -07:00
Eina_List * items , * selected ;
2012-07-31 15:06:36 -07:00
Elm_Object_Item * last_selected_item ;
2014-02-18 06:40:48 -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. */
2014-12-29 03:17:41 -08:00
Evas_Coord minw [ 2 ] , minh [ 2 ] , dx , dy ;
2012-07-31 15:06:36 -07:00
Elm_Object_Select_Mode select_mode ;
2013-11-04 16:22:25 -08:00
Elm_Object_Multi_Select_Mode multi_select_mode ; /**< select mode for multiple selection */
2012-07-31 15:06:36 -07:00
int movements ;
int walking ;
Elm_List_Mode h_mode ;
Elm_List_Mode mode ;
struct
{
Evas_Coord x , y ;
} history [ ELM_LIST_SWIPE_MOVES ] ;
2013-02-20 02:00:49 -08:00
Eina_Bool focus_on_selection_enabled : 1 ;
2012-07-31 15:06:36 -07:00
Eina_Bool was_selected : 1 ;
Eina_Bool fix_pending : 1 ;
Eina_Bool longpressed : 1 ;
Eina_Bool scr_minw : 1 ;
Eina_Bool scr_minh : 1 ;
Eina_Bool on_hold : 1 ;
Eina_Bool multi : 1 ;
Eina_Bool swipe : 1 ;
2012-08-29 16:38:58 -07:00
Eina_Bool delete_me : 1 ;
2014-03-22 02:01:22 -07:00
Eina_Bool mouse_down : 1 ; /**< a flag that mouse is down on the list at the moment. this flag is set to true on mouse and reset to false on mouse up */
2014-03-24 01:35:07 -07:00
Eina_Bool item_loop_enable : 1 ; /**< value whether item loop feature is enabled or not. */
2014-07-21 23:11:17 -07:00
Eina_Bool item_looping_on : 1 ;
2018-07-19 01:01:05 -07:00
Eina_Bool fixing_now : 1 ;
2012-07-31 15:06:36 -07:00
} ;
2014-09-27 22:15:48 -07:00
struct _Elm_List_Item_Data
2012-07-31 15:06:36 -07:00
{
2014-09-27 22:15:48 -07:00
Elm_Widget_Item_Data * base ;
2012-07-31 15:06:36 -07:00
Ecore_Timer * swipe_timer ;
Ecore_Timer * long_timer ;
Evas_Object * icon , * end ;
Evas_Smart_Cb func ;
const char * label ;
Eina_List * node ;
Eina_Bool is_separator : 1 ;
Eina_Bool highlighted : 1 ;
Eina_Bool dummy_icon : 1 ;
Eina_Bool dummy_end : 1 ;
Eina_Bool selected : 1 ;
Eina_Bool deleted : 1 ;
Eina_Bool is_even : 1 ;
Eina_Bool fixed : 1 ;
Eina_Bool even : 1 ;
} ;
/**
* @ }
*/
# define ELM_LIST_DATA_GET(o, sd) \
2016-08-15 06:44:41 -07:00
Elm_List_Data * sd = efl_data_scope_get ( o , ELM_LIST_CLASS )
2012-07-31 15:06:36 -07:00
2014-08-21 10:57:57 -07:00
# define ELM_LIST_DATA_GET_FROM_ITEM(it, sd) \
ELM_LIST_DATA_GET ( WIDGET ( it ) , sd )
2012-07-31 15:06:36 -07:00
# define ELM_LIST_DATA_GET_OR_RETURN(o, ptr) \
ELM_LIST_DATA_GET ( o , ptr ) ; \
2014-01-15 10:33:40 -08:00
if ( EINA_UNLIKELY ( ! ptr ) ) \
2012-07-31 15:06:36 -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:36 -07:00
return ; \
}
# define ELM_LIST_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
ELM_LIST_DATA_GET ( o , ptr ) ; \
2014-01-15 10:33:40 -08:00
if ( EINA_UNLIKELY ( ! ptr ) ) \
2012-07-31 15:06:36 -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:36 -07:00
return val ; \
}
2014-01-15 10:33:40 -08:00
# define ELM_LIST_CHECK(obj) \
2016-08-15 06:44:41 -07:00
if ( EINA_UNLIKELY ( ! efl_isa ( ( obj ) , ELM_LIST_CLASS ) ) ) \
2012-07-31 15:06:36 -07:00
return
# define ELM_LIST_ITEM_CHECK(it) \
2014-09-27 22:15:48 -07:00
ELM_WIDGET_ITEM_CHECK_OR_RETURN ( it - > base , ) ; \
ELM_LIST_CHECK ( it - > base - > widget ) ; \
2014-08-19 00:52:24 -07:00
if ( it - > deleted ) \
2012-07-31 15:06:36 -07:00
{ \
ERR ( " ERROR: " # it " has been DELETED. \n " ) ; \
return ; \
}
# define ELM_LIST_ITEM_CHECK_OR_RETURN(it, ...) \
2014-09-27 22:15:48 -07:00
ELM_WIDGET_ITEM_CHECK_OR_RETURN ( it - > base , __VA_ARGS__ ) ; \
ELM_LIST_CHECK ( it - > base - > widget ) __VA_ARGS__ ; \
2014-08-19 00:52:24 -07:00
if ( it - > deleted ) \
2012-07-31 15:06:36 -07:00
{ \
ERR ( " ERROR: " # it " has been DELETED. \n " ) ; \
return __VA_ARGS__ ; \
}
2014-09-27 22:15:48 -07:00
# define ELM_LIST_ITEM_DATA_GET(o, sd) \
2016-08-15 06:44:41 -07:00
Elm_List_Item_Data * sd = efl_data_scope_get ( o , ELM_LIST_ITEM_CLASS )
2014-09-27 22:15:48 -07:00
2012-07-31 15:06:36 -07:00
# endif