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 * // basic - allocate data for widget and fill it
113 * wd = ELM_NEW(Widget_Data);
114 * e = evas_object_evas_get(parent);
115 * if (!e) return NULL;
116 * obj = elm_widget_add(e);
117 * // give it a type name and set up a mywidget type string if needed
118 * ELM_SET_WIDTYPE(widtype, "mywidget");
119 * elm_widget_type_set(obj, "mywidget");
120 * // tell the parent widget that we are a sub object
121 * elm_widget_sub_object_add(parent, obj);
122 * // setup hooks we need (some are optional)
123 * elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
124 * elm_widget_data_set(obj, wd);
125 * elm_widget_del_hook_set(obj, _del_hook);
126 * elm_widget_theme_hook_set(obj, _theme_hook);
127 * elm_widget_disable_hook_set(obj, _disable_hook);
128 * // this widget can focus (true means yes it can, false means it can't)
129 * elm_widget_can_focus_set(obj, EINA_TRUE);
131 * // for this widget we will add 1 sub object that is an edje object
132 * wd->sub = edje_object_add(e);
133 * // set the theme. this follows a scheme for group name like this:
134 * // "elm/WIDGETNAME/ELEMENT/STYLE"
135 * // so here it will be:
136 * // "elm/mywidget/base/default"
137 * // changing style changes style name from default (all widgets start
138 * // with the default style) and element is for your widget internal
139 * // structure as you see fit
140 * elm_widget_theme_object_set(obj, wd->sub, "mywidget", "base", "default");
141 * // listen to a signal from the edje object to produce widget smart
142 * // callback (like click)
143 * edje_object_signal_callback_add(wd->sub, "elm,action,click", "",
144 * _signal_clicked, obj);
145 * // set this sub object as the "resize object". widgets get 1 resize
146 * // object that is resized along with the object wrapper.
147 * elm_widget_resize_object_set(obj, wd->sub);
149 * // evaluate sizing of the widget (minimum size calc etc.). optional but
150 * // not a bad idea to do here. it will get queued for later anyway
153 * // register the smart callback descriptions so we can have some runtime
154 * // info as to what the smart callback strings mean
155 * evas_object_smart_callbacks_descriptions_set(obj, _signals);
159 * // example - do "whatever" to the widget (here just emit a signal)
161 * elm_mywidget_whatever(Evas_Object *obj)
163 * // check if type is correct - check will return if it fails
164 * ELM_CHECK_WIDTYPE(obj, widtype);
165 * // get widget data - type is correct and sane by this point, so this
166 * // should never fail
167 * Widget_Data *wd = elm_widget_data_get(obj);
168 * // do whatever you like
169 * edje_object_signal_emit(wd->sub, "elm,state,action,whatever", "elm");
172 * // you can add more - you need to see elementary's code to know how to
173 * // handle all cases. remember this api is not stable and may change. it's
178 #ifndef ELM_INTERAL_API_MDFGELQ
179 # warning "You are using an internal elementary API. This API is not stable"
180 # warning "and is subject to change. You use this at your own risk."
181 # warning "Remember to call elm_widget_api_check(ELM_INTERNAL_API_VERSION);"
182 # warning "in your widgets before you call any other elm_widget calls to do"
183 # warning "a correct runtime version check."
185 #define ELM_INTERNAL_API_VERSION 7000
187 typedef struct _Elm_Tooltip Elm_Tooltip;
188 typedef struct _Elm_Cursor Elm_Cursor;
189 typedef struct _Elm_Widget_Item Elm_Widget_Item; /**< base structure for all widget items that are not Elm_Widget themselves */
191 struct _Elm_Widget_Item
193 /* ef1 ~~ efl, el3 ~~ elm */
194 #define ELM_WIDGET_ITEM_MAGIC 0xef1e1301
197 Evas_Object *widget; /**< the owner widget that owns this item */
198 Evas_Object *view; /**< the base view object */
199 const void *data; /**< item specific data */
200 Evas_Smart_Cb del_cb; /**< used to notify the item is being deleted */
201 /* widget variations should have data from here and on */
202 /* @todo: TODO check if this is enough for 1.0 release, maybe add padding! */
205 #define ELM_NEW(t) calloc(1, sizeof(t))
207 EAPI Eina_Bool elm_widget_api_check(int ver);
208 EAPI Evas_Object *elm_widget_add(Evas *evas);
209 EAPI void elm_widget_del_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
210 EAPI void elm_widget_del_pre_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
211 EAPI void elm_widget_focus_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
212 EAPI void elm_widget_activate_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
213 EAPI void elm_widget_disable_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
214 EAPI void elm_widget_theme_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
215 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));
216 EAPI void elm_widget_changed_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
217 EAPI void elm_widget_signal_emit_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj, const char *emission, const char *source));
218 EAPI void elm_widget_signal_callback_add_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj, const char *emission, const char *source, void (*func_cb) (void *data, Evas_Object *o, const char *emission, const char *source), void *data));
219 EAPI void elm_widget_signal_callback_del_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj, const char *emission, const char *source, void (*func_cb) (void *data, Evas_Object *o, const char *emission, const char *source), void *data));
220 EAPI void elm_widget_theme(Evas_Object *obj);
221 EAPI void elm_widget_theme_specific(Evas_Object *obj, Elm_Theme *th, Eina_Bool force);
222 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));
223 EAPI void elm_widget_on_focus_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data);
224 EAPI void elm_widget_on_change_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data);
225 EAPI void elm_widget_on_show_region_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data);
226 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));
227 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));
228 EAPI void elm_widget_data_set(Evas_Object *obj, void *data);
229 EAPI void *elm_widget_data_get(const Evas_Object *obj);
230 EAPI void elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj);
231 EAPI void elm_widget_sub_object_del(Evas_Object *obj, Evas_Object *sobj);
232 EAPI void elm_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj);
233 EAPI void elm_widget_hover_object_set(Evas_Object *obj, Evas_Object *sobj);
234 EAPI void elm_widget_signal_emit(Evas_Object *obj, const char *emission, const char *source);
235 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);
236 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));
237 EAPI void elm_widget_can_focus_set(Evas_Object *obj, Eina_Bool can_focus);
238 EAPI Eina_Bool elm_widget_can_focus_get(const Evas_Object *obj);
239 EAPI Eina_Bool elm_widget_child_can_focus_get(const Evas_Object *obj);
240 EAPI void elm_widget_highlight_ignore_set(Evas_Object *obj, Eina_Bool ignore);
241 EAPI Eina_Bool elm_widget_highlight_ignore_get(const Evas_Object *obj);
242 EAPI void elm_widget_highlight_in_theme_set(Evas_Object *obj, Eina_Bool highlight);
243 EAPI Eina_Bool elm_widget_highlight_in_theme_get(const Evas_Object *obj);
244 EAPI Eina_Bool elm_widget_focus_get(const Evas_Object *obj);
245 EAPI Evas_Object *elm_widget_focused_object_get(const Evas_Object *obj);
246 EAPI Evas_Object *elm_widget_top_get(const Evas_Object *obj);
247 EAPI Eina_Bool elm_widget_is(const Evas_Object *obj);
248 EAPI Evas_Object *elm_widget_parent_widget_get(const Evas_Object *obj);
249 EAPI void elm_widget_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, const void *data);
250 EAPI void *elm_widget_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data);
251 EAPI Eina_Bool elm_widget_event_propagate(Evas_Object *obj, Evas_Callback_Type type, void *event_info, Evas_Event_Flags *event_flags);
252 EAPI void elm_widget_focus_custom_chain_set(Evas_Object *obj, Eina_List *objs);
253 EAPI void elm_widget_focus_custom_chain_unset(Evas_Object *obj);
254 EAPI const Eina_List *elm_widget_focus_custom_chain_get(const Evas_Object *obj);
255 EAPI void elm_widget_focus_custom_chain_append(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
256 EAPI void elm_widget_focus_custom_chain_prepend(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
257 EAPI void elm_widget_focus_cycle(Evas_Object *obj, Elm_Focus_Direction dir);
258 EAPI void elm_widget_focus_direction_go(Evas_Object *obj, int x, int y);
259 EAPI Eina_Bool elm_widget_focus_next_get(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next);
260 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);
261 EAPI void elm_widget_focus_set(Evas_Object *obj, int first);
262 EAPI void elm_widget_focused_object_clear(Evas_Object *obj);
263 EAPI Evas_Object *elm_widget_parent_get(const Evas_Object *obj);
264 EAPI void elm_widget_focus_steal(Evas_Object *obj);
265 EAPI void elm_widget_activate(Evas_Object *obj);
266 EAPI void elm_widget_change(Evas_Object *obj);
267 EAPI void elm_widget_disabled_set(Evas_Object *obj, int disabled);
268 EAPI int elm_widget_disabled_get(const Evas_Object *obj);
269 EAPI void elm_widget_show_region_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
270 EAPI void elm_widget_show_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
271 EAPI void elm_widget_focus_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
272 EAPI void elm_widget_scroll_hold_push(Evas_Object *obj);
273 EAPI void elm_widget_scroll_hold_pop(Evas_Object *obj);
274 EAPI int elm_widget_scroll_hold_get(const Evas_Object *obj);
275 EAPI void elm_widget_scroll_freeze_push(Evas_Object *obj);
276 EAPI void elm_widget_scroll_freeze_pop(Evas_Object *obj);
277 EAPI int elm_widget_scroll_freeze_get(const Evas_Object *obj);
278 EAPI void elm_widget_scale_set(Evas_Object *obj, double scale);
279 EAPI double elm_widget_scale_get(const Evas_Object *obj);
280 EAPI void elm_widget_theme_set(Evas_Object *obj, Elm_Theme *th);
281 EAPI Elm_Theme *elm_widget_theme_get(const Evas_Object *obj);
282 EAPI void elm_widget_style_set(Evas_Object *obj, const char *style);
283 EAPI const char *elm_widget_style_get(const Evas_Object *obj);
284 EAPI void elm_widget_type_set(Evas_Object *obj, const char *type);
285 EAPI const char *elm_widget_type_get(const Evas_Object *obj);
286 EAPI void elm_widget_tooltip_add(Evas_Object *obj, Elm_Tooltip *tt);
287 EAPI void elm_widget_tooltip_del(Evas_Object *obj, Elm_Tooltip *tt);
288 EAPI void elm_widget_cursor_add(Evas_Object *obj, Elm_Cursor *cur);
289 EAPI void elm_widget_cursor_del(Evas_Object *obj, Elm_Cursor *cur);
290 EAPI void elm_widget_drag_lock_x_set(Evas_Object *obj, Eina_Bool lock);
291 EAPI void elm_widget_drag_lock_y_set(Evas_Object *obj, Eina_Bool lock);
292 EAPI Eina_Bool elm_widget_drag_lock_x_get(const Evas_Object *obj);
293 EAPI Eina_Bool elm_widget_drag_lock_y_get(const Evas_Object *obj);
294 EAPI int elm_widget_drag_child_locked_x_get(const Evas_Object *obj);
295 EAPI int elm_widget_drag_child_locked_y_get(const Evas_Object *obj);
296 EAPI Eina_Bool elm_widget_theme_object_set(Evas_Object *obj, Evas_Object *edj, const char *wname, const char *welement, const char *wstyle);
297 EAPI void elm_widget_type_register(const char **ptr);
298 EAPI Eina_Bool elm_widget_type_check(const Evas_Object *obj, const char *type);
299 EAPI Eina_List *elm_widget_stringlist_get(const char *str);
300 EAPI void elm_widget_stringlist_free(Eina_List *list);
302 EAPI Elm_Widget_Item *_elm_widget_item_new(Evas_Object *parent, size_t alloc_size);
303 EAPI void _elm_widget_item_del(Elm_Widget_Item *item);
304 EAPI void _elm_widget_item_pre_notify_del(Elm_Widget_Item *item);
305 EAPI void _elm_widget_item_del_cb_set(Elm_Widget_Item *item, Evas_Smart_Cb del_cb);
306 EAPI void _elm_widget_item_data_set(Elm_Widget_Item *item, const void *data);
307 EAPI void *_elm_widget_item_data_get(const Elm_Widget_Item *item);
308 EAPI void _elm_widget_item_tooltip_text_set(Elm_Widget_Item *item, const char *text);
309 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);
310 EAPI void _elm_widget_item_tooltip_unset(Elm_Widget_Item *item);
311 EAPI void _elm_widget_item_tooltip_style_set(Elm_Widget_Item *item, const char *style);
312 EAPI const char *_elm_widget_item_tooltip_style_get(const Elm_Widget_Item *item);
313 EAPI void _elm_widget_item_cursor_set(Elm_Widget_Item *item, const char *cursor);
314 EAPI const char *_elm_widget_item_cursor_get(const Elm_Widget_Item *item);
315 EAPI void _elm_widget_item_cursor_unset(Elm_Widget_Item *item);
316 EAPI void _elm_widget_item_cursor_style_set(Elm_Widget_Item *item, const char *style);
317 EAPI const char *_elm_widget_item_cursor_style_get(const Elm_Widget_Item *item);
318 EAPI void _elm_widget_item_cursor_engine_only_set(Elm_Widget_Item *item, Eina_Bool engine_only);
319 EAPI Eina_Bool _elm_widget_item_cursor_engine_only_get(const Elm_Widget_Item *item);
321 /* debug function. don't use it unless you are tracking parenting issues */
322 EAPI void elm_widget_tree_dump(const Evas_Object *top);
323 EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *output);
326 * Convenience macro to create new widget item, doing casts for you.
327 * @see _elm_widget_item_new()
328 * @param parent a valid elm_widget variant.
329 * @param type the C type that extends Elm_Widget_Item
331 #define elm_widget_item_new(parent, type) \
332 (type *)_elm_widget_item_new((parent), sizeof(type))
334 * Convenience macro to delete widget item, doing casts for you.
335 * @see _elm_widget_item_del()
336 * @param item a valid item.
338 #define elm_widget_item_del(item) \
339 _elm_widget_item_del((Elm_Widget_Item *)item)
341 * Convenience macro to notify deletion of widget item, doing casts for you.
342 * @see _elm_widget_item_pre_notify_del()
344 #define elm_widget_item_pre_notify_del(item) \
345 _elm_widget_item_pre_notify_del((Elm_Widget_Item *)item)
347 * Convenience macro to set deletion callback of widget item, doing casts for you.
348 * @see _elm_widget_item_del_cb_set()
350 #define elm_widget_item_del_cb_set(item, del_cb) \
351 _elm_widget_item_del_cb_set((Elm_Widget_Item *)item, del_cb)
355 * @see _elm_widget_item_data_set()
357 #define elm_widget_item_data_set(item, data) \
358 _elm_widget_item_data_set((Elm_Widget_Item *)item, data)
361 * @see _elm_widget_item_data_get()
363 #define elm_widget_item_data_get(item) \
364 _elm_widget_item_data_get((const Elm_Widget_Item *)item)
367 * Convenience function to set widget item tooltip as a text string.
368 * @see _elm_widget_item_tooltip_text_set()
370 #define elm_widget_item_tooltip_text_set(item, text) \
371 _elm_widget_item_tooltip_text_set((Elm_Widget_Item *)item, text)
373 * Convenience function to set widget item tooltip.
374 * @see _elm_widget_item_tooltip_content_cb_set()
376 #define elm_widget_item_tooltip_content_cb_set(item, func, data, del_cb) \
377 _elm_widget_item_tooltip_content_cb_set((Elm_Widget_Item *)item, \
380 * Convenience function to unset widget item tooltip.
381 * @see _elm_widget_item_tooltip_unset()
383 #define elm_widget_item_tooltip_unset(item) \
384 _elm_widget_item_tooltip_unset((Elm_Widget_Item *)item)
386 * Convenience function to change item's tooltip style.
387 * @see _elm_widget_item_tooltip_style_set()
389 #define elm_widget_item_tooltip_style_set(item, style) \
390 _elm_widget_item_tooltip_style_set((Elm_Widget_Item *)item, style)
392 * Convenience function to query item's tooltip style.
393 * @see _elm_widget_item_tooltip_style_get()
395 #define elm_widget_item_tooltip_style_get(item) \
396 _elm_widget_item_tooltip_style_get((const Elm_Widget_Item *)item)
398 * Convenience function to set widget item cursor.
399 * @see _elm_widget_item_cursor_set()
401 #define elm_widget_item_cursor_set(item, cursor) \
402 _elm_widget_item_cursor_set((Elm_Widget_Item *)item, cursor)
404 * Convenience function to get widget item cursor.
405 * @see _elm_widget_item_cursor_get()
407 #define elm_widget_item_cursor_get(item) \
408 _elm_widget_item_cursor_get((const Elm_Widget_Item *)item)
410 * Convenience function to unset widget item cursor.
411 * @see _elm_widget_item_cursor_unset()
413 #define elm_widget_item_cursor_unset(item) \
414 _elm_widget_item_cursor_unset((Elm_Widget_Item *)item)
416 * Convenience function to change item's cursor style.
417 * @see _elm_widget_item_cursor_style_set()
419 #define elm_widget_item_cursor_style_set(item, style) \
420 _elm_widget_item_cursor_style_set((Elm_Widget_Item *)item, style)
422 * Convenience function to query item's cursor style.
423 * @see _elm_widget_item_cursor_style_get()
425 #define elm_widget_item_cursor_style_get(item) \
426 _elm_widget_item_cursor_style_get((const Elm_Widget_Item *)item)
428 * Convenience function to change item's cursor engine_only.
429 * @see _elm_widget_item_cursor_engine_only_set()
431 #define elm_widget_item_cursor_engine_only_set(item, engine_only) \
432 _elm_widget_item_cursor_engine_only_set((Elm_Widget_Item *)item, engine_only)
434 * Convenience function to query item's cursor engine_only.
435 * @see _elm_widget_item_cursor_engine_only_get()
437 #define elm_widget_item_cursor_engine_only_get(item) \
438 _elm_widget_item_cursor_engine_only_get((const Elm_Widget_Item *)item)
441 * Cast and ensure the given pointer is an Elm_Widget_Item or return NULL.
443 #define ELM_WIDGET_ITEM(item) \
444 (((item) && (EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC))) ? \
445 ((Elm_Widget_Item *)(item)) : NULL)
447 #define ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, ...) \
450 CRITICAL("Elm_Widget_Item " # item " is NULL!"); \
451 return __VA_ARGS__; \
453 if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) { \
454 EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC); \
455 return __VA_ARGS__; \
459 #define ELM_WIDGET_ITEM_CHECK_OR_GOTO(item, label) \
462 CRITICAL("Elm_Widget_Item " # item " is NULL!"); \
465 if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) { \
466 EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC); \
471 #define ELM_SET_WIDTYPE(widtype, type) \
474 widtype = eina_stringshare_add(type); \
475 elm_widget_type_register(&widtype); \
479 #define ELM_CHECK_WIDTYPE(obj, widtype) \
480 if (!elm_widget_type_check((obj), (widtype))) return
482 #define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, ...) \
483 ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
484 ELM_CHECK_WIDTYPE(it->base.widget, widtype) __VA_ARGS__;
486 #define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(it, label) \
487 ELM_WIDGET_ITEM_CHECK_OR_GOTO((Elm_Widget_Item *)it, label); \
488 if (!elm_widget_type_check((it->base.widget), (widtype))) goto label;
492 * The drag and drop API.
493 * Currently experimental, and will change when it does dynamic type
496 * Here so applications can start to use it, if they ask elm nicely.
498 * And yes, elm_widget, should probably be elm_experimental...
499 * Complaints about this code should go to /dev/null, or failing that nash.
501 typedef struct _Elm_Selection_Data Elm_Selection_Data;
503 typedef Eina_Bool (*Elm_Drop_Cb) (void *d, Evas_Object *o, Elm_Selection_Data *data);
505 typedef enum _Elm_Sel_Type
515 typedef enum _Elm_Sel_Format
517 /** Plain unformated text: Used for things that don't want rich markup */
518 ELM_SEL_FORMAT_TEXT = 0x01,
519 /** Edje textblock markup, including inline images */
520 ELM_SEL_FORMAT_MARKUP = 0x02,
522 ELM_SEL_FORMAT_IMAGE = 0x04,
524 ELM_SEL_FORMAT_VCARD = 0x08,
525 /** Raw HTMLish things for widgets that want that stuff (hello webkit!) */
526 ELM_SEL_FORMAT_HTML = 0x10,
529 struct _Elm_Selection_Data
532 Elm_Sel_Format format;
537 Eina_Bool elm_selection_set(Elm_Sel_Type selection, Evas_Object *widget, Elm_Sel_Format format, const char *buf);
538 Eina_Bool elm_selection_clear(Elm_Sel_Type selection, Evas_Object *widget);
539 Eina_Bool elm_selection_get(Elm_Sel_Type selection, Elm_Sel_Format format, Evas_Object *widget, Elm_Drop_Cb datacb, void *udata);
540 Eina_Bool elm_drop_target_add(Evas_Object *widget, Elm_Sel_Type, Elm_Drop_Cb, void *);
541 Eina_Bool elm_drop_target_del(Evas_Object *widget);
542 Eina_Bool elm_drag_start(Evas_Object *, Elm_Sel_Format, const char *, void (*)(void *,Evas_Object*),void*);