1 #ifndef ELM_WIDGET_MULTIBUTTONENTRY_H
2 #define ELM_WIDGET_MULTIBUTTONENTRY_H
4 #include "elm_widget_layout.h"
10 * @section elm-multibuttonentry-class The Elementary Multi Button Entry Class
12 * Elementary, besides having the @ref Multibuttonentry widget,
13 * exposes its foundation -- the Elementary Multi Button Entry Class --
14 * in order to create other widgets which are a multi button entry with
15 * some more logic on top.
19 * @def ELM_MULTIBUTTONENTRY_CLASS
21 * Use this macro to cast whichever subclass of
22 * #Elm_Multibuttonentry_Smart_Class into it, so to access its fields.
26 #define ELM_MULTIBUTTONENTRY_CLASS(x) ((Elm_Multibuttonentry_Smart_Class *)x)
29 * @def ELM_MULTIBUTTONENTRY_DATA
31 * Use this macro to cast whichever subdata of
32 * #Elm_Multibuttonentry_Smart_Data into it, so to access its fields.
36 #define ELM_MULTIBUTTONENTRY_DATA(x) ((Elm_Multibuttonentry_Smart_Data *)x)
39 * @def ELM_MULTIBUTTONENTRY_SMART_CLASS_VERSION
41 * Current version for Elementary multibuttonentry @b base smart class, a value
42 * which goes to _Elm_Multibuttonentry_Smart_Class::version.
46 #define ELM_MULTIBUTTONENTRY_SMART_CLASS_VERSION 1
49 * @def ELM_MULTIBUTTONENTRY_SMART_CLASS_INIT
51 * Initializer for a whole #Elm_Multibuttonentry_Smart_Class structure, with
52 * @c NULL values on its specific fields.
54 * @param smart_class_init initializer to use for the "base" field
55 * (#Evas_Smart_Class).
57 * @see EVAS_SMART_CLASS_INIT_NULL
58 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION
59 * @see ELM_MULTIBUTTONENTRY_SMART_CLASS_INIT_NULL
60 * @see ELM_MULTIBUTTONENTRY_SMART_CLASS_INIT_NAME_VERSION
64 #define ELM_MULTIBUTTONENTRY_SMART_CLASS_INIT(smart_class_init) \
65 {smart_class_init, ELM_MULTIBUTTONENTRY_SMART_CLASS_VERSION}
68 * @def ELM_MULTIBUTTONENTRY_SMART_CLASS_INIT_NULL
70 * Initializer to zero out a whole #Elm_Multibuttonentry_Smart_Class structure.
72 * @see ELM_MULTIBUTTONENTRY_SMART_CLASS_INIT_NAME_VERSION
73 * @see ELM_MULTIBUTTONENTRY_SMART_CLASS_INIT
77 #define ELM_MULTIBUTTONENTRY_SMART_CLASS_INIT_NULL \
78 ELM_MULTIBUTTONENTRY_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NULL)
81 * @def ELM_MULTIBUTTONENTRY_SMART_CLASS_INIT_NAME_VERSION
83 * Initializer to zero out a whole #Elm_Multibuttonentry_Smart_Class
84 * structure and set its name and version.
86 * This is similar to #ELM_MULTIBUTTONENTRY_SMART_CLASS_INIT_NULL, but
87 * it will also set the version field of
88 * #Elm_Multibuttonentry_Smart_Class (base field) to the latest
89 * #ELM_MULTIBUTTONENTRY_SMART_CLASS_VERSION and name it to the
92 * It will keep a reference to the name field as a <c>"const char *"</c>,
93 * i.e., the name must be available while the structure is
94 * used (hint: static or global variable!) and must not be modified.
96 * @see ELM_MULTIBUTTONENTRY_SMART_CLASS_INIT_NULL
97 * @see ELM_MULTIBUTTONENTRY_SMART_CLASS_INIT
101 #define ELM_MULTIBUTTONENTRY_SMART_CLASS_INIT_NAME_VERSION(name) \
102 ELM_MULTIBUTTONENTRY_SMART_CLASS_INIT \
103 (ELM_LAYOUT_SMART_CLASS_INIT_NAME_VERSION(name))
106 * Elementary multibuttonentry base smart class. This inherits
107 * directly from #Elm_Layout_Smart_Class and is meant to build widgets
108 * extending the behavior of a multibuttonentry.
110 * All of the functions listed on @ref Multibuttonentry namespace will
111 * work for objects deriving from #Elm_Multibuttonentry_Smart_Class.
113 typedef struct _Elm_Multibuttonentry_Smart_Class
115 Elm_Layout_Smart_Class base;
117 int version; /**< Version of this smart class definition */
118 } Elm_Multibuttonentry_Smart_Class;
121 * Base widget smart data extended with multibuttonentry instance data.
123 typedef struct _Elm_Multibuttonentry_Item
128 } Elm_Multibuttonentry_Item;
130 typedef struct _Elm_Multibuttonentry_Item_Filter
132 Elm_Multibuttonentry_Item_Filter_Cb func;
134 } Elm_Multibuttonentry_Item_Filter;
136 typedef struct _Elm_Multibuttonentry_Smart_Data
138 Elm_Layout_Smart_Data base;
151 Elm_Object_Item *selected_item;
153 Eina_Bool item_be_selected : 1;
154 Eina_Bool editable : 1;
155 Eina_Bool expanded : 1;
156 Eina_Bool expanded_state : 1;
157 Eina_Bool long_pressed : 1;
159 Ecore_Timer *longpress_timer;
160 } Elm_Multibuttonentry_Smart_Data;
166 EAPI extern const char ELM_MULTIBUTTONENTRY_SMART_NAME[];
168 EAPI const Elm_Multibuttonentry_Smart_Class
169 *elm_multibuttonentry_smart_class_get(void);
171 #define ELM_MULTIBUTTONENTRY_DATA_GET(o, sd) \
172 Elm_Multibuttonentry_Smart_Data * sd = evas_object_smart_data_get(o)
174 #define ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(o, ptr) \
175 ELM_MULTIBUTTONENTRY_DATA_GET(o, ptr); \
178 CRITICAL("No widget data for object %p (%s)", \
179 o, evas_object_type_get(o)); \
183 #define ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
184 ELM_MULTIBUTTONENTRY_DATA_GET(o, ptr); \
187 CRITICAL("No widget data for object %p (%s)", \
188 o, evas_object_type_get(o)); \
192 #define ELM_MULTIBUTTONENTRY_CHECK(obj) \
193 if (!obj || !elm_widget_type_check \
195 ELM_MULTIBUTTONENTRY_SMART_NAME, __func__)) \
198 #define ELM_MULTIBUTTONENTRY_ITEM_CHECK(it) \
199 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, ); \
200 ELM_MULTIBUTTONENTRY_CHECK(it->base.widget);
202 #define ELM_MULTIBUTTONENTRY_ITEM_CHECK_OR_RETURN(it, ...) \
203 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
204 ELM_MULTIBUTTONENTRY_CHECK(it->base.widget) __VA_ARGS__;