diff --git a/legacy/elementary/src/lib/elc_fileselector.c b/legacy/elementary/src/lib/elc_fileselector.c index d94d60e164..14a3ca1807 100644 --- a/legacy/elementary/src/lib/elc_fileselector.c +++ b/legacy/elementary/src/lib/elc_fileselector.c @@ -985,15 +985,12 @@ _elm_fileselector_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_fileselector_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_fileselector_smart_class_new()); + obj = elm_widget_add(_elm_fileselector_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elc_fileselector_button.c b/legacy/elementary/src/lib/elc_fileselector_button.c index d06a8d80e1..d75ef4b390 100644 --- a/legacy/elementary/src/lib/elc_fileselector_button.c +++ b/legacy/elementary/src/lib/elc_fileselector_button.c @@ -250,15 +250,12 @@ _elm_fileselector_button_smart_set_user(Elm_Button_Smart_Class *sc) EAPI Evas_Object * elm_fileselector_button_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_fileselector_button_smart_class_new()); + obj = elm_widget_add(_elm_fileselector_button_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elc_hoversel.c b/legacy/elementary/src/lib/elc_hoversel.c index cc6c3aab35..0454b36d59 100644 --- a/legacy/elementary/src/lib/elc_hoversel.c +++ b/legacy/elementary/src/lib/elc_hoversel.c @@ -292,12 +292,20 @@ _elm_hoversel_smart_del(Evas_Object *obj) ELM_WIDGET_CLASS(_elm_hoversel_parent_sc)->base.del(obj); } +static void +_elm_hoversel_smart_parent_set(Evas_Object *obj, + Evas_Object *parent) +{ + elm_hoversel_hover_parent_set(obj, parent); +} + static void _elm_hoversel_smart_set_user(Elm_Button_Smart_Class *sc) { ELM_WIDGET_CLASS(sc)->base.add = _elm_hoversel_smart_add; ELM_WIDGET_CLASS(sc)->base.del = _elm_hoversel_smart_del; + ELM_WIDGET_CLASS(sc)->parent_set = _elm_hoversel_smart_parent_set; ELM_WIDGET_CLASS(sc)->theme = _elm_hoversel_smart_theme; sc->admits_autorepeat = EINA_FALSE; @@ -306,21 +314,16 @@ _elm_hoversel_smart_set_user(Elm_Button_Smart_Class *sc) EAPI Evas_Object * elm_hoversel_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_hoversel_smart_class_new()); + obj = elm_widget_add(_elm_hoversel_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); - elm_hoversel_hover_parent_set(obj, parent); - return obj; } diff --git a/legacy/elementary/src/lib/elc_naviframe.c b/legacy/elementary/src/lib/elc_naviframe.c index 9a51962e57..2e28a0c7b8 100644 --- a/legacy/elementary/src/lib/elc_naviframe.c +++ b/legacy/elementary/src/lib/elc_naviframe.c @@ -919,15 +919,12 @@ _elm_naviframe_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_naviframe_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_naviframe_smart_class_new()); + obj = elm_widget_add(_elm_naviframe_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elc_player.c b/legacy/elementary/src/lib/elc_player.c index 0ce00dfec1..7ec67c01b5 100644 --- a/legacy/elementary/src/lib/elc_player.c +++ b/legacy/elementary/src/lib/elc_player.c @@ -561,15 +561,12 @@ EAPI Evas_Object * elm_player_add(Evas_Object *parent) { #ifdef HAVE_EMOTION - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_player_smart_class_new()); + obj = elm_widget_add(_elm_player_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_access.c b/legacy/elementary/src/lib/elm_access.c index 533fa07666..fe8946ce6a 100644 --- a/legacy/elementary/src/lib/elm_access.c +++ b/legacy/elementary/src/lib/elm_access.c @@ -705,15 +705,12 @@ _elm_access_2nd_click_timeout(Evas_Object *obj) static Evas_Object * _elm_access_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_access_smart_class_new()); + obj = elm_widget_add(_elm_access_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_actionslider.c b/legacy/elementary/src/lib/elm_actionslider.c index 68b336c13d..c916f21bff 100644 --- a/legacy/elementary/src/lib/elm_actionslider.c +++ b/legacy/elementary/src/lib/elm_actionslider.c @@ -464,15 +464,12 @@ _elm_actionslider_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_actionslider_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_actionslider_smart_class_new()); + obj = elm_widget_add(_elm_actionslider_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_bg.c b/legacy/elementary/src/lib/elm_bg.c index 41db770d9e..681fa790bf 100644 --- a/legacy/elementary/src/lib/elm_bg.c +++ b/legacy/elementary/src/lib/elm_bg.c @@ -173,15 +173,12 @@ _elm_bg_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_bg_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_bg_smart_class_new()); + obj = elm_widget_add(_elm_bg_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_box.c b/legacy/elementary/src/lib/elm_box.c index 9b953b3413..524c73d684 100644 --- a/legacy/elementary/src/lib/elm_box.c +++ b/legacy/elementary/src/lib/elm_box.c @@ -494,15 +494,12 @@ _elm_box_smart_set_user(Elm_Widget_Smart_Class *sc) EAPI Evas_Object * elm_box_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_box_smart_class_new()); + obj = elm_widget_add(_elm_box_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_bubble.c b/legacy/elementary/src/lib/elm_bubble.c index 16d9c1904d..c088b4b192 100644 --- a/legacy/elementary/src/lib/elm_bubble.c +++ b/legacy/elementary/src/lib/elm_bubble.c @@ -195,15 +195,12 @@ _elm_bubble_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_bubble_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_bubble_smart_class_new()); + obj = elm_widget_add(_elm_bubble_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_button.c b/legacy/elementary/src/lib/elm_button.c index 7dbae8af17..ed5217a914 100644 --- a/legacy/elementary/src/lib/elm_button.c +++ b/legacy/elementary/src/lib/elm_button.c @@ -370,15 +370,12 @@ _elm_button_widget_smart_set_user(Elm_Button_Smart_Class *sc __UNUSED__) EAPI Evas_Object * elm_button_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_button_widget_smart_class_new()); + obj = elm_widget_add(_elm_button_widget_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_calendar.c b/legacy/elementary/src/lib/elm_calendar.c index de957d3dee..0820bb6048 100644 --- a/legacy/elementary/src/lib/elm_calendar.c +++ b/legacy/elementary/src/lib/elm_calendar.c @@ -854,15 +854,12 @@ _elm_calendar_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_calendar_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_calendar_smart_class_new()); + obj = elm_widget_add(_elm_calendar_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_check.c b/legacy/elementary/src/lib/elm_check.c index e85da2820f..86abeb4225 100644 --- a/legacy/elementary/src/lib/elm_check.c +++ b/legacy/elementary/src/lib/elm_check.c @@ -363,15 +363,12 @@ _elm_check_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_check_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_check_smart_class_new()); + obj = elm_widget_add(_elm_check_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_clock.c b/legacy/elementary/src/lib/elm_clock.c index 1c2c3586ce..af3eaa1fd4 100644 --- a/legacy/elementary/src/lib/elm_clock.c +++ b/legacy/elementary/src/lib/elm_clock.c @@ -545,15 +545,12 @@ _elm_clock_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_clock_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_clock_smart_class_new()); + obj = elm_widget_add(_elm_clock_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_colorselector.c b/legacy/elementary/src/lib/elm_colorselector.c index ad5260ecd5..cd81d484cc 100644 --- a/legacy/elementary/src/lib/elm_colorselector.c +++ b/legacy/elementary/src/lib/elm_colorselector.c @@ -1297,15 +1297,12 @@ _elm_colorselector_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_colorselector_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_colorselector_smart_class_new()); + obj = elm_widget_add(_elm_colorselector_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_conform.c b/legacy/elementary/src/lib/elm_conform.c index 6935b6aada..c80b8c251e 100644 --- a/legacy/elementary/src/lib/elm_conform.c +++ b/legacy/elementary/src/lib/elm_conform.c @@ -575,12 +575,33 @@ _elm_conformant_smart_del(Evas_Object *obj) ELM_WIDGET_CLASS(_elm_conformant_parent_sc)->base.del(obj); } +static void +_elm_conformant_smart_parent_set(Evas_Object *obj, + Evas_Object *parent) +{ +#ifdef HAVE_ELEMENTARY_X + Evas_Object *top = elm_widget_top_get(parent); + Ecore_X_Window xwin = elm_win_xwindow_get(parent); + + if ((xwin) && (!elm_win_inlined_image_object_get(top))) + { + ELM_CONFORMANT_DATA_GET(obj, sd); + + sd->prop_hdl = ecore_event_handler_add + (ECORE_X_EVENT_WINDOW_PROPERTY, _on_prop_change, obj); + sd->vkb_state = ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF; + } + // FIXME: get kbd region prop +#endif +} + static void _elm_conformant_smart_set_user(Elm_Layout_Smart_Class *sc) { ELM_WIDGET_CLASS(sc)->base.add = _elm_conformant_smart_add; ELM_WIDGET_CLASS(sc)->base.del = _elm_conformant_smart_del; + ELM_WIDGET_CLASS(sc)->parent_set = _elm_conformant_smart_parent_set; ELM_WIDGET_CLASS(sc)->theme = _elm_conformant_smart_theme; /* not a 'focus chain manager' */ @@ -593,34 +614,15 @@ _elm_conformant_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_conformant_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; + obj = elm_widget_add(_elm_conformant_smart_class_new(), parent); + if (!obj) return NULL; - obj = evas_object_smart_add(e, _elm_conformant_smart_class_new()); - - /* NB: we got to sub-object-add before we probe for the top widget */ if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); -#ifdef HAVE_ELEMENTARY_X - Evas_Object *top = elm_widget_top_get(obj); - Ecore_X_Window xwin = elm_win_xwindow_get(top); - - if ((xwin) && (!elm_win_inlined_image_object_get(top))) - { - ELM_CONFORMANT_DATA_GET(obj, sd); - - sd->prop_hdl = ecore_event_handler_add - (ECORE_X_EVENT_WINDOW_PROPERTY, _on_prop_change, obj); - sd->vkb_state = ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF; - } - // FIXME: get kbd region prop -#endif - return obj; } diff --git a/legacy/elementary/src/lib/elm_datetime.c b/legacy/elementary/src/lib/elm_datetime.c index 77c807dd7f..3880a81ae3 100644 --- a/legacy/elementary/src/lib/elm_datetime.c +++ b/legacy/elementary/src/lib/elm_datetime.c @@ -854,15 +854,12 @@ _elm_datetime_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_datetime_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_datetime_smart_class_new()); + obj = elm_widget_add(_elm_datetime_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_dayselector.c b/legacy/elementary/src/lib/elm_dayselector.c index 434ff6898f..2dc0d17e01 100644 --- a/legacy/elementary/src/lib/elm_dayselector.c +++ b/legacy/elementary/src/lib/elm_dayselector.c @@ -523,15 +523,12 @@ _elm_dayselector_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_dayselector_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_dayselector_smart_class_new()); + obj = elm_widget_add(_elm_dayselector_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_diskselector.c b/legacy/elementary/src/lib/elm_diskselector.c index fd61cd3003..5cecf9be18 100644 --- a/legacy/elementary/src/lib/elm_diskselector.c +++ b/legacy/elementary/src/lib/elm_diskselector.c @@ -1288,18 +1288,16 @@ _elm_diskselector_smart_set_user(Elm_Widget_Smart_Class *sc) EAPI Evas_Object * elm_diskselector_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_diskselector_smart_class_new()); + obj = elm_widget_add(_elm_diskselector_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); + return obj; } diff --git a/legacy/elementary/src/lib/elm_flip.c b/legacy/elementary/src/lib/elm_flip.c index e7ced2584e..0a9c1532da 100644 --- a/legacy/elementary/src/lib/elm_flip.c +++ b/legacy/elementary/src/lib/elm_flip.c @@ -1906,15 +1906,12 @@ _elm_flip_smart_set_user(Elm_Container_Smart_Class *sc) EAPI Evas_Object * elm_flip_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_flip_smart_class_new()); + obj = elm_widget_add(_elm_flip_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_flipselector.c b/legacy/elementary/src/lib/elm_flipselector.c index 0d9ca60490..3249e0dcba 100644 --- a/legacy/elementary/src/lib/elm_flipselector.c +++ b/legacy/elementary/src/lib/elm_flipselector.c @@ -661,15 +661,12 @@ _elm_flipselector_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_flipselector_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_flipselector_smart_class_new()); + obj = elm_widget_add(_elm_flipselector_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_frame.c b/legacy/elementary/src/lib/elm_frame.c index aa0d38e13e..e4d78cbd24 100644 --- a/legacy/elementary/src/lib/elm_frame.c +++ b/legacy/elementary/src/lib/elm_frame.c @@ -208,15 +208,12 @@ _elm_frame_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_frame_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_frame_smart_class_new()); + obj = elm_widget_add(_elm_frame_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_gengrid.c b/legacy/elementary/src/lib/elm_gengrid.c index c19db8167c..cfca448e50 100644 --- a/legacy/elementary/src/lib/elm_gengrid.c +++ b/legacy/elementary/src/lib/elm_gengrid.c @@ -2432,18 +2432,16 @@ _elm_gengrid_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_gengrid_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_gengrid_smart_class_new()); + obj = elm_widget_add(_elm_gengrid_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); + return obj; } diff --git a/legacy/elementary/src/lib/elm_genlist.c b/legacy/elementary/src/lib/elm_genlist.c index eaad8f0c16..f1da85b9b6 100644 --- a/legacy/elementary/src/lib/elm_genlist.c +++ b/legacy/elementary/src/lib/elm_genlist.c @@ -4679,6 +4679,9 @@ _decorate_item_unset(Elm_Genlist_Smart_Data *sd) static void _elm_genlist_smart_add(Evas_Object *obj) { + Evas_Coord minw, minh; + Elm_Genlist_Pan_Smart_Data *pan_data; + EVAS_SMART_DATA_ALLOC(obj, Elm_Genlist_Smart_Data); ELM_WIDGET_CLASS(_elm_genlist_parent_sc)->base.add(obj); @@ -4687,11 +4690,57 @@ _elm_genlist_smart_add(Evas_Object *obj) evas_object_smart_member_add(priv->hit_rect, obj); elm_widget_sub_object_add(obj, priv->hit_rect); - /* common scroller hit rectangle setup -- it has to take place - * AFTER smart_member_add() */ + /* common scroller hit rectangle setup */ evas_object_color_set(priv->hit_rect, 0, 0, 0, 0); evas_object_show(priv->hit_rect); evas_object_repeat_events_set(priv->hit_rect, EINA_TRUE); + + elm_widget_can_focus_set(obj, EINA_TRUE); + elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj); + + priv->generation = 1; + + elm_layout_theme_set(obj, "genlist", "base", elm_widget_style_get(obj)); + + /* interface's add() routine issued AFTER the object's smart_add() */ + priv->s_iface = evas_object_smart_interface_get + (obj, ELM_SCROLLABLE_IFACE_NAME); + + priv->s_iface->objects_set + (obj, ELM_WIDGET_DATA(priv)->resize_obj, priv->hit_rect); + + priv->s_iface->bounce_allow_set + (obj, EINA_FALSE, _elm_config->thumbscroll_bounce_enable); + priv->v_bounce = _elm_config->thumbscroll_bounce_enable; + + priv->s_iface->animate_start_cb_set(obj, _scroll_animate_start_cb); + priv->s_iface->animate_stop_cb_set(obj, _scroll_animate_stop_cb); + priv->s_iface->drag_start_cb_set(obj, _scroll_drag_start_cb); + priv->s_iface->drag_stop_cb_set(obj, _scroll_drag_stop_cb); + priv->s_iface->edge_left_cb_set(obj, _edge_left_cb); + priv->s_iface->edge_right_cb_set(obj, _edge_right_cb); + priv->s_iface->edge_top_cb_set(obj, _edge_top_cb); + priv->s_iface->edge_bottom_cb_set(obj, _edge_bottom_cb); + + priv->mode = ELM_LIST_SCROLL; + priv->max_items_per_block = MAX_ITEMS_PER_BLOCK; + priv->item_cache_max = priv->max_items_per_block * 2; + priv->longpress_timeout = _elm_config->longpress_timeout; + priv->highlight = EINA_TRUE; + + priv->pan_obj = evas_object_smart_add + (evas_object_evas_get(obj), _elm_genlist_pan_smart_class_new()); + pan_data = evas_object_smart_data_get(priv->pan_obj); + pan_data->wsd = priv; + + priv->s_iface->extern_pan_set(obj, priv->pan_obj); + + edje_object_size_min_calc(ELM_WIDGET_DATA(priv)->resize_obj, &minw, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + + _mirrored_set(obj, elm_widget_mirrored_get(obj)); + + elm_layout_sizing_eval(obj); } static void @@ -4776,70 +4825,16 @@ _elm_genlist_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_genlist_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; - Evas_Coord minw, minh; - Elm_Genlist_Pan_Smart_Data *pan_data; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_genlist_smart_class_new()); + obj = elm_widget_add(_elm_genlist_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); - ELM_GENLIST_DATA_GET(obj, sd); - - elm_widget_can_focus_set(obj, EINA_TRUE); - elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj); - - sd->generation = 1; - - elm_layout_theme_set(obj, "genlist", "base", elm_widget_style_get(obj)); - - /* interface's add() routine issued AFTER the object's smart_add() */ - sd->s_iface = evas_object_smart_interface_get - (obj, ELM_SCROLLABLE_IFACE_NAME); - - sd->s_iface->objects_set - (obj, ELM_WIDGET_DATA(sd)->resize_obj, sd->hit_rect); - - sd->s_iface->bounce_allow_set - (obj, EINA_FALSE, _elm_config->thumbscroll_bounce_enable); - sd->v_bounce = _elm_config->thumbscroll_bounce_enable; - - sd->s_iface->animate_start_cb_set(obj, _scroll_animate_start_cb); - sd->s_iface->animate_stop_cb_set(obj, _scroll_animate_stop_cb); - sd->s_iface->drag_start_cb_set(obj, _scroll_drag_start_cb); - sd->s_iface->drag_stop_cb_set(obj, _scroll_drag_stop_cb); - sd->s_iface->edge_left_cb_set(obj, _edge_left_cb); - sd->s_iface->edge_right_cb_set(obj, _edge_right_cb); - sd->s_iface->edge_top_cb_set(obj, _edge_top_cb); - sd->s_iface->edge_bottom_cb_set(obj, _edge_bottom_cb); - - sd->mode = ELM_LIST_SCROLL; - sd->max_items_per_block = MAX_ITEMS_PER_BLOCK; - sd->item_cache_max = sd->max_items_per_block * 2; - sd->longpress_timeout = _elm_config->longpress_timeout; - sd->highlight = EINA_TRUE; - - sd->pan_obj = evas_object_smart_add - (evas_object_evas_get(obj), _elm_genlist_pan_smart_class_new()); - pan_data = evas_object_smart_data_get(sd->pan_obj); - pan_data->wsd = sd; - - sd->s_iface->extern_pan_set(obj, sd->pan_obj); - - edje_object_size_min_calc(ELM_WIDGET_DATA(sd)->resize_obj, &minw, &minh); - evas_object_size_hint_min_set(obj, minw, minh); - - _mirrored_set(obj, elm_widget_mirrored_get(obj)); - - elm_layout_sizing_eval(obj); - return obj; } diff --git a/legacy/elementary/src/lib/elm_gesture_layer.c b/legacy/elementary/src/lib/elm_gesture_layer.c index f43f65a606..08abba3baf 100644 --- a/legacy/elementary/src/lib/elm_gesture_layer.c +++ b/legacy/elementary/src/lib/elm_gesture_layer.c @@ -3655,15 +3655,12 @@ _elm_gesture_layer_smart_set_user(Elm_Widget_Smart_Class *sc) EAPI Evas_Object * elm_gesture_layer_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_gesture_layer_smart_class_new()); + obj = elm_widget_add(_elm_gesture_layer_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_glview.c b/legacy/elementary/src/lib/elm_glview.c index adbc3a5b18..d505b1f89b 100644 --- a/legacy/elementary/src/lib/elm_glview.c +++ b/legacy/elementary/src/lib/elm_glview.c @@ -332,17 +332,15 @@ _elm_glview_smart_set_user(Elm_Widget_Smart_Class *sc) EAPI Evas_Object * elm_glview_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_glview_smart_class_new()); + obj = elm_widget_add(_elm_glview_smart_class_new(), parent); + if (!obj) return NULL; ELM_GLVIEW_DATA_GET(obj, sd); + if (!sd->evasgl) return NULL; diff --git a/legacy/elementary/src/lib/elm_grid.c b/legacy/elementary/src/lib/elm_grid.c index 0e6c0c82b0..2d2d38f989 100644 --- a/legacy/elementary/src/lib/elm_grid.c +++ b/legacy/elementary/src/lib/elm_grid.c @@ -176,15 +176,12 @@ _elm_grid_smart_set_user(Elm_Widget_Smart_Class *sc) EAPI Evas_Object * elm_grid_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_grid_smart_class_new()); + obj = elm_widget_add(_elm_grid_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_hover.c b/legacy/elementary/src/lib/elm_hover.c index fd9835353c..80221acb19 100644 --- a/legacy/elementary/src/lib/elm_hover.c +++ b/legacy/elementary/src/lib/elm_hover.c @@ -658,6 +658,15 @@ _elm_hover_smart_hide(Evas_Object *obj) } } +static void +_elm_hover_smart_parent_set(Evas_Object *obj, + Evas_Object *parent) +{ + elm_hover_parent_set(obj, parent); + + elm_layout_sizing_eval(obj); +} + static void _elm_hover_smart_set_user(Elm_Layout_Smart_Class *sc) { @@ -668,6 +677,7 @@ _elm_hover_smart_set_user(Elm_Layout_Smart_Class *sc) ELM_WIDGET_CLASS(sc)->base.show = _elm_hover_smart_show; ELM_WIDGET_CLASS(sc)->base.hide = _elm_hover_smart_hide; + ELM_WIDGET_CLASS(sc)->parent_set = _elm_hover_smart_parent_set; ELM_WIDGET_CLASS(sc)->sub_object_add = _elm_hover_smart_sub_object_add; ELM_WIDGET_CLASS(sc)->sub_object_del = _elm_hover_smart_sub_object_del; ELM_WIDGET_CLASS(sc)->theme = _elm_hover_smart_theme; @@ -688,22 +698,16 @@ _elm_hover_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_hover_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_hover_smart_class_new()); + obj = elm_widget_add(_elm_hover_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); - elm_hover_parent_set(obj, parent); - elm_layout_sizing_eval(obj); - return obj; } diff --git a/legacy/elementary/src/lib/elm_icon.c b/legacy/elementary/src/lib/elm_icon.c index 012bb8db95..57ac5c92f5 100644 --- a/legacy/elementary/src/lib/elm_icon.c +++ b/legacy/elementary/src/lib/elm_icon.c @@ -807,15 +807,12 @@ _elm_icon_smart_set_user(Elm_Image_Smart_Class *sc) EAPI Evas_Object * elm_icon_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_icon_smart_class_new()); + obj = elm_widget_add(_elm_icon_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_image.c b/legacy/elementary/src/lib/elm_image.c index 3c5d098745..fcb99bf8ef 100644 --- a/legacy/elementary/src/lib/elm_image.c +++ b/legacy/elementary/src/lib/elm_image.c @@ -1077,15 +1077,12 @@ elm_image_smart_class_get(void) EAPI Evas_Object * elm_image_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_image_smart_class_new()); + obj = elm_widget_add(_elm_image_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_index.c b/legacy/elementary/src/lib/elm_index.c index 7429d38628..4cce1bee4f 100644 --- a/legacy/elementary/src/lib/elm_index.c +++ b/legacy/elementary/src/lib/elm_index.c @@ -713,15 +713,12 @@ _elm_index_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_index_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_index_smart_class_new()); + obj = elm_widget_add(_elm_index_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_inwin.c b/legacy/elementary/src/lib/elm_inwin.c index c6c0e8ac66..fe363dccf8 100644 --- a/legacy/elementary/src/lib/elm_inwin.c +++ b/legacy/elementary/src/lib/elm_inwin.c @@ -90,6 +90,19 @@ _elm_inwin_smart_add(Evas_Object *obj) elm_widget_can_focus_set(obj, EINA_FALSE); elm_widget_highlight_ignore_set(obj, EINA_TRUE); + + evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_layout_theme_set(obj, "win", "inwin", elm_object_style_get(obj)); +} + +static void +_elm_inwin_smart_parent_set(Evas_Object *obj, + Evas_Object *parent) +{ + elm_win_resize_object_add(parent, obj); + + elm_layout_sizing_eval(obj); } static void @@ -98,6 +111,7 @@ _elm_inwin_smart_set_user(Elm_Layout_Smart_Class *sc) ELM_WIDGET_CLASS(sc)->base.add = _elm_inwin_smart_add; ELM_WIDGET_CLASS(sc)->focus_next = _elm_inwin_smart_focus_next; + ELM_WIDGET_CLASS(sc)->parent_set = _elm_inwin_smart_parent_set; sc->sizing_eval = _elm_inwin_smart_sizing_eval; @@ -107,28 +121,17 @@ _elm_inwin_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_win_inwin_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; if (!parent || !elm_widget_type_check((parent), "elm_win", __func__)) return NULL; /* *has* to have a parent window */ - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_inwin_smart_class_new()); + obj = elm_widget_add(_elm_inwin_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); - evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_win_resize_object_add(parent, obj); - - elm_layout_theme_set(obj, "win", "inwin", elm_object_style_get(obj)); - - elm_layout_sizing_eval(obj); - return obj; } diff --git a/legacy/elementary/src/lib/elm_label.c b/legacy/elementary/src/lib/elm_label.c index c0833da8d0..0eba7e2f36 100644 --- a/legacy/elementary/src/lib/elm_label.c +++ b/legacy/elementary/src/lib/elm_label.c @@ -398,15 +398,12 @@ _elm_label_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_label_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_label_smart_class_new()); + obj = elm_widget_add(_elm_label_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_layout.c b/legacy/elementary/src/lib/elm_layout.c index 61695a6034..9d661e1bc3 100644 --- a/legacy/elementary/src/lib/elm_layout.c +++ b/legacy/elementary/src/lib/elm_layout.c @@ -1802,15 +1802,12 @@ elm_layout_edje_object_can_access_get(Evas_Object *obj) EAPI Evas_Object * elm_layout_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_layout_widget_smart_class_new()); + obj = elm_widget_add(_elm_layout_widget_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_list.c b/legacy/elementary/src/lib/elm_list.c index 3b7b0d5f2a..4f4b56450c 100644 --- a/legacy/elementary/src/lib/elm_list.c +++ b/legacy/elementary/src/lib/elm_list.c @@ -1740,15 +1740,12 @@ _elm_list_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_list_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_list_smart_class_new()); + obj = elm_widget_add(_elm_list_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_mapbuf.c b/legacy/elementary/src/lib/elm_mapbuf.c index ec9555eead..3365b69859 100644 --- a/legacy/elementary/src/lib/elm_mapbuf.c +++ b/legacy/elementary/src/lib/elm_mapbuf.c @@ -289,15 +289,12 @@ _elm_mapbuf_smart_set_user(Elm_Container_Smart_Class *sc) EAPI Evas_Object * elm_mapbuf_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_mapbuf_smart_class_new()); + obj = elm_widget_add(_elm_mapbuf_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_menu.c b/legacy/elementary/src/lib/elm_menu.c index 66468bab41..19a117c826 100644 --- a/legacy/elementary/src/lib/elm_menu.c +++ b/legacy/elementary/src/lib/elm_menu.c @@ -631,6 +631,21 @@ _elm_menu_smart_del(Evas_Object *obj) _elm_menu_parent_sc->base.del(obj); /* handles freeing sd */ } +static void +_elm_menu_smart_parent_set(Evas_Object *obj, + Evas_Object *parent) +{ + ELM_MENU_DATA_GET(obj, sd); + + elm_menu_parent_set(obj, parent); + elm_hover_target_set(sd->hv, sd->location); + elm_layout_content_set + (sd->hv, elm_hover_best_content_location_get + (sd->hv, ELM_HOVER_AXIS_VERTICAL), sd->bx); + + _sizing_eval(obj); +} + static void _elm_menu_smart_set_user(Elm_Widget_Smart_Class *sc) { @@ -642,35 +657,23 @@ _elm_menu_smart_set_user(Elm_Widget_Smart_Class *sc) sc->focus_next = NULL; sc->focus_direction = NULL; + sc->parent_set = _elm_menu_smart_parent_set; sc->theme = _elm_menu_smart_theme; } EAPI Evas_Object * elm_menu_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_menu_smart_class_new()); + obj = elm_widget_add(_elm_menu_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); - ELM_MENU_DATA_GET(obj, sd); - - elm_menu_parent_set(obj, parent); - elm_hover_target_set(sd->hv, sd->location); - elm_layout_content_set - (sd->hv, elm_hover_best_content_location_get - (sd->hv, ELM_HOVER_AXIS_VERTICAL), sd->bx); - - _sizing_eval(obj); - return obj; } diff --git a/legacy/elementary/src/lib/elm_notify.c b/legacy/elementary/src/lib/elm_notify.c index 40245b3454..d8446fa44b 100644 --- a/legacy/elementary/src/lib/elm_notify.c +++ b/legacy/elementary/src/lib/elm_notify.c @@ -578,6 +578,7 @@ _elm_notify_smart_add(Evas_Object *obj) (obj, EVAS_CALLBACK_RESTACK, _restack_cb, obj); elm_widget_can_focus_set(obj, EINA_FALSE); + elm_notify_orient_set(obj, ELM_NOTIFY_ORIENT_TOP); } static void @@ -596,6 +597,15 @@ _elm_notify_smart_del(Evas_Object *obj) ELM_WIDGET_CLASS(_elm_notify_parent_sc)->base.del(obj); } +static void +_elm_notify_smart_parent_set(Evas_Object *obj, + Evas_Object *parent) +{ + elm_notify_parent_set(obj, parent); + + _sizing_eval(obj); +} + static void _elm_notify_smart_set_user(Elm_Container_Smart_Class *sc) { @@ -607,6 +617,7 @@ _elm_notify_smart_set_user(Elm_Container_Smart_Class *sc) ELM_WIDGET_CLASS(sc)->base.show = _elm_notify_smart_show; ELM_WIDGET_CLASS(sc)->base.hide = _elm_notify_smart_hide; + ELM_WIDGET_CLASS(sc)->parent_set = _elm_notify_smart_parent_set; ELM_WIDGET_CLASS(sc)->theme = _elm_notify_smart_theme; ELM_WIDGET_CLASS(sc)->focus_next = _elm_notify_smart_focus_next; ELM_WIDGET_CLASS(sc)->focus_direction = _elm_notify_smart_focus_direction; @@ -621,24 +632,16 @@ _elm_notify_smart_set_user(Elm_Container_Smart_Class *sc) EAPI Evas_Object * elm_notify_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_notify_smart_class_new()); + obj = elm_widget_add(_elm_notify_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); - elm_notify_orient_set(obj, ELM_NOTIFY_ORIENT_TOP); - elm_notify_parent_set(obj, parent); - - _sizing_eval(obj); - return obj; } diff --git a/legacy/elementary/src/lib/elm_panes.c b/legacy/elementary/src/lib/elm_panes.c index 39799152eb..0b1e6f9d21 100644 --- a/legacy/elementary/src/lib/elm_panes.c +++ b/legacy/elementary/src/lib/elm_panes.c @@ -242,15 +242,12 @@ _elm_panes_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_panes_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_panes_smart_class_new()); + obj = elm_widget_add(_elm_panes_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_photo.c b/legacy/elementary/src/lib/elm_photo.c index 9bf9799605..c0313bc90b 100644 --- a/legacy/elementary/src/lib/elm_photo.c +++ b/legacy/elementary/src/lib/elm_photo.c @@ -349,15 +349,12 @@ _elm_photo_smart_set_user(Elm_Widget_Smart_Class *sc) EAPI Evas_Object * elm_photo_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_photo_smart_class_new()); + obj = elm_widget_add(_elm_photo_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_photocam.c b/legacy/elementary/src/lib/elm_photocam.c index d66b8e825d..0fefed5f4a 100644 --- a/legacy/elementary/src/lib/elm_photocam.c +++ b/legacy/elementary/src/lib/elm_photocam.c @@ -1569,18 +1569,16 @@ _elm_photocam_smart_set_user(Elm_Widget_Smart_Class *sc) EAPI Evas_Object * elm_photocam_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_photocam_smart_class_new()); + obj = elm_widget_add(_elm_photocam_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); + return obj; } diff --git a/legacy/elementary/src/lib/elm_plug.c b/legacy/elementary/src/lib/elm_plug.c index 9e965583fd..0a065fe7b5 100644 --- a/legacy/elementary/src/lib/elm_plug.c +++ b/legacy/elementary/src/lib/elm_plug.c @@ -114,15 +114,12 @@ _elm_plug_smart_set_user(Elm_Widget_Smart_Class *sc) EAPI Evas_Object * elm_plug_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_plug_smart_class_new()); + obj = elm_widget_add(_elm_plug_smart_class_new(), parent); + if (!obj) return NULL; ELM_PLUG_DATA_GET(obj, sd); if (!ELM_WIDGET_DATA(sd)->resize_obj) return NULL; diff --git a/legacy/elementary/src/lib/elm_progressbar.c b/legacy/elementary/src/lib/elm_progressbar.c index db531bf01b..0497b46cb9 100644 --- a/legacy/elementary/src/lib/elm_progressbar.c +++ b/legacy/elementary/src/lib/elm_progressbar.c @@ -300,15 +300,12 @@ _elm_progressbar_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_progressbar_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_progressbar_smart_class_new()); + obj = elm_widget_add(_elm_progressbar_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_radio.c b/legacy/elementary/src/lib/elm_radio.c index 9df43815c0..03f84cd869 100644 --- a/legacy/elementary/src/lib/elm_radio.c +++ b/legacy/elementary/src/lib/elm_radio.c @@ -359,15 +359,12 @@ _elm_radio_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_radio_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_radio_smart_class_new()); + obj = elm_widget_add(_elm_radio_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_route.c b/legacy/elementary/src/lib/elm_route.c index b0c055a629..b30aedae2c 100644 --- a/legacy/elementary/src/lib/elm_route.c +++ b/legacy/elementary/src/lib/elm_route.c @@ -244,15 +244,12 @@ _elm_route_smart_set_user(Elm_Widget_Smart_Class *sc) EAPI Evas_Object * elm_route_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_route_smart_class_new()); + obj = elm_widget_add(_elm_route_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_segment_control.c b/legacy/elementary/src/lib/elm_segment_control.c index 5405232532..2c3f23bcd0 100644 --- a/legacy/elementary/src/lib/elm_segment_control.c +++ b/legacy/elementary/src/lib/elm_segment_control.c @@ -596,15 +596,12 @@ _elm_segment_control_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_segment_control_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_segment_control_smart_class_new()); + obj = elm_widget_add(_elm_segment_control_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_separator.c b/legacy/elementary/src/lib/elm_separator.c index 08e24ca5f8..895b665026 100644 --- a/legacy/elementary/src/lib/elm_separator.c +++ b/legacy/elementary/src/lib/elm_separator.c @@ -106,15 +106,12 @@ _elm_separator_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_separator_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_separator_smart_class_new()); + obj = elm_widget_add(_elm_separator_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_slider.c b/legacy/elementary/src/lib/elm_slider.c index 81b6811621..bc3e0d4a76 100644 --- a/legacy/elementary/src/lib/elm_slider.c +++ b/legacy/elementary/src/lib/elm_slider.c @@ -801,15 +801,12 @@ _elm_slider_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_slider_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_slider_smart_class_new()); + obj = elm_widget_add(_elm_slider_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_slideshow.c b/legacy/elementary/src/lib/elm_slideshow.c index a9e8964abd..a7844160ce 100644 --- a/legacy/elementary/src/lib/elm_slideshow.c +++ b/legacy/elementary/src/lib/elm_slideshow.c @@ -446,15 +446,12 @@ _elm_slideshow_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_slideshow_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_slideshow_smart_class_new()); + obj = elm_widget_add(_elm_slideshow_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_spinner.c b/legacy/elementary/src/lib/elm_spinner.c index 81f6061bb0..3c276ab06c 100644 --- a/legacy/elementary/src/lib/elm_spinner.c +++ b/legacy/elementary/src/lib/elm_spinner.c @@ -602,15 +602,12 @@ _elm_spinner_smart_set_user(Elm_Layout_Smart_Class *sc) EAPI Evas_Object * elm_spinner_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_spinner_smart_class_new()); + obj = elm_widget_add(_elm_spinner_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_table.c b/legacy/elementary/src/lib/elm_table.c index 45d0fb15be..9dae0499e0 100644 --- a/legacy/elementary/src/lib/elm_table.c +++ b/legacy/elementary/src/lib/elm_table.c @@ -224,15 +224,12 @@ _elm_table_smart_set_user(Elm_Widget_Smart_Class *sc) EAPI Evas_Object * elm_table_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_table_smart_class_new()); + obj = elm_widget_add(_elm_table_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_thumb.c b/legacy/elementary/src/lib/elm_thumb.c index ee50adadc7..d4c9018a82 100644 --- a/legacy/elementary/src/lib/elm_thumb.c +++ b/legacy/elementary/src/lib/elm_thumb.c @@ -660,15 +660,12 @@ _elm_thumb_smart_set_user(Elm_Widget_Smart_Class *sc) EAPI Evas_Object * elm_thumb_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_thumb_smart_class_new()); + obj = elm_widget_add(_elm_thumb_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_video.c b/legacy/elementary/src/lib/elm_video.c index 17d664986c..6b8e4dea66 100644 --- a/legacy/elementary/src/lib/elm_video.c +++ b/legacy/elementary/src/lib/elm_video.c @@ -266,6 +266,8 @@ _elm_video_smart_add(Evas_Object *obj) { EVAS_SMART_DATA_ALLOC(obj, Elm_Video_Smart_Data); + _elm_emotion_init(); + ELM_WIDGET_CLASS(_elm_video_parent_sc)->base.add(obj); elm_widget_can_focus_set(obj, EINA_TRUE); @@ -327,7 +329,6 @@ _elm_video_smart_set_user(Elm_Layout_Smart_Class *sc) ELM_WIDGET_CLASS(sc)->focus_next = NULL; ELM_WIDGET_CLASS(sc)->focus_direction = NULL; - sc->sizing_eval = _elm_video_smart_sizing_eval; } @@ -335,17 +336,12 @@ EAPI Evas_Object * elm_video_add(Evas_Object *parent) { #ifdef HAVE_EMOTION - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - _elm_emotion_init(); - - obj = evas_object_smart_add(e, _elm_video_smart_class_new()); + obj = elm_widget_add(_elm_video_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); diff --git a/legacy/elementary/src/lib/elm_web.c b/legacy/elementary/src/lib/elm_web.c index 220d0853cf..8797d0e8c3 100644 --- a/legacy/elementary/src/lib/elm_web.c +++ b/legacy/elementary/src/lib/elm_web.c @@ -1316,15 +1316,12 @@ _elm_web_smart_set_user(Elm_Widget_Smart_Class *sc) EAPI Evas_Object * elm_web_add(Evas_Object *parent) { - Evas *e; Evas_Object *obj; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - e = evas_object_evas_get(parent); - if (!e) return NULL; - - obj = evas_object_smart_add(e, _elm_web_smart_class_new()); + obj = elm_widget_add(_elm_web_smart_class_new(), parent); + if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent);