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;
23 Evas_Coord x, y, w, h;
25 Evas_Object *resize_obj;
26 Evas_Object *hover_obj;
27 Eina_List *tooltips, *cursors;
28 void (*del_func)(Evas_Object *obj);
29 void (*del_pre_func)(Evas_Object *obj);
30 void (*focus_func)(Evas_Object *obj);
31 void (*activate_func)(Evas_Object *obj);
32 void (*disable_func)(Evas_Object *obj);
33 void (*theme_func)(Evas_Object *obj);
34 Eina_Bool (*event_func)(Evas_Object *obj,
36 Evas_Callback_Type type,
38 void (*signal_func)(Evas_Object *obj,
41 void (*callback_add_func)(Evas_Object *obj,
46 void (*callback_del_func)(Evas_Object *obj,
51 void (*changed_func)(Evas_Object *obj);
52 Eina_Bool (*focus_next_func)(const Evas_Object *obj,
53 Elm_Focus_Direction dir,
55 void (*on_focus_func)(void *data,
58 void (*on_change_func)(void *data,
61 void (*on_show_region_func)(void *data,
63 void *on_show_region_data;
64 void (*focus_region_func)(Evas_Object *obj,
69 void (*on_focus_region_func)(const Evas_Object *obj,
74 void (*on_text_set_func)(Evas_Object *obj,
77 const char *(*on_text_get_func)(const Evas_Object *obj,
79 void (*on_content_set_func)(Evas_Object *obj,
81 Evas_Object *content);
82 Evas_Object *(*on_content_get_func)(const Evas_Object *obj,
84 Evas_Object *(*on_content_unset_func)(Evas_Object *obj,
87 Evas_Coord rx, ry, rw, rh;
93 unsigned int focus_order;
94 Eina_Bool focus_order_on_calc;
96 int child_drag_x_locked;
97 int child_drag_y_locked;
99 Eina_List *edje_signals;
101 Eina_Bool drag_x_locked : 1;
102 Eina_Bool drag_y_locked : 1;
104 Eina_Bool can_focus : 1;
105 Eina_Bool child_can_focus : 1;
106 Eina_Bool focused : 1;
107 Eina_Bool tree_unfocusable : 1;
108 Eina_Bool highlight_ignore : 1;
109 Eina_Bool highlight_in_theme : 1;
110 Eina_Bool disabled : 1;
111 Eina_Bool is_mirrored : 1;
112 Eina_Bool mirrored_auto_mode : 1; /* This is TRUE by default */
114 Eina_List *focus_chain;
118 struct _Edje_Signal_Data
122 const char *emission;
127 struct _Elm_Event_Cb_Data
133 /* local subsystem functions */
134 static void _smart_reconfigure(Smart_Data *sd);
135 static void _smart_add(Evas_Object *obj);
136 static void _smart_del(Evas_Object *obj);
137 static void _smart_move(Evas_Object *obj,
140 static void _smart_resize(Evas_Object *obj,
143 static void _smart_show(Evas_Object *obj);
144 static void _smart_hide(Evas_Object *obj);
145 static void _smart_color_set(Evas_Object *obj,
150 static void _smart_clip_set(Evas_Object *obj,
152 static void _smart_clip_unset(Evas_Object *obj);
153 static void _smart_calculate(Evas_Object *obj);
154 static void _smart_init(void);
156 static void _if_focused_revert(Evas_Object *obj,
157 Eina_Bool can_focus_only);
158 static Evas_Object *_newest_focus_order_get(Evas_Object *obj,
159 unsigned int *newest_focus_order,
160 Eina_Bool can_focus_only);
162 /* local subsystem globals */
163 static Evas_Smart *_e_smart = NULL;
164 static Eina_List *widtypes = NULL;
166 static unsigned int focus_order = 0;
169 static inline Eina_Bool
170 _elm_widget_is(const Evas_Object *obj)
172 const char *type = evas_object_type_get(obj);
173 return type == SMART_NAME;
176 static inline Eina_Bool
177 _is_focusable(Evas_Object *obj)
179 API_ENTRY return EINA_FALSE;
180 return sd->can_focus || (sd->child_can_focus);
184 _unfocus_parents(Evas_Object *obj)
186 for (; obj; obj = elm_widget_parent_get(obj))
189 if (!sd->focused) return;
195 _focus_parents(Evas_Object *obj)
197 for (; obj; obj = elm_widget_parent_get(obj))
200 if (sd->focused) return;
206 _sub_obj_del(void *data,
209 void *event_info __UNUSED__)
211 Smart_Data *sd = data;
213 if (_elm_widget_is(obj))
215 if (elm_widget_focus_get(obj)) _unfocus_parents(sd->obj);
217 if (obj == sd->resize_obj)
218 sd->resize_obj = NULL;
219 else if (obj == sd->hover_obj)
220 sd->hover_obj = NULL;
222 sd->subobjs = eina_list_remove(sd->subobjs, obj);
223 evas_object_smart_callback_call(sd->obj, "sub-object-del", obj);
227 _sub_obj_hide(void *data __UNUSED__,
230 void *event_info __UNUSED__)
232 elm_widget_focus_hide_handle(obj);
236 _sub_obj_mouse_down(void *data __UNUSED__,
239 void *event_info __UNUSED__)
241 elm_widget_focus_mouse_down_handle(obj);
245 _propagate_x_drag_lock(Evas_Object *obj,
251 Smart_Data *sd2 = evas_object_smart_data_get(sd->parent_obj);
254 sd2->child_drag_x_locked += dir;
255 _propagate_x_drag_lock(sd->parent_obj, dir);
261 _propagate_y_drag_lock(Evas_Object *obj,
267 Smart_Data *sd2 = evas_object_smart_data_get(sd->parent_obj);
270 sd2->child_drag_y_locked += dir;
271 _propagate_y_drag_lock(sd->parent_obj, dir);
277 _propagate_event(void *data,
283 Evas_Callback_Type type = (Evas_Callback_Type)(long)data;
284 Evas_Event_Flags *event_flags = NULL;
288 case EVAS_CALLBACK_KEY_DOWN:
290 Evas_Event_Key_Down *ev = event_info;
291 event_flags = &(ev->event_flags);
295 case EVAS_CALLBACK_KEY_UP:
297 Evas_Event_Key_Up *ev = event_info;
298 event_flags = &(ev->event_flags);
302 case EVAS_CALLBACK_MOUSE_WHEEL:
304 Evas_Event_Mouse_Wheel *ev = event_info;
305 event_flags = &(ev->event_flags);
313 elm_widget_event_propagate(obj, type, event_info, event_flags);
317 _parent_focus(Evas_Object *obj)
320 if (sd->focused) return;
322 Evas_Object *o = elm_widget_parent_get(obj);
323 sd->focus_order_on_calc = EINA_TRUE;
325 if (o) _parent_focus(o);
327 if (!sd->focus_order_on_calc)
328 return; /* we don't want to override it if by means of any of the
329 callbacks below one gets to calculate our order
333 sd->focus_order = focus_order;
334 sd->focused = EINA_TRUE;
335 if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
336 if (sd->focus_func) sd->focus_func(obj);
338 _elm_widget_focus_region_show(obj);
340 sd->focus_order_on_calc = EINA_FALSE;
344 _elm_object_focus_chain_del_cb(void *data,
347 void *event_info __UNUSED__)
349 Smart_Data *sd = data;
351 sd->focus_chain = eina_list_remove(sd->focus_chain, obj);
354 // exposed util funcs to elm
356 _elm_widget_type_clear(void)
360 EINA_LIST_FREE(widtypes, ptr)
362 eina_stringshare_del(*ptr);
368 _elm_widget_focus_region_show(const Evas_Object *obj)
370 Evas_Coord x, y, w, h, ox, oy;
376 o = elm_widget_parent_get(obj);
379 elm_widget_focus_region_get(obj, &x, &y, &w, &h);
380 evas_object_geometry_get(obj, &ox, &oy, NULL, NULL);
384 sd2 = evas_object_smart_data_get(o);
385 if (sd2->focus_region_func)
387 sd2->focus_region_func(o, x, y, w, h);
388 elm_widget_focus_region_get(o, &x, &y, &w, &h);
392 evas_object_geometry_get(o, &px, &py, NULL, NULL);
398 o = elm_widget_parent_get(o);
403 * @defgroup Widget Widget
406 * Exposed api for making widgets
409 elm_widget_type_register(const char **ptr)
411 widtypes = eina_list_append(widtypes, (void *)ptr);
415 elm_widget_api_check(int ver)
417 if (ver != ELM_INTERNAL_API_VERSION)
419 CRITICAL("Elementary widget api versions do not match");
426 elm_widget_add(Evas *evas)
430 obj = evas_object_smart_add(evas, _e_smart);
431 elm_widget_mirrored_set(obj, elm_mirrored_get());
436 elm_widget_del_hook_set(Evas_Object *obj,
437 void (*func)(Evas_Object *obj))
444 elm_widget_del_pre_hook_set(Evas_Object *obj,
445 void (*func)(Evas_Object *obj))
448 sd->del_pre_func = func;
452 elm_widget_focus_hook_set(Evas_Object *obj,
453 void (*func)(Evas_Object *obj))
456 sd->focus_func = func;
460 elm_widget_activate_hook_set(Evas_Object *obj,
461 void (*func)(Evas_Object *obj))
464 sd->activate_func = func;
468 elm_widget_disable_hook_set(Evas_Object *obj,
469 void (*func)(Evas_Object *obj))
472 sd->disable_func = func;
476 elm_widget_theme_hook_set(Evas_Object *obj,
477 void (*func)(Evas_Object *obj))
480 sd->theme_func = func;
484 elm_widget_event_hook_set(Evas_Object *obj,
485 Eina_Bool (*func)(Evas_Object *obj,
487 Evas_Callback_Type type,
491 sd->event_func = func;
495 elm_widget_text_set_hook_set(Evas_Object *obj,
496 void (*func)(Evas_Object *obj,
501 sd->on_text_set_func = func;
505 elm_widget_text_get_hook_set(Evas_Object *obj,
506 const char *(*func)(const Evas_Object *obj,
510 sd->on_text_get_func = func;
514 elm_widget_content_set_hook_set(Evas_Object *obj,
515 void (*func)(Evas_Object *obj,
517 Evas_Object *content))
520 sd->on_content_set_func = func;
524 elm_widget_content_get_hook_set(Evas_Object *obj,
525 Evas_Object *(*func)(const Evas_Object *obj,
529 sd->on_content_get_func = func;
533 elm_widget_content_unset_hook_set(Evas_Object *obj,
534 Evas_Object *(*func)(Evas_Object *obj,
538 sd->on_content_unset_func = func;
542 elm_widget_changed_hook_set(Evas_Object *obj,
543 void (*func)(Evas_Object *obj))
546 sd->changed_func = func;
550 elm_widget_signal_emit_hook_set(Evas_Object *obj,
551 void (*func)(Evas_Object *obj,
552 const char *emission,
556 sd->signal_func = func;
560 elm_widget_signal_callback_add_hook_set(Evas_Object *obj,
561 void (*func)(Evas_Object *obj,
562 const char *emission,
564 Edje_Signal_Cb func_cb,
568 sd->callback_add_func = func;
572 elm_widget_signal_callback_del_hook_set(Evas_Object *obj,
573 void (*func)(Evas_Object *obj,
574 const char *emission,
576 Edje_Signal_Cb func_cb,
580 sd->callback_del_func = func;
584 elm_widget_theme(Evas_Object *obj)
592 EINA_LIST_FOREACH(sd->subobjs, l, child) elm_widget_theme(child);
593 if (sd->resize_obj) elm_widget_theme(sd->resize_obj);
594 if (sd->hover_obj) elm_widget_theme(sd->hover_obj);
595 EINA_LIST_FOREACH(sd->tooltips, l, tt) elm_tooltip_theme(tt);
596 EINA_LIST_FOREACH(sd->cursors, l, cur) elm_cursor_theme(cur);
597 if (sd->theme_func) sd->theme_func(obj);
601 elm_widget_theme_specific(Evas_Object *obj,
609 Elm_Theme *th2, *thdef;
612 thdef = elm_theme_default_get();
617 if (!th2) th2 = thdef;
625 if (th2 == thdef) break;
626 th2 = th2->ref_theme;
627 if (!th2) th2 = thdef;
631 EINA_LIST_FOREACH(sd->subobjs, l, child)
632 elm_widget_theme_specific(child, th, force);
633 if (sd->resize_obj) elm_widget_theme(sd->resize_obj);
634 if (sd->hover_obj) elm_widget_theme(sd->hover_obj);
635 EINA_LIST_FOREACH(sd->tooltips, l, tt) elm_tooltip_theme(tt);
636 EINA_LIST_FOREACH(sd->cursors, l, cur) elm_cursor_theme(cur);
637 if (sd->theme_func) sd->theme_func(obj);
643 * Set hook to get next object in object focus chain.
645 * @param obj The widget object.
646 * @param func The hook to be used with this widget.
651 elm_widget_focus_next_hook_set(Evas_Object *obj,
652 Eina_Bool (*func)(const Evas_Object *obj,
653 Elm_Focus_Direction dir,
657 sd->focus_next_func = func;
661 * Returns the widget's mirrored mode.
663 * @param obj The widget.
664 * @return mirrored mode of the object.
668 elm_widget_mirrored_get(const Evas_Object *obj)
670 API_ENTRY return EINA_FALSE;
671 return sd->is_mirrored;
675 * Sets the widget's mirrored mode.
677 * @param obj The widget.
678 * @param mirrored EINA_TRUE to set mirrored mode. EINA_FALSE to unset.
681 elm_widget_mirrored_set(Evas_Object *obj,
685 if (sd->is_mirrored != mirrored)
687 sd->is_mirrored = mirrored;
688 elm_widget_theme(obj);
694 * Resets the mirrored mode from the system mirror mode for widgets that are in
695 * automatic mirroring mode. This function does not call elm_widget_theme.
697 * @param obj The widget.
698 * @param mirrored EINA_TRUE to set mirrored mode. EINA_FALSE to unset.
701 _elm_widget_mirrored_reload(Evas_Object *obj)
704 Eina_Bool mirrored = elm_mirrored_get();
705 if (elm_widget_mirrored_automatic_get(obj) && (sd->is_mirrored != mirrored))
707 sd->is_mirrored = mirrored;
712 * Returns the widget's mirrored mode setting.
714 * @param obj The widget.
715 * @return mirrored mode setting of the object.
719 elm_widget_mirrored_automatic_get(const Evas_Object *obj)
721 API_ENTRY return EINA_FALSE;
722 return sd->mirrored_auto_mode;
726 * Sets the widget's mirrored mode setting.
727 * When widget in automatic mode, it follows the system mirrored mode set by
728 * elm_mirrored_set().
729 * @param obj The widget.
730 * @param automatic EINA_TRUE for auto mirrored mode. EINA_FALSE for manual.
733 elm_widget_mirrored_automatic_set(Evas_Object *obj,
737 if (sd->mirrored_auto_mode != automatic)
739 sd->mirrored_auto_mode = automatic;
743 elm_widget_mirrored_set(obj, elm_mirrored_get());
749 elm_widget_on_focus_hook_set(Evas_Object *obj,
750 void (*func)(void *data,
755 sd->on_focus_func = func;
756 sd->on_focus_data = data;
760 elm_widget_on_change_hook_set(Evas_Object *obj,
761 void (*func)(void *data,
766 sd->on_change_func = func;
767 sd->on_change_data = data;
771 elm_widget_on_show_region_hook_set(Evas_Object *obj,
772 void (*func)(void *data,
777 sd->on_show_region_func = func;
778 sd->on_show_region_data = data;
784 * Set the hook to use to show the focused region.
786 * Whenever a new widget gets focused or it's needed to show the focused
787 * area of the current one, this hook will be called on objects that may
788 * want to move their children into their visible area.
789 * The area given in the hook function is relative to the @p obj widget.
791 * @param obj The widget object
792 * @param func The function to call to show the specified area.
797 elm_widget_focus_region_hook_set(Evas_Object *obj,
798 void (*func)(Evas_Object *obj,
805 sd->focus_region_func = func;
811 * Set the hook to retrieve the focused region of a widget.
813 * This hook will be called by elm_widget_focus_region_get() whenever
814 * it's needed to get the focused area of a widget. The area must be relative
815 * to the widget itself and if no hook is set, it will default to the entire
818 * @param obj The widget object
819 * @param func The function used to retrieve the focus region.
824 elm_widget_on_focus_region_hook_set(Evas_Object *obj,
825 void (*func)(const Evas_Object *obj,
832 sd->on_focus_region_func = func;
836 elm_widget_data_set(Evas_Object *obj,
844 elm_widget_data_get(const Evas_Object *obj)
846 API_ENTRY return NULL;
851 elm_widget_sub_object_add(Evas_Object *obj,
855 double scale, pscale = elm_widget_scale_get(sobj);
856 Elm_Theme *th, *pth = elm_widget_theme_get(sobj);
857 Eina_Bool mirrored, pmirrored = elm_widget_mirrored_get(obj);
859 if (_elm_widget_is(sobj))
861 Smart_Data *sd2 = evas_object_smart_data_get(sobj);
864 if (sd2->parent_obj == obj)
867 elm_widget_sub_object_del(sd2->parent_obj, sobj);
868 sd2->parent_obj = obj;
869 if (!sd->child_can_focus && (_is_focusable(sobj)))
870 sd->child_can_focus = EINA_TRUE;
875 void *data = evas_object_data_get(sobj, "elm-parent");
878 if (data == obj) return;
879 evas_object_event_callback_del(sobj, EVAS_CALLBACK_DEL,
884 sd->subobjs = eina_list_append(sd->subobjs, sobj);
885 evas_object_data_set(sobj, "elm-parent", obj);
886 evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
887 if (_elm_widget_is(sobj))
888 evas_object_event_callback_add(sobj, EVAS_CALLBACK_HIDE, _sub_obj_hide, sd);
889 evas_object_smart_callback_call(obj, "sub-object-add", sobj);
890 scale = elm_widget_scale_get(sobj);
891 th = elm_widget_theme_get(sobj);
892 mirrored = elm_widget_mirrored_get(sobj);
893 if ((scale != pscale) || (th != pth) || (pmirrored != mirrored)) elm_widget_theme(sobj);
894 if (elm_widget_focus_get(sobj)) _focus_parents(obj);
898 elm_widget_sub_object_del(Evas_Object *obj,
901 Evas_Object *sobj_parent;
905 sobj_parent = evas_object_data_del(sobj, "elm-parent");
906 if (sobj_parent != obj)
908 static int abort_on_warn = -1;
909 ERR("removing sub object %p from parent %p, "
910 "but elm-parent is different %p!",
911 sobj, obj, sobj_parent);
912 if (EINA_UNLIKELY(abort_on_warn == -1))
914 if (getenv("ELM_ERROR_ABORT")) abort_on_warn = 1;
915 else abort_on_warn = 0;
917 if (abort_on_warn == 1) abort();
919 if (_elm_widget_is(sobj))
921 Smart_Data *sd2 = evas_object_smart_data_get(sobj);
924 sd2->parent_obj = NULL;
925 if (sd2->resize_obj == sobj)
926 sd2->resize_obj = NULL;
928 sd->subobjs = eina_list_remove(sd->subobjs, sobj);
931 sd->subobjs = eina_list_remove(sd->subobjs, sobj);
932 if (elm_widget_focus_get(sobj)) _unfocus_parents(obj);
933 if ((sd->child_can_focus) && (_is_focusable(sobj)))
937 sd->child_can_focus = EINA_FALSE;
938 EINA_LIST_FOREACH(sd->subobjs, l, subobj)
940 if (_is_focusable(subobj))
942 sd->child_can_focus = EINA_TRUE;
949 sd->subobjs = eina_list_remove(sd->subobjs, sobj);
950 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL,
952 if (_elm_widget_is(sobj))
953 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_HIDE,
955 evas_object_smart_callback_call(obj, "sub-object-del", sobj);
959 elm_widget_resize_object_set(Evas_Object *obj,
963 // orphan previous resize obj
966 evas_object_clip_unset(sd->resize_obj);
967 evas_object_data_del(sd->resize_obj, "elm-parent");
968 if (_elm_widget_is(sd->resize_obj))
970 Smart_Data *sd2 = evas_object_smart_data_get(sd->resize_obj);
971 if (sd2) sd2->parent_obj = NULL;
972 evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_HIDE,
975 evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_DEL,
977 evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_MOUSE_DOWN,
978 _sub_obj_mouse_down, sd);
979 evas_object_smart_member_del(sd->resize_obj);
980 if (_elm_widget_is(sd->resize_obj))
982 if (elm_widget_focus_get(sd->resize_obj)) _unfocus_parents(obj);
985 // orphan new resize obj
988 evas_object_data_del(sobj, "elm-parent");
989 if (_elm_widget_is(sobj))
991 Smart_Data *sd2 = evas_object_smart_data_get(sobj);
992 if (sd2) sd2->parent_obj = NULL;
993 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_HIDE,
996 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL,
998 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_MOUSE_DOWN,
999 _sub_obj_mouse_down, sd);
1000 evas_object_smart_member_del(sobj);
1001 if (_elm_widget_is(sobj))
1003 if (elm_widget_focus_get(sobj)) _unfocus_parents(obj);
1006 // set the resize obj up
1007 sd->resize_obj = sobj;
1010 if (_elm_widget_is(sd->resize_obj))
1012 Smart_Data *sd2 = evas_object_smart_data_get(sd->resize_obj);
1013 if (sd2) sd2->parent_obj = obj;
1014 evas_object_event_callback_add(sobj, EVAS_CALLBACK_HIDE,
1017 evas_object_clip_set(sobj, evas_object_clip_get(obj));
1018 evas_object_smart_member_add(sobj, obj);
1019 evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL,
1021 evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_DOWN,
1022 _sub_obj_mouse_down, sd);
1023 _smart_reconfigure(sd);
1024 evas_object_data_set(sobj, "elm-parent", obj);
1025 evas_object_smart_callback_call(obj, "sub-object-add", sobj);
1026 if (_elm_widget_is(sobj))
1028 if (elm_widget_focus_get(sobj)) _focus_parents(obj);
1034 elm_widget_hover_object_set(Evas_Object *obj,
1040 evas_object_event_callback_del_full(sd->hover_obj, EVAS_CALLBACK_DEL,
1043 sd->hover_obj = sobj;
1046 evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL,
1048 _smart_reconfigure(sd);
1053 elm_widget_can_focus_set(Evas_Object *obj,
1054 Eina_Bool can_focus)
1057 sd->can_focus = can_focus;
1060 evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN,
1062 (void *)(long)EVAS_CALLBACK_KEY_DOWN);
1063 evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_UP,
1065 (void *)(long)EVAS_CALLBACK_KEY_UP);
1066 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_WHEEL,
1068 (void *)(long)EVAS_CALLBACK_MOUSE_WHEEL);
1072 evas_object_event_callback_del(obj, EVAS_CALLBACK_KEY_DOWN,
1074 evas_object_event_callback_del(obj, EVAS_CALLBACK_KEY_UP,
1076 evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_WHEEL,
1082 elm_widget_can_focus_get(const Evas_Object *obj)
1084 API_ENTRY return EINA_FALSE;
1085 return sd->can_focus;
1089 elm_widget_child_can_focus_get(const Evas_Object *obj)
1091 API_ENTRY return EINA_FALSE;
1092 return sd->child_can_focus;
1098 * This API makes the widget object and its children to be unfocusable.
1100 * This API can be helpful for an object to be deleted.
1101 * When an object will be deleted soon, it and its children may not
1102 * want to get focus (by focus reverting or by other focus controls).
1103 * Then, just use this API before deleting.
1105 * @param obj The widget root of sub-tree
1106 * @param tree_unfocusable If true, set the object sub-tree as unfocusable
1111 elm_widget_tree_unfocusable_set(Evas_Object *obj,
1112 Eina_Bool tree_unfocusable)
1116 if (sd->tree_unfocusable == tree_unfocusable) return;
1117 sd->tree_unfocusable = !!tree_unfocusable;
1118 elm_widget_focus_tree_unfocusable_handle(obj);
1124 * This returns true, if the object sub-tree is unfocusable.
1126 * @param obj The widget root of sub-tree
1127 * @return EINA_TRUE if the object sub-tree is unfocusable
1132 elm_widget_tree_unfocusable_get(const Evas_Object *obj)
1134 API_ENTRY return EINA_FALSE;
1135 return sd->tree_unfocusable;
1139 elm_widget_highlight_ignore_set(Evas_Object *obj,
1143 sd->highlight_ignore = !!ignore;
1147 elm_widget_highlight_ignore_get(const Evas_Object *obj)
1149 API_ENTRY return EINA_FALSE;
1150 return sd->highlight_ignore;
1154 elm_widget_highlight_in_theme_set(Evas_Object *obj,
1155 Eina_Bool highlight)
1158 sd->highlight_in_theme = !!highlight;
1159 /* FIXME: if focused, it should switch from one mode to the other */
1163 elm_widget_highlight_in_theme_get(const Evas_Object *obj)
1165 API_ENTRY return EINA_FALSE;
1166 return sd->highlight_in_theme;
1170 elm_widget_focus_get(const Evas_Object *obj)
1172 API_ENTRY return EINA_FALSE;
1177 elm_widget_focused_object_get(const Evas_Object *obj)
1179 const Evas_Object *subobj;
1181 API_ENTRY return NULL;
1183 if (!sd->focused) return NULL;
1184 EINA_LIST_FOREACH(sd->subobjs, l, subobj)
1186 Evas_Object *fobj = elm_widget_focused_object_get(subobj);
1187 if (fobj) return fobj;
1189 return (Evas_Object *)obj;
1193 elm_widget_top_get(const Evas_Object *obj)
1195 API_ENTRY return NULL;
1196 if (sd->parent_obj) return elm_widget_top_get(sd->parent_obj);
1197 return (Evas_Object *)obj;
1201 elm_widget_is(const Evas_Object *obj)
1203 return _elm_widget_is(obj);
1207 elm_widget_parent_widget_get(const Evas_Object *obj)
1209 Evas_Object *parent;
1211 if (_elm_widget_is(obj))
1213 Smart_Data *sd = evas_object_smart_data_get(obj);
1214 if (!sd) return NULL;
1215 parent = sd->parent_obj;
1219 parent = evas_object_data_get(obj, "elm-parent");
1220 if (!parent) parent = evas_object_smart_parent_get(obj);
1225 Evas_Object *elm_parent;
1226 if (_elm_widget_is(parent)) break;
1227 elm_parent = evas_object_data_get(parent, "elm-parent");
1228 if (elm_parent) parent = elm_parent;
1229 else parent = evas_object_smart_parent_get(parent);
1235 elm_widget_parent2_get(const Evas_Object *obj)
1237 if (_elm_widget_is(obj))
1239 Smart_Data *sd = evas_object_smart_data_get(obj);
1240 if (sd) return sd->parent2;
1246 elm_widget_parent2_set(Evas_Object *obj, Evas_Object *parent)
1249 sd->parent2 = parent;
1253 elm_widget_event_callback_add(Evas_Object *obj,
1258 EINA_SAFETY_ON_NULL_RETURN(func);
1259 Elm_Event_Cb_Data *ecb = ELM_NEW(Elm_Event_Cb_Data);
1262 sd->event_cb = eina_list_append(sd->event_cb, ecb);
1266 elm_widget_event_callback_del(Evas_Object *obj,
1270 API_ENTRY return NULL;
1271 EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
1273 Elm_Event_Cb_Data *ecd;
1274 EINA_LIST_FOREACH(sd->event_cb, l, ecd)
1275 if ((ecd->func == func) && (ecd->data == data))
1278 sd->event_cb = eina_list_remove_list(sd->event_cb, l);
1279 return (void *)data;
1285 elm_widget_event_propagate(Evas_Object *obj,
1286 Evas_Callback_Type type,
1288 Evas_Event_Flags *event_flags)
1290 API_ENTRY return EINA_FALSE; //TODO reduce.
1291 if (!_elm_widget_is(obj)) return EINA_FALSE;
1292 Evas_Object *parent = obj;
1293 Elm_Event_Cb_Data *ecd;
1294 Eina_List *l, *l_prev;
1297 (!(event_flags && ((*event_flags) & EVAS_EVENT_FLAG_ON_HOLD))))
1299 sd = evas_object_smart_data_get(parent);
1300 if ((!sd) || (!_elm_widget_is(obj)))
1301 return EINA_FALSE; //Not Elm Widget
1303 if (sd->event_func && (sd->event_func(parent, obj, type, event_info)))
1306 EINA_LIST_FOREACH_SAFE(sd->event_cb, l, l_prev, ecd)
1308 if (ecd->func((void *)ecd->data, parent, obj, type, event_info) ||
1309 (event_flags && ((*event_flags) & EVAS_EVENT_FLAG_ON_HOLD)))
1312 parent = sd->parent_obj;
1321 * Set custom focus chain.
1323 * This function i set one new and overwrite any previous custom focus chain
1324 * with the list of objects. The previous list will be deleted and this list
1325 * will be managed. After setted, don't modity it.
1327 * @note On focus cycle, only will be evaluated children of this container.
1329 * @param obj The container widget
1330 * @param objs Chain of objects to pass focus
1334 elm_widget_focus_custom_chain_set(Evas_Object *obj,
1338 if (!sd->focus_next_func)
1341 elm_widget_focus_custom_chain_unset(obj);
1346 EINA_LIST_FOREACH(objs, l, o)
1348 evas_object_event_callback_add(o, EVAS_CALLBACK_DEL,
1349 _elm_object_focus_chain_del_cb, sd);
1352 sd->focus_chain = objs;
1358 * Get custom focus chain
1360 * @param obj The container widget
1363 EAPI const Eina_List *
1364 elm_widget_focus_custom_chain_get(const Evas_Object *obj)
1366 API_ENTRY return NULL;
1367 return (const Eina_List *)sd->focus_chain;
1373 * Unset custom focus chain
1375 * @param obj The container widget
1379 elm_widget_focus_custom_chain_unset(Evas_Object *obj)
1382 Eina_List *l, *l_next;
1385 EINA_LIST_FOREACH_SAFE(sd->focus_chain, l, l_next, o)
1387 evas_object_event_callback_del_full(o, EVAS_CALLBACK_DEL,
1388 _elm_object_focus_chain_del_cb, sd);
1389 sd->focus_chain = eina_list_remove_list(sd->focus_chain, l);
1396 * Append object to custom focus chain.
1398 * @note If relative_child equal to NULL or not in custom chain, the object
1399 * will be added in end.
1401 * @note On focus cycle, only will be evaluated children of this container.
1403 * @param obj The container widget
1404 * @param child The child to be added in custom chain
1405 * @param relative_child The relative object to position the child
1409 elm_widget_focus_custom_chain_append(Evas_Object *obj,
1411 Evas_Object *relative_child)
1414 EINA_SAFETY_ON_NULL_RETURN(child);
1415 if (!sd->focus_next_func)
1418 evas_object_event_callback_del_full(child, EVAS_CALLBACK_DEL,
1419 _elm_object_focus_chain_del_cb, sd);
1421 if (!relative_child)
1423 sd->focus_chain = eina_list_append(sd->focus_chain, child);
1427 sd->focus_chain = eina_list_append_relative(sd->focus_chain, child, relative_child);
1434 * Prepend object to custom focus chain.
1436 * @note If relative_child equal to NULL or not in custom chain, the object
1437 * will be added in begin.
1439 * @note On focus cycle, only will be evaluated children of this container.
1441 * @param obj The container widget
1442 * @param child The child to be added in custom chain
1443 * @param relative_child The relative object to position the child
1447 elm_widget_focus_custom_chain_prepend(Evas_Object *obj,
1449 Evas_Object *relative_child)
1452 EINA_SAFETY_ON_NULL_RETURN(child);
1453 if (!sd->focus_next_func)
1456 evas_object_event_callback_del_full(child, EVAS_CALLBACK_DEL,
1457 _elm_object_focus_chain_del_cb, sd);
1459 if (!relative_child)
1461 sd->focus_chain = eina_list_prepend(sd->focus_chain, child);
1465 sd->focus_chain = eina_list_prepend_relative(sd->focus_chain, child, relative_child);
1472 * Give focus to next object in object tree.
1474 * Give focus to next object in focus chain of one object sub-tree.
1475 * If the last object of chain already have focus, the focus will go to the
1476 * first object of chain.
1478 * @param obj The widget root of sub-tree
1479 * @param dir Direction to cycle the focus
1484 elm_widget_focus_cycle(Evas_Object *obj,
1485 Elm_Focus_Direction dir)
1487 Evas_Object *target = NULL;
1488 if (!_elm_widget_is(obj))
1490 elm_widget_focus_next_get(obj, dir, &target);
1492 elm_widget_focus_steal(target);
1498 * Give focus to near object in one direction.
1500 * Give focus to near object in direction of one object.
1501 * If none focusable object in given direction, the focus will not change.
1503 * @param obj The reference widget
1504 * @param x Horizontal component of direction to focus
1505 * @param y Vertical component of direction to focus
1510 elm_widget_focus_direction_go(Evas_Object *obj __UNUSED__,
1520 * Get next object in focus chain of object tree.
1522 * Get next object in focus chain of one object sub-tree.
1523 * Return the next object by reference. If don't have any candidate to receive
1524 * focus before chain end, the first candidate will be returned.
1526 * @param obj The widget root of sub-tree
1527 * @param dir Direction os focus chain
1528 * @param next The next object in focus chain
1529 * @return EINA_TRUE if don't need focus chain restart/loop back
1530 * to use 'next' obj.
1535 elm_widget_focus_next_get(const Evas_Object *obj,
1536 Elm_Focus_Direction dir,
1543 API_ENTRY return EINA_FALSE;
1545 /* Ignore if disabled */
1546 if ((!evas_object_visible_get(obj))
1547 || (elm_widget_disabled_get(obj))
1548 || (elm_widget_tree_unfocusable_get(obj)))
1552 if (sd->focus_next_func)
1553 return sd->focus_next_func(obj, dir, next);
1555 if (!elm_widget_can_focus_get(obj))
1559 *next = (Evas_Object *)obj;
1560 return !elm_widget_focus_get(obj);
1566 * Get next object in focus chain of object tree in list.
1568 * Get next object in focus chain of one object sub-tree ordered by one list.
1569 * Return the next object by reference. If don't have any candidate to receive
1570 * focus before list end, the first candidate will be returned.
1572 * @param obj The widget root of sub-tree
1573 * @param dir Direction os focus chain
1574 * @param items list with ordered objects
1575 * @param list_data_get function to get the object from one item of list
1576 * @param next The next object in focus chain
1577 * @return EINA_TRUE if don't need focus chain restart/loop back
1578 * to use 'next' obj.
1583 elm_widget_focus_list_next_get(const Evas_Object *obj,
1584 const Eina_List *items,
1585 void *(*list_data_get)(const Eina_List * list),
1586 Elm_Focus_Direction dir,
1589 Eina_List *(*list_next)(const Eina_List * list);
1595 if (!_elm_widget_is(obj))
1602 if (dir == ELM_FOCUS_PREVIOUS)
1604 items = eina_list_last(items);
1605 list_next = eina_list_prev;
1607 else if (dir == ELM_FOCUS_NEXT)
1608 list_next = eina_list_next;
1612 const Eina_List *l = items;
1614 /* Recovery last focused sub item */
1615 if (elm_widget_focus_get(obj))
1616 for (; l; l = list_next(l))
1618 Evas_Object *cur = list_data_get(l);
1619 if (elm_widget_focus_get(cur)) break;
1622 const Eina_List *start = l;
1623 Evas_Object *to_focus = NULL;
1625 /* Interate sub items */
1626 /* Go to end of list */
1627 for (; l; l = list_next(l))
1629 Evas_Object *tmp = NULL;
1630 Evas_Object *cur = list_data_get(l);
1632 if (elm_widget_parent_get(cur) != obj)
1635 /* Try Focus cycle in subitem */
1636 if (elm_widget_focus_next_get(cur, dir, &tmp))
1641 else if ((tmp) && (!to_focus))
1647 /* Get First possible */
1648 for (; l != start; l = list_next(l))
1650 Evas_Object *tmp = NULL;
1651 Evas_Object *cur = list_data_get(l);
1653 if (elm_widget_parent_get(cur) != obj)
1656 /* Try Focus cycle in subitem */
1657 elm_widget_focus_next_get(cur, dir, &tmp);
1670 elm_widget_signal_emit(Evas_Object *obj,
1671 const char *emission,
1675 if (!sd->signal_func) return;
1676 sd->signal_func(obj, emission, source);
1680 _edje_signal_callback(void *data,
1681 Evas_Object *obj __UNUSED__,
1682 const char *emission,
1685 Edje_Signal_Data *esd = data;
1686 esd->func(esd->data, esd->obj, emission, source);
1690 elm_widget_signal_callback_add(Evas_Object *obj,
1691 const char *emission,
1693 Edje_Signal_Cb func,
1696 Edje_Signal_Data *esd;
1698 if (!sd->callback_add_func) return;
1699 EINA_SAFETY_ON_NULL_RETURN(func);
1701 esd = ELM_NEW(Edje_Signal_Data);
1706 esd->emission = eina_stringshare_add(emission);
1707 esd->source = eina_stringshare_add(source);
1709 sd->edje_signals = eina_list_append(sd->edje_signals, esd);
1710 sd->callback_add_func(obj, emission, source, _edje_signal_callback, esd);
1714 elm_widget_signal_callback_del(Evas_Object *obj,
1715 const char *emission,
1717 Edje_Signal_Cb func)
1719 Edje_Signal_Data *esd;
1722 API_ENTRY return NULL;
1723 if (!sd->callback_del_func) return NULL;
1725 EINA_LIST_FOREACH(sd->edje_signals, l, esd)
1727 if ((esd->func == func) && (!strcmp(esd->emission, emission)) &&
1728 (!strcmp(esd->source, source)))
1730 sd->edje_signals = eina_list_remove_list(sd->edje_signals, l);
1731 eina_stringshare_del(esd->emission);
1732 eina_stringshare_del(esd->source);
1738 sd->callback_del_func(obj, emission, source, _edje_signal_callback, esd);
1743 elm_widget_focus_set(Evas_Object *obj,
1750 sd->focus_order = focus_order;
1751 sd->focused = EINA_TRUE;
1752 if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
1756 sd->focus_func(obj);
1763 if ((_is_focusable(sd->resize_obj)) &&
1764 (!elm_widget_disabled_get(sd->resize_obj)))
1766 elm_widget_focus_set(sd->resize_obj, first);
1772 EINA_LIST_FOREACH(sd->subobjs, l, child)
1774 if ((_is_focusable(child)) &&
1775 (!elm_widget_disabled_get(child)))
1777 elm_widget_focus_set(child, first);
1787 EINA_LIST_REVERSE_FOREACH(sd->subobjs, l, child)
1789 if ((_is_focusable(child)) &&
1790 (!elm_widget_disabled_get(child)))
1792 elm_widget_focus_set(child, first);
1798 if ((_is_focusable(sd->resize_obj)) &&
1799 (!elm_widget_disabled_get(sd->resize_obj)))
1801 elm_widget_focus_set(sd->resize_obj, first);
1809 elm_widget_parent_get(const Evas_Object *obj)
1811 API_ENTRY return NULL;
1812 return sd->parent_obj;
1816 elm_widget_focused_object_clear(Evas_Object *obj)
1819 if (!sd->focused) return;
1820 if (elm_widget_focus_get(sd->resize_obj))
1821 elm_widget_focused_object_clear(sd->resize_obj);
1826 EINA_LIST_FOREACH(sd->subobjs, l, child)
1828 if (elm_widget_focus_get(child))
1830 elm_widget_focused_object_clear(child);
1835 sd->focused = EINA_FALSE;
1836 if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
1837 if (sd->focus_func) sd->focus_func(obj);
1841 elm_widget_focus_steal(Evas_Object *obj)
1843 Evas_Object *parent, *parent2, *o;
1846 if (sd->focused) return;
1847 if (sd->disabled) return;
1848 if (!sd->can_focus) return;
1849 if (sd->tree_unfocusable) return;
1853 o = elm_widget_parent_get(parent);
1855 sd = evas_object_smart_data_get(o);
1856 if (sd->disabled || sd->tree_unfocusable) return;
1857 if (sd->focused) break;
1860 if ((!elm_widget_parent_get(parent)) &&
1861 (!elm_widget_parent2_get(parent)))
1862 elm_widget_focused_object_clear(parent);
1865 parent2 = elm_widget_parent_get(parent);
1866 if (!parent2) parent2 = elm_widget_parent2_get(parent);
1868 sd = evas_object_smart_data_get(parent);
1871 if ((sd->resize_obj) && (elm_widget_focus_get(sd->resize_obj)))
1872 elm_widget_focused_object_clear(sd->resize_obj);
1877 EINA_LIST_FOREACH(sd->subobjs, l, child)
1879 if (elm_widget_focus_get(child))
1881 elm_widget_focused_object_clear(child);
1893 elm_widget_activate(Evas_Object *obj)
1896 elm_widget_change(obj);
1897 if (sd->activate_func) sd->activate_func(obj);
1901 elm_widget_change(Evas_Object *obj)
1904 elm_widget_change(elm_widget_parent_get(obj));
1905 if (sd->on_change_func) sd->on_change_func(sd->on_change_data, obj);
1909 elm_widget_disabled_set(Evas_Object *obj,
1914 if (sd->disabled == disabled) return;
1915 sd->disabled = !!disabled;
1916 elm_widget_focus_disabled_handle(obj);
1917 if (sd->disable_func) sd->disable_func(obj);
1921 elm_widget_disabled_get(const Evas_Object *obj)
1924 return sd->disabled;
1928 elm_widget_show_region_set(Evas_Object *obj,
1933 Eina_Bool forceshow)
1935 Evas_Object *parent_obj, *child_obj;
1936 Evas_Coord px, py, cx, cy;
1939 if (!forceshow && (x == sd->rx) && (y == sd->ry)
1940 && (w == sd->rw) && (h == sd->rh)) return;
1945 if (sd->on_show_region_func)
1946 sd->on_show_region_func(sd->on_show_region_data, obj);
1950 parent_obj = sd->parent_obj;
1951 child_obj = sd->obj;
1952 if ((!parent_obj) || (!_elm_widget_is(parent_obj))) break;
1953 sd = evas_object_smart_data_get(parent_obj);
1956 evas_object_geometry_get(parent_obj, &px, &py, NULL, NULL);
1957 evas_object_geometry_get(child_obj, &cx, &cy, NULL, NULL);
1966 if (sd->on_show_region_func)
1968 sd->on_show_region_func(sd->on_show_region_data, parent_obj);
1975 elm_widget_show_region_get(const Evas_Object *obj,
1991 * Get the focus region of the given widget.
1993 * The focus region is the area of a widget that should brought into the
1994 * visible area when the widget is focused. Mostly used to show the part of
1995 * an entry where the cursor is, for example. The area returned is relative
1996 * to the object @p obj.
1997 * If the @p obj doesn't have the proper on_focus_region_hook set, this
1998 * function will return the full size of the object.
2000 * @param obj The widget object
2001 * @param x Where to store the x coordinate of the area
2002 * @param y Where to store the y coordinate of the area
2003 * @param w Where to store the width of the area
2004 * @param h Where to store the height of the area
2009 elm_widget_focus_region_get(const Evas_Object *obj,
2019 sd = evas_object_smart_data_get(obj);
2020 if (!sd || !_elm_widget_is(obj) || !sd->on_focus_region_func)
2022 evas_object_geometry_get(obj, NULL, NULL, w, h);
2027 sd->on_focus_region_func(obj, x, y, w, h);
2031 elm_widget_scroll_hold_push(Evas_Object *obj)
2035 if (sd->scroll_hold == 1)
2036 evas_object_smart_callback_call(obj, "scroll-hold-on", obj);
2037 if (sd->parent_obj) elm_widget_scroll_hold_push(sd->parent_obj);
2038 // FIXME: on delete/reparent hold pop
2042 elm_widget_scroll_hold_pop(Evas_Object *obj)
2046 if (sd->scroll_hold < 0) sd->scroll_hold = 0;
2047 if (!sd->scroll_hold)
2048 evas_object_smart_callback_call(obj, "scroll-hold-off", obj);
2049 if (sd->parent_obj) elm_widget_scroll_hold_pop(sd->parent_obj);
2053 elm_widget_scroll_hold_get(const Evas_Object *obj)
2056 return sd->scroll_hold;
2060 elm_widget_scroll_freeze_push(Evas_Object *obj)
2063 sd->scroll_freeze++;
2064 if (sd->scroll_freeze == 1)
2065 evas_object_smart_callback_call(obj, "scroll-freeze-on", obj);
2066 if (sd->parent_obj) elm_widget_scroll_freeze_push(sd->parent_obj);
2067 // FIXME: on delete/reparent freeze pop
2071 elm_widget_scroll_freeze_pop(Evas_Object *obj)
2074 sd->scroll_freeze--;
2075 if (sd->scroll_freeze < 0) sd->scroll_freeze = 0;
2076 if (!sd->scroll_freeze)
2077 evas_object_smart_callback_call(obj, "scroll-freeze-off", obj);
2078 if (sd->parent_obj) elm_widget_scroll_freeze_pop(sd->parent_obj);
2082 elm_widget_scroll_freeze_get(const Evas_Object *obj)
2085 return sd->scroll_freeze;
2089 elm_widget_scale_set(Evas_Object *obj,
2093 if (scale <= 0.0) scale = 0.0;
2094 if (sd->scale != scale)
2097 elm_widget_theme(obj);
2102 elm_widget_scale_get(const Evas_Object *obj)
2104 API_ENTRY return 1.0;
2105 // FIXME: save walking up the tree by storing/caching parent scale
2106 if (sd->scale == 0.0)
2109 return elm_widget_scale_get(sd->parent_obj);
2117 elm_widget_theme_set(Evas_Object *obj,
2121 if (sd->theme != th)
2123 if (sd->theme) elm_theme_free(sd->theme);
2126 elm_widget_theme(obj);
2131 elm_widget_text_part_set(Evas_Object *obj, const char *part, const char *label)
2135 if (!sd->on_text_set_func)
2138 sd->on_text_set_func(obj, part, label);
2142 elm_widget_text_part_get(const Evas_Object *obj, const char *part)
2144 API_ENTRY return NULL;
2146 if (!sd->on_text_get_func)
2149 return sd->on_text_get_func(obj, part);
2153 elm_widget_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content)
2157 if (!sd->on_content_set_func) return;
2158 sd->on_content_set_func(obj, part, content);
2162 elm_widget_content_part_get(const Evas_Object *obj, const char *part)
2164 API_ENTRY return NULL;
2166 if (!sd->on_content_get_func) return NULL;
2167 return sd->on_content_get_func(obj, part);
2171 elm_widget_content_part_unset(Evas_Object *obj, const char *part)
2173 API_ENTRY return NULL;
2175 if (!sd->on_content_unset_func) return NULL;
2176 return sd->on_content_unset_func(obj, part);
2180 elm_widget_theme_get(const Evas_Object *obj)
2182 API_ENTRY return NULL;
2186 return elm_widget_theme_get(sd->parent_obj);
2194 elm_widget_style_set(Evas_Object *obj,
2199 if (eina_stringshare_replace(&sd->style, style))
2200 elm_widget_theme(obj);
2204 elm_widget_style_get(const Evas_Object *obj)
2206 API_ENTRY return NULL;
2207 if (sd->style) return sd->style;
2212 elm_widget_type_set(Evas_Object *obj,
2216 eina_stringshare_replace(&sd->type, type);
2220 elm_widget_type_get(const Evas_Object *obj)
2222 API_ENTRY return NULL;
2223 if (sd->type) return sd->type;
2228 elm_widget_tooltip_add(Evas_Object *obj,
2232 sd->tooltips = eina_list_append(sd->tooltips, tt);
2236 elm_widget_tooltip_del(Evas_Object *obj,
2240 sd->tooltips = eina_list_remove(sd->tooltips, tt);
2244 elm_widget_cursor_add(Evas_Object *obj,
2248 sd->cursors = eina_list_append(sd->cursors, cur);
2252 elm_widget_cursor_del(Evas_Object *obj,
2256 sd->cursors = eina_list_remove(sd->cursors, cur);
2260 elm_widget_drag_lock_x_set(Evas_Object *obj,
2264 if (sd->drag_x_locked == lock) return;
2265 sd->drag_x_locked = lock;
2266 if (sd->drag_x_locked) _propagate_x_drag_lock(obj, 1);
2267 else _propagate_x_drag_lock(obj, -1);
2271 elm_widget_drag_lock_y_set(Evas_Object *obj,
2275 if (sd->drag_y_locked == lock) return;
2276 sd->drag_y_locked = lock;
2277 if (sd->drag_y_locked) _propagate_y_drag_lock(obj, 1);
2278 else _propagate_y_drag_lock(obj, -1);
2282 elm_widget_drag_lock_x_get(const Evas_Object *obj)
2284 API_ENTRY return EINA_FALSE;
2285 return sd->drag_x_locked;
2289 elm_widget_drag_lock_y_get(const Evas_Object *obj)
2291 API_ENTRY return EINA_FALSE;
2292 return sd->drag_y_locked;
2296 elm_widget_drag_child_locked_x_get(const Evas_Object *obj)
2299 return sd->child_drag_x_locked;
2303 elm_widget_drag_child_locked_y_get(const Evas_Object *obj)
2306 return sd->child_drag_y_locked;
2310 elm_widget_theme_object_set(Evas_Object *obj,
2313 const char *welement,
2316 API_ENTRY return EINA_FALSE;
2317 return _elm_theme_object_set(obj, edj, wname, welement, wstyle);
2321 elm_widget_type_check(const Evas_Object *obj,
2324 const char *provided, *expected = "(unknown)";
2325 static int abort_on_warn = -1;
2326 provided = elm_widget_type_get(obj);
2327 if (EINA_LIKELY(provided == type)) return EINA_TRUE;
2328 if (type) expected = type;
2329 if ((!provided) || (!provided[0]))
2331 provided = evas_object_type_get(obj);
2332 if ((!provided) || (!provided[0]))
2333 provided = "(unknown)";
2335 ERR("Passing Object: %p, of type: '%s' when expecting type: '%s'", obj, provided, expected);
2336 if (abort_on_warn == -1)
2338 if (getenv("ELM_ERROR_ABORT")) abort_on_warn = 1;
2339 else abort_on_warn = 0;
2341 if (abort_on_warn == 1) abort();
2348 * Split string in words
2350 * @param str Source string
2351 * @return List of const words
2353 * @see elm_widget_stringlist_free()
2357 elm_widget_stringlist_get(const char *str)
2359 Eina_List *list = NULL;
2361 if (!str) return NULL;
2362 for (b = s = str; 1; s++)
2364 if ((*s == ' ') || (!*s))
2366 char *t = malloc(s - b + 1);
2369 strncpy(t, b, s - b);
2371 list = eina_list_append(list, eina_stringshare_add(t));
2382 elm_widget_stringlist_free(Eina_List *list)
2385 EINA_LIST_FREE(list, s) eina_stringshare_del(s);
2389 elm_widget_focus_hide_handle(Evas_Object *obj)
2391 _if_focused_revert(obj, EINA_TRUE);
2395 elm_widget_focus_mouse_down_handle(Evas_Object *obj)
2397 Evas_Object *o = obj;
2400 if (_elm_widget_is(o)) break;
2401 o = evas_object_smart_parent_get(o);
2405 if (!_is_focusable(o)) return;
2406 elm_widget_focus_steal(o);
2410 elm_widget_focus_tree_unfocusable_handle(Evas_Object *obj)
2414 if (!elm_widget_parent_get(obj))
2415 elm_widget_focused_object_clear(obj);
2417 _if_focused_revert(obj, EINA_TRUE);
2421 elm_widget_focus_disabled_handle(Evas_Object *obj)
2425 elm_widget_focus_tree_unfocusable_handle(obj);
2431 * Allocate a new Elm_Widget_Item-derived structure.
2433 * The goal of this structure is to provide common ground for actions
2434 * that a widget item have, such as the owner widget, callback to
2435 * notify deletion, data pointer and maybe more.
2437 * @param widget the owner widget that holds this item, must be an elm_widget!
2438 * @param alloc_size any number greater than sizeof(Elm_Widget_Item) that will
2439 * be used to allocate memory.
2441 * @return allocated memory that is already zeroed out, or NULL on errors.
2443 * @see elm_widget_item_new() convenience macro.
2444 * @see elm_widget_item_del() to release memory.
2447 EAPI Elm_Widget_Item *
2448 _elm_widget_item_new(Evas_Object *widget,
2451 if (!_elm_widget_is(widget))
2454 Elm_Widget_Item *item;
2456 EINA_SAFETY_ON_TRUE_RETURN_VAL(alloc_size < sizeof(Elm_Widget_Item), NULL);
2457 EINA_SAFETY_ON_TRUE_RETURN_VAL(!_elm_widget_is(widget), NULL);
2459 item = calloc(1, alloc_size);
2460 EINA_SAFETY_ON_NULL_RETURN_VAL(item, NULL);
2462 EINA_MAGIC_SET(item, ELM_WIDGET_ITEM_MAGIC);
2463 item->widget = widget;
2470 * Releases widget item memory, calling back del_cb() if it exists.
2472 * If there is a Elm_Widget_Item::del_cb, then it will be called prior
2473 * to memory release. Note that elm_widget_item_pre_notify_del() calls
2474 * this function and then unset it, thus being useful for 2 step
2475 * cleanup whenever the del_cb may use any of the data that must be
2476 * deleted from item.
2478 * The Elm_Widget_Item::view will be deleted (evas_object_del()) if it
2481 * @param item a valid #Elm_Widget_Item to be deleted.
2482 * @see elm_widget_item_del() convenience macro.
2486 _elm_widget_item_del(Elm_Widget_Item *item)
2488 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2491 item->del_cb((void *)item->data, item->widget, item);
2494 evas_object_del(item->view);
2496 EINA_MAGIC_SET(item, EINA_MAGIC_NONE);
2503 * Notify object will be deleted without actually deleting it.
2505 * This function will callback Elm_Widget_Item::del_cb if it is set
2506 * and then unset it so it is not called twice (ie: from
2507 * elm_widget_item_del()).
2509 * @param item a valid #Elm_Widget_Item to be notified
2510 * @see elm_widget_item_pre_notify_del() convenience macro.
2514 _elm_widget_item_pre_notify_del(Elm_Widget_Item *item)
2516 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2517 if (!item->del_cb) return;
2518 item->del_cb((void *)item->data, item->widget, item);
2519 item->del_cb = NULL;
2525 * Set the function to notify when item is being deleted.
2527 * This function will complain if there was a callback set already,
2528 * however it will set the new one.
2530 * The callback will be called from elm_widget_item_pre_notify_del()
2531 * or elm_widget_item_del() will be called with:
2532 * - data: the Elm_Widget_Item::data value.
2533 * - obj: the Elm_Widget_Item::widget evas object.
2534 * - event_info: the item being deleted.
2536 * @param item a valid #Elm_Widget_Item to be notified
2537 * @see elm_widget_item_del_cb_set() convenience macro.
2541 _elm_widget_item_del_cb_set(Elm_Widget_Item *item,
2542 Evas_Smart_Cb del_cb)
2544 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2546 if ((item->del_cb) && (item->del_cb != del_cb))
2547 WRN("You're replacing a previously set del_cb %p of item %p with %p",
2548 item->del_cb, item, del_cb);
2550 item->del_cb = del_cb;
2556 * Set user-data in this item.
2558 * User data may be used to identify this item or just store any
2559 * application data. It is automatically given as the first parameter
2560 * of the deletion notify callback.
2562 * @param item a valid #Elm_Widget_Item to store data in.
2563 * @param data user data to store.
2564 * @see elm_widget_item_del_cb_set() convenience macro.
2568 _elm_widget_item_data_set(Elm_Widget_Item *item,
2571 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2572 if ((item->data) && (item->data != data))
2573 DBG("Replacing item %p data %p with %p", item, item->data, data);
2580 * Retrieves user-data of this item.
2582 * @param item a valid #Elm_Widget_Item to get data from.
2583 * @see elm_widget_item_data_set()
2587 _elm_widget_item_data_get(const Elm_Widget_Item *item)
2589 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
2590 return (void *)item->data;
2593 typedef struct _Elm_Widget_Item_Tooltip Elm_Widget_Item_Tooltip;
2595 struct _Elm_Widget_Item_Tooltip
2597 Elm_Widget_Item *item;
2598 Elm_Tooltip_Item_Content_Cb func;
2599 Evas_Smart_Cb del_cb;
2603 static Evas_Object *
2604 _elm_widget_item_tooltip_label_create(void *data,
2605 Evas_Object *obj __UNUSED__,
2606 Evas_Object *tooltip,
2607 void *item __UNUSED__)
2609 Evas_Object *label = elm_label_add(tooltip);
2612 elm_object_style_set(label, "tooltip");
2613 elm_object_text_set(label, data);
2618 _elm_widget_item_tooltip_label_del_cb(void *data,
2619 Evas_Object *obj __UNUSED__,
2620 void *event_info __UNUSED__)
2622 eina_stringshare_del(data);
2628 * Set the text to be shown in the widget item.
2630 * @param item Target item
2631 * @param text The text to set in the content
2633 * Setup the text as tooltip to object. The item can have only one tooltip,
2634 * so any previous tooltip data is removed.
2639 _elm_widget_item_tooltip_text_set(Elm_Widget_Item *item,
2642 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2643 EINA_SAFETY_ON_NULL_RETURN(text);
2645 text = eina_stringshare_add(text);
2646 _elm_widget_item_tooltip_content_cb_set
2647 (item, _elm_widget_item_tooltip_label_create, text,
2648 _elm_widget_item_tooltip_label_del_cb);
2651 static Evas_Object *
2652 _elm_widget_item_tooltip_create(void *data,
2654 Evas_Object *tooltip)
2656 Elm_Widget_Item_Tooltip *wit = data;
2657 return wit->func((void *)wit->data, obj, tooltip, wit->item);
2661 _elm_widget_item_tooltip_del_cb(void *data,
2663 void *event_info __UNUSED__)
2665 Elm_Widget_Item_Tooltip *wit = data;
2666 if (wit->del_cb) wit->del_cb((void *)wit->data, obj, wit->item);
2673 * Set the content to be shown in the tooltip item
2675 * Setup the tooltip to item. The item can have only one tooltip,
2676 * so any previous tooltip data is removed. @p func(with @p data) will
2677 * be called every time that need show the tooltip and it should
2678 * return a valid Evas_Object. This object is then managed fully by
2679 * tooltip system and is deleted when the tooltip is gone.
2681 * @param item the widget item being attached a tooltip.
2682 * @param func the function used to create the tooltip contents.
2683 * @param data what to provide to @a func as callback data/context.
2684 * @param del_cb called when data is not needed anymore, either when
2685 * another callback replaces @func, the tooltip is unset with
2686 * elm_widget_item_tooltip_unset() or the owner @a item
2687 * dies. This callback receives as the first parameter the
2688 * given @a data, and @c event_info is the item.
2693 _elm_widget_item_tooltip_content_cb_set(Elm_Widget_Item *item,
2694 Elm_Tooltip_Item_Content_Cb func,
2696 Evas_Smart_Cb del_cb)
2698 Elm_Widget_Item_Tooltip *wit;
2700 ELM_WIDGET_ITEM_CHECK_OR_GOTO(item, error_noitem);
2704 _elm_widget_item_tooltip_unset(item);
2708 wit = ELM_NEW(Elm_Widget_Item_Tooltip);
2709 if (!wit) goto error;
2713 wit->del_cb = del_cb;
2715 elm_object_sub_tooltip_content_cb_set
2716 (item->view, item->widget, _elm_widget_item_tooltip_create, wit,
2717 _elm_widget_item_tooltip_del_cb);
2722 if (del_cb) del_cb((void *)data, NULL, item);
2725 if (del_cb) del_cb((void *)data, item->widget, item);
2731 * Unset tooltip from item
2733 * @param item widget item to remove previously set tooltip.
2735 * Remove tooltip from item. The callback provided as del_cb to
2736 * elm_widget_item_tooltip_content_cb_set() will be called to notify
2737 * it is not used anymore.
2739 * @see elm_widget_item_tooltip_content_cb_set()
2744 _elm_widget_item_tooltip_unset(Elm_Widget_Item *item)
2746 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2747 elm_object_tooltip_unset(item->view);
2753 * Sets a different style for this item tooltip.
2755 * @note before you set a style you should define a tooltip with
2756 * elm_widget_item_tooltip_content_cb_set() or
2757 * elm_widget_item_tooltip_text_set()
2759 * @param item widget item with tooltip already set.
2760 * @param style the theme style to use (default, transparent, ...)
2765 _elm_widget_item_tooltip_style_set(Elm_Widget_Item *item,
2768 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2769 elm_object_tooltip_style_set(item->view, style);
2773 _elm_widget_item_tooltip_size_restrict_disable(Elm_Widget_Item *item, Eina_Bool disable)
2775 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, EINA_FALSE);
2776 return elm_tooltip_size_restrict_disable(item->view, disable);
2780 _elm_widget_item_tooltip_size_restrict_disabled_get(const Elm_Widget_Item *item)
2782 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, EINA_FALSE);
2783 return elm_tooltip_size_restrict_disabled_get(item->view);
2789 * Get the style for this item tooltip.
2791 * @param item widget item with tooltip already set.
2792 * @return style the theme style in use, defaults to "default". If the
2793 * object does not have a tooltip set, then NULL is returned.
2798 _elm_widget_item_tooltip_style_get(const Elm_Widget_Item *item)
2800 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
2801 return elm_object_tooltip_style_get(item->view);
2805 _elm_widget_item_cursor_set(Elm_Widget_Item *item,
2808 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2809 elm_object_sub_cursor_set(item->view, item->widget, cursor);
2813 _elm_widget_item_cursor_get(const Elm_Widget_Item *item)
2815 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
2816 return elm_object_cursor_get(item->view);
2820 _elm_widget_item_cursor_unset(Elm_Widget_Item *item)
2822 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2823 elm_object_cursor_unset(item->view);
2829 * Sets a different style for this item cursor.
2831 * @note before you set a style you should define a cursor with
2832 * elm_widget_item_cursor_set()
2834 * @param item widget item with cursor already set.
2835 * @param style the theme style to use (default, transparent, ...)
2840 _elm_widget_item_cursor_style_set(Elm_Widget_Item *item,
2843 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2844 elm_object_cursor_style_set(item->view, style);
2850 * Get the style for this item cursor.
2852 * @param item widget item with cursor already set.
2853 * @return style the theme style in use, defaults to "default". If the
2854 * object does not have a cursor set, then NULL is returned.
2859 _elm_widget_item_cursor_style_get(const Elm_Widget_Item *item)
2861 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
2862 return elm_object_cursor_style_get(item->view);
2868 * Set if the cursor set should be searched on the theme or should use
2869 * the provided by the engine, only.
2871 * @note before you set if should look on theme you should define a cursor
2872 * with elm_object_cursor_set(). By default it will only look for cursors
2873 * provided by the engine.
2875 * @param item widget item with cursor already set.
2876 * @param engine_only boolean to define it cursors should be looked only
2877 * between the provided by the engine or searched on widget's theme as well.
2882 _elm_widget_item_cursor_engine_only_set(Elm_Widget_Item *item,
2883 Eina_Bool engine_only)
2885 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2886 elm_object_cursor_engine_only_set(item->view, engine_only);
2892 * Get the cursor engine only usage for this item cursor.
2894 * @param item widget item with cursor already set.
2895 * @return engine_only boolean to define it cursors should be looked only
2896 * between the provided by the engine or searched on widget's theme as well. If
2897 * the object does not have a cursor set, then EINA_FALSE is returned.
2902 _elm_widget_item_cursor_engine_only_get(const Elm_Widget_Item *item)
2904 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, EINA_FALSE);
2905 return elm_object_cursor_engine_only_get(item->view);
2908 // smart object funcs
2910 _smart_reconfigure(Smart_Data *sd)
2914 evas_object_move(sd->resize_obj, sd->x, sd->y);
2915 evas_object_resize(sd->resize_obj, sd->w, sd->h);
2919 evas_object_move(sd->hover_obj, sd->x, sd->y);
2920 evas_object_resize(sd->hover_obj, sd->w, sd->h);
2925 _elm_widget_item_content_part_set(Elm_Widget_Item *item,
2927 Evas_Object *content)
2929 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2930 if (!item->on_content_set_func) return;
2931 item->on_content_set_func(item, part, content);
2935 _elm_widget_item_content_part_get(const Elm_Widget_Item *item,
2938 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
2939 if (!item->on_content_get_func) return NULL;
2940 return item->on_content_get_func(item, part);
2944 _elm_widget_item_content_part_unset(Elm_Widget_Item *item,
2947 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
2948 if (!item->on_content_unset_func) return NULL;
2949 return item->on_content_unset_func(item, part);
2953 _elm_widget_item_text_part_set(Elm_Widget_Item *item,
2957 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
2958 if (!item->on_text_set_func) return;
2959 item->on_text_set_func(item, part, label);
2963 _elm_widget_item_text_part_get(const Elm_Widget_Item *item,
2966 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
2967 if (!item->on_text_get_func) return NULL;
2968 return item->on_text_get_func(item, part);
2972 _smart_add(Evas_Object *obj)
2976 sd = calloc(1, sizeof(Smart_Data));
2979 sd->x = sd->y = sd->w = sd->h = 0;
2981 sd->mirrored_auto_mode = EINA_TRUE; /* will follow system locale settings */
2982 evas_object_smart_data_set(obj, sd);
2985 static Evas_Object *
2986 _newest_focus_order_get(Evas_Object *obj,
2987 unsigned int *newest_focus_order,
2988 Eina_Bool can_focus_only)
2991 Evas_Object *child, *ret, *best;
2993 API_ENTRY return NULL;
2995 if (!evas_object_visible_get(obj)
2996 || (elm_widget_disabled_get(obj))
2997 || (elm_widget_tree_unfocusable_get(obj)))
3001 if (*newest_focus_order < sd->focus_order)
3003 *newest_focus_order = sd->focus_order;
3006 EINA_LIST_FOREACH(sd->subobjs, l, child)
3008 ret = _newest_focus_order_get(child, newest_focus_order, can_focus_only);
3014 if ((!best) || (!elm_widget_can_focus_get(best)))
3021 _if_focused_revert(Evas_Object *obj,
3022 Eina_Bool can_focus_only)
3025 Evas_Object *newest = NULL;
3026 unsigned int newest_focus_order = 0;
3030 if (!sd->focused) return;
3031 if (!sd->parent_obj) return;
3033 top = elm_widget_top_get(sd->parent_obj);
3036 newest = _newest_focus_order_get(top, &newest_focus_order, can_focus_only);
3039 elm_object_focus_set(newest, EINA_FALSE);
3040 elm_object_focus_set(newest, EINA_TRUE);
3046 _smart_del(Evas_Object *obj)
3049 Edje_Signal_Data *esd;
3053 if (sd->del_pre_func) sd->del_pre_func(obj);
3056 sobj = sd->resize_obj;
3057 sd->resize_obj = NULL;
3058 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
3059 evas_object_smart_callback_call(sd->obj, "sub-object-del", sobj);
3060 evas_object_del(sobj);
3064 sobj = sd->hover_obj;
3065 sd->hover_obj = NULL;
3066 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
3067 evas_object_smart_callback_call(sd->obj, "sub-object-del", sobj);
3068 evas_object_del(sobj);
3070 EINA_LIST_FREE(sd->subobjs, sobj)
3072 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
3073 evas_object_smart_callback_call(sd->obj, "sub-object-del", sobj);
3074 evas_object_del(sobj);
3076 eina_list_free(sd->tooltips); /* should be empty anyway */
3077 eina_list_free(sd->cursors); /* should be empty anyway */
3078 EINA_LIST_FREE(sd->edje_signals, esd)
3080 eina_stringshare_del(esd->emission);
3081 eina_stringshare_del(esd->source);
3084 eina_list_free(sd->event_cb); /* should be empty anyway */
3085 if (sd->del_func) sd->del_func(obj);
3086 if (sd->style) eina_stringshare_del(sd->style);
3087 if (sd->type) eina_stringshare_del(sd->type);
3088 if (sd->theme) elm_theme_free(sd->theme);
3089 _if_focused_revert(obj, EINA_TRUE);
3094 _smart_move(Evas_Object *obj,
3101 _smart_reconfigure(sd);
3105 _smart_resize(Evas_Object *obj,
3112 _smart_reconfigure(sd);
3116 _smart_show(Evas_Object *obj)
3121 if ((list = evas_object_smart_members_get(obj)))
3123 EINA_LIST_FREE(list, o)
3125 if (evas_object_data_get(o, "_elm_leaveme")) continue;
3126 evas_object_show(o);
3132 _smart_hide(Evas_Object *obj)
3138 list = evas_object_smart_members_get(obj);
3139 EINA_LIST_FREE(list, o)
3141 if (evas_object_data_get(o, "_elm_leaveme")) continue;
3142 evas_object_hide(o);
3147 _smart_color_set(Evas_Object *obj,
3156 if ((list = evas_object_smart_members_get(obj)))
3158 EINA_LIST_FREE(list, o)
3160 if (evas_object_data_get(o, "_elm_leaveme")) continue;
3161 evas_object_color_set(o, r, g, b, a);
3167 _smart_clip_set(Evas_Object *obj,
3173 if ((list = evas_object_smart_members_get(obj)))
3175 EINA_LIST_FREE(list, o)
3177 if (evas_object_data_get(o, "_elm_leaveme")) continue;
3178 evas_object_clip_set(o, clip);
3184 _smart_clip_unset(Evas_Object *obj)
3189 if ((list = evas_object_smart_members_get(obj)))
3191 EINA_LIST_FREE(list, o)
3193 if (evas_object_data_get(o, "_elm_leaveme")) continue;
3194 evas_object_clip_unset(o);
3200 _smart_calculate(Evas_Object *obj)
3203 if (sd->changed_func) sd->changed_func(obj);
3206 /* never need to touch this */
3210 if (_e_smart) return;
3212 static const Evas_Smart_Class sc =
3215 EVAS_SMART_CLASS_VERSION,
3233 _e_smart = evas_smart_class_new(&sc);
3237 /* happy debug functions */
3240 _sub_obj_tree_dump(const Evas_Object *obj,
3245 for (i = 0; i < lvl * 3; i++)
3248 if (_elm_widget_is(obj))
3252 printf("+ %s(%p)\n",
3256 _sub_obj_tree_dump(sd->resize_obj, lvl + 1);
3257 EINA_LIST_FOREACH(sd->subobjs, l, obj)
3259 if (obj != sd->resize_obj)
3260 _sub_obj_tree_dump(obj, lvl + 1);
3264 printf("+ %s(%p)\n", evas_object_type_get(obj), obj);
3268 _sub_obj_tree_dot_dump(const Evas_Object *obj,
3271 if (!_elm_widget_is(obj))
3275 Eina_Bool visible = evas_object_visible_get(obj);
3276 Eina_Bool disabled = elm_widget_disabled_get(obj);
3277 Eina_Bool focused = elm_widget_focus_get(obj);
3278 Eina_Bool can_focus = elm_widget_can_focus_get(obj);
3282 fprintf(output, "\"%p\" -- \"%p\" [ color=black", sd->parent_obj, obj);
3285 fprintf(output, ", style=bold");
3288 fprintf(output, ", color=gray28");
3290 fprintf(output, " ];\n");
3293 fprintf(output, "\"%p\" [ label = \"{%p|%s|%s|visible: %d|"
3294 "disabled: %d|focused: %d/%d|focus order:%d}\"", obj, obj, sd->type,
3295 evas_object_name_get(obj), visible, disabled, focused, can_focus,
3299 fprintf(output, ", style=bold");
3302 fprintf(output, ", fontcolor=gray28");
3304 if ((disabled) || (!visible))
3305 fprintf(output, ", color=gray");
3307 fprintf(output, " ];\n");
3311 EINA_LIST_FOREACH(sd->subobjs, l, o)
3312 _sub_obj_tree_dot_dump(o, output);
3317 elm_widget_tree_dump(const Evas_Object *top)
3320 _sub_obj_tree_dump(top, 0);
3328 elm_widget_tree_dot_dump(const Evas_Object *top,
3332 if (!_elm_widget_is(top))
3334 fprintf(output, "graph " " { node [shape=record];\n");
3335 _sub_obj_tree_dot_dump(top, output);
3336 fprintf(output, "}\n");