Add unset methods for view. 80/63280/3
authorWoochan Lee <wc0917.lee@samsung.com>
Wed, 23 Mar 2016 05:19:30 +0000 (14:19 +0900)
committerWoochan Lee <wc0917.lee@samsung.com>
Wed, 23 Mar 2016 07:29:08 +0000 (16:29 +0900)
unset_content
unset_title_left_btn
unset_tilte_right_btn
unset_toolbar

Change-Id: I09f8087d18cac66a86be53873b775a9a2dfaad22

src/include/efl/mobile/ui_basic_view.h
src/include/efl/ui_view.h
src/include/interface/ui_iface_view.h
src/lib/efl/mobile/ui_basic_view.cpp
src/lib/efl/ui_view.cpp
src/lib/interface/ui_iface_view.cpp

index 4dc46b8..9d64de2 100644 (file)
@@ -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();
 
index b8991a9..0783c9c 100644 (file)
@@ -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();
index b745e49..74513e7 100644 (file)
@@ -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.
index c34e9cc..d423875 100644 (file)
@@ -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;
+}
index ce5d94d..041cd36 100644 (file)
@@ -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<Evas_Object *>(pcontent);
+}
+
 Evas_Object *ui_view::get_base()
 {
        ui_viewmgr *viewmgr = MY_VIEWMGR;
index 6b0fe5a..bf65eb5 100644 (file)
@@ -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);