From ff0a70d488aed8b584d47d9491ec8c1364c93031 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Fri, 19 Feb 2016 20:36:27 +0900 Subject: [PATCH] code refactoring. reorganize classs domains. Change-Id: I9c8faed884050b8b8ab9bb7813796b9a972dc4ee --- CMakeLists.txt | 12 ++-- inc/main.h | 5 +- src/{ => efl/example}/main.cpp | 12 ++-- src/{page1_controller.h => efl/example/page1.h} | 12 ++-- src/{page2_controller.h => efl/example/page2.h} | 12 ++-- src/{page3_controller.h => efl/example/page3.h} | 12 ++-- src/{page4_controller.h => efl/example/page4.h} | 12 ++-- src/{page5_controller.h => efl/example/page5.h} | 10 +-- ...e_key_handler.cpp => ui_basic_key_listener.cpp} | 19 +++-- ...obile_key_handler.h => ui_basic_key_listener.h} | 13 ++-- src/efl/mobile/ui_basic_view.cpp | 8 ++- src/efl/mobile/ui_basic_view.h | 6 +- src/efl/mobile/{efl_viewmgr.h => ui_viewmanager.h} | 8 +++ src/efl/ui_controller.cpp | 4 +- src/efl/ui_controller.h | 9 ++- .../{ui_key_handler.cpp => ui_key_listener.cpp} | 13 ++-- src/efl/{ui_key_handler.h => ui_key_listener.h} | 14 ++-- src/efl/ui_view.cpp | 20 ++---- src/efl/ui_view.h | 12 ++-- src/efl/{efl_viewmgr.h => ui_viewmanager.h} | 9 +++ src/efl/ui_viewmgr.cpp | 22 +++--- src/efl/ui_viewmgr.h | 16 ++--- ...roller_base.cpp => ui_controller_interface.cpp} | 4 +- ...controller_base.h => ui_controller_interface.h} | 22 +++--- .../{ui_view_base.cpp => ui_view_interface.cpp} | 42 +++++------ .../{ui_view_base.h => ui_view_interface.h} | 84 +++++++++++----------- .../{ui_viewmgr.h => ui_viewmanager_interface.h} | 15 ++-- ...i_viewmgr_base.cpp => ui_viewmgr_interface.cpp} | 62 ++++++++-------- .../{ui_viewmgr_base.h => ui_viewmgr_interface.h} | 58 +++++++-------- 29 files changed, 274 insertions(+), 273 deletions(-) rename src/{ => efl/example}/main.cpp (96%) rename src/{page1_controller.h => efl/example/page1.h} (90%) rename src/{page2_controller.h => efl/example/page2.h} (91%) rename src/{page3_controller.h => efl/example/page3.h} (90%) rename src/{page4_controller.h => efl/example/page4.h} (90%) rename src/{page5_controller.h => efl/example/page5.h} (91%) rename src/efl/mobile/{mobile_key_handler.cpp => ui_basic_key_listener.cpp} (85%) rename src/efl/mobile/{mobile_key_handler.h => ui_basic_key_listener.h} (77%) rename src/efl/mobile/{efl_viewmgr.h => ui_viewmanager.h} (84%) rename src/efl/{ui_key_handler.cpp => ui_key_listener.cpp} (87%) rename src/efl/{ui_key_handler.h => ui_key_listener.h} (79%) rename src/efl/{efl_viewmgr.h => ui_viewmanager.h} (86%) rename src/interface/{ui_controller_base.cpp => ui_controller_interface.cpp} (87%) rename src/interface/{ui_controller_base.h => ui_controller_interface.h} (90%) rename src/interface/{ui_view_base.cpp => ui_view_interface.cpp} (70%) rename src/interface/{ui_view_base.h => ui_view_interface.h} (71%) rename src/interface/{ui_viewmgr.h => ui_viewmanager_interface.h} (78%) rename src/interface/{ui_viewmgr_base.cpp => ui_viewmgr_interface.cpp} (68%) rename src/interface/{ui_viewmgr_base.h => ui_viewmgr_interface.h} (81%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 818aad6..efecc3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,16 +3,16 @@ PROJECT(ui-viewmgr) SET(PACKAGE org.tizen.ui-viewmgr) SET(SRCS - src/interface/ui_controller_base.cpp - src/interface/ui_view_base.cpp - src/interface/ui_viewmgr_base.cpp + src/interface/ui_controller_interface.cpp + src/interface/ui_view_interface.cpp + src/interface/ui_viewmgr_interface.cpp src/efl/ui_controller.cpp src/efl/ui_view.cpp src/efl/ui_viewmgr.cpp - src/efl/ui_key_handler.cpp + src/efl/ui_key_listener.cpp src/efl/mobile/ui_basic_view.cpp - src/efl/mobile/mobile_key_handler.cpp - src/main.cpp + src/efl/mobile/ui_basic_key_listener.cpp + src/efl/example/main.cpp ) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/inc) diff --git a/inc/main.h b/inc/main.h index 9624a71..783f495 100644 --- a/inc/main.h +++ b/inc/main.h @@ -17,8 +17,7 @@ #include #include #include -#include -#include "../src/efl/mobile/efl_viewmgr.h" +#include "../src/efl/mobile/ui_viewmanager.h" //uncomment if you want debug #ifndef TIZEN_ENGINEER_MODE @@ -28,7 +27,7 @@ #ifdef LOG_TAG #undef LOG_TAG #endif -#define LOG_TAG "VIEWMGR" +#define LOG_TAG "UI_VIEWMGR" #if !defined(PACKAGE) #define PACKAGE "org.tizen.ui-viewmgr" diff --git a/src/main.cpp b/src/efl/example/main.cpp similarity index 96% rename from src/main.cpp rename to src/efl/example/main.cpp index e3483ad..ff20a0d 100644 --- a/src/main.cpp +++ b/src/efl/example/main.cpp @@ -15,11 +15,11 @@ * */ #include "main.h" -#include "page5_controller.h" -#include "page4_controller.h" -#include "page3_controller.h" -#include "page2_controller.h" -#include "page1_controller.h" +#include "page5.h" +#include "page4.h" +#include "page3.h" +#include "page2.h" +#include "page1.h" Evas_Object* create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb, appdata_s *ad) @@ -68,7 +68,7 @@ static void create_base_gui(appdata_s *ad) //FIXME: Hide this creation. ad->viewmgr = new ui_viewmgr(PACKAGE); - page1(ad); + create_page1(ad); ad->viewmgr->activate(); } diff --git a/src/page1_controller.h b/src/efl/example/page1.h similarity index 90% rename from src/page1_controller.h rename to src/efl/example/page1.h index b34d122..0951a61 100644 --- a/src/page1_controller.h +++ b/src/efl/example/page1.h @@ -14,20 +14,20 @@ * limitations under the License. * */ -class page1_controller: public ui_controller +class page1: public ui_controller { private: appdata_s *ad; public: - page1_controller(appdata_s *ad) + page1(appdata_s *ad) : ad(ad) { /* ui_basic_view(controller, identity name). Later, you could get the identity name using view->get_name(); */ ad->viewmgr->push_view(new ui_basic_view(this, "page1")); } - ~page1_controller() + ~page1() { } @@ -49,7 +49,7 @@ public: [](void *data, Evas_Object *obj, void *event_info) -> void { appdata_s *ad = static_cast(data); - page2(ad); + create_page2(ad); }, this->ad); @@ -57,7 +57,7 @@ public: } }; -void page1(appdata_s *ad) +void create_page1(appdata_s *ad) { - new page1_controller(ad); + new page1(ad); } diff --git a/src/page2_controller.h b/src/efl/example/page2.h similarity index 91% rename from src/page2_controller.h rename to src/efl/example/page2.h index 5e71b8d..0f2a2d3 100644 --- a/src/page2_controller.h +++ b/src/efl/example/page2.h @@ -14,13 +14,13 @@ * limitations under the License. * */ -class page2_controller: public ui_controller +class page2: public ui_controller { private: appdata_s *ad; public: - page2_controller(appdata_s *ad) + page2(appdata_s *ad) : ad(ad) { /* ui_basic_view(controller, identity name). @@ -28,7 +28,7 @@ public: ad->viewmgr->push_view(new ui_basic_view(this, "page2")); } - ~page2_controller() + ~page2() { } @@ -49,7 +49,7 @@ public: [](void *data, Evas_Object *obj, void *event_info) -> void { appdata_s *ad = static_cast(data); - page3(ad); + create_page3(ad); }, this->ad); @@ -66,7 +66,7 @@ public: } }; -void page2(appdata_s *ad) +void create_page2(appdata_s *ad) { - new page2_controller(ad); + new page2(ad); } diff --git a/src/page3_controller.h b/src/efl/example/page3.h similarity index 90% rename from src/page3_controller.h rename to src/efl/example/page3.h index 67a6070..dc5621b 100644 --- a/src/page3_controller.h +++ b/src/efl/example/page3.h @@ -14,13 +14,13 @@ * limitations under the License. * */ -class page3_controller: public ui_controller +class page3: public ui_controller { private: appdata_s *ad; public: - page3_controller(appdata_s *ad) + page3(appdata_s *ad) : ad(ad) { /* ui_basic_view(controller, identity name). @@ -28,7 +28,7 @@ public: ad->viewmgr->push_view(new ui_basic_view(this, "page3")); } - ~page3_controller() + ~page3() { } @@ -50,7 +50,7 @@ public: [](void *data, Evas_Object *obj, void *event_info) -> void { appdata_s *ad = static_cast(data); - page4(ad); + create_page4(ad); }, this->ad); @@ -59,7 +59,7 @@ public: } }; -void page3(appdata_s *ad) +void create_page3(appdata_s *ad) { - new page3_controller(ad); + new page3(ad); } diff --git a/src/page4_controller.h b/src/efl/example/page4.h similarity index 90% rename from src/page4_controller.h rename to src/efl/example/page4.h index 6e97a38..6c22cf5 100644 --- a/src/page4_controller.h +++ b/src/efl/example/page4.h @@ -14,13 +14,13 @@ * limitations under the License. * */ -class page4_controller: public ui_controller +class page4: public ui_controller { private: appdata_s *ad; public: - page4_controller(appdata_s *ad) + page4(appdata_s *ad) : ad(ad) { /* ui_basic_view(controller, identity name). @@ -28,7 +28,7 @@ public: ad->viewmgr->push_view(new ui_basic_view(this, "page4")); } - ~page4_controller() + ~page4() { } @@ -50,7 +50,7 @@ public: [](void *data, Evas_Object *obj, void *event_info) -> void { appdata_s *ad = static_cast(data); - page5(ad); + create_page5(ad); }, this->ad); @@ -60,7 +60,7 @@ public: } }; -void page4(appdata_s *ad) +void create_page4(appdata_s *ad) { - new page4_controller(ad); + new page4(ad); } diff --git a/src/page5_controller.h b/src/efl/example/page5.h similarity index 91% rename from src/page5_controller.h rename to src/efl/example/page5.h index 744de44..85f861a 100644 --- a/src/page5_controller.h +++ b/src/efl/example/page5.h @@ -14,13 +14,13 @@ * limitations under the License. * */ -class page5_controller: public ui_controller +class page5: public ui_controller { private: appdata_s *ad; public: - page5_controller(appdata_s *ad) + page5(appdata_s *ad) : ad(ad) { //No basic form. @@ -29,7 +29,7 @@ public: ui_view *view = ad->viewmgr->push_view(new ui_view(this, "page5")); } - ~page5_controller() + ~page5() { } @@ -60,7 +60,7 @@ public: } }; -void page5(appdata_s *ad) +void create_page5(appdata_s *ad) { - new page5_controller(ad); + new page5(ad); } diff --git a/src/efl/mobile/mobile_key_handler.cpp b/src/efl/mobile/ui_basic_key_listener.cpp similarity index 85% rename from src/efl/mobile/mobile_key_handler.cpp rename to src/efl/mobile/ui_basic_key_listener.cpp index 9a3a1ba..5fe7c98 100644 --- a/src/efl/mobile/mobile_key_handler.cpp +++ b/src/efl/mobile/ui_basic_key_listener.cpp @@ -14,28 +14,27 @@ * limitations under the License. * */ -#include "../efl_viewmgr.h" -#include "mobile_key_handler.h" +#include "ui_viewmanager.h" using namespace efl; static const char *KEY_BACK = "XF86Back"; static const char *KEY_MENU = "XF86Menu"; -enum mobile_key_event_type +enum ui_key_event_type { UI_KEY_EVENT_BACK = 0, UI_KEY_EVENT_MENU }; -mobile_key_handler::mobile_key_handler(ui_viewmgr *viewmgr) - : ui_key_handler(viewmgr) +ui_basic_key_listener::ui_basic_key_listener(ui_viewmgr *viewmgr) + : ui_key_listener(viewmgr) { } -static void event_proc(mobile_key_handler *key_handler, Evas_Event_Key_Down *ev) +static void event_proc(ui_basic_key_listener *key_handler, Evas_Event_Key_Down *ev) { - mobile_key_event_type type; + ui_key_event_type type; if (!strcmp(ev->keyname, KEY_BACK)) type = UI_KEY_EVENT_BACK; @@ -64,13 +63,13 @@ static void event_proc(mobile_key_handler *key_handler, Evas_Event_Key_Down *ev) } } -bool mobile_key_handler::term() +bool ui_basic_key_listener::term() { evas_object_del(this->key_grabber); return true; } -bool mobile_key_handler::init() +bool ui_basic_key_listener::init() { if (!this->viewmgr) { @@ -96,7 +95,7 @@ bool mobile_key_handler::init() [](void *data, Evas *e, Evas_Object *obj, void *event_info) -> void { Evas_Event_Key_Down *ev = static_cast(event_info); - mobile_key_handler *key_handler = static_cast(data); + ui_basic_key_listener *key_handler = static_cast(data); event_proc(key_handler, ev); }, this); diff --git a/src/efl/mobile/mobile_key_handler.h b/src/efl/mobile/ui_basic_key_listener.h similarity index 77% rename from src/efl/mobile/mobile_key_handler.h rename to src/efl/mobile/ui_basic_key_listener.h index f30db1d..58d6ff8 100644 --- a/src/efl/mobile/mobile_key_handler.h +++ b/src/efl/mobile/ui_basic_key_listener.h @@ -14,20 +14,19 @@ * limitations under the License. * */ -#ifndef MOBILE_KEY_HANDLER -#define MOBILE_KEY_HANDLER +#ifndef MOBILE_KEY_HANDLER_H +#define MOBILE_KEY_HANDLER_H -#include -#include "../ui_key_handler.h" +#include "../ui_viewmanager.h" namespace efl { class ui_viewmgr; -class mobile_key_handler : public ui_key_handler +class ui_basic_key_listener : public ui_key_listener { public: - mobile_key_handler(ui_viewmgr *viewmgr); + ui_basic_key_listener(ui_viewmgr *viewmgr); bool init(); bool term(); @@ -37,4 +36,4 @@ public: } -#endif /* MOBILE_KEY_HANDLER */ +#endif /* MOBILE_KEY_HANDLER_H */ diff --git a/src/efl/mobile/ui_basic_view.cpp b/src/efl/mobile/ui_basic_view.cpp index 754ff0e..8fca093 100644 --- a/src/efl/mobile/ui_basic_view.cpp +++ b/src/efl/mobile/ui_basic_view.cpp @@ -14,7 +14,11 @@ * limitations under the License. * */ -#include "efl_viewmgr.h" +#include "ui_viewmanager.h" + +//FIXME: is it correct to define here? +#define EDJ_PATH "/opt/usr/apps/org.tizen.ui-viewmgr/res/ui-viewmgr.edj" +#define GROUP "elm/layout/tizen_view/default" using namespace efl; @@ -54,7 +58,7 @@ bool ui_basic_view::create_layout() } //Set soft back key, if it's needed - ui_viewmgr *viewmgr = dynamic_cast(ui_view_base::get_viewmgr()); + ui_viewmgr *viewmgr = dynamic_cast(ui_view_interface::get_viewmgr()); if (viewmgr->get_soft_back_key()) { Evas_Object *prev_btn = elm_button_add(layout); diff --git a/src/efl/mobile/ui_basic_view.h b/src/efl/mobile/ui_basic_view.h index 565614f..6d81437 100644 --- a/src/efl/mobile/ui_basic_view.h +++ b/src/efl/mobile/ui_basic_view.h @@ -17,11 +17,7 @@ #ifndef UI_BASIC_VIEW #define UI_BASIC_VIEW -#include "../efl_viewmgr.h" - -//FIXME: is it correct to define here? -#define EDJ_PATH "/opt/usr/apps/org.tizen.ui-viewmgr/res/ui-viewmgr.edj" -#define GROUP "elm/layout/tizen_view/default" +#include "../ui_viewmanager.h" namespace efl { diff --git a/src/efl/mobile/efl_viewmgr.h b/src/efl/mobile/ui_viewmanager.h similarity index 84% rename from src/efl/mobile/efl_viewmgr.h rename to src/efl/mobile/ui_viewmanager.h index 23fb3c3..a2a23b5 100644 --- a/src/efl/mobile/efl_viewmgr.h +++ b/src/efl/mobile/ui_viewmanager.h @@ -14,4 +14,12 @@ * limitations under the License. * */ +#include + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "UI_VIEWMGR" + +#include "ui_basic_key_listener.h" #include "ui_basic_view.h" diff --git a/src/efl/ui_controller.cpp b/src/efl/ui_controller.cpp index 68369f5..4f16828 100644 --- a/src/efl/ui_controller.cpp +++ b/src/efl/ui_controller.cpp @@ -14,13 +14,13 @@ * limitations under the License. * */ -#include "efl_viewmgr.h" +#include "ui_viewmanager.h" using namespace efl; ui_view * ui_controller::get_view() { - ui_view_base *view = ui_controller_base::get_view(); + ui_view_interface *view = ui_controller_interface::get_view(); if (!view) return NULL; return dynamic_cast(view); } diff --git a/src/efl/ui_controller.h b/src/efl/ui_controller.h index 3414930..9228b10 100644 --- a/src/efl/ui_controller.h +++ b/src/efl/ui_controller.h @@ -14,15 +14,14 @@ * limitations under the License. * */ -#ifndef UI_CONTROLLER -#define UI_CONTROLLER +#ifndef UI_CONTROLLER_H +#define UI_CONTROLLER_H -#include -#include "../interface/ui_viewmgr.h" +#include "../interface/ui_viewmanager_interface.h" namespace efl { -class ui_controller: public ui_controller_base +class ui_controller: public ui_controller_interface { public: virtual ~ui_controller(); diff --git a/src/efl/ui_key_handler.cpp b/src/efl/ui_key_listener.cpp similarity index 87% rename from src/efl/ui_key_handler.cpp rename to src/efl/ui_key_listener.cpp index 797ea47..ec33380 100644 --- a/src/efl/ui_key_handler.cpp +++ b/src/efl/ui_key_listener.cpp @@ -14,8 +14,7 @@ * limitations under the License. * */ -#include "ui_viewmgr.h" -#include "ui_key_handler.h" +#include "ui_viewmanager.h" using namespace efl; @@ -26,13 +25,13 @@ enum ui_key_event_type UI_KEY_EVENT_BACK = 0, }; -ui_key_handler::ui_key_handler(ui_viewmgr *viewmgr) +ui_key_listener::ui_key_listener(ui_viewmgr *viewmgr) : viewmgr(viewmgr), key_grabber(NULL) { } -static void event_proc(ui_key_handler *key_handler, Evas_Event_Key_Down *ev) +static void event_proc(ui_key_listener *key_handler, Evas_Event_Key_Down *ev) { ui_key_event_type type; @@ -57,13 +56,13 @@ static void event_proc(ui_key_handler *key_handler, Evas_Event_Key_Down *ev) } } -bool ui_key_handler::term() +bool ui_key_listener::term() { evas_object_del(this->key_grabber); return true; } -bool ui_key_handler::init() +bool ui_key_listener::init() { if (!this->viewmgr) { @@ -89,7 +88,7 @@ bool ui_key_handler::init() [](void *data, Evas *e, Evas_Object *obj, void *event_info) -> void { Evas_Event_Key_Down *ev = static_cast(event_info); - ui_key_handler *key_handler = static_cast(data); + ui_key_listener *key_handler = static_cast(data); event_proc(key_handler, ev); }, this); diff --git a/src/efl/ui_key_handler.h b/src/efl/ui_key_listener.h similarity index 79% rename from src/efl/ui_key_handler.h rename to src/efl/ui_key_listener.h index 112cd94..7d94ac5 100644 --- a/src/efl/ui_key_handler.h +++ b/src/efl/ui_key_listener.h @@ -14,25 +14,25 @@ * limitations under the License. * */ -#ifndef UI_KEY_HANDLER -#define UI_KEY_HANDLER +#ifndef UI_KEY_LISTENER_H +#define UI_KEY_LISTENER_H #include -#include "../interface/ui_viewmgr.h" +#include "../interface/ui_viewmanager_interface.h" namespace efl { class ui_viewmgr; -class ui_key_handler +class ui_key_listener { protected: ui_viewmgr *viewmgr; Evas_Object *key_grabber; public: - ui_key_handler(ui_viewmgr *viewmgr); - virtual ~ui_key_handler() {} + ui_key_listener(ui_viewmgr *viewmgr); + virtual ~ui_key_listener() {} virtual bool init(); virtual bool term(); @@ -42,4 +42,4 @@ public: } -#endif /* UI_KEY_HANDLER */ +#endif /* UI_KEY_LISTENER_H */ diff --git a/src/efl/ui_view.cpp b/src/efl/ui_view.cpp index 11b64fd..a14f74b 100644 --- a/src/efl/ui_view.cpp +++ b/src/efl/ui_view.cpp @@ -14,12 +14,12 @@ * limitations under the License. * */ -#include "efl_viewmgr.h" +#include "ui_viewmanager.h" using namespace efl; ui_view::ui_view(ui_controller *controller, const char *name) - : ui_view_base(controller, name) + : ui_view_interface(controller, name) { } @@ -29,13 +29,13 @@ ui_view::~ui_view() Evas_Object *ui_view::set_content(Evas_Object *content) { - T pcontent = ui_view_base::set_content(CONVERT_TO_T(content)); + T pcontent = ui_view_interface::set_content(CONVERT_TO_T(content)); return static_cast(pcontent); } Evas_Object *ui_view::get_base() { - ui_viewmgr *viewmgr = dynamic_cast(ui_view_base::get_viewmgr()); + ui_viewmgr *viewmgr = dynamic_cast(ui_view_interface::get_viewmgr()); if (!viewmgr) { return NULL; @@ -43,16 +43,6 @@ Evas_Object *ui_view::get_base() return viewmgr->get_base(); } -void ui_view::load() -{ - ui_view_base::load(); -} - -void ui_view::unload() -{ - ui_view_base::unload(); -} - void ui_view::unload_content() { Evas_Object *pcontent = this->set_content(NULL); @@ -69,7 +59,7 @@ void ui_view::set_indicator(ui_view_indicator indicator) { if (this->get_indicator() == indicator) return; - ui_view_base::set_indicator(indicator); + ui_view_interface::set_indicator(indicator); ui_viewmgr *viewmgr = dynamic_cast(this->get_viewmgr()); diff --git a/src/efl/ui_view.h b/src/efl/ui_view.h index df0fd13..6a16b5c 100644 --- a/src/efl/ui_view.h +++ b/src/efl/ui_view.h @@ -14,11 +14,11 @@ * limitations under the License. * */ -#ifndef UI_VIEW -#define UI_VIEW +#ifndef UI_VIEW_H +#define UI_VIEW_H #include -#include "../interface/ui_viewmgr.h" +#include "../interface/ui_viewmanager_interface.h" #define CONVERT_TO_EO(T) static_cast((T)) #define CONVERT_TO_T(EO) static_cast((EO)) @@ -27,7 +27,7 @@ namespace efl { class ui_controller; -class ui_view: public ui_view_base +class ui_view: public ui_view_interface { friend class ui_viewmgr; @@ -41,12 +41,10 @@ public: void set_indicator(ui_view_indicator indicator); protected: - virtual void load(); - virtual void unload(); virtual void unload_content(); Evas_Object *get_parent(); }; } -#endif /* UI_VIEW */ +#endif /* UI_VIEW_H */ diff --git a/src/efl/efl_viewmgr.h b/src/efl/ui_viewmanager.h similarity index 86% rename from src/efl/efl_viewmgr.h rename to src/efl/ui_viewmanager.h index 7a6c43b..ed2e034 100644 --- a/src/efl/efl_viewmgr.h +++ b/src/efl/ui_viewmanager.h @@ -14,6 +14,15 @@ * limitations under the License. * */ +#include + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "UI_VIEWMGR" + #include "ui_viewmgr.h" #include "ui_controller.h" #include "ui_view.h" +#include "ui_key_listener.h" + diff --git a/src/efl/ui_viewmgr.cpp b/src/efl/ui_viewmgr.cpp index 67ff19d..20caf98 100644 --- a/src/efl/ui_viewmgr.cpp +++ b/src/efl/ui_viewmgr.cpp @@ -14,7 +14,7 @@ * limitations under the License. * */ -#include "efl_viewmgr.h" +#include "ui_viewmanager.h" using namespace efl; @@ -79,7 +79,7 @@ bool ui_viewmgr::create_base_layout(Evas_Object *conform) } ui_viewmgr::ui_viewmgr(const char *pkg) - : ui_viewmgr_base(), key_handler(NULL) + : ui_viewmgr_interface(), key_listener(NULL) { if (!pkg) { @@ -133,23 +133,23 @@ ui_viewmgr::ui_viewmgr(const char *pkg) elm_win_autodel_set(this->win, EINA_TRUE); - this->set_key_handler(); + this->set_key_listener(); } ui_viewmgr::~ui_viewmgr() { - this->key_handler->term(); + this->key_listener->term(); } -void ui_viewmgr::set_key_handler() +void ui_viewmgr::set_key_listener() { - this->key_handler = new ui_key_handler(this); - this->key_handler->init(); + this->key_listener = new ui_key_listener(this); + this->key_listener->init(); } bool ui_viewmgr::activate() { - ui_viewmgr_base::activate(); + ui_viewmgr_interface::activate(); elm_object_part_content_unset(this->get_base(), "elm.swallow.content"); @@ -176,7 +176,7 @@ bool ui_viewmgr::activate() bool ui_viewmgr::deactivate() { - ui_viewmgr_base::deactivate(); + ui_viewmgr_interface::deactivate(); //FIXME: based on the profile, we should app to go behind or terminate. if (true) @@ -197,7 +197,7 @@ bool ui_viewmgr::deactivate() bool ui_viewmgr::pop_view() { if (this->get_view_count() == 1) this->deactivate(); - else if(!ui_viewmgr_base::pop_view()) return false; + else if(!ui_viewmgr_interface::pop_view()) return false; ui_view *view = dynamic_cast(this->get_last_view()); @@ -220,7 +220,7 @@ bool ui_viewmgr::pop_view() ui_view * ui_viewmgr::push_view(ui_view *view) { - ui_viewmgr_base::push_view(view); + ui_viewmgr_interface::push_view(view); //Don't prepare yet if viewmgr is not activated. if (!this->is_activated()) return view; diff --git a/src/efl/ui_viewmgr.h b/src/efl/ui_viewmgr.h index ba40d36..2a9c23a 100644 --- a/src/efl/ui_viewmgr.h +++ b/src/efl/ui_viewmgr.h @@ -14,19 +14,19 @@ * limitations under the License. * */ -#ifndef UI_VIEWMGR -#define UI_VIEWMGR +#ifndef UI_VIEWMGR_H +#define UI_VIEWMGR_H #include -#include "../interface/ui_viewmgr.h" -#include "ui_key_handler.h" +#include "../interface/ui_viewmanager_interface.h" +#include "ui_key_listener.h" namespace efl { class ui_view; -class ui_viewmgr: public ui_viewmgr_base +class ui_viewmgr: public ui_viewmgr_interface { friend class ui_view; @@ -34,13 +34,13 @@ private: Evas_Object *win; Evas_Object *conform; Evas_Object *layout; - ui_key_handler *key_handler; //HW Key Handler such as "BACK" key... + ui_key_listener *key_listener; //HW Key Handler such as "BACK" key... ui_view_indicator indicator; bool create_conformant(Evas_Object *win); bool create_base_layout(Evas_Object *conform); bool set_indicator(ui_view_indicator indicator); - virtual void set_key_handler(); + virtual void set_key_listener(); protected: Evas_Object *get_base() @@ -69,4 +69,4 @@ public: }; } -#endif /* UI_VIEWMGR */ +#endif /* UI_VIEWMGR_H */ diff --git a/src/interface/ui_controller_base.cpp b/src/interface/ui_controller_interface.cpp similarity index 87% rename from src/interface/ui_controller_base.cpp rename to src/interface/ui_controller_interface.cpp index 84aa2b9..c62bf20 100644 --- a/src/interface/ui_controller_base.cpp +++ b/src/interface/ui_controller_interface.cpp @@ -14,9 +14,9 @@ * limitations under the License. * */ -#include "ui_viewmgr.h" +#include "ui_viewmanager_interface.h" -void ui_controller_base::set_view(ui_view_base *view) +void ui_controller_interface::set_view(ui_view_interface *view) { if (this->view) { diff --git a/src/interface/ui_controller_base.h b/src/interface/ui_controller_interface.h similarity index 90% rename from src/interface/ui_controller_base.h rename to src/interface/ui_controller_interface.h index 907ff2f..28ea496 100644 --- a/src/interface/ui_controller_base.h +++ b/src/interface/ui_controller_interface.h @@ -14,10 +14,10 @@ * limitations under the License. * */ -#ifndef UI_CONTROLLER_BASE_H_ -#define UI_CONTROLLER_BASE_H_ +#ifndef UI_CONTROLLER_INTERFACE_H_ +#define UI_CONTROLLER_INTERFACE_H_ -class ui_view_base; +class ui_view_interface; /** * @class ui_controller_base @@ -30,27 +30,27 @@ class ui_view_base; * @author Hermet Park * */ -class ui_controller_base +class ui_controller_interface { - friend class ui_view_base; + friend class ui_view_interface; private: - ui_view_base *view; + ui_view_interface *view; - void set_view(ui_view_base *view); + void set_view(ui_view_interface *view); protected: - ui_view_base *get_view() + ui_view_interface *get_view() { return this->view; } public: - ui_controller_base() : + ui_controller_interface() : view(NULL) { } - virtual ~ui_controller_base() + virtual ~ui_controller_interface() { } @@ -110,4 +110,4 @@ public: virtual void destroy() = 0; }; -#endif /* UI_CONTROLLER_BASE_H_ */ +#endif /* UI_CONTROLLER_INTERFACE_H_ */ diff --git a/src/interface/ui_view_base.cpp b/src/interface/ui_view_interface.cpp similarity index 70% rename from src/interface/ui_view_base.cpp rename to src/interface/ui_view_interface.cpp index f708ec9..fad60b2 100644 --- a/src/interface/ui_view_base.cpp +++ b/src/interface/ui_view_interface.cpp @@ -14,14 +14,14 @@ * limitations under the License. * */ -#include "ui_viewmgr.h" +#include "ui_viewmanager_interface.h" -void ui_view_base::set_event_block(bool block) +void ui_view_interface::set_event_block(bool block) { this->event_block = block; } -void ui_view_base::load() +void ui_view_interface::load() { this->state = UI_VIEW_STATE_LOAD; if (this->content) return; @@ -29,7 +29,7 @@ void ui_view_base::load() this->controller->load(); } -void ui_view_base::unload() +void ui_view_interface::unload() { this->state = UI_VIEW_STATE_UNLOAD; if (this->get_removable_content()) @@ -42,21 +42,21 @@ void ui_view_base::unload() this->controller->unload(); } -void ui_view_base::active() +void ui_view_interface::active() { this->state = UI_VIEW_STATE_ACTIVE; if (!this->controller) return; this->controller->active(); } -void ui_view_base::inactive() +void ui_view_interface::inactive() { this->state = UI_VIEW_STATE_INACTIVE; if (!this->controller) return; this->controller->inactive(); } -void ui_view_base::pause() +void ui_view_interface::pause() { this->state = UI_VIEW_STATE_PAUSE; if (!this->content) return; @@ -65,7 +65,7 @@ void ui_view_base::pause() this->controller->pause(); } -void ui_view_base::resume() +void ui_view_interface::resume() { this->state = UI_VIEW_STATE_ACTIVE; if (state != UI_VIEW_STATE_PAUSE) return; @@ -74,13 +74,13 @@ void ui_view_base::resume() this->controller->resume(); } -void ui_view_base::destroy() +void ui_view_interface::destroy() { if (!this->controller) return; this->controller->destroy(); } -ui_view_base::ui_view_base(T content, ui_controller_base *controller, const char *name) +ui_view_interface::ui_view_interface(T content, ui_controller_interface *controller, const char *name) : content(content), controller(controller), name(string(name ? name : "")), style(string("")), viewmgr(NULL), state(UI_VIEW_STATE_LOAD), indicator(UI_VIEW_INDICATOR_DEFAULT), event_block(false), removable_content(true) { @@ -89,54 +89,54 @@ ui_view_base::ui_view_base(T content, ui_controller_base *controller, const char controller->set_view(this); } -ui_view_base::ui_view_base(ui_controller_base *controller, const char *name) - : ui_view_base(NULL, controller, name) +ui_view_interface::ui_view_interface(ui_controller_interface *controller, const char *name) + : ui_view_interface(NULL, controller, name) { this->state = UI_VIEW_STATE_UNLOAD; } -ui_view_base::ui_view_base(const char *name) - : ui_view_base(NULL, name) +ui_view_interface::ui_view_interface(const char *name) + : ui_view_interface(NULL, name) { } -ui_view_base::~ui_view_base() +ui_view_interface::~ui_view_interface() { this->viewmgr->remove_view(this); if (this->controller) delete (this->controller); } -ui_controller_base* ui_view_base::set_controller(ui_controller_base *controller) +ui_controller_interface* ui_view_interface::set_controller(ui_controller_interface *controller) { - ui_controller_base *prev_controller = this->controller; + ui_controller_interface *prev_controller = this->controller; this->controller = controller; if (controller) controller->set_view(this); if (prev_controller) prev_controller->set_view(NULL); return prev_controller; } -T ui_view_base::set_content(T content) +T ui_view_interface::set_content(T content) { T prev = this->content; this->content = content; return prev; } -bool ui_view_base::set_style(const char *style) +bool ui_view_interface::set_style(const char *style) { this->style.assign(style); return true; } -void ui_view_base::set_removable_content(bool removable) +void ui_view_interface::set_removable_content(bool removable) { this->removable_content = removable; //FIXME: If this api is called on unload state? should we remove content right now? } -void ui_view_base::set_indicator(ui_view_indicator indicator) +void ui_view_interface::set_indicator(ui_view_indicator indicator) { this->indicator = indicator; } diff --git a/src/interface/ui_view_base.h b/src/interface/ui_view_interface.h similarity index 71% rename from src/interface/ui_view_base.h rename to src/interface/ui_view_interface.h index 08caea0..8d10364 100644 --- a/src/interface/ui_view_base.h +++ b/src/interface/ui_view_interface.h @@ -14,18 +14,20 @@ * limitations under the License. * */ -#ifndef UI_VIEW_BASE_H_ -#define UI_VIEW_BASE_H_ +#ifndef UI_VIEW_INTERFACE_H_ +#define UI_VIEW_INTERFACE_H_ #include +using namespace std; + typedef void* T; -class ui_viewmgr_base; -class ui_controller_base; +class ui_viewmgr_interface; +class ui_controller_interface; /** - * @class ui_view_base + * @class ui_view_interface * * @ingroup ui_viewmgr * @@ -33,16 +35,16 @@ class ui_controller_base; * UI View may have it's own show/hide transition styles. That means, it's available that views have different show/hide effects on demands. * It's not mandatory but view should describe the transitions in this class. * - * @warning When the transitions are finished, the view must to call ui_viewmgr_base :: _push_finished(), ui_viewmgr_base :: _pop_finished() in order that - * The ui_viewmgr_base keeps the view states exactly. + * @warning When the transitions are finished, the view must to call ui_viewmgr_interface :: _push_finished(), ui_viewmgr_interface :: _pop_finished() in order that + * The ui_viewmgr_interface keeps the view states exactly. * * @date 2016/01/15 * @author Hermet Park */ -class ui_view_base +class ui_view_interface { - friend class ui_viewmgr_base; - friend class ui_controller_base; + friend class ui_viewmgr_interface; + friend class ui_controller_interface; private: /// View state definition @@ -57,10 +59,10 @@ private: }; T content; ///< A content instance for a screen as a view. - ui_controller_base *controller; ///< View life-cycle controller interface. - std::string name; ///< View name - std::string style; ///< View style name. - ui_viewmgr_base *viewmgr; ///< Viewmgr which this view belongs to. + ui_controller_interface *controller; ///< View life-cycle controller interface. + string name; ///< View name + string style; ///< View style name. + ui_viewmgr_interface *viewmgr; ///< Viewmgr which this view belongs to. ui_view_state state; ///< View state ui_view_indicator indicator; ///< View indicator mode bool event_block; ///< State of event block. @@ -71,7 +73,7 @@ protected: /** @brief toggle event block * * @note This interface is designed for toggling touch event on view transition. - * ui_viewmgr_base will call this interface for notifying event blocking toggling on transition time. + * ui_viewmgr_interface will call this interface for notifying event blocking toggling on transition time. * * @param block @c true, when blocking is enabled, otherwise @c false. * @@ -80,57 +82,57 @@ protected: /** @brief view load state * - * @note this state will be triggered by ui_viewmgr_base + * @note this state will be triggered by ui_viewmgr_interface * - * @see ui_controller_base for this state in detail. + * @see ui_controller_interface for this state in detail. */ virtual void load(); /** @brief view unload state * - * @note this state will be triggered by ui_viewmgr_base + * @note this state will be triggered by ui_viewmgr_interface * - * @see ui_controller_base for this state in detail. + * @see ui_controller_interface for this state in detail. */ virtual void unload(); /** @brief view active state * - * @note this state will be triggered by ui_viewmgr_base + * @note this state will be triggered by ui_viewmgr_interface * - * @see ui_controller_base for this state in detail. + * @see ui_controller_interface for this state in detail. */ virtual void active(); /** @brief view inactive state * - * @note this state will be triggered by ui_viewmgr_base + * @note this state will be triggered by ui_viewmgr_interface * - * @see ui_controller_base for this state in detail. + * @see ui_controller_interface for this state in detail. */ virtual void inactive(); /** @brief view pause state * - * @note this state will be triggered by ui_viewmgr_base + * @note this state will be triggered by ui_viewmgr_interface * - * @see ui_controller_base for this state in detail. + * @see ui_controller_interface for this state in detail. */ virtual void pause(); /** @brief view resume state * - * @note this state will be triggered by ui_viewmgr_base + * @note this state will be triggered by ui_viewmgr_interface * - * @see ui_controller_base for this state in detail. + * @see ui_controller_interface for this state in detail. */ virtual void resume(); /** @brief view destroy state * - * @note this state will be triggered by ui_viewmgr_base + * @note this state will be triggered by ui_viewmgr_interface * - * @see ui_controller_base for this state in detail. + * @see ui_controller_interface for this state in detail. */ virtual void destroy(); @@ -143,13 +145,13 @@ protected: } /// Return a controller of this view. - const ui_controller_base* get_controller() + const ui_controller_interface* get_controller() { return this->controller; } /// Return a viewmgr which this view is belonging to - ui_viewmgr_base *get_viewmgr() + ui_viewmgr_interface *get_viewmgr() { return this->viewmgr; } @@ -159,10 +161,10 @@ protected: * @param controller a new controller. It allows @c NULL for canceling the previous controller. * @return A previous controller. If it wasn't, the return value will be @c NULL * - * @warning Be aware deletion of controller passed here will be taken cover by ui_view_base. - * If you want to keep the controller for any reasons, please unset it using set_controller() before ui_view_base is deleted. + * @warning Be aware deletion of controller passed here will be taken cover by ui_view_interface. + * If you want to keep the controller for any reasons, please unset it using set_controller() before ui_view_interface is deleted. */ - ui_controller_base* set_controller(ui_controller_base *controller); + ui_controller_interface* set_controller(ui_controller_interface *controller); public: /** @brief This is a constructor for initializing this view resources. @@ -171,17 +173,17 @@ public: * @param controller view life-cycle controller interface. * @param name view name. * - * @warning Be aware the deletion of controller passed here will be covered by ui_view_base. - * If you want to keep it for any reasons, please unset it using set_controller() before ui_view_base is deleted. + * @warning Be aware the deletion of controller passed here will be covered by ui_view_interface. + * If you want to keep it for any reasons, please unset it using set_controller() before ui_view_interface is deleted. */ - ui_view_base(T content, ui_controller_base *controller, const char *name); + ui_view_interface(T content, ui_controller_interface *controller, const char *name); ///Constructor for initializing with controller. - ui_view_base(ui_controller_base *controller, const char *name = NULL); + ui_view_interface(ui_controller_interface *controller, const char *name = NULL); ///Constructor for initializing with name. - ui_view_base(const char *name = NULL); + ui_view_interface(const char *name = NULL); ///Destructor for terminating view. - virtual ~ui_view_base(); + virtual ~ui_view_interface(); /** @brief This is for replacing or setting a content of the view. * @@ -253,4 +255,4 @@ public: } }; -#endif /* UI_VIEW_BASE_H_ */ +#endif /* UI_VIEW_INTERFACE_H_ */ diff --git a/src/interface/ui_viewmgr.h b/src/interface/ui_viewmanager_interface.h similarity index 78% rename from src/interface/ui_viewmgr.h rename to src/interface/ui_viewmanager_interface.h index cc56ba2..67fdd79 100644 --- a/src/interface/ui_viewmgr.h +++ b/src/interface/ui_viewmanager_interface.h @@ -14,8 +14,8 @@ * limitations under the License. * */ -#ifndef UI_VIEWMGR_H_ -#define UI_VIEWMGR_H_ +#ifndef UI_VIEWMANAGER_INTERFACE_H_ +#define UI_VIEWMANAGER_INTERFACE_H_ #include #include @@ -23,7 +23,7 @@ #ifdef LOG_TAG #undef LOG_TAG #endif -#define LOG_TAG "VIEWMGR" +#define LOG_TAG "UI_VIEWMGR" enum ui_view_indicator { @@ -34,9 +34,8 @@ enum ui_view_indicator UI_VIEW_INDICATOR_LAST }; -#include "ui_viewmgr_base.h" -#include "ui_view_base.h" -#include "ui_controller_base.h" +#include "ui_viewmgr_interface.h" +#include "ui_view_interface.h" +#include "ui_controller_interface.h" - -#endif /* UI_VIEWMGR_H */ +#endif /* UI_VIEWMANAGER_INTERFACE_H */ diff --git a/src/interface/ui_viewmgr_base.cpp b/src/interface/ui_viewmgr_interface.cpp similarity index 68% rename from src/interface/ui_viewmgr_base.cpp rename to src/interface/ui_viewmgr_interface.cpp index afc835d..392ab9a 100644 --- a/src/interface/ui_viewmgr_base.cpp +++ b/src/interface/ui_viewmgr_interface.cpp @@ -14,9 +14,9 @@ * limitations under the License. * */ -#include "ui_viewmgr.h" +#include "ui_viewmanager_interface.h" -bool ui_viewmgr_base::connect_view(ui_view_base *view) +bool ui_viewmgr_interface::connect_view(ui_view_interface *view) { if (view->viewmgr) { @@ -28,23 +28,23 @@ bool ui_viewmgr_base::connect_view(ui_view_base *view) return true; } -bool ui_viewmgr_base::disconnect_view(ui_view_base *view) +bool ui_viewmgr_interface::disconnect_view(ui_view_interface *view) { if (!view->viewmgr) return false; view->viewmgr = NULL; return true; } -void ui_viewmgr_base::set_event_block(ui_view_base *view, bool block) +void ui_viewmgr_interface::set_event_block(ui_view_interface *view, bool block) { if (!this->event_block) return; view->set_event_block(block); } -bool ui_viewmgr_base::push_view_finished(ui_view_base *view) +bool ui_viewmgr_interface::push_view_finished(ui_view_interface *view) { - ui_view_base *last = this->view_list.back(); + ui_view_interface *last = this->view_list.back(); //The previous view has been pushed. This should be unload. if (last != view) @@ -60,9 +60,9 @@ bool ui_viewmgr_base::push_view_finished(ui_view_base *view) return true; } -bool ui_viewmgr_base::pop_view_finished(ui_view_base *view) +bool ui_viewmgr_interface::pop_view_finished(ui_view_interface *view) { - ui_view_base *last = this->view_list.back(); + ui_view_interface *last = this->view_list.back(); //This view has been popped. It should be destroyed. if (last == view) @@ -80,7 +80,7 @@ bool ui_viewmgr_base::pop_view_finished(ui_view_base *view) return true; } -ui_viewmgr_base::ui_viewmgr_base() +ui_viewmgr_interface::ui_viewmgr_interface() : event_block(true), activated(false) { //FIXME: Read binary profile to decide whether support software back key or not. @@ -88,12 +88,12 @@ ui_viewmgr_base::ui_viewmgr_base() this->soft_back_key = true; } -ui_viewmgr_base::~ui_viewmgr_base() +ui_viewmgr_interface::~ui_viewmgr_interface() { //Terminate views - for (typename std::list::reverse_iterator it = this->view_list.rbegin(); it != this->view_list.rend(); it++) + for (typename std::list::reverse_iterator it = this->view_list.rbegin(); it != this->view_list.rend(); it++) { - ui_view_base *view = *it; + ui_view_interface *view = *it; view->inactive(); view->unload(); view->destroy(); @@ -104,8 +104,8 @@ ui_viewmgr_base::~ui_viewmgr_base() ui_app_exit(); } -ui_view_base * -ui_viewmgr_base::push_view(ui_view_base *view) +ui_view_interface * +ui_viewmgr_interface::push_view(ui_view_interface *view) { if (!view) { @@ -119,7 +119,7 @@ ui_viewmgr_base::push_view(ui_view_base *view) return NULL; } - ui_view_base *pview; + ui_view_interface *pview; //Previous view if (this->view_list.size()) @@ -145,7 +145,7 @@ ui_viewmgr_base::push_view(ui_view_base *view) return view; } -bool ui_viewmgr_base::pop_view() +bool ui_viewmgr_interface::pop_view() { //No more view? destroy viewmgr? if (this->get_view_count() == 0) @@ -157,7 +157,7 @@ bool ui_viewmgr_base::pop_view() if (this->get_view_count() == 1) { //destroy viewmgr? - ui_view_base *view = this->view_list.back(); + ui_view_interface *view = this->view_list.back(); view->inactive(); view->unload(); view->destroy(); @@ -167,7 +167,7 @@ bool ui_viewmgr_base::pop_view() } //last page to be popped. - ui_view_base *view = this->view_list.back(); + ui_view_interface *view = this->view_list.back(); view->inactive(); this->set_event_block(view, true); @@ -175,7 +175,7 @@ bool ui_viewmgr_base::pop_view() //Make this getter method? or define instance? //previous page to be current active. auto nx = std::prev(this->view_list.end(), 2); - ui_view_base *pview = *nx; + ui_view_interface *pview = *nx; pview->load(); pview->inactive(); this->set_event_block(pview, true); @@ -190,19 +190,19 @@ bool ui_viewmgr_base::pop_view() return true; } -bool ui_viewmgr_base::insert_view_before(ui_view_base *view, ui_view_base *before) +bool ui_viewmgr_interface::insert_view_before(ui_view_interface *view, ui_view_interface *before) { //TODO: ... return true; } -bool ui_viewmgr_base::insert_view_after(ui_view_base *view, ui_view_base *after) +bool ui_viewmgr_interface::insert_view_after(ui_view_interface *view, ui_view_interface *after) { //TODO: ... return true; } -bool ui_viewmgr_base::remove_view(ui_view_base *view) +bool ui_viewmgr_interface::remove_view(ui_view_interface *view) { this->view_list.remove(view); this->disconnect_view(view); @@ -211,24 +211,24 @@ bool ui_viewmgr_base::remove_view(ui_view_base *view) return true; } -ui_view_base* -ui_viewmgr_base::get_view(unsigned int idx) +ui_view_interface* +ui_viewmgr_interface::get_view(unsigned int idx) { if (idx < 0 || idx >= this->view_list.size()) { LOGE("Invalid idx(%d)! =? (idx range: %d ~ %d)", idx, 0, this->view_list.size() - 1); return NULL; } - typename std::list::iterator it = this->view_list.begin(); + typename std::list::iterator it = this->view_list.begin(); std::advance(it, idx); return *it; } -int ui_viewmgr_base::get_view_index(const ui_view_base *view) +int ui_viewmgr_interface::get_view_index(const ui_view_interface *view) { int idx = 0; - for (typename std::list::iterator it = this->view_list.begin(); it != this->view_list.end(); it++) + for (typename std::list::iterator it = this->view_list.begin(); it != this->view_list.end(); it++) { if (view == *it) return idx; ++idx; @@ -237,21 +237,21 @@ int ui_viewmgr_base::get_view_index(const ui_view_base *view) return -1; } -ui_view_base * -ui_viewmgr_base::get_last_view() +ui_view_interface * +ui_viewmgr_interface::get_last_view() { int cnt = this->get_view_count(); return this->get_view(cnt - 1); } -bool ui_viewmgr_base::activate() +bool ui_viewmgr_interface::activate() { if (this->activated) return false; this->activated = true; return true; } -bool ui_viewmgr_base::deactivate() +bool ui_viewmgr_interface::deactivate() { if (!this->activated) return false; this->activated = false; diff --git a/src/interface/ui_viewmgr_base.h b/src/interface/ui_viewmgr_interface.h similarity index 81% rename from src/interface/ui_viewmgr_base.h rename to src/interface/ui_viewmgr_interface.h index 9191c70..ed025fd 100644 --- a/src/interface/ui_viewmgr_base.h +++ b/src/interface/ui_viewmgr_interface.h @@ -14,17 +14,17 @@ * limitations under the License. * */ -#ifndef UI_WINDOW_BASE_H_ -#define UI_WINDOW_BASE_H_ +#ifndef UI_VIEWMGR_INTERFACE_H_ +#define UI_VIEWMGR_INTERFACE_H_ #include using namespace std; -class ui_view_base; +class ui_view_interface; /** - * @class ui_viewmgr_base + * @class ui_viewmgr_interface * * @ingroup ui_viewmgr * @@ -35,12 +35,12 @@ class ui_view_base; * @date 2016/01/29 * @author Hermet Park */ -class ui_viewmgr_base +class ui_viewmgr_interface { - friend class ui_view_base; + friend class ui_view_interface; private: - list view_list; //view list. + list view_list; //view list. bool event_block; //event block on view transition. This value should be configurable by system. bool activated; //activated status of this viewmgr. bool soft_back_key; //If system doesn't support HW back key, then this value is true. @@ -51,9 +51,9 @@ private: * @param view a view to connect to this viewmgr. * @return success or not. * - * @note This is s a friend function of ui_view_base + * @note This is s a friend function of ui_view_interface */ - bool connect_view(ui_view_base *view); + bool connect_view(ui_view_interface *view); /** * @brief unlink a given view from this viewmgr. @@ -61,9 +61,9 @@ private: * @param view a view to disconnect from this viewmgr. * @return @c true success or @c false not. * - * @note This is s a friend function of ui_view_base + * @note This is s a friend function of ui_view_interface */ - bool disconnect_view(ui_view_base *view); + bool disconnect_view(ui_view_interface *view); /** * @brief toggle event blocking to the given view. @@ -71,9 +71,9 @@ private: * @param view a view to toggle event blocking * @param block @c true is block event, otherwise @c false. * - * @note This is s a friend function of ui_view_base + * @note This is s a friend function of ui_view_interface */ - void set_event_block(ui_view_base *view, bool block); + void set_event_block(ui_view_interface *view, bool block); protected: /** @@ -83,9 +83,9 @@ protected: * @return @c true success or @c false not. * * @warning This function must be called definitely when push transition is finished. - * @note This is s a friend function of ui_view_base + * @note This is s a friend function of ui_view_interface */ - bool push_view_finished(ui_view_base *view); + bool push_view_finished(ui_view_interface *view); /** * @brief This function is designed for end of pop transition. @@ -94,16 +94,16 @@ protected: * @return @c true success or @c false not. * * @warning This function must be called definitely when push transition is finished. - * @note This is s a friend function of ui_view_base + * @note This is s a friend function of ui_view_interface */ - bool pop_view_finished(ui_view_base *view); + bool pop_view_finished(ui_view_interface *view); /** * @brief Return a list of views which this viewmgr has. * * @return a pointer of list of views. */ - const list* const get_view_list() + const list* const get_view_list() { return &this->view_list; } @@ -115,7 +115,7 @@ protected: * @note Normally, the current view will be hidden by a new view. * @return @c true on success, @c false otherwise. */ - ui_view_base *push_view(ui_view_base *view); + ui_view_interface *push_view(ui_view_interface *view); /** * @brief Pop the top view from the viewmgr stack. @@ -137,7 +137,7 @@ protected: * If you pass @c NULL, @c view will be inserted at the front of the view stack. * @return @c true success or @c false not. */ - bool insert_view_before(ui_view_base *view, ui_view_base *before); + bool insert_view_before(ui_view_interface *view, ui_view_interface *before); /** * @brief Insert a view into this viewmgr stack. Specially, right after of the given view, @after @@ -147,7 +147,7 @@ protected: * If you pass @c NULL, @c view will be inserted at the end of the view stack. * @return @c true success or @c false not. */ - bool insert_view_after(ui_view_base *view, ui_view_base *after); + bool insert_view_after(ui_view_interface *view, ui_view_interface *after); /** * @brief Remove the given view from this viewmgr stack. @@ -155,7 +155,7 @@ protected: * @return @c true on success or @c false if not. * */ - bool remove_view(ui_view_base *view); + bool remove_view(ui_view_interface *view); /** * @brief Return a stack index number of the given view. @@ -167,7 +167,7 @@ protected: * * @warning the index number is variable since the view stack size is also variable. */ - ui_view_base* get_view(unsigned int idx); + ui_view_interface* get_view(unsigned int idx); /** * @brief Return a view which is matched with the @c name. @@ -177,7 +177,7 @@ protected: * If there were no views name matched, @c NULL will be returned. * */ - ui_view_base *get_view(const char *name) + ui_view_interface *get_view(const char *name) { //FIXME: ... return NULL; @@ -192,7 +192,7 @@ protected: * * @warning the index number is variable since the view stack size is also variable. */ - int get_view_index(const ui_view_base *view); + int get_view_index(const ui_view_interface *view); //Activate a viewmgr. bool activate(); @@ -202,13 +202,13 @@ protected: public: ///Constructor. - ui_viewmgr_base(); + ui_viewmgr_interface(); ///Destructor. Delete all contained views. - virtual ~ui_viewmgr_base(); + virtual ~ui_viewmgr_interface(); //FIXME: Doc. - ui_view_base *get_last_view(); + ui_view_interface *get_last_view(); /** * @brief Return the number of views which this viewmgr has. @@ -245,4 +245,4 @@ public: }; -#endif /* UI_WINDOW_BASE_H_ */ +#endif /* UI_VIEWMGR_INTERFACE_H_ */ -- 2.7.4