From 3f7cf6c2acfabe395f77d064c70f5d2c578819e4 Mon Sep 17 00:00:00 2001 From: Woochan Lee Date: Wed, 23 Mar 2016 14:19:30 +0900 Subject: [PATCH] Add unset methods for view. unset_content unset_title_left_btn unset_tilte_right_btn unset_toolbar Change-Id: I09f8087d18cac66a86be53873b775a9a2dfaad22 --- src/include/efl/mobile/ui_basic_view.h | 6 ++- src/include/efl/ui_view.h | 6 +++ src/include/interface/ui_iface_view.h | 6 +++ src/lib/efl/mobile/ui_basic_view.cpp | 70 ++++++++++++++++++++++++++++++---- src/lib/efl/ui_view.cpp | 6 +++ src/lib/interface/ui_iface_view.cpp | 7 ++++ 6 files changed, 92 insertions(+), 9 deletions(-) diff --git a/src/include/efl/mobile/ui_basic_view.h b/src/include/efl/mobile/ui_basic_view.h index 4dc46b8..9d64de2 100644 --- a/src/include/efl/mobile/ui_basic_view.h +++ b/src/include/efl/mobile/ui_basic_view.h @@ -51,7 +51,11 @@ public: bool set_title(const char *text); bool set_toolbar(Elm_Toolbar *toolbar); bool set_menu(Elm_Ctxpopup *menu); - Elm_Ctxpopup * unset_menu(); + Elm_Ctxpopup *unset_menu(); + Evas_Object *unset_content(); + Elm_Button *unset_title_left_btn(); + Elm_Button *unset_title_right_btn(); + Elm_Toolbar *unset_toolbar(); virtual void on_menu(); diff --git a/src/include/efl/ui_view.h b/src/include/efl/ui_view.h index b8991a9..0783c9c 100644 --- a/src/include/efl/ui_view.h +++ b/src/include/efl/ui_view.h @@ -83,6 +83,12 @@ public: */ virtual Evas_Object *set_content(Evas_Object *content); + /** @brief This is for unsetting a content of the view. + * + * @return A previous content. If it wasn't, return value will be @c NULL. + */ + virtual Evas_Object *unset_content(); + /** @brief Get a base layout of viewmgr. */ virtual Evas_Object *get_base(); diff --git a/src/include/interface/ui_iface_view.h b/src/include/interface/ui_iface_view.h index b745e49..74513e7 100644 --- a/src/include/interface/ui_iface_view.h +++ b/src/include/interface/ui_iface_view.h @@ -205,6 +205,12 @@ public: */ T set_content(T content); + /** @brief This is for unsetting a content of the view. + * + * @return A previous content. If it wasn't, return value will be @c NULL. + */ + T unset_content(); + /** @brief set transition style of a view. * * @note @p style is reserved for supporting various kinds of view transition effects. diff --git a/src/lib/efl/mobile/ui_basic_view.cpp b/src/lib/efl/mobile/ui_basic_view.cpp index c34e9cc..d423875 100644 --- a/src/lib/efl/mobile/ui_basic_view.cpp +++ b/src/lib/efl/mobile/ui_basic_view.cpp @@ -275,14 +275,6 @@ Evas_Object *ui_basic_view::set_content(Evas_Object *content, const char *title, return pcontent; } -Elm_Ctxpopup* ui_basic_view::unset_menu() -{ - Elm_Ctxpopup *menu = this->ctxpopup; - //FIXME: cancel callbacks - this->ctxpopup = NULL; - return menu; -} - bool ui_basic_view::set_menu(Elm_Ctxpopup *menu) { if (this->ctxpopup) evas_object_del(this->ctxpopup); @@ -379,3 +371,65 @@ void ui_basic_view::set_event_block(bool block) ui_iface_view::set_event_block(block); evas_object_freeze_events_set(this->get_base(), block); } + +Elm_Ctxpopup* ui_basic_view::unset_menu() +{ + Elm_Ctxpopup *menu = this->ctxpopup; + //FIXME: cancel callbacks + this->ctxpopup = NULL; + return menu; +} + +Evas_Object *ui_basic_view::unset_content() +{ + Evas_Object *pcontent = ui_view::unset_content(); + + if (!this->get_base()) return pcontent; + + elm_object_part_content_unset(this->get_base(), "elm.swallow.content"); + evas_object_hide(pcontent); + + return pcontent; +} + +Elm_Button *ui_basic_view::unset_title_left_btn() +{ + Elm_Button *title_left_btn; + + if (!this->get_base()) return NULL; + + title_left_btn = elm_object_part_content_unset(this->get_base(), "title_left_btn"); + if (title_left_btn) + elm_object_signal_emit(this->get_base(), "elm,state,title_left_btn,hide", "elm"); + evas_object_hide(title_left_btn); + + return title_left_btn; +} + +Elm_Button *ui_basic_view::unset_title_right_btn() +{ + Elm_Button *title_right_btn; + + if (!this->get_base()) return NULL; + + title_right_btn = elm_object_part_content_unset(this->get_base(), "title_right_btn"); + if (title_right_btn) + elm_object_signal_emit(this->get_base(), "elm,state,title_right_btn,hide", "elm"); + evas_object_hide(title_right_btn); + + return title_right_btn; +} + +Elm_Toolbar *ui_basic_view::unset_toolbar() +{ + Elm_Toolbar *toolbar; + + if (!this->get_base()) return NULL; + + toolbar = elm_object_part_content_unset(this->get_base(), "toolbar"); + if (toolbar) + elm_object_signal_emit(this->get_base(), "elm,state,toolbar,hide", "elm"); + evas_object_hide(toolbar); + + return toolbar; +} diff --git a/src/lib/efl/ui_view.cpp b/src/lib/efl/ui_view.cpp index ce5d94d..041cd36 100644 --- a/src/lib/efl/ui_view.cpp +++ b/src/lib/efl/ui_view.cpp @@ -42,6 +42,12 @@ Evas_Object *ui_view::set_content(Evas_Object *content) return CONVERT_TO_EO(pcontent); } +Evas_Object *ui_view::unset_content() +{ + T pcontent = ui_iface_view::unset_content(); + return static_cast(pcontent); +} + Evas_Object *ui_view::get_base() { ui_viewmgr *viewmgr = MY_VIEWMGR; diff --git a/src/lib/interface/ui_iface_view.cpp b/src/lib/interface/ui_iface_view.cpp index 6b0fe5a..bf65eb5 100644 --- a/src/lib/interface/ui_iface_view.cpp +++ b/src/lib/interface/ui_iface_view.cpp @@ -120,6 +120,13 @@ T ui_iface_view::set_content(T content) return prev; } +T ui_iface_view::unset_content() +{ + T prev = this->content; + this->content = NULL; + return prev; +} + bool ui_iface_view::set_transition_style(const char *style) { this->transition_style.assign(style); -- 2.7.4