1 #ifndef ELM_WIDGET_HOVERSEL_H
2 #define ELM_WIDGET_HOVERSEL_H
4 #include "elm_widget_button.h"
14 * @section elm-hoversel-class The Elementary Hoversel Class
16 * Elementary, besides having the @ref Hoversel widget, exposes its
17 * foundation -- the Elementary Hoversel Class -- in order to create other
18 * widgets which are a hoversel with some more logic on top.
22 * @def ELM_HOVERSEL_CLASS
24 * Use this macro to cast whichever subclass of
25 * #Elm_Hoversel_Smart_Class into it, so to access its fields.
29 #define ELM_HOVERSEL_CLASS(x) ((Elm_Hoversel_Smart_Class *)x)
32 * @def ELM_HOVERSEL_DATA
34 * Use this macro to cast whichever subdata of
35 * #Elm_Hoversel_Smart_Data into it, so to access its fields.
39 #define ELM_HOVERSEL_DATA(x) ((Elm_Hoversel_Smart_Data *)x)
42 * @def ELM_HOVERSEL_SMART_CLASS_VERSION
44 * Current version for Elementary hoversel @b base smart class, a value
45 * which goes to _Elm_Hoversel_Smart_Class::version.
49 #define ELM_HOVERSEL_SMART_CLASS_VERSION 1
52 * @def ELM_HOVERSEL_SMART_CLASS_INIT
54 * Initializer for a whole #Elm_Hoversel_Smart_Class structure, with
55 * @c NULL values on its specific fields.
57 * @param smart_class_init initializer to use for the "base" field
58 * (#Evas_Smart_Class).
60 * @see EVAS_SMART_CLASS_INIT_NULL
61 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION
62 * @see ELM_HOVERSEL_SMART_CLASS_INIT_NULL
63 * @see ELM_HOVERSEL_SMART_CLASS_INIT_NAME_VERSION
67 #define ELM_HOVERSEL_SMART_CLASS_INIT(smart_class_init) \
68 {smart_class_init, ELM_HOVERSEL_SMART_CLASS_VERSION}
71 * @def ELM_HOVERSEL_SMART_CLASS_INIT_NULL
73 * Initializer to zero out a whole #Elm_Hoversel_Smart_Class structure.
75 * @see ELM_HOVERSEL_SMART_CLASS_INIT_NAME_VERSION
76 * @see ELM_HOVERSEL_SMART_CLASS_INIT
80 #define ELM_HOVERSEL_SMART_CLASS_INIT_NULL \
81 ELM_HOVERSEL_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NULL)
84 * @def ELM_HOVERSEL_SMART_CLASS_INIT_NAME_VERSION
86 * Initializer to zero out a whole #Elm_Hoversel_Smart_Class structure and
87 * set its name and version.
89 * This is similar to #ELM_HOVERSEL_SMART_CLASS_INIT_NULL, but it will
90 * also set the version field of #Elm_Hoversel_Smart_Class (base field)
91 * to the latest #ELM_HOVERSEL_SMART_CLASS_VERSION and name it to the
94 * It will keep a reference to the name field as a <c>"const char *"</c>,
95 * i.e., the name must be available while the structure is
96 * used (hint: static or global variable!) and must not be modified.
98 * @see ELM_HOVERSEL_SMART_CLASS_INIT_NULL
99 * @see ELM_HOVERSEL_SMART_CLASS_INIT
103 #define ELM_HOVERSEL_SMART_CLASS_INIT_NAME_VERSION(name) \
104 ELM_HOVERSEL_SMART_CLASS_INIT \
105 (ELM_BUTTON_SMART_CLASS_INIT_NAME_VERSION(name))
108 * Elementary hoversel base smart class. This inherits directly from
109 * #Elm_Button_Smart_Class and is meant to build widgets extending the
110 * behavior of a hoversel.
112 * All of the functions listed on @ref Hoversel namespace will work for
113 * objects deriving from #Elm_Hoversel_Smart_Class.
115 typedef struct _Elm_Hoversel_Smart_Class
117 Elm_Button_Smart_Class base;
119 int version; /**< Version of this smart class definition */
120 } Elm_Hoversel_Smart_Class;
123 * Base button smart data extended with hoversel instance data.
125 typedef struct _Elm_Hoversel_Smart_Data Elm_Hoversel_Smart_Data;
126 struct _Elm_Hoversel_Smart_Data
128 Elm_Button_Smart_Data base;
130 /* aggregates a hover */
132 Evas_Object *hover_parent;
136 Eina_Bool horizontal : 1;
137 Eina_Bool expanded : 1;
140 typedef struct _Elm_Hoversel_Item Elm_Hoversel_Item;
141 struct _Elm_Hoversel_Item
146 const char *icon_file;
147 const char *icon_group;
149 Elm_Icon_Type icon_type;
157 EAPI extern const char ELM_HOVERSEL_SMART_NAME[];
158 EAPI const Elm_Hoversel_Smart_Class *elm_hoversel_smart_class_get(void);
160 #define ELM_HOVERSEL_DATA_GET(o, sd) \
161 Elm_Hoversel_Smart_Data * sd = evas_object_smart_data_get(o)
163 #define ELM_HOVERSEL_DATA_GET_OR_RETURN(o, ptr) \
164 ELM_HOVERSEL_DATA_GET(o, ptr); \
167 CRITICAL("No widget data for object %p (%s)", \
168 o, evas_object_type_get(o)); \
172 #define ELM_HOVERSEL_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
173 ELM_HOVERSEL_DATA_GET(o, ptr); \
176 CRITICAL("No widget data for object %p (%s)", \
177 o, evas_object_type_get(o)); \
181 #define ELM_HOVERSEL_CHECK(obj) \
182 if (!obj || !elm_widget_type_check \
183 ((obj), ELM_HOVERSEL_SMART_NAME, __func__)) \
186 #define ELM_HOVERSEL_ITEM_CHECK(it) \
187 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, ); \
188 ELM_HOVERSEL_CHECK(it->base.widget);
190 #define ELM_HOVERSEL_ITEM_CHECK_OR_RETURN(it, ...) \
191 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
192 ELM_HOVERSEL_CHECK(it->base.widget) __VA_ARGS__;