From: Hermet Park Date: Wed, 9 Mar 2016 10:28:50 +0000 (+0900) Subject: ui_viewmgr: refactoring code X-Git-Tag: submit/tizen/20160617.075742~119 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8c2bb3e6ee54107f496fae02ab3b623019687f4e;p=platform%2Fcore%2Fuifw%2Fui-viewmgr.git ui_viewmgr: refactoring code Change-Id: I2ec5d09da073f437a457bdcc7de4a079a5c8ec59 --- diff --git a/src/include/efl/ui_viewmgr.h b/src/include/efl/ui_viewmgr.h index 61c7070..9477f92 100644 --- a/src/include/efl/ui_viewmgr.h +++ b/src/include/efl/ui_viewmgr.h @@ -72,6 +72,8 @@ private: */ bool set_indicator(ui_view_indicator indicator); + void active_top_view(); + protected: ui_viewmgr(const char *pkg, ui_key_listener *key_listener); diff --git a/src/lib/efl/ui_viewmgr.cpp b/src/lib/efl/ui_viewmgr.cpp index b21172b..a8e9902 100644 --- a/src/lib/efl/ui_viewmgr.cpp +++ b/src/lib/efl/ui_viewmgr.cpp @@ -19,6 +19,28 @@ using namespace efl_viewmgr; using namespace viewmgr; +void ui_viewmgr::active_top_view() +{ + elm_object_part_content_unset(this->get_base(), "elm.swallow.content"); + + ui_view *view = dynamic_cast(this->get_last_view()); + + //TODO: get parent? + Evas_Object *content = view->get_base(); + if (content == this->get_base()) + { + elm_object_part_content_set(this->get_base(), "elm.swallow.content", CONVERT_TO_EO(view->get_content())); + } + else + { + elm_object_part_content_set(this->get_base(), "elm.swallow.content", CONVERT_TO_EO(view->get_base())); + } + + this->set_indicator(view->get_indicator()); +} + +//FIXME: How to deal with indicator in other UI framework? Dali? Volt? +//Is it possible make this interface common? bool ui_viewmgr::set_indicator(ui_view_indicator indicator) { if (this->indicator == indicator) return false; @@ -150,24 +172,12 @@ ui_viewmgr::~ui_viewmgr() bool ui_viewmgr::activate() { - ui_iface_viewmgr::activate(); + if (!ui_iface_viewmgr::activate()) return false; - elm_object_part_content_unset(this->get_base(), "elm.swallow.content"); + this->active_top_view(); + //FIXME: Necessary?? ui_view *view = dynamic_cast(this->get_last_view()); - - //TODO: get parent? - Evas_Object *content = view->get_base(); - if (content == this->get_base()) - { - elm_object_part_content_set(this->get_base(), "elm.swallow.content", CONVERT_TO_EO(view->get_content())); - } - else - { - elm_object_part_content_set(this->get_base(), "elm.swallow.content", CONVERT_TO_EO(view->get_base())); - } - - this->set_indicator(view->get_indicator()); view->active(); evas_object_show(this->win); @@ -222,23 +232,7 @@ ui_view * ui_viewmgr::push_view(ui_view *view) { ui_iface_viewmgr::push_view(view); - //Don't prepare yet if viewmgr is not activated. - if (!this->is_activated()) return view; - - elm_object_part_content_unset(this->get_base(), "elm.swallow.content"); - - Evas_Object *content = view->get_base(); - - if (content == this->get_base()) - { - elm_object_part_content_set(this->get_base(), "elm.swallow.content", CONVERT_TO_EO(view->get_content())); - } - else - { - elm_object_part_content_set(this->get_base(), "elm.swallow.content", CONVERT_TO_EO(view->get_base())); - } - - this->set_indicator(view->get_indicator()); + this->active_top_view(); return view; } diff --git a/src/lib/interface/ui_iface_viewmgr.cpp b/src/lib/interface/ui_iface_viewmgr.cpp index d2cb2b0..164f987 100644 --- a/src/lib/interface/ui_iface_viewmgr.cpp +++ b/src/lib/interface/ui_iface_viewmgr.cpp @@ -256,6 +256,7 @@ ui_iface_viewmgr::get_last_view() bool ui_iface_viewmgr::activate() { if (this->activated) return false; + if (this->get_view_count() == 0) return false; this->activated = true; return true; }