2012-08-01 14:03:11 -07:00
# ifndef ELM_WIDGET_INDEX_H
# define ELM_WIDGET_INDEX_H
2012-11-25 22:32:53 -08:00
# include "Elementary.h"
2012-08-01 14:03:11 -07:00
/**
* @ addtogroup Widget
* @ {
*
* @ section elm - index - class The Elementary Index Class
*
* Elementary , besides having the @ ref Index widget , exposes its
* foundation - - the Elementary Index Class - - in order to create other
* widgets which are a index with some more logic on top .
*/
/**
* Base layout smart data extended with index instance data .
*/
typedef struct _Elm_Index_Smart_Data Elm_Index_Smart_Data ;
struct _Elm_Index_Smart_Data
{
2014-02-10 05:27:08 -08:00
Evas_Object * event_rect [ 2 ] ; /**< rectangle objects for event handling */
2012-08-01 14:03:11 -07:00
Evas_Object * bx [ 2 ] ; // 2 - for now all that's supported
Eina_List * items ; /* 1 list. N levels, but only 2
* for now and # of items will be
* small */
2013-02-26 05:52:15 -08:00
Eina_List * omit ;
2012-08-01 14:03:11 -07:00
int level ;
Evas_Coord dx , dy ;
Ecore_Timer * delay ;
2013-01-26 01:55:32 -08:00
double delay_change_time ;
2013-04-16 23:11:00 -07:00
Eina_Bool level_active [ 2 ] ; /**< a flag for the activeness of a
level . activeness means the box is
filled with contents . */
2012-08-01 14:03:11 -07:00
2014-03-22 01:54:49 -07:00
Eina_Bool mouse_down : 1 ;
2012-08-01 14:03:11 -07:00
Eina_Bool horizontal : 1 ;
Eina_Bool autohide_disabled : 1 ;
Eina_Bool indicator_disabled : 1 ;
2013-02-26 05:52:15 -08:00
Eina_Bool omit_enabled : 1 ;
2012-08-01 14:03:11 -07:00
} ;
typedef struct _Elm_Index_Item Elm_Index_Item ;
struct _Elm_Index_Item
{
ELM_WIDGET_ITEM ;
2013-03-04 02:13:20 -08:00
const char * letter ;
int level ;
Evas_Smart_Cb func ;
2012-08-01 14:03:11 -07:00
2013-03-04 02:13:20 -08:00
Eina_List * omitted ;
Elm_Index_Item * head ;
2013-02-26 05:52:15 -08:00
2013-04-16 00:05:51 -07:00
Eina_Bool selected : 1 ; /**< a flag that remembers an item is selected. this is set true when mouse down/move occur above an item and when elm_index_item_selected_set() API is called. */
2012-08-01 14:03:11 -07:00
} ;
2013-02-26 05:52:15 -08:00
typedef struct _Elm_Index_Omit Elm_Index_Omit ;
struct _Elm_Index_Omit
{
int offset ;
int count ;
} ;
2012-08-01 14:03:11 -07:00
/**
* @ }
*/
# define ELM_INDEX_DATA_GET(o, sd) \
2013-04-24 04:41:37 -07:00
Elm_Index_Smart_Data * sd = eo_data_scope_get ( o , ELM_OBJ_INDEX_CLASS )
2012-08-01 14:03:11 -07:00
# define ELM_INDEX_DATA_GET_OR_RETURN(o, ptr) \
ELM_INDEX_DATA_GET ( o , ptr ) ; \
2014-01-15 10:33:40 -08:00
if ( EINA_UNLIKELY ( ! ptr ) ) \
2012-08-01 14:03:11 -07:00
{ \
2014-01-15 10:33:40 -08:00
CRI ( " No widget data for object %p (%s) " , \
o , evas_object_type_get ( o ) ) ; \
2012-08-01 14:03:11 -07:00
return ; \
}
# define ELM_INDEX_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
ELM_INDEX_DATA_GET ( o , ptr ) ; \
2014-01-15 10:33:40 -08:00
if ( EINA_UNLIKELY ( ! ptr ) ) \
2012-08-01 14:03:11 -07:00
{ \
2014-01-15 10:33:40 -08:00
CRI ( " No widget data for object %p (%s) " , \
o , evas_object_type_get ( o ) ) ; \
2012-08-01 14:03:11 -07:00
return val ; \
}
2014-01-15 10:33:40 -08:00
# define ELM_INDEX_CHECK(obj) \
if ( EINA_UNLIKELY ( ! eo_isa ( ( obj ) , ELM_OBJ_INDEX_CLASS ) ) ) \
2012-08-01 14:03:11 -07:00
return
# define ELM_INDEX_ITEM_CHECK(it) \
ELM_WIDGET_ITEM_CHECK_OR_RETURN ( ( Elm_Widget_Item * ) it , ) ; \
ELM_INDEX_CHECK ( it - > base . widget ) ;
# define ELM_INDEX_ITEM_CHECK_OR_RETURN(it, ...) \
ELM_WIDGET_ITEM_CHECK_OR_RETURN ( ( Elm_Widget_Item * ) it , __VA_ARGS__ ) ; \
ELM_INDEX_CHECK ( it - > base . widget ) __VA_ARGS__ ;
# endif