1 #ifndef ELM_WIDGET_TOOLBAR_H
2 #define ELM_WIDGET_TOOLBAR_H
4 #include "elm_interface_scrollable.h"
6 /* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR
7 * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT
8 * FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK
17 * @section elm-toolbar-class The Elementary Toolbar Class
19 * Elementary, besides having the @ref Toolbar widget, exposes its
20 * foundation -- the Elementary Toolbar Class -- in order to create other
21 * widgets which are a toolbar with some more logic on top.
24 typedef struct _Elm_Toolbar_Item_Data Elm_Toolbar_Item_Data;
27 * Base widget smart data extended with toolbar instance data.
29 typedef struct _Elm_Toolbar_Data Elm_Toolbar_Data;
30 struct _Elm_Toolbar_Data
32 Evas_Object *hit_rect;
34 Evas_Object *bx, *more, *bx_more, *bx_more2;
35 Evas_Object *menu_parent;
37 Elm_Toolbar_Item_Data *more_item;
38 Elm_Object_Item *selected_item; /**< a selected item by mouse click, return key, api, and etc. */
39 // TIZEN_ONLY(20150815): Properly unselect the last item which is selected by order.
40 Elm_Object_Item *auto_selected_last_item; /**< a selected item by order. */
42 Elm_Object_Item *focused_item; /**< a focused item by keypad arrow or mouse. This is set to NULL if widget looses focus. */
43 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. */
44 Elm_Toolbar_Item_Data *reorder_empty, *reorder_item;
45 Elm_Toolbar_Shrink_Mode shrink_mode;
46 Elm_Icon_Lookup_Order lookup_order;
47 int theme_icon_size, priv_icon_size,
49 int standard_priority;
50 unsigned int item_count;
51 unsigned int separator_count;
53 Elm_Object_Select_Mode select_mode;
54 Ecore_Timer *long_timer;
55 Ecore_Job *resize_job;
57 Eina_Bool vertical : 1;
58 Eina_Bool long_press : 1;
59 Eina_Bool homogeneous : 1;
60 Eina_Bool delete_me : 1;
61 Eina_Bool reorder_mode : 1;
62 Eina_Bool transverse_expanded : 1;
63 Eina_Bool mouse_down : 1; /**< a flag that mouse is down on the toolbar at the moment. This flag is set to true on mouse and reset to false on mouse up. */
66 struct _Elm_Toolbar_Item_Data
68 Elm_Widget_Item_Data *base;
80 Elm_Toolbar_Item_Data *reorder_to;
84 Eina_Bool visible : 1;
88 Eina_List *current_state;
90 Eina_Bool separator : 1;
91 Eina_Bool selected : 1;
93 Eina_Bool on_move : 1;
96 struct _Elm_Toolbar_Item_State
109 #define ELM_TOOLBAR_DATA_GET(o, sd) \
110 Elm_Toolbar_Data * sd = eo_data_scope_get(o, ELM_TOOLBAR_CLASS)
112 #define ELM_TOOLBAR_DATA_GET_OR_RETURN(o, ptr) \
113 ELM_TOOLBAR_DATA_GET(o, ptr); \
114 if (EINA_UNLIKELY(!ptr)) \
116 CRI("No widget data for object %p (%s)", \
117 o, evas_object_type_get(o)); \
121 #define ELM_TOOLBAR_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
122 ELM_TOOLBAR_DATA_GET(o, ptr); \
123 if (EINA_UNLIKELY(!ptr)) \
125 CRI("No widget data for object %p (%s)", \
126 o, evas_object_type_get(o)); \
130 #define ELM_TOOLBAR_CHECK(obj) \
131 if (EINA_UNLIKELY(!eo_isa((obj), ELM_TOOLBAR_CLASS))) \
134 #define ELM_TOOLBAR_ITEM_CHECK(it) \
135 ELM_WIDGET_ITEM_CHECK_OR_RETURN(it->base, ); \
136 ELM_TOOLBAR_CHECK(it->base->widget);
138 #define ELM_TOOLBAR_ITEM_CHECK_OR_RETURN(it, ...) \
139 ELM_WIDGET_ITEM_CHECK_OR_RETURN(it->base, __VA_ARGS__); \
140 ELM_TOOLBAR_CHECK(it->base->widget) __VA_ARGS__;
142 #define ELM_TOOLBAR_ITEM_CHECK_OR_GOTO(it, label) \
143 ELM_WIDGET_ITEM_CHECK_OR_GOTO(it->base, label); \
144 if (!it->base->widget || !eo_isa ((it->base->widget), ELM_TOOLBAR_CLASS)) goto label;
146 #define ELM_TOOLBAR_ITEM_DATA_GET(o, sd) \
147 Elm_Toolbar_Item_Data *sd = eo_data_scope_get(o, ELM_TOOLBAR_ITEM_CLASS)