1 #ifndef ELM_WIDGET_TOOLBAR_H
2 #define ELM_WIDGET_TOOLBAR_H
4 #include "elm_interface_scrollable.h"
12 * @section elm-toolbar-class The Elementary Toolbar Class
14 * Elementary, besides having the @ref Toolbar widget, exposes its
15 * foundation -- the Elementary Toolbar Class -- in order to create other
16 * widgets which are a toolbar with some more logic on top.
20 * @def ELM_TOOLBAR_CLASS
22 * Use this macro to cast whichever subclass of
23 * #Elm_Toolbar_Smart_Class into it, so to access its fields.
27 #define ELM_TOOLBAR_CLASS(x) ((Elm_Toolbar_Smart_Class *)x)
30 * @def ELM_TOOLBAR_DATA
32 * Use this macro to cast whichever subdata of
33 * #Elm_Toolbar_Smart_Data into it, so to access its fields.
37 #define ELM_TOOLBAR_DATA(x) ((Elm_Toolbar_Smart_Data *)x)
40 * @def ELM_TOOLBAR_SMART_CLASS_VERSION
42 * Current version for Elementary toolbar @b base smart class, a value
43 * which goes to _Elm_Toolbar_Smart_Class::version.
47 #define ELM_TOOLBAR_SMART_CLASS_VERSION 1
50 * @def ELM_TOOLBAR_SMART_CLASS_INIT
52 * Initializer for a whole #Elm_Toolbar_Smart_Class structure, with
53 * @c NULL values on its specific fields.
55 * @param smart_class_init initializer to use for the "base" field
56 * (#Evas_Smart_Class).
58 * @see EVAS_SMART_CLASS_INIT_NULL
59 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION
60 * @see ELM_TOOLBAR_SMART_CLASS_INIT_NULL
61 * @see ELM_TOOLBAR_SMART_CLASS_INIT_NAME_VERSION
65 #define ELM_TOOLBAR_SMART_CLASS_INIT(smart_class_init) \
66 {smart_class_init, ELM_TOOLBAR_SMART_CLASS_VERSION}
69 * @def ELM_TOOLBAR_SMART_CLASS_INIT_NULL
71 * Initializer to zero out a whole #Elm_Toolbar_Smart_Class structure.
73 * @see ELM_TOOLBAR_SMART_CLASS_INIT_NAME_VERSION
74 * @see ELM_TOOLBAR_SMART_CLASS_INIT
78 #define ELM_TOOLBAR_SMART_CLASS_INIT_NULL \
79 ELM_TOOLBAR_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NULL)
82 * @def ELM_TOOLBAR_SMART_CLASS_INIT_NAME_VERSION
84 * Initializer to zero out a whole #Elm_Toolbar_Smart_Class structure and
85 * set its name and version.
87 * This is similar to #ELM_TOOLBAR_SMART_CLASS_INIT_NULL, but it will
88 * also set the version field of #Elm_Toolbar_Smart_Class (base field)
89 * to the latest #ELM_TOOLBAR_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_TOOLBAR_SMART_CLASS_INIT_NULL
97 * @see ELM_TOOLBAR_SMART_CLASS_INIT
101 #define ELM_TOOLBAR_SMART_CLASS_INIT_NAME_VERSION(name) \
102 ELM_TOOLBAR_SMART_CLASS_INIT(ELM_WIDGET_SMART_CLASS_INIT_NAME_VERSION(name))
105 * Elementary toolbar base smart class. This inherits directly from
106 * #Elm_Widget_Smart_Class and is meant to build widgets extending the
107 * behavior of a toolbar.
109 * All of the functions listed on @ref Toolbar namespace will work for
110 * objects deriving from #Elm_Toolbar_Smart_Class.
112 typedef struct _Elm_Toolbar_Smart_Class
114 Elm_Widget_Smart_Class base;
116 int version; /**< Version of this smart class definition */
117 } Elm_Toolbar_Smart_Class;
119 typedef struct _Elm_Toolbar_Item Elm_Toolbar_Item;
122 * Base widget smart data extended with toolbar instance data.
124 typedef struct _Elm_Toolbar_Smart_Data Elm_Toolbar_Smart_Data;
125 struct _Elm_Toolbar_Smart_Data
127 Elm_Widget_Smart_Data base; /* base widget smart data as
128 * first member obligatory, as
129 * we're inheriting from it */
131 Evas_Object *hit_rect;
132 const Elm_Scrollable_Smart_Interface *s_iface;
134 Evas_Object *bx, *more, *bx_more, *bx_more2;
135 Evas_Object *menu_parent;
137 Elm_Toolbar_Item *more_item;
138 Elm_Toolbar_Item *selected_item, *highlighted_item;
139 Elm_Toolbar_Item *reorder_empty, *reorder_item;
140 Elm_Toolbar_Shrink_Mode shrink_mode;
141 Elm_Icon_Lookup_Order lookup_order;
142 int theme_icon_size, priv_icon_size,
144 int standard_priority;
145 unsigned int item_count;
146 unsigned int separator_count;
148 Elm_Object_Select_Mode select_mode;
149 Ecore_Timer *long_timer;
150 Ecore_Job *resize_job;
152 Eina_Bool vertical : 1;
153 Eina_Bool long_press : 1;
154 Eina_Bool homogeneous : 1;
155 Eina_Bool on_deletion : 1;
156 Eina_Bool reorder_mode : 1;
157 Eina_Bool transverse_expanded : 1;
158 Eina_Bool mouse_down : 1;
161 struct _Elm_Toolbar_Item
167 const char *icon_str;
175 Elm_Toolbar_Item *reorder_to;
179 Eina_Bool visible : 1;
183 Eina_List *current_state;
185 Eina_Bool separator : 1;
186 Eina_Bool selected : 1;
188 Eina_Bool on_move : 1;
190 //******************** TIZEN Only
191 Eina_Bool pressed : 1;
192 //****************************
195 struct _Elm_Toolbar_Item_State
198 const char *icon_str;
208 EAPI extern const char ELM_TOOLBAR_SMART_NAME[];
209 EAPI const Elm_Toolbar_Smart_Class
210 *elm_toolbar_smart_class_get(void);
212 #define ELM_TOOLBAR_DATA_GET(o, sd) \
213 Elm_Toolbar_Smart_Data * sd = evas_object_smart_data_get(o)
215 #define ELM_TOOLBAR_DATA_GET_OR_RETURN(o, ptr) \
216 ELM_TOOLBAR_DATA_GET(o, ptr); \
219 CRITICAL("No widget data for object %p (%s)", \
220 o, evas_object_type_get(o)); \
224 #define ELM_TOOLBAR_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
225 ELM_TOOLBAR_DATA_GET(o, ptr); \
228 CRITICAL("No widget data for object %p (%s)", \
229 o, evas_object_type_get(o)); \
233 #define ELM_TOOLBAR_CHECK(obj) \
234 if (!obj || !elm_widget_type_check((obj), \
235 ELM_TOOLBAR_SMART_NAME, __func__)) \
238 #define ELM_TOOLBAR_ITEM_CHECK(it) \
239 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, ); \
240 ELM_TOOLBAR_CHECK(it->base.widget);
242 #define ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, ...) \
243 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
244 ELM_TOOLBAR_CHECK(it->base.widget) __VA_ARGS__;
246 #define ELM_TOOLBAR_ITEM_CHECK_OR_GOTO(it, label) \
247 ELM_WIDGET_ITEM_CHECK_OR_GOTO((Elm_Widget_Item *)it, label); \
248 if (!it->base.widget || !elm_widget_type_check \
249 ((it->base.widget), ELM_TOOLBAR_SMART_NAME, __func__)) goto label;