aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/elementary/src/lib/elm_widget.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libraries/elementary/src/lib/elm_widget.h751
1 files changed, 751 insertions, 0 deletions
diff --git a/libraries/elementary/src/lib/elm_widget.h b/libraries/elementary/src/lib/elm_widget.h
new file mode 100644
index 0000000..2f00121
--- /dev/null
+++ b/libraries/elementary/src/lib/elm_widget.h
@@ -0,0 +1,751 @@
1#ifndef ELM_WIDGET_H
2#define ELM_WIDGET_H
3
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
7 * AT RUNTIME
8 *
9 * How to make your own widget? like this:
10 *
11 * #include <Elementary.h>
12 * #include "elm_priv.h"
13 *
14 * typedef struct _Widget_Data Widget_Data;
15 *
16 * struct _Widget_Data
17 * {
18 * Evas_Object *sub;
19 * // add any other widget data here too
20 * };
21 *
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);
28 *
29 * static const char SIG_CLICKED[] = "clicked";
30 * static const Evas_Smart_Cb_Description _signals[] = {
31 * {SIG_CLICKED, ""},
32 * {NULL, NULL}
33 * };
34 *
35 * static void
36 * _del_hook(Evas_Object *obj)
37 * {
38 * Widget_Data *wd = elm_widget_data_get(obj);
39 * if (!wd) return;
40 * // delete hook - on delete of object delete object struct etc.
41 * free(wd);
42 * }
43 *
44 * static void
45 * _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
46 * {
47 * Widget_Data *wd = elm_widget_data_get(obj);
48 * if (!wd) return;
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))
52 * {
53 * edje_object_signal_emit(wd->sub, "elm,action,focus", "elm");
54 * evas_object_focus_set(wd->sub, EINA_TRUE);
55 * }
56 * else
57 * {
58 * edje_object_signal_emit(wd->sub, "elm,action,unfocus", "elm");
59 * evas_object_focus_set(wd->sub, EINA_FALSE);
60 * }
61 * }
62 *
63 * static void
64 * _theme_hook(Evas_Object *obj)
65 * {
66 * Widget_Data *wd = elm_widget_data_get(obj);
67 * if (!wd) return;
68 * // handle change in theme/scale etc.
69 * elm_widget_theme_object_set(obj, wd->sub, "mywidget", "base",
70 * elm_widget_style_get(obj));
71 * }
72 *
73 * static void
74 * _disable_hook(Evas_Object *obj)
75 * {
76 * Widget_Data *wd = elm_widget_data_get(obj);
77 * if (!wd) return;
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");
81 * else
82 * edje_object_signal_emit(wd->sub, "elm,state,enabled", "elm");
83 * }
84 *
85 * static void
86 * _sizing_eval(Evas_Object *obj)
87 * {
88 * Widget_Data *wd = elm_widget_data_get(obj);
89 * Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
90 * if (!wd) return;
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);
96 * }
97 *
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.
100 * EAPI Evas_Object *
101 * elm_mywidget_add(Evas_Object *parent)
102 * {
103 * Evas_Object *obj;
104 * Evas *e;
105 * Widget_Data *wd;
106 *
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;
111 *
112 * // standard widget setup and allocate wd, create obj given parent etc.
113 * ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
114 *
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);
128 *
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);
146 *
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
149 * _sizing_eval(obj);
150 *
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);
154 * return obj;
155 * }
156 *
157 * // example - do "whatever" to the widget (here just emit a signal)
158 * EAPI void
159 * elm_mywidget_whatever(Evas_Object *obj)
160 * {
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");
168 * }
169 *
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
172 * // internal
173 *
174 */
175
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."
188#endif
189#define ELM_INTERNAL_API_VERSION 7000
190
191typedef struct _Elm_Tooltip Elm_Tooltip;
192typedef struct _Elm_Cursor Elm_Cursor;
193
194/**< base structure for all widget items that are not Elm_Widget themselves */
195typedef struct _Elm_Widget_Item Elm_Widget_Item;
196
197/**< accessibility information to be able to set and get from the access API */
198typedef struct _Elm_Access_Info Elm_Access_Info;
199
200/**< accessibility info item */
201typedef struct _Elm_Access_Item Elm_Access_Item;
202
203typedef void (*Elm_Widget_Text_Set_Cb)(void *data, const char *part, const char *text);
204typedef void (*Elm_Widget_Content_Set_Cb)(void *data, const char *part, Evas_Object *content);
205typedef const char *(*Elm_Widget_Text_Get_Cb)(const void *data, const char *part);
206typedef Evas_Object *(*Elm_Widget_Content_Get_Cb)(const void *data, const char *part);
207typedef Evas_Object *(*Elm_Widget_Content_Unset_Cb)(const void *data, const char *part);
208typedef void (*Elm_Widget_Signal_Emit_Cb)(void *data, const char *emission, const char *source);
209typedef void (*Elm_Widget_Disable_Cb)(void *data);
210typedef Eina_Bool (*Elm_Widget_Del_Pre_Cb)(void *data);
211
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
216
217#define ELM_ACCESS_DONE -1 // sentence done - send done event here
218#define ELM_ACCESS_CANCEL -2 // stop reading immediately
219
220typedef char *(*Elm_Access_Content_Cb)(void *data, Evas_Object *obj, Elm_Widget_Item *item);
221
222struct _Elm_Access_Item
223{
224 int type;
225 const void *data;
226 Elm_Access_Content_Cb func;
227};
228
229struct _Elm_Access_Info
230{
231 Evas_Object *hoverobj;
232 Eina_List *items;
233 Ecore_Timer *delay_timer;
234};
235
236EAPI void _elm_access_clear(Elm_Access_Info *ac);
237EAPI void _elm_access_text_set(Elm_Access_Info *ac, int type, const char *text);
238EAPI void _elm_access_callback_set(Elm_Access_Info *ac, int type, Elm_Access_Content_Cb func, const void *data);
239EAPI char *_elm_access_text_get(const Elm_Access_Info *ac, int type, Evas_Object *obj, Elm_Widget_Item *item); /* this is ok it actually returns a strduped string - it's meant to! */
240EAPI void _elm_access_read(Elm_Access_Info *ac, int type, Evas_Object *obj, Elm_Widget_Item *item);
241EAPI void _elm_access_say(const char *txt);
242EAPI Elm_Access_Info *_elm_access_object_get(const Evas_Object *obj);
243EAPI Elm_Access_Info *_elm_access_item_get(const Elm_Widget_Item *it);
244EAPI void _elm_access_object_hilight(Evas_Object *obj);
245EAPI void _elm_access_object_unhilight(Evas_Object *obj);
246EAPI void _elm_access_object_hilight_disable(Evas *e);
247EAPI void _elm_access_object_register(Evas_Object *obj, Evas_Object *hoverobj);
248EAPI void _elm_access_item_unregister(Elm_Widget_Item *item);
249EAPI void _elm_access_item_register(Elm_Widget_Item *item, Evas_Object *hoverobj);
250EAPI Eina_Bool _elm_access_2nd_click_timeout(Evas_Object *obj);
251
252/**< put this as the first member in your widget item struct */
253#define ELM_WIDGET_ITEM Elm_Widget_Item base
254
255struct _Elm_Widget_Item
256{
257/* ef1 ~~ efl, el3 ~~ elm */
258#define ELM_WIDGET_ITEM_MAGIC 0xef1e1301
259 EINA_MAGIC;
260/* simple accessor macros */
261#define VIEW(X) X->base.view
262#define WIDGET(X) X->base.widget
263 /**< the owner widget that owns this item */
264 Evas_Object *widget;
265 /**< the base view object */
266 Evas_Object *view;
267 /**< item specific data. used for del callback */
268 const void *data;
269 /**< user delete callback function */
270 Evas_Smart_Cb del_func;
271 /**< widget delete callback function. don't expose this callback call */
272 Elm_Widget_Del_Pre_Cb del_pre_func;
273
274 Elm_Widget_Content_Set_Cb content_set_func;
275 Elm_Widget_Content_Get_Cb content_get_func;
276 Elm_Widget_Content_Unset_Cb content_unset_func;
277 Elm_Widget_Text_Set_Cb text_set_func;
278 Elm_Widget_Text_Get_Cb text_get_func;
279 Elm_Widget_Signal_Emit_Cb signal_emit_func;
280 Elm_Widget_Disable_Cb disable_func;
281 Elm_Access_Info *access;
282 const char *access_info;
283
284 Eina_Bool disabled : 1;
285};
286
287struct _Elm_Object_Item
288{
289 ELM_WIDGET_ITEM;
290};
291
292#define ELM_NEW(t) calloc(1, sizeof(t))
293
294EAPI Eina_Bool elm_widget_api_check(int ver);
295EAPI Evas_Object *elm_widget_add(Evas *evas);
296EAPI void elm_widget_del_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj));
297EAPI void elm_widget_del_pre_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj));
298EAPI void elm_widget_focus_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj));
299EAPI void elm_widget_activate_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj));
300EAPI void elm_widget_disable_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj));
301EAPI void elm_widget_theme_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj));
302EAPI void elm_widget_translate_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj));
303EAPI 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));
304EAPI void elm_widget_changed_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj));
305EAPI void elm_widget_signal_emit_hook_set(Evas_Object *obj, void (*func)(Evas_Object *obj, const char *emission, const char *source));
306EAPI 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));
307EAPI 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));
308EAPI Eina_Bool elm_widget_theme(Evas_Object *obj);
309EAPI void elm_widget_theme_specific(Evas_Object *obj, Elm_Theme *th, Eina_Bool force);
310EAPI void elm_widget_translate(Evas_Object *obj);
311EAPI void elm_widget_focus_next_hook_set(Evas_Object *obj, Eina_Bool (*func)(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next));
312EAPI void elm_widget_on_focus_hook_set(Evas_Object *obj, void (*func)(void *data, Evas_Object *obj), void *data);
313EAPI void elm_widget_on_change_hook_set(Evas_Object *obj, void (*func)(void *data, Evas_Object *obj), void *data);
314EAPI void elm_widget_on_show_region_hook_set(Evas_Object *obj, void (*func)(void *data, Evas_Object *obj), void *data);
315EAPI 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));
316EAPI void elm_widget_text_set_hook_set(Evas_Object *obj, Elm_Widget_Text_Set_Cb func);
317#define elm_widget_text_set_hook_set(obj, func) elm_widget_text_set_hook_set(obj, (Elm_Widget_Text_Set_Cb)(func))
318EAPI void elm_widget_text_get_hook_set(Evas_Object *obj, Elm_Widget_Text_Get_Cb func);
319#define elm_widget_text_get_hook_set(obj, func) elm_widget_text_get_hook_set(obj, (Elm_Widget_Text_Get_Cb)(func))
320EAPI void elm_widget_content_set_hook_set(Evas_Object *obj, Elm_Widget_Content_Set_Cb func);
321#define elm_widget_content_set_hook_set(obj, func) elm_widget_content_set_hook_set(obj, (Elm_Widget_Content_Set_Cb)(func))
322EAPI void elm_widget_content_get_hook_set(Evas_Object *obj, Elm_Widget_Content_Get_Cb func);
323#define elm_widget_content_get_hook_set(obj, func) elm_widget_content_get_hook_set(obj, (Elm_Widget_Content_Get_Cb)(func))
324EAPI void elm_widget_content_unset_hook_set(Evas_Object *obj, Elm_Widget_Content_Unset_Cb func);
325#define elm_widget_content_unset_hook_set(obj, func) elm_widget_content_unset_hook_set(obj, (Elm_Widget_Content_Unset_Cb)(func))
326EAPI 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));
327EAPI void elm_widget_data_set(Evas_Object *obj, void *data);
328EAPI void *elm_widget_data_get(const Evas_Object *obj);
329EAPI void elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj);
330EAPI void elm_widget_sub_object_del(Evas_Object *obj, Evas_Object *sobj);
331EAPI const Eina_List *elm_widget_sub_object_list_get(const Evas_Object *obj);
332EAPI void elm_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj);
333EAPI void elm_widget_hover_object_set(Evas_Object *obj, Evas_Object *sobj);
334EAPI void elm_widget_signal_emit(Evas_Object *obj, const char *emission, const char *source);
335EAPI void elm_widget_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
336EAPI void *elm_widget_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func);
337EAPI void elm_widget_can_focus_set(Evas_Object *obj, Eina_Bool can_focus);
338EAPI Eina_Bool elm_widget_can_focus_get(const Evas_Object *obj);
339EAPI Eina_Bool elm_widget_child_can_focus_get(const Evas_Object *obj);
340EAPI Eina_List *elm_widget_can_focus_child_list_get(const Evas_Object *obj);
341EAPI void elm_widget_tree_unfocusable_set(Evas_Object *obj, Eina_Bool tree_unfocusable);
342EAPI Eina_Bool elm_widget_tree_unfocusable_get(const Evas_Object *obj);
343EAPI void elm_widget_highlight_ignore_set(Evas_Object *obj, Eina_Bool ignore);
344EAPI Eina_Bool elm_widget_highlight_ignore_get(const Evas_Object *obj);
345EAPI void elm_widget_highlight_in_theme_set(Evas_Object *obj, Eina_Bool highlight);
346EAPI Eina_Bool elm_widget_highlight_in_theme_get(const Evas_Object *obj);
347EAPI Eina_Bool elm_widget_focus_get(const Evas_Object *obj);
348EAPI Evas_Object *elm_widget_focused_object_get(const Evas_Object *obj);
349EAPI Evas_Object *elm_widget_top_get(const Evas_Object *obj);
350EAPI Eina_Bool elm_widget_is(const Evas_Object *obj);
351EAPI Evas_Object *elm_widget_parent_widget_get(const Evas_Object *obj);
352EAPI void elm_widget_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, const void *data);
353EAPI void *elm_widget_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data);
354EAPI Eina_Bool elm_widget_event_propagate(Evas_Object *obj, Evas_Callback_Type type, void *event_info, Evas_Event_Flags *event_flags);
355EAPI void elm_widget_focus_custom_chain_set(Evas_Object *obj, Eina_List *objs);
356EAPI void elm_widget_focus_custom_chain_unset(Evas_Object *obj);
357EAPI const Eina_List *elm_widget_focus_custom_chain_get(const Evas_Object *obj);
358EAPI void elm_widget_focus_custom_chain_append(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
359EAPI void elm_widget_focus_custom_chain_prepend(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
360EAPI void elm_widget_focus_cycle(Evas_Object *obj, Elm_Focus_Direction dir);
361EAPI void elm_widget_focus_direction_go(Evas_Object *obj, int x, int y);
362EAPI Eina_Bool elm_widget_focus_next_get(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next);
363EAPI 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);
364EAPI void elm_widget_focus_set(Evas_Object *obj, int first);
365EAPI void elm_widget_focused_object_clear(Evas_Object *obj);
366EAPI Evas_Object *elm_widget_parent_get(const Evas_Object *obj);
367EAPI Evas_Object *elm_widget_parent2_get(const Evas_Object *obj);
368EAPI void elm_widget_parent2_set(Evas_Object *obj, Evas_Object *parent);
369EAPI void elm_widget_focus_steal(Evas_Object *obj);
370
371/**
372 * @internal
373 *
374 * Restore the focus state of the sub-tree.
375 *
376 * This API will restore the focus state of the sub-tree to the latest
377 * state. If a sub-tree is unfocused and wants to get back to the latest
378 * focus state, this API will be helpful.
379 *
380 * @param obj The widget root of sub-tree
381 *
382 * @ingroup Widget
383 */
384EAPI void elm_widget_focus_restore(Evas_Object *obj);
385
386EAPI void elm_widget_activate(Evas_Object *obj);
387EAPI void elm_widget_change(Evas_Object *obj);
388EAPI void elm_widget_disabled_set(Evas_Object *obj, Eina_Bool disabled);
389EAPI Eina_Bool elm_widget_disabled_get(const Evas_Object *obj);
390EAPI void elm_widget_show_region_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Eina_Bool forceshow);
391EAPI void elm_widget_show_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
392EAPI void elm_widget_focus_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
393EAPI void elm_widget_scroll_hold_push(Evas_Object *obj);
394EAPI void elm_widget_scroll_hold_pop(Evas_Object *obj);
395EAPI int elm_widget_scroll_hold_get(const Evas_Object *obj);
396EAPI void elm_widget_scroll_freeze_push(Evas_Object *obj);
397EAPI void elm_widget_scroll_freeze_pop(Evas_Object *obj);
398EAPI int elm_widget_scroll_freeze_get(const Evas_Object *obj);
399EAPI void elm_widget_scale_set(Evas_Object *obj, double scale);
400EAPI double elm_widget_scale_get(const Evas_Object *obj);
401EAPI Eina_Bool elm_widget_mirrored_get(const Evas_Object *obj);
402EAPI void elm_widget_mirrored_set(Evas_Object *obj, Eina_Bool mirrored);
403EAPI Eina_Bool elm_widget_mirrored_automatic_get(const Evas_Object *obj);
404EAPI void elm_widget_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic);
405EAPI void elm_widget_theme_set(Evas_Object *obj, Elm_Theme *th);
406EAPI Elm_Theme *elm_widget_theme_get(const Evas_Object *obj);
407EAPI Eina_Bool elm_widget_style_set(Evas_Object *obj, const char *style);
408EAPI const char *elm_widget_style_get(const Evas_Object *obj);
409EAPI void elm_widget_type_set(Evas_Object *obj, const char *type);
410EAPI const char *elm_widget_type_get(const Evas_Object *obj);
411EAPI void elm_widget_tooltip_add(Evas_Object *obj, Elm_Tooltip *tt);
412EAPI void elm_widget_tooltip_del(Evas_Object *obj, Elm_Tooltip *tt);
413EAPI void elm_widget_cursor_add(Evas_Object *obj, Elm_Cursor *cur);
414EAPI void elm_widget_cursor_del(Evas_Object *obj, Elm_Cursor *cur);
415EAPI void elm_widget_drag_lock_x_set(Evas_Object *obj, Eina_Bool lock);
416EAPI void elm_widget_drag_lock_y_set(Evas_Object *obj, Eina_Bool lock);
417EAPI Eina_Bool elm_widget_drag_lock_x_get(const Evas_Object *obj);
418EAPI Eina_Bool elm_widget_drag_lock_y_get(const Evas_Object *obj);
419EAPI int elm_widget_drag_child_locked_x_get(const Evas_Object *obj);
420EAPI int elm_widget_drag_child_locked_y_get(const Evas_Object *obj);
421EAPI Eina_Bool elm_widget_theme_object_set(Evas_Object *obj, Evas_Object *edj, const char *wname, const char *welement, const char *wstyle);
422EAPI void elm_widget_type_register(const char **ptr);
423EAPI void elm_widget_type_unregister(const char **ptr);
424EAPI Eina_Bool elm_widget_is_check(const Evas_Object *obj);
425EAPI Eina_Bool elm_widget_type_check(const Evas_Object *obj, const char *type, const char *func);
426EAPI Evas_Object *elm_widget_name_find(const Evas_Object *obj, const char *name, int recurse);
427EAPI Eina_List *elm_widget_stringlist_get(const char *str);
428EAPI void elm_widget_stringlist_free(Eina_List *list);
429EAPI void elm_widget_focus_hide_handle(Evas_Object *obj);
430EAPI void elm_widget_focus_mouse_up_handle(Evas_Object *obj);
431EAPI void elm_widget_focus_tree_unfocusable_handle(Evas_Object *obj);
432EAPI void elm_widget_focus_disabled_handle(Evas_Object *obj);
433EAPI unsigned int elm_widget_focus_order_get(const Evas_Object *obj);
434EAPI void elm_widget_text_part_set(Evas_Object *obj, const char *part, const char *label);
435EAPI const char *elm_widget_text_part_get(const Evas_Object *obj, const char *part);
436EAPI void elm_widget_domain_translatable_text_part_set(Evas_Object *obj, const char *part, const char *domain, const char *text);
437EAPI const char *elm_widget_translatable_text_part_get(const Evas_Object *obj, const char *part);
438EAPI void elm_widget_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content);
439EAPI Evas_Object *elm_widget_content_part_get(const Evas_Object *obj, const char *part);
440EAPI Evas_Object *elm_widget_content_part_unset(Evas_Object *obj, const char *part);
441EAPI void elm_widget_access_info_set(Evas_Object *obj, const char *txt);
442EAPI const char *elm_widget_access_info_get(const Evas_Object *obj);
443EAPI Elm_Widget_Item *_elm_widget_item_new(Evas_Object *parent, size_t alloc_size);
444EAPI void _elm_widget_item_free(Elm_Widget_Item *item);
445EAPI void _elm_widget_item_del(Elm_Widget_Item *item);
446EAPI void _elm_widget_item_pre_notify_del(Elm_Widget_Item *item);
447EAPI void _elm_widget_item_del_cb_set(Elm_Widget_Item *item, Evas_Smart_Cb del_cb);
448EAPI void _elm_widget_item_data_set(Elm_Widget_Item *item, const void *data);
449EAPI void *_elm_widget_item_data_get(const Elm_Widget_Item *item);
450EAPI void _elm_widget_item_tooltip_text_set(Elm_Widget_Item *item, const char *text);
451EAPI void _elm_widget_item_tooltip_translatable_text_set(Elm_Widget_Item *item, const char *text);
452EAPI 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);
453EAPI void _elm_widget_item_tooltip_unset(Elm_Widget_Item *item);
454EAPI void _elm_widget_item_tooltip_style_set(Elm_Widget_Item *item, const char *style);
455EAPI Eina_Bool _elm_widget_item_tooltip_window_mode_set(Elm_Widget_Item *item, Eina_Bool disable);
456EAPI Eina_Bool _elm_widget_item_tooltip_window_mode_get(const Elm_Widget_Item *item);
457EAPI const char *_elm_widget_item_tooltip_style_get(const Elm_Widget_Item *item);
458EAPI void _elm_widget_item_cursor_set(Elm_Widget_Item *item, const char *cursor);
459EAPI const char *_elm_widget_item_cursor_get(const Elm_Widget_Item *item);
460EAPI void _elm_widget_item_cursor_unset(Elm_Widget_Item *item);
461EAPI void _elm_widget_item_cursor_style_set(Elm_Widget_Item *item, const char *style);
462EAPI const char *_elm_widget_item_cursor_style_get(const Elm_Widget_Item *item);
463EAPI void _elm_widget_item_cursor_engine_only_set(Elm_Widget_Item *item, Eina_Bool engine_only);
464EAPI Eina_Bool _elm_widget_item_cursor_engine_only_get(const Elm_Widget_Item *item);
465EAPI void _elm_widget_item_part_content_set(Elm_Widget_Item *item, const char *part, Evas_Object *content);
466EAPI Evas_Object *_elm_widget_item_part_content_get(const Elm_Widget_Item *item, const char *part);
467EAPI Evas_Object *_elm_widget_item_part_content_unset(Elm_Widget_Item *item, const char *part);
468EAPI void _elm_widget_item_part_text_set(Elm_Widget_Item *item, const char *part, const char *label);
469EAPI const char *_elm_widget_item_part_text_get(const Elm_Widget_Item *item, const char *part);
470EAPI void _elm_widget_item_signal_emit(Elm_Widget_Item *item, const char *emission, const char *source);
471EAPI void _elm_widget_item_content_set_hook_set(Elm_Widget_Item *item, Elm_Widget_Content_Set_Cb func);
472EAPI void _elm_widget_item_content_get_hook_set(Elm_Widget_Item *item, Elm_Widget_Content_Get_Cb func);
473EAPI void _elm_widget_item_content_unset_hook_set(Elm_Widget_Item *item, Elm_Widget_Content_Unset_Cb func);
474EAPI void _elm_widget_item_text_set_hook_set(Elm_Widget_Item *item, Elm_Widget_Text_Set_Cb func);
475EAPI void _elm_widget_item_text_get_hook_set(Elm_Widget_Item *item, Elm_Widget_Text_Get_Cb func);
476EAPI void _elm_widget_item_signal_emit_hook_set(Elm_Widget_Item *it, Elm_Widget_Signal_Emit_Cb func);
477EAPI void _elm_widget_item_access_info_set(Elm_Widget_Item *item, const char *txt);
478EAPI void _elm_widget_item_disabled_set(Elm_Widget_Item *item, Eina_Bool disabled);
479EAPI Eina_Bool _elm_widget_item_disabled_get(const Elm_Widget_Item *item);
480EAPI void _elm_widget_item_disable_hook_set(Elm_Widget_Item *item, Elm_Widget_Disable_Cb func);
481EAPI void _elm_widget_item_del_pre_hook_set(Elm_Widget_Item *item, Elm_Widget_Del_Pre_Cb func);
482
483/* debug function. don't use it unless you are tracking parenting issues */
484EAPI void elm_widget_tree_dump(const Evas_Object *top);
485EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *output);
486
487/**
488 * Convenience macro to create new widget item, doing casts for you.
489 * @see _elm_widget_item_new()
490 * @param parent a valid elm_widget variant.
491 * @param type the C type that extends Elm_Widget_Item
492 */
493#define elm_widget_item_new(parent, type) \
494 (type *)_elm_widget_item_new((parent), sizeof(type))
495/**
496 * Convenience macro to free widget item, doing casts for you.
497 * @see _elm_widget_item_free()
498 * @param item a valid item.
499 */
500#define elm_widget_item_free(item) \
501 _elm_widget_item_free((Elm_Widget_Item *)item)
502
503/**
504 * Convenience macro to delete widget item, doing casts for you.
505 * @see _elm_widget_item_del()
506 * @param item a valid item.
507 */
508#define elm_widget_item_del(item) \
509 _elm_widget_item_del((Elm_Widget_Item *)item)
510/**
511 * Convenience macro to notify deletion of widget item, doing casts for you.
512 * @see _elm_widget_item_pre_notify_del()
513 */
514#define elm_widget_item_pre_notify_del(item) \
515 _elm_widget_item_pre_notify_del((Elm_Widget_Item *)item)
516/**
517 * Convenience macro to set deletion callback of widget item, doing casts for you.
518 * @see _elm_widget_item_del_cb_set()
519 */
520#define elm_widget_item_del_cb_set(item, del_cb) \
521 _elm_widget_item_del_cb_set((Elm_Widget_Item *)item, del_cb)
522
523/**
524 * Set item's data
525 * @see _elm_widget_item_data_set()
526 */
527#define elm_widget_item_data_set(item, data) \
528 _elm_widget_item_data_set((Elm_Widget_Item *)item, data)
529/**
530 * Get item's data
531 * @see _elm_widget_item_data_get()
532 */
533#define elm_widget_item_data_get(item) \
534 _elm_widget_item_data_get((const Elm_Widget_Item *)item)
535
536/**
537 * Convenience function to set widget item tooltip as a text string.
538 * @see _elm_widget_item_tooltip_text_set()
539 */
540#define elm_widget_item_tooltip_text_set(item, text) \
541 _elm_widget_item_tooltip_text_set((Elm_Widget_Item *)item, text)
542/**
543 * Convenience function to set widget item tooltip as a text string.
544 * @see _elm_widget_item_tooltip_text_set()
545 */
546#define elm_widget_item_tooltip_translatable_text_set(item, text) \
547 _elm_widget_item_tooltip_translatable_text_set((Elm_Widget_Item *)item, text)
548/**
549 * Convenience function to set widget item tooltip.
550 * @see _elm_widget_item_tooltip_content_cb_set()
551 */
552#define elm_widget_item_tooltip_content_cb_set(item, func, data, del_cb) \
553 _elm_widget_item_tooltip_content_cb_set((Elm_Widget_Item *)item, \
554 func, data, del_cb)
555/**
556 * Convenience function to unset widget item tooltip.
557 * @see _elm_widget_item_tooltip_unset()
558 */
559#define elm_widget_item_tooltip_unset(item) \
560 _elm_widget_item_tooltip_unset((Elm_Widget_Item *)item)
561/**
562 * Convenience function to change item's tooltip style.
563 * @see _elm_widget_item_tooltip_style_set()
564 */
565#define elm_widget_item_tooltip_style_set(item, style) \
566 _elm_widget_item_tooltip_style_set((Elm_Widget_Item *)item, style)
567
568#define elm_widget_item_tooltip_window_mode_set(item, disable) \
569 _elm_widget_item_tooltip_window_mode_set((Elm_Widget_Item *)item, disable)
570
571#define elm_widget_item_tooltip_window_mode_get(item) \
572 _elm_widget_item_tooltip_window_mode_get((Elm_Widget_Item *)item)
573/**
574 * Convenience function to query item's tooltip style.
575 * @see _elm_widget_item_tooltip_style_get()
576 */
577#define elm_widget_item_tooltip_style_get(item) \
578 _elm_widget_item_tooltip_style_get((const Elm_Widget_Item *)item)
579/**
580 * Convenience function to set widget item cursor.
581 * @see _elm_widget_item_cursor_set()
582 */
583#define elm_widget_item_cursor_set(item, cursor) \
584 _elm_widget_item_cursor_set((Elm_Widget_Item *)item, cursor)
585/**
586 * Convenience function to get widget item cursor.
587 * @see _elm_widget_item_cursor_get()
588 */
589#define elm_widget_item_cursor_get(item) \
590 _elm_widget_item_cursor_get((const Elm_Widget_Item *)item)
591/**
592 * Convenience function to unset widget item cursor.
593 * @see _elm_widget_item_cursor_unset()
594 */
595#define elm_widget_item_cursor_unset(item) \
596 _elm_widget_item_cursor_unset((Elm_Widget_Item *)item)
597/**
598 * Convenience function to change item's cursor style.
599 * @see _elm_widget_item_cursor_style_set()
600 */
601#define elm_widget_item_cursor_style_set(item, style) \
602 _elm_widget_item_cursor_style_set((Elm_Widget_Item *)item, style)
603/**
604 * Convenience function to query item's cursor style.
605 * @see _elm_widget_item_cursor_style_get()
606 */
607#define elm_widget_item_cursor_style_get(item) \
608 _elm_widget_item_cursor_style_get((const Elm_Widget_Item *)item)
609/**
610 * Convenience function to change item's cursor engine_only.
611 * @see _elm_widget_item_cursor_engine_only_set()
612 */
613#define elm_widget_item_cursor_engine_only_set(item, engine_only) \
614 _elm_widget_item_cursor_engine_only_set((Elm_Widget_Item *)item, engine_only)
615/**
616 * Convenience function to query item's cursor engine_only.
617 * @see _elm_widget_item_cursor_engine_only_get()
618 */
619#define elm_widget_item_cursor_engine_only_get(item) \
620 _elm_widget_item_cursor_engine_only_get((const Elm_Widget_Item *)item)
621/**
622 * Convenience function to query item's content set hook.
623 * @see _elm_widget_item_content_set_hook_set()
624 */
625#define elm_widget_item_content_set_hook_set(item, func) \
626 _elm_widget_item_content_set_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Content_Set_Cb)func)
627/**
628 * Convenience function to query item's content get hook.
629 * @see _elm_widget_item_content_get_hook_set()
630 */
631#define elm_widget_item_content_get_hook_set(item, func) \
632 _elm_widget_item_content_get_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Content_Get_Cb)func)
633/**
634 * Convenience function to query item's content unset hook.
635 * @see _elm_widget_item_content_unset_hook_set()
636 */
637#define elm_widget_item_content_unset_hook_set(item, func) \
638 _elm_widget_item_content_unset_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Content_Unset_Cb)func)
639/**
640 * Convenience function to query item's text set hook.
641 * @see _elm_widget_item_text_set_hook_set()
642 */
643#define elm_widget_item_text_set_hook_set(item, func) \
644 _elm_widget_item_text_set_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Text_Set_Cb)func)
645/**
646 * Convenience function to query item's text get hook.
647 * @see _elm_widget_item_text_get_hook_set()
648 */
649#define elm_widget_item_text_get_hook_set(item, func) \
650 _elm_widget_item_text_get_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Text_Get_Cb)func)
651/**
652 * Convenience function to query item's signal emit hook.
653 * @see _elm_widget_item_signal_emit_hook_set()
654 */
655#define elm_widget_item_signal_emit_hook_set(item, func) \
656 _elm_widget_item_signal_emit_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Signal_Emit_Cb)func)
657/**
658 * Convenience function to query disable get hook.
659 * @see _elm_widget_item_disabled_get()
660 */
661#define elm_widget_item_disabled_get(item) \
662 _elm_widget_item_disabled_get((Elm_Widget_Item *)item)
663/**
664 * Convenience function to query disable set hook.
665 * @see _elm_widget_item_disable_hook_set()
666 */
667#define elm_widget_item_disable_hook_set(item, func) \
668 _elm_widget_item_disable_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Disable_Cb)func)
669/**
670 * Convenience function to query del pre hook.
671 * @see _elm_widget_item_del_pre_hook_set()
672 */
673#define elm_widget_item_del_pre_hook_set(item, func) \
674 _elm_widget_item_del_pre_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Del_Pre_Cb)func)
675
676#define ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, ...) \
677 do { \
678 if (!item) { \
679 CRITICAL("Elm_Widget_Item " # item " is NULL"); \
680 return __VA_ARGS__; \
681 } \
682 if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) { \
683 EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC); \
684 return __VA_ARGS__; \
685 } \
686 } while (0)
687
688#define ELM_WIDGET_ITEM_CHECK_OR_GOTO(item, label) \
689 do { \
690 if (!item) { \
691 CRITICAL("Elm_Widget_Item " # item " is NULL"); \
692 goto label; \
693 } \
694 if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) { \
695 EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC); \
696 goto label; \
697 } \
698 } while (0)
699
700#define ELM_SET_WIDTYPE(widtype, type) \
701 do { \
702 if (!widtype) { \
703 widtype = eina_stringshare_add(type); \
704 elm_widget_type_register(&widtype); \
705 } \
706 } while (0)
707
708#define ELM_CHECK_WID_IS(obj) \
709 if (!elm_widget_is_check(obj)) return
710
711#define ELM_CHECK_WIDTYPE(obj, widtype) \
712 if (!obj || !elm_widget_type_check((obj), (widtype), __func__)) return
713
714#define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, ...) \
715 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
716 ELM_CHECK_WIDTYPE(it->base.widget, widtype) __VA_ARGS__;
717
718#define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(it, label) \
719 ELM_WIDGET_ITEM_CHECK_OR_GOTO((Elm_Widget_Item *)it, label); \
720 if (!elm_widget_type_check((it->base.widget), (widtype), __func__)) goto label;
721
722#define ELM_WIDGET_STANDARD_SETUP(wdat, wdtype, par, evas, ob, ret) \
723 do { \
724 EINA_SAFETY_ON_NULL_RETURN_VAL((par), (ret)); \
725 evas = evas_object_evas_get(par); if (!(evas)) return (ret); \
726 wdat = ELM_NEW(wdtype); if (!(wdat)) return (ret); \
727 ob = elm_widget_add(evas); if (!(ob)) { free(wdat); return (ret); } \
728 } while (0)
729
730#define ELM_OBJ_ITEM_CHECK_OR_RETURN(it, ...) \
731 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, __VA_ARGS__);
732
733#define ELM_OBJ_ITEM_CHECK_OR_GOTO(it, label) \
734 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(it, label);
735
736/**
737 * The drag and drop API.
738 * Currently experimental, and will change when it does dynamic type
739 * addition RSN.
740 *
741 * Here so applications can start to use it, if they ask elm nicely.
742 *
743 * And yes, elm_widget, should probably be elm_experimental...
744 * Complaints about this code should go to /dev/null, or failing that nash.
745 */
746Eina_Bool elm_selection_selection_has_owner(void);
747Eina_Bool elm_drop_target_add(Evas_Object *widget, Elm_Sel_Type, Elm_Drop_Cb, void *);
748Eina_Bool elm_drop_target_del(Evas_Object *widget);
749Eina_Bool elm_drag_start(Evas_Object *, Elm_Sel_Format, const char *, void (*)(void *, Evas_Object *), void *);
750
751#endif