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."
189 #define ELM_INTERNAL_API_VERSION 7000
191 typedef struct _Elm_Tooltip Elm_Tooltip;
192 typedef struct _Elm_Cursor Elm_Cursor;
194 /**< base structure for all widget items that are not Elm_Widget themselves */
195 typedef struct _Elm_Widget_Item Elm_Widget_Item;
197 /**< accessibility information to be able to set and get from the access API */
198 typedef struct _Elm_Access_Info Elm_Access_Info;
200 /**< accessibility info item */
201 typedef struct _Elm_Access_Item Elm_Access_Item;
203 typedef void (*Elm_Widget_Text_Set_Cb)(void *data, const char *part, const char *text);
204 typedef void (*Elm_Widget_Content_Set_Cb)(void *data, const char *part, Evas_Object *content);
205 typedef const char *(*Elm_Widget_Text_Get_Cb)(const void *data, const char *part);
206 typedef Evas_Object *(*Elm_Widget_Content_Get_Cb)(const void *data, const char *part);
207 typedef Evas_Object *(*Elm_Widget_Content_Unset_Cb)(const void *data, const char *part);
208 typedef void (*Elm_Widget_Signal_Emit_Cb)(void *data, const char *emission, const char *source);
209 typedef void (*Elm_Widget_Disable_Cb)(void *data);
210 typedef void (*Elm_Widget_Del_Pre_Cb)(void *data);
212 #define ELM_ACCESS_TYPE 0 // when reading out widget or item this is read first
213 #define ELM_ACCESS_INFO 1 // next read is info - this is normally label
214 #define ELM_ACCESS_STATE 2 // if there is a state (eg checkbox) then read state out
215 #define ELM_ACCESS_CONTENT 3 // read ful content - eg all of the label, not a shortened version
217 #define ELM_ACCESS_DONE -1 // sentence done - send done event here
218 #define ELM_ACCESS_CANCEL -2 // stop reading immediately
220 typedef char *(*Elm_Access_Content_Cb)(void *data, Evas_Object *obj, Elm_Widget_Item *item);
222 struct _Elm_Access_Item
226 Elm_Access_Content_Cb func;
229 struct _Elm_Access_Info
232 Ecore_Timer *delay_timer;
235 EAPI void _elm_access_clear(Elm_Access_Info *ac);
236 EAPI void _elm_access_text_set(Elm_Access_Info *ac, int type, const char *text);
237 EAPI void _elm_access_callback_set(Elm_Access_Info *ac, int type, Elm_Access_Content_Cb func, const void *data);
238 EAPI char *_elm_access_text_get(Elm_Access_Info *ac, int type, Evas_Object *obj, Elm_Widget_Item *item);
239 EAPI void _elm_access_read(Elm_Access_Info *ac, int type, Evas_Object *obj, Elm_Widget_Item *item);
240 EAPI void _elm_access_say(const char *txt);
241 EAPI Elm_Access_Info *_elm_access_object_get(Evas_Object *obj);
242 EAPI Elm_Access_Info *_elm_access_item_get(Elm_Widget_Item *it);
243 EAPI void _elm_access_object_hilight(Evas_Object *obj);
244 EAPI void _elm_access_object_unhilight(Evas_Object *obj);
245 EAPI void _elm_access_object_hilight_disable(Evas *e);
246 EAPI void _elm_access_object_register(Evas_Object *obj, Evas_Object *hoverobj);
247 EAPI void _elm_access_item_register(Elm_Widget_Item *item, Evas_Object *hoverobj);
248 EAPI Eina_Bool _elm_access_2nd_click_timeout(Evas_Object *obj);
250 /**< put this as the first member in your widget item struct */
251 #define ELM_WIDGET_ITEM Elm_Widget_Item base
253 struct _Elm_Widget_Item
255 /* ef1 ~~ efl, el3 ~~ elm */
256 #define ELM_WIDGET_ITEM_MAGIC 0xef1e1301
258 /* simple accessor macros */
259 #define VIEW(X) X->base.view
260 #define WIDGET(X) X->base.widget
261 /**< the owner widget that owns this item */
263 /**< the base view object */
265 /**< item specific data. used for del callback */
267 /**< user delete callback function */
268 Evas_Smart_Cb del_func;
269 /**< widget delete callback function. don't expose this callback call */
270 Elm_Widget_Del_Pre_Cb del_pre_func;
272 Elm_Widget_Content_Set_Cb content_set_func;
273 Elm_Widget_Content_Get_Cb content_get_func;
274 Elm_Widget_Content_Unset_Cb content_unset_func;
275 Elm_Widget_Text_Set_Cb text_set_func;
276 Elm_Widget_Text_Get_Cb text_get_func;
277 Elm_Widget_Signal_Emit_Cb signal_emit_func;
278 Elm_Widget_Disable_Cb disable_func;
279 Elm_Access_Info *access;
280 const char *access_info;
281 Eina_Bool disabled : 1;
282 /* widget variations should have data from here and on */
283 /* @todo: TODO check if this is enough for 1.0 release, maybe add padding! */
286 struct _Elm_Object_Item
291 #define ELM_NEW(t) calloc(1, sizeof(t))
293 #define ELM_OBJ_ITEM_CHECK_OR_RETURN(it, ...) \
294 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)(it), __VA_ARGS__); \
295 ELM_CHECK_WIDTYPE(WIDGET(it), widtype) __VA_ARGS__;
297 #define ELM_OBJ_ITEM_CHECK_OR_GOTO(it, label) \
298 ELM_WIDGET_ITEM_CHECK_OR_GOTO((Elm_Widget_Item *)it, label); \
299 if (!elm_widget_type_check(WIDGET(it), (widtype), __func__)) goto label;
301 EAPI Eina_Bool elm_widget_api_check(int ver);
302 EAPI Evas_Object *elm_widget_add(Evas *evas);
303 EAPI void elm_widget_del_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj));
304 EAPI void elm_widget_del_pre_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj));
305 EAPI void elm_widget_focus_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj));
306 EAPI void elm_widget_activate_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj));
307 EAPI void elm_widget_disable_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj));
308 EAPI void elm_widget_theme_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj));
309 EAPI void elm_widget_translate_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj));
310 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));
311 EAPI void elm_widget_changed_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj));
312 EAPI void elm_widget_signal_emit_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj, const char *emission, const char *source));
313 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));
314 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));
315 EAPI void elm_widget_theme(Evas_Object *obj);
316 EAPI void elm_widget_theme_specific(Evas_Object *obj, Elm_Theme *th, Eina_Bool force);
317 EAPI void elm_widget_translate(Evas_Object *obj);
318 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));
319 EAPI void elm_widget_on_focus_hook_set(Evas_Object *obj, void (*func)(void *data, Evas_Object *obj), void *data);
320 EAPI void elm_widget_on_change_hook_set(Evas_Object *obj, void (*func)(void *data, Evas_Object *obj), void *data);
321 EAPI void elm_widget_on_show_region_hook_set(Evas_Object *obj, void (*func)(void *data, Evas_Object *obj), void *data);
322 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));
323 EAPI void elm_widget_text_set_hook_set(Evas_Object *obj, Elm_Widget_Text_Set_Cb func);
324 #define elm_widget_text_set_hook_set(obj, func) elm_widget_text_set_hook_set(obj, (Elm_Widget_Text_Set_Cb)(func))
325 EAPI void elm_widget_text_get_hook_set(Evas_Object *obj, Elm_Widget_Text_Get_Cb func);
326 #define elm_widget_text_get_hook_set(obj, func) elm_widget_text_get_hook_set(obj, (Elm_Widget_Text_Get_Cb)(func))
327 EAPI void elm_widget_content_set_hook_set(Evas_Object *obj, Elm_Widget_Content_Set_Cb func);
328 #define elm_widget_content_set_hook_set(obj, func) elm_widget_content_set_hook_set(obj, (Elm_Widget_Content_Set_Cb)(func))
329 EAPI void elm_widget_content_get_hook_set(Evas_Object *obj, Elm_Widget_Content_Get_Cb func);
330 #define elm_widget_content_get_hook_set(obj, func) elm_widget_content_get_hook_set(obj, (Elm_Widget_Content_Get_Cb)(func))
331 EAPI void elm_widget_content_unset_hook_set(Evas_Object *obj, Elm_Widget_Content_Unset_Cb func);
332 #define elm_widget_content_unset_hook_set(obj, func) elm_widget_content_unset_hook_set(obj, (Elm_Widget_Content_Unset_Cb)(func))
333 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));
334 EAPI void elm_widget_data_set(Evas_Object *obj, void *data);
335 EAPI void *elm_widget_data_get(const Evas_Object *obj);
336 EAPI void elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj);
337 EAPI void elm_widget_sub_object_del(Evas_Object *obj, Evas_Object *sobj);
338 EAPI void elm_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj);
339 EAPI void elm_widget_hover_object_set(Evas_Object *obj, Evas_Object *sobj);
340 EAPI void elm_widget_signal_emit(Evas_Object *obj, const char *emission, const char *source);
341 EAPI void elm_widget_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
342 EAPI void *elm_widget_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func);
343 EAPI void elm_widget_can_focus_set(Evas_Object *obj, Eina_Bool can_focus);
344 EAPI Eina_Bool elm_widget_can_focus_get(const Evas_Object *obj);
345 EAPI Eina_Bool elm_widget_child_can_focus_get(const Evas_Object *obj);
346 EAPI Eina_List *elm_widget_can_focus_child_list_get(const Evas_Object *obj);
347 EAPI void elm_widget_tree_unfocusable_set(Evas_Object *obj, Eina_Bool tree_unfocusable);
348 EAPI Eina_Bool elm_widget_tree_unfocusable_get(const Evas_Object *obj);
349 EAPI void elm_widget_highlight_ignore_set(Evas_Object *obj, Eina_Bool ignore);
350 EAPI Eina_Bool elm_widget_highlight_ignore_get(const Evas_Object *obj);
351 EAPI void elm_widget_highlight_in_theme_set(Evas_Object *obj, Eina_Bool highlight);
352 EAPI Eina_Bool elm_widget_highlight_in_theme_get(const Evas_Object *obj);
353 EAPI Eina_Bool elm_widget_focus_get(const Evas_Object *obj);
354 EAPI Evas_Object *elm_widget_focused_object_get(const Evas_Object *obj);
355 EAPI Evas_Object *elm_widget_top_get(const Evas_Object *obj);
356 EAPI Eina_Bool elm_widget_is(const Evas_Object *obj);
357 EAPI Evas_Object *elm_widget_parent_widget_get(const Evas_Object *obj);
358 EAPI void elm_widget_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, const void *data);
359 EAPI void *elm_widget_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data);
360 EAPI Eina_Bool elm_widget_event_propagate(Evas_Object *obj, Evas_Callback_Type type, void *event_info, Evas_Event_Flags *event_flags);
361 EAPI void elm_widget_focus_custom_chain_set(Evas_Object *obj, Eina_List *objs);
362 EAPI void elm_widget_focus_custom_chain_unset(Evas_Object *obj);
363 EAPI const Eina_List *elm_widget_focus_custom_chain_get(const Evas_Object *obj);
364 EAPI void elm_widget_focus_custom_chain_append(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
365 EAPI void elm_widget_focus_custom_chain_prepend(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
366 EAPI void elm_widget_focus_cycle(Evas_Object *obj, Elm_Focus_Direction dir);
367 EAPI void elm_widget_focus_direction_go(Evas_Object *obj, int x, int y);
368 EAPI Eina_Bool elm_widget_focus_next_get(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next);
369 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);
370 EAPI void elm_widget_focus_set(Evas_Object *obj, int first);
371 EAPI void elm_widget_focused_object_clear(Evas_Object *obj);
372 EAPI Evas_Object *elm_widget_parent_get(const Evas_Object *obj);
373 EAPI Evas_Object *elm_widget_parent2_get(const Evas_Object *obj);
374 EAPI void elm_widget_parent2_set(Evas_Object *obj, Evas_Object *parent);
375 EAPI void elm_widget_focus_steal(Evas_Object *obj);
380 * Restore the focus state of the sub-tree.
382 * This API will restore the focus state of the sub-tree to the lastest
383 * state. If a sub-tree is unfocused and wants to get back to the lastest
384 * focus state, this API will be helpful.
386 * @param obj The widget root of sub-tree
390 EAPI void elm_widget_focus_restore(Evas_Object *obj);
392 EAPI void elm_widget_activate(Evas_Object *obj);
393 EAPI void elm_widget_change(Evas_Object *obj);
394 EAPI void elm_widget_disabled_set(Evas_Object *obj, Eina_Bool disabled);
395 EAPI Eina_Bool elm_widget_disabled_get(const Evas_Object *obj);
396 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);
397 EAPI void elm_widget_show_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
398 EAPI void elm_widget_focus_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
399 EAPI void elm_widget_scroll_hold_push(Evas_Object *obj);
400 EAPI void elm_widget_scroll_hold_pop(Evas_Object *obj);
401 EAPI int elm_widget_scroll_hold_get(const Evas_Object *obj);
402 EAPI void elm_widget_scroll_freeze_push(Evas_Object *obj);
403 EAPI void elm_widget_scroll_freeze_pop(Evas_Object *obj);
404 EAPI int elm_widget_scroll_freeze_get(const Evas_Object *obj);
405 EAPI void elm_widget_scale_set(Evas_Object *obj, double scale);
406 EAPI double elm_widget_scale_get(const Evas_Object *obj);
407 EAPI Eina_Bool elm_widget_mirrored_get(const Evas_Object *obj);
408 EAPI void elm_widget_mirrored_set(Evas_Object *obj, Eina_Bool mirrored);
409 EAPI Eina_Bool elm_widget_mirrored_automatic_get(const Evas_Object *obj);
410 EAPI void elm_widget_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic);
411 EAPI void elm_widget_theme_set(Evas_Object *obj, Elm_Theme *th);
412 EAPI Elm_Theme *elm_widget_theme_get(const Evas_Object *obj);
413 EAPI void elm_widget_style_set(Evas_Object *obj, const char *style);
414 EAPI const char *elm_widget_style_get(const Evas_Object *obj);
415 EAPI void elm_widget_type_set(Evas_Object *obj, const char *type);
416 EAPI const char *elm_widget_type_get(const Evas_Object *obj);
417 EAPI void elm_widget_tooltip_add(Evas_Object *obj, Elm_Tooltip *tt);
418 EAPI void elm_widget_tooltip_del(Evas_Object *obj, Elm_Tooltip *tt);
419 EAPI void elm_widget_cursor_add(Evas_Object *obj, Elm_Cursor *cur);
420 EAPI void elm_widget_cursor_del(Evas_Object *obj, Elm_Cursor *cur);
421 EAPI void elm_widget_drag_lock_x_set(Evas_Object *obj, Eina_Bool lock);
422 EAPI void elm_widget_drag_lock_y_set(Evas_Object *obj, Eina_Bool lock);
423 EAPI Eina_Bool elm_widget_drag_lock_x_get(const Evas_Object *obj);
424 EAPI Eina_Bool elm_widget_drag_lock_y_get(const Evas_Object *obj);
425 EAPI int elm_widget_drag_child_locked_x_get(const Evas_Object *obj);
426 EAPI int elm_widget_drag_child_locked_y_get(const Evas_Object *obj);
427 EAPI Eina_Bool elm_widget_theme_object_set(Evas_Object *obj, Evas_Object *edj, const char *wname, const char *welement, const char *wstyle);
428 EAPI void elm_widget_type_register(const char **ptr);
429 EAPI void elm_widget_type_unregister(const char **ptr);
430 EAPI Eina_Bool elm_widget_is_check(const Evas_Object *obj);
431 EAPI Eina_Bool elm_widget_type_check(const Evas_Object *obj, const char *type, const char *func);
432 EAPI Evas_Object *elm_widget_name_find(const Evas_Object *obj, const char *name, int recurse);
433 EAPI Eina_List *elm_widget_stringlist_get(const char *str);
434 EAPI void elm_widget_stringlist_free(Eina_List *list);
435 EAPI void elm_widget_focus_hide_handle(Evas_Object *obj);
436 EAPI void elm_widget_focus_mouse_up_handle(Evas_Object *obj);
437 EAPI void elm_widget_focus_tree_unfocusable_handle(Evas_Object *obj);
438 EAPI void elm_widget_focus_disabled_handle(Evas_Object *obj);
439 EAPI void elm_widget_text_part_set(Evas_Object *obj, const char *part, const char *label);
440 EAPI const char *elm_widget_text_part_get(const Evas_Object *obj, const char *part);
441 EAPI void elm_widget_domain_translatable_text_part_set(Evas_Object *obj, const char *part, const char *domain, const char *text);
442 EAPI const char *elm_widget_translatable_text_part_get(const Evas_Object *obj, const char *part);
443 EAPI void elm_widget_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content);
444 EAPI Evas_Object *elm_widget_content_part_get(const Evas_Object *obj, const char *part);
445 EAPI Evas_Object *elm_widget_content_part_unset(Evas_Object *obj, const char *part);
446 EAPI void elm_widget_access_info_set(Evas_Object *obj, const char *txt);
447 EAPI const char *elm_widget_access_info_get(Evas_Object *obj);
448 EAPI Elm_Widget_Item *_elm_widget_item_new(Evas_Object *parent, size_t alloc_size);
449 EAPI void _elm_widget_item_free(Elm_Widget_Item *item);
450 EAPI void _elm_widget_item_del(Elm_Widget_Item *item);
451 EAPI void _elm_widget_item_pre_notify_del(Elm_Widget_Item *item);
452 EAPI void _elm_widget_item_del_cb_set(Elm_Widget_Item *item, Evas_Smart_Cb del_cb);
453 EAPI void _elm_widget_item_data_set(Elm_Widget_Item *item, const void *data);
454 EAPI void *_elm_widget_item_data_get(const Elm_Widget_Item *item);
455 EAPI void _elm_widget_item_tooltip_text_set(Elm_Widget_Item *item, const char *text);
456 EAPI void _elm_widget_item_tooltip_translatable_text_set(Elm_Widget_Item *item, const char *text);
457 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);
458 EAPI void _elm_widget_item_tooltip_unset(Elm_Widget_Item *item);
459 EAPI void _elm_widget_item_tooltip_style_set(Elm_Widget_Item *item, const char *style);
460 EAPI Eina_Bool _elm_widget_item_tooltip_window_mode_set(Elm_Widget_Item *item, Eina_Bool disable);
461 EAPI Eina_Bool _elm_widget_item_tooltip_window_mode_get(const Elm_Widget_Item *item);
462 EAPI const char *_elm_widget_item_tooltip_style_get(const Elm_Widget_Item *item);
463 EAPI void _elm_widget_item_cursor_set(Elm_Widget_Item *item, const char *cursor);
464 EAPI const char *_elm_widget_item_cursor_get(const Elm_Widget_Item *item);
465 EAPI void _elm_widget_item_cursor_unset(Elm_Widget_Item *item);
466 EAPI void _elm_widget_item_cursor_style_set(Elm_Widget_Item *item, const char *style);
467 EAPI const char *_elm_widget_item_cursor_style_get(const Elm_Widget_Item *item);
468 EAPI void _elm_widget_item_cursor_engine_only_set(Elm_Widget_Item *item, Eina_Bool engine_only);
469 EAPI Eina_Bool _elm_widget_item_cursor_engine_only_get(const Elm_Widget_Item *item);
470 EAPI void _elm_widget_item_content_part_set(Elm_Widget_Item *item, const char *part, Evas_Object *content);
471 EAPI Evas_Object *_elm_widget_item_content_part_get(const Elm_Widget_Item *item, const char *part);
472 EAPI Evas_Object *_elm_widget_item_content_part_unset(Elm_Widget_Item *item, const char *part);
473 EAPI void _elm_widget_item_text_part_set(Elm_Widget_Item *item, const char *part, const char *label);
474 EAPI const char *_elm_widget_item_text_part_get(const Elm_Widget_Item *item, const char *part);
475 EAPI void _elm_widget_item_signal_emit(Elm_Widget_Item *item, const char *emission, const char *source);
476 EAPI void _elm_widget_item_content_set_hook_set(Elm_Widget_Item *item, Elm_Widget_Content_Set_Cb func);
477 EAPI void _elm_widget_item_content_get_hook_set(Elm_Widget_Item *item, Elm_Widget_Content_Get_Cb func);
478 EAPI void _elm_widget_item_content_unset_hook_set(Elm_Widget_Item *item, Elm_Widget_Content_Unset_Cb func);
479 EAPI void _elm_widget_item_text_set_hook_set(Elm_Widget_Item *item, Elm_Widget_Text_Set_Cb func);
480 EAPI void _elm_widget_item_text_get_hook_set(Elm_Widget_Item *item, Elm_Widget_Text_Get_Cb func);
481 EAPI void _elm_widget_item_signal_emit_hook_set(Elm_Widget_Item *it, Elm_Widget_Signal_Emit_Cb func);
482 EAPI void _elm_widget_item_access_info_set(Elm_Widget_Item *item, const char *txt);
483 EAPI void _elm_widget_item_disabled_set(Elm_Widget_Item *item, Eina_Bool disabled);
484 EAPI Eina_Bool _elm_widget_item_disabled_get(const Elm_Widget_Item *item);
485 EAPI void _elm_widget_item_disable_hook_set(Elm_Widget_Item *item, Elm_Widget_Disable_Cb func);
486 EAPI void _elm_widget_item_del_pre_hook_set(Elm_Widget_Item *item, Elm_Widget_Del_Pre_Cb func);
488 /* debug function. don't use it unless you are tracking parenting issues */
489 EAPI void elm_widget_tree_dump(const Evas_Object *top);
490 EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *output);
493 * Convenience macro to create new widget item, doing casts for you.
494 * @see _elm_widget_item_new()
495 * @param parent a valid elm_widget variant.
496 * @param type the C type that extends Elm_Widget_Item
498 #define elm_widget_item_new(parent, type) \
499 (type *)_elm_widget_item_new((parent), sizeof(type))
501 * Convenience macro to free widget item, doing casts for you.
502 * @see _elm_widget_item_free()
503 * @param item a valid item.
505 #define elm_widget_item_free(item) \
506 _elm_widget_item_free((Elm_Widget_Item *)item)
509 * Convenience macro to delete widget item, doing casts for you.
510 * @see _elm_widget_item_del()
511 * @param item a valid item.
513 #define elm_widget_item_del(item) \
514 _elm_widget_item_del((Elm_Widget_Item *)item)
516 * Convenience macro to notify deletion of widget item, doing casts for you.
517 * @see _elm_widget_item_pre_notify_del()
519 #define elm_widget_item_pre_notify_del(item) \
520 _elm_widget_item_pre_notify_del((Elm_Widget_Item *)item)
522 * Convenience macro to set deletion callback of widget item, doing casts for you.
523 * @see _elm_widget_item_del_cb_set()
525 #define elm_widget_item_del_cb_set(item, del_cb) \
526 _elm_widget_item_del_cb_set((Elm_Widget_Item *)item, del_cb)
530 * @see _elm_widget_item_data_set()
532 #define elm_widget_item_data_set(item, data) \
533 _elm_widget_item_data_set((Elm_Widget_Item *)item, data)
536 * @see _elm_widget_item_data_get()
538 #define elm_widget_item_data_get(item) \
539 _elm_widget_item_data_get((const Elm_Widget_Item *)item)
542 * Convenience function to set widget item tooltip as a text string.
543 * @see _elm_widget_item_tooltip_text_set()
545 #define elm_widget_item_tooltip_text_set(item, text) \
546 _elm_widget_item_tooltip_text_set((Elm_Widget_Item *)item, text)
548 * Convenience function to set widget item tooltip as a text string.
549 * @see _elm_widget_item_tooltip_text_set()
551 #define elm_widget_item_tooltip_translatable_text_set(item, text) \
552 _elm_widget_item_tooltip_translatable_text_set((Elm_Widget_Item *)item, text)
554 * Convenience function to set widget item tooltip.
555 * @see _elm_widget_item_tooltip_content_cb_set()
557 #define elm_widget_item_tooltip_content_cb_set(item, func, data, del_cb) \
558 _elm_widget_item_tooltip_content_cb_set((Elm_Widget_Item *)item, \
561 * Convenience function to unset widget item tooltip.
562 * @see _elm_widget_item_tooltip_unset()
564 #define elm_widget_item_tooltip_unset(item) \
565 _elm_widget_item_tooltip_unset((Elm_Widget_Item *)item)
567 * Convenience function to change item's tooltip style.
568 * @see _elm_widget_item_tooltip_style_set()
570 #define elm_widget_item_tooltip_style_set(item, style) \
571 _elm_widget_item_tooltip_style_set((Elm_Widget_Item *)item, style)
573 #define elm_widget_item_tooltip_window_mode_set(item, disable) \
574 _elm_widget_item_tooltip_window_mode_set((Elm_Widget_Item *)item, disable)
576 #define elm_widget_item_tooltip_window_mode_get(item) \
577 _elm_widget_item_tooltip_window_mode_get((Elm_Widget_Item *)item)
579 * Convenience function to query item's tooltip style.
580 * @see _elm_widget_item_tooltip_style_get()
582 #define elm_widget_item_tooltip_style_get(item) \
583 _elm_widget_item_tooltip_style_get((const Elm_Widget_Item *)item)
585 * Convenience function to set widget item cursor.
586 * @see _elm_widget_item_cursor_set()
588 #define elm_widget_item_cursor_set(item, cursor) \
589 _elm_widget_item_cursor_set((Elm_Widget_Item *)item, cursor)
591 * Convenience function to get widget item cursor.
592 * @see _elm_widget_item_cursor_get()
594 #define elm_widget_item_cursor_get(item) \
595 _elm_widget_item_cursor_get((const Elm_Widget_Item *)item)
597 * Convenience function to unset widget item cursor.
598 * @see _elm_widget_item_cursor_unset()
600 #define elm_widget_item_cursor_unset(item) \
601 _elm_widget_item_cursor_unset((Elm_Widget_Item *)item)
603 * Convenience function to change item's cursor style.
604 * @see _elm_widget_item_cursor_style_set()
606 #define elm_widget_item_cursor_style_set(item, style) \
607 _elm_widget_item_cursor_style_set((Elm_Widget_Item *)item, style)
609 * Convenience function to query item's cursor style.
610 * @see _elm_widget_item_cursor_style_get()
612 #define elm_widget_item_cursor_style_get(item) \
613 _elm_widget_item_cursor_style_get((const Elm_Widget_Item *)item)
615 * Convenience function to change item's cursor engine_only.
616 * @see _elm_widget_item_cursor_engine_only_set()
618 #define elm_widget_item_cursor_engine_only_set(item, engine_only) \
619 _elm_widget_item_cursor_engine_only_set((Elm_Widget_Item *)item, engine_only)
621 * Convenience function to query item's cursor engine_only.
622 * @see _elm_widget_item_cursor_engine_only_get()
624 #define elm_widget_item_cursor_engine_only_get(item) \
625 _elm_widget_item_cursor_engine_only_get((const Elm_Widget_Item *)item)
627 * Convenience function to query item's content set hook.
628 * @see _elm_widget_item_content_set_hook_set()
630 #define elm_widget_item_content_set_hook_set(item, func) \
631 _elm_widget_item_content_set_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Content_Set_Cb)func)
633 * Convenience function to query item's content get hook.
634 * @see _elm_widget_item_content_get_hook_set()
636 #define elm_widget_item_content_get_hook_set(item, func) \
637 _elm_widget_item_content_get_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Content_Get_Cb)func)
639 * Convenience function to query item's content unset hook.
640 * @see _elm_widget_item_content_unset_hook_set()
642 #define elm_widget_item_content_unset_hook_set(item, func) \
643 _elm_widget_item_content_unset_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Content_Unset_Cb)func)
645 * Convenience function to query item's text set hook.
646 * @see _elm_widget_item_text_set_hook_set()
648 #define elm_widget_item_text_set_hook_set(item, func) \
649 _elm_widget_item_text_set_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Text_Set_Cb)func)
651 * Convenience function to query item's text get hook.
652 * @see _elm_widget_item_text_get_hook_set()
654 #define elm_widget_item_text_get_hook_set(item, func) \
655 _elm_widget_item_text_get_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Text_Get_Cb)func)
657 * Convenience function to query item's signal emit hook.
658 * @see _elm_widget_item_signal_emit_hook_set()
660 #define elm_widget_item_signal_emit_hook_set(item, func) \
661 _elm_widget_item_signal_emit_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Signal_Emit_Cb)func)
663 * Convenience function to query disable get hook.
664 * @see _elm_widget_item_disabled_get()
666 #define elm_widget_item_disabled_get(item) \
667 _elm_widget_item_disabled_get((Elm_Widget_Item *)item)
669 * Convenience function to query disable set hook.
670 * @see _elm_widget_item_disable_hook_set()
672 #define elm_widget_item_disable_hook_set(item, func) \
673 _elm_widget_item_disable_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Disable_Cb)func)
675 * Convenience function to query del pre hook.
676 * @see _elm_widget_item_del_pre_hook_set()
678 #define elm_widget_item_del_pre_hook_set(item, func) \
679 _elm_widget_item_del_pre_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Del_Pre_Cb)func)
681 #define ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, ...) \
684 CRITICAL("Elm_Widget_Item " # item " is NULL!"); \
685 return __VA_ARGS__; \
687 if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) { \
688 EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC); \
689 return __VA_ARGS__; \
693 #define ELM_WIDGET_ITEM_CHECK_OR_GOTO(item, label) \
696 CRITICAL("Elm_Widget_Item " # item " is NULL!"); \
699 if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) { \
700 EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC); \
705 #define ELM_SET_WIDTYPE(widtype, type) \
708 widtype = eina_stringshare_add(type); \
709 elm_widget_type_register(&widtype); \
713 #define ELM_CHECK_WID_IS(obj) \
714 if (!elm_widget_is_check(obj)) return
716 #define ELM_CHECK_WIDTYPE(obj, widtype) \
717 if (!obj || !elm_widget_type_check((obj), (widtype), __func__)) return
719 #define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, ...) \
720 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
721 ELM_CHECK_WIDTYPE(it->base.widget, widtype) __VA_ARGS__;
723 #define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(it, label) \
724 ELM_WIDGET_ITEM_CHECK_OR_GOTO((Elm_Widget_Item *)it, label); \
725 if (!elm_widget_type_check((it->base.widget), (widtype), __func__)) goto label;
727 #define ELM_WIDGET_STANDARD_SETUP(wdat, wdtype, par, evas, ob, ret) \
729 EINA_SAFETY_ON_NULL_RETURN_VAL((par), (ret)); \
730 evas = evas_object_evas_get(par); if (!(evas)) return (ret); \
731 wdat = ELM_NEW(wdtype); if (!(wdat)) return (ret); \
732 ob = elm_widget_add(evas); if (!(ob)) { free(wdat); return (ret); } \
736 * The drag and drop API.
737 * Currently experimental, and will change when it does dynamic type
740 * Here so applications can start to use it, if they ask elm nicely.
742 * And yes, elm_widget, should probably be elm_experimental...
743 * Complaints about this code should go to /dev/null, or failing that nash.
745 Eina_Bool elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object *widget, Elm_Sel_Format format, const void *selbuf, size_t buflen);
746 Eina_Bool elm_selection_clear(Elm_Sel_Type selection, Evas_Object *widget);
747 Eina_Bool elm_selection_get(Elm_Sel_Type selection, Elm_Sel_Format format, Evas_Object *widget, Elm_Drop_Cb datacb, void *udata);
748 Eina_Bool elm_selection_selection_has_owner(void);
749 Eina_Bool elm_drop_target_add(Evas_Object *widget, Elm_Sel_Type, Elm_Drop_Cb, void *);
750 Eina_Bool elm_drop_target_del(Evas_Object *widget);
751 Eina_Bool elm_drag_start(Evas_Object *, Elm_Sel_Format, const char *, void (*)(void *, Evas_Object*), void *);