4 /* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR
5 * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT
6 * FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK IT
9 * How to make your own widget? like this:
11 * #include <Elementary.h>
12 * #include "elm_priv.h"
14 * typedef struct _Widget_Data Widget_Data;
19 * // add any other widget data here too
22 * static const char *widtype = NULL;
23 * static void _del_hook(Evas_Object *obj);
24 * static void _theme_hook(Evas_Object *obj);
25 * static void _disable_hook(Evas_Object *obj);
26 * static void _sizing_eval(Evas_Object *obj);
27 * static void _on_focus_hook(void *data, Evas_Object *obj);
29 * static const char SIG_CLICKED[] = "clicked";
30 * static const Evas_Smart_Cb_Description _signals[] = {
36 * _del_hook(Evas_Object *obj)
38 * Widget_Data *wd = elm_widget_data_get(obj);
40 * // delete hook - on delete of object delete object struct etc.
45 * _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
47 * Widget_Data *wd = elm_widget_data_get(obj);
49 * // handle focus going in and out - optional, but if you want to, set
50 * // this hook and handle it (eg emit a signal to an edje obj)
51 * if (elm_widget_focus_get(obj))
53 * edje_object_signal_emit(wd->sub, "elm,action,focus", "elm");
54 * evas_object_focus_set(wd->sub, EINA_TRUE);
58 * edje_object_signal_emit(wd->sub, "elm,action,unfocus", "elm");
59 * evas_object_focus_set(wd->sub, EINA_FALSE);
64 * _theme_hook(Evas_Object *obj)
66 * Widget_Data *wd = elm_widget_data_get(obj);
68 * // handle change in theme/scale etc.
69 * elm_widget_theme_object_set(obj, wd->sub, "mywidget", "base",
70 * elm_widget_style_get(obj));
74 * _disable_hook(Evas_Object *obj)
76 * Widget_Data *wd = elm_widget_data_get(obj);
78 * // optional, but handle if the widget gets disabled or not
79 * if (elm_widget_disabled_get(obj))
80 * edje_object_signal_emit(wd->sub, "elm,state,disabled", "elm");
82 * edje_object_signal_emit(wd->sub, "elm,state,enabled", "elm");
86 * _sizing_eval(Evas_Object *obj)
88 * Widget_Data *wd = elm_widget_data_get(obj);
89 * Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
91 * elm_coords_finger_size_adjust(1, &minw, 1, &minh);
92 * edje_object_size_min_restricted_calc(wd->sub, &minw, &minh, minw, minh);
93 * elm_coords_finger_size_adjust(1, &minw, 1, &minh);
94 * evas_object_size_hint_min_set(obj, minw, minh);
95 * evas_object_size_hint_max_set(obj, maxw, maxh);
98 * // actual api to create your widget. add more to manipulate it as needed
99 * // mark your calls with EAPI to make them "external api" calls.
101 * elm_mywidget_add(Evas_Object *parent)
107 * // ALWAYS call this - this checks that your widget matches that of
108 * // elementary and that the api hasn't broken. if it has this returns
109 * // false and you need to handle this error gracefully
110 * if (!elm_widget_api_check(ELM_INTERNAL_API_VERSION)) return NULL;
112 * // standard widget setup and allocate wd, create obj given parent etc.
113 * ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
115 * // give it a type name and set up a mywidget type string if needed
116 * ELM_SET_WIDTYPE(widtype, "mywidget");
117 * elm_widget_type_set(obj, "mywidget");
118 * // tell the parent widget that we are a sub object
119 * elm_widget_sub_object_add(parent, obj);
120 * // setup hooks we need (some are optional)
121 * elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
122 * elm_widget_data_set(obj, wd);
123 * elm_widget_del_hook_set(obj, _del_hook);
124 * elm_widget_theme_hook_set(obj, _theme_hook);
125 * elm_widget_disable_hook_set(obj, _disable_hook);
126 * // this widget can focus (true means yes it can, false means it can't)
127 * elm_widget_can_focus_set(obj, EINA_TRUE);
129 * // for this widget we will add 1 sub object that is an edje object
130 * wd->sub = edje_object_add(e);
131 * // set the theme. this follows a scheme for group name like this:
132 * // "elm/WIDGETNAME/ELEMENT/STYLE"
133 * // so here it will be:
134 * // "elm/mywidget/base/default"
135 * // changing style changes style name from default (all widgets start
136 * // with the default style) and element is for your widget internal
137 * // structure as you see fit
138 * elm_widget_theme_object_set(obj, wd->sub, "mywidget", "base", "default");
139 * // listen to a signal from the edje object to produce widget smart
140 * // callback (like click)
141 * edje_object_signal_callback_add(wd->sub, "elm,action,click", "",
142 * _signal_clicked, obj);
143 * // set this sub object as the "resize object". widgets get 1 resize
144 * // object that is resized along with the object wrapper.
145 * elm_widget_resize_object_set(obj, wd->sub);
147 * // evaluate sizing of the widget (minimum size calc etc.). optional but
148 * // not a bad idea to do here. it will get queued for later anyway
151 * // register the smart callback descriptions so we can have some runtime
152 * // info as to what the smart callback strings mean
153 * evas_object_smart_callbacks_descriptions_set(obj, _signals);
157 * // example - do "whatever" to the widget (here just emit a signal)
159 * elm_mywidget_whatever(Evas_Object *obj)
161 * // check if type is correct - check will return if it fails
162 * ELM_CHECK_WIDTYPE(obj, widtype);
163 * // get widget data - type is correct and sane by this point, so this
164 * // should never fail
165 * Widget_Data *wd = elm_widget_data_get(obj);
166 * // do whatever you like
167 * edje_object_signal_emit(wd->sub, "elm,state,action,whatever", "elm");
170 * // you can add more - you need to see elementary's code to know how to
171 * // handle all cases. remember this api is not stable and may change. it's
176 #ifndef ELM_INTERNAL_API_ARGESFSDFEFC
177 # warning "You are using an internal elementary API. This API is not stable"
178 # warning "and is subject to change. You use this at your own risk."
179 # warning "Remember to call elm_widget_api_check(ELM_INTERNAL_API_VERSION);"
180 # warning "in your widgets before you call any other elm_widget calls to do"
181 # warning "a correct runtime version check. Also remember - you don't NEED"
182 # warning "to make an Elementary widget is almost ALL cases. You can easily"
183 # warning "make a smart object with Evas's API and do everything you need"
184 # warning "there. You only need a widget if you want to seamlessly be part"
185 # warning "of the focus tree and want to transparently become a container"
186 # warning "for any number of child Elementary widgets"
187 //# error "ERROR. Compile aborted." // Note : Do not merge this from upstream.
189 #define ELM_INTERNAL_API_VERSION 7000
191 typedef struct _Elm_Tooltip Elm_Tooltip;
192 typedef struct _Elm_Cursor Elm_Cursor;
193 typedef struct _Elm_Widget_Item Elm_Widget_Item; /**< base structure for all widget items that are not Elm_Widget themselves */
195 typedef struct _Elm_Access_Info Elm_Access_Info; /**< accessibility information to be able to set and get from the access API */
196 typedef struct _Elm_Access_Item Elm_Access_Item; /**< accessibility info item */
198 typedef void (*Elm_Widget_On_Text_Set_Cb)(void *data, const char *part, const char *text);
199 typedef void (*Elm_Widget_On_Content_Set_Cb)(void *data, const char *part, Evas_Object *content);
200 typedef const char *(*Elm_Widget_On_Text_Get_Cb)(const void *data, const char *part);
201 typedef Evas_Object *(*Elm_Widget_On_Content_Get_Cb)(const void *data, const char *part);
202 typedef Evas_Object *(*Elm_Widget_On_Content_Unset_Cb)(const void *data, const char *part);
203 typedef void (*Elm_Widget_On_Signal_Emit_Cb)(void *data, const char *emission, const char *source);
205 #define ELM_ACCESS_TYPE 0 // when reading out widget or item this is read first
206 #define ELM_ACCESS_INFO 1 // next read is info - this is normally label
207 #define ELM_ACCESS_STATE 2 // if there is a state (eg checkbox) then read state out
208 #define ELM_ACCESS_CONTENT 3 // read ful content - eg all of the label, not a shortened version
210 #define ELM_ACCESS_DONE -1 // sentence done - send done event here
211 #define ELM_ACCESS_CANCEL -2 // stop reading immediately
213 typedef char *(*Elm_Access_Content_Cb)(void *data, Evas_Object *obj, Elm_Widget_Item *item);
215 struct _Elm_Access_Item
219 Elm_Access_Content_Cb func;
222 struct _Elm_Access_Info
225 Ecore_Timer *delay_timer;
228 EAPI void _elm_access_clear(Elm_Access_Info *ac);
229 EAPI void _elm_access_text_set(Elm_Access_Info *ac, int type, const char *text);
230 EAPI void _elm_access_callback_set(Elm_Access_Info *ac, int type, Elm_Access_Content_Cb func, const void *data);
231 EAPI char *_elm_access_text_get(Elm_Access_Info *ac, int type, Evas_Object *obj, Elm_Widget_Item *item);
232 EAPI void _elm_access_read(Elm_Access_Info *ac, int type, Evas_Object *obj, Elm_Widget_Item *item);
233 EAPI void _elm_access_say(const char *txt);
234 EAPI Elm_Access_Info *_elm_access_object_get(Evas_Object *obj);
235 EAPI Elm_Access_Info *_elm_access_item_get(Elm_Widget_Item *it);
236 EAPI void _elm_access_object_hilight(Evas_Object *obj);
237 EAPI void _elm_access_object_unhilight(Evas_Object *obj);
238 EAPI void _elm_access_object_hilight_disable(Evas *e);
239 EAPI void _elm_access_object_register(Evas_Object *obj, Evas_Object *hoverobj);
240 EAPI void _elm_access_item_register(Elm_Widget_Item *item, Evas_Object *hoverobj);
241 EAPI Eina_Bool _elm_access_2nd_click_timeout(Evas_Object *obj);
243 #define ELM_WIDGET_ITEM Elm_Widget_Item base /**< put this as the first member in your widget item struct */
244 struct _Elm_Widget_Item
246 /* ef1 ~~ efl, el3 ~~ elm */
247 #define ELM_WIDGET_ITEM_MAGIC 0xef1e1301
250 /* simple accessor macros */
251 #define VIEW(X) X->base.view
252 #define WIDGET(X) X->base.widget
253 Evas_Object *widget; /**< the owner widget that owns this item */
254 Evas_Object *view; /**< the base view object */
255 const void *data; /**< item specific data */
256 Evas_Smart_Cb del_cb; /**< used to notify the item is being deleted */
257 Elm_Widget_On_Content_Set_Cb on_content_set_func;
258 Elm_Widget_On_Content_Get_Cb on_content_get_func;
259 Elm_Widget_On_Content_Unset_Cb on_content_unset_func;
260 Elm_Widget_On_Text_Set_Cb on_text_set_func;
261 Elm_Widget_On_Text_Get_Cb on_text_get_func;
262 Elm_Widget_On_Signal_Emit_Cb on_signal_emit_func;
263 Elm_Access_Info *access;
264 const char *access_info;
265 /* widget variations should have data from here and on */
266 /* @todo: TODO check if this is enough for 1.0 release, maybe add padding! */
269 struct _Elm_Object_Item
274 #define ELM_NEW(t) calloc(1, sizeof(t))
276 #define ELM_OBJ_ITEM_CHECK_OR_RETURN(it, ...) \
277 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *) (it), __VA_ARGS__); \
278 ELM_CHECK_WIDTYPE(it->base.widget, widtype) __VA_ARGS__;
280 EAPI Eina_Bool elm_widget_api_check(int ver);
281 EAPI Evas_Object *elm_widget_add(Evas *evas);
282 EAPI void elm_widget_del_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
283 EAPI void elm_widget_del_pre_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
284 EAPI void elm_widget_focus_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
285 EAPI void elm_widget_activate_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
286 EAPI void elm_widget_disable_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
287 EAPI void elm_widget_theme_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
288 EAPI void elm_widget_translate_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
289 EAPI void elm_widget_event_hook_set(Evas_Object *obj, Eina_Bool (*func) (Evas_Object *obj, Evas_Object *source, Evas_Callback_Type type, void *event_info));
290 EAPI void elm_widget_changed_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
291 EAPI void elm_widget_signal_emit_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj, const char *emission, const char *source));
292 EAPI void elm_widget_signal_callback_add_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data));
293 EAPI void elm_widget_signal_callback_del_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data));
294 EAPI void elm_widget_theme(Evas_Object *obj);
295 EAPI void elm_widget_theme_specific(Evas_Object *obj, Elm_Theme *th, Eina_Bool force);
296 EAPI void elm_widget_translate(Evas_Object *obj);
297 EAPI void elm_widget_focus_next_hook_set(Evas_Object *obj, Eina_Bool (*func) (const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next));
298 EAPI void elm_widget_on_focus_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data);
299 EAPI void elm_widget_on_change_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data);
300 EAPI void elm_widget_on_show_region_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data);
301 EAPI void elm_widget_focus_region_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h));
302 EAPI void elm_widget_text_set_hook_set(Evas_Object *obj, Elm_Widget_On_Text_Set_Cb func);
303 #define elm_widget_text_set_hook_set(obj, func) elm_widget_text_set_hook_set(obj, (Elm_Widget_On_Text_Set_Cb)(func))
304 EAPI void elm_widget_text_get_hook_set(Evas_Object *obj, Elm_Widget_On_Text_Get_Cb func);
305 #define elm_widget_text_get_hook_set(obj, func) elm_widget_text_get_hook_set(obj, (Elm_Widget_On_Text_Get_Cb)(func))
306 EAPI void elm_widget_content_set_hook_set(Evas_Object *obj, Elm_Widget_On_Content_Set_Cb func);
307 #define elm_widget_content_set_hook_set(obj, func) elm_widget_content_set_hook_set(obj, (Elm_Widget_On_Content_Set_Cb)(func))
308 EAPI void elm_widget_content_get_hook_set(Evas_Object *obj, Elm_Widget_On_Content_Get_Cb func);
309 #define elm_widget_content_get_hook_set(obj, func) elm_widget_content_get_hook_set(obj, (Elm_Widget_On_Content_Get_Cb)(func))
310 EAPI void elm_widget_content_unset_hook_set(Evas_Object *obj, Elm_Widget_On_Content_Unset_Cb func);
311 #define elm_widget_content_unset_hook_set(obj, func) elm_widget_content_unset_hook_set(obj, (Elm_Widget_On_Content_Unset_Cb)(func))
312 EAPI void elm_widget_on_focus_region_hook_set(Evas_Object *obj, void (*func) (const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h));
313 EAPI void elm_widget_data_set(Evas_Object *obj, void *data);
314 EAPI void *elm_widget_data_get(const Evas_Object *obj);
315 EAPI void elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj);
316 EAPI void elm_widget_sub_object_del(Evas_Object *obj, Evas_Object *sobj);
317 EAPI void elm_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj);
318 EAPI void elm_widget_hover_object_set(Evas_Object *obj, Evas_Object *sobj);
319 EAPI void elm_widget_signal_emit(Evas_Object *obj, const char *emission, const char *source);
320 EAPI void elm_widget_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source), void *data);
321 EAPI void *elm_widget_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source));
322 EAPI void elm_widget_can_focus_set(Evas_Object *obj, Eina_Bool can_focus);
323 EAPI Eina_Bool elm_widget_can_focus_get(const Evas_Object *obj);
324 EAPI Eina_Bool elm_widget_child_can_focus_get(const Evas_Object *obj);
325 EAPI void elm_widget_tree_unfocusable_set(Evas_Object *obj, Eina_Bool tree_unfocusable);
326 EAPI Eina_Bool elm_widget_tree_unfocusable_get(const Evas_Object *obj);
327 EAPI void elm_widget_highlight_ignore_set(Evas_Object *obj, Eina_Bool ignore);
328 EAPI Eina_Bool elm_widget_highlight_ignore_get(const Evas_Object *obj);
329 EAPI void elm_widget_highlight_in_theme_set(Evas_Object *obj, Eina_Bool highlight);
330 EAPI Eina_Bool elm_widget_highlight_in_theme_get(const Evas_Object *obj);
331 EAPI Eina_Bool elm_widget_focus_get(const Evas_Object *obj);
332 EAPI Evas_Object *elm_widget_focused_object_get(const Evas_Object *obj);
333 EAPI Evas_Object *elm_widget_top_get(const Evas_Object *obj);
334 EAPI Eina_Bool elm_widget_is(const Evas_Object *obj);
335 EAPI Evas_Object *elm_widget_parent_widget_get(const Evas_Object *obj);
336 EAPI void elm_widget_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, const void *data);
337 EAPI void *elm_widget_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data);
338 EAPI Eina_Bool elm_widget_event_propagate(Evas_Object *obj, Evas_Callback_Type type, void *event_info, Evas_Event_Flags *event_flags);
339 EAPI void elm_widget_focus_custom_chain_set(Evas_Object *obj, Eina_List *objs);
340 EAPI void elm_widget_focus_custom_chain_unset(Evas_Object *obj);
341 EAPI const Eina_List *elm_widget_focus_custom_chain_get(const Evas_Object *obj);
342 EAPI void elm_widget_focus_custom_chain_append(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
343 EAPI void elm_widget_focus_custom_chain_prepend(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
344 EAPI void elm_widget_focus_cycle(Evas_Object *obj, Elm_Focus_Direction dir);
345 EAPI void elm_widget_focus_direction_go(Evas_Object *obj, int x, int y);
346 EAPI Eina_Bool elm_widget_focus_next_get(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next);
347 EAPI Eina_Bool elm_widget_focus_list_next_get(const Evas_Object *obj, const Eina_List *items, void *(*list_data_get) (const Eina_List *list), Elm_Focus_Direction dir, Evas_Object **next);
348 EAPI void elm_widget_focus_set(Evas_Object *obj, int first);
349 EAPI void elm_widget_focused_object_clear(Evas_Object *obj);
350 EAPI Evas_Object *elm_widget_parent_get(const Evas_Object *obj);
351 EAPI void elm_widget_focus_steal(Evas_Object *obj);
356 * Restore the focus state of the sub-tree.
358 * This API will restore the focus state of the sub-tree to the lastest
359 * state. If a sub-tree is unfocused and wants to get back to the lastest
360 * focus state, this API will be helpful.
362 * @param obj The widget root of sub-tree
366 EAPI void elm_widget_focus_restore(Evas_Object *obj);
368 EAPI void elm_widget_activate(Evas_Object *obj);
369 EAPI void elm_widget_change(Evas_Object *obj);
370 EAPI void elm_widget_disabled_set(Evas_Object *obj, Eina_Bool disabled);
371 EAPI Eina_Bool elm_widget_disabled_get(const Evas_Object *obj);
372 EAPI void elm_widget_show_region_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Eina_Bool forceshow);
373 EAPI void elm_widget_show_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
374 EAPI void elm_widget_focus_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
375 EAPI void elm_widget_scroll_hold_push(Evas_Object *obj);
376 EAPI void elm_widget_scroll_hold_pop(Evas_Object *obj);
377 EAPI int elm_widget_scroll_hold_get(const Evas_Object *obj);
378 EAPI void elm_widget_scroll_freeze_push(Evas_Object *obj);
379 EAPI void elm_widget_scroll_freeze_pop(Evas_Object *obj);
380 EAPI int elm_widget_scroll_freeze_get(const Evas_Object *obj);
381 EAPI void elm_widget_scale_set(Evas_Object *obj, double scale);
382 EAPI double elm_widget_scale_get(const Evas_Object *obj);
383 EAPI Eina_Bool elm_widget_mirrored_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
384 EAPI void elm_widget_mirrored_set(Evas_Object *obj, Eina_Bool mirrored) EINA_ARG_NONNULL(1);
385 EAPI Eina_Bool elm_widget_mirrored_automatic_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
386 EAPI void elm_widget_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic) EINA_ARG_NONNULL(1);
387 EAPI void elm_widget_theme_set(Evas_Object *obj, Elm_Theme *th);
388 EAPI Elm_Theme *elm_widget_theme_get(const Evas_Object *obj);
389 EAPI void elm_widget_style_set(Evas_Object *obj, const char *style);
390 EAPI const char *elm_widget_style_get(const Evas_Object *obj);
391 EAPI void elm_widget_type_set(Evas_Object *obj, const char *type);
392 EAPI const char *elm_widget_type_get(const Evas_Object *obj);
393 EAPI void elm_widget_tooltip_add(Evas_Object *obj, Elm_Tooltip *tt);
394 EAPI void elm_widget_tooltip_del(Evas_Object *obj, Elm_Tooltip *tt);
395 EAPI void elm_widget_cursor_add(Evas_Object *obj, Elm_Cursor *cur);
396 EAPI void elm_widget_cursor_del(Evas_Object *obj, Elm_Cursor *cur);
397 EAPI void elm_widget_drag_lock_x_set(Evas_Object *obj, Eina_Bool lock);
398 EAPI void elm_widget_drag_lock_y_set(Evas_Object *obj, Eina_Bool lock);
399 EAPI Eina_Bool elm_widget_drag_lock_x_get(const Evas_Object *obj);
400 EAPI Eina_Bool elm_widget_drag_lock_y_get(const Evas_Object *obj);
401 EAPI int elm_widget_drag_child_locked_x_get(const Evas_Object *obj);
402 EAPI int elm_widget_drag_child_locked_y_get(const Evas_Object *obj);
403 EAPI Eina_Bool elm_widget_theme_object_set(Evas_Object *obj, Evas_Object *edj, const char *wname, const char *welement, const char *wstyle);
404 EAPI void elm_widget_type_register(const char **ptr);
405 EAPI void elm_widget_type_unregister(const char **ptr);
406 EAPI Eina_Bool elm_widget_is_check(const Evas_Object *obj);
407 EAPI Eina_Bool elm_widget_type_check(const Evas_Object *obj, const char *type);
408 EAPI Eina_List *elm_widget_stringlist_get(const char *str);
409 EAPI void elm_widget_stringlist_free(Eina_List *list);
410 EAPI void elm_widget_focus_hide_handle(Evas_Object *obj);
411 EAPI void elm_widget_focus_mouse_up_handle(Evas_Object *obj);
412 EAPI void elm_widget_focus_tree_unfocusable_handle(Evas_Object *obj);
413 EAPI void elm_widget_focus_disabled_handle(Evas_Object *obj);
414 EAPI void elm_widget_text_part_set(Evas_Object *obj, const char *part, const char *label);
415 EAPI const char *elm_widget_text_part_get(const Evas_Object *obj, const char *part);
416 EAPI void elm_widget_domain_translatable_text_part_set(Evas_Object *obj, const char *part, const char *domain, const char *text);
417 EAPI const char *elm_widget_translatable_text_part_get(const Evas_Object *obj, const char *part);
418 EAPI void elm_widget_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content);
419 EAPI Evas_Object *elm_widget_content_part_get(const Evas_Object *obj, const char *part);
420 EAPI Evas_Object *elm_widget_content_part_unset(Evas_Object *obj, const char *part);
421 EAPI void elm_widget_access_info_set(Evas_Object *obj, const char *txt);
422 EAPI const char *elm_widget_access_info_get(Evas_Object *obj);
423 EAPI Elm_Widget_Item *_elm_widget_item_new(Evas_Object *parent, size_t alloc_size);
424 EAPI void _elm_widget_item_del(Elm_Widget_Item *item);
425 EAPI void _elm_widget_item_pre_notify_del(Elm_Widget_Item *item);
426 EAPI void _elm_widget_item_del_cb_set(Elm_Widget_Item *item, Evas_Smart_Cb del_cb);
427 EAPI void _elm_widget_item_data_set(Elm_Widget_Item *item, const void *data);
428 EAPI void *_elm_widget_item_data_get(const Elm_Widget_Item *item);
429 EAPI void _elm_widget_item_tooltip_text_set(Elm_Widget_Item *item, const char *text);
430 EAPI void _elm_widget_item_tooltip_translatable_text_set(Elm_Widget_Item *item, const char *text);
431 EAPI void _elm_widget_item_tooltip_content_cb_set(Elm_Widget_Item *item, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb);
432 EAPI void _elm_widget_item_tooltip_unset(Elm_Widget_Item *item);
433 EAPI void _elm_widget_item_tooltip_style_set(Elm_Widget_Item *item, const char *style);
434 EAPI Eina_Bool _elm_widget_item_tooltip_size_restrict_disable(Elm_Widget_Item *item, Eina_Bool disable);
435 EAPI Eina_Bool _elm_widget_item_tooltip_size_restrict_disabled_get(const Elm_Widget_Item *item);
436 EAPI const char *_elm_widget_item_tooltip_style_get(const Elm_Widget_Item *item);
437 EAPI void _elm_widget_item_cursor_set(Elm_Widget_Item *item, const char *cursor);
438 EAPI const char *_elm_widget_item_cursor_get(const Elm_Widget_Item *item);
439 EAPI void _elm_widget_item_cursor_unset(Elm_Widget_Item *item);
440 EAPI void _elm_widget_item_cursor_style_set(Elm_Widget_Item *item, const char *style);
441 EAPI const char *_elm_widget_item_cursor_style_get(const Elm_Widget_Item *item);
442 EAPI void _elm_widget_item_cursor_engine_only_set(Elm_Widget_Item *item, Eina_Bool engine_only);
443 EAPI Eina_Bool _elm_widget_item_cursor_engine_only_get(const Elm_Widget_Item *item);
444 EAPI void _elm_widget_item_content_part_set(Elm_Widget_Item *item, const char *part, Evas_Object *content);
445 EAPI Evas_Object *_elm_widget_item_content_part_get(const Elm_Widget_Item *item, const char *part);
446 EAPI Evas_Object *_elm_widget_item_content_part_unset(Elm_Widget_Item *item, const char *part);
447 EAPI void _elm_widget_item_text_part_set(Elm_Widget_Item *item, const char *part, const char *label);
448 EAPI const char *_elm_widget_item_text_part_get(const Elm_Widget_Item *item, const char *part);
449 EAPI void _elm_widget_item_signal_emit(Elm_Widget_Item *item, const char *emission, const char *source);
450 EAPI void _elm_widget_item_content_set_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Content_Set_Cb func);
451 EAPI void _elm_widget_item_content_get_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Content_Get_Cb func);
452 EAPI void _elm_widget_item_content_unset_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Content_Unset_Cb func);
453 EAPI void _elm_widget_item_text_set_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Text_Set_Cb func);
454 EAPI void _elm_widget_item_text_get_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Text_Get_Cb func);
455 EAPI void _elm_widget_item_signal_emit_hook_set(Elm_Widget_Item *it, Elm_Widget_On_Signal_Emit_Cb func);
456 EAPI void _elm_widget_item_access_info_set(Elm_Widget_Item *item, const char *txt);
459 /* debug function. don't use it unless you are tracking parenting issues */
460 EAPI void elm_widget_tree_dump(const Evas_Object *top);
461 EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *output);
464 * Convenience macro to create new widget item, doing casts for you.
465 * @see _elm_widget_item_new()
466 * @param parent a valid elm_widget variant.
467 * @param type the C type that extends Elm_Widget_Item
469 #define elm_widget_item_new(parent, type) \
470 (type *)_elm_widget_item_new((parent), sizeof(type))
472 * Convenience macro to delete widget item, doing casts for you.
473 * @see _elm_widget_item_del()
474 * @param item a valid item.
476 #define elm_widget_item_del(item) \
477 _elm_widget_item_del((Elm_Widget_Item *)item)
479 * Convenience macro to notify deletion of widget item, doing casts for you.
480 * @see _elm_widget_item_pre_notify_del()
482 #define elm_widget_item_pre_notify_del(item) \
483 _elm_widget_item_pre_notify_del((Elm_Widget_Item *)item)
485 * Convenience macro to set deletion callback of widget item, doing casts for you.
486 * @see _elm_widget_item_del_cb_set()
488 #define elm_widget_item_del_cb_set(item, del_cb) \
489 _elm_widget_item_del_cb_set((Elm_Widget_Item *)item, del_cb)
493 * @see _elm_widget_item_data_set()
495 #define elm_widget_item_data_set(item, data) \
496 _elm_widget_item_data_set((Elm_Widget_Item *)item, data)
499 * @see _elm_widget_item_data_get()
501 #define elm_widget_item_data_get(item) \
502 _elm_widget_item_data_get((const Elm_Widget_Item *)item)
505 * Convenience function to set widget item tooltip as a text string.
506 * @see _elm_widget_item_tooltip_text_set()
508 #define elm_widget_item_tooltip_text_set(item, text) \
509 _elm_widget_item_tooltip_text_set((Elm_Widget_Item *)item, text)
511 * Convenience function to set widget item tooltip as a text string.
512 * @see _elm_widget_item_tooltip_text_set()
514 #define elm_widget_item_tooltip_translatable_text_set(item, text) \
515 _elm_widget_item_tooltip_translatable_text_set((Elm_Widget_Item *)item, text)
517 * Convenience function to set widget item tooltip.
518 * @see _elm_widget_item_tooltip_content_cb_set()
520 #define elm_widget_item_tooltip_content_cb_set(item, func, data, del_cb) \
521 _elm_widget_item_tooltip_content_cb_set((Elm_Widget_Item *)item, \
524 * Convenience function to unset widget item tooltip.
525 * @see _elm_widget_item_tooltip_unset()
527 #define elm_widget_item_tooltip_unset(item) \
528 _elm_widget_item_tooltip_unset((Elm_Widget_Item *)item)
530 * Convenience function to change item's tooltip style.
531 * @see _elm_widget_item_tooltip_style_set()
533 #define elm_widget_item_tooltip_style_set(item, style) \
534 _elm_widget_item_tooltip_style_set((Elm_Widget_Item *)item, style)
536 #define elm_widget_item_tooltip_size_restrict_disable(item, disable) \
537 _elm_widget_item_tooltip_size_restrict_disable((Elm_Widget_Item *)item, disable)
539 #define elm_widget_item_tooltip_size_restrict_disabled_get(item) \
540 _elm_widget_item_tooltip_size_restrict_disabled_get((Elm_Widget_Item *)item)
542 * Convenience function to query item's tooltip style.
543 * @see _elm_widget_item_tooltip_style_get()
545 #define elm_widget_item_tooltip_style_get(item) \
546 _elm_widget_item_tooltip_style_get((const Elm_Widget_Item *)item)
548 * Convenience function to set widget item cursor.
549 * @see _elm_widget_item_cursor_set()
551 #define elm_widget_item_cursor_set(item, cursor) \
552 _elm_widget_item_cursor_set((Elm_Widget_Item *)item, cursor)
554 * Convenience function to get widget item cursor.
555 * @see _elm_widget_item_cursor_get()
557 #define elm_widget_item_cursor_get(item) \
558 _elm_widget_item_cursor_get((const Elm_Widget_Item *)item)
560 * Convenience function to unset widget item cursor.
561 * @see _elm_widget_item_cursor_unset()
563 #define elm_widget_item_cursor_unset(item) \
564 _elm_widget_item_cursor_unset((Elm_Widget_Item *)item)
566 * Convenience function to change item's cursor style.
567 * @see _elm_widget_item_cursor_style_set()
569 #define elm_widget_item_cursor_style_set(item, style) \
570 _elm_widget_item_cursor_style_set((Elm_Widget_Item *)item, style)
572 * Convenience function to query item's cursor style.
573 * @see _elm_widget_item_cursor_style_get()
575 #define elm_widget_item_cursor_style_get(item) \
576 _elm_widget_item_cursor_style_get((const Elm_Widget_Item *)item)
578 * Convenience function to change item's cursor engine_only.
579 * @see _elm_widget_item_cursor_engine_only_set()
581 #define elm_widget_item_cursor_engine_only_set(item, engine_only) \
582 _elm_widget_item_cursor_engine_only_set((Elm_Widget_Item *)item, engine_only)
584 * Convenience function to query item's cursor engine_only.
585 * @see _elm_widget_item_cursor_engine_only_get()
587 #define elm_widget_item_cursor_engine_only_get(item) \
588 _elm_widget_item_cursor_engine_only_get((const Elm_Widget_Item *)item)
590 * Convenience function to query item's content part set.
591 * @see _elm_widget_item_content_part_set()
593 #define elm_widget_item_content_part_set(item, part, content) \
594 _elm_widget_item_content_part_set((Elm_Widget_Item *)item, part, content)
596 * Convenience function to query item's content part get.
597 * @see _elm_widget_item_content_part_get()
599 #define elm_widget_item_content_part_get(item, part) \
600 _elm_widget_item_content_part_get((const Elm_Widget_Item *)item, part)
602 * Convenience function to query item's content part unset.
603 * @see _elm_widget_item_content_part_unset()
605 #define elm_widget_item_content_part_unset(item, part) \
606 _elm_widget_item_content_part_unset((Elm_Widget_Item *)item, part)
608 * Convenience function to query item's text part set.
609 * @see _elm_widget_item_text_part_set()
611 #define elm_widget_item_text_part_set(item, part, label) \
612 _elm_widget_item_text_part_set((Elm_Widget_Item *)item, part, label)
614 * Convenience function to query item's text part get.
615 * @see _elm_widget_item_text_part_get()
617 #define elm_widget_item_text_part_get(item, part) \
618 _elm_widget_item_text_part_get((const Elm_Widget_Item *)item, part)
620 * Convenience function to query item's signal emit.
621 * @see _elm_widget_item_signal_emit()
623 #define elm_widget_item_signal_emit(item, emission, source) \
624 _elm_widget_item_signal_emit((Elm_Widget_Item *)item, emission, source)
626 * Convenience function to query item's content set hook.
627 * @see _elm_widget_item_content_set_hook_set()
629 #define elm_widget_item_content_set_hook_set(item, func) \
630 _elm_widget_item_content_set_hook_set((Elm_Widget_Item *)item, (Elm_Widget_On_Content_Set_Cb)func)
632 * Convenience function to query item's content get hook.
633 * @see _elm_widget_item_content_get_hook_set()
635 #define elm_widget_item_content_get_hook_set(item, func) \
636 _elm_widget_item_content_get_hook_set((Elm_Widget_Item *)item, (Elm_Widget_On_Content_Get_Cb)func)
638 * Convenience function to query item's content unset hook.
639 * @see _elm_widget_item_content_unset_hook_set()
641 #define elm_widget_item_content_unset_hook_set(item, func) \
642 _elm_widget_item_content_unset_hook_set((Elm_Widget_Item *)item, (Elm_Widget_On_Content_Unset_Cb)func)
644 * Convenience function to query item's text set hook.
645 * @see _elm_widget_item_text_set_hook_set()
647 #define elm_widget_item_text_set_hook_set(item, func) \
648 _elm_widget_item_text_set_hook_set((Elm_Widget_Item *)item, (Elm_Widget_On_Text_Set_Cb)func)
650 * Convenience function to query item's text get hook.
651 * @see _elm_widget_item_text_get_hook_set()
653 #define elm_widget_item_text_get_hook_set(item, func) \
654 _elm_widget_item_text_get_hook_set((Elm_Widget_Item *)item, (Elm_Widget_On_Text_Get_Cb)func)
656 * Convenience function to query item's signal emit hook.
657 * @see _elm_widget_item_signal_emit_hook_set()
659 #define elm_widget_item_signal_emit_hook_set(item, func) \
660 _elm_widget_item_signal_emit_hook_set((Elm_Widget_Item *)item, (Elm_Widget_On_Signal_Emit_Cb)func)
663 #define ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, ...) \
666 CRITICAL("Elm_Widget_Item " # item " is NULL!"); \
667 return __VA_ARGS__; \
669 if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) { \
670 EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC); \
671 return __VA_ARGS__; \
675 #define ELM_WIDGET_ITEM_CHECK_OR_GOTO(item, label) \
678 CRITICAL("Elm_Widget_Item " # item " is NULL!"); \
681 if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) { \
682 EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC); \
687 #define ELM_SET_WIDTYPE(widtype, type) \
690 widtype = eina_stringshare_add(type); \
691 elm_widget_type_register(&widtype); \
695 #define ELM_CHECK_WID_IS(obj) \
696 if (!elm_widget_is_check(obj)) return
698 #define ELM_CHECK_WIDTYPE(obj, widtype) \
699 if (!elm_widget_type_check((obj), (widtype))) return
701 #define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, ...) \
702 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
703 ELM_CHECK_WIDTYPE(it->base.widget, widtype) __VA_ARGS__;
705 #define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(it, label) \
706 ELM_WIDGET_ITEM_CHECK_OR_GOTO((Elm_Widget_Item *)it, label); \
707 if (!elm_widget_type_check((it->base.widget), (widtype))) goto label;
709 #define ELM_WIDGET_STANDARD_SETUP(wdat, wdtype, par, evas, ob, ret) \
711 EINA_SAFETY_ON_NULL_RETURN_VAL((par), (ret)); \
712 evas = evas_object_evas_get(par); if (!(evas)) return (ret); \
713 wdat = ELM_NEW(wdtype); if (!(wdat)) return (ret); \
714 ob = elm_widget_add(evas); if (!(ob)) { free(wdat); return (ret); } \
718 * The drag and drop API.
719 * Currently experimental, and will change when it does dynamic type
722 * Here so applications can start to use it, if they ask elm nicely.
724 * And yes, elm_widget, should probably be elm_experimental...
725 * Complaints about this code should go to /dev/null, or failing that nash.
727 typedef struct _Elm_Selection_Data Elm_Selection_Data;
729 typedef Eina_Bool (*Elm_Drop_Cb) (void *d, Evas_Object *o, Elm_Selection_Data *data);
731 typedef enum _Elm_Sel_Type
741 typedef enum _Elm_Sel_Format
743 /** Plain unformated text: Used for things that don't want rich markup */
744 ELM_SEL_FORMAT_TEXT = 0x01,
745 /** Edje textblock markup, including inline images */
746 ELM_SEL_FORMAT_MARKUP = 0x02,
748 ELM_SEL_FORMAT_IMAGE = 0x04,
750 ELM_SEL_FORMAT_VCARD = 0x08,
751 /** Raw HTMLish things for widgets that want that stuff (hello webkit!) */
752 ELM_SEL_FORMAT_HTML = 0x10,
755 struct _Elm_Selection_Data
758 Elm_Sel_Format format;
763 Eina_Bool elm_selection_set(Elm_Sel_Type selection, Evas_Object *widget, Elm_Sel_Format format, const char *buf);
764 Eina_Bool elm_selection_clear(Elm_Sel_Type selection, Evas_Object *widget);
765 Eina_Bool elm_selection_get(Elm_Sel_Type selection, Elm_Sel_Format format, Evas_Object *widget, Elm_Drop_Cb datacb, void *udata);
766 Eina_Bool elm_drop_target_add(Evas_Object *widget, Elm_Sel_Type, Elm_Drop_Cb, void *);
767 Eina_Bool elm_drop_target_del(Evas_Object *widget);
768 Eina_Bool elm_drag_start(Evas_Object *, Elm_Sel_Format, const char *, void (*)(void *,Evas_Object*),void*);