From: hermet Date: Sun, 30 Oct 2011 15:50:14 +0000 (+0000) Subject: elementary/panes - content_part_set/get/unset X-Git-Tag: REL_F_I9500_20111122_1~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=00feee26084889d83bda9e98fe9619db23ee6bfc;p=framework%2Fuifw%2Felementary.git elementary/panes - content_part_set/get/unset git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@64524 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/bin/test_panes.c b/src/bin/test_panes.c index 8160d4a..8217490 100644 --- a/src/bin/test_panes.c +++ b/src/bin/test_panes.c @@ -73,7 +73,7 @@ test_panes(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info evas_object_size_hint_weight_set(bt, 1.0, 1.0); evas_object_size_hint_align_set(bt, -1.0, -1.0); evas_object_show(bt); - elm_panes_content_left_set(panes, bt); + elm_object_content_part_set(panes, ELM_PANES_CONTENT_LEFT, bt); // // @@ -88,7 +88,7 @@ test_panes(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info evas_object_smart_callback_add(panes_h, "press", _press, panes_h); evas_object_smart_callback_add(panes_h, "unpress", _unpress, panes_h); - elm_panes_content_right_set(panes, panes_h); + elm_object_content_part_set(panes, ELM_PANES_CONTENT_RIGHT, panes_h); // // @@ -97,7 +97,7 @@ test_panes(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(bt); - elm_panes_content_left_set(panes_h, bt); + elm_object_content_part_set(panes_h, ELM_PANES_CONTENT_LEFT, bt); // // @@ -106,7 +106,7 @@ test_panes(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(bt); - elm_panes_content_right_set(panes_h, bt); + elm_object_content_part_set(panes_h, ELM_PANES_CONTENT_RIGHT, bt); // diff --git a/src/edje_externals/elm_panes.c b/src/edje_externals/elm_panes.c index 9ff569b..1a7a8df 100644 --- a/src/edje_externals/elm_panes.c +++ b/src/edje_externals/elm_panes.c @@ -27,10 +27,10 @@ static void external_panes_state_set(void *data __UNUSED__, else return; if (p->content_left) - elm_panes_content_left_set(obj, p->content_left); + elm_object_content_part_set(obj, ELM_PANES_CONTENT_LEFT, p->content_left); if (p->content_right) - elm_panes_content_right_set(obj, p->content_right); + elm_object_content_part_set(obj, ELM_PANES_CONTENT_RIGHT, p->content_right); if (p->is_left_size) elm_panes_content_left_size_set(obj, p->left_size); @@ -51,7 +51,7 @@ static Eina_Bool external_panes_param_set(void *data __UNUSED__, Evas_Object *content = external_common_param_edje_object_get(obj, param); if ((strcmp(param->s, "")) && (!content)) return EINA_FALSE; - elm_panes_content_left_set(obj, content); + elm_object_content_part_set(obj, ELM_PANES_CONTENT_LEFT, content); return EINA_TRUE; } else if ((!strcmp(param->name, "content right")) @@ -60,7 +60,7 @@ static Eina_Bool external_panes_param_set(void *data __UNUSED__, Evas_Object *content = external_common_param_edje_object_get(obj, param); if ((strcmp(param->s, "")) && (!content)) return EINA_FALSE; - elm_panes_content_right_set(obj, content); + elm_object_content_part_set(obj, ELM_PANES_CONTENT_RIGHT, content); return EINA_TRUE; } else if ((!strcmp(param->name, "horizontal")) @@ -170,9 +170,9 @@ external_panes_content_get(void *data __UNUSED__, const Evas_Object *obj, const char *content) { if (!strcmp(content, "left")) - return elm_panes_content_left_get(obj); + return elm_object_content_part_get(obj, ELM_PANES_CONTENT_LEFT); else if (!strcmp(content, "right")) - return elm_panes_content_right_get(obj); + return elm_object_content_part_get(obj, ELM_PANES_CONTENT_RIGHT); ERR("unknown content '%s'", content); diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index d39858e..0bbbabf 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -23910,7 +23910,7 @@ extern "C" { * * @ingroup Panes */ - EAPI void elm_panes_content_left_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1); + EINA_DEPRECATED EAPI void elm_panes_content_left_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1); /** * Set the right content of the panes widget. @@ -23930,7 +23930,7 @@ extern "C" { * * @ingroup Panes */ - EAPI void elm_panes_content_right_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1); + EINA_DEPRECATED EAPI void elm_panes_content_right_set(Evas_Object *obj, Evas_Object *content) EINA_ARG_NONNULL(1); /** * Get the left content of the panes. @@ -23944,7 +23944,7 @@ extern "C" { * * @ingroup Panes */ - EAPI Evas_Object *elm_panes_content_left_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + EINA_DEPRECATED EAPI Evas_Object *elm_panes_content_left_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); /** * Get the right content of the panes. @@ -23958,7 +23958,7 @@ extern "C" { * * @ingroup Panes */ - EAPI Evas_Object *elm_panes_content_right_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + EINA_DEPRECATED EAPI Evas_Object *elm_panes_content_right_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); /** * Unset the left content used for the panes. @@ -23973,7 +23973,7 @@ extern "C" { * * @ingroup Panes */ - EAPI Evas_Object *elm_panes_content_left_unset(Evas_Object *obj) EINA_ARG_NONNULL(1); + EINA_DEPRECATED EAPI Evas_Object *elm_panes_content_left_unset(Evas_Object *obj) EINA_ARG_NONNULL(1); /** * Unset the right content used for the panes. @@ -28503,6 +28503,7 @@ extern "C" { #define ELM_NAVIFRAME_ITEM_OPTIONHEADER "elm.swallow.optionheader" #define ELM_NAVIFRAME_ITEM_TITLE_LABEL "elm.text.title" #define ELM_NAVIFRAME_ITEM_PREV_BTN "elm.swallow.prev_btn" + #define ELM_NAVIFRAME_ITEM_NEXT_BTN "elm.swallow.next_btn" #define ELM_NAVIFRAME_ITEM_TITLE_LEFT_BTN "elm.swallow.left_btn" #define ELM_NAVIFRAME_ITEM_TITLE_RIGHT_BTN "elm.swallow.right_btn" #define ELM_NAVIFRAME_ITEM_TITLE_MORE_BTN "elm.swallow.more_btn" diff --git a/src/lib/elm_panes.c b/src/lib/elm_panes.c index 67c6a01..68d6a76 100644 --- a/src/lib/elm_panes.c +++ b/src/lib/elm_panes.c @@ -215,6 +215,105 @@ _unpress(void *data, Evas_Object *obj __UNUSED__ , const char *emission __UNUSED } } +static void +_content_left_set(Evas_Object *obj, Evas_Object *content) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (wd->contents.left) + { + evas_object_del(wd->contents.left); + wd->contents.left = NULL; + } + if (content) + { + wd->contents.left = content; + elm_widget_sub_object_add(obj, content); + edje_object_part_swallow(wd->panes, "elm.swallow.left", content); + } +} + +static void +_content_right_set(Evas_Object *obj, Evas_Object *content) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (wd->contents.right) + { + evas_object_del(wd->contents.right); + wd->contents.right = NULL; + } + if (content) + { + wd->contents.right = content; + elm_widget_sub_object_add(obj, content); + edje_object_part_swallow(wd->panes, "elm.swallow.right", content); + } +} + +static Evas_Object * +_content_left_unset(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd->contents.left) return NULL; + Evas_Object *content = wd->contents.left; + elm_widget_sub_object_del(obj, content); + edje_object_part_unswallow(wd->panes, content); + wd->contents.left = NULL; + return content; +} + +static Evas_Object * +_content_right_unset(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd->contents.right) return NULL; + Evas_Object *content = wd->contents.right; + elm_widget_sub_object_del(obj, content); + edje_object_part_unswallow(wd->panes, content); + wd->contents.right = NULL; + return content; +} + +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if ((!part) || (!strcmp(part, "elm.swallow.right"))) + _content_right_set(obj, content); + else if(!strcmp(part, "elm.swallow.left")) + _content_left_set(obj, content); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if ((!part) || (!strcmp(part, "elm.swallow.right"))) + return wd->contents.left; + else if (!strcmp(part, "elm.swallow.left")) + return wd->contents.right; + return NULL; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return NULL; + + if ((!part) || (!strcmp(part, "elm.swallow.right"))) + _content_right_unset(obj); + else if (!strcmp(part, "elm.swallow.left")) + _content_left_unset(obj); + + return NULL; +} + EAPI Evas_Object * elm_panes_add(Evas_Object *parent) { @@ -232,6 +331,10 @@ elm_panes_add(Evas_Object *parent) elm_widget_del_hook_set(obj, _del_hook); elm_widget_theme_hook_set(obj, _theme_hook); elm_widget_focus_next_hook_set(obj, _elm_panes_focus_next_hook); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); + elm_widget_can_focus_set(obj, EINA_FALSE); wd->panes = edje_object_add(e); _elm_theme_object_set(obj, wd->panes, "panes", "vertical", "default"); @@ -263,93 +366,37 @@ elm_panes_add(Evas_Object *parent) EAPI void elm_panes_content_left_set(Evas_Object *obj, Evas_Object *content) { - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - if (wd->contents.left) - { - evas_object_del(wd->contents.left); - wd->contents.left = NULL; - } - if (content) - { - wd->contents.left = content; - elm_widget_sub_object_add(obj, content); - edje_object_part_swallow(wd->panes, "elm.swallow.left", content); - if (wd->contents.right) - edje_object_signal_emit(wd->panes, "elm.panes.pair", "elm"); - } - else - edje_object_signal_emit(wd->panes, "elm.panes.unpair", "elm"); + _content_set_hook(obj, "elm.swallow.left", content); } EAPI void elm_panes_content_right_set(Evas_Object *obj, Evas_Object *content) { - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - if (wd->contents.right) - { - evas_object_del(wd->contents.right); - wd->contents.right = NULL; - } - if (content) - { - wd->contents.right = content; - elm_widget_sub_object_add(obj, content); - edje_object_part_swallow(wd->panes, "elm.swallow.right", content); - if (wd->contents.left) - edje_object_signal_emit(wd->panes, "elm.panes.pair", "elm"); - } - else - edje_object_signal_emit(wd->panes, "elm.panes.unpair", "elm"); + _content_set_hook(obj, NULL, content); } EAPI Evas_Object * elm_panes_content_left_get(const Evas_Object *obj) { - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - return wd->contents.left; + return _content_get_hook(obj, "elm.swallow.left"); } EAPI Evas_Object * elm_panes_content_right_get(const Evas_Object *obj) { - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - return wd->contents.right; + return _content_get_hook(obj, NULL); } EAPI Evas_Object * elm_panes_content_left_unset(Evas_Object *obj) { - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) return NULL; - if (!wd->contents.left) return NULL; - Evas_Object *content = wd->contents.left; - elm_widget_sub_object_del(obj, content); - edje_object_part_unswallow(wd->panes, content); - evas_object_hide(content); - wd->contents.left = NULL; - edje_object_signal_emit(wd->panes, "elm.panes.unpair", "elm"); - return content; + return _content_unset_hook(obj, "elm.swallow.left"); } EAPI Evas_Object * elm_panes_content_right_unset(Evas_Object *obj) { - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) return NULL; - if (!wd->contents.right) return NULL; - Evas_Object *content = wd->contents.right; - elm_widget_sub_object_del(obj, content); - edje_object_part_unswallow(wd->panes, content); - evas_object_hide(content); - wd->contents.right = NULL; - edje_object_signal_emit(wd->panes, "elm.panes.unpair", "elm"); - return content; + return _content_unset_hook(obj, "elm.swallow.right"); } EAPI double