widget - should be declared in header.
[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    Evas_Object                  *focus_previous, *focus_next;
470    Evas_Object                  *focus_up, *focus_down, *focus_right, *focus_left;
471
472    /* "show region" coordinates. all widgets got those because this
473     * info may be set and queried recursively through the widget
474     * parenting tree */
475    Evas_Coord                    rx, ry, rw, rh;
476
477    /* scrolling hold/freeze hints. all widgets got those because this
478     * info may be set and queried recursively through the widget
479     * parenting tree */
480    int                           scroll_hold;
481    int                           scroll_freeze;
482
483    double                        scale;
484    Elm_Theme                    *theme;
485    const char                   *style;
486    const char                   *access_info;
487    unsigned int                  focus_order;
488    Eina_Bool                     focus_order_on_calc;
489
490    int                           child_drag_x_locked;
491    int                           child_drag_y_locked;
492
493    Eina_List                    *translate_strings;
494    Eina_List                    *focus_chain;
495    Eina_List                    *event_cb;
496
497    /* this is a hook to be set on-the-fly on widgets. this is code
498     * handling the request of showing a specific region from an inner
499     * widget (mainly issued by entries, on cursor moving) */
500    void                         *on_show_region_data;
501    void                        (*on_show_region)(void *data,
502                                                  Evas_Object *obj);
503
504    int                           frozen;
505    int                           orient_mode; /* -1 is disabled */
506
507    Eina_Bool                     drag_x_locked : 1;
508    Eina_Bool                     drag_y_locked : 1;
509
510    Eina_Bool                     can_focus : 1;
511    Eina_Bool                     child_can_focus : 1;
512    Eina_Bool                     focused : 1;
513    Eina_Bool                     top_win_focused : 1;
514    Eina_Bool                     tree_unfocusable : 1;
515    Eina_Bool                     highlight_ignore : 1;
516    Eina_Bool                     highlight_in_theme : 1;
517    Eina_Bool                     disabled : 1;
518    Eina_Bool                     is_mirrored : 1;
519    Eina_Bool                     mirrored_auto_mode : 1; /* This is
520                                                           * TRUE by
521                                                           * default */
522    Eina_Bool                     still_in : 1;
523    Eina_Bool                     can_access : 1;
524    Eina_Bool                     highlighted : 1;
525    Eina_Bool                     highlight_root : 1;
526 } Elm_Widget_Smart_Data;
527
528 /**
529  * @}
530  */
531
532 typedef struct _Elm_Tooltip     Elm_Tooltip;
533 typedef struct _Elm_Cursor      Elm_Cursor;
534
535 /**< base structure for all widget items that are not Elm_Widget themselves */
536 typedef struct _Elm_Widget_Item Elm_Widget_Item;
537 typedef struct _Elm_Widget_Item_Signal_Data Elm_Widget_Item_Signal_Data;
538
539 /**< accessibility information to be able to set and get from the access API */
540 typedef struct _Elm_Access_Info Elm_Access_Info;
541
542 /**< accessibility info item */
543 typedef struct _Elm_Access_Item Elm_Access_Item;
544
545 typedef void                  (*Elm_Widget_Text_Set_Cb)(void *data, const char *part, const char *text);
546 typedef void                  (*Elm_Widget_Content_Set_Cb)(void *data, const char *part, Evas_Object *content);
547 typedef const char           *(*Elm_Widget_Text_Get_Cb)(const void *data, const char *part);
548 typedef Evas_Object          *(*Elm_Widget_Content_Get_Cb)(const void *data, const char *part);
549 typedef Evas_Object          *(*Elm_Widget_Content_Unset_Cb)(const void *data, const char *part);
550 typedef void                  (*Elm_Widget_Signal_Emit_Cb)(void *data, const char *emission, const char *source);
551 typedef void                  (*Elm_Widget_Disable_Cb)(void *data);
552 typedef Eina_Bool             (*Elm_Widget_Del_Pre_Cb)(void *data);
553 typedef void                  (*Elm_Widget_Item_Signal_Cb)(void *data, Elm_Widget_Item *item, const char *emission, const char *source);
554
555 #define ELM_ACCESS_DONE          -1   /* sentence done - send done event here */
556 #define ELM_ACCESS_CANCEL        -2   /* stop reading immediately */
557
558 typedef void (*Elm_Access_On_Highlight_Cb)(void *data);
559
560 struct _Elm_Access_Item
561 {
562    int                   type;
563    const void           *data;
564    Elm_Access_Info_Cb    func;
565 };
566
567 struct _Elm_Access_Info
568 {
569    Evas_Object               *hoverobj;
570    Eina_List                 *items;
571    Ecore_Timer               *delay_timer;
572    void                      *on_highlight_data;
573    Elm_Access_On_Highlight_Cb on_highlight;
574
575    void                      *activate_data;
576    Elm_Access_Activate_Cb    activate;
577
578    /* the owner widget item that owns this access info */
579    Elm_Widget_Item           *widget_item;
580
581    /* the owner part object that owns this access info */
582    Evas_Object               *part_object;
583 };
584
585 void                  _elm_access_shutdown();
586 void                  _elm_access_mouse_event_enabled_set(Eina_Bool enabled);
587 /* elm_widget_focus_list_next_get();, elm_widget_focus_next_get();
588    and elm_widget_focus_cycle(); use _elm_access_read_mode to use
589    focus chain */
590 void                  _elm_access_read_mode_set(Eina_Bool enabled);
591 Eina_Bool             _elm_access_read_mode_get();
592 void                  _elm_access_widget_item_access_order_set(Elm_Widget_Item *item, Eina_List *objs);
593 const Eina_List      *_elm_access_widget_item_access_order_get(const Elm_Widget_Item *item);
594 void                  _elm_access_widget_item_access_order_unset(Elm_Widget_Item *item);
595
596 EAPI void             _elm_access_clear(Elm_Access_Info *ac);
597 EAPI void             _elm_access_text_set(Elm_Access_Info *ac, int type, const char *text);
598 EAPI void             _elm_access_callback_set(Elm_Access_Info *ac, int type, Elm_Access_Info_Cb func, const void *data);
599 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! */
600 EAPI void             _elm_access_read(Elm_Access_Info *ac, int type, const Evas_Object *obj);
601 EAPI void             _elm_access_say(const char *txt);
602 EAPI Elm_Access_Info *_elm_access_object_get(const Evas_Object *obj);
603 EAPI void             _elm_access_object_hilight(Evas_Object *obj);
604 EAPI void             _elm_access_object_unhilight(Evas_Object *obj);
605 EAPI void             _elm_access_object_hilight_disable(Evas *e);
606 EAPI void             _elm_access_object_register(Evas_Object *obj, Evas_Object *hoverobj);
607 EAPI void             _elm_access_object_unregister(Evas_Object *obj, Evas_Object *hoverobj);
608 EAPI Eina_Bool        _elm_access_2nd_click_timeout(Evas_Object *obj);
609 EAPI void             _elm_access_highlight_set(Evas_Object* obj);
610 EAPI Evas_Object *    _elm_access_edje_object_part_object_register(Evas_Object *obj, const Evas_Object *partobj, const char* part);
611 EAPI void             _elm_access_edje_object_part_object_unregister(Evas_Object* obj, const Evas_Object *eobj, const char* part);
612 EAPI void             _elm_access_widget_item_register(Elm_Widget_Item *item);
613 EAPI void             _elm_access_widget_item_unregister(Elm_Widget_Item *item);
614 EAPI void             _elm_access_on_highlight_hook_set(Elm_Access_Info *ac, Elm_Access_On_Highlight_Cb func, void *data);
615 EAPI void             _elm_access_activate_callback_set(Elm_Access_Info *ac, Elm_Access_Activate_Cb func, void *data);
616 EAPI void             _elm_access_highlight_object_activate(Evas_Object *obj, Elm_Activate act);
617 EAPI void             _elm_access_highlight_cycle(Evas_Object *obj, Elm_Focus_Direction dir);
618
619 /**< put this as the first member in your widget item struct */
620 #define ELM_WIDGET_ITEM       Elm_Widget_Item base
621
622 struct _Elm_Widget_Item_Signal_Data
623 {
624    Elm_Widget_Item *item;
625    Elm_Widget_Item_Signal_Cb func;
626    const char *emission;
627    const char *source;
628    void *data;
629 };
630
631 struct _Elm_Widget_Item
632 {
633 /* ef1 ~~ efl, el3 ~~ elm */
634 #define ELM_WIDGET_ITEM_MAGIC 0xef1e1301
635    EINA_MAGIC;
636 /* simple accessor macros */
637 #define VIEW(X)   X->base.view
638 #define WIDGET(X) X->base.widget
639    /**< the owner widget that owns this item */
640    Evas_Object                   *widget;
641    /**< the base view object */
642    Evas_Object                   *view;
643    /**< item specific data. used for del callback */
644    const void                    *data;
645    /**< user delete callback function */
646    Evas_Smart_Cb                  del_func;
647    /**< widget delete callback function. don't expose this callback call */
648    Elm_Widget_Del_Pre_Cb          del_pre_func;
649
650    Elm_Widget_Content_Set_Cb      content_set_func;
651    Elm_Widget_Content_Get_Cb      content_get_func;
652    Elm_Widget_Content_Unset_Cb    content_unset_func;
653    Elm_Widget_Text_Set_Cb         text_set_func;
654    Elm_Widget_Text_Get_Cb         text_get_func;
655    Elm_Widget_Signal_Emit_Cb      signal_emit_func;
656    Elm_Widget_Disable_Cb          disable_func;
657    Evas_Object                   *access_obj;
658    const char                    *access_info;
659    Eina_List                     *access_order;
660    Eina_List                     *translate_strings;
661    Eina_List                     *signals;
662
663    Eina_Bool                      disabled : 1;
664    Eina_Bool                      on_deletion : 1;
665 };
666
667 struct _Elm_Object_Item
668 {
669    ELM_WIDGET_ITEM;
670 };
671
672 #define ELM_NEW(t) calloc(1, sizeof(t))
673
674 EAPI Evas_Object     *elm_widget_add(Evas_Smart *, Evas_Object *);
675 EAPI void             elm_widget_parent_set(Evas_Object *, Evas_Object *);
676 EAPI Eina_Bool        elm_widget_api_check(int ver);
677 EAPI Eina_Bool        elm_widget_access(Evas_Object *obj, Eina_Bool is_access);
678 EAPI Eina_Bool        elm_widget_theme(Evas_Object *obj);
679 EAPI void             elm_widget_theme_specific(Evas_Object *obj, Elm_Theme *th, Eina_Bool force);
680 EAPI void             elm_widget_translate(Evas_Object *obj);
681 EAPI void             elm_widget_on_show_region_hook_set(Evas_Object *obj, void (*func)(void *data, Evas_Object *obj), void *data);
682 EAPI Eina_Bool        elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj);
683 EAPI Eina_Bool        elm_widget_sub_object_del(Evas_Object *obj, Evas_Object *sobj);
684
685 //SHKWAK : This is temp for Indicator Issue
686 //THIS MUST BE REMOVED
687
688 EAPI const Eina_List *elm_widget_sub_object_list_get(const Evas_Object *obj);
689
690 //SHKWAK : END
691
692 EAPI void             elm_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj);
693 EAPI void             elm_widget_hover_object_set(Evas_Object *obj, Evas_Object *sobj);
694 EAPI void             elm_widget_signal_emit(Evas_Object *obj, const char *emission, const char *source);
695 EAPI void             elm_widget_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
696 EAPI void            *elm_widget_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func);
697 EAPI void             elm_widget_can_focus_set(Evas_Object *obj, Eina_Bool can_focus);
698 EAPI Eina_Bool        elm_widget_can_focus_get(const Evas_Object *obj);
699 EAPI Eina_Bool        elm_widget_child_can_focus_get(const Evas_Object *obj);
700 EAPI Eina_List       *elm_widget_can_focus_child_list_get(const Evas_Object *obj);
701 EAPI void             elm_widget_tree_unfocusable_set(Evas_Object *obj, Eina_Bool tree_unfocusable);
702 EAPI Eina_Bool        elm_widget_tree_unfocusable_get(const Evas_Object *obj);
703 EAPI void             elm_widget_highlight_ignore_set(Evas_Object *obj, Eina_Bool ignore);
704 EAPI Eina_Bool        elm_widget_highlight_ignore_get(const Evas_Object *obj);
705 EAPI void             elm_widget_highlight_in_theme_set(Evas_Object *obj, Eina_Bool highlight);
706 EAPI Eina_Bool        elm_widget_highlight_in_theme_get(const Evas_Object *obj);
707 EAPI Eina_Bool        elm_widget_focus_get(const Evas_Object *obj);
708 EAPI Evas_Object     *elm_widget_focused_object_get(const Evas_Object *obj);
709 EAPI Evas_Object     *elm_widget_top_get(const Evas_Object *obj);
710 EAPI Eina_Bool        elm_widget_is(const Evas_Object *obj);
711 EAPI Evas_Object     *elm_widget_parent_widget_get(const Evas_Object *obj);
712 EAPI void             elm_widget_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, const void *data);
713 EAPI void            *elm_widget_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data);
714 EAPI Eina_Bool        elm_widget_event_propagate(Evas_Object *obj, Evas_Callback_Type type, void *event_info, Evas_Event_Flags *event_flags);
715 EAPI void             elm_widget_focus_custom_chain_set(Evas_Object *obj, Eina_List *objs);
716 EAPI void             elm_widget_focus_custom_chain_unset(Evas_Object *obj);
717 EAPI const Eina_List *elm_widget_focus_custom_chain_get(const Evas_Object *obj);
718 EAPI void             elm_widget_focus_custom_chain_append(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
719 EAPI void             elm_widget_focus_custom_chain_prepend(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
720 EAPI void             elm_widget_focus_cycle(Evas_Object *obj, Elm_Focus_Direction dir);
721 EAPI Eina_Bool        elm_widget_focus_direction_go(Evas_Object *obj, double degree);
722 EAPI Eina_Bool        elm_widget_focus_direction_get(const Evas_Object *obj, const Evas_Object *base, double degree, Evas_Object **direction, double *weight);
723 EAPI Eina_Bool        elm_widget_focus_next_get(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next);
724 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);
725 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);
726 EAPI Evas_Object     *elm_widget_focus_next_object_get(const Evas_Object *obj, Elm_Focus_Direction dir);
727 EAPI void             elm_widget_focus_next_object_set(Evas_Object *obj, Evas_Object *next, Elm_Focus_Direction dir);
728 EAPI void             elm_widget_focus_set(Evas_Object *obj, int first);
729 EAPI void             elm_widget_focused_object_clear(Evas_Object *obj);
730 EAPI Evas_Object     *elm_widget_parent_get(const Evas_Object *obj);
731 EAPI Evas_Object     *elm_widget_parent2_get(const Evas_Object *obj);
732 EAPI void             elm_widget_parent2_set(Evas_Object *obj, Evas_Object *parent);
733 EAPI void             elm_widget_focus_steal(Evas_Object *obj);
734 EAPI Evas_Display_Mode elm_widget_display_mode_get(const Evas_Object *obj);
735 EAPI void             elm_widget_display_mode_set(Evas_Object *obj, Evas_Display_Mode dispmode);
736 EAPI const Elm_Widget_Smart_Class *elm_widget_smart_class_get(void);
737
738 EAPI Eina_Bool        elm_widget_highlight_get(const Evas_Object *obj);
739 EAPI void             elm_widget_parent_highlight_set(Evas_Object *obj, Eina_Bool highlighted);
740 /**
741  * @internal
742  *
743  * Restore the focus state of the sub-tree.
744  *
745  * This API will restore the focus state of the sub-tree to the latest
746  * state. If a sub-tree is unfocused and wants to get back to the latest
747  * focus state, this API will be helpful.
748  *
749  * @param obj The widget root of sub-tree
750  *
751  * @ingroup Widget
752  */
753 EAPI void             elm_widget_focus_restore(Evas_Object *obj);
754
755 EAPI void             elm_widget_disabled_set(Evas_Object *obj, Eina_Bool disabled);
756 EAPI Eina_Bool        elm_widget_disabled_get(const Evas_Object *obj);
757 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);
758 EAPI void             elm_widget_show_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
759 EAPI Eina_Bool        elm_widget_focus_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
760 EAPI void             elm_widget_scroll_hold_push(Evas_Object *obj);
761 EAPI void             elm_widget_scroll_hold_pop(Evas_Object *obj);
762 EAPI int              elm_widget_scroll_hold_get(const Evas_Object *obj);
763 EAPI void             elm_widget_scroll_freeze_push(Evas_Object *obj);
764 EAPI void             elm_widget_scroll_freeze_pop(Evas_Object *obj);
765 EAPI int              elm_widget_scroll_freeze_get(const Evas_Object *obj);
766 EAPI void             elm_widget_scale_set(Evas_Object *obj, double scale);
767 EAPI double           elm_widget_scale_get(const Evas_Object *obj);
768 EAPI Eina_Bool        elm_widget_mirrored_get(const Evas_Object *obj);
769 EAPI void             elm_widget_mirrored_set(Evas_Object *obj, Eina_Bool mirrored);
770 EAPI Eina_Bool        elm_widget_mirrored_automatic_get(const Evas_Object *obj);
771 EAPI void             elm_widget_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic);
772 EAPI void             elm_widget_theme_set(Evas_Object *obj, Elm_Theme *th);
773 EAPI Elm_Theme       *elm_widget_theme_get(const Evas_Object *obj);
774 EAPI Eina_Bool        elm_widget_style_set(Evas_Object *obj, const char *style);
775 EAPI const char      *elm_widget_style_get(const Evas_Object *obj);
776 EAPI void             elm_widget_type_set(Evas_Object *obj, const char *type);
777 EAPI const char      *elm_widget_type_get(const Evas_Object *obj);
778 EAPI void             elm_widget_tooltip_add(Evas_Object *obj, Elm_Tooltip *tt);
779 EAPI void             elm_widget_tooltip_del(Evas_Object *obj, Elm_Tooltip *tt);
780 EAPI void             elm_widget_cursor_add(Evas_Object *obj, Elm_Cursor *cur);
781 EAPI void             elm_widget_cursor_del(Evas_Object *obj, Elm_Cursor *cur);
782 EAPI void             elm_widget_drag_lock_x_set(Evas_Object *obj, Eina_Bool lock);
783 EAPI void             elm_widget_drag_lock_y_set(Evas_Object *obj, Eina_Bool lock);
784 EAPI Eina_Bool        elm_widget_drag_lock_x_get(const Evas_Object *obj);
785 EAPI Eina_Bool        elm_widget_drag_lock_y_get(const Evas_Object *obj);
786 EAPI int              elm_widget_drag_child_locked_x_get(const Evas_Object *obj);
787 EAPI int              elm_widget_drag_child_locked_y_get(const Evas_Object *obj);
788 EAPI Eina_Bool        elm_widget_theme_object_set(Evas_Object *obj, Evas_Object *edj, const char *wname, const char *welement, const char *wstyle);
789 EAPI Eina_Bool        elm_widget_type_check(const Evas_Object *obj, const char *type, const char *func);
790 EAPI Evas_Object     *elm_widget_name_find(const Evas_Object *obj, const char *name, int recurse);
791 EAPI Eina_List       *elm_widget_stringlist_get(const char *str);
792 EAPI void             elm_widget_stringlist_free(Eina_List *list);
793 EAPI void             elm_widget_focus_hide_handle(Evas_Object *obj);
794 EAPI void             elm_widget_focus_mouse_up_handle(Evas_Object *obj);
795 EAPI void             elm_widget_focus_tree_unfocusable_handle(Evas_Object *obj);
796 EAPI void             elm_widget_focus_disabled_handle(Evas_Object *obj);
797 EAPI unsigned int     elm_widget_focus_order_get(const Evas_Object *obj);
798 EAPI Evas_Object     *elm_widget_newest_focus_order_get(const Evas_Object *obj, unsigned int *newest_focus_order, Eina_Bool can_focus_only);
799 EAPI void             elm_widget_activate(Evas_Object *obj, Elm_Activate act);
800 EAPI void             elm_widget_text_part_set(Evas_Object *obj, const char *part, const char *label);
801 EAPI const char      *elm_widget_text_part_get(const Evas_Object *obj, const char *part);
802 EAPI void             elm_widget_domain_translatable_part_text_set(Evas_Object *obj, const char *part, const char *domain, const char *text);
803 EAPI const char      *elm_widget_translatable_part_text_get(const Evas_Object *obj, const char *part);
804 EAPI void             elm_widget_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content);
805 EAPI Evas_Object     *elm_widget_content_part_get(const Evas_Object *obj, const char *part);
806 EAPI Evas_Object     *elm_widget_content_part_unset(Evas_Object *obj, const char *part);
807 EAPI void             elm_widget_access_info_set(Evas_Object *obj, const char *txt);
808 EAPI const char      *elm_widget_access_info_get(const Evas_Object *obj);
809 EAPI void             elm_widget_orientation_set(Evas_Object *obj, int rotation);
810 EAPI void             elm_widget_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool disabled);
811 EAPI Eina_Bool        elm_widget_orientation_mode_disabled_get(const Evas_Object *obj);
812 // TIZEN ONLY: temporary code. should be removed after eo is applied.
813 EAPI void             _elm_widget_orient_signal_emit(Evas_Object *obj);
814
815 EAPI Elm_Widget_Item *_elm_widget_item_new(Evas_Object *parent, size_t alloc_size);
816 EAPI void             _elm_widget_item_free(Elm_Widget_Item *item);
817 EAPI Evas_Object     *_elm_widget_item_widget_get(const Elm_Widget_Item *item);
818 EAPI void             _elm_widget_item_del(Elm_Widget_Item *item);
819 EAPI void             _elm_widget_item_pre_notify_del(Elm_Widget_Item *item);
820 EAPI void             _elm_widget_item_del_cb_set(Elm_Widget_Item *item, Evas_Smart_Cb del_cb);
821 EAPI void             _elm_widget_item_data_set(Elm_Widget_Item *item, const void *data);
822 EAPI void            *_elm_widget_item_data_get(const Elm_Widget_Item *item);
823 EAPI void             _elm_widget_item_tooltip_text_set(Elm_Widget_Item *item, const char *text);
824 EAPI void             _elm_widget_item_tooltip_translatable_text_set(Elm_Widget_Item *item, const char *text);
825 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);
826 EAPI void             _elm_widget_item_tooltip_unset(Elm_Widget_Item *item);
827 EAPI void             _elm_widget_item_tooltip_style_set(Elm_Widget_Item *item, const char *style);
828 EAPI Eina_Bool        _elm_widget_item_tooltip_window_mode_set(Elm_Widget_Item *item, Eina_Bool disable);
829 EAPI Eina_Bool        _elm_widget_item_tooltip_window_mode_get(const Elm_Widget_Item *item);
830 EAPI const char      *_elm_widget_item_tooltip_style_get(const Elm_Widget_Item *item);
831 EAPI void             _elm_widget_item_cursor_set(Elm_Widget_Item *item, const char *cursor);
832 EAPI const char      *_elm_widget_item_cursor_get(const Elm_Widget_Item *item);
833 EAPI void             _elm_widget_item_cursor_unset(Elm_Widget_Item *item);
834 EAPI void             _elm_widget_item_cursor_style_set(Elm_Widget_Item *item, const char *style);
835 EAPI const char      *_elm_widget_item_cursor_style_get(const Elm_Widget_Item *item);
836 EAPI void             _elm_widget_item_cursor_engine_only_set(Elm_Widget_Item *item, Eina_Bool engine_only);
837 EAPI Eina_Bool        _elm_widget_item_cursor_engine_only_get(const Elm_Widget_Item *item);
838 EAPI void             _elm_widget_item_part_content_set(Elm_Widget_Item *item, const char *part, Evas_Object *content);
839 EAPI Evas_Object     *_elm_widget_item_part_content_get(const Elm_Widget_Item *item, const char *part);
840 EAPI Evas_Object     *_elm_widget_item_part_content_unset(Elm_Widget_Item *item, const char *part);
841 EAPI void             _elm_widget_item_part_text_set(Elm_Widget_Item *item, const char *part, const char *label);
842 EAPI const char      *_elm_widget_item_part_text_get(const Elm_Widget_Item *item, const char *part);
843
844 EAPI void             _elm_widget_item_signal_callback_add(Elm_Widget_Item *item, const char *emission, const char *source, Elm_Widget_Item_Signal_Cb func, void *data);
845 EAPI void            *_elm_widget_item_signal_callback_del(Elm_Widget_Item *it, const char *emission, const char *source, Elm_Widget_Item_Signal_Cb func);
846 EAPI void             _elm_widget_item_signal_emit(Elm_Widget_Item *item, const char *emission, const char *source);
847 EAPI void             _elm_widget_item_content_set_hook_set(Elm_Widget_Item *item, Elm_Widget_Content_Set_Cb func);
848 EAPI void             _elm_widget_item_content_get_hook_set(Elm_Widget_Item *item, Elm_Widget_Content_Get_Cb func);
849 EAPI void             _elm_widget_item_content_unset_hook_set(Elm_Widget_Item *item, Elm_Widget_Content_Unset_Cb func);
850 EAPI void             _elm_widget_item_text_set_hook_set(Elm_Widget_Item *item, Elm_Widget_Text_Set_Cb func);
851 EAPI void             _elm_widget_item_text_get_hook_set(Elm_Widget_Item *item, Elm_Widget_Text_Get_Cb func);
852 EAPI void             _elm_widget_item_signal_emit_hook_set(Elm_Widget_Item *it, Elm_Widget_Signal_Emit_Cb func);
853 EAPI void             _elm_widget_item_access_info_set(Elm_Widget_Item *item, const char *txt);
854 EAPI void             _elm_widget_item_disabled_set(Elm_Widget_Item *item, Eina_Bool disabled);
855 EAPI Eina_Bool        _elm_widget_item_disabled_get(const Elm_Widget_Item *item);
856 EAPI void             _elm_widget_item_disable_hook_set(Elm_Widget_Item *item, Elm_Widget_Disable_Cb func);
857 EAPI void             _elm_widget_item_del_pre_hook_set(Elm_Widget_Item *item, Elm_Widget_Del_Pre_Cb func);
858 EAPI void             _elm_widget_item_domain_translatable_part_text_set(Elm_Widget_Item *item, const char *part, const char *domain, const char *label);
859 EAPI const char *     _elm_widget_item_translatable_part_text_get(const Elm_Widget_Item *item, const char *part);
860 EAPI void             _elm_widget_item_translate(Elm_Widget_Item *item);
861
862 /**
863  * Function to operate on a given widget's scrollabe children when necessary.
864  * @warning free the returned list with eina_list_free().
865  */
866 EAPI Eina_List       *elm_widget_scrollable_children_get(Evas_Object *obj);
867
868 /* debug function. don't use it unless you are tracking parenting issues */
869 EAPI void             elm_widget_tree_dump(const Evas_Object *top);
870 EAPI void             elm_widget_tree_dot_dump(const Evas_Object *top, FILE *output);
871
872 #define ELM_WIDGET_DATA_GET(o, sd) \
873   Elm_Widget_Smart_Data * sd = evas_object_smart_data_get(o)
874
875 #define ELM_WIDGET_DATA_GET_OR_RETURN(o, ptr)        \
876   ELM_WIDGET_DATA_GET(o, ptr);                       \
877   if (!ptr)                                          \
878     {                                                \
879        CRITICAL("no widget data for object %p (%s)", \
880                 o, evas_object_type_get(o));         \
881        return;                                       \
882     }
883
884 /**
885  * Convenience macro to create new widget item, doing casts for you.
886  * @see _elm_widget_item_new()
887  * @param parent a valid elm_widget variant.
888  * @param type the C type that extends Elm_Widget_Item
889  */
890 #define elm_widget_item_new(parent, type) \
891   (type *)_elm_widget_item_new((parent), sizeof(type))
892 /**
893  * Convenience macro to free widget item, doing casts for you.
894  * @see _elm_widget_item_free()
895  * @param item a valid item.
896  */
897 #define elm_widget_item_free(item) \
898   _elm_widget_item_free((Elm_Widget_Item *)item)
899
900 /**
901  * Convenience macro to delete widget item, doing casts for you.
902  * @see _elm_widget_item_del()
903  * @param item a valid item.
904  */
905 #define elm_widget_item_del(item) \
906   _elm_widget_item_del((Elm_Widget_Item *)item)
907 /**
908  * Convenience macro to notify deletion of widget item, doing casts for you.
909  * @see _elm_widget_item_pre_notify_del()
910  */
911 #define elm_widget_item_pre_notify_del(item) \
912   _elm_widget_item_pre_notify_del((Elm_Widget_Item *)item)
913 /**
914  * Convenience macro to set deletion callback of widget item, doing casts for you.
915  * @see _elm_widget_item_del_cb_set()
916  */
917 #define elm_widget_item_del_cb_set(item, del_cb) \
918   _elm_widget_item_del_cb_set((Elm_Widget_Item *)item, del_cb)
919
920 /**
921  * Get item's owner widget
922  * @see _elm_widget_item_widget_get()
923  */
924 #define elm_widget_item_widget_get(item) \
925   _elm_widget_item_widget_get((const Elm_Widget_Item *)item)
926
927 /**
928  * Set item's data
929  * @see _elm_widget_item_data_set()
930  */
931 #define elm_widget_item_data_set(item, data) \
932   _elm_widget_item_data_set((Elm_Widget_Item *)item, data)
933 /**
934  * Get item's data
935  * @see _elm_widget_item_data_get()
936  */
937 #define elm_widget_item_data_get(item) \
938   _elm_widget_item_data_get((const Elm_Widget_Item *)item)
939
940 /**
941  * Convenience function to set widget item tooltip as a text string.
942  * @see _elm_widget_item_tooltip_text_set()
943  */
944 #define elm_widget_item_tooltip_text_set(item, text) \
945   _elm_widget_item_tooltip_text_set((Elm_Widget_Item *)item, text)
946 /**
947  * Convenience function to set widget item tooltip as a text string.
948  * @see _elm_widget_item_tooltip_text_set()
949  */
950 #define elm_widget_item_tooltip_translatable_text_set(item, text) \
951   _elm_widget_item_tooltip_translatable_text_set((Elm_Widget_Item *)item, text)
952 /**
953  * Convenience function to set widget item tooltip.
954  * @see _elm_widget_item_tooltip_content_cb_set()
955  */
956 #define elm_widget_item_tooltip_content_cb_set(item, func, data, del_cb) \
957   _elm_widget_item_tooltip_content_cb_set((Elm_Widget_Item *)item,       \
958                                           func, data, del_cb)
959 /**
960  * Convenience function to unset widget item tooltip.
961  * @see _elm_widget_item_tooltip_unset()
962  */
963 #define elm_widget_item_tooltip_unset(item) \
964   _elm_widget_item_tooltip_unset((Elm_Widget_Item *)item)
965 /**
966  * Convenience function to change item's tooltip style.
967  * @see _elm_widget_item_tooltip_style_set()
968  */
969 #define elm_widget_item_tooltip_style_set(item, style) \
970   _elm_widget_item_tooltip_style_set((Elm_Widget_Item *)item, style)
971
972 #define elm_widget_item_tooltip_window_mode_set(item, disable) \
973   _elm_widget_item_tooltip_window_mode_set((Elm_Widget_Item *)item, disable)
974
975 #define elm_widget_item_tooltip_window_mode_get(item) \
976   _elm_widget_item_tooltip_window_mode_get((Elm_Widget_Item *)item)
977 /**
978  * Convenience function to query item's tooltip style.
979  * @see _elm_widget_item_tooltip_style_get()
980  */
981 #define elm_widget_item_tooltip_style_get(item) \
982   _elm_widget_item_tooltip_style_get((const Elm_Widget_Item *)item)
983 /**
984  * Convenience function to set widget item cursor.
985  * @see _elm_widget_item_cursor_set()
986  */
987 #define elm_widget_item_cursor_set(item, cursor) \
988   _elm_widget_item_cursor_set((Elm_Widget_Item *)item, cursor)
989 /**
990  * Convenience function to get widget item cursor.
991  * @see _elm_widget_item_cursor_get()
992  */
993 #define elm_widget_item_cursor_get(item) \
994   _elm_widget_item_cursor_get((const Elm_Widget_Item *)item)
995 /**
996  * Convenience function to unset widget item cursor.
997  * @see _elm_widget_item_cursor_unset()
998  */
999 #define elm_widget_item_cursor_unset(item) \
1000   _elm_widget_item_cursor_unset((Elm_Widget_Item *)item)
1001 /**
1002  * Convenience function to change item's cursor style.
1003  * @see _elm_widget_item_cursor_style_set()
1004  */
1005 #define elm_widget_item_cursor_style_set(item, style) \
1006   _elm_widget_item_cursor_style_set((Elm_Widget_Item *)item, style)
1007 /**
1008  * Convenience function to query item's cursor style.
1009  * @see _elm_widget_item_cursor_style_get()
1010  */
1011 #define elm_widget_item_cursor_style_get(item) \
1012   _elm_widget_item_cursor_style_get((const Elm_Widget_Item *)item)
1013 /**
1014  * Convenience function to change item's cursor engine_only.
1015  * @see _elm_widget_item_cursor_engine_only_set()
1016  */
1017 #define elm_widget_item_cursor_engine_only_set(item, engine_only) \
1018   _elm_widget_item_cursor_engine_only_set((Elm_Widget_Item *)item, engine_only)
1019 /**
1020  * Convenience function to query item's cursor engine_only.
1021  * @see _elm_widget_item_cursor_engine_only_get()
1022  */
1023 #define elm_widget_item_cursor_engine_only_get(item) \
1024   _elm_widget_item_cursor_engine_only_get((const Elm_Widget_Item *)item)
1025 /**
1026  * Convenience function to query item's content set hook.
1027  * @see _elm_widget_item_content_set_hook_set()
1028  */
1029 #define elm_widget_item_content_set_hook_set(item, func) \
1030   _elm_widget_item_content_set_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Content_Set_Cb)func)
1031 /**
1032  * Convenience function to query item's content get hook.
1033  * @see _elm_widget_item_content_get_hook_set()
1034  */
1035 #define elm_widget_item_content_get_hook_set(item, func) \
1036   _elm_widget_item_content_get_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Content_Get_Cb)func)
1037 /**
1038  * Convenience function to query item's content unset hook.
1039  * @see _elm_widget_item_content_unset_hook_set()
1040  */
1041 #define elm_widget_item_content_unset_hook_set(item, func) \
1042   _elm_widget_item_content_unset_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Content_Unset_Cb)func)
1043 /**
1044  * Convenience function to query item's text set hook.
1045  * @see _elm_widget_item_text_set_hook_set()
1046  */
1047 #define elm_widget_item_text_set_hook_set(item, func) \
1048   _elm_widget_item_text_set_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Text_Set_Cb)func)
1049 /**
1050  * Convenience function to query item's text get hook.
1051  * @see _elm_widget_item_text_get_hook_set()
1052  */
1053 #define elm_widget_item_text_get_hook_set(item, func) \
1054   _elm_widget_item_text_get_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Text_Get_Cb)func)
1055 /**
1056  * Convenience function to query item's signal emit hook.
1057  * @see _elm_widget_item_signal_emit_hook_set()
1058  */
1059 #define elm_widget_item_signal_emit_hook_set(item, func) \
1060   _elm_widget_item_signal_emit_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Signal_Emit_Cb)func)
1061 /**
1062  * Convenience function to query disable get hook.
1063  * @see _elm_widget_item_disabled_get()
1064  */
1065 #define elm_widget_item_disabled_get(item) \
1066   _elm_widget_item_disabled_get((Elm_Widget_Item *)item)
1067 /**
1068  * Convenience function to query disable set hook.
1069  * @see _elm_widget_item_disable_hook_set()
1070  */
1071 #define elm_widget_item_disable_hook_set(item, func) \
1072   _elm_widget_item_disable_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Disable_Cb)func)
1073 /**
1074  * Convenience function to query del pre hook.
1075  * @see _elm_widget_item_del_pre_hook_set()
1076  */
1077 #define elm_widget_item_del_pre_hook_set(item, func) \
1078   _elm_widget_item_del_pre_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Del_Pre_Cb)func)
1079
1080 #define ELM_WIDGET_CHECK_OR_RETURN(obj, ...)                    \
1081    do {                                                         \
1082         if (!obj || !evas_object_smart_data_get(obj))           \
1083           {                                                     \
1084              WRN("Object [%p] is already deleted", obj);        \
1085              return __VA_ARGS__;                                \
1086           }                                                     \
1087    } while (0)
1088
1089 #define ELM_WIDGET_CHECK_OR_GOTO(obj, label)                    \
1090    do {                                                         \
1091         if (!obj || !evas_object_smart_data_get(obj))           \
1092           {                                                     \
1093              WRN("Object [%p] is already deleted", obj);        \
1094              goto label;                                        \
1095           }                                                     \
1096    } while (0)
1097
1098 #define ELM_WIDGET_ITEM_RETURN_IF_ONDEL(item, ...)              \
1099    do {                                                         \
1100        if (item && (item)->on_deletion) {                       \
1101             CRITICAL("Elm_Widget_Item " # item " is deleting"); \
1102             return __VA_ARGS__;                                 \
1103         }                                                       \
1104            ELM_WIDGET_CHECK_OR_RETURN((item)->widget, __VA_ARGS__); \
1105    } while (0)
1106
1107
1108 #define ELM_WIDGET_ITEM_GOTO_IF_ONDEL(item, label)              \
1109    do {                                                         \
1110        if (item && (item)->on_deletion) {                       \
1111             CRITICAL("Elm_Widget_Item " # item " is deleting"); \
1112             goto label;                                         \
1113         }                                                       \
1114        ELM_WIDGET_CHECK_OR_GOTO((item)->widget, label);         \
1115    } while (0)
1116
1117 #define ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, ...)               \
1118    do {                                                          \
1119        if (!item) {                                              \
1120             CRITICAL("Elm_Widget_Item " # item " is NULL");      \
1121             return __VA_ARGS__;                                  \
1122        }                                                         \
1123        if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) {     \
1124             EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC);        \
1125             return __VA_ARGS__;                                  \
1126        }                                                         \
1127        ELM_WIDGET_CHECK_OR_RETURN((item)->widget, __VA_ARGS__);  \
1128   } while (0)
1129
1130 #define ELM_WIDGET_ITEM_CHECK_OR_GOTO(item, label)              \
1131   do {                                                          \
1132        if (!item) {                                             \
1133             CRITICAL("Elm_Widget_Item " # item " is NULL");     \
1134             goto label;                                         \
1135        }                                                        \
1136       if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) {     \
1137            EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC);        \
1138            goto label;                                          \
1139         }                                                       \
1140       ELM_WIDGET_CHECK_OR_GOTO((item)->widget, label);          \
1141   } while (0)
1142
1143 /* to be used by INTERNAL classes on Elementary, so that the widgets
1144  * parsing script skips it */
1145 #define ELM_INTERNAL_SMART_SUBCLASS_NEW EVAS_SMART_SUBCLASS_NEW
1146
1147 /**
1148  * The drag and drop API.
1149  * Currently experimental, and will change when it does dynamic type
1150  * addition RSN.
1151  *
1152  * Here so applications can start to use it, if they ask elm nicely.
1153  *
1154  * And yes, elm_widget, should probably be elm_experimental...
1155  * Complaints about this code should go to /dev/null, or failing that nash.
1156  */
1157 EAPI Eina_Bool elm_drop_target_add(Evas_Object *widget, Elm_Sel_Type, Elm_Drop_Cb, void *);
1158 EAPI Eina_Bool elm_drop_target_del(Evas_Object *widget);
1159 EAPI Eina_Bool elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data, void (*dragdone) (void *data, Evas_Object *), void *donecbdata);
1160 EAPI Eina_Bool elm_selection_selection_has_owner(Evas_Object *obj);
1161
1162 #endif