From: Hermet Park Date: Mon, 2 May 2016 08:41:09 +0000 (+0900) Subject: sort out public/internal apis. X-Git-Tag: submit/tizen/20160617.075742~46 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bb754d7dbebd102952dc45097348d84286b77466;p=platform%2Fcore%2Fuifw%2Fui-viewmgr.git sort out public/internal apis. Change-Id: Iad050a5570e6119fd325994d84b26e22e597019b target: ui_iface_overlay. --- diff --git a/src/include/efl/ui_base_key_listener.h b/src/include/efl/ui_base_key_listener.h index cc0849d..05f6a21 100644 --- a/src/include/efl/ui_base_key_listener.h +++ b/src/include/efl/ui_base_key_listener.h @@ -19,24 +19,27 @@ namespace efl_viewmanager { + class ui_base_viewmgr; -class ui_base_view; class ui_base_key_listener { -protected: - ui_base_viewmgr *viewmgr; - Evas_Object *key_grabber; - public: ui_base_key_listener(ui_base_viewmgr *viewmgr); - virtual ~ui_base_key_listener() {} + virtual ~ui_base_key_listener(); virtual bool init(); virtual bool term(); virtual void extend_event_proc(ui_base_view *view, Evas_Event_Key_Down *ev) {} - ui_base_viewmgr *get_viewmgr() { return this->viewmgr; } + ui_base_viewmgr *get_viewmgr(); + +protected: + Evas_Object *get_keygrab_obj(); + +private: + _UI_DECLARE_PRIVATE_IMPL(ui_base_key_listener); + _UI_DISABLE_COPY_AND_ASSIGN(ui_base_key_listener); }; } diff --git a/src/include/efl/ui_base_overlay.h b/src/include/efl/ui_base_overlay.h index ee0fb75..f369c50 100644 --- a/src/include/efl/ui_base_overlay.h +++ b/src/include/efl/ui_base_overlay.h @@ -20,7 +20,6 @@ namespace efl_viewmanager { -class ui_base_viewmgr; class ui_base_view; class ui_base_overlay: public ui_iface_overlay diff --git a/src/include/efl/ui_base_view.h b/src/include/efl/ui_base_view.h index 2f41438..3afdbb7 100644 --- a/src/include/efl/ui_base_view.h +++ b/src/include/efl/ui_base_view.h @@ -34,29 +34,6 @@ namespace efl_viewmanager */ class ui_base_view: public ui_iface_view { - friend class ui_base_viewmgr; - -protected: - /** @brief Get a parent object of view. - * - * @note This is calling viewmgr get_base() method internally. - * - * @return base layout of viewmgr. - */ - Evas_Object *get_parent(); - - /** @brief toggle event block. - * - * @note It makes internal conformant event freeze during effect showing. - * - * @param block @c true, when blocking is enabled, otherwise @c false. - */ - virtual void set_event_block(bool block); - - virtual void on_rotate(int degree); - virtual void on_portrait(); - virtual void on_landscape(); - public: ///Constructor. ui_base_view(const char *name = NULL); @@ -93,6 +70,32 @@ public: * @return Current rotation degree, -1 if it fails to get degree information. */ virtual int get_degree(); + +protected: + /** @brief Get a parent object of view. + * + * @note This is calling viewmgr get_base() method internally. + * + * @return base layout of viewmgr. + */ + Evas_Object *get_parent(); + + /** @brief toggle event block. + * + * @note It makes internal conformant event freeze during effect showing. + * + * @param block @c true, when blocking is enabled, otherwise @c false. + */ + virtual void set_event_block(bool block); + + virtual void on_rotate(int degree); + virtual void on_portrait(); + virtual void on_landscape(); + +private: + _UI_DECLARE_PRIVATE_IMPL(ui_base_view); + _UI_DISABLE_COPY_AND_ASSIGN(ui_base_view); + _UI_DECLARE_FRIENDS(ui_base_viewmgr); }; } diff --git a/src/include/efl/ui_base_viewmanager.h b/src/include/efl/ui_base_viewmanager.h index f03c711..6b5f37e 100644 --- a/src/include/efl/ui_base_viewmanager.h +++ b/src/include/efl/ui_base_viewmanager.h @@ -17,6 +17,11 @@ #ifndef _UI_BASE_VIEWMANAGER_H_ #define _UI_BASE_VIEWMANAGER_H_ +//FIXME: ?? +#ifndef Elm_Conformant +#define Elm_Conformant Evas_Object +#endif + #include "../interface/ui_iface_viewmanager.h" #include "ui_base_overlay.h" #include "ui_base_key_listener.h" diff --git a/src/include/efl/ui_base_viewmgr.h b/src/include/efl/ui_base_viewmgr.h index 55e697f..54a6731 100644 --- a/src/include/efl/ui_base_viewmgr.h +++ b/src/include/efl/ui_base_viewmgr.h @@ -17,16 +17,6 @@ #ifndef _UI_BASE_VIEWMGR_H_ #define _UI_BASE_VIEWMGR_H_ -#include -#include - -using namespace std; - -//FIXME: ?? -#ifndef Elm_Conformant -#define Elm_Conformant Evas_Object -#endif - namespace efl_viewmanager { @@ -45,80 +35,7 @@ class ui_base_view; */ class ui_base_viewmgr: public ui_iface_viewmgr { - friend class ui_base_view; - -private: - Elm_Win *win; //This is acting like a base object of viewmgr. - Elm_Conformant *conform; //Conformant for viewmgr. - Elm_Scroller *scroller; //Scroller for viewmgr. - Elm_Layout *layout; //Viewmgr's base layout. - ui_base_key_listener *key_listener; //HW Key Handler such as "BACK" key... - ui_view_indicator indicator; //Mode of indicator. - string transition_style; //Current transition effect style name - map effect_map; //Map for effect layouts. - - Elm_Layout *set_transition_layout(string transition_style); - - /** - * @brief Create a conformant. - * - * @param win viewmgr's window object. this will be parent of conformant object. - * - * @return @c true success or @c false not. - */ - bool create_conformant(Elm_Win *win); - - /** - * @brief Create a Scroller. - * - * @param conform viewmgr's conformant object. this will be parent of layout object. - * - * @note We add a scroller for an exceptional case. If user view content is larger than window, - * then the content will be automatically scrollable by this scroller. - * For instance, if the virtual keypad is enabled in the landscape mode, - * the content area would be smaller than content minimum size. - * We could avoid clipping the content by scroller. - * - * @return @c true success or @c false not. - */ - - bool create_scroller(Elm_Conformant *conform); - /** - * @brief Create a base layout. - * - * @param scroller viewmgr's scroller object. this will be parent of layout object. - * @param style view's transition effect style. - * - * @return @c true success or @c false not. - */ - bool create_base_layout(Elm_Scroller *scroller, const char *style); - - /** @brief Set the indicator mode. - * - * @param indicator The mode to set, one of #ui_view_indicator. - */ - bool set_indicator(ui_view_indicator indicator); - - void activate_top_view(); - -protected: - ui_base_viewmgr(const char *pkg, ui_base_key_listener *key_listener); - - ///Constructor. - ui_base_viewmgr(const char *pkg); - ///Destructor. - virtual ~ui_base_viewmgr(); - - /** @brief Get a base layout of viewmgr. - */ - Evas_Object *get_base() - { - return this->layout; - } - - public: - /** * @brief Activate this view manager. * @@ -203,17 +120,11 @@ public: /** @brief Get a window object of viewmgr. */ - Elm_Win *get_window() - { - return this->win; - } + Elm_Win *get_window(); /** @brief Get a conformant object of viewmgr. */ - Elm_Conformant *get_conformant() - { - return this->conform; - } + Elm_Conformant *get_conformant(); /** @brief Get a last view of current view stack. */ @@ -234,7 +145,26 @@ public: * @see get_view_count() */ ui_base_view *get_view(unsigned int idx); + + /** @brief Get a base layout of viewmgr. + */ + Evas_Object *get_base(); + +protected: + bool set_indicator(ui_view_indicator indicator); + + ///Constructor + ui_base_viewmgr(const char *pkg, ui_base_key_listener *key_listener); + ui_base_viewmgr(const char *pkg); + ///Destructor. + virtual ~ui_base_viewmgr(); + +private: + _UI_DECLARE_PRIVATE_IMPL(ui_base_viewmgr); + _UI_DISABLE_COPY_AND_ASSIGN(ui_base_viewmgr); + _UI_DECLARE_FRIENDS(ui_base_view); }; + } #endif /* _UI_BASE_VIEWMGR_H_ */ diff --git a/src/include/interface/ui_iface_overlay.h b/src/include/interface/ui_iface_overlay.h index 9493a2e..e3d0544 100644 --- a/src/include/interface/ui_iface_overlay.h +++ b/src/include/interface/ui_iface_overlay.h @@ -27,20 +27,21 @@ class ui_iface_overlay: public ui_iface_rotatable public: virtual bool set_content(T content); virtual T unset_content(); + virtual void on_back(); + virtual bool activate(); + virtual bool deactivate(); + virtual bool is_activated(); + ui_iface_view *get_view(); virtual T get_content(); - virtual void on_back(); - virtual bool activate() = 0; - virtual bool deactivate() = 0; - virtual bool is_activated() = 0; protected: ui_iface_overlay(ui_iface_view *view); virtual ~ui_iface_overlay(); private: - ui_iface_view *view; - T content; + _UI_DECLARE_PRIVATE_IMPL(ui_iface_overlay); + _UI_DISABLE_COPY_AND_ASSIGN(ui_iface_overlay); }; } diff --git a/src/include/interface/ui_iface_view.h b/src/include/interface/ui_iface_view.h index 00e862c..e219c9b 100644 --- a/src/include/interface/ui_iface_view.h +++ b/src/include/interface/ui_iface_view.h @@ -140,7 +140,7 @@ public: */ ui_view_indicator get_indicator(); - void on_back(); + virtual void on_back(); protected: diff --git a/src/include/interface/ui_iface_viewmanager.h b/src/include/interface/ui_iface_viewmanager.h index bb8f2dc..592e93e 100644 --- a/src/include/interface/ui_iface_viewmanager.h +++ b/src/include/interface/ui_iface_viewmanager.h @@ -54,7 +54,8 @@ enum ui_view_state #define LOG_TAG "UI_VIEWMGR" #define _UI_DECLARE_FRIENDS(A) \ - friend class A##_impl + friend class A##_impl; \ + friend class A #define _UI_DECLARE_PRIVATE_IMPL(A) \ class A##_impl *impl; \ diff --git a/src/lib/efl/mobile/ui_key_listener.cpp b/src/lib/efl/mobile/ui_key_listener.cpp index 2011271..fe1849a 100644 --- a/src/lib/efl/mobile/ui_key_listener.cpp +++ b/src/lib/efl/mobile/ui_key_listener.cpp @@ -37,13 +37,13 @@ void ui_key_listener::extend_event_proc(ui_base_view *view, Evas_Event_Key_Down bool ui_key_listener::init() { if (!ui_base_key_listener::init()) return false; - if (!evas_object_key_grab(this->key_grabber, KEY_MENU, 0, 0, EINA_FALSE)) + if (!evas_object_key_grab(this->get_keygrab_obj(), KEY_MENU, 0, 0, EINA_FALSE)) { LOGE("Failed to grab MENU KEY(%s)\n", KEY_MENU); return false; } - if (!evas_object_key_grab(this->key_grabber, KEY_MENU2, 0, 0, EINA_FALSE)) + if (!evas_object_key_grab(this->get_keygrab_obj(), KEY_MENU2, 0, 0, EINA_FALSE)) { LOGE("Failed to grab MENU KEY(%s)\n", KEY_MENU2); return false; diff --git a/src/lib/efl/ui_base_key_listener.cpp b/src/lib/efl/ui_base_key_listener.cpp index 19d29d6..81b924e 100644 --- a/src/lib/efl/ui_base_key_listener.cpp +++ b/src/lib/efl/ui_base_key_listener.cpp @@ -16,15 +16,32 @@ */ #include "../../include/efl/ui_base_viewmanager.h" -static const char *KEY_BACK = "XF86Back"; -static const char *KEY_BACK2 = "XF86Stop"; - -ui_base_key_listener::ui_base_key_listener(ui_base_viewmgr *viewmgr) - : viewmgr(viewmgr), key_grabber(NULL) +/***********************************************************************************************/ +/* Internal class Implementation */ +/***********************************************************************************************/ +namespace efl_viewmanager { - +class ui_base_key_listener_impl +{ +protected: + ui_base_key_listener *key_listener; + ui_base_viewmgr *viewmgr; + Evas_Object *key_grabber; + +public: + ui_base_key_listener_impl(ui_base_key_listener *key_listener, ui_base_viewmgr *viewmgr); + ~ui_base_key_listener_impl() {} + + bool init(); + bool term(); + ui_base_viewmgr *get_viewmgr() { return this->viewmgr; } + Evas_Object *get_keygrab_obj() { return this->key_grabber; } +}; } +static const char *KEY_BACK = "XF86Back"; +static const char *KEY_BACK2 = "XF86Stop"; + static void event_proc(ui_base_key_listener *key_listener, Evas_Event_Key_Down *ev) { //Only if view manager is activated @@ -32,7 +49,7 @@ static void event_proc(ui_base_key_listener *key_listener, Evas_Event_Key_Down * if (!viewmgr->is_activated()) return; //Get Top View - ui_base_view *view = dynamic_cast(viewmgr->get_last_view()); + ui_base_view *view = viewmgr->get_last_view(); if (!view) return; key_listener->extend_event_proc(view, ev); @@ -42,13 +59,19 @@ static void event_proc(ui_base_key_listener *key_listener, Evas_Event_Key_Down * view->on_back(); } -bool ui_base_key_listener::term() +ui_base_key_listener_impl::ui_base_key_listener_impl(ui_base_key_listener *key_listener, ui_base_viewmgr *viewmgr) + : key_listener(key_listener), viewmgr(viewmgr), key_grabber(NULL) +{ + +} + +bool ui_base_key_listener_impl::term() { evas_object_del(this->key_grabber); return true; } -bool ui_base_key_listener::init() +bool ui_base_key_listener_impl::init() { if (!this->viewmgr) { @@ -75,7 +98,7 @@ bool ui_base_key_listener::init() Evas_Event_Key_Down *ev = static_cast(event_info); ui_base_key_listener *key_listener = static_cast(data); event_proc(key_listener, ev); - }, this); + }, this->key_listener); if (!evas_object_key_grab(key_grab_rect, KEY_BACK, 0, 0, EINA_FALSE)) { @@ -95,3 +118,39 @@ bool ui_base_key_listener::init() return true; } + + +/***********************************************************************************************/ +/* External class Implementation */ +/***********************************************************************************************/ + +ui_base_key_listener::ui_base_key_listener(ui_base_viewmgr *viewmgr) +{ + this->impl = new ui_base_key_listener_impl(this, viewmgr); +} + +ui_base_key_listener::~ui_base_key_listener() +{ + delete(this->impl); +} + +bool ui_base_key_listener::term() +{ + return this->impl->term(); +} + +bool ui_base_key_listener::init() +{ + return this->impl->init(); +} + +Evas_Object *ui_base_key_listener::get_keygrab_obj() +{ + return this->impl->get_keygrab_obj(); +} + + +ui_base_viewmgr *ui_base_key_listener::get_viewmgr() +{ + return this->impl->get_viewmgr(); +} diff --git a/src/lib/efl/ui_base_view.cpp b/src/lib/efl/ui_base_view.cpp index 51c6a4e..b5f8759 100644 --- a/src/lib/efl/ui_base_view.cpp +++ b/src/lib/efl/ui_base_view.cpp @@ -16,6 +16,19 @@ */ #include "../../include/efl/ui_base_viewmanager.h" + +/***********************************************************************************************/ +/* Internal class Implementation */ +/***********************************************************************************************/ +namespace efl_viewmanager +{ +class ui_base_view_impl; +} + +/***********************************************************************************************/ +/* External class Implementation */ +/***********************************************************************************************/ + static void content_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) { ui_base_view *view = static_cast(data); @@ -93,7 +106,7 @@ void ui_base_view::set_indicator(ui_view_indicator indicator) if (!viewmgr->is_activated()) return; - if (dynamic_cast(viewmgr->get_last_view()) != this) return; + if (viewmgr->get_last_view() != this) return; viewmgr->set_indicator(indicator); } @@ -126,3 +139,4 @@ int ui_base_view::get_degree() } return elm_win_rotation_get(viewmgr->get_window()); } + diff --git a/src/lib/efl/ui_base_viewmgr.cpp b/src/lib/efl/ui_base_viewmgr.cpp index 71ed03d..c8d52a0 100644 --- a/src/lib/efl/ui_base_viewmgr.cpp +++ b/src/lib/efl/ui_base_viewmgr.cpp @@ -14,9 +14,72 @@ * limitations under the License. * */ + +#include +#include #include "../../include/efl/ui_base_viewmanager.h" -bool ui_base_viewmgr::create_base_layout(Elm_Scroller *scroller, const char *style) +using namespace std; + +/***********************************************************************************************/ +/* Internal class Implementation */ +/***********************************************************************************************/ +namespace efl_viewmanager +{ + +class ui_base_viewmgr_impl +{ + friend class ui_base_viewmgr; + +private: + ui_base_viewmgr *viewmgr; + Elm_Win *win; //This is acting like a base object of viewmgr. + Elm_Conformant *conform; //Conformant for viewmgr. + Elm_Scroller *scroller; //Scroller for viewmgr. + Elm_Layout *layout; //Viewmgr's base layout. + ui_base_key_listener *key_listener; //HW Key Handler such as "BACK" key... + ui_view_indicator indicator; //Mode of indicator. + string transition_style; //Current transition effect style name + map effect_map; //Map for effect layouts. + + Elm_Layout *set_transition_layout(string transition_style); + + bool create_conformant(Elm_Win *win); + bool create_scroller(Elm_Conformant *conform); + bool create_base_layout(Elm_Scroller *scroller, const char *style); + bool set_indicator(ui_view_indicator indicator); + void activate_top_view(); + bool init(); + bool term(); + +public: + ui_base_viewmgr_impl(ui_base_viewmgr *viewmgr, const char *pkg, ui_base_key_listener *key_listener); + ~ui_base_viewmgr_impl(); + + bool activate(); + bool deactivate(); + ui_base_view *push_view(ui_base_view *view); + bool pop_view(); + bool insert_view_before(ui_base_view *view, ui_base_view *before); + bool insert_view_after(ui_base_view *view, ui_base_view *after); + + Evas_Object *get_base() + { + return this->layout; + } + Elm_Win *get_window() + { + return this->win; + } + Elm_Conformant *get_conformant() + { + return this->conform; + } +}; + +} + +bool ui_base_viewmgr_impl::create_base_layout(Elm_Scroller *scroller, const char *style) { char edj_path[PATH_MAX]; char group_name[128]; @@ -41,7 +104,7 @@ bool ui_base_viewmgr::create_base_layout(Elm_Scroller *scroller, const char *sty if (pview) viewmgr->push_view_finished(pview); if (view) viewmgr->push_view_finished(view); }, - this); + this->viewmgr); //Pop Finished Event elm_layout_signal_callback_add(layout, "pop,finished", "viewmgr", @@ -53,14 +116,14 @@ bool ui_base_viewmgr::create_base_layout(Elm_Scroller *scroller, const char *sty if (pview) viewmgr->pop_view_finished(pview); if (view) viewmgr->pop_view_finished(view); }, - this); + this->viewmgr); this->layout = layout; return true; } -Elm_Layout *ui_base_viewmgr::set_transition_layout(string transition_style) +Elm_Layout *ui_base_viewmgr_impl::set_transition_layout(string transition_style) { Elm_Layout *effect_layout = NULL; Elm_Layout *pcontent; @@ -97,12 +160,12 @@ Elm_Layout *ui_base_viewmgr::set_transition_layout(string transition_style) return this->layout; } -void ui_base_viewmgr::activate_top_view() +void ui_base_viewmgr_impl::activate_top_view() { Evas_Object *pcontent = elm_object_part_content_unset(this->get_base(), "content"); if (pcontent) evas_object_hide(pcontent); - ui_base_view *view = this->get_last_view(); + ui_base_view *view = this->viewmgr->get_last_view(); //In case of ui_base_view, it doesn't have any base form. It uses viewmgr base instead. Evas_Object *content; @@ -122,7 +185,7 @@ void ui_base_viewmgr::activate_top_view() //FIXME: How to deal with indicator in other UI framework? Dali? Volt? //Is it possible make this interface common? -bool ui_base_viewmgr::set_indicator(ui_view_indicator indicator) +bool ui_base_viewmgr_impl::set_indicator(ui_view_indicator indicator) { if (this->indicator == indicator) return false; this->indicator = indicator; @@ -154,7 +217,7 @@ bool ui_base_viewmgr::set_indicator(ui_view_indicator indicator) return true; } -bool ui_base_viewmgr::create_conformant(Elm_Win *win) +bool ui_base_viewmgr_impl::create_conformant(Elm_Win *win) { Elm_Conformant *conform = elm_conformant_add(win); if (!conform) return false; @@ -169,7 +232,7 @@ bool ui_base_viewmgr::create_conformant(Elm_Win *win) return true; } -bool ui_base_viewmgr::create_scroller(Elm_Conformant *conform) +bool ui_base_viewmgr_impl::create_scroller(Elm_Conformant *conform) { Elm_Scroller *scroller = elm_scroller_add(conform); if (!scroller) return false; @@ -185,14 +248,15 @@ bool ui_base_viewmgr::create_scroller(Elm_Conformant *conform) return true; } -ui_base_viewmgr::ui_base_viewmgr(const char *pkg, ui_base_key_listener *key_listener) - : ui_iface_viewmgr(), key_listener(key_listener), transition_style("default") +ui_base_viewmgr_impl::ui_base_viewmgr_impl(ui_base_viewmgr *viewmgr, const char *pkg, ui_base_key_listener *key_listener) + : viewmgr(viewmgr), key_listener(key_listener), transition_style("default") { if (!pkg) { LOGE("Invalid package name"); return; } + //Window this->win = elm_win_util_standard_add(pkg, pkg); @@ -223,8 +287,7 @@ ui_base_viewmgr::ui_base_viewmgr(const char *pkg, ui_base_key_listener *key_list if (rot == 0 || rot == 180) view->on_portrait(); else view->on_landscape(); } - , this); - + , this->viewmgr); //Window is requested to delete. evas_object_smart_callback_add(this->win, "delete,request", [](void *data, Evas_Object *obj, void *event_info) -> void @@ -234,7 +297,7 @@ ui_base_viewmgr::ui_base_viewmgr(const char *pkg, ui_base_key_listener *key_list //FIXME: Window is destroyed. Terminate Application! //ui_app_exit(); }, - this); + this->viewmgr); //FIXME: Make conformant configurable? if (!this->create_conformant(this->win)) @@ -260,29 +323,29 @@ ui_base_viewmgr::ui_base_viewmgr(const char *pkg, ui_base_key_listener *key_list elm_win_indicator_opacity_set(this->win, ELM_WIN_INDICATOR_OPAQUE); elm_win_autodel_set(this->win, EINA_TRUE); - - key_listener->init(); } -ui_base_viewmgr::ui_base_viewmgr(const char *pkg) - : ui_base_viewmgr(pkg, new ui_base_key_listener(this)) +ui_base_viewmgr_impl::~ui_base_viewmgr_impl() { + delete(this->key_listener); } -ui_base_viewmgr::~ui_base_viewmgr() +bool ui_base_viewmgr_impl::init() { - this->key_listener->term(); - delete(this->key_listener); + return this->key_listener->init(); } -bool ui_base_viewmgr::activate() +bool ui_base_viewmgr_impl::term() { - if (!ui_iface_viewmgr::activate()) return false; + return this->key_listener->term(); +} +bool ui_base_viewmgr_impl::activate() +{ this->activate_top_view(); //FIXME: Necessary?? - ui_base_view *view = this->get_last_view(); + ui_base_view *view = this->viewmgr->get_last_view(); view->on_activate(); evas_object_show(this->win); @@ -290,14 +353,12 @@ bool ui_base_viewmgr::activate() return true; } -bool ui_base_viewmgr::deactivate() +bool ui_base_viewmgr_impl::deactivate() { - if (!ui_iface_viewmgr::deactivate()) return false; - //FIXME: based on the profile, we should app to go behind or terminate. if (true) { - ui_base_view *view = this->get_last_view(); + ui_base_view *view = this->viewmgr->get_last_view(); if (view) view->on_deactivate(); evas_object_lower(this->win); } @@ -310,27 +371,16 @@ bool ui_base_viewmgr::deactivate() return true; } -bool ui_base_viewmgr::pop_view() +bool ui_base_viewmgr_impl::pop_view() { - if (this->get_view_count() == 1) - { - this->deactivate(); - return true; - } - - if(!ui_iface_viewmgr::pop_view()) - { - return false; - } - - ui_base_view *pview = this->get_view(this->get_view_count() - 2); - ui_base_view *view = this->get_last_view(); + ui_base_view *pview = this->viewmgr->get_view(this->viewmgr->get_view_count() - 2); + ui_base_view *view = this->viewmgr->get_last_view(); //In case, if view doesn't have transition effect if (!strcmp(view->get_transition_style(), "none")) { - this->pop_view_finished(pview); - this->pop_view_finished(view); + this->viewmgr->pop_view_finished(pview); + this->viewmgr->pop_view_finished(view); this->activate_top_view(); return true; } @@ -339,8 +389,8 @@ bool ui_base_viewmgr::pop_view() Elm_Layout *effect = this->set_transition_layout(view->get_transition_style()); if (!effect) { LOGE("invalid effect transition style?! = %s", view->get_transition_style()); - this->pop_view_finished(pview); - this->pop_view_finished(view); + this->viewmgr->pop_view_finished(pview); + this->viewmgr->pop_view_finished(view); this->activate_top_view(); return true; } @@ -359,26 +409,24 @@ bool ui_base_viewmgr::pop_view() return true; } -ui_base_view * ui_base_viewmgr::push_view(ui_base_view *view) +ui_base_view * ui_base_viewmgr_impl::push_view(ui_base_view *view) { - ui_iface_viewmgr::push_view(view); - - if (!this->is_activated()) return view; + if (!this->viewmgr->is_activated()) return view; //In case, if viewmgr has one view, we skip effect. - if (this->get_view_count() == 1) { + if (this->viewmgr->get_view_count() == 1) { this->activate_top_view(); - this->push_view_finished(view); + this->viewmgr->push_view_finished(view); return view; } - ui_base_view *pview = this->get_view(this->get_view_count() - 2); + ui_base_view *pview = this->viewmgr->get_view(this->viewmgr->get_view_count() - 2); //In case, if view doesn't have transition effect if (!strcmp(view->get_transition_style(), "none")) { this->activate_top_view(); - this->push_view_finished(pview); - this->push_view_finished(view); + this->viewmgr->push_view_finished(pview); + this->viewmgr->push_view_finished(view); return view; } @@ -387,8 +435,8 @@ ui_base_view * ui_base_viewmgr::push_view(ui_base_view *view) if (!effect) { LOGE("invalid effect transition style?! = %s", view->get_transition_style()); this->activate_top_view(); - this->push_view_finished(pview); - this->push_view_finished(view); + this->viewmgr->push_view_finished(pview); + this->viewmgr->push_view_finished(view); return view; } @@ -406,6 +454,69 @@ ui_base_view * ui_base_viewmgr::push_view(ui_base_view *view) return view; } +/***********************************************************************************************/ +/* External class Implementation */ +/***********************************************************************************************/ + +ui_base_viewmgr::ui_base_viewmgr(const char *pkg, ui_base_key_listener *key_listener) + : ui_iface_viewmgr() +{ + this->impl = new ui_base_viewmgr_impl(this, pkg, key_listener); + this->impl->init(); +} + +ui_base_viewmgr::ui_base_viewmgr(const char *pkg) + : ui_base_viewmgr(pkg, new ui_base_key_listener(this)) +{ +} + +ui_base_viewmgr::~ui_base_viewmgr() +{ + this->impl->term(); + delete(this->impl); +} + +bool ui_base_viewmgr::activate() +{ + if (!ui_iface_viewmgr::activate()) return false; + + this->impl->activate(); + + return true; +} + +bool ui_base_viewmgr::deactivate() +{ + if (!ui_iface_viewmgr::deactivate()) return false; + + this->impl->deactivate(); + + return true; +} + +bool ui_base_viewmgr::pop_view() +{ + if (this->get_view_count() == 1) + { + this->deactivate(); + return true; + } + + if(!ui_iface_viewmgr::pop_view()) + { + return false; + } + + return this->impl->pop_view(); +} + +ui_base_view * ui_base_viewmgr::push_view(ui_base_view *view) +{ + ui_iface_viewmgr::push_view(view); + + return this->impl->push_view(view); +} + bool ui_base_viewmgr::insert_view_before(ui_base_view *view, ui_base_view *before) { return ui_iface_viewmgr::insert_view_before(view, before); @@ -425,3 +536,21 @@ ui_base_view *ui_base_viewmgr::get_last_view() { return dynamic_cast(ui_iface_viewmgr::get_last_view()); } + +Evas_Object *ui_base_viewmgr::get_base() +{ + return this->impl->get_base(); +} +Elm_Win *ui_base_viewmgr::get_window() +{ + return this->impl->get_window(); +} +Elm_Conformant *ui_base_viewmgr::get_conformant() +{ + return this->impl->get_conformant(); +} + +bool ui_base_viewmgr::set_indicator(ui_view_indicator indicator) +{ + return this->impl->set_indicator(indicator); +} diff --git a/src/lib/interface/ui_iface_overlay.cpp b/src/lib/interface/ui_iface_overlay.cpp index e65aa3c..a56da6a 100644 --- a/src/lib/interface/ui_iface_overlay.cpp +++ b/src/lib/interface/ui_iface_overlay.cpp @@ -17,39 +17,116 @@ #include "../../include/interface/ui_iface_viewmanager.h" -ui_iface_overlay::ui_iface_overlay(ui_iface_view *view) - : view(view), content(NULL) + +/***********************************************************************************************/ +/* Internal class Implementation */ +/***********************************************************************************************/ +namespace ui_viewmanager +{ + +class ui_iface_overlay_impl +{ + friend class ui_iface_overlay; + +private: + ui_iface_overlay *overlay; + ui_iface_view *view; + T content; + +public: + bool set_content(T content); + T unset_content(); + ui_iface_view *get_view(); + T get_content(); + + ui_iface_overlay_impl(ui_iface_overlay *overlay, ui_iface_view *view); + ~ui_iface_overlay_impl(); +}; + +} + +ui_iface_overlay_impl::ui_iface_overlay_impl(ui_iface_overlay *overlay, ui_iface_view *view) + : overlay(overlay), view(view), content(NULL) { } -ui_iface_overlay::~ui_iface_overlay() +ui_iface_overlay_impl::~ui_iface_overlay_impl() { } -bool ui_iface_overlay::set_content(T content) +bool ui_iface_overlay_impl::set_content(T content) { this->content = content; return true; } -T ui_iface_overlay::unset_content() +T ui_iface_overlay_impl::unset_content() { T prev = this->content; this->content = NULL; return prev; } -T ui_iface_overlay::get_content() +T ui_iface_overlay_impl::get_content() { return this->content; } -ui_iface_view *ui_iface_overlay::get_view() +ui_iface_view *ui_iface_overlay_impl::get_view() { return this->view; } + +/***********************************************************************************************/ +/* External class Implementation */ +/***********************************************************************************************/ +ui_iface_overlay::ui_iface_overlay(ui_iface_view *view) +{ + this->impl = new ui_iface_overlay_impl(this, view); +} + +ui_iface_overlay::~ui_iface_overlay() +{ + delete(this->impl); +} + +bool ui_iface_overlay::set_content(T content) +{ + return this->impl->set_content(content); +} + +T ui_iface_overlay::unset_content() +{ + return this->impl->unset_content(); +} + +T ui_iface_overlay::get_content() +{ + return this->impl->get_content(); +} + +ui_iface_view *ui_iface_overlay::get_view() +{ + return this->impl->get_view(); +} + void ui_iface_overlay::on_back() { this->deactivate(); } + +bool ui_iface_overlay::activate() +{ + return true; +} + +bool ui_iface_overlay::deactivate() +{ + return true; +} + +bool ui_iface_overlay::is_activated() +{ + return true; +} diff --git a/src/lib/interface/ui_iface_view.cpp b/src/lib/interface/ui_iface_view.cpp index a4d19a7..f62e273 100644 --- a/src/lib/interface/ui_iface_view.cpp +++ b/src/lib/interface/ui_iface_view.cpp @@ -24,7 +24,8 @@ using namespace std; /***********************************************************************************************/ /* Internal class Implementation */ /***********************************************************************************************/ -namespace ui_viewmanager { +namespace ui_viewmanager +{ class ui_iface_view_impl { diff --git a/src/lib/interface/ui_iface_viewmgr.cpp b/src/lib/interface/ui_iface_viewmgr.cpp index 3cd0083..c092e03 100644 --- a/src/lib/interface/ui_iface_viewmgr.cpp +++ b/src/lib/interface/ui_iface_viewmgr.cpp @@ -23,7 +23,8 @@ using namespace std; /***********************************************************************************************/ /* Internal class Implementation */ /***********************************************************************************************/ -namespace ui_viewmanager { +namespace ui_viewmanager +{ class ui_iface_viewmgr_impl {