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
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).
13 * #include <Elementary.h>
14 * #include "elm_priv.h"
16 * static const char ELM_WNAME_SMART_NAME[] = "elm_wname";
18 * #define ELM_WNAME_DATA_GET(o, sd) \
19 * Elm_WName_Smart_Data * sd = evas_object_smart_data_get(o)
21 * #define ELM_WNAME_CHECK(obj) \
22 * if (!obj || !elm_widget_type_check((obj), ELM_WNAME_SMART_NAME, \
26 * typedef struct _Elm_WName_Smart_Class
28 * Elm_WParentName_Smart_Class base;
29 * } Elm_WName_Smart_Class;
31 * typedef struct _Elm_WName_Smart_Data Elm_WName_Smart_Data;
32 * struct _Elm_WName_Smart_Data
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
39 * static const char SIG_CLICKED[] = "clicked";
40 * static const Evas_Smart_Cb_Description _smart_callbacks[] = {
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,
51 * _elm_wname_smart_on_focus(Evas_Object *obj)
53 * ELM_WNAME_DATA_GET(obj, sd);
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)
59 * if (elm_widget_focus_get(obj))
61 * edje_object_signal_emit(sd->sub, "elm,action,focus", "elm");
62 * evas_object_focus_set(sd->sub, EINA_TRUE);
66 * edje_object_signal_emit(sd->sub, "elm,action,unfocus", "elm");
67 * evas_object_focus_set(sd->sub, EINA_FALSE);
74 * _elm_wname_smart_theme(Evas_Object *obj)
76 * ELM_WNAME_DATA_GET(obj, sd);
78 * if (!ELM_WIDGET_CLASS(_elm_wname_parent_sc)->theme(obj))
81 * // handle changes in theme/scale etc here. always call the
82 * // parent class's version, as even the base class implements it.
84 * elm_widget_theme_object_set(obj, sd->sub, "wname", "base",
85 * elm_widget_style_get(obj));
91 * _elm_widget_smart_disable(Evas_Object *obj)
93 * ELM_WNAME_DATA_GET(obj, sd);
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");
99 * edje_object_signal_emit(sd->sub, "elm,state,enabled", "elm");
105 * _elm_wname_smart_add(Evas_Object *obj)
107 * EVAS_SMART_DATA_ALLOC(obj, Elm_WName_Smart_Data);
109 * ELM_WIDGET_CLASS(_elm_wname_parent_sc)->base.add(obj);
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);
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, EINA_TRUE);
138 * _elm_wname_smart_del(Evas_Object *obj)
140 * ELM_WNAME_DATA_GET(obj, sd);
142 * // deleting 'virtual' function implementation - on deletion of
143 * // object delete object struct, etc.
145 * ELM_WIDGET_CLASS(_elm_wname_parent_sc)->base.del(obj);
149 * _elm_wname_smart_set_user(Elm_WName_Smart_Class *sc)
151 * ELM_WIDGET_CLASS(sc)->base.add = _elm_wname_smart_add;
152 * ELM_WIDGET_CLASS(sc)->base.del = _elm_wname_smart_del;
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;
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"
164 * elm_wname_add(Evas_Object *parent)
168 * EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
170 * obj = elm_widget_add(_elm_check_smart_class_new(), parent);
171 * if (!obj) return NULL;
173 * if (!elm_widget_sub_object_add(parent, obj))
174 * ERR("could not add %p as sub object of %p", obj, parent);
179 * // example - do "whatever" to the widget (here just emit a signal)
181 * elm_wname_whatever(Evas_Object *obj)
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");
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
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."
210 #define ELM_INTERNAL_API_VERSION 7000
214 * @defgroup Widget Widgets Extension Infrastructure
216 * This section is intended for people willing to create @b custom
217 * Elementary widgets or to contribute new (useful, unique) widgets
218 * upstream. If neither is your case, this text won't be of any use
221 * Elementary widgets are built in a @b hierarchical fashion. The idea
222 * is to factorize as much code as possible between widgets with
223 * behavioral similarities, as long as to facilitate the creation of
224 * @b custom, new widgets, may the user need them.
226 * It all starts with a base class, which aggregates behaviour
227 * @b every Elementary widget is supposed to have:
228 * #Elm_Widget_Smart_Class. Every Elementary widget will be of that
229 * type, be it directly or by means of @b inheriting from it.
231 * #Elm_Widget_Smart_Class happens to be an @c Evas_Smart_Class. If
232 * you check out Evas' documentation on it, you'll see it's how one is
233 * supposed to create custom Evas objects, what Elementary widgets
236 * Once one instantiates an Elementary widget, since it inherits from
237 * #Elm_Widget_Smart_Class, the system will raise a class instance of
238 * that type for you. But that happens only @b once: the first time
239 * you ask for an Elementary widget (of a given type). All subsequent
240 * ones will only point to the very same class instance. Since it's
241 * the class which points to the functions implementing the behavior
242 * of objects of that type, all of the live instances of Elementary
243 * widgets (of that type) will share the same blob of code loaded in
244 * memory to execute their routines.
246 * Now go and take a look at #Elm_Widget_Smart_Class's fields. Because
247 * it inherits from Evas' base smart class, we got a field of that
248 * type as the first member, so that Evas can handle Elementary
249 * objects internally as if they were 'normal' Evas objects. Evas has
250 * the Evas-only behavior function pointers in there, so it's all it
253 * Then, comes a version field, so that whenever we got to update or
254 * change the fields on our base smart class, there'll be a runtime
255 * check of the version expected by Elementary and the one provided by
256 * any code linking with it. A mismatch will show the developer of
257 * that code he/she needs to recompile and link its code to a newer
258 * version of Elementary.
260 * The next fields are the class functions themselves. We call them
261 * 'virtual' because, as in object-oriented languages, one is supposed
262 * here to override them on inheriting classes. On most of
263 * inheritances you'll probably want to call the parent's version of
264 * the class function too: you must analyse each case to tell.
266 * Take a look at #Elm_Widget_Smart_Data. That's private data bound to
267 * each Elementary object @b instance. It aggregates data needed for
268 * all widgets, since it's meant for the #Elm_Widget_Smart_Class-typed
271 * When inheriting from that base type, instance data for this new
272 * class has to have, as the first member, a field of type
273 * #Elm_Widget_Smart_Data. This has to be respected recursively -- if
274 * a third class is to be created inheriting from the one that is a
275 * direct 'child' of #Elm_Widget_Smart_Class, then the private data on
276 * this third class has to have, as its first field, a variable of the
277 * type of the private data of the second class (its parent), direct
278 * child of #Elm_Widget_Smart_Class.
280 * It is from the base private data, #Elm_Widget_Smart_Data, that we
281 * reach an object's class functions, by the given object
282 * instance. This is the reason of the first field of that struct: a
283 * pointer set to point to its class when the object is instantiated.
285 * The following figure illustrates the widget inheritance schema.
287 * @image html elm-widget-hierarchy.png
288 * @image rtf elm-widget-hierarchy.png
289 * @image latex elm-widget-hierarchy.eps
291 * @section elm-hierarchy-tree Elementary Widgets Hierarchy Tree
293 * The following figure illustrates the Elementary widget inheritance
296 * @image html elm-widget-tree.png
297 * @image rtf elm-widget-tree.png
298 * @image latex elm-widget-tree.eps
307 /* Elm_Activate is used in 'Virtual' function Eina_Bool (*activate)
308 * (Evas_Object *obj, Elm_Activate act); of Elm_Widget_Smart_Class */
311 ELM_ACTIVATE_DEFAULT = 0,
319 /* Please, ALWAYS update the ELM_WIDGET_SMART_CLASS_INIT macro
320 * whenever you change the following struct! */
323 * Base widget smart class. It has the 'virtual' functions for all
324 * general, common actions on Elementary widgets.
326 typedef struct _Elm_Widget_Smart_Class
328 Evas_Smart_Class base; /**< Base smart class struct, needed for all smart objects */
329 int version; /**< Version of this smart class definition */
331 void (*parent_set)(Evas_Object *obj,
332 Evas_Object *parent); /**< 'Virtual' function handling parent widget attachment to new object */
333 Eina_Bool (*on_focus)(Evas_Object *obj); /**< 'Virtual' function handling focus in/out events on the widget */
334 Eina_Bool (*disable)(Evas_Object *obj); /**< 'Virtual' function on the widget being disabled */
335 Eina_Bool (*theme)(Evas_Object *obj); /**< 'Virtual' function on the widget being re-themed */
336 Eina_Bool (*translate)(Evas_Object *obj); /**< 'Virtual' function handling language changes on Elementary */
337 Eina_Bool (*event)(Evas_Object *obj,
339 Evas_Callback_Type type,
340 void *event_info); /**< 'Virtual' function handling input events on the widget */
341 Eina_Bool (*on_focus_region)(const Evas_Object *obj,
345 Evas_Coord *h); /**< 'Virtual' function returning an inner area of a widget that should be brought into the visible area 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. */
346 Eina_Bool (*focus_next)(const Evas_Object *obj,
347 Elm_Focus_Direction dir,
348 Evas_Object **next); /**< 'Virtual' function handling passing focus to sub-objects */
349 Eina_Bool (*focus_direction)(const Evas_Object *obj,
350 const Evas_Object *base,
352 Evas_Object **target,
353 double *weight); /**< 'Virtual' function handling passing focus to sub-objects <b>given a direction, in degrees</b> */
355 Eina_Bool (*sub_object_add)(Evas_Object *obj,
356 Evas_Object *sobj); /**< 'Virtual' function handling sub objects being added */
358 Eina_Bool (*sub_object_del)(Evas_Object *obj,
359 Evas_Object *sobj); /**< 'Virtual' function handling sub objects being removed */
360 void (*access)(Evas_Object *obj,
361 Eina_Bool is_access); /**< 'Virtual' function on the widget being set access */
362 Eina_Bool (*activate)(Evas_Object *obj,
363 Elm_Activate act); /**< 'Virtual' function to activate widget */
364 } Elm_Widget_Smart_Class;
367 * Base widget smart data. This is data bound to an Elementary object
368 * @b instance, so its particular to that specific object and not
369 * shared between all objects in its class. It is here, though, that
370 * we got a pointer to the object's class, the first field -- @c
373 typedef struct _Elm_Widget_Smart_Data
375 Evas_Object *obj; /**< object pointer for this widget smart data */
376 Evas_Object *parent_obj; /**< parent object of a widget in the elementary tree */
377 Evas_Object *parent2; /**< parent object for an inlined window */
378 Evas_Coord x, y, w, h;
379 Eina_List *subobjs; /**< list of widgets' sub objects in the elementary tree */
380 Evas_Object *resize_obj; /**< an unique object for each widget that shows the look of a widget. Resize object's geometry is same as the widget. This resize object is different from that of window's resize object. */
381 Evas_Object *hover_obj;
382 Eina_List *tooltips, *cursors;
383 Evas_Object *focus_previous, *focus_next;
384 Evas_Object *focus_up, *focus_down, *focus_right, *focus_left;
386 /* "show region" coordinates. all widgets got those because this
387 * info may be set and queried recursively through the widget
389 Evas_Coord rx, ry, rw, rh;
391 /* scrolling hold/freeze hints. all widgets got those because this
392 * info may be set and queried recursively through the widget
400 const char *focus_highlight_style; /**< custom focus style for a widget */
401 const char *access_info;
402 unsigned int focus_order;
403 Eina_Bool focus_order_on_calc;
405 int child_drag_x_locked;
406 int child_drag_y_locked;
408 Eina_Inlist *translate_strings;
409 Eina_List *focus_chain;
412 int role; /**< Accessibility role */
413 const char *description; /**< Accessibility description */
414 //TIZEN_ONLY(20150717) add widget name setter
417 Eo *atspi_custom_parent; /**< Accessibility parent if different then parent_obj */
418 //TIZEN_ONLY(20150709) add relations atpi
419 Elm_Atspi_Relation_Set atspi_custom_relations; /**< Developer-defined accessiblity relations */
420 ///////////////////////////////////
421 //TIZEN_ONLY(20150731) : add i18n support for name and description
422 const char *atspi_translation_domain;
425 /* this is a hook to be set on-the-fly on widgets. this is code
426 * handling the request of showing a specific region from an inner
427 * widget (mainly issued by entries, on cursor moving) */
428 void *on_show_region_data;
429 void (*on_show_region)(void *data,
432 int orient_mode; /* -1 is disabled */
433 Elm_Focus_Move_Policy focus_move_policy;
435 Eina_Bool drag_x_locked : 1;
436 Eina_Bool drag_y_locked : 1;
438 Eina_Bool can_focus : 1;
439 Eina_Bool child_can_focus : 1;
440 Eina_Bool focused : 1;
441 Eina_Bool top_win_focused : 1;
442 Eina_Bool tree_unfocusable : 1;
443 Eina_Bool highlight_ignore : 1;
444 Eina_Bool highlight_in_theme : 1;
445 Eina_Bool access_highlight_in_theme : 1;
446 Eina_Bool disabled : 1;
447 Eina_Bool is_mirrored : 1;
448 Eina_Bool mirrored_auto_mode : 1; /* This is
451 Eina_Bool still_in : 1;
452 Eina_Bool highlighted : 1;
453 Eina_Bool highlight_root : 1;
454 Eina_Bool on_translate : 1; /**< This is true when any types of elm translate function is being called. */
455 Eina_Bool on_create : 1; /**< This is true when the widget is on creation(general widget constructor). */
456 // TIZEN_ONLY(20150705): Genlist item align feature
457 Eina_Bool scroll_item_align_enable;
458 const char *scroll_item_valign;
460 ///TIZEN_ONLY(20170717) : expose highlight information on atspi
461 Eina_Bool can_highlight : 1; /**< true if widget have at-spi HIGHLIGHTABLE state */
464 } Elm_Widget_Smart_Data;
470 typedef struct _Elm_Tooltip Elm_Tooltip;
471 typedef struct _Elm_Cursor Elm_Cursor;
473 /**< base structure for all widget items that are not Elm_Widget themselves */
474 typedef struct _Elm_Widget_Item_Data Elm_Widget_Item_Data;
475 typedef struct _Elm_Widget_Item_Signal_Data Elm_Widget_Item_Signal_Data;
477 /**< accessibility information to be able to set and get from the access API */
478 typedef struct _Elm_Access_Info Elm_Access_Info;
480 /**< accessibility info item */
481 typedef struct _Elm_Access_Item Elm_Access_Item;
483 typedef struct _Elm_Action Elm_Action;
485 typedef void (*Elm_Widget_Text_Set_Cb)(void *data, const char *part, const char *text);
486 typedef void (*Elm_Widget_Content_Set_Cb)(void *data, const char *part, Evas_Object *content);
487 typedef const char *(*Elm_Widget_Text_Get_Cb)(const void *data, const char *part);
488 typedef Evas_Object *(*Elm_Widget_Content_Get_Cb)(const void *data, const char *part);
489 typedef Evas_Object *(*Elm_Widget_Content_Unset_Cb)(const void *data, const char *part);
490 typedef void (*Elm_Widget_Signal_Emit_Cb)(void *data, const char *emission, const char *source);
491 typedef void (*Elm_Widget_Disable_Cb)(void *data);
492 typedef Eina_Bool (*Elm_Widget_Del_Pre_Cb)(void *data);
493 typedef void (*Elm_Widget_Item_Signal_Cb)(void *data, Elm_Widget_Item_Data *item, const char *emission, const char *source);
494 typedef void (*Elm_Widget_Style_Set_Cb)(void *data, const char *style);
495 typedef const char *(*Elm_Widget_Style_Get_Cb)(const void *data);
496 typedef void (*Elm_Widget_Focus_Set_Cb)(void *data, Eina_Bool focused);
497 typedef Eina_Bool (*Elm_Widget_Focus_Get_Cb)(const void *data);
499 #define ELM_ACCESS_DONE -1 /* sentence done - send done event here */
500 #define ELM_ACCESS_CANCEL -2 /* stop reading immediately */
502 typedef void (*Elm_Access_On_Highlight_Cb)(void *data);
504 struct _Elm_Access_Item
508 Elm_Access_Info_Cb func;
511 struct _Elm_Access_Info
513 Evas_Object *hoverobj;
515 Ecore_Timer *delay_timer;
516 void *on_highlight_data;
517 Elm_Access_On_Highlight_Cb on_highlight;
520 Elm_Access_Activate_Cb activate;
522 /* the owner widget item that owns this access info */
523 Elm_Widget_Item_Data *widget_item;
525 /* the owner part object that owns this access info */
526 Evas_Object *part_object;
535 Eina_Bool (*func)(Evas_Object *obj, const char *params);
538 void _elm_access_shutdown();
539 void _elm_access_mouse_event_enabled_set(Eina_Bool enabled);
541 /* if auto_higlight is EINA_TRUE, it does not steal a focus, it just moves a highlight */
542 void _elm_access_auto_highlight_set(Eina_Bool enabled);
543 Eina_Bool _elm_access_auto_highlight_get(void);
544 void _elm_access_widget_item_access_order_set(Elm_Widget_Item_Data *item, Eina_List *objs);
545 const Eina_List *_elm_access_widget_item_access_order_get(const Elm_Widget_Item_Data *item);
546 void _elm_access_widget_item_access_order_unset(Elm_Widget_Item_Data *item);
548 // widget focus highlight
549 void _elm_widget_focus_highlight_start(const Evas_Object *obj);
550 void _elm_widget_highlight_in_theme_update(Eo *obj);
551 void _elm_widget_focus_highlight_signal_emit(Evas_Object *obj, const char *emission, const char *source);
552 void _elm_widget_focus_highlight_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb _focus_highlight_signal_cb, void *data);
553 void _elm_widget_focus_highlight_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb _focus_highlight_signal_cb);
555 // win focus highlight
556 void _elm_win_focus_highlight_start(Evas_Object *obj);
557 void _elm_win_focus_highlight_in_theme_update(Evas_Object *obj, Eina_Bool in_theme);
558 void _elm_win_focus_highlight_signal_emit(Evas_Object *obj, const char *emission, const char *source);
559 void _elm_win_focus_highlight_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb _focus_highlight_signal_cb, void *data);
560 void _elm_win_focus_highlight_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb _focus_highlight_signal_cb);
561 void _elm_win_object_set_accessibility_highlight(Evas_Object *win, Evas_Object *obj);
562 void *_elm_object_accessibility_currently_highlighted_get();
564 EAPI void _elm_access_clear(Elm_Access_Info *ac);
565 EAPI void _elm_access_text_set(Elm_Access_Info *ac, int type, const char *text);
566 EAPI void _elm_access_callback_set(Elm_Access_Info *ac, int type, Elm_Access_Info_Cb func, const void *data);
567 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! */
568 EAPI void _elm_access_read(Elm_Access_Info *ac, int type, const Evas_Object *obj);
569 EAPI void _elm_access_say(const char *txt);
570 EAPI Elm_Access_Info *_elm_access_info_get(const Evas_Object *obj);
571 EAPI void _elm_access_object_highlight(Evas_Object *obj);
572 EAPI void _elm_access_object_unhighlight(Evas_Object *obj);
573 EAPI void _elm_access_object_highlight_disable(Evas *e);
574 EAPI void _elm_access_object_register(Evas_Object *obj, Evas_Object *hoverobj);
575 EAPI void _elm_access_object_unregister(Evas_Object *obj, Evas_Object *hoverobj);
576 EAPI Eina_Bool _elm_access_2nd_click_timeout(Evas_Object *obj);
577 EAPI void _elm_access_highlight_set(Evas_Object* obj);
578 EAPI Evas_Object * _elm_access_edje_object_part_object_register(Evas_Object *obj, const Evas_Object *partobj, const char* part);
579 EAPI void _elm_access_edje_object_part_object_unregister(Evas_Object* obj, const Evas_Object *eobj, const char* part);
580 EAPI void _elm_access_widget_item_register(Elm_Widget_Item_Data *item);
581 EAPI void _elm_access_widget_item_unregister(Elm_Widget_Item_Data *item);
582 EAPI void _elm_access_on_highlight_hook_set(Elm_Access_Info *ac, Elm_Access_On_Highlight_Cb func, void *data);
583 EAPI void _elm_access_activate_callback_set(Elm_Access_Info *ac, Elm_Access_Activate_Cb func, void *data);
584 EAPI void _elm_access_highlight_object_activate(Evas_Object *obj, Elm_Activate act);
585 EAPI void _elm_access_highlight_cycle(Evas_Object *obj, Elm_Focus_Direction dir);
587 EINA_DEPRECATED EAPI Elm_Access_Info *_elm_access_object_get(const Evas_Object *obj);
589 #define ELM_PREFS_DATA_MAGIC 0xe1f5da7a
591 /**< put this as the first member in your widget item struct */
592 #define ELM_WIDGET_ITEM Elm_Widget_Item_Data base
594 struct _Elm_Widget_Item_Signal_Data
596 Elm_Widget_Item_Data *item;
597 Elm_Widget_Item_Signal_Cb func;
598 const char *emission;
603 #define WIDGET_ITEM_DATA_GET(eo_obj) \
605 eo_do(eo_obj, eo_key_data_get("__elm_widget_item_data")); \
608 #define WIDGET_ITEM_DATA_SET(eo_obj, data) \
610 eo_do(eo_obj, eo_key_data_set("__elm_widget_item_data", data, NULL)); \
613 struct _Elm_Widget_Item_Data
615 /* ef1 ~~ efl, el3 ~~ elm */
616 #define ELM_WIDGET_ITEM_MAGIC 0xef1e1301
618 /* simple accessor macros */
619 #define VIEW(X) X->base->view
620 #define WIDGET(X) X->base->widget
621 #define EO_OBJ(X) ((X)?X->base->eo_obj:NULL)
622 /**< the owner widget that owns this item */
624 /**< The Eo item, useful to invoke eo_do when only the item data is available */
626 /**< the base view object */
628 /**< user delete callback function */
629 Evas_Smart_Cb del_func;
630 /**< widget delete callback function. don't expose this callback call */
631 Elm_Widget_Del_Pre_Cb del_pre_func;
633 Evas_Object *access_obj;
634 const char *access_info;
635 Eina_List *access_order;
636 Eina_Inlist *translate_strings;
639 Evas_Object *track_obj;
642 const char *description;
645 //TIZEN_ONLY(20150709) add relations atpi
646 Elm_Atspi_Relation_Set atspi_custom_relations; /**< Developer-defined accessiblity relations */
647 ///////////////////////////////////
648 //TIZEN_ONLY(20150731) : add i18n support for name and description
649 const char *atspi_translation_domain;
652 Eina_Bool disabled : 1;
653 Eina_Bool on_deletion : 1;
654 Eina_Bool on_translate : 1;
655 Eina_Bool still_in : 1;
656 ///TIZEN_ONLY(20170717) : expose highlight information on atspi
657 Eina_Bool can_highlight : 1; /**< true if widget have at-spi HIGHLIGHTABLE state */
661 #define ELM_NEW(t) calloc(1, sizeof(t))
663 EAPI Evas_Object *elm_widget_add(Evas_Smart *, Evas_Object *);
664 EAPI void elm_widget_parent_set(Evas_Object *, Evas_Object *);
665 EAPI Eina_Bool elm_widget_api_check(int ver);
666 EAPI Eina_Bool elm_widget_access(Evas_Object *obj, Eina_Bool is_access);
667 EAPI Eina_Bool elm_widget_theme(Evas_Object *obj);
668 EAPI void elm_widget_theme_specific(Evas_Object *obj, Elm_Theme *th, Eina_Bool force);
669 EAPI void elm_widget_translate(Evas_Object *obj);
670 EAPI void elm_widget_on_show_region_hook_set(Evas_Object *obj, void (*func)(void *data, Evas_Object *obj), void *data);
671 EAPI Eina_Bool elm_widget_sub_object_parent_add(Evas_Object *sobj);
672 EAPI Eina_Bool elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj);
673 EAPI Eina_Bool elm_widget_sub_object_del(Evas_Object *obj, Evas_Object *sobj);
674 EAPI void elm_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj, Eina_Bool sub_obj);
675 EAPI void elm_widget_hover_object_set(Evas_Object *obj, Evas_Object *sobj);
676 EAPI void elm_widget_signal_emit(Evas_Object *obj, const char *emission, const char *source);
677 EAPI void elm_widget_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
678 EAPI void *elm_widget_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func);
679 EAPI void elm_widget_can_focus_set(Evas_Object *obj, Eina_Bool can_focus);
680 EAPI Eina_Bool elm_widget_can_focus_get(const Evas_Object *obj);
681 EAPI Eina_Bool elm_widget_child_can_focus_get(const Evas_Object *obj);
682 EAPI Eina_List *elm_widget_can_focus_child_list_get(const Evas_Object *obj);
683 EAPI void elm_widget_tree_unfocusable_set(Evas_Object *obj, Eina_Bool tree_unfocusable);
684 EAPI Eina_Bool elm_widget_tree_unfocusable_get(const Evas_Object *obj);
685 EAPI void elm_widget_highlight_ignore_set(Evas_Object *obj, Eina_Bool ignore);
686 EAPI Eina_Bool elm_widget_highlight_ignore_get(const Evas_Object *obj);
687 EAPI void elm_widget_highlight_in_theme_set(Evas_Object *obj, Eina_Bool highlight);
688 EAPI Eina_Bool elm_widget_highlight_in_theme_get(const Evas_Object *obj);
689 EAPI void elm_widget_access_highlight_in_theme_set(Evas_Object *obj, Eina_Bool highlight);
690 EAPI Eina_Bool elm_widget_access_highlight_in_theme_get(const Evas_Object *obj);
691 EAPI Eina_Bool elm_widget_focus_get(const Evas_Object *obj);
692 EAPI Eina_Bool elm_widget_highlight_get(const Evas_Object *obj);
693 EAPI Evas_Object *elm_widget_focused_object_get(const Evas_Object *obj);
694 EAPI Evas_Object *elm_widget_top_get(const Evas_Object *obj);
695 EAPI Eina_Bool elm_widget_is(const Evas_Object *obj);
696 EAPI Evas_Object *elm_widget_parent_widget_get(const Evas_Object *obj);
697 EAPI void elm_widget_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, const void *data);
698 EAPI void *elm_widget_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data);
699 EAPI Eina_Bool elm_widget_event_propagate(Evas_Object *obj, Evas_Callback_Type type, void *event_info, Evas_Event_Flags *event_flags);
700 EAPI void elm_widget_focus_custom_chain_set(Evas_Object *obj, Eina_List *objs);
701 EAPI void elm_widget_focus_custom_chain_unset(Evas_Object *obj);
702 EAPI const Eina_List *elm_widget_focus_custom_chain_get(const Evas_Object *obj);
703 EAPI void elm_widget_focus_custom_chain_append(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
704 EAPI void elm_widget_focus_custom_chain_prepend(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
705 EAPI void elm_widget_focus_cycle(Evas_Object *obj, Elm_Focus_Direction dir);
706 EAPI Eina_Bool elm_widget_focus_direction_go(Evas_Object *obj, double degree);
707 EAPI Eina_Bool elm_widget_focus_direction_get(const Evas_Object *obj, const Evas_Object *base, double degree, Evas_Object **direction, double *weight);
708 EAPI Eina_Bool elm_widget_focus_next_get(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next);
709 EAPI Eina_Bool elm_widget_focus_list_direction_get(const Evas_Object *obj, const Evas_Object *base, const Eina_List *items, void *(*list_data_get)(const Eina_List *list), double degree, Evas_Object **direction, double *weight);
710 EAPI Eina_Bool elm_widget_focus_list_next_get(const Evas_Object *obj, const Eina_List *items, void *(*list_data_get)(const Eina_List *list), Elm_Focus_Direction dir, Evas_Object **next);
711 EAPI Evas_Object *elm_widget_focus_next_object_get(const Evas_Object *obj, Elm_Focus_Direction dir);
712 EAPI void elm_widget_focus_next_object_set(Evas_Object *obj, Evas_Object *next, Elm_Focus_Direction dir);
713 EAPI Eina_Bool elm_widget_focus_highlight_style_set(Evas_Object *obj, const char *style);
714 EAPI const char *elm_widget_focus_highlight_style_get(const Evas_Object *obj);
715 EAPI void elm_widget_parent_highlight_set(Evas_Object *obj, Eina_Bool highlighted);
716 EAPI void elm_widget_focus_set(Evas_Object *obj, Eina_Bool focus);
717 EAPI void elm_widget_focused_object_clear(Evas_Object *obj);
718 EAPI Evas_Object *elm_widget_parent_get(const Evas_Object *obj);
719 EAPI Evas_Object *elm_widget_parent2_get(const Evas_Object *obj);
720 EAPI void elm_widget_parent2_set(Evas_Object *obj, Evas_Object *parent);
721 EAPI void elm_widget_focus_steal(Evas_Object *obj);
722 EAPI Evas_Object *elm_widget_newest_focus_order_get(const Evas_Object *obj, unsigned int *newest_focus_order, Eina_Bool can_focus_only);
723 EAPI void elm_widget_display_mode_set(Evas_Object *obj, Evas_Display_Mode dispmode);
724 EAPI Eina_Bool elm_widget_focus_highlight_enabled_get(const Evas_Object *obj);
725 EAPI void elm_widget_focus_highlight_focus_part_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
726 EAPI const Elm_Widget_Smart_Class *elm_widget_smart_class_get(void);
731 * Restore the focus state of the sub-tree.
733 * This API will restore the focus state of the sub-tree to the latest
734 * state. If a sub-tree is unfocused and wants to get back to the latest
735 * focus state, this API will be helpful.
737 * @param obj The widget root of sub-tree
741 EAPI void elm_widget_focus_restore(Evas_Object *obj);
743 EAPI void elm_widget_disabled_set(Evas_Object *obj, Eina_Bool disabled);
744 EAPI Eina_Bool elm_widget_disabled_get(const Evas_Object *obj);
745 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);
746 EAPI void elm_widget_show_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
747 EAPI Eina_Bool elm_widget_focus_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
748 EAPI void elm_widget_focus_region_show(const Evas_Object *obj);
749 EAPI void elm_widget_parents_bounce_get(const Evas_Object *obj, Eina_Bool *horiz, Eina_Bool *vert);
750 EAPI void elm_widget_scroll_hold_push(Evas_Object *obj);
751 EAPI void elm_widget_scroll_hold_pop(Evas_Object *obj);
752 EAPI int elm_widget_scroll_hold_get(const Evas_Object *obj);
753 EAPI void elm_widget_scroll_freeze_push(Evas_Object *obj);
754 EAPI void elm_widget_scroll_freeze_pop(Evas_Object *obj);
755 EAPI int elm_widget_scroll_freeze_get(const Evas_Object *obj);
756 // TIZEN_ONLY(20150705): Genlist item align feature
757 EAPI void elm_widget_scroll_item_align_enabled_set(Evas_Object *obj, Eina_Bool scroll_item_align_enable);
758 EAPI Eina_Bool elm_widget_scroll_item_align_enabled_get(const Evas_Object *obj);
759 EAPI void elm_widget_scroll_item_valign_set(Evas_Object *obj, char *scroll_item_valign);
760 EAPI const char* elm_widget_scroll_item_valign_get(const Evas_Object *obj);
762 EAPI void elm_widget_scale_set(Evas_Object *obj, double scale);
763 EAPI double elm_widget_scale_get(const Evas_Object *obj);
764 EAPI Eina_Bool elm_widget_mirrored_get(const Evas_Object *obj);
765 EAPI void elm_widget_mirrored_set(Evas_Object *obj, Eina_Bool mirrored);
766 EAPI Eina_Bool elm_widget_mirrored_automatic_get(const Evas_Object *obj);
767 EAPI void elm_widget_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic);
768 EAPI void elm_widget_theme_set(Evas_Object *obj, Elm_Theme *th);
769 EAPI Elm_Theme *elm_widget_theme_get(const Evas_Object *obj);
770 EAPI Eina_Bool elm_widget_style_set(Evas_Object *obj, const char *style);
771 EAPI const char *elm_widget_style_get(const Evas_Object *obj);
772 EAPI void elm_widget_type_set(Evas_Object *obj, const char *type);
773 EAPI const char *elm_widget_type_get(const Evas_Object *obj);
774 EAPI void elm_widget_tooltip_add(Evas_Object *obj, Elm_Tooltip *tt);
775 EAPI void elm_widget_tooltip_del(Evas_Object *obj, Elm_Tooltip *tt);
776 EAPI void elm_widget_cursor_add(Evas_Object *obj, Elm_Cursor *cur);
777 EAPI void elm_widget_cursor_del(Evas_Object *obj, Elm_Cursor *cur);
778 EAPI void elm_widget_drag_lock_x_set(Evas_Object *obj, Eina_Bool lock);
779 EAPI void elm_widget_drag_lock_y_set(Evas_Object *obj, Eina_Bool lock);
780 EAPI Eina_Bool elm_widget_drag_lock_x_get(const Evas_Object *obj);
781 EAPI Eina_Bool elm_widget_drag_lock_y_get(const Evas_Object *obj);
782 EAPI int elm_widget_drag_child_locked_x_get(const Evas_Object *obj);
783 EAPI int elm_widget_drag_child_locked_y_get(const Evas_Object *obj);
784 EAPI void elm_widget_item_loop_enabled_set(Evas_Object *obj, Eina_Bool enable);
785 EAPI Eina_Bool elm_widget_item_loop_enabled_get(const Evas_Object *obj);
786 EAPI Eina_Bool elm_widget_theme_object_set(Evas_Object *obj, Evas_Object *edj, const char *wname, const char *welement, const char *wstyle);
787 EAPI Eina_Bool elm_widget_type_check(const Evas_Object *obj, const char *type, const char *func);
788 EAPI Evas_Object *elm_widget_name_find(const Evas_Object *obj, const char *name, int recurse);
789 EAPI Eina_List *elm_widget_stringlist_get(const char *str);
790 EAPI void elm_widget_stringlist_free(Eina_List *list);
791 EAPI void elm_widget_focus_hide_handle(Evas_Object *obj);
792 EAPI void elm_widget_focus_mouse_up_handle(Evas_Object *obj);
793 EAPI void elm_widget_focus_tree_unfocusable_handle(Evas_Object *obj);
794 EAPI void elm_widget_focus_disabled_handle(Evas_Object *obj);
795 EAPI unsigned int elm_widget_focus_order_get(const Evas_Object *obj);
796 EAPI void elm_widget_activate(Evas_Object *obj, Elm_Activate act);
797 EAPI void elm_widget_part_text_set(Evas_Object *obj, const char *part, const char *label);
798 EAPI const char *elm_widget_part_text_get(const Evas_Object *obj, const char *part);
799 EAPI void elm_widget_domain_translatable_part_text_set(Evas_Object *obj, const char *part, const char *domain, const char *text);
800 EAPI const char *elm_widget_translatable_part_text_get(const Evas_Object *obj, const char *part);
801 EAPI void elm_widget_domain_part_text_translatable_set(Evas_Object *obj, const char *part, const char *domain, Eina_Bool translatable);
802 EAPI const char * elm_widget_part_text_translate(Evas_Object *obj, const char *part, const char *text);
803 EAPI void elm_widget_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content);
804 EAPI Evas_Object *elm_widget_content_part_get(const Evas_Object *obj, const char *part);
805 EAPI Evas_Object *elm_widget_content_part_unset(Evas_Object *obj, const char *part);
806 EAPI void elm_widget_access_info_set(Evas_Object *obj, const char *txt);
807 EAPI const char *elm_widget_access_info_get(const Evas_Object *obj);
808 EAPI void elm_widget_orientation_set(Evas_Object *obj, int rotation);
809 EAPI Elm_Object_Item *elm_widget_focused_item_get(const Evas_Object *obj);
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 EAPI void elm_widget_focus_highlight_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
813 void _elm_widget_item_highlight_in_theme(Evas_Object *obj, Elm_Object_Item *it);
814 EAPI void elm_widget_focus_move_policy_set(Evas_Object *obj, Elm_Focus_Move_Policy policy);
815 EAPI Elm_Focus_Move_Policy elm_widget_focus_move_policy_get(const Evas_Object *obj);
816 EAPI Eo* _elm_atspi_bridge_utils_plug_create(Eo *parent, const char *svcname, int svcnum);
817 EAPI Eo* _elm_atspi_bridge_utils_socket_create(Eo *parent, const char *svcname, int svcnum);
820 * Function to operate on a given widget's scrollabe children when necessary.
821 * @warning free the returned list with eina_list_free().
823 EAPI Eina_List *elm_widget_scrollable_children_get(const Evas_Object *obj);
825 /* debug function. don't use it unless you are tracking parenting issues */
826 EAPI void elm_widget_tree_dump(const Evas_Object *top);
827 EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *output);
828 EAPI Eina_Bool _elm_widget_onscreen_is(Evas_Object *widget);
829 EAPI Eina_Bool _elm_widget_item_onscreen_is(Elm_Object_Item *item);
831 #define ELM_WIDGET_DATA_GET_OR_RETURN(o, ptr, ...) \
832 Elm_Widget_Smart_Data *ptr; \
833 ptr = eo_data_scope_get(o, ELM_WIDGET_CLASS); \
834 if (EINA_UNLIKELY(!ptr)) \
836 CRI("no widget data for object %p (%s)", \
837 o, evas_object_type_get(o)); \
838 return __VA_ARGS__; \
841 #define ELM_WIDGET_CHECK(obj) \
842 if (EINA_UNLIKELY(!eo_isa((obj), ELM_WIDGET_CLASS))) \
845 #define ELM_WIDGET_ITEM_RETURN_IF_ONDEL(item, ...) \
847 if (item && (item)->on_deletion) { \
848 WRN("Elm_Widget_Item " # item " is deleting"); \
849 return __VA_ARGS__; \
853 #define ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, ...) \
856 CRI("Elm_Widget_Item " # item " is NULL"); \
857 return __VA_ARGS__; \
859 if ((item)->eo_obj && \
860 eo_isa((item)->eo_obj, ELM_WIDGET_ITEM_CLASS)) break; \
861 if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) { \
862 EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC); \
863 return __VA_ARGS__; \
867 #define ELM_WIDGET_ITEM_CHECK_OR_GOTO(item, label) \
870 CRI("Elm_Widget_Item " # item " is NULL"); \
873 if ((item)->eo_obj && \
874 eo_isa((item)->eo_obj, ELM_WIDGET_ITEM_CLASS)) break; \
875 if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) { \
876 EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC); \
881 /* to be used by INTERNAL classes on Elementary, so that the widgets
882 * parsing script skips it */
883 #define ELM_INTERNAL_SMART_SUBCLASS_NEW EVAS_SMART_SUBCLASS_NEW
885 EAPI Eina_Bool elm_selection_selection_has_owner(Evas_Object *obj);
887 typedef void (*region_hook_func_type)(void *data, Evas_Object *obj);
888 typedef void * (*list_data_get_func_type)(const Eina_List * l);
890 #include "elm_widget.eo.h"
892 #define ELM_WIDGET_ITEM_PROTECTED
893 #include "elm_widget_item.eo.h"