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;
19 Evas_Object *parent_obj;
20 Evas_Coord x, y, w, h;
22 Evas_Object *resize_obj;
23 Evas_Object *hover_obj;
24 void (*del_func) (Evas_Object *obj);
25 void (*del_pre_func) (Evas_Object *obj);
26 void (*focus_func) (Evas_Object *obj);
27 void (*activate_func) (Evas_Object *obj);
28 void (*disable_func) (Evas_Object *obj);
29 void (*theme_func) (Evas_Object *obj);
30 void (*changed_func) (Evas_Object *obj);
31 void (*on_focus_func) (void *data, Evas_Object *obj);
33 void (*on_change_func) (void *data, Evas_Object *obj);
35 void (*on_show_region_func) (void *data, Evas_Object *obj);
36 void *on_show_region_data;
38 Evas_Coord rx, ry, rw, rh;
45 int child_drag_x_locked;
46 int child_drag_y_locked;
47 Eina_Bool drag_x_locked : 1;
48 Eina_Bool drag_y_locked : 1;
50 Eina_Bool can_focus : 1;
51 Eina_Bool child_can_focus : 1;
52 Eina_Bool focused : 1;
53 Eina_Bool disabled : 1;
56 /* local subsystem functions */
57 static void _smart_reconfigure(Smart_Data *sd);
58 static void _smart_add(Evas_Object *obj);
59 static void _smart_del(Evas_Object *obj);
60 static void _smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
61 static void _smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
62 static void _smart_show(Evas_Object *obj);
63 static void _smart_hide(Evas_Object *obj);
64 static void _smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
65 static void _smart_clip_set(Evas_Object *obj, Evas_Object * clip);
66 static void _smart_clip_unset(Evas_Object *obj);
67 static void _smart_calculate(Evas_Object *obj);
68 static void _smart_init(void);
69 static inline Eina_Bool _elm_widget_is(const Evas_Object *obj);
71 /* local subsystem globals */
72 static Evas_Smart *_e_smart = NULL;
75 _sub_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
77 Smart_Data *sd = data;
79 if (obj == sd->resize_obj)
80 sd->resize_obj = NULL;
81 else if (obj == sd->hover_obj)
84 sd->subobjs = eina_list_remove(sd->subobjs, obj);
85 evas_object_smart_callback_call(sd->obj, "sub-object-del", obj);
89 _sub_obj_mouse_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
94 if (_elm_widget_is(o)) break;
95 o = evas_object_smart_parent_get(o);
99 if (!elm_widget_can_focus_get(o)) return;
100 elm_widget_focus_steal(o);
104 elm_widget_add(Evas *evas)
107 return evas_object_smart_add(evas, _e_smart);
111 elm_widget_del_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj))
118 elm_widget_del_pre_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj))
121 sd->del_pre_func = func;
125 elm_widget_focus_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj))
128 sd->focus_func = func;
132 elm_widget_activate_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj))
135 sd->activate_func = func;
139 elm_widget_disable_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj))
142 sd->disable_func = func;
146 elm_widget_theme_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj))
149 sd->theme_func = func;
153 elm_widget_changed_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj))
156 sd->changed_func = func;
160 elm_widget_theme(Evas_Object *obj)
166 EINA_LIST_FOREACH(sd->subobjs, l, child)
167 elm_widget_theme(child);
168 if (sd->resize_obj) elm_widget_theme(sd->resize_obj);
169 if (sd->hover_obj) elm_widget_theme(sd->hover_obj);
170 if (sd->theme_func) sd->theme_func(obj);
174 elm_widget_on_focus_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data)
177 sd->on_focus_func = func;
178 sd->on_focus_data = data;
182 elm_widget_on_change_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data)
185 sd->on_change_func = func;
186 sd->on_change_data = data;
190 elm_widget_on_show_region_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data)
193 sd->on_show_region_func = func;
194 sd->on_show_region_data = data;
198 elm_widget_data_set(Evas_Object *obj, void *data)
205 elm_widget_data_get(const Evas_Object *obj)
207 API_ENTRY return NULL;
212 elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj)
215 double scale, pscale = elm_widget_scale_get(sobj);
216 Elm_Theme *th, *pth = elm_widget_theme_get(sobj);
218 sd->subobjs = eina_list_append(sd->subobjs, sobj);
219 if (!sd->child_can_focus)
221 if (elm_widget_can_focus_get(sobj)) sd->child_can_focus = 1;
223 if (_elm_widget_is(sobj))
225 Smart_Data *sd2 = evas_object_smart_data_get(sobj);
229 elm_widget_sub_object_del(sd2->parent_obj, sobj);
230 sd2->parent_obj = obj;
233 evas_object_data_set(sobj, "elm-parent", obj);
234 evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
235 evas_object_smart_callback_call(obj, "sub-object-add", sobj);
236 scale = elm_widget_scale_get(sobj);
237 th = elm_widget_theme_get(sobj);
238 if ((scale != pscale) || (th != pth)) elm_widget_theme(sobj);
242 elm_widget_sub_object_del(Evas_Object *obj, Evas_Object *sobj)
244 Evas_Object *sobj_parent;
248 sobj_parent = evas_object_data_del(sobj, "elm-parent");
249 if (sobj_parent != obj)
251 static int abort_on_warn = -1;
252 ERR("removing sub object %p from parent %p, "
253 "but elm-parent is different %p!",
254 sobj, obj, sobj_parent);
255 if (EINA_UNLIKELY(abort_on_warn == -1))
257 if (getenv("ELM_ERROR_ABORT")) abort_on_warn = 1;
258 else abort_on_warn = 0;
260 if (abort_on_warn == 1) abort();
262 sd->subobjs = eina_list_remove(sd->subobjs, sobj);
263 if (!sd->child_can_focus)
265 if (elm_widget_can_focus_get(sobj)) sd->child_can_focus = 0;
267 if (_elm_widget_is(sobj))
269 Smart_Data *sd2 = evas_object_smart_data_get(sobj);
270 if (sd2) sd2->parent_obj = NULL;
272 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
273 evas_object_smart_callback_call(obj, "sub-object-del", sobj);
277 elm_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj)
282 evas_object_data_del(sd->resize_obj, "elm-parent");
283 if (_elm_widget_is(sd->resize_obj))
285 Smart_Data *sd2 = evas_object_smart_data_get(sd->resize_obj);
286 if (sd2) sd2->parent_obj = NULL;
288 evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_DEL,
290 evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_MOUSE_DOWN,
291 _sub_obj_mouse_down, sd);
292 evas_object_smart_member_del(sd->resize_obj);
294 sd->resize_obj = sobj;
297 if (_elm_widget_is(sd->resize_obj))
299 Smart_Data *sd2 = evas_object_smart_data_get(sd->resize_obj);
300 if (sd2) sd2->parent_obj = obj;
302 evas_object_clip_set(sobj, evas_object_clip_get(obj));
303 evas_object_smart_member_add(sobj, obj);
304 evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
305 evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_DOWN,
306 _sub_obj_mouse_down, sd);
307 _smart_reconfigure(sd);
308 evas_object_data_set(sobj, "elm-parent", obj);
309 evas_object_smart_callback_call(obj, "sub-object-add", sobj);
314 elm_widget_hover_object_set(Evas_Object *obj, Evas_Object *sobj)
319 evas_object_event_callback_del_full(sd->hover_obj, EVAS_CALLBACK_DEL,
322 sd->hover_obj = sobj;
325 evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
326 _smart_reconfigure(sd);
331 elm_widget_can_focus_set(Evas_Object *obj, int can_focus)
334 sd->can_focus = can_focus;
338 elm_widget_can_focus_get(const Evas_Object *obj)
341 if (sd->can_focus) return 1;
342 if (sd->child_can_focus) return 1;
347 elm_widget_focus_get(const Evas_Object *obj)
354 elm_widget_focused_object_get(const Evas_Object *obj)
356 const Evas_Object *subobj;
358 API_ENTRY return NULL;
360 if (!sd->focused) return NULL;
361 EINA_LIST_FOREACH(sd->subobjs, l, subobj)
363 Evas_Object *fobj = elm_widget_focused_object_get(subobj);
364 if (fobj) return fobj;
366 return (Evas_Object *)obj;
370 elm_widget_top_get(const Evas_Object *obj)
373 API_ENTRY return NULL;
374 if (sd->parent_obj) return elm_widget_top_get(sd->parent_obj);
375 return (Evas_Object *)obj;
377 Smart_Data *sd = evas_object_smart_data_get(obj);
380 if (!obj) return NULL;
381 if ((sd) && _elm_widget_is(obj))
383 if ((sd->type) && (!strcmp(sd->type, "win")))
384 return (Evas_Object *)obj;
386 return elm_widget_top_get(sd->parent_obj);
388 par = evas_object_smart_parent_get(obj);
389 if (!par) return (Evas_Object *)obj;
390 return elm_widget_top_get(par);
395 elm_widget_is(const Evas_Object *obj)
397 return _elm_widget_is(obj);
401 elm_widget_parent_widget_get(const Evas_Object *obj)
405 if (_elm_widget_is(obj))
407 Smart_Data *sd = evas_object_smart_data_get(obj);
408 if (!sd) return NULL;
409 parent = sd->parent_obj;
413 parent = evas_object_data_get(obj, "elm-parent");
415 parent = evas_object_smart_data_get(obj);
420 Evas_Object *elm_parent;
421 if (_elm_widget_is(parent)) break;
422 elm_parent = evas_object_data_get(parent, "elm-parent");
426 parent = evas_object_smart_parent_get(parent);
432 elm_widget_focus_jump(Evas_Object *obj, int forward)
435 if (!elm_widget_can_focus_get(obj)) return 0;
437 /* if it has a focus func its an end-point widget like a button */
440 if (!sd->focused) sd->focused = 1;
441 else sd->focused = 0;
442 if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
446 /* its some container */
455 elm_widget_focus_set(obj, forward);
457 if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
464 if (elm_widget_can_focus_get(sd->resize_obj))
467 (!elm_widget_disabled_get(sd->resize_obj)))
469 /* the previous focused item was unfocused - so focus
470 * the next one (that can be focused) */
471 if (elm_widget_focus_jump(sd->resize_obj, forward))
477 if (elm_widget_focus_get(sd->resize_obj))
479 /* jump to the next focused item or focus this item */
480 if (elm_widget_focus_jump(sd->resize_obj, forward))
482 /* it returned 0 - it got to the last item and is past it */
491 EINA_LIST_FOREACH(sd->subobjs, l, child)
493 if (elm_widget_can_focus_get(child))
496 (!elm_widget_disabled_get(child)))
498 /* the previous focused item was unfocused - so focus
499 * the next one (that can be focused) */
500 if (elm_widget_focus_jump(child, forward))
506 if (elm_widget_focus_get(child))
508 /* jump to the next focused item or focus this item */
509 if (elm_widget_focus_jump(child, forward))
511 /* it returned 0 - it got to the last item and is past it */
524 EINA_LIST_REVERSE_FOREACH(sd->subobjs, l, child)
526 if (elm_widget_can_focus_get(child))
529 (!elm_widget_disabled_get(child)))
531 /* the previous focused item was unfocused - so focus
532 * the next one (that can be focused) */
533 if (elm_widget_focus_jump(child, forward))
539 if (elm_widget_focus_get(child))
541 /* jump to the next focused item or focus this item */
542 if (elm_widget_focus_jump(child, forward))
544 /* it returned 0 - it got to the last item and is past it */
552 if (elm_widget_can_focus_get(sd->resize_obj))
555 (!elm_widget_disabled_get(sd->resize_obj)))
557 /* the previous focused item was unfocused - so focus
558 * the next one (that can be focused) */
559 if (elm_widget_focus_jump(sd->resize_obj, forward))
564 if (elm_widget_focus_get(sd->resize_obj))
566 /* jump to the next focused item or focus this item */
567 if (elm_widget_focus_jump(sd->resize_obj, forward))
569 /* it returned 0 - it got to the last item and is past it */
578 /* no next item can be focused */
582 if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
588 elm_widget_focus_set(Evas_Object *obj, int first)
594 if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
605 if ((elm_widget_can_focus_get(sd->resize_obj)) &&
606 (!elm_widget_disabled_get(sd->resize_obj)))
608 elm_widget_focus_set(sd->resize_obj, first);
614 EINA_LIST_FOREACH(sd->subobjs, l, child)
616 if ((elm_widget_can_focus_get(child)) &&
617 (!elm_widget_disabled_get(child)))
619 elm_widget_focus_set(child, first);
629 EINA_LIST_REVERSE_FOREACH(sd->subobjs, l, child)
631 if ((elm_widget_can_focus_get(child)) &&
632 (!elm_widget_disabled_get(child)))
634 elm_widget_focus_set(child, first);
640 if ((elm_widget_can_focus_get(sd->resize_obj)) &&
641 (!elm_widget_disabled_get(sd->resize_obj)))
643 elm_widget_focus_set(sd->resize_obj, first);
651 elm_widget_parent_get(const Evas_Object *obj)
653 API_ENTRY return NULL;
654 return sd->parent_obj;
658 elm_widget_focused_object_clear(Evas_Object *obj)
661 if (!sd->focused) return;
662 if (elm_widget_focus_get(sd->resize_obj))
663 elm_widget_focused_object_clear(sd->resize_obj);
668 EINA_LIST_FOREACH(sd->subobjs, l, child)
670 if (elm_widget_focus_get(child))
672 elm_widget_focused_object_clear(child);
678 if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
679 if (sd->focus_func) sd->focus_func(obj);
683 _elm_widget_parent_focus(Evas_Object *obj)
686 Evas_Object *o = elm_widget_parent_get(obj);
688 if (sd->focused) return;
689 if (o) _elm_widget_parent_focus(o);
691 if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
692 if (sd->focus_func) sd->focus_func(obj);
696 elm_widget_focus_steal(Evas_Object *obj)
698 Evas_Object *parent, *o;
701 if (sd->focused) return;
702 if (sd->disabled) return;
706 o = elm_widget_parent_get(parent);
708 sd = evas_object_smart_data_get(o);
709 if (sd->focused) break;
712 if (!elm_widget_parent_get(parent))
713 elm_widget_focused_object_clear(parent);
716 parent = elm_widget_parent_get(parent);
717 sd = evas_object_smart_data_get(parent);
718 if (elm_widget_focus_get(sd->resize_obj))
720 elm_widget_focused_object_clear(sd->resize_obj);
726 EINA_LIST_FOREACH(sd->subobjs, l, child)
728 if (elm_widget_focus_get(child))
730 elm_widget_focused_object_clear(child);
736 _elm_widget_parent_focus(obj);
741 elm_widget_activate(Evas_Object *obj)
744 elm_widget_change(obj);
745 if (sd->activate_func) sd->activate_func(obj);
749 elm_widget_change(Evas_Object *obj)
752 elm_widget_change(elm_widget_parent_get(obj));
753 if (sd->on_change_func) sd->on_change_func(sd->on_change_data, obj);
757 elm_widget_disabled_set(Evas_Object *obj, int disabled)
761 if (sd->disabled == disabled) return;
762 sd->disabled = disabled;
765 Evas_Object *o, *parent;
770 o = elm_widget_parent_get(parent);
774 elm_widget_focus_jump(parent, 1);
776 if (sd->disable_func) sd->disable_func(obj);
780 elm_widget_disabled_get(const Evas_Object *obj)
787 elm_widget_show_region_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
790 if ((x == sd->rx) && (y == sd->ry) && (w == sd->rw) && (h == sd->rh)) return;
795 if (sd->on_show_region_func)
796 sd->on_show_region_func(sd->on_show_region_data, obj);
799 Evas_Object *parent_obj;
802 parent_obj = sd->parent_obj;
803 sd = evas_object_smart_data_get(parent_obj);
804 if ((!parent_obj) || (!sd) || (!_elm_widget_is(parent_obj))) break;
805 if (sd->on_show_region_func)
807 sd->on_show_region_func(sd->on_show_region_data, obj);
816 elm_widget_show_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
826 elm_widget_scroll_hold_push(Evas_Object *obj)
830 if (sd->scroll_hold == 1)
831 evas_object_smart_callback_call(obj, "scroll-hold-on", obj);
832 if (sd->parent_obj) elm_widget_scroll_hold_push(sd->parent_obj);
833 // FIXME: on delete/reparent hold pop
837 elm_widget_scroll_hold_pop(Evas_Object *obj)
841 if (sd->scroll_hold < 0) sd->scroll_hold = 0;
842 if (sd->scroll_hold == 0)
843 evas_object_smart_callback_call(obj, "scroll-hold-off", obj);
844 if (sd->parent_obj) elm_widget_scroll_hold_pop(sd->parent_obj);
848 elm_widget_scroll_hold_get(const Evas_Object *obj)
851 return sd->scroll_hold;
855 elm_widget_scroll_freeze_push(Evas_Object *obj)
859 if (sd->scroll_freeze == 1)
860 evas_object_smart_callback_call(obj, "scroll-freeze-on", obj);
861 if (sd->parent_obj) elm_widget_scroll_freeze_push(sd->parent_obj);
862 // FIXME: on delete/reparent freeze pop
866 elm_widget_scroll_freeze_pop(Evas_Object *obj)
870 if (sd->scroll_freeze < 0) sd->scroll_freeze = 0;
871 if (sd->scroll_freeze == 0)
872 evas_object_smart_callback_call(obj, "scroll-freeze-off", obj);
873 if (sd->parent_obj) elm_widget_scroll_freeze_pop(sd->parent_obj);
877 elm_widget_scroll_freeze_get(const Evas_Object *obj)
880 return sd->scroll_freeze;
884 elm_widget_scale_set(Evas_Object *obj, double scale)
887 if (scale <= 0.0) scale = 0.0;
888 if (sd->scale != scale)
891 elm_widget_theme(obj);
896 elm_widget_scale_get(const Evas_Object *obj)
898 API_ENTRY return 1.0;
899 // FIXME: save walking up the tree by storingcaching parent scale
900 if (sd->scale == 0.0)
903 return elm_widget_scale_get(sd->parent_obj);
911 elm_widget_theme_set(Evas_Object *obj, Elm_Theme *th)
916 if (sd->theme) elm_theme_free(sd->theme);
919 elm_widget_theme(obj);
924 elm_widget_theme_get(const Evas_Object *obj)
926 API_ENTRY return NULL;
930 return elm_widget_theme_get(sd->parent_obj);
938 elm_widget_style_set(Evas_Object *obj, const char *style)
942 if (eina_stringshare_replace(&sd->style, style))
943 elm_widget_theme(obj);
947 elm_widget_style_get(const Evas_Object *obj)
950 if (sd->style) return sd->style;
955 elm_widget_type_set(Evas_Object *obj, const char *type)
958 eina_stringshare_replace(&sd->type, type);
962 elm_widget_type_get(const Evas_Object *obj)
965 if (sd->type) return sd->type;
978 _propagate_x_drag_lock(Evas_Object *obj, int dir)
980 Smart_Data *sd = evas_object_smart_data_get(obj);
983 Smart_Data *sd2 = evas_object_smart_data_get(sd->parent_obj);
986 sd2->child_drag_x_locked += dir;
987 _propagate_x_drag_lock(sd->parent_obj, dir);
993 _propagate_y_drag_lock(Evas_Object *obj, int dir)
995 Smart_Data *sd = evas_object_smart_data_get(obj);
998 Smart_Data *sd2 = evas_object_smart_data_get(sd->parent_obj);
1001 sd2->child_drag_y_locked += dir;
1002 _propagate_y_drag_lock(sd->parent_obj, dir);
1008 elm_widget_drag_lock_x_set(Evas_Object *obj, Eina_Bool lock)
1011 if (sd->drag_x_locked == lock) return;
1012 sd->drag_x_locked = lock;
1013 if (sd->drag_x_locked) _propagate_x_drag_lock(obj, 1);
1014 else _propagate_x_drag_lock(obj, -1);
1018 elm_widget_drag_lock_y_set(Evas_Object *obj, Eina_Bool lock)
1021 if (sd->drag_y_locked == lock) return;
1022 sd->drag_y_locked = lock;
1023 if (sd->drag_y_locked) _propagate_y_drag_lock(obj, 1);
1024 else _propagate_y_drag_lock(obj, -1);
1028 elm_widget_drag_lock_x_get(Evas_Object *obj)
1030 API_ENTRY return EINA_FALSE;
1031 printf("check %p x lock %i\n", obj, sd->drag_x_locked);
1032 return sd->drag_x_locked;
1036 elm_widget_drag_lock_y_get(Evas_Object *obj)
1038 API_ENTRY return EINA_FALSE;
1039 printf("check %p y lock %i\n", obj, sd->drag_y_locked);
1040 return sd->drag_y_locked;
1044 elm_widget_drag_child_locked_x_get(Evas_Object *obj)
1047 return sd->child_drag_x_locked;
1051 elm_widget_drag_child_locked_y_get(Evas_Object *obj)
1054 return sd->child_drag_y_locked;
1067 /* local subsystem functions */
1069 _smart_reconfigure(Smart_Data *sd)
1073 evas_object_move(sd->resize_obj, sd->x, sd->y);
1074 evas_object_resize(sd->resize_obj, sd->w, sd->h);
1078 evas_object_move(sd->hover_obj, sd->x, sd->y);
1079 evas_object_resize(sd->hover_obj, sd->w, sd->h);
1084 _smart_add(Evas_Object *obj)
1088 sd = calloc(1, sizeof(Smart_Data));
1096 evas_object_smart_data_set(obj, sd);
1100 _smart_del(Evas_Object *obj)
1105 if (sd->del_pre_func) sd->del_pre_func(obj);
1108 sobj = sd->resize_obj;
1109 sd->resize_obj = NULL;
1110 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
1111 evas_object_smart_callback_call(sd->obj, "sub-object-del", sobj);
1112 evas_object_del(sobj);
1116 sobj = sd->hover_obj;
1117 sd->hover_obj = NULL;
1118 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
1119 evas_object_smart_callback_call(sd->obj, "sub-object-del", sobj);
1120 evas_object_del(sobj);
1122 EINA_LIST_FREE(sd->subobjs, sobj)
1124 evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
1125 evas_object_smart_callback_call(sd->obj, "sub-object-del", sobj);
1126 evas_object_del(sobj);
1128 if (sd->del_func) sd->del_func(obj);
1129 if (sd->style) eina_stringshare_del(sd->style);
1130 if (sd->type) eina_stringshare_del(sd->type);
1131 if (sd->theme) elm_theme_free(sd->theme);
1136 _smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
1141 _smart_reconfigure(sd);
1145 _smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
1150 _smart_reconfigure(sd);
1154 _smart_show(Evas_Object *obj)
1157 evas_object_show(sd->resize_obj);
1161 _smart_hide(Evas_Object *obj)
1164 evas_object_hide(sd->resize_obj);
1168 _smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
1171 evas_object_color_set(sd->resize_obj, r, g, b, a);
1175 _smart_clip_set(Evas_Object *obj, Evas_Object *clip)
1178 evas_object_clip_set(sd->resize_obj, clip);
1182 _smart_clip_unset(Evas_Object *obj)
1185 evas_object_clip_unset(sd->resize_obj);
1189 _smart_calculate(Evas_Object *obj)
1192 if (sd->changed_func) sd->changed_func(obj);
1195 /* never need to touch this */
1200 if (_e_smart) return;
1202 static const Evas_Smart_Class sc =
1205 EVAS_SMART_CLASS_VERSION,
1223 _e_smart = evas_smart_class_new(&sc);
1230 _elm_stringlist_get(const char *str)
1232 Eina_List *list = NULL;
1234 if (!str) return NULL;
1235 for (b = s = str; 1; s++)
1237 if ((*s == ' ') || (*s == 0))
1239 char *t = malloc(s - b + 1);
1242 strncpy(t, b, s - b);
1244 list = eina_list_append(list, eina_stringshare_add(t));
1255 _elm_stringlist_free(Eina_List *list)
1258 EINA_LIST_FREE(list, s) eina_stringshare_del(s);
1262 _elm_widget_type_check(const Evas_Object *obj, const char *type)
1264 const char *provided, *expected = "(unknown)";
1265 static int abort_on_warn = -1;
1266 provided = elm_widget_type_get(obj);
1267 if (EINA_LIKELY(provided == type)) return EINA_TRUE;
1268 if (type) expected = type;
1269 if ((!provided) || (provided[0] == 0))
1271 provided = evas_object_type_get(obj);
1272 if ((!provided) || (provided[0] == 0))
1273 provided = "(unknown)";
1275 ERR("Passing Object: %p, of type: '%s' when expecting type: '%s'", obj, provided, expected);
1276 if (abort_on_warn == -1)
1278 if (getenv("ELM_ERROR_ABORT")) abort_on_warn = 1;
1279 else abort_on_warn = 0;
1281 if (abort_on_warn == 1) abort();
1285 static inline Eina_Bool
1286 _elm_widget_is(const Evas_Object *obj)
1288 const char *type = evas_object_type_get(obj);
1289 return type == SMART_NAME;