From: ChunEon Park Date: Sat, 16 Feb 2013 11:11:25 +0000 (+0000) Subject: elementary/widget, naviframe, popup, label, button X-Git-Tag: submit/efl/20131021.015827~961 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b0b3b9b70d1c616c211c7794df257abfde60973f;p=platform%2Fupstream%2Felementary.git elementary/widget, naviframe, popup, label, button let elm_wdg_orientation_set() have return value and call the elm_wdg_theme() inside. since every widgets tend to do same task with smart_theme() when it's orient mode is changed. SVN revision: 83981 --- diff --git a/src/lib/elc_naviframe.c b/src/lib/elc_naviframe.c index c18a6f0..e7cf3ba 100644 --- a/src/lib/elc_naviframe.c +++ b/src/lib/elc_naviframe.c @@ -277,9 +277,14 @@ _item_title_visible_update(Elm_Naviframe_Item *nit) } static void -_theme_update(Evas_Object *obj, Elm_Naviframe_Smart_Data *sd) +_elm_naviframe_smart_theme(Eo *obj, void *_pd, va_list *list) { Elm_Naviframe_Item *it; + Elm_Naviframe_Smart_Data *sd = _pd; + Eina_Bool *ret = va_arg(*list, Eina_Bool *); + Eina_Bool int_ret = EINA_FALSE; + eo_do_super(obj, elm_wdg_theme(&int_ret)); + if (!int_ret) return; EINA_INLIST_FOREACH(sd->stack, it) { @@ -289,28 +294,9 @@ _theme_update(Evas_Object *obj, Elm_Naviframe_Smart_Data *sd) } elm_layout_sizing_eval(obj); -} - -static void -_elm_naviframe_smart_theme(Eo *obj, void *_pd, va_list *list) -{ - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - Eina_Bool int_ret = EINA_FALSE; - eo_do_super(obj, elm_wdg_theme(&int_ret)); - if (!int_ret) return; - _theme_update(obj, _pd); if (ret) *ret = EINA_TRUE; } -static void -_elm_naviframe_smart_orientation_set(Eo *obj, void *_pd, va_list *list) -{ - int rotation = va_arg(*list, int); - eo_do_super(obj, elm_wdg_orientation_set(rotation)); - //TODO: Deffered Updation. update only top item. - _theme_update(obj, _pd); -} - static char * _access_info_cb(void *data, Evas_Object *obj __UNUSED__) { @@ -1270,6 +1256,9 @@ _elm_naviframe_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_obj_size_hints_changed, obj); elm_widget_can_focus_set(obj, EINA_FALSE); + + if (!elm_widget_sub_object_add(eo_parent_get(obj), obj)) + ERR("could not add %p as sub object of %p", obj, eo_parent_get(obj)); } static Eina_Bool @@ -1370,10 +1359,6 @@ _constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) eo_do(obj, evas_obj_type_set(MY_CLASS_NAME), evas_obj_smart_callbacks_descriptions_set(_smart_callbacks, NULL)); - - Evas_Object *parent = eo_parent_get(obj); - if (!elm_widget_sub_object_add(parent, obj)) - ERR("could not add %p as sub object of %p", obj, parent); } EAPI Elm_Object_Item * @@ -1985,7 +1970,6 @@ _class_constructor(Eo_Class *klass) EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT), _elm_naviframe_smart_focus_next), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_THEME), _elm_naviframe_smart_theme), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ACCESS), _elm_naviframe_smart_access), - EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ORIENTATION_SET), _elm_naviframe_smart_orientation_set), EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_SET), _elm_naviframe_smart_content_set), EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_GET), _elm_naviframe_smart_content_get), diff --git a/src/lib/elc_popup.c b/src/lib/elc_popup.c index 34b50a1..8030b74 100644 --- a/src/lib/elc_popup.c +++ b/src/lib/elc_popup.c @@ -1383,12 +1383,14 @@ _elm_popup_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) Elm_Widget_Smart_Data *wd = eo_data_get(obj, ELM_OBJ_WIDGET_CLASS); eo_do_super(obj, evas_obj_smart_add()); - elm_layout_theme_set(obj, "popup", "base", elm_widget_style_get(obj)); - evas_object_size_hint_weight_set (wd->resize_obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set (wd->resize_obj, EVAS_HINT_FILL, EVAS_HINT_FILL); + if (!elm_widget_sub_object_add(eo_parent_get(obj), obj)) + ERR("could not add %p as sub object of %p", obj, eo_parent_get(obj)); + + elm_layout_theme_set(obj, "popup", "base", elm_widget_style_get(obj)); priv->notify = elm_notify_add(obj); elm_notify_align_set(priv->notify, 0.5, 0.5); @@ -1482,9 +1484,6 @@ _constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) eo_do(obj, evas_obj_type_set(MY_CLASS_NAME), evas_obj_smart_callbacks_descriptions_set(_smart_callbacks, NULL)); - - if (!elm_widget_sub_object_add(eo_parent_get(obj), obj)) - ERR("could not add %p as sub object of %p", obj, eo_parent_get(obj)); } EAPI void diff --git a/src/lib/elm_button.c b/src/lib/elm_button.c index 6528f8e..ffe06b7 100644 --- a/src/lib/elm_button.c +++ b/src/lib/elm_button.c @@ -117,10 +117,8 @@ _elm_button_smart_theme(Eo *obj, void *_pd EINA_UNUSED, va_list *list) Eina_Bool *ret = va_arg(*list, Eina_Bool *); if (ret) *ret = EINA_FALSE; Eina_Bool int_ret = EINA_FALSE; - eo_do_super(obj, elm_wdg_theme(&int_ret)); if (!int_ret) return; - _icon_signal_emit(obj); if (ret) *ret = EINA_TRUE; @@ -521,16 +519,6 @@ _elm_button_smart_focus_direction_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA } static void -_elm_button_smart_orientation_set(Eo *obj __UNUSED__, void *_pd __UNUSED__, va_list *list) - -{ - int rotation = va_arg(*list, int); - eo_do_super(obj, elm_wdg_orientation_set(rotation)); - elm_layout_theme_set(obj, "button", "base", elm_widget_style_get(obj)); - _icon_signal_emit(obj); -} - -static void _class_constructor(Eo_Class *klass) { const Eo_Op_Func_Description func_desc[] = { @@ -544,7 +532,6 @@ _class_constructor(Eo_Class *klass) EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ACTIVATE), _elm_button_smart_activate), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT_MANAGER_IS), _elm_button_smart_focus_next_manager_is), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_DIRECTION_MANAGER_IS), _elm_button_smart_focus_direction_manager_is), - EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ORIENTATION_SET), _elm_button_smart_orientation_set), EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_SET), _elm_button_smart_content_set), diff --git a/src/lib/elm_label.c b/src/lib/elm_label.c index ec55414..0af94c0 100644 --- a/src/lib/elm_label.c +++ b/src/lib/elm_label.c @@ -151,23 +151,6 @@ _label_slide_change(Evas_Object *obj) } static void -_elm_label_smart_orientation_set(Eo *obj, void *_pd, va_list *list) -{ - int rotation = va_arg(*list, int); - Elm_Widget_Smart_Data *wd = eo_data_get(obj, ELM_OBJ_WIDGET_CLASS); - Elm_Label_Smart_Data *sd = _pd; - - eo_do_super(obj, elm_wdg_orientation_set(rotation)); - - elm_layout_theme_set(obj, "label", "base", elm_widget_style_get(obj)); - evas_event_freeze(evas_object_evas_get(obj)); - _label_format_set(wd->resize_obj, sd->format); - _label_slide_change(obj); - evas_event_thaw(evas_object_evas_get(obj)); - evas_event_thaw_eval(evas_object_evas_get(obj)); -} - -static void _elm_label_smart_theme(Eo *obj, void *_pd, va_list *list) { Eina_Bool *ret = va_arg(*list, Eina_Bool *); @@ -748,7 +731,6 @@ _class_constructor(Eo_Class *klass) EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_TRANSLATE), _elm_label_smart_translate), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT_MANAGER_IS), _elm_label_smart_focus_next_manager_is), EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_DIRECTION_MANAGER_IS), _elm_label_smart_focus_direction_manager_is), - EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ORIENTATION_SET), _elm_label_smart_orientation_set), EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_SIZING_EVAL), _elm_label_smart_sizing_eval), EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_TEXT_SET), _elm_label_smart_text_set), diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index 83c9fa6..1b33367 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -1046,7 +1046,6 @@ _elm_widget_sub_object_add(Eo *obj, void *_pd, va_list *list) if (!elm_widget_sub_object_del(data, sobj)) return; } } - sd->subobjs = eina_list_append(sd->subobjs, sobj); evas_object_data_set(sobj, "elm-parent", obj); evas_object_event_callback_add @@ -4089,11 +4088,10 @@ _elm_widget_theme_object_set(Eo *obj, void *_pd EINA_UNUSED, va_list *list) const char *welement = va_arg(*list, const char *); const char *wstyle = va_arg(*list, const char *); Eina_Bool *ret = va_arg(*list, Eina_Bool *); + Eina_Bool ret2 = EINA_FALSE; Elm_Widget_Smart_Data *sd = _pd; char buf[128]; - if (*ret) *ret = EINA_FALSE; - //Apply orientation styles. if (welement) { @@ -4112,16 +4110,18 @@ _elm_widget_theme_object_set(Eo *obj, void *_pd EINA_UNUSED, va_list *list) strncpy(buf, welement, sizeof(buf)); break; } - *ret = _elm_theme_object_set(obj, edj, wname, buf, wstyle); + ret2 = _elm_theme_object_set(obj, edj, wname, buf, wstyle); } - if (!*ret) + if (!ret2) { - *ret = _elm_theme_object_set(obj, edj, wname, welement, wstyle); - strncpy(buf, "elm,state,orient,default", sizeof(buf)); + ret2 = _elm_theme_object_set(obj, edj, wname, welement, wstyle); + strncpy(buf, "elm,state,orient,0", sizeof(buf)); } else snprintf(buf, sizeof(buf), "elm,state,orient,%d", sd->orient_mode); elm_object_signal_emit(obj, buf, "elm"); + + if (ret) *ret = ret2; } static void @@ -4515,13 +4515,13 @@ _elm_widget_orientation_mode_disabled_set(Eo *obj __UNUSED__, void *_pd, va_list if (!disabled) { - //Get current orient mode form it's parent otherwise, 0. + //Get current orient mode from it's parent otherwise, 0. sd->orient_mode = 0; ELM_WIDGET_DATA_GET(sd->parent_obj, sd_parent); if (!sd_parent) orient_mode = 0; else orient_mode = sd_parent->orient_mode; } - eo_do((Eo *) obj, elm_wdg_orientation_set(orient_mode)); + eo_do((Eo *) obj, elm_wdg_orientation_set(orient_mode, NULL)); } EAPI Eina_Bool @@ -4548,7 +4548,7 @@ elm_widget_orientation_set(Evas_Object *obj, int rotation) ELM_WIDGET_CHECK(obj); ELM_WIDGET_DATA_GET(obj, sd); if ((sd->orient_mode == rotation) || (sd->orient_mode == -1)) return; - eo_do((Eo *) obj, elm_wdg_orientation_set(rotation)); + eo_do((Eo *) obj, elm_wdg_orientation_set(rotation, NULL)); } static void @@ -4557,12 +4557,17 @@ _elm_widget_orientation_set(Eo *obj __UNUSED__, void *_pd, va_list *list) Evas_Object *child; Eina_List *l; int orient_mode = va_arg(*list, int); + Eina_Bool *ret = va_arg(*list, Eina_Bool *); Elm_Widget_Smart_Data *sd = _pd; sd->orient_mode = orient_mode; + eo_do(obj, elm_wdg_theme(NULL)); + EINA_LIST_FOREACH (sd->subobjs, l, child) elm_widget_orientation_set(child, orient_mode); + + if (ret) *ret = EINA_TRUE; } /** diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h index 8dd072f..9aed6a8 100644 --- a/src/lib/elm_widget.h +++ b/src/lib/elm_widget.h @@ -2402,10 +2402,11 @@ typedef void * (*list_data_get_func_type)(const Eina_List * l); * * No description supplied by the EAPI. * + * @param[in] degree * @param[out] ret * */ -#define elm_wdg_orientation_set(rotation) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ORIENTATION_SET), EO_TYPECHECK(int, rotation) +#define elm_wdg_orientation_set(rotation, ret) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ORIENTATION_SET), EO_TYPECHECK(int, rotation), EO_TYPECHECK(Eina_Bool *, ret) /** * @def elm_wdg_orientation_mode_disabled_set