sync with master
[framework/uifw/elementary.git] / src / lib / elm_widget.h
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
7  * IT AT RUNTIME.
8  *
9  * How to make your own widget? like this (where wname is your widget
10  * name (space) and wparentname is you widget's parent widget name
11  * (the base widget class if its a 'root' one).
12  *
13  * #include <Elementary.h>
14  * #include "elm_priv.h"
15  *
16  * static const char ELM_WNAME_SMART_NAME[] = "elm_wname";
17  *
18  * #define ELM_WNAME_DATA_GET(o, sd) \
19  *   Elm_WName_Smart_Data * sd = evas_object_smart_data_get(o)
20  *
21  * #define ELM_WNAME_CHECK(obj)                                      \
22  *   if (!obj || !elm_widget_type_check((obj), ELM_WNAME_SMART_NAME, \
23  *                                      __func__))                   \
24  *     return
25  *
26  * typedef struct _Elm_WName_Smart_Class
27  * {
28  *    Elm_WParentName_Smart_Class base;
29  * } Elm_WName_Smart_Class;
30  *
31  * typedef struct _Elm_WName_Smart_Data Elm_WName_Smart_Data;
32  * struct _Elm_WName_Smart_Data
33  * {
34  *   Elm_WParentName_Smart_Data base;
35  *   Evas_Object *sub; // or any private data needed for an instance
36  *   // add any other instance data here too
37  * };
38  *
39  * static const char SIG_CLICKED[] = "clicked";
40  * static const Evas_Smart_Cb_Description _smart_callbacks[] = {
41  *   {SIG_CLICKED, ""},
42  *   {NULL, NULL}
43  * };
44  *
45  * EVAS_SMART_SUBCLASS_NEW
46  *   (ELM_WNAME_SMART_NAME, _elm_wname, Elm_WName_Smart_Class,
47  *   Elm_WParentName_Smart_Class, elm_wparentname_smart_class_get,
48  *   _smart_callbacks);
49  *
50  * static Eina_Bool
51  * _elm_wname_smart_on_focus(Evas_Object *obj)
52  * {
53  *    ELM_WNAME_DATA_GET(obj, sd);
54  *
55  *    // handle focus going in and out - optional, but if you want to,
56  *    // define this virtual function to handle it (e.g. to emit a
57  *    // signal to an edje object)
58  *
59  *    if (elm_widget_focus_get(obj))
60  *      {
61  *         edje_object_signal_emit(sd->sub, "elm,action,focus", "elm");
62  *         evas_object_focus_set(sd->sub, EINA_TRUE);
63  *      }
64  *    else
65  *      {
66  *         edje_object_signal_emit(sd->sub, "elm,action,unfocus", "elm");
67  *         evas_object_focus_set(sd->sub, EINA_FALSE);
68  *      }
69  *
70  *    return EINA_TRUE;
71  * }
72  *
73  * static Eina_Bool
74  * _elm_wname_smart_theme(Evas_Object *obj)
75  * {
76  *    ELM_WNAME_DATA_GET(obj, sd);
77  *
78  *   if (!ELM_WIDGET_CLASS(_elm_wname_parent_sc)->theme(obj))
79  *     return EINA_FALSE;
80  *
81  *    // handle changes in theme/scale etc here. always call the
82  *    // parent class's version, as even the base class implements it.
83  *
84  *    elm_widget_theme_object_set(obj, sd->sub, "wname", "base",
85  *                                elm_widget_style_get(obj));
86  *
87  *    return EINA_TRUE;
88  * }
89  *
90  * static Eina_Bool
91  * _elm_widget_smart_disable(Evas_Object *obj)
92  * {
93  *    ELM_WNAME_DATA_GET(obj, sd);
94  *
95  *    // optional, but handle if the widget gets disabled or not
96  *    if (elm_widget_disabled_get(obj))
97  *      edje_object_signal_emit(sd->sub, "elm,state,disabled", "elm");
98  *    else
99  *      edje_object_signal_emit(sd->sub, "elm,state,enabled", "elm");
100  *
101  *    return EINA_TRUE;
102  * }
103  *
104  * static void
105  * _elm_wname_smart_add(Evas_Object *obj)
106  * {
107  *    EVAS_SMART_DATA_ALLOC(obj, Elm_WName_Smart_Data);
108  *
109  *    ELM_WIDGET_CLASS(_elm_wname_parent_sc)->base.add(obj);
110  *
111  *    priv->sub = edje_object_add(evas_object_evas_get(obj));
112  *    // just an example having an Edje object here. if it's really the case
113  *    // you have a sub edje object as a resize object, consider inheriting
114  *    // from @ref elm-layout-class.
115  *    elm_widget_can_focus_set(obj, EINA_TRUE);
116  *
117  *    // for this widget we will add 1 sub object that is an edje object
118  *    priv->sub = edje_object_add(e);
119  *    // set the theme. this follows a scheme for group name like this:
120  *    //   "elm/WIDGETNAME/ELEMENT/STYLE"
121  *    // so here it will be:
122  *    //   "elm/wname/base/default"
123  *    // changing style changes style name from default (all widgets start
124  *    // with the default style) and element is for your widget internal
125  *    // structure as you see fit
126  *    elm_widget_theme_object_set
127  *      (obj, priv->sub, "wname", "base", "default");
128  *    // listen to a signal from the edje object to produce widget smart
129  *    // callback (like click)
130  *    edje_object_signal_callback_add
131  *      (priv->sub, "elm,action,click", "", _clicked_signal_cb, obj);
132  *    // set this sub object as the "resize object". widgets get 1 resize
133  *    // object that is resized along with the object wrapper.
134  *    elm_widget_resize_object_set(obj, priv->sub);
135  * }
136  *
137  * static void
138  * _elm_wname_smart_del(Evas_Object *obj)
139  * {
140  *    ELM_WNAME_DATA_GET(obj, sd);
141  *
142  *    // deleting 'virtual' function implementation - on deletion of
143  *    // object delete object struct, etc.
144  *
145  *    ELM_WIDGET_CLASS(_elm_wname_parent_sc)->base.del(obj);
146  * }
147  *
148  * static void
149  * _elm_wname_smart_set_user(Elm_WName_Smart_Class *sc)
150  * {
151  *    ELM_WIDGET_CLASS(sc)->base.add = _elm_wname_smart_add;
152  *    ELM_WIDGET_CLASS(sc)->base.del = _elm_wname_smart_del;
153  *
154  *    ELM_WIDGET_CLASS(sc)->theme = _elm_wname_smart_theme;
155  *    ELM_WIDGET_CLASS(sc)->disable = _elm_wname_smart_disable;
156  *    ELM_WIDGET_CLASS(sc)->on_focus = _elm_wname_smart_on_focus;
157  * }
158  *
159  * // actual API to create your widget. add more to manipulate it as
160  * // needed mark your calls with EAPI to make them "external api"
161  * // calls.
162  *
163  * EAPI Evas_Object *
164  * elm_wname_add(Evas_Object *parent)
165  * {
166  *    Evas_Object *obj;
167  *
168  *    EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
169  *
170  *    obj = elm_widget_add(_elm_check_smart_class_new(), parent);
171  *    if (!obj) return NULL;
172  *
173  *    if (!elm_widget_sub_object_add(parent, obj))
174  *      ERR("could not add %p as sub object of %p", obj, parent);
175  *
176  *    return obj;
177  * }
178  *
179  * // example - do "whatever" to the widget (here just emit a signal)
180  * EAPI void
181  * elm_wname_whatever(Evas_Object *obj)
182  * {
183  *    // check if type is correct - check will return if it fails
184  *    ELM_WNAME_CHECK(obj);
185  *    // get widget data - type is correct and sane by this point, so this
186  *    // should never fail
187  *    ELM_WNAME_DATA_GET(obj, sd);
188  *    // do whatever you like
189  *    edje_object_signal_emit(sd->sub, "elm,state,action,whatever", "elm");
190  * }
191  *
192  * // you can add more - you need to see elementary's code to know how
193  * // to handle all cases. remember this api is not stable and may
194  * change. it's internal
195  */
196
197 #ifndef ELM_INTERNAL_API_ARGESFSDFEFC
198 #warning "You are using an internal elementary API. This API is not stable"
199 #warning "and is subject to change. You use this at your own risk."
200 #warning "Remember to call elm_widget_api_check(ELM_INTERNAL_API_VERSION);"
201 #warning "in your widgets before you call any other elm_widget calls to do"
202 #warning "a correct runtime version check. Also remember - you don't NEED"
203 #warning "to make an Elementary widget is almost ALL cases. You can easily"
204 #warning "make a smart object with Evas's API and do everything you need"
205 #warning "there. You only need a widget if you want to seamlessly be part"
206 #warning "of the focus tree and want to transparently become a container"
207 #warning "for any number of child Elementary widgets"
208 //#error "ERROR. Compile aborted."
209 #endif
210 #define ELM_INTERNAL_API_VERSION 7000
211
212 /**
213  * @defgroup Widget Widgets Extension Infrastructure
214  *
215  * This section is intended for people willing to create @b custom
216  * Elementary widgets or to contribute new (useful, unique) widgets
217  * upstream. If neither is your case, this text won't be of any use
218  * for you.
219  *
220  * Elementary widgets are built in a @b hierarchical fashion. The idea
221  * is to factorize as much code as possible between widgets with
222  * behavioral similarities, as long as to facilitate the creation of
223  * @b custom, new widgets, may the user need them.
224  *
225  * It all starts with a base class, which aggregates behaviour
226  * @b every Elementary widget is supposed to have:
227  * #Elm_Widget_Smart_Class. Every Elementary widget will be of that
228  * type, be it directly or by means of @b inheriting from it.
229  *
230  * #Elm_Widget_Smart_Class happens to be an @c Evas_Smart_Class. If
231  * you check out Evas' documentation on it, you'll see it's how one is
232  * supposed to create custom Evas objects, what Elementary widgets
233  * are.
234  *
235  * Once one instantiates an Elementary widget, since it inherits from
236  * #Elm_Widget_Smart_Class, the system will raise a class instance of
237  * that type for you. But that happens only @b once: the first time
238  * you ask for an Elementary widget (of a given type). All subsequent
239  * ones will only point to the very same class instance. Since it's
240  * the class which points to the functions implementing the behavior
241  * of objects of that type, all of the live instances of Elementary
242  * widgets (of that type) will share the same blob of code loaded in
243  * memory to execute their routines.
244  *
245  * Now go and take a look at #Elm_Widget_Smart_Class's fields. Because
246  * it inherits from Evas' base smart class, we got a field of that
247  * type as the first member, so that Evas can handle Elementary
248  * objects internally as if they were 'normal' Evas objects. Evas has
249  * the Evas-only behavior function pointers in there, so it's all it
250  * needs.
251  *
252  * Then, comes a version field, so that whenever we got to update or
253  * change the fields on our base smart class, there'll be a runtime
254  * check of the version expected by Elementary and the one provided by
255  * any code linking with it. A mismatch will show the developer of
256  * that code he/she needs to recompile and link its code to a newer
257  * version of Elementary.
258  *
259  * The next fields are the class functions themselves. We call them
260  * 'virtual' because, as in object-oriented languages, one is supposed
261  * here to override them on inheriting classes. On most of
262  * inheritances you'll probably want to call the parent's version of
263  * the class function too: you must analyse each case to tell.
264  *
265  * Take a look at #Elm_Widget_Smart_Data. That's private data bound to
266  * each Elementary object @b instance. It aggregates data needed for
267  * all widgets, since it's meant for the #Elm_Widget_Smart_Class-typed
268  * ones.
269  *
270  * When inheriting from that base type, instance data for this new
271  * class has to have, as the first member, a field of type
272  * #Elm_Widget_Smart_Data. This has to be respected recursively -- if
273  * a third class is to be created inheriting from the one that is a
274  * direct 'child' of #Elm_Widget_Smart_Class, then the private data on
275  * this third class has to have, as its first field, a variable of the
276  * type of the private data of the second class (its parent), direct
277  * child of #Elm_Widget_Smart_Class.
278  *
279  * It is from the base private data, #Elm_Widget_Smart_Data, that we
280  * reach an object's class functions, by the given object
281  * instance. This is the reason of the first field of that struct: a
282  * pointer set to point to its class when the object is instantiated.
283  *
284  * The following figure illustrates the widget inheritance schema.
285  *
286  * @image html elm-widget-hierarchy.png
287  * @image rtf elm-widget-hierarchy.png
288  * @image latex elm-widget-hierarchy.eps
289  *
290  * @section elm-hierarchy-tree Elementary Widgets Hierarchy Tree
291  *
292  * The following figure illustrates the Elementary widget inheritance
293  * tree.
294  *
295  * @image html elm-widget-tree.png
296  * @image rtf elm-widget-tree.png
297  * @image latex elm-widget-tree.eps
298  */
299
300 /**
301  * @addtogroup Widget
302  * @{
303  */
304
305 /**
306  * @def ELM_WIDGET_CLASS
307  *
308  * Use this macro to cast whichever subclass of
309  * #Elm_Widget_Smart_Class into it, so to access its fields.
310  *
311  * @ingroup Widget
312  */
313 #define ELM_WIDGET_CLASS(x) ((Elm_Widget_Smart_Class *) x)
314
315 /**
316  * @def ELM_WIDGET_DATA
317  *
318  * Use this macro to cast whichever subdata of
319  * #Elm_Widget_Smart_Data into it, so to access its fields.
320  *
321  * @ingroup Widget
322  */
323 #define ELM_WIDGET_DATA(x) ((Elm_Widget_Smart_Data *) x)
324
325 /**
326  * @def ELM_WIDGET_SMART_CLASS_VERSION
327  *
328  * Current version for Elementary widget @b base smart class, a value
329  * which goes to _Elm_Widget_Smart_Class::version.
330  *
331  * @ingroup Wiget
332  */
333 #define ELM_WIDGET_SMART_CLASS_VERSION 1
334
335 /**
336  * @def ELM_WIDGET_SMART_CLASS_INIT
337  *
338  * Initializer for a whole #Elm_Widget_Smart_Class structure, with
339  * @c NULL values on its specific fields.
340  *
341  * @param smart_class_init initializer to use for the "base" field
342  * (#Evas_Smart_Class).
343  *
344  * @see EVAS_SMART_CLASS_INIT_NULL
345  * @see EVAS_SMART_CLASS_INIT_VERSION
346  * @see EVAS_SMART_CLASS_INIT_NAME_VERSION
347  * @see ELM_WIDGET_SMART_CLASS_INIT_NULL
348  * @see ELM_WIDGET_SMART_CLASS_INIT_NAME_VERSION
349  *
350  * @ingroup Widget
351  */
352 #define ELM_WIDGET_SMART_CLASS_INIT(smart_class_init)                        \
353   {smart_class_init, ELM_WIDGET_SMART_CLASS_VERSION, NULL, NULL, NULL, NULL, \
354    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
355
356 /**
357  * @def ELM_WIDGET_SMART_CLASS_INIT_NULL
358  *
359  * Initializer to zero out a whole #Elm_Widget_Smart_Class structure.
360  *
361  * @see ELM_WIDGET_SMART_CLASS_INIT_NAME_VERSION
362  * @see ELM_WIDGET_SMART_CLASS_INIT
363  *
364  * @ingroup Widget
365  */
366 #define ELM_WIDGET_SMART_CLASS_INIT_NULL \
367   ELM_WIDGET_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NULL)
368
369 /**
370  * @def ELM_WIDGET_SMART_CLASS_INIT_NAME_VERSION
371  *
372  * Initializer to zero out a whole #Elm_Widget_Smart_Class structure and
373  * set its name and version.
374  *
375  * This is similar to #ELM_WIDGET_SMART_CLASS_INIT_NULL, but it will
376  * also set the version field of #Elm_Widget_Smart_Class (base field)
377  * to the latest #ELM_WIDGET_SMART_CLASS_VERSION and name it to the
378  * specific value.
379  *
380  * It will keep a reference to the name field as a <c>"const char *"</c>,
381  * i.e., the name must be available while the structure is
382  * used (hint: static or global variable!) and must not be modified.
383  *
384  * @see ELM_WIDGET_SMART_CLASS_INIT_NULL
385  * @see ELM_WIDGET_SMART_CLASS_INIT
386  *
387  * @ingroup Widget
388  */
389 #define ELM_WIDGET_SMART_CLASS_INIT_NAME_VERSION(name) \
390   ELM_WIDGET_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NAME_VERSION(name))
391
392 /* Elm_Activate is used in 'Virtual' function Eina_Bool (*activate)
393  * (Evas_Object *obj, Elm_Activate act); of Elm_Widget_Smart_Class */
394 typedef enum
395 {
396    ELM_ACTIVATE_DEFAULT = 0,
397    ELM_ACTIVATE_UP,
398    ELM_ACTIVATE_DOWN,
399    ELM_ACTIVATE_RIGHT,
400    ELM_ACTIVATE_LEFT
401 } Elm_Activate;
402
403 /* Please, ALWAYS update the ELM_WIDGET_SMART_CLASS_INIT macro
404  * whenever you change the following struct! */
405
406 /**
407  * Base widget smart class. It has the 'virtual' functions for all
408  * general, common actions on Elementary widgets.
409  */
410 typedef struct _Elm_Widget_Smart_Class
411 {
412    Evas_Smart_Class base; /**< Base smart class struct, needed for all smart objects */
413    int              version; /**< Version of this smart class definition */
414
415    void             (*parent_set)(Evas_Object *obj,
416                                   Evas_Object *parent); /**< 'Virtual' function handling parent widget attachment to new object */
417    Eina_Bool        (*on_focus)(Evas_Object *obj); /**< 'Virtual' function handling focus in/out events on the widget */
418    Eina_Bool        (*disable)(Evas_Object *obj); /**< 'Virtual' function on the widget being disabled */
419    Eina_Bool        (*theme)(Evas_Object *obj); /**< 'Virtual' function on the widget being re-themed */
420    Eina_Bool        (*translate)(Evas_Object *obj); /**< 'Virtual' function handling language changes on Elementary */
421    Eina_Bool        (*event)(Evas_Object *obj,
422                              Evas_Object *source,
423                              Evas_Callback_Type type,
424                              void *event_info); /**< 'Virtual' function handling input events on the widget */
425    Eina_Bool        (*on_focus_region)(const Evas_Object *obj,
426                                        Evas_Coord *x,
427                                        Evas_Coord *y,
428                                        Evas_Coord *w,
429                                        Evas_Coord *h); /**< 'Virtual' function returning an inner area of a widget that should be brought into the visible are of a broader viewport, may this context arise. On the base Elementary widget class, it defaults to the object's total area, so only override it if you have to. */
430    Eina_Bool        (*focus_next)(const Evas_Object *obj,
431                                   Elm_Focus_Direction dir,
432                                   Evas_Object **next); /**< 'Virtual' function handling passing focus to sub-objects */
433    Eina_Bool        (*focus_direction)(const Evas_Object *obj,
434                                        const Evas_Object *base,
435                                        double degree,
436                                        Evas_Object **target,
437                                        double *weight); /**< 'Virtual' function handling passing focus to sub-objects <b>given a direction, in degrees</b> */
438
439    Eina_Bool        (*sub_object_add)(Evas_Object *obj,
440                                       Evas_Object *sobj); /**< 'Virtual' function handling sub objects being added */
441
442    Eina_Bool        (*sub_object_del)(Evas_Object *obj,
443                                       Evas_Object *sobj); /**< 'Virtual' function handling sub objects being removed */
444    void             (*access)(Evas_Object *obj,
445                               Eina_Bool is_access); /**< 'Virtual' function on the widget being set access */
446    Eina_Bool        (*activate)(Evas_Object *obj,
447                                 Elm_Activate act); /**< 'Virtual' function to activate widget  */
448 } Elm_Widget_Smart_Class;
449
450 /**
451  * Base widget smart data. This is data bound to an Elementary object
452  * @b instance, so its particular to that specific object and not
453  * shared between all objects in its class. It is here, though, that
454  * we got a pointer to the object's class, the first field -- @c
455  * 'api'.
456  */
457 typedef struct _Elm_Widget_Smart_Data
458 {
459    const Elm_Widget_Smart_Class *api; /**< This is the pointer to the object's class, from where we can reach/call its class functions */
460
461    Evas_Object                  *obj;
462    Evas_Object                  *parent_obj;
463    Evas_Object                  *parent2;
464    Evas_Coord                    x, y, w, h;
465    Eina_List                    *subobjs;
466    Evas_Object                  *resize_obj;
467    Evas_Object                  *hover_obj;
468    Eina_List                    *tooltips, *cursors;
469
470    /* "show region" coordinates. all widgets got those because this
471     * info may be set and queried recursively through the widget
472     * parenting tree */
473    Evas_Coord                    rx, ry, rw, rh;
474
475    /* scrolling hold/freeze hints. all widgets got those because this
476     * info may be set and queried recursively through the widget
477     * parenting tree */
478    int                           scroll_hold;
479    int                           scroll_freeze;
480
481    double                        scale;
482    Elm_Theme                    *theme;
483    const char                   *style;
484    const char                   *access_info;
485    unsigned int                  focus_order;
486    Eina_Bool                     focus_order_on_calc;
487
488    int                           child_drag_x_locked;
489    int                           child_drag_y_locked;
490
491    Eina_List                    *translate_strings;
492    Eina_List                    *focus_chain;
493    Eina_List                    *event_cb;
494
495    /* this is a hook to be set on-the-fly on widgets. this is code
496     * handling the request of showing a specific region from an inner
497     * widget (mainly issued by entries, on cursor moving) */
498    void                         *on_show_region_data;
499    void                        (*on_show_region)(void *data,
500                                                  Evas_Object *obj);
501
502    int                           frozen;
503    int                           orient_mode; /* -1 is disabled */
504
505    Eina_Bool                     drag_x_locked : 1;
506    Eina_Bool                     drag_y_locked : 1;
507
508    Eina_Bool                     can_focus : 1;
509    Eina_Bool                     child_can_focus : 1;
510    Eina_Bool                     focused : 1;
511    Eina_Bool                     top_win_focused : 1;
512    Eina_Bool                     tree_unfocusable : 1;
513    Eina_Bool                     highlight_ignore : 1;
514    Eina_Bool                     highlight_in_theme : 1;
515    Eina_Bool                     disabled : 1;
516    Eina_Bool                     is_mirrored : 1;
517    Eina_Bool                     mirrored_auto_mode : 1; /* This is
518                                                           * TRUE by
519                                                           * default */
520    Eina_Bool                     still_in : 1;
521    Eina_Bool                     can_access : 1;
522    Eina_Bool                     highlighted : 1;
523    Eina_Bool                     highlight_root : 1;
524 } Elm_Widget_Smart_Data;
525
526 /**
527  * @}
528  */
529
530 typedef struct _Elm_Tooltip     Elm_Tooltip;
531 typedef struct _Elm_Cursor      Elm_Cursor;
532
533 /**< base structure for all widget items that are not Elm_Widget themselves */
534 typedef struct _Elm_Widget_Item Elm_Widget_Item;
535
536 /**< accessibility information to be able to set and get from the access API */
537 typedef struct _Elm_Access_Info Elm_Access_Info;
538
539 /**< accessibility info item */
540 typedef struct _Elm_Access_Item Elm_Access_Item;
541
542 typedef void                  (*Elm_Widget_Text_Set_Cb)(void *data, const char *part, const char *text);
543 typedef void                  (*Elm_Widget_Content_Set_Cb)(void *data, const char *part, Evas_Object *content);
544 typedef const char           *(*Elm_Widget_Text_Get_Cb)(const void *data, const char *part);
545 typedef Evas_Object          *(*Elm_Widget_Content_Get_Cb)(const void *data, const char *part);
546 typedef Evas_Object          *(*Elm_Widget_Content_Unset_Cb)(const void *data, const char *part);
547 typedef void                  (*Elm_Widget_Signal_Emit_Cb)(void *data, const char *emission, const char *source);
548 typedef void                  (*Elm_Widget_Disable_Cb)(void *data);
549 typedef Eina_Bool             (*Elm_Widget_Del_Pre_Cb)(void *data);
550
551 #define ELM_ACCESS_DONE          -1   /* sentence done - send done event here */
552 #define ELM_ACCESS_CANCEL        -2   /* stop reading immediately */
553
554 typedef void (*Elm_Access_On_Highlight_Cb)(void *data);
555
556 struct _Elm_Access_Item
557 {
558    int                   type;
559    const void           *data;
560    Elm_Access_Info_Cb    func;
561 };
562
563 struct _Elm_Access_Info
564 {
565    Evas_Object               *hoverobj;
566    Eina_List                 *items;
567    Ecore_Timer               *delay_timer;
568    void                      *on_highlight_data;
569    Elm_Access_On_Highlight_Cb on_highlight;
570
571    void                      *activate_data;
572    Elm_Access_Activate_Cb    activate;
573
574    /* the owner widget item that owns this access info */
575    Elm_Widget_Item           *widget_item;
576
577    /* the owner part object that owns this access info */
578    Evas_Object               *part_object;
579 };
580
581 void                  _elm_access_shutdown();
582 void                  _elm_access_mouse_event_enabled_set(Eina_Bool enabled);
583 /* elm_widget_focus_list_next_get();, elm_widget_focus_next_get();
584    and elm_widget_focus_cycle(); use _elm_access_read_mode to use
585    focus chain */
586 void                  _elm_access_read_mode_set(Eina_Bool enabled);
587 Eina_Bool             _elm_access_read_mode_get();
588 void                  _elm_access_widget_item_access_order_set(Elm_Widget_Item *item, Eina_List *objs);
589 const Eina_List      *_elm_access_widget_item_access_order_get(const Elm_Widget_Item *item);
590 void                  _elm_access_widget_item_access_order_unset(Elm_Widget_Item *item);
591
592 EAPI void             _elm_access_clear(Elm_Access_Info *ac);
593 EAPI void             _elm_access_text_set(Elm_Access_Info *ac, int type, const char *text);
594 EAPI void             _elm_access_callback_set(Elm_Access_Info *ac, int type, Elm_Access_Info_Cb func, const void *data);
595 EAPI char            *_elm_access_text_get(const Elm_Access_Info *ac, int type, const Evas_Object *obj); /* this is ok it actually returns a strduped string - it's meant to! */
596 EAPI void             _elm_access_read(Elm_Access_Info *ac, int type, const Evas_Object *obj);
597 EAPI void             _elm_access_say(const char *txt);
598 EAPI Elm_Access_Info *_elm_access_object_get(const Evas_Object *obj);
599 EAPI void             _elm_access_object_hilight(Evas_Object *obj);
600 EAPI void             _elm_access_object_unhilight(Evas_Object *obj);
601 EAPI void             _elm_access_object_hilight_disable(Evas *e);
602 EAPI void             _elm_access_object_register(Evas_Object *obj, Evas_Object *hoverobj);
603 EAPI void             _elm_access_object_unregister(Evas_Object *obj, Evas_Object *hoverobj);
604 EAPI Eina_Bool        _elm_access_2nd_click_timeout(Evas_Object *obj);
605 EAPI void             _elm_access_highlight_set(Evas_Object* obj);
606 EAPI Evas_Object *    _elm_access_edje_object_part_object_register(Evas_Object *obj, const Evas_Object *partobj, const char* part);
607 EAPI void             _elm_access_edje_object_part_object_unregister(Evas_Object* obj, const Evas_Object *eobj, const char* part);
608 EAPI void             _elm_access_widget_item_register(Elm_Widget_Item *item);
609 EAPI void             _elm_access_widget_item_unregister(Elm_Widget_Item *item);
610 EAPI void             _elm_access_on_highlight_hook_set(Elm_Access_Info *ac, Elm_Access_On_Highlight_Cb func, void *data);
611 EAPI void             _elm_access_activate_callback_set(Elm_Access_Info *ac, Elm_Access_Activate_Cb func, void *data);
612 EAPI void             _elm_access_highlight_object_activate(Evas_Object *obj, Elm_Activate act);
613 EAPI void             _elm_access_highlight_cycle(Evas_Object *obj, Elm_Focus_Direction dir);
614
615 /**< put this as the first member in your widget item struct */
616 #define ELM_WIDGET_ITEM       Elm_Widget_Item base
617
618 struct _Elm_Widget_Item
619 {
620 /* ef1 ~~ efl, el3 ~~ elm */
621 #define ELM_WIDGET_ITEM_MAGIC 0xef1e1301
622    EINA_MAGIC;
623 /* simple accessor macros */
624 #define VIEW(X)   X->base.view
625 #define WIDGET(X) X->base.widget
626    /**< the owner widget that owns this item */
627    Evas_Object                   *widget;
628    /**< the base view object */
629    Evas_Object                   *view;
630    /**< item specific data. used for del callback */
631    const void                    *data;
632    /**< user delete callback function */
633    Evas_Smart_Cb                  del_func;
634    /**< widget delete callback function. don't expose this callback call */
635    Elm_Widget_Del_Pre_Cb          del_pre_func;
636
637    Elm_Widget_Content_Set_Cb      content_set_func;
638    Elm_Widget_Content_Get_Cb      content_get_func;
639    Elm_Widget_Content_Unset_Cb    content_unset_func;
640    Elm_Widget_Text_Set_Cb         text_set_func;
641    Elm_Widget_Text_Get_Cb         text_get_func;
642    Elm_Widget_Signal_Emit_Cb      signal_emit_func;
643    Elm_Widget_Disable_Cb          disable_func;
644    Evas_Object                   *access_obj;
645    const char                    *access_info;
646    Eina_List                     *access_order;
647
648    Eina_Bool                      disabled : 1;
649    Eina_Bool                      on_deletion : 1;
650 };
651
652 struct _Elm_Object_Item
653 {
654    ELM_WIDGET_ITEM;
655 };
656
657 #define ELM_NEW(t) calloc(1, sizeof(t))
658
659 EAPI Evas_Object     *elm_widget_add(Evas_Smart *, Evas_Object *);
660 EAPI void             elm_widget_parent_set(Evas_Object *, Evas_Object *);
661 EAPI Eina_Bool        elm_widget_api_check(int ver);
662 EAPI Eina_Bool        elm_widget_access(Evas_Object *obj, Eina_Bool is_access);
663 EAPI Eina_Bool        elm_widget_theme(Evas_Object *obj);
664 EAPI void             elm_widget_theme_specific(Evas_Object *obj, Elm_Theme *th, Eina_Bool force);
665 EAPI void             elm_widget_translate(Evas_Object *obj);
666 EAPI void             elm_widget_on_show_region_hook_set(Evas_Object *obj, void (*func)(void *data, Evas_Object *obj), void *data);
667 EAPI Eina_Bool        elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj);
668 EAPI Eina_Bool        elm_widget_sub_object_del(Evas_Object *obj, Evas_Object *sobj);
669
670 //SHKWAK : This is temp for Indicator Issue
671 //THIS MUST BE REMOVED
672
673 EAPI const Eina_List *elm_widget_sub_object_list_get(const Evas_Object *obj);
674
675 //SHKWAK : END
676
677 EAPI void             elm_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj);
678 EAPI void             elm_widget_hover_object_set(Evas_Object *obj, Evas_Object *sobj);
679 EAPI void             elm_widget_signal_emit(Evas_Object *obj, const char *emission, const char *source);
680 EAPI void             elm_widget_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
681 EAPI void            *elm_widget_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func);
682 EAPI void             elm_widget_can_focus_set(Evas_Object *obj, Eina_Bool can_focus);
683 EAPI Eina_Bool        elm_widget_can_focus_get(const Evas_Object *obj);
684 EAPI Eina_Bool        elm_widget_child_can_focus_get(const Evas_Object *obj);
685 EAPI Eina_List       *elm_widget_can_focus_child_list_get(const Evas_Object *obj);
686 EAPI void             elm_widget_tree_unfocusable_set(Evas_Object *obj, Eina_Bool tree_unfocusable);
687 EAPI Eina_Bool        elm_widget_tree_unfocusable_get(const Evas_Object *obj);
688 EAPI void             elm_widget_highlight_ignore_set(Evas_Object *obj, Eina_Bool ignore);
689 EAPI Eina_Bool        elm_widget_highlight_ignore_get(const Evas_Object *obj);
690 EAPI void             elm_widget_highlight_in_theme_set(Evas_Object *obj, Eina_Bool highlight);
691 EAPI Eina_Bool        elm_widget_highlight_in_theme_get(const Evas_Object *obj);
692 EAPI Eina_Bool        elm_widget_focus_get(const Evas_Object *obj);
693 EAPI Evas_Object     *elm_widget_focused_object_get(const Evas_Object *obj);
694 EAPI Evas_Object     *elm_widget_top_get(const Evas_Object *obj);
695 EAPI Eina_Bool        elm_widget_is(const Evas_Object *obj);
696 EAPI Evas_Object     *elm_widget_parent_widget_get(const Evas_Object *obj);
697 EAPI void             elm_widget_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, const void *data);
698 EAPI void            *elm_widget_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data);
699 EAPI Eina_Bool        elm_widget_event_propagate(Evas_Object *obj, Evas_Callback_Type type, void *event_info, Evas_Event_Flags *event_flags);
700 EAPI void             elm_widget_focus_custom_chain_set(Evas_Object *obj, Eina_List *objs);
701 EAPI void             elm_widget_focus_custom_chain_unset(Evas_Object *obj);
702 EAPI const Eina_List *elm_widget_focus_custom_chain_get(const Evas_Object *obj);
703 EAPI void             elm_widget_focus_custom_chain_append(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
704 EAPI void             elm_widget_focus_custom_chain_prepend(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
705 EAPI void             elm_widget_focus_cycle(Evas_Object *obj, Elm_Focus_Direction dir);
706 EAPI Eina_Bool        elm_widget_focus_direction_go(Evas_Object *obj, double degree);
707 EAPI Eina_Bool        elm_widget_focus_direction_get(const Evas_Object *obj, const Evas_Object *base, double degree, Evas_Object **direction, double *weight);
708 EAPI Eina_Bool        elm_widget_focus_next_get(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next);
709 EAPI Eina_Bool        elm_widget_focus_list_direction_get(const Evas_Object  *obj, const Evas_Object *base, const Eina_List *items, void *(*list_data_get)(const Eina_List *list), double degree, Evas_Object **direction, double *weight);
710 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);
711 EAPI void             elm_widget_focus_set(Evas_Object *obj, int first);
712 EAPI void             elm_widget_focused_object_clear(Evas_Object *obj);
713 EAPI Evas_Object     *elm_widget_parent_get(const Evas_Object *obj);
714 EAPI Evas_Object     *elm_widget_parent2_get(const Evas_Object *obj);
715 EAPI void             elm_widget_parent2_set(Evas_Object *obj, Evas_Object *parent);
716 EAPI void             elm_widget_focus_steal(Evas_Object *obj);
717 EAPI Evas_Display_Mode elm_widget_display_mode_get(const Evas_Object *obj);
718 EAPI void             elm_widget_display_mode_set(Evas_Object *obj, Evas_Display_Mode dispmode);
719 EAPI const Elm_Widget_Smart_Class *elm_widget_smart_class_get(void);
720
721 EAPI Eina_Bool        elm_widget_highlight_get(const Evas_Object *obj);
722 EAPI void             elm_widget_parent_highlight_set(Evas_Object *obj, Eina_Bool highlighted);
723 /**
724  * @internal
725  *
726  * Restore the focus state of the sub-tree.
727  *
728  * This API will restore the focus state of the sub-tree to the latest
729  * state. If a sub-tree is unfocused and wants to get back to the latest
730  * focus state, this API will be helpful.
731  *
732  * @param obj The widget root of sub-tree
733  *
734  * @ingroup Widget
735  */
736 EAPI void             elm_widget_focus_restore(Evas_Object *obj);
737
738 EAPI void             elm_widget_disabled_set(Evas_Object *obj, Eina_Bool disabled);
739 EAPI Eina_Bool        elm_widget_disabled_get(const Evas_Object *obj);
740 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);
741 EAPI void             elm_widget_show_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
742 EAPI Eina_Bool        elm_widget_focus_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
743 EAPI void             elm_widget_scroll_hold_push(Evas_Object *obj);
744 EAPI void             elm_widget_scroll_hold_pop(Evas_Object *obj);
745 EAPI int              elm_widget_scroll_hold_get(const Evas_Object *obj);
746 EAPI void             elm_widget_scroll_freeze_push(Evas_Object *obj);
747 EAPI void             elm_widget_scroll_freeze_pop(Evas_Object *obj);
748 EAPI int              elm_widget_scroll_freeze_get(const Evas_Object *obj);
749 EAPI void             elm_widget_scale_set(Evas_Object *obj, double scale);
750 EAPI double           elm_widget_scale_get(const Evas_Object *obj);
751 EAPI Eina_Bool        elm_widget_mirrored_get(const Evas_Object *obj);
752 EAPI void             elm_widget_mirrored_set(Evas_Object *obj, Eina_Bool mirrored);
753 EAPI Eina_Bool        elm_widget_mirrored_automatic_get(const Evas_Object *obj);
754 EAPI void             elm_widget_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic);
755 EAPI void             elm_widget_theme_set(Evas_Object *obj, Elm_Theme *th);
756 EAPI Elm_Theme       *elm_widget_theme_get(const Evas_Object *obj);
757 EAPI Eina_Bool        elm_widget_style_set(Evas_Object *obj, const char *style);
758 EAPI const char      *elm_widget_style_get(const Evas_Object *obj);
759 EAPI void             elm_widget_type_set(Evas_Object *obj, const char *type);
760 EAPI const char      *elm_widget_type_get(const Evas_Object *obj);
761 EAPI void             elm_widget_tooltip_add(Evas_Object *obj, Elm_Tooltip *tt);
762 EAPI void             elm_widget_tooltip_del(Evas_Object *obj, Elm_Tooltip *tt);
763 EAPI void             elm_widget_cursor_add(Evas_Object *obj, Elm_Cursor *cur);
764 EAPI void             elm_widget_cursor_del(Evas_Object *obj, Elm_Cursor *cur);
765 EAPI void             elm_widget_drag_lock_x_set(Evas_Object *obj, Eina_Bool lock);
766 EAPI void             elm_widget_drag_lock_y_set(Evas_Object *obj, Eina_Bool lock);
767 EAPI Eina_Bool        elm_widget_drag_lock_x_get(const Evas_Object *obj);
768 EAPI Eina_Bool        elm_widget_drag_lock_y_get(const Evas_Object *obj);
769 EAPI int              elm_widget_drag_child_locked_x_get(const Evas_Object *obj);
770 EAPI int              elm_widget_drag_child_locked_y_get(const Evas_Object *obj);
771 EAPI Eina_Bool        elm_widget_theme_object_set(Evas_Object *obj, Evas_Object *edj, const char *wname, const char *welement, const char *wstyle);
772 EAPI Eina_Bool        elm_widget_type_check(const Evas_Object *obj, const char *type, const char *func);
773 EAPI Evas_Object     *elm_widget_name_find(const Evas_Object *obj, const char *name, int recurse);
774 EAPI Eina_List       *elm_widget_stringlist_get(const char *str);
775 EAPI void             elm_widget_stringlist_free(Eina_List *list);
776 EAPI void             elm_widget_focus_hide_handle(Evas_Object *obj);
777 EAPI void             elm_widget_focus_mouse_up_handle(Evas_Object *obj);
778 EAPI void             elm_widget_focus_tree_unfocusable_handle(Evas_Object *obj);
779 EAPI void             elm_widget_focus_disabled_handle(Evas_Object *obj);
780 EAPI unsigned int     elm_widget_focus_order_get(const Evas_Object *obj);
781 EAPI Evas_Object     *elm_widget_newest_focus_order_get(const Evas_Object *obj, unsigned int *newest_focus_order, Eina_Bool can_focus_only);
782 EAPI void             elm_widget_activate(Evas_Object *obj, Elm_Activate act);
783 EAPI void             elm_widget_text_part_set(Evas_Object *obj, const char *part, const char *label);
784 EAPI const char      *elm_widget_text_part_get(const Evas_Object *obj, const char *part);
785 EAPI void             elm_widget_domain_translatable_text_part_set(Evas_Object *obj, const char *part, const char *domain, const char *text);
786 EAPI const char      *elm_widget_translatable_text_part_get(const Evas_Object *obj, const char *part);
787 EAPI void             elm_widget_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content);
788 EAPI Evas_Object     *elm_widget_content_part_get(const Evas_Object *obj, const char *part);
789 EAPI Evas_Object     *elm_widget_content_part_unset(Evas_Object *obj, const char *part);
790 EAPI void             elm_widget_access_info_set(Evas_Object *obj, const char *txt);
791 EAPI const char      *elm_widget_access_info_get(const Evas_Object *obj);
792 EAPI void             elm_widget_orientation_set(Evas_Object *obj, int rotation);
793 EAPI void             elm_widget_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool disabled);
794 EAPI Eina_Bool        elm_widget_orientation_mode_disabled_get(const Evas_Object *obj);
795 EAPI Elm_Widget_Item *_elm_widget_item_new(Evas_Object *parent, size_t alloc_size);
796 EAPI void             _elm_widget_item_free(Elm_Widget_Item *item);
797 EAPI Evas_Object     *_elm_widget_item_widget_get(const Elm_Widget_Item *item);
798 EAPI void             _elm_widget_item_del(Elm_Widget_Item *item);
799 EAPI void             _elm_widget_item_pre_notify_del(Elm_Widget_Item *item);
800 EAPI void             _elm_widget_item_del_cb_set(Elm_Widget_Item *item, Evas_Smart_Cb del_cb);
801 EAPI void             _elm_widget_item_data_set(Elm_Widget_Item *item, const void *data);
802 EAPI void            *_elm_widget_item_data_get(const Elm_Widget_Item *item);
803 EAPI void             _elm_widget_item_tooltip_text_set(Elm_Widget_Item *item, const char *text);
804 EAPI void             _elm_widget_item_tooltip_translatable_text_set(Elm_Widget_Item *item, const char *text);
805 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);
806 EAPI void             _elm_widget_item_tooltip_unset(Elm_Widget_Item *item);
807 EAPI void             _elm_widget_item_tooltip_style_set(Elm_Widget_Item *item, const char *style);
808 EAPI Eina_Bool        _elm_widget_item_tooltip_window_mode_set(Elm_Widget_Item *item, Eina_Bool disable);
809 EAPI Eina_Bool        _elm_widget_item_tooltip_window_mode_get(const Elm_Widget_Item *item);
810 EAPI const char      *_elm_widget_item_tooltip_style_get(const Elm_Widget_Item *item);
811 EAPI void             _elm_widget_item_cursor_set(Elm_Widget_Item *item, const char *cursor);
812 EAPI const char      *_elm_widget_item_cursor_get(const Elm_Widget_Item *item);
813 EAPI void             _elm_widget_item_cursor_unset(Elm_Widget_Item *item);
814 EAPI void             _elm_widget_item_cursor_style_set(Elm_Widget_Item *item, const char *style);
815 EAPI const char      *_elm_widget_item_cursor_style_get(const Elm_Widget_Item *item);
816 EAPI void             _elm_widget_item_cursor_engine_only_set(Elm_Widget_Item *item, Eina_Bool engine_only);
817 EAPI Eina_Bool        _elm_widget_item_cursor_engine_only_get(const Elm_Widget_Item *item);
818 EAPI void             _elm_widget_item_part_content_set(Elm_Widget_Item *item, const char *part, Evas_Object *content);
819 EAPI Evas_Object     *_elm_widget_item_part_content_get(const Elm_Widget_Item *item, const char *part);
820 EAPI Evas_Object     *_elm_widget_item_part_content_unset(Elm_Widget_Item *item, const char *part);
821 EAPI void             _elm_widget_item_part_text_set(Elm_Widget_Item *item, const char *part, const char *label);
822 EAPI const char      *_elm_widget_item_part_text_get(const Elm_Widget_Item *item, const char *part);
823 EAPI void             _elm_widget_item_signal_emit(Elm_Widget_Item *item, const char *emission, const char *source);
824 EAPI void             _elm_widget_item_content_set_hook_set(Elm_Widget_Item *item, Elm_Widget_Content_Set_Cb func);
825 EAPI void             _elm_widget_item_content_get_hook_set(Elm_Widget_Item *item, Elm_Widget_Content_Get_Cb func);
826 EAPI void             _elm_widget_item_content_unset_hook_set(Elm_Widget_Item *item, Elm_Widget_Content_Unset_Cb func);
827 EAPI void             _elm_widget_item_text_set_hook_set(Elm_Widget_Item *item, Elm_Widget_Text_Set_Cb func);
828 EAPI void             _elm_widget_item_text_get_hook_set(Elm_Widget_Item *item, Elm_Widget_Text_Get_Cb func);
829 EAPI void             _elm_widget_item_signal_emit_hook_set(Elm_Widget_Item *it, Elm_Widget_Signal_Emit_Cb func);
830 EAPI void             _elm_widget_item_access_info_set(Elm_Widget_Item *item, const char *txt);
831 EAPI void             _elm_widget_item_disabled_set(Elm_Widget_Item *item, Eina_Bool disabled);
832 EAPI Eina_Bool        _elm_widget_item_disabled_get(const Elm_Widget_Item *item);
833 EAPI void             _elm_widget_item_disable_hook_set(Elm_Widget_Item *item, Elm_Widget_Disable_Cb func);
834 EAPI void             _elm_widget_item_del_pre_hook_set(Elm_Widget_Item *item, Elm_Widget_Del_Pre_Cb func);
835
836 /**
837  * Function to operate on a given widget's scrollabe children when necessary.
838  * @warning free the returned list with eina_list_free().
839  */
840 EAPI Eina_List       *elm_widget_scrollable_children_get(Evas_Object *obj);
841
842 /* debug function. don't use it unless you are tracking parenting issues */
843 EAPI void             elm_widget_tree_dump(const Evas_Object *top);
844 EAPI void             elm_widget_tree_dot_dump(const Evas_Object *top, FILE *output);
845
846 #define ELM_WIDGET_DATA_GET(o, sd) \
847   Elm_Widget_Smart_Data * sd = evas_object_smart_data_get(o)
848
849 #define ELM_WIDGET_DATA_GET_OR_RETURN(o, ptr)        \
850   ELM_WIDGET_DATA_GET(o, ptr);                       \
851   if (!ptr)                                          \
852     {                                                \
853        CRITICAL("no widget data for object %p (%s)", \
854                 o, evas_object_type_get(o));         \
855        return;                                       \
856     }
857
858 /**
859  * Convenience macro to create new widget item, doing casts for you.
860  * @see _elm_widget_item_new()
861  * @param parent a valid elm_widget variant.
862  * @param type the C type that extends Elm_Widget_Item
863  */
864 #define elm_widget_item_new(parent, type) \
865   (type *)_elm_widget_item_new((parent), sizeof(type))
866 /**
867  * Convenience macro to free widget item, doing casts for you.
868  * @see _elm_widget_item_free()
869  * @param item a valid item.
870  */
871 #define elm_widget_item_free(item) \
872   _elm_widget_item_free((Elm_Widget_Item *)item)
873
874 /**
875  * Convenience macro to delete widget item, doing casts for you.
876  * @see _elm_widget_item_del()
877  * @param item a valid item.
878  */
879 #define elm_widget_item_del(item) \
880   _elm_widget_item_del((Elm_Widget_Item *)item)
881 /**
882  * Convenience macro to notify deletion of widget item, doing casts for you.
883  * @see _elm_widget_item_pre_notify_del()
884  */
885 #define elm_widget_item_pre_notify_del(item) \
886   _elm_widget_item_pre_notify_del((Elm_Widget_Item *)item)
887 /**
888  * Convenience macro to set deletion callback of widget item, doing casts for you.
889  * @see _elm_widget_item_del_cb_set()
890  */
891 #define elm_widget_item_del_cb_set(item, del_cb) \
892   _elm_widget_item_del_cb_set((Elm_Widget_Item *)item, del_cb)
893
894 /**
895  * Get item's owner widget
896  * @see _elm_widget_item_widget_get()
897  */
898 #define elm_widget_item_widget_get(item) \
899   _elm_widget_item_widget_get((const Elm_Widget_Item *)item)
900
901 /**
902  * Set item's data
903  * @see _elm_widget_item_data_set()
904  */
905 #define elm_widget_item_data_set(item, data) \
906   _elm_widget_item_data_set((Elm_Widget_Item *)item, data)
907 /**
908  * Get item's data
909  * @see _elm_widget_item_data_get()
910  */
911 #define elm_widget_item_data_get(item) \
912   _elm_widget_item_data_get((const Elm_Widget_Item *)item)
913
914 /**
915  * Convenience function to set widget item tooltip as a text string.
916  * @see _elm_widget_item_tooltip_text_set()
917  */
918 #define elm_widget_item_tooltip_text_set(item, text) \
919   _elm_widget_item_tooltip_text_set((Elm_Widget_Item *)item, text)
920 /**
921  * Convenience function to set widget item tooltip as a text string.
922  * @see _elm_widget_item_tooltip_text_set()
923  */
924 #define elm_widget_item_tooltip_translatable_text_set(item, text) \
925   _elm_widget_item_tooltip_translatable_text_set((Elm_Widget_Item *)item, text)
926 /**
927  * Convenience function to set widget item tooltip.
928  * @see _elm_widget_item_tooltip_content_cb_set()
929  */
930 #define elm_widget_item_tooltip_content_cb_set(item, func, data, del_cb) \
931   _elm_widget_item_tooltip_content_cb_set((Elm_Widget_Item *)item,       \
932                                           func, data, del_cb)
933 /**
934  * Convenience function to unset widget item tooltip.
935  * @see _elm_widget_item_tooltip_unset()
936  */
937 #define elm_widget_item_tooltip_unset(item) \
938   _elm_widget_item_tooltip_unset((Elm_Widget_Item *)item)
939 /**
940  * Convenience function to change item's tooltip style.
941  * @see _elm_widget_item_tooltip_style_set()
942  */
943 #define elm_widget_item_tooltip_style_set(item, style) \
944   _elm_widget_item_tooltip_style_set((Elm_Widget_Item *)item, style)
945
946 #define elm_widget_item_tooltip_window_mode_set(item, disable) \
947   _elm_widget_item_tooltip_window_mode_set((Elm_Widget_Item *)item, disable)
948
949 #define elm_widget_item_tooltip_window_mode_get(item) \
950   _elm_widget_item_tooltip_window_mode_get((Elm_Widget_Item *)item)
951 /**
952  * Convenience function to query item's tooltip style.
953  * @see _elm_widget_item_tooltip_style_get()
954  */
955 #define elm_widget_item_tooltip_style_get(item) \
956   _elm_widget_item_tooltip_style_get((const Elm_Widget_Item *)item)
957 /**
958  * Convenience function to set widget item cursor.
959  * @see _elm_widget_item_cursor_set()
960  */
961 #define elm_widget_item_cursor_set(item, cursor) \
962   _elm_widget_item_cursor_set((Elm_Widget_Item *)item, cursor)
963 /**
964  * Convenience function to get widget item cursor.
965  * @see _elm_widget_item_cursor_get()
966  */
967 #define elm_widget_item_cursor_get(item) \
968   _elm_widget_item_cursor_get((const Elm_Widget_Item *)item)
969 /**
970  * Convenience function to unset widget item cursor.
971  * @see _elm_widget_item_cursor_unset()
972  */
973 #define elm_widget_item_cursor_unset(item) \
974   _elm_widget_item_cursor_unset((Elm_Widget_Item *)item)
975 /**
976  * Convenience function to change item's cursor style.
977  * @see _elm_widget_item_cursor_style_set()
978  */
979 #define elm_widget_item_cursor_style_set(item, style) \
980   _elm_widget_item_cursor_style_set((Elm_Widget_Item *)item, style)
981 /**
982  * Convenience function to query item's cursor style.
983  * @see _elm_widget_item_cursor_style_get()
984  */
985 #define elm_widget_item_cursor_style_get(item) \
986   _elm_widget_item_cursor_style_get((const Elm_Widget_Item *)item)
987 /**
988  * Convenience function to change item's cursor engine_only.
989  * @see _elm_widget_item_cursor_engine_only_set()
990  */
991 #define elm_widget_item_cursor_engine_only_set(item, engine_only) \
992   _elm_widget_item_cursor_engine_only_set((Elm_Widget_Item *)item, engine_only)
993 /**
994  * Convenience function to query item's cursor engine_only.
995  * @see _elm_widget_item_cursor_engine_only_get()
996  */
997 #define elm_widget_item_cursor_engine_only_get(item) \
998   _elm_widget_item_cursor_engine_only_get((const Elm_Widget_Item *)item)
999 /**
1000  * Convenience function to query item's content set hook.
1001  * @see _elm_widget_item_content_set_hook_set()
1002  */
1003 #define elm_widget_item_content_set_hook_set(item, func) \
1004   _elm_widget_item_content_set_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Content_Set_Cb)func)
1005 /**
1006  * Convenience function to query item's content get hook.
1007  * @see _elm_widget_item_content_get_hook_set()
1008  */
1009 #define elm_widget_item_content_get_hook_set(item, func) \
1010   _elm_widget_item_content_get_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Content_Get_Cb)func)
1011 /**
1012  * Convenience function to query item's content unset hook.
1013  * @see _elm_widget_item_content_unset_hook_set()
1014  */
1015 #define elm_widget_item_content_unset_hook_set(item, func) \
1016   _elm_widget_item_content_unset_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Content_Unset_Cb)func)
1017 /**
1018  * Convenience function to query item's text set hook.
1019  * @see _elm_widget_item_text_set_hook_set()
1020  */
1021 #define elm_widget_item_text_set_hook_set(item, func) \
1022   _elm_widget_item_text_set_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Text_Set_Cb)func)
1023 /**
1024  * Convenience function to query item's text get hook.
1025  * @see _elm_widget_item_text_get_hook_set()
1026  */
1027 #define elm_widget_item_text_get_hook_set(item, func) \
1028   _elm_widget_item_text_get_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Text_Get_Cb)func)
1029 /**
1030  * Convenience function to query item's signal emit hook.
1031  * @see _elm_widget_item_signal_emit_hook_set()
1032  */
1033 #define elm_widget_item_signal_emit_hook_set(item, func) \
1034   _elm_widget_item_signal_emit_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Signal_Emit_Cb)func)
1035 /**
1036  * Convenience function to query disable get hook.
1037  * @see _elm_widget_item_disabled_get()
1038  */
1039 #define elm_widget_item_disabled_get(item) \
1040   _elm_widget_item_disabled_get((Elm_Widget_Item *)item)
1041 /**
1042  * Convenience function to query disable set hook.
1043  * @see _elm_widget_item_disable_hook_set()
1044  */
1045 #define elm_widget_item_disable_hook_set(item, func) \
1046   _elm_widget_item_disable_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Disable_Cb)func)
1047 /**
1048  * Convenience function to query del pre hook.
1049  * @see _elm_widget_item_del_pre_hook_set()
1050  */
1051 #define elm_widget_item_del_pre_hook_set(item, func) \
1052   _elm_widget_item_del_pre_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Del_Pre_Cb)func)
1053
1054 #define ELM_WIDGET_CHECK_OR_RETURN(obj, ...)                    \
1055    do {                                                         \
1056         if (!obj || !evas_object_smart_data_get(obj))           \
1057           {                                                     \
1058              WRN("Object [%p] is already deleted", obj);        \
1059              return __VA_ARGS__;                                \
1060           }                                                     \
1061    } while (0)
1062
1063 #define ELM_WIDGET_CHECK_OR_GOTO(obj, label)                    \
1064    do {                                                         \
1065         if (!obj || !evas_object_smart_data_get(obj))           \
1066           {                                                     \
1067              WRN("Object [%p] is already deleted", obj);        \
1068              goto label;                                        \
1069           }                                                     \
1070    } while (0)
1071
1072 #define ELM_WIDGET_ITEM_RETURN_IF_ONDEL(item, ...)              \
1073    do {                                                         \
1074        if (item && (item)->on_deletion) {                       \
1075             CRITICAL("Elm_Widget_Item " # item " is deleting"); \
1076             return __VA_ARGS__;                                 \
1077         }                                                       \
1078            ELM_WIDGET_CHECK_OR_RETURN((item)->widget, __VA_ARGS__); \
1079    } while (0)
1080
1081
1082 #define ELM_WIDGET_ITEM_GOTO_IF_ONDEL(item, label)              \
1083    do {                                                         \
1084        if (item && (item)->on_deletion) {                       \
1085             CRITICAL("Elm_Widget_Item " # item " is deleting"); \
1086             goto label;                                         \
1087         }                                                       \
1088        ELM_WIDGET_CHECK_OR_GOTO((item)->widget, label);         \
1089    } while (0)
1090
1091 #define ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, ...)               \
1092    do {                                                          \
1093        if (!item) {                                              \
1094             CRITICAL("Elm_Widget_Item " # item " is NULL");      \
1095             return __VA_ARGS__;                                  \
1096        }                                                         \
1097        if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) {     \
1098             EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC);        \
1099             return __VA_ARGS__;                                  \
1100        }                                                         \
1101        ELM_WIDGET_CHECK_OR_RETURN((item)->widget, __VA_ARGS__);  \
1102   } while (0)
1103
1104 #define ELM_WIDGET_ITEM_CHECK_OR_GOTO(item, label)              \
1105   do {                                                          \
1106        if (!item) {                                             \
1107             CRITICAL("Elm_Widget_Item " # item " is NULL");     \
1108             goto label;                                         \
1109        }                                                        \
1110       if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) {     \
1111            EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC);        \
1112            goto label;                                          \
1113         }                                                       \
1114       ELM_WIDGET_CHECK_OR_GOTO((item)->widget, label);          \
1115   } while (0)
1116
1117 /* to be used by INTERNAL classes on Elementary, so that the widgets
1118  * parsing script skips it */
1119 #define ELM_INTERNAL_SMART_SUBCLASS_NEW EVAS_SMART_SUBCLASS_NEW
1120
1121 /**
1122  * The drag and drop API.
1123  * Currently experimental, and will change when it does dynamic type
1124  * addition RSN.
1125  *
1126  * Here so applications can start to use it, if they ask elm nicely.
1127  *
1128  * And yes, elm_widget, should probably be elm_experimental...
1129  * Complaints about this code should go to /dev/null, or failing that nash.
1130  */
1131 EAPI Eina_Bool elm_drop_target_add(Evas_Object *widget, Elm_Sel_Type, Elm_Drop_Cb, void *);
1132 EAPI Eina_Bool elm_drop_target_del(Evas_Object *widget);
1133 EAPI Eina_Bool elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data, void (*dragdone) (void *data, Evas_Object *), void *donecbdata);
1134 EAPI Eina_Bool elm_selection_selection_has_owner(Evas_Object *obj);
1135
1136 #endif