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