1 #include <Elementary.h>
4 static const char SMART_NAME[] = "elm_widget";
7 Smart_Data * sd = evas_object_smart_data_get(obj); \
8 if ((!obj) || (!sd) || (!_elm_widget_is(obj)))
9 #define INTERNAL_ENTRY \
10 Smart_Data * sd = evas_object_smart_data_get(obj); \
13 typedef struct _Smart_Data Smart_Data;
14 typedef struct _Edje_Signal_Data Edje_Signal_Data;
15 typedef struct _Elm_Event_Cb_Data Elm_Event_Cb_Data;
21 Evas_Object *parent_obj;
22 Evas_Coord x, y, w, h;
24 Evas_Object *resize_obj;
25 Evas_Object *hover_obj;
26 Eina_List *tooltips, *cursors;
27 void (*del_func)(Evas_Object *obj);
28 void (*del_pre_func)(Evas_Object *obj);
29 void (*focus_func)(Evas_Object *obj);
30 void (*activate_func)(Evas_Object *obj);
31 void (*disable_func)(Evas_Object *obj);
32 void (*theme_func)(Evas_Object *obj);
33 Eina_Bool (*event_func)(Evas_Object *obj,
35 Evas_Callback_Type type,
37 void (*signal_func)(Evas_Object *obj,
40 void (*callback_add_func)(Evas_Object *obj,
45 void (*callback_del_func)(Evas_Object *obj,
50 void (*changed_func)(Evas_Object *obj);
51 Eina_Bool (*focus_next_func)(const Evas_Object *obj,
52 Elm_Focus_Direction dir,
54 void (*on_focus_func)(void *data,
57 void (*on_change_func)(void *data,
60 void (*on_show_region_func)(void *data,
62 void *on_show_region_data;
63 void (*focus_region_func)(Evas_Object *obj,
68 void (*on_focus_region_func)(const Evas_Object *obj,
73 void (*on_text_set_func)(Evas_Object *obj,
76 const char *(*on_text_get_func)(const Evas_Object *obj,
78 void (*on_content_set_func)(Evas_Object *obj,
80 Evas_Object *content);
81 Evas_Object *(*on_content_get_func)(const Evas_Object *obj,
83 Evas_Object *(*on_content_unset_func)(Evas_Object *obj,
86 Evas_Coord rx, ry, rw, rh;
92 unsigned int focus_order;
93 Eina_Bool focus_order_on_calc;
95 int child_drag_x_locked;
96 int child_drag_y_locked;
98 Eina_List *edje_signals;
100 Eina_Bool drag_x_locked : 1;
101 Eina_Bool drag_y_locked : 1;
103 Eina_Bool can_focus : 1;
104 Eina_Bool child_can_focus : 1;
105 Eina_Bool focused : 1;
106 Eina_Bool tree_unfocusable : 1;
107 Eina_Bool highlight_ignore : 1;
108 Eina_Bool highlight_in_theme : 1;
109 Eina_Bool disabled : 1;
110 Eina_Bool is_mirrored : 1;
111 Eina_Bool mirrored_auto_mode : 1; /* This is TRUE by default */
113 Eina_List *focus_chain;
117 struct _Edje_Signal_Data
121 const char *emission;
126 struct _Elm_Event_Cb_Data
132 /* local subsystem functions */
133 static void _smart_reconfigure(Smart_Data *sd);
134 static void _smart_add(Evas_Object *obj);
135 static void _smart_del(Evas_Object *obj);
136 static void _smart_move(Evas_Object *obj,
139 static void _smart_resize(Evas_Object *obj,
142 static void _smart_show(Evas_Object *obj);
143 static void _smart_hide(Evas_Object *obj);
144 static void _smart_color_set(Evas_Object *obj,
149 static void _smart_clip_set(Evas_Object *obj,
151 static void _smart_clip_unset(Evas_Object *obj);
152 static void _smart_calculate(Evas_Object *obj);
153 static void _smart_init(void);
155 static void _if_focused_revert(Evas_Object *obj,
156 Eina_Bool can_focus_only);
157 static Evas_Object *_newest_focus_order_get(Evas_Object *obj,
158 unsigned int *newest_focus_order,
159 Eina_Bool can_focus_only);
161 /* local subsystem globals */
162 static Evas_Smart *_e_smart = NULL;
163 static Eina_List *widtypes = NULL;
165 static unsigned int focus_order = 0;
168 static inline Eina_Bool
169 _elm_widget_is(const Evas_Object *obj)
171 const char *type = evas_object_type_get(obj);
172 return type == SMART_NAME;
175 static inline Eina_Bool
176 _is_focusable(Evas_Object *obj)
178 API_ENTRY return EINA_FALSE;
179 return sd->can_focus || (sd->child_can_focus);
183 _unfocus_parents(Evas_Object *obj)
185 for (; obj; obj = elm_widget_parent_get(obj))
188 if (!sd->focused) return;
194 _focus_parents(Evas_Object *obj)
196 for (; obj; obj = elm_widget_parent_get(obj))
199 if (sd->focused) return;
205 _sub_obj_del(void *data,
208 void *event_info __UNUSED__)
210 Smart_Data *sd = data;
212 if (_elm_widget_is(obj))
214 if (elm_widget_focus_get(obj)) _unfocus_parents(sd->obj);
216 if (obj == sd->resize_obj)
217 sd->resize_obj = NULL;
218 else if (obj == sd->hover_obj)
219 sd->hover_obj = NULL;
221 sd->subobjs = eina_list_remove(sd->subobjs, obj);
222 evas_object_smart_callback_call(sd->obj, "sub-object-del", obj);
226 _sub_obj_hide(void *data __UNUSED__,
229 void *event_info __UNUSED__)
231 elm_widget_focus_hide_handle(obj);
235 _sub_obj_mouse_down(void *data __UNUSED__,
238 void *event_info __UNUSED__)
240 elm_widget_focus_mouse_down_handle(obj);
244 _propagate_x_drag_lock(Evas_Object *obj,
250 Smart_Data *sd2 = evas_object_smart_data_get(sd->parent_obj);
253 sd2->child_drag_x_locked += dir;
254 _propagate_x_drag_lock(sd->parent_obj, dir);
260 _propagate_y_drag_lock(Evas_Object *obj,
266 Smart_Data *sd2 = evas_object_smart_data_get(sd->parent_obj);
269 sd2->child_drag_y_locked += dir;
270 _propagate_y_drag_lock(sd->parent_obj, dir);
276 _propagate_event(void *data,
282 Evas_Callback_Type type = (Evas_Callback_Type)(long)data;
283 Evas_Event_Flags *event_flags = NULL;
287 case EVAS_CALLBACK_KEY_DOWN:
289 Evas_Event_Key_Down *ev = event_info;
290 event_flags = &(ev->event_flags);
294 case EVAS_CALLBACK_KEY_UP:
296 Evas_Event_Key_Up *ev = event_info;
297 event_flags = &(ev->event_flags);
301 case EVAS_CALLBACK_MOUSE_WHEEL:
303 Evas_Event_Mouse_Wheel *ev = event_info;
304 event_flags = &(ev->event_flags);
312 elm_widget_event_propagate(obj, type, event_info, event_flags);
316 _parent_focus(Evas_Object *obj)
319 if (sd->focused) return;
321 Evas_Object *o = elm_widget_parent_get(obj);
322 sd->focus_order_on_calc = EINA_TRUE;
324 if (o) _parent_focus(o);
326 if (!sd->focus_order_on_calc)
327 return; /* we don't want to override it if by means of any of the
328 callbacks below one gets to calculate our order
332 sd->focus_order = focus_order;
333 sd->focused = EINA_TRUE;
334 if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
335 if (sd->focus_func) sd->focus_func(obj);
337 _elm_widget_focus_region_show(obj);
339 sd->focus_order_on_calc = EINA_FALSE;
343 _elm_object_focus_chain_del_cb(void *data,
346 void *event_info __UNUSED__)
348 Smart_Data *sd = data;
350 sd->focus_chain = eina_list_remove(sd->focus_chain, obj);
353 // exposed util funcs to elm
355 _elm_widget_type_clear(void)
359 EINA_LIST_FREE(widtypes, ptr)
361 eina_stringshare_del(*ptr);
367 _elm_widget_focus_region_show(const Evas_Object *obj)
369 Evas_Coord x, y, w, h, ox, oy;
375 o = elm_widget_parent_get(obj);
378 elm_widget_focus_region_get(obj, &x, &y, &w, &h);
379 evas_object_geometry_get(obj, &ox, &oy, NULL, NULL);
383 sd2 = evas_object_smart_data_get(o);
384 if (sd2->focus_region_func)
386 sd2->focus_region_func(o, x, y, w, h);
387 elm_widget_focus_region_get(o, &x, &y, &w, &h);
391 evas_object_geometry_get(o, &px, &py, NULL, NULL);
397 o = elm_widget_parent_get(o);
402 * @defgroup Widget Widget
405 * Exposed api for making widgets
408 elm_widget_type_register(const char **ptr)
410 widtypes = eina_list_append(widtypes, (void *)ptr);
414 elm_widget_api_check(int ver)
416 if (ver != ELM_INTERNAL_API_VERSION)
418 CRITICAL("Elementary widget api versions do not match");
425 elm_widget_add(Evas *evas)
429 obj = evas_object_smart_add(evas, _e_smart);
430 elm_widget_mirrored_set(obj, elm_mirrored_get());
435 elm_widget_del_hook_set(Evas_Object *obj,
436 void (*func)(Evas_Object *obj))
443 elm_widget_del_pre_hook_set(Evas_Object *obj,
444 void (*func)(Evas_Object *obj))
447 sd->del_pre_func = func;
451 elm_widget_focus_hook_set(Evas_Object *obj,
452 void (*func)(Evas_Object *obj))
455 sd->focus_func = func;
459 elm_widget_activate_hook_set(Evas_Object *obj,
460 void (*func)(Evas_Object *obj))
463 sd->activate_func = func;
467 elm_widget_disable_hook_set(Evas_Object *obj,
468 void (*func)(Evas_Object *obj))
471 sd->disable_func = func;
475 elm_widget_theme_hook_set(Evas_Object *obj,
476 void (*func)(Evas_Object *obj))
479 sd->theme_func = func;
483 elm_widget_event_hook_set(Evas_Object *obj,
484 Eina_Bool (*func)(Evas_Object *obj,
486 Evas_Callback_Type type,
490 sd->event_func = func;
494 elm_widget_text_set_hook_set(Evas_Object *obj,
495 void (*func)(Evas_Object *obj,
500 sd->on_text_set_func = func;
504 elm_widget_text_get_hook_set(Evas_Object *obj,
505 const char *(*func)(const Evas_Object *obj,
509 sd->on_text_get_func = func;
513 elm_widget_content_set_hook_set(Evas_Object *obj,
514 void (*func)(Evas_Object *obj,
516 Evas_Object *content))
519 sd->on_content_set_func = func;
523 elm_widget_content_get_hook_set(Evas_Object *obj,
524 Evas_Object *(*func)(const Evas_Object *obj,
528 sd->on_content_get_func = func;
532 elm_widget_content_unset_hook_set(Evas_Object *obj,
533 Evas_Object *(*func)(Evas_Object *obj,
537 sd->on_content_unset_func = func;
541 elm_widget_changed_hook_set(Evas_Object *obj,
542 void (*func)(Evas_Object *obj))
545 sd->changed_func = func;
549 elm_widget_signal_emit_hook_set(Evas_Object *obj,
550 void (*func)(Evas_Object *obj,
551 const char *emission,
555 sd->signal_func = func;
559 elm_widget_signal_callback_add_hook_set(Evas_Object *obj,
560 void (*func)(Evas_Object *obj,
561 const char *emission,
563 Edje_Signal_Cb func_cb,
567 sd->callback_add_func = func;
571 elm_widget_signal_callback_del_hook_set(Evas_Object *obj,
572 void (*func)(Evas_Object *obj,
573 const char *emission,
575 Edje_Signal_Cb func_cb,
579 sd->callback_del_func = func;
583 elm_widget_theme(Evas_Object *obj)
591 EINA_LIST_FOREACH(sd->subobjs, l, child) elm_widget_theme(child);
592 if (sd->resize_obj) elm_widget_theme(sd->resize_obj);
593 if (sd->hover_obj) elm_widget_theme(sd->hover_obj);
594 EINA_LIST_FOREACH(sd->tooltips, l, tt) elm_tooltip_theme(tt);
595 EINA_LIST_FOREACH(sd->cursors, l, cur) elm_cursor_theme(cur);
596 if (sd->theme_func) sd->theme_func(obj);
600 elm_widget_theme_specific(Evas_Object *obj,
608 Elm_Theme *th2, *thdef;
611 thdef = elm_theme_default_get();
616 if (!th2) th2 = thdef;
624 if (th2 == thdef) break;
625 th2 = th2->ref_theme;
626 if (!th2) th2 = thdef;
630 EINA_LIST_FOREACH(sd->subobjs, l, child)
631 elm_widget_theme_specific(child, th, force);
632 if (sd->resize_obj) elm_widget_theme(sd->resize_obj);
633 if (sd->hover_obj) elm_widget_theme(sd->hover_obj);
634 EINA_LIST_FOREACH(sd->tooltips, l, tt) elm_tooltip_theme(tt);
635 EINA_LIST_FOREACH(sd->cursors, l, cur) elm_cursor_theme(cur);
636 if (sd->theme_func) sd->theme_func(obj);
642 * Set hook to get next object in object focus chain.
644 * @param obj The widget object.
645 * @param func The hook to be used with this widget.
650 elm_widget_focus_next_hook_set(Evas_Object *obj,
651 Eina_Bool (*func)(const Evas_Object *obj,
652 Elm_Focus_Direction dir,
656 sd->focus_next_func = func;
660 * Returns the widget's mirrored mode.
662 * @param obj The widget.
663 * @return mirrored mode of the object.
667 elm_widget_mirrored_get(const Evas_Object *obj)
669 API_ENTRY return EINA_FALSE;
670 return sd->is_mirrored;
674 * Sets the widget's mirrored mode.
676 * @param obj The widget.
677 * @param mirrored EINA_TRUE to set mirrored mode. EINA_FALSE to unset.
680 elm_widget_mirrored_set(Evas_Object *obj,
684 if (sd->is_mirrored != mirrored)
686 sd->is_mirrored = mirrored;
687 elm_widget_theme(obj);
693 * Resets the mirrored mode from the system mirror mode for widgets that are in
694 * automatic mirroring mode. This function does not call elm_widget_theme.
696 * @param obj The widget.
697 * @param mirrored EINA_TRUE to set mirrored mode. EINA_FALSE to unset.
700 _elm_widget_mirrored_reload(Evas_Object *obj)
703 Eina_Bool mirrored = elm_mirrored_get();
704 if (elm_widget_mirrored_automatic_get(obj) && (sd->is_mirrored != mirrored))
706 sd->is_mirrored = mirrored;
711 * Returns the widget's mirrored mode setting.
713 * @param obj The widget.
714 * @return mirrored mode setting of the object.
718 elm_widget_mirrored_automatic_get(const Evas_Object *obj)
720 API_ENTRY return EINA_FALSE;
721 return sd->mirrored_auto_mode;
725 * Sets the widget's mirrored mode setting.
726 * When widget in automatic mode, it follows the system mirrored mode set by
727 * elm_mirrored_set().
728 * @param obj The widget.
729 * @param automatic EINA_TRUE for auto mirrored mode. EINA_FALSE for manual.
732 elm_widget_mirrored_automatic_set(Evas_Object *obj,
736 if (sd->mirrored_auto_mode != automatic)
738 sd->mirrored_auto_mode = automatic;
742 elm_widget_mirrored_set(obj, elm_mirrored_get());
748 elm_widget_on_focus_hook_set(Evas_Object *obj,
749 void (*func)(void *data,
754 sd->on_focus_func = func;
755 sd->on_focus_data = data;
759 elm_widget_on_change_hook_set(Evas_Object *obj,
760 void (*func)(void *data,
765 sd->on_change_func = func;
766 sd->on_change_data = data;
770 elm_widget_on_show_region_hook_set(Evas_Object *obj,
771 void (*func)(void *data,
776 sd->on_show_region_func = func;
777 sd->on_show_region_data = data;
783 * Set the hook to use to show the focused region.
785 * Whenever a new widget gets focused or it's needed to show the focused
786 * area of the current one, this hook will be called on objects that may
787 * want to move their children into their visible area.
788 * The area given in the hook function is relative to the @p obj widget.
790 * @param obj The widget object
791 * @param func The function to call to show the specified area.
796 elm_widget_focus_region_hook_set(Evas_Object *obj,
797 void (*func)(Evas_Object *obj,
804 sd->focus_region_func = func;
810 * Set the hook to retrieve the focused region of a widget.
812 * This hook will be called by elm_widget_focus_region_get() whenever
813 * it's needed to get the focused area of a widget. The area must be relative
814 * to the widget itself and if no hook is set, it will default to the entire
817 * @param obj The widget object
818 * @param func The function used to retrieve the focus region.
823 elm_widget_on_focus_region_hook_set(Evas_Object *obj,
824 void (*func)(const Evas_Object *obj,
831 sd->on_focus_region_func = func;
835 elm_widget_data_set(Evas_Object *obj,
843 elm_widget_data_get(const Evas_Object *obj)
845 API_ENTRY return NULL;
850 elm_widget_sub_object_add(Evas_Object *obj,
854 double scale, pscale = elm_widget_scale_get(sobj);
855 Elm_Theme *th, *pth = elm_widget_theme_get(sobj);
856 Eina_Bool mirrored, pmirrored = elm_widget_mirrored_get(obj);
858 if (_elm_widget_is(sobj))
860 Smart_Data *sd2 = evas_object_smart_data_get(sobj);
863 if (sd2->parent_obj == obj)
866 elm_widget_sub_object_del(sd2->parent_obj, sobj);
867 sd2->parent_obj = obj;
868 if (!sd->child_can_focus && (_is_focusable(sobj)))
869 sd->child_can_focus = EINA_TRUE;
874 void *data = evas_object_data_get(sobj, "elm-parent");
877 if (data == obj) return;
878 evas_object_event_callback_del(sobj, EVAS_CALLBACK_DEL,
883 sd->subobjs = eina_list_append(sd->subobjs, sobj);
884 evas_object_data_set(sobj, "elm-parent", obj);
885 evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
886 if (_elm_widget_is(sobj))
887 evas_object_event_callback_add(sobj, EVAS_CALLBACK_HIDE, _sub_obj_hide, sd);
888 evas_object_smart_callback_call(obj, "sub-object-add", sobj);
889 scale = elm_widget_scale_get(sobj);
890 th = elm_widget_theme_get(sobj);
891 mirrored = elm_widget_mirrored_get(sobj);
892 if ((scale != pscale) || (th != pth) || (pmirrored != mirrored)) elm_widget_theme(sobj);
893 if (elm_widget_focus_get(sobj)) _focus_parents(obj);
897 elm_widget_sub_object_del(Evas_Object *obj,
900 Evas_Object *sobj_parent;
904 sobj_parent = evas_object_data_del(sobj, "elm-parent");
905 if (sobj_parent != obj)
907 static int abort_on_warn = -1;
908 ERR("removing sub object %p from parent %p, "
909 "but elm-parent is different %p!",
910 sobj, obj, sobj_parent);
911 if (EINA_UNLIKELY(abort_on_warn == -1))
913 if (getenv("ELM_ERROR_ABORT")) abort_on_warn = 1;
914 else abort_on_warn = 0;
916 if (abort_on_warn == 1) abort();
918 if (_elm_widget_is(sobj))
920 Smart_Data *sd2 = evas_object_smart_data_get(sobj);
923 sd2->parent_obj = NULL;
924 if (sd2->resize_obj == sobj)
925 sd2->resize_obj = NULL;
927 sd->subobjs = eina_list_remove(sd->subobjs, sobj);
930 sd->subobjs = eina_list_remove(sd->subobjs, sobj);
931 if (elm_widget_focus_get(sobj)) _unfocus_parents(obj);
932 if ((sd->child_can_focus) && (_is_focusable(sobj)))
936 sd->child_can_focus = EINA_FALSE;
937 EINA_LIST_FOREACH(sd->subobjs, l, subobj)
939 if (_is_focusable(subobj))
941 sd->child_can_focus = EINA_TRUE;
948 sd->subobjs = eina_list_remove(sd->subobjs, sobj);
949 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL,
951 if (_elm_widget_is(sobj))
952 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_HIDE,
954 evas_object_smart_callback_call(obj, "sub-object-del", sobj);
958 elm_widget_resize_object_set(Evas_Object *obj,
962 // orphan previous resize obj
965 evas_object_clip_unset(sd->resize_obj);
966 evas_object_data_del(sd->resize_obj, "elm-parent");
967 if (_elm_widget_is(sd->resize_obj))
969 Smart_Data *sd2 = evas_object_smart_data_get(sd->resize_obj);
970 if (sd2) sd2->parent_obj = NULL;
971 evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_HIDE,
974 evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_DEL,
976 evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_MOUSE_DOWN,
977 _sub_obj_mouse_down, sd);
978 evas_object_smart_member_del(sd->resize_obj);
979 if (_elm_widget_is(sd->resize_obj))
981 if (elm_widget_focus_get(sd->resize_obj)) _unfocus_parents(obj);
984 // orphan new resize obj
987 evas_object_data_del(sobj, "elm-parent");
988 if (_elm_widget_is(sobj))
990 Smart_Data *sd2 = evas_object_smart_data_get(sobj);
991 if (sd2) sd2->parent_obj = NULL;
992 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_HIDE,
995 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL,
997 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_MOUSE_DOWN,
998 _sub_obj_mouse_down, sd);
999 evas_object_smart_member_del(sobj);
1000 if (_elm_widget_is(sobj))
1002 if (elm_widget_focus_get(sobj)) _unfocus_parents(obj);
1005 // set the resize obj up
1006 sd->resize_obj = sobj;
1009 if (_elm_widget_is(sd->resize_obj))
1011 Smart_Data *sd2 = evas_object_smart_data_get(sd->resize_obj);
1012 if (sd2) sd2->parent_obj = obj;
1013 evas_object_event_callback_add(sobj, EVAS_CALLBACK_HIDE,
1016 evas_object_clip_set(sobj, evas_object_clip_get(obj));
1017 evas_object_smart_member_add(sobj, obj);
1018 evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL,
1020 evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_DOWN,
1021 _sub_obj_mouse_down, sd);
1022 _smart_reconfigure(sd);
1023 evas_object_data_set(sobj, "elm-parent", obj);
1024 evas_object_smart_callback_call(obj, "sub-object-add", sobj);
1025 if (_elm_widget_is(sobj))
1027 if (elm_widget_focus_get(sobj)) _focus_parents(obj);
1033 elm_widget_hover_object_set(Evas_Object *obj,
1039 evas_object_event_callback_del_full(sd->hover_obj, EVAS_CALLBACK_DEL,
1042 sd->hover_obj = sobj;
1045 evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL,
1047 _smart_reconfigure(sd);
1052 elm_widget_can_focus_set(Evas_Object *obj,
1053 Eina_Bool can_focus)
1056 sd->can_focus = can_focus;
1059 evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN,
1061 (void *)(long)EVAS_CALLBACK_KEY_DOWN);
1062 evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_UP,
1064 (void *)(long)EVAS_CALLBACK_KEY_UP);
1065 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_WHEEL,
1067 (void *)(long)EVAS_CALLBACK_MOUSE_WHEEL);
1071 evas_object_event_callback_del(obj, EVAS_CALLBACK_KEY_DOWN,
1073 evas_object_event_callback_del(obj, EVAS_CALLBACK_KEY_UP,
1075 evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_WHEEL,
1081 elm_widget_can_focus_get(const Evas_Object *obj)
1083 API_ENTRY return EINA_FALSE;
1084 return sd->can_focus;
1088 elm_widget_child_can_focus_get(const Evas_Object *obj)
1090 API_ENTRY return EINA_FALSE;
1091 return sd->child_can_focus;
1097 * This API makes the widget object and its children to be unfocusable.
1099 * This API can be helpful for an object to be deleted.
1100 * When an object will be deleted soon, it and its children may not
1101 * want to get focus (by focus reverting or by other focus controls).
1102 * Then, just use this API before deleting.
1104 * @param obj The widget root of sub-tree
1105 * @param tree_unfocusable If true, set the object sub-tree as unfocusable
1110 elm_widget_tree_unfocusable_set(Evas_Object *obj,
1111 Eina_Bool tree_unfocusable)
1115 if (sd->tree_unfocusable == tree_unfocusable) return;
1116 sd->tree_unfocusable = !!tree_unfocusable;
1117 elm_widget_focus_tree_unfocusable_handle(obj);
1123 * This returns true, if the object sub-tree is unfocusable.
1125 * @param obj The widget root of sub-tree
1126 * @return EINA_TRUE if the object sub-tree is unfocusable
1131 elm_widget_tree_unfocusable_get(const Evas_Object *obj)
1133 API_ENTRY return EINA_FALSE;
1134 return sd->tree_unfocusable;
1138 elm_widget_highlight_ignore_set(Evas_Object *obj,
1142 sd->highlight_ignore = !!ignore;
1146 elm_widget_highlight_ignore_get(const Evas_Object *obj)
1148 API_ENTRY return EINA_FALSE;
1149 return sd->highlight_ignore;
1153 elm_widget_highlight_in_theme_set(Evas_Object *obj,
1154 Eina_Bool highlight)
1157 sd->highlight_in_theme = !!highlight;
1158 /* FIXME: if focused, it should switch from one mode to the other */
1162 elm_widget_highlight_in_theme_get(const Evas_Object *obj)
1164 API_ENTRY return EINA_FALSE;
1165 return sd->highlight_in_theme;
1169 elm_widget_focus_get(const Evas_Object *obj)
1171 API_ENTRY return EINA_FALSE;
1176 elm_widget_focused_object_get(const Evas_Object *obj)
1178 const Evas_Object *subobj;
1180 API_ENTRY return NULL;
1182 if (!sd->focused) return NULL;
1183 EINA_LIST_FOREACH(sd->subobjs, l, subobj)
1185 Evas_Object *fobj = elm_widget_focused_object_get(subobj);
1186 if (fobj) return fobj;
1188 return (Evas_Object *)obj;
1192 elm_widget_top_get(const Evas_Object *obj)
1194 API_ENTRY return NULL;
1195 if (sd->parent_obj) return elm_widget_top_get(sd->parent_obj);
1196 return (Evas_Object *)obj;
1200 elm_widget_is(const Evas_Object *obj)
1202 return _elm_widget_is(obj);
1206 elm_widget_parent_widget_get(const Evas_Object *obj)
1208 Evas_Object *parent;
1210 if (_elm_widget_is(obj))
1212 Smart_Data *sd = evas_object_smart_data_get(obj);
1213 if (!sd) return NULL;
1214 parent = sd->parent_obj;
1218 parent = evas_object_data_get(obj, "elm-parent");
1219 if (!parent) parent = evas_object_smart_parent_get(obj);
1224 Evas_Object *elm_parent;
1225 if (_elm_widget_is(parent)) break;
1226 elm_parent = evas_object_data_get(parent, "elm-parent");
1227 if (elm_parent) parent = elm_parent;
1228 else parent = evas_object_smart_parent_get(parent);
1234 elm_widget_event_callback_add(Evas_Object *obj,
1239 EINA_SAFETY_ON_NULL_RETURN(func);
1240 Elm_Event_Cb_Data *ecb = ELM_NEW(Elm_Event_Cb_Data);
1243 sd->event_cb = eina_list_append(sd->event_cb, ecb);
1247 elm_widget_event_callback_del(Evas_Object *obj,
1251 API_ENTRY return NULL;
1252 EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
1254 Elm_Event_Cb_Data *ecd;
1255 EINA_LIST_FOREACH(sd->event_cb, l, ecd)
1256 if ((ecd->func == func) && (ecd->data == data))
1259 sd->event_cb = eina_list_remove_list(sd->event_cb, l);
1260 return (void *)data;
1266 elm_widget_event_propagate(Evas_Object *obj,
1267 Evas_Callback_Type type,
1269 Evas_Event_Flags *event_flags)
1271 API_ENTRY return EINA_FALSE; //TODO reduce.
1272 if (!_elm_widget_is(obj)) return EINA_FALSE;
1273 Evas_Object *parent = obj;
1274 Elm_Event_Cb_Data *ecd;
1275 Eina_List *l, *l_prev;
1278 (!(event_flags && ((*event_flags) & EVAS_EVENT_FLAG_ON_HOLD))))
1280 sd = evas_object_smart_data_get(parent);
1281 if ((!sd) || (!_elm_widget_is(obj)))
1282 return EINA_FALSE; //Not Elm Widget
1284 if (sd->event_func && (sd->event_func(parent, obj, type, event_info)))
1287 EINA_LIST_FOREACH_SAFE(sd->event_cb, l, l_prev, ecd)
1289 if (ecd->func((void *)ecd->data, parent, obj, type, event_info) ||
1290 (event_flags && ((*event_flags) & EVAS_EVENT_FLAG_ON_HOLD)))
1293 parent = sd->parent_obj;
1302 * Set custom focus chain.
1304 * This function i set one new and overwrite any previous custom focus chain
1305 * with the list of objects. The previous list will be deleted and this list
1306 * will be managed. After setted, don't modity it.
1308 * @note On focus cycle, only will be evaluated children of this container.
1310 * @param obj The container widget
1311 * @param objs Chain of objects to pass focus
1315 elm_widget_focus_custom_chain_set(Evas_Object *obj,
1319 if (!sd->focus_next_func)
1322 elm_widget_focus_custom_chain_unset(obj);
1327 EINA_LIST_FOREACH(objs, l, o)
1329 evas_object_event_callback_add(o, EVAS_CALLBACK_DEL,
1330 _elm_object_focus_chain_del_cb, sd);
1333 sd->focus_chain = objs;
1339 * Get custom focus chain
1341 * @param obj The container widget
1344 EAPI const Eina_List *
1345 elm_widget_focus_custom_chain_get(const Evas_Object *obj)
1347 API_ENTRY return NULL;
1348 return (const Eina_List *)sd->focus_chain;
1354 * Unset custom focus chain
1356 * @param obj The container widget
1360 elm_widget_focus_custom_chain_unset(Evas_Object *obj)
1363 Eina_List *l, *l_next;
1366 EINA_LIST_FOREACH_SAFE(sd->focus_chain, l, l_next, o)
1368 evas_object_event_callback_del_full(o, EVAS_CALLBACK_DEL,
1369 _elm_object_focus_chain_del_cb, sd);
1370 sd->focus_chain = eina_list_remove_list(sd->focus_chain, l);
1377 * Append object to custom focus chain.
1379 * @note If relative_child equal to NULL or not in custom chain, the object
1380 * will be added in end.
1382 * @note On focus cycle, only will be evaluated children of this container.
1384 * @param obj The container widget
1385 * @param child The child to be added in custom chain
1386 * @param relative_child The relative object to position the child
1390 elm_widget_focus_custom_chain_append(Evas_Object *obj,
1392 Evas_Object *relative_child)
1395 EINA_SAFETY_ON_NULL_RETURN(child);
1396 if (!sd->focus_next_func)
1399 evas_object_event_callback_del_full(child, EVAS_CALLBACK_DEL,
1400 _elm_object_focus_chain_del_cb, sd);
1402 if (!relative_child)
1404 sd->focus_chain = eina_list_append(sd->focus_chain, child);
1408 sd->focus_chain = eina_list_append_relative(sd->focus_chain, child, relative_child);
1415 * Prepend object to custom focus chain.
1417 * @note If relative_child equal to NULL or not in custom chain, the object
1418 * will be added in begin.
1420 * @note On focus cycle, only will be evaluated children of this container.
1422 * @param obj The container widget
1423 * @param child The child to be added in custom chain
1424 * @param relative_child The relative object to position the child
1428 elm_widget_focus_custom_chain_prepend(Evas_Object *obj,
1430 Evas_Object *relative_child)
1433 EINA_SAFETY_ON_NULL_RETURN(child);
1434 if (!sd->focus_next_func)
1437 evas_object_event_callback_del_full(child, EVAS_CALLBACK_DEL,
1438 _elm_object_focus_chain_del_cb, sd);
1440 if (!relative_child)
1442 sd->focus_chain = eina_list_prepend(sd->focus_chain, child);
1446 sd->focus_chain = eina_list_prepend_relative(sd->focus_chain, child, relative_child);
1453 * Give focus to next object in object tree.
1455 * Give focus to next object in focus chain of one object sub-tree.
1456 * If the last object of chain already have focus, the focus will go to the
1457 * first object of chain.
1459 * @param obj The widget root of sub-tree
1460 * @param dir Direction to cycle the focus
1465 elm_widget_focus_cycle(Evas_Object *obj,
1466 Elm_Focus_Direction dir)
1468 Evas_Object *target = NULL;
1469 if (!_elm_widget_is(obj))
1471 elm_widget_focus_next_get(obj, dir, &target);
1473 elm_widget_focus_steal(target);
1479 * Give focus to near object in one direction.
1481 * Give focus to near object in direction of one object.
1482 * If none focusable object in given direction, the focus will not change.
1484 * @param obj The reference widget
1485 * @param x Horizontal component of direction to focus
1486 * @param y Vertical component of direction to focus
1491 elm_widget_focus_direction_go(Evas_Object *obj __UNUSED__,
1501 * Get next object in focus chain of object tree.
1503 * Get next object in focus chain of one object sub-tree.
1504 * Return the next object by reference. If don't have any candidate to receive
1505 * focus before chain end, the first candidate will be returned.
1507 * @param obj The widget root of sub-tree
1508 * @param dir Direction os focus chain
1509 * @param next The next object in focus chain
1510 * @return EINA_TRUE if don't need focus chain restart/loop back
1511 * to use 'next' obj.
1516 elm_widget_focus_next_get(const Evas_Object *obj,
1517 Elm_Focus_Direction dir,
1524 API_ENTRY return EINA_FALSE;
1526 /* Ignore if disabled */
1527 if ((!evas_object_visible_get(obj))
1528 || (elm_widget_disabled_get(obj))
1529 || (elm_widget_tree_unfocusable_get(obj)))
1533 if (sd->focus_next_func)
1534 return sd->focus_next_func(obj, dir, next);
1536 if (!elm_widget_can_focus_get(obj))
1540 *next = (Evas_Object *)obj;
1541 return !elm_widget_focus_get(obj);
1547 * Get next object in focus chain of object tree in list.
1549 * Get next object in focus chain of one object sub-tree ordered by one list.
1550 * Return the next object by reference. If don't have any candidate to receive
1551 * focus before list end, the first candidate will be returned.
1553 * @param obj The widget root of sub-tree
1554 * @param dir Direction os focus chain
1555 * @param items list with ordered objects
1556 * @param list_data_get function to get the object from one item of list
1557 * @param next The next object in focus chain
1558 * @return EINA_TRUE if don't need focus chain restart/loop back
1559 * to use 'next' obj.
1564 elm_widget_focus_list_next_get(const Evas_Object *obj,
1565 const Eina_List *items,
1566 void *(*list_data_get)(const Eina_List * list),
1567 Elm_Focus_Direction dir,
1570 Eina_List *(*list_next)(const Eina_List * list);
1576 if (!_elm_widget_is(obj))
1583 if (dir == ELM_FOCUS_PREVIOUS)
1585 items = eina_list_last(items);
1586 list_next = eina_list_prev;
1588 else if (dir == ELM_FOCUS_NEXT)
1589 list_next = eina_list_next;
1593 const Eina_List *l = items;
1595 /* Recovery last focused sub item */
1596 if (elm_widget_focus_get(obj))
1597 for (; l; l = list_next(l))
1599 Evas_Object *cur = list_data_get(l);
1600 if (elm_widget_focus_get(cur)) break;
1603 const Eina_List *start = l;
1604 Evas_Object *to_focus = NULL;
1606 /* Interate sub items */
1607 /* Go to end of list */
1608 for (; l; l = list_next(l))
1610 Evas_Object *tmp = NULL;
1611 Evas_Object *cur = list_data_get(l);
1613 if (elm_widget_parent_get(cur) != obj)
1616 /* Try Focus cycle in subitem */
1617 if (elm_widget_focus_next_get(cur, dir, &tmp))
1622 else if ((tmp) && (!to_focus))
1628 /* Get First possible */
1629 for (; l != start; l = list_next(l))
1631 Evas_Object *tmp = NULL;
1632 Evas_Object *cur = list_data_get(l);
1634 if (elm_widget_parent_get(cur) != obj)
1637 /* Try Focus cycle in subitem */
1638 elm_widget_focus_next_get(cur, dir, &tmp);
1651 elm_widget_signal_emit(Evas_Object *obj,
1652 const char *emission,
1656 if (!sd->signal_func) return;
1657 sd->signal_func(obj, emission, source);
1661 _edje_signal_callback(void *data,
1662 Evas_Object *obj __UNUSED__,
1663 const char *emission,
1666 Edje_Signal_Data *esd = data;
1667 esd->func(esd->data, esd->obj, emission, source);
1671 elm_widget_signal_callback_add(Evas_Object *obj,
1672 const char *emission,
1674 Edje_Signal_Cb func,
1677 Edje_Signal_Data *esd;
1679 if (!sd->callback_add_func) return;
1680 EINA_SAFETY_ON_NULL_RETURN(func);
1682 esd = ELM_NEW(Edje_Signal_Data);
1687 esd->emission = eina_stringshare_add(emission);
1688 esd->source = eina_stringshare_add(source);
1690 sd->edje_signals = eina_list_append(sd->edje_signals, esd);
1691 sd->callback_add_func(obj, emission, source, _edje_signal_callback, esd);
1695 elm_widget_signal_callback_del(Evas_Object *obj,
1696 const char *emission,
1698 Edje_Signal_Cb func)
1700 Edje_Signal_Data *esd;
1703 API_ENTRY return NULL;
1704 if (!sd->callback_del_func) return NULL;
1706 EINA_LIST_FOREACH(sd->edje_signals, l, esd)
1708 if ((esd->func == func) && (!strcmp(esd->emission, emission)) &&
1709 (!strcmp(esd->source, source)))
1711 sd->edje_signals = eina_list_remove_list(sd->edje_signals, l);
1712 eina_stringshare_del(esd->emission);
1713 eina_stringshare_del(esd->source);
1719 sd->callback_del_func(obj, emission, source, _edje_signal_callback, esd);
1724 elm_widget_focus_set(Evas_Object *obj,
1731 sd->focus_order = focus_order;
1732 sd->focused = EINA_TRUE;
1733 if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
1737 sd->focus_func(obj);
1744 if ((_is_focusable(sd->resize_obj)) &&
1745 (!elm_widget_disabled_get(sd->resize_obj)))
1747 elm_widget_focus_set(sd->resize_obj, first);
1753 EINA_LIST_FOREACH(sd->subobjs, l, child)
1755 if ((_is_focusable(child)) &&
1756 (!elm_widget_disabled_get(child)))
1758 elm_widget_focus_set(child, first);
1768 EINA_LIST_REVERSE_FOREACH(sd->subobjs, l, child)
1770 if ((_is_focusable(child)) &&
1771 (!elm_widget_disabled_get(child)))
1773 elm_widget_focus_set(child, first);
1779 if ((_is_focusable(sd->resize_obj)) &&
1780 (!elm_widget_disabled_get(sd->resize_obj)))
1782 elm_widget_focus_set(sd->resize_obj, first);
1790 elm_widget_parent_get(const Evas_Object *obj)
1792 API_ENTRY return NULL;
1793 return sd->parent_obj;
1797 elm_widget_focused_object_clear(Evas_Object *obj)
1800 if (!sd->focused) return;
1801 if (elm_widget_focus_get(sd->resize_obj))
1802 elm_widget_focused_object_clear(sd->resize_obj);
1807 EINA_LIST_FOREACH(sd->subobjs, l, child)
1809 if (elm_widget_focus_get(child))
1811 elm_widget_focused_object_clear(child);
1816 sd->focused = EINA_FALSE;
1817 if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
1818 if (sd->focus_func) sd->focus_func(obj);
1822 elm_widget_focus_steal(Evas_Object *obj)
1824 Evas_Object *parent, *o;
1827 if (sd->focused) return;
1828 if (sd->disabled) return;
1829 if (!sd->can_focus) return;
1830 if (sd->tree_unfocusable) return;
1834 o = elm_widget_parent_get(parent);
1836 sd = evas_object_smart_data_get(o);
1837 if (sd->disabled || sd->tree_unfocusable) return;
1838 if (sd->focused) break;
1841 if (!elm_widget_parent_get(parent))
1842 elm_widget_focused_object_clear(parent);
1845 parent = elm_widget_parent_get(parent);
1846 sd = evas_object_smart_data_get(parent);
1847 if ((sd->resize_obj) && (elm_widget_focus_get(sd->resize_obj)))
1848 elm_widget_focused_object_clear(sd->resize_obj);
1853 EINA_LIST_FOREACH(sd->subobjs, l, child)
1855 if (elm_widget_focus_get(child))
1857 elm_widget_focused_object_clear(child);
1868 elm_widget_activate(Evas_Object *obj)
1871 elm_widget_change(obj);
1872 if (sd->activate_func) sd->activate_func(obj);
1876 elm_widget_change(Evas_Object *obj)
1879 elm_widget_change(elm_widget_parent_get(obj));
1880 if (sd->on_change_func) sd->on_change_func(sd->on_change_data, obj);
1884 elm_widget_disabled_set(Evas_Object *obj,
1889 if (sd->disabled == disabled) return;
1890 sd->disabled = !!disabled;
1891 elm_widget_focus_disabled_handle(obj);
1892 if (sd->disable_func) sd->disable_func(obj);
1896 elm_widget_disabled_get(const Evas_Object *obj)
1899 return sd->disabled;
1903 elm_widget_show_region_set(Evas_Object *obj,
1908 Eina_Bool forceshow)
1910 Evas_Object *parent_obj, *child_obj;
1911 Evas_Coord px, py, cx, cy;
1914 if (!forceshow && (x == sd->rx) && (y == sd->ry)
1915 && (w == sd->rw) && (h == sd->rh)) return;
1920 if (sd->on_show_region_func)
1921 sd->on_show_region_func(sd->on_show_region_data, obj);
1925 parent_obj = sd->parent_obj;
1926 child_obj = sd->obj;
1927 if ((!parent_obj) || (!_elm_widget_is(parent_obj))) break;
1928 sd = evas_object_smart_data_get(parent_obj);
1931 evas_object_geometry_get(parent_obj, &px, &py, NULL, NULL);
1932 evas_object_geometry_get(child_obj, &cx, &cy, NULL, NULL);
1941 if (sd->on_show_region_func)
1943 sd->on_show_region_func(sd->on_show_region_data, parent_obj);
1950 elm_widget_show_region_get(const Evas_Object *obj,
1966 * Get the focus region of the given widget.
1968 * The focus region is the area of a widget that should brought into the
1969 * visible area when the widget is focused. Mostly used to show the part of
1970 * an entry where the cursor is, for example. The area returned is relative
1971 * to the object @p obj.
1972 * If the @p obj doesn't have the proper on_focus_region_hook set, this
1973 * function will return the full size of the object.
1975 * @param obj The widget object
1976 * @param x Where to store the x coordinate of the area
1977 * @param y Where to store the y coordinate of the area
1978 * @param w Where to store the width of the area
1979 * @param h Where to store the height of the area
1984 elm_widget_focus_region_get(const Evas_Object *obj,
1994 sd = evas_object_smart_data_get(obj);
1995 if (!sd || !_elm_widget_is(obj) || !sd->on_focus_region_func)
1997 evas_object_geometry_get(obj, NULL, NULL, w, h);
2002 sd->on_focus_region_func(obj, x, y, w, h);
2006 elm_widget_scroll_hold_push(Evas_Object *obj)
2010 if (sd->scroll_hold == 1)
2011 evas_object_smart_callback_call(obj, "scroll-hold-on", obj);
2012 if (sd->parent_obj) elm_widget_scroll_hold_push(sd->parent_obj);
2013 // FIXME: on delete/reparent hold pop
2017 elm_widget_scroll_hold_pop(Evas_Object *obj)
2021 if (sd->scroll_hold < 0) sd->scroll_hold = 0;
2022 if (!sd->scroll_hold)
2023 evas_object_smart_callback_call(obj, "scroll-hold-off", obj);
2024 if (sd->parent_obj) elm_widget_scroll_hold_pop(sd->parent_obj);
2028 elm_widget_scroll_hold_get(const Evas_Object *obj)
2031 return sd->scroll_hold;
2035 elm_widget_scroll_freeze_push(Evas_Object *obj)
2038 sd->scroll_freeze++;
2039 if (sd->scroll_freeze == 1)
2040 evas_object_smart_callback_call(obj, "scroll-freeze-on", obj);
2041 if (sd->parent_obj) elm_widget_scroll_freeze_push(sd->parent_obj);
2042 // FIXME: on delete/reparent freeze pop
2046 elm_widget_scroll_freeze_pop(Evas_Object *obj)
2049 sd->scroll_freeze--;
2050 if (sd->scroll_freeze < 0) sd->scroll_freeze = 0;
2051 if (!sd->scroll_freeze)
2052 evas_object_smart_callback_call(obj, "scroll-freeze-off", obj);
2053 if (sd->parent_obj) elm_widget_scroll_freeze_pop(sd->parent_obj);
2057 elm_widget_scroll_freeze_get(const Evas_Object *obj)
2060 return sd->scroll_freeze;
2064 elm_widget_scale_set(Evas_Object *obj,
2068 if (scale <= 0.0) scale = 0.0;
2069 if (sd->scale != scale)
2072 elm_widget_theme(obj);
2077 elm_widget_scale_get(const Evas_Object *obj)
2079 API_ENTRY return 1.0;
2080 // FIXME: save walking up the tree by storing/caching parent scale
2081 if (sd->scale == 0.0)
2084 return elm_widget_scale_get(sd->parent_obj);
2092 elm_widget_theme_set(Evas_Object *obj,
2096 if (sd->theme != th)
2098 if (sd->theme) elm_theme_free(sd->theme);
2101 elm_widget_theme(obj);
2106 elm_widget_text_part_set(Evas_Object *obj, const char *item, const char *label)
2110 if (!sd->on_text_set_func)
2113 sd->on_text_set_func(obj, item, label);
2117 elm_widget_text_part_get(const Evas_Object *obj, const char *item)
2119 API_ENTRY return NULL;
2121 if (!sd->on_text_get_func)
2124 return sd->on_text_get_func(obj, item);
2128 elm_widget_content_part_set(Evas_Object *obj, const char *item, Evas_Object *content)
2132 if (!sd->on_content_set_func) return;
2133 sd->on_content_set_func(obj, item, content);
2137 elm_widget_content_part_get(const Evas_Object *obj, const char *item)
2139 API_ENTRY return NULL;
2141 if (!sd->on_content_get_func) return NULL;
2142 return sd->on_content_get_func(obj, item);
2146 elm_widget_content_part_unset(Evas_Object *obj, const char *item)
2148 API_ENTRY return NULL;
2150 if (!sd->on_content_unset_func) return NULL;
2151 return sd->on_content_unset_func(obj, item);
2155 elm_widget_theme_get(const Evas_Object *obj)
2157 API_ENTRY return NULL;
2161 return elm_widget_theme_get(sd->parent_obj);
2169 elm_widget_style_set(Evas_Object *obj,
2174 if (eina_stringshare_replace(&sd->style, style))
2175 elm_widget_theme(obj);
2179 elm_widget_style_get(const Evas_Object *obj)
2181 API_ENTRY return NULL;
2182 if (sd->style) return sd->style;
2187 elm_widget_type_set(Evas_Object *obj,
2191 eina_stringshare_replace(&sd->type, type);
2195 elm_widget_type_get(const Evas_Object *obj)
2197 API_ENTRY return NULL;
2198 if (sd->type) return sd->type;
2203 elm_widget_tooltip_add(Evas_Object *obj,
2207 sd->tooltips = eina_list_append(sd->tooltips, tt);
2211 elm_widget_tooltip_del(Evas_Object *obj,
2215 sd->tooltips = eina_list_remove(sd->tooltips, tt);
2219 elm_widget_cursor_add(Evas_Object *obj,
2223 sd->cursors = eina_list_append(sd->cursors, cur);
2227 elm_widget_cursor_del(Evas_Object *obj,
2231 sd->cursors = eina_list_remove(sd->cursors, cur);
2235 elm_widget_drag_lock_x_set(Evas_Object *obj,
2239 if (sd->drag_x_locked == lock) return;
2240 sd->drag_x_locked = lock;
2241 if (sd->drag_x_locked) _propagate_x_drag_lock(obj, 1);
2242 else _propagate_x_drag_lock(obj, -1);
2246 elm_widget_drag_lock_y_set(Evas_Object *obj,
2250 if (sd->drag_y_locked == lock) return;
2251 sd->drag_y_locked = lock;
2252 if (sd->drag_y_locked) _propagate_y_drag_lock(obj, 1);
2253 else _propagate_y_drag_lock(obj, -1);
2257 elm_widget_drag_lock_x_get(const Evas_Object *obj)
2259 API_ENTRY return EINA_FALSE;
2260 return sd->drag_x_locked;
2264 elm_widget_drag_lock_y_get(const Evas_Object *obj)
2266 API_ENTRY return EINA_FALSE;
2267 return sd->drag_y_locked;
2271 elm_widget_drag_child_locked_x_get(const Evas_Object *obj)
2274 return sd->child_drag_x_locked;
2278 elm_widget_drag_child_locked_y_get(const Evas_Object *obj)
2281 return sd->child_drag_y_locked;
2285 elm_widget_theme_object_set(Evas_Object *obj,
2288 const char *welement,
2291 API_ENTRY return EINA_FALSE;
2292 return _elm_theme_object_set(obj, edj, wname, welement, wstyle);
2296 elm_widget_type_check(const Evas_Object *obj,
2299 const char *provided, *expected = "(unknown)";
2300 static int abort_on_warn = -1;
2301 provided = elm_widget_type_get(obj);
2302 if (EINA_LIKELY(provided == type)) return EINA_TRUE;
2303 if (type) expected = type;
2304 if ((!provided) || (!provided[0]))
2306 provided = evas_object_type_get(obj);
2307 if ((!provided) || (!provided[0]))
2308 provided = "(unknown)";
2310 ERR("Passing Object: %p, of type: '%s' when expecting type: '%s'", obj, provided, expected);
2311 if (abort_on_warn == -1)
2313 if (getenv("ELM_ERROR_ABORT")) abort_on_warn = 1;
2314 else abort_on_warn = 0;
2316 if (abort_on_warn == 1) abort();
2323 * Split string in words
2325 * @param str Source string
2326 * @return List of const words
2328 * @see elm_widget_stringlist_free()
2332 elm_widget_stringlist_get(const char *str)
2334 Eina_List *list = NULL;
2336 if (!str) return NULL;
2337 for (b = s = str; 1; s++)
2339 if ((*s == ' ') || (!*s))
2341 char *t = malloc(s - b + 1);
2344 strncpy(t, b, s - b);
2346 list = eina_list_append(list, eina_stringshare_add(t));
2357 elm_widget_stringlist_free(Eina_List *list)
2360 EINA_LIST_FREE(list, s) eina_stringshare_del(s);
2364 elm_widget_focus_hide_handle(Evas_Object *obj)
2366 _if_focused_revert(obj, EINA_TRUE);
2370 elm_widget_focus_mouse_down_handle(Evas_Object *obj)
2372 Evas_Object *o = obj;
2375 if (_elm_widget_is(o)) break;
2376 o = evas_object_smart_parent_get(o);
2380 if (!_is_focusable(o)) return;
2381 elm_widget_focus_steal(o);
2385 elm_widget_focus_tree_unfocusable_handle(Evas_Object *obj)
2389 if (!elm_widget_parent_get(obj))
2390 elm_widget_focused_object_clear(obj);
2392 _if_focused_revert(obj, EINA_TRUE);
2396 elm_widget_focus_disabled_handle(Evas_Object *obj)
2400 elm_widget_focus_tree_unfocusable_handle(obj);
2406 * Allocate a new Elm_Widget_Item-derived structure.
2408 * The goal of this structure is to provide common ground for actions
2409 * that a widget item have, such as the owner widget, callback to
2410 * notify deletion, data pointer and maybe more.
2412 * @param widget the owner widget that holds this item, must be an elm_widget!
2413 * @param alloc_size any number greater than sizeof(Elm_Widget_Item) that will
2414 * be used to allocate memory.
2416 * @return allocated memory that is already zeroed out, or NULL on errors.
2418 * @see elm_widget_item_new() convenience macro.
2419 * @see elm_widget_item_del() to release memory.
2422 EAPI Elm_Widget_Item *
2423 _elm_widget_item_new(Evas_Object *widget,
2426 if (!_elm_widget_is(widget))
2429 Elm_Widget_Item *item;
2431 EINA_SAFETY_ON_TRUE_RETURN_VAL(alloc_size < sizeof(Elm_Widget_Item), NULL);
2432 EINA_SAFETY_ON_TRUE_RETURN_VAL(!_elm_widget_is(widget), NULL);
2434 item = calloc(1, alloc_size);
2435 EINA_SAFETY_ON_NULL_RETURN_VAL(item, NULL);
2437 EINA_MAGIC_SET(item, ELM_WIDGET_ITEM_MAGIC);
2438 item->widget = widget;
2445 * Releases widget item memory, calling back del_cb() if it exists.
2447 * If there is a Elm_Widget_Item::del_cb, then it will be called prior
2448 * to memory release. Note that elm_widget_item_pre_notify_del() calls
2449 * this function and then unset it, thus being useful for 2 step
2450 * cleanup whenever the del_cb may use any of the data that must be
2451 * deleted from item.
2453 * The Elm_Widget_Item::view will be deleted (evas_object_del()) if it
2456 * @param item a valid #Elm_Widget_Item to be deleted.
2457 * @see elm_widget_item_del() convenience macro.
2461 _elm_widget_item_del(Elm_Widget_Item *item)
2463 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2466 item->del_cb((void *)item->data, item->widget, item);
2469 evas_object_del(item->view);
2471 EINA_MAGIC_SET(item, EINA_MAGIC_NONE);
2478 * Notify object will be deleted without actually deleting it.
2480 * This function will callback Elm_Widget_Item::del_cb if it is set
2481 * and then unset it so it is not called twice (ie: from
2482 * elm_widget_item_del()).
2484 * @param item a valid #Elm_Widget_Item to be notified
2485 * @see elm_widget_item_pre_notify_del() convenience macro.
2489 _elm_widget_item_pre_notify_del(Elm_Widget_Item *item)
2491 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2492 if (!item->del_cb) return;
2493 item->del_cb((void *)item->data, item->widget, item);
2494 item->del_cb = NULL;
2500 * Set the function to notify when item is being deleted.
2502 * This function will complain if there was a callback set already,
2503 * however it will set the new one.
2505 * The callback will be called from elm_widget_item_pre_notify_del()
2506 * or elm_widget_item_del() will be called with:
2507 * - data: the Elm_Widget_Item::data value.
2508 * - obj: the Elm_Widget_Item::widget evas object.
2509 * - event_info: the item being deleted.
2511 * @param item a valid #Elm_Widget_Item to be notified
2512 * @see elm_widget_item_del_cb_set() convenience macro.
2516 _elm_widget_item_del_cb_set(Elm_Widget_Item *item,
2517 Evas_Smart_Cb del_cb)
2519 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2521 if ((item->del_cb) && (item->del_cb != del_cb))
2522 WRN("You're replacing a previously set del_cb %p of item %p with %p",
2523 item->del_cb, item, del_cb);
2525 item->del_cb = del_cb;
2531 * Set user-data in this item.
2533 * User data may be used to identify this item or just store any
2534 * application data. It is automatically given as the first parameter
2535 * of the deletion notify callback.
2537 * @param item a valid #Elm_Widget_Item to store data in.
2538 * @param data user data to store.
2539 * @see elm_widget_item_del_cb_set() convenience macro.
2543 _elm_widget_item_data_set(Elm_Widget_Item *item,
2546 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2547 if ((item->data) && (item->data != data))
2548 DBG("Replacing item %p data %p with %p", item, item->data, data);
2555 * Retrieves user-data of this item.
2557 * @param item a valid #Elm_Widget_Item to get data from.
2558 * @see elm_widget_item_data_set()
2562 _elm_widget_item_data_get(const Elm_Widget_Item *item)
2564 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
2565 return (void *)item->data;
2568 typedef struct _Elm_Widget_Item_Tooltip Elm_Widget_Item_Tooltip;
2570 struct _Elm_Widget_Item_Tooltip
2572 Elm_Widget_Item *item;
2573 Elm_Tooltip_Item_Content_Cb func;
2574 Evas_Smart_Cb del_cb;
2578 static Evas_Object *
2579 _elm_widget_item_tooltip_label_create(void *data,
2580 Evas_Object *obj __UNUSED__,
2581 Evas_Object *tooltip,
2582 void *item __UNUSED__)
2584 Evas_Object *label = elm_label_add(tooltip);
2587 elm_object_style_set(label, "tooltip");
2588 elm_object_text_set(label, data);
2593 _elm_widget_item_tooltip_label_del_cb(void *data,
2594 Evas_Object *obj __UNUSED__,
2595 void *event_info __UNUSED__)
2597 eina_stringshare_del(data);
2603 * Set the text to be shown in the widget item.
2605 * @param item Target item
2606 * @param text The text to set in the content
2608 * Setup the text as tooltip to object. The item can have only one tooltip,
2609 * so any previous tooltip data is removed.
2614 _elm_widget_item_tooltip_text_set(Elm_Widget_Item *item,
2617 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2618 EINA_SAFETY_ON_NULL_RETURN(text);
2620 text = eina_stringshare_add(text);
2621 _elm_widget_item_tooltip_content_cb_set
2622 (item, _elm_widget_item_tooltip_label_create, text,
2623 _elm_widget_item_tooltip_label_del_cb);
2626 static Evas_Object *
2627 _elm_widget_item_tooltip_create(void *data,
2629 Evas_Object *tooltip)
2631 Elm_Widget_Item_Tooltip *wit = data;
2632 return wit->func((void *)wit->data, obj, tooltip, wit->item);
2636 _elm_widget_item_tooltip_del_cb(void *data,
2638 void *event_info __UNUSED__)
2640 Elm_Widget_Item_Tooltip *wit = data;
2641 if (wit->del_cb) wit->del_cb((void *)wit->data, obj, wit->item);
2648 * Set the content to be shown in the tooltip item
2650 * Setup the tooltip to item. The item can have only one tooltip,
2651 * so any previous tooltip data is removed. @p func(with @p data) will
2652 * be called every time that need show the tooltip and it should
2653 * return a valid Evas_Object. This object is then managed fully by
2654 * tooltip system and is deleted when the tooltip is gone.
2656 * @param item the widget item being attached a tooltip.
2657 * @param func the function used to create the tooltip contents.
2658 * @param data what to provide to @a func as callback data/context.
2659 * @param del_cb called when data is not needed anymore, either when
2660 * another callback replaces @func, the tooltip is unset with
2661 * elm_widget_item_tooltip_unset() or the owner @a item
2662 * dies. This callback receives as the first parameter the
2663 * given @a data, and @c event_info is the item.
2668 _elm_widget_item_tooltip_content_cb_set(Elm_Widget_Item *item,
2669 Elm_Tooltip_Item_Content_Cb func,
2671 Evas_Smart_Cb del_cb)
2673 Elm_Widget_Item_Tooltip *wit;
2675 ELM_WIDGET_ITEM_CHECK_OR_GOTO(item, error_noitem);
2679 _elm_widget_item_tooltip_unset(item);
2683 wit = ELM_NEW(Elm_Widget_Item_Tooltip);
2684 if (!wit) goto error;
2688 wit->del_cb = del_cb;
2690 elm_object_sub_tooltip_content_cb_set
2691 (item->view, item->widget, _elm_widget_item_tooltip_create, wit,
2692 _elm_widget_item_tooltip_del_cb);
2697 if (del_cb) del_cb((void *)data, NULL, item);
2700 if (del_cb) del_cb((void *)data, item->widget, item);
2706 * Unset tooltip from item
2708 * @param item widget item to remove previously set tooltip.
2710 * Remove tooltip from item. The callback provided as del_cb to
2711 * elm_widget_item_tooltip_content_cb_set() will be called to notify
2712 * it is not used anymore.
2714 * @see elm_widget_item_tooltip_content_cb_set()
2719 _elm_widget_item_tooltip_unset(Elm_Widget_Item *item)
2721 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2722 elm_object_tooltip_unset(item->view);
2728 * Sets a different style for this item tooltip.
2730 * @note before you set a style you should define a tooltip with
2731 * elm_widget_item_tooltip_content_cb_set() or
2732 * elm_widget_item_tooltip_text_set()
2734 * @param item widget item with tooltip already set.
2735 * @param style the theme style to use (default, transparent, ...)
2740 _elm_widget_item_tooltip_style_set(Elm_Widget_Item *item,
2743 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2744 elm_object_tooltip_style_set(item->view, style);
2748 _elm_widget_item_tooltip_size_restrict_disable(Elm_Widget_Item *item, Eina_Bool disable)
2750 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, EINA_FALSE);
2751 return elm_tooltip_size_restrict_disable(item->view, disable);
2755 _elm_widget_item_tooltip_size_restrict_disabled_get(const Elm_Widget_Item *item)
2757 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, EINA_FALSE);
2758 return elm_tooltip_size_restrict_disabled_get(item->view);
2764 * Get the style for this item tooltip.
2766 * @param item widget item with tooltip already set.
2767 * @return style the theme style in use, defaults to "default". If the
2768 * object does not have a tooltip set, then NULL is returned.
2773 _elm_widget_item_tooltip_style_get(const Elm_Widget_Item *item)
2775 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
2776 return elm_object_tooltip_style_get(item->view);
2780 _elm_widget_item_cursor_set(Elm_Widget_Item *item,
2783 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2784 elm_object_sub_cursor_set(item->view, item->widget, cursor);
2788 _elm_widget_item_cursor_get(const Elm_Widget_Item *item)
2790 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
2791 return elm_object_cursor_get(item->view);
2795 _elm_widget_item_cursor_unset(Elm_Widget_Item *item)
2797 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2798 elm_object_cursor_unset(item->view);
2804 * Sets a different style for this item cursor.
2806 * @note before you set a style you should define a cursor with
2807 * elm_widget_item_cursor_set()
2809 * @param item widget item with cursor already set.
2810 * @param style the theme style to use (default, transparent, ...)
2815 _elm_widget_item_cursor_style_set(Elm_Widget_Item *item,
2818 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2819 elm_object_cursor_style_set(item->view, style);
2825 * Get the style for this item cursor.
2827 * @param item widget item with cursor already set.
2828 * @return style the theme style in use, defaults to "default". If the
2829 * object does not have a cursor set, then NULL is returned.
2834 _elm_widget_item_cursor_style_get(const Elm_Widget_Item *item)
2836 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
2837 return elm_object_cursor_style_get(item->view);
2843 * Set if the cursor set should be searched on the theme or should use
2844 * the provided by the engine, only.
2846 * @note before you set if should look on theme you should define a cursor
2847 * with elm_object_cursor_set(). By default it will only look for cursors
2848 * provided by the engine.
2850 * @param item widget item with cursor already set.
2851 * @param engine_only boolean to define it cursors should be looked only
2852 * between the provided by the engine or searched on widget's theme as well.
2857 _elm_widget_item_cursor_engine_only_set(Elm_Widget_Item *item,
2858 Eina_Bool engine_only)
2860 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2861 elm_object_cursor_engine_only_set(item->view, engine_only);
2867 * Get the cursor engine only usage for this item cursor.
2869 * @param item widget item with cursor already set.
2870 * @return engine_only boolean to define it cursors should be looked only
2871 * between the provided by the engine or searched on widget's theme as well. If
2872 * the object does not have a cursor set, then EINA_FALSE is returned.
2877 _elm_widget_item_cursor_engine_only_get(const Elm_Widget_Item *item)
2879 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, EINA_FALSE);
2880 return elm_object_cursor_engine_only_get(item->view);
2883 // smart object funcs
2885 _smart_reconfigure(Smart_Data *sd)
2889 evas_object_move(sd->resize_obj, sd->x, sd->y);
2890 evas_object_resize(sd->resize_obj, sd->w, sd->h);
2894 evas_object_move(sd->hover_obj, sd->x, sd->y);
2895 evas_object_resize(sd->hover_obj, sd->w, sd->h);
2900 _smart_add(Evas_Object *obj)
2904 sd = calloc(1, sizeof(Smart_Data));
2907 sd->x = sd->y = sd->w = sd->h = 0;
2909 sd->mirrored_auto_mode = EINA_TRUE; /* will follow system locale settings */
2910 evas_object_smart_data_set(obj, sd);
2913 static Evas_Object *
2914 _newest_focus_order_get(Evas_Object *obj,
2915 unsigned int *newest_focus_order,
2916 Eina_Bool can_focus_only)
2919 Evas_Object *child, *ret, *best;
2921 API_ENTRY return NULL;
2923 if (!evas_object_visible_get(obj)
2924 || (elm_widget_disabled_get(obj))
2925 || (elm_widget_tree_unfocusable_get(obj)))
2929 if (*newest_focus_order < sd->focus_order)
2931 *newest_focus_order = sd->focus_order;
2934 EINA_LIST_FOREACH(sd->subobjs, l, child)
2936 ret = _newest_focus_order_get(child, newest_focus_order, can_focus_only);
2942 if ((!best) || (!elm_widget_can_focus_get(best)))
2949 _if_focused_revert(Evas_Object *obj,
2950 Eina_Bool can_focus_only)
2953 Evas_Object *newest = NULL;
2954 unsigned int newest_focus_order = 0;
2958 if (!sd->focused) return;
2959 if (!sd->parent_obj) return;
2961 top = elm_widget_top_get(sd->parent_obj);
2964 newest = _newest_focus_order_get(top, &newest_focus_order, can_focus_only);
2967 elm_object_unfocus(newest);
2968 elm_object_focus(newest);
2974 _smart_del(Evas_Object *obj)
2977 Edje_Signal_Data *esd;
2981 if (sd->del_pre_func) sd->del_pre_func(obj);
2984 sobj = sd->resize_obj;
2985 sd->resize_obj = NULL;
2986 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
2987 evas_object_smart_callback_call(sd->obj, "sub-object-del", sobj);
2988 evas_object_del(sobj);
2992 sobj = sd->hover_obj;
2993 sd->hover_obj = NULL;
2994 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
2995 evas_object_smart_callback_call(sd->obj, "sub-object-del", sobj);
2996 evas_object_del(sobj);
2998 EINA_LIST_FREE(sd->subobjs, sobj)
3000 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
3001 evas_object_smart_callback_call(sd->obj, "sub-object-del", sobj);
3002 evas_object_del(sobj);
3004 eina_list_free(sd->tooltips); /* should be empty anyway */
3005 eina_list_free(sd->cursors); /* should be empty anyway */
3006 EINA_LIST_FREE(sd->edje_signals, esd)
3008 eina_stringshare_del(esd->emission);
3009 eina_stringshare_del(esd->source);
3012 eina_list_free(sd->event_cb); /* should be empty anyway */
3013 if (sd->del_func) sd->del_func(obj);
3014 if (sd->style) eina_stringshare_del(sd->style);
3015 if (sd->type) eina_stringshare_del(sd->type);
3016 if (sd->theme) elm_theme_free(sd->theme);
3017 _if_focused_revert(obj, EINA_TRUE);
3022 _smart_move(Evas_Object *obj,
3029 _smart_reconfigure(sd);
3033 _smart_resize(Evas_Object *obj,
3040 _smart_reconfigure(sd);
3044 _smart_show(Evas_Object *obj)
3049 if ((list = evas_object_smart_members_get(obj)))
3051 EINA_LIST_FREE(list, o)
3053 if (evas_object_data_get(o, "_elm_leaveme")) continue;
3054 evas_object_show(o);
3060 _smart_hide(Evas_Object *obj)
3066 list = evas_object_smart_members_get(obj);
3067 EINA_LIST_FREE(list, o)
3069 if (evas_object_data_get(o, "_elm_leaveme")) continue;
3070 evas_object_hide(o);
3075 _smart_color_set(Evas_Object *obj,
3084 if ((list = evas_object_smart_members_get(obj)))
3086 EINA_LIST_FREE(list, o)
3088 if (evas_object_data_get(o, "_elm_leaveme")) continue;
3089 evas_object_color_set(o, r, g, b, a);
3095 _smart_clip_set(Evas_Object *obj,
3101 if ((list = evas_object_smart_members_get(obj)))
3103 EINA_LIST_FREE(list, o)
3105 if (evas_object_data_get(o, "_elm_leaveme")) continue;
3106 evas_object_clip_set(o, clip);
3112 _smart_clip_unset(Evas_Object *obj)
3117 if ((list = evas_object_smart_members_get(obj)))
3119 EINA_LIST_FREE(list, o)
3121 if (evas_object_data_get(o, "_elm_leaveme")) continue;
3122 evas_object_clip_unset(o);
3128 _smart_calculate(Evas_Object *obj)
3131 if (sd->changed_func) sd->changed_func(obj);
3134 /* never need to touch this */
3138 if (_e_smart) return;
3140 static const Evas_Smart_Class sc =
3143 EVAS_SMART_CLASS_VERSION,
3161 _e_smart = evas_smart_class_new(&sc);
3165 /* happy debug functions */
3168 _sub_obj_tree_dump(const Evas_Object *obj,
3173 for (i = 0; i < lvl * 3; i++)
3176 if (_elm_widget_is(obj))
3180 printf("+ %s(%p)\n",
3184 _sub_obj_tree_dump(sd->resize_obj, lvl + 1);
3185 EINA_LIST_FOREACH(sd->subobjs, l, obj)
3187 if (obj != sd->resize_obj)
3188 _sub_obj_tree_dump(obj, lvl + 1);
3192 printf("+ %s(%p)\n", evas_object_type_get(obj), obj);
3196 _sub_obj_tree_dot_dump(const Evas_Object *obj,
3199 if (!_elm_widget_is(obj))
3203 Eina_Bool visible = evas_object_visible_get(obj);
3204 Eina_Bool disabled = elm_widget_disabled_get(obj);
3205 Eina_Bool focused = elm_widget_focus_get(obj);
3206 Eina_Bool can_focus = elm_widget_can_focus_get(obj);
3210 fprintf(output, "\"%p\" -- \"%p\" [ color=black", sd->parent_obj, obj);
3213 fprintf(output, ", style=bold");
3216 fprintf(output, ", color=gray28");
3218 fprintf(output, " ];\n");
3221 fprintf(output, "\"%p\" [ label = \"{%p|%s|%s|visible: %d|"
3222 "disabled: %d|focused: %d/%d|focus order:%d}\"", obj, obj, sd->type,
3223 evas_object_name_get(obj), visible, disabled, focused, can_focus,
3227 fprintf(output, ", style=bold");
3230 fprintf(output, ", fontcolor=gray28");
3232 if ((disabled) || (!visible))
3233 fprintf(output, ", color=gray");
3235 fprintf(output, " ];\n");
3239 EINA_LIST_FOREACH(sd->subobjs, l, o)
3240 _sub_obj_tree_dot_dump(o, output);
3245 elm_widget_tree_dump(const Evas_Object *top)
3248 _sub_obj_tree_dump(top, 0);
3256 elm_widget_tree_dot_dump(const Evas_Object *top,
3260 if (!_elm_widget_is(top))
3262 fprintf(output, "graph " " { node [shape=record];\n");
3263 _sub_obj_tree_dot_dump(top, output);
3264 fprintf(output, "}\n");