From: Hermet Park Date: Tue, 22 Mar 2016 13:20:55 +0000 (+0900) Subject: rename state member functions. X-Git-Tag: submit/tizen/20160617.075742~105 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F01%2F63201%2F1;p=platform%2Fcore%2Fuifw%2Fui-viewmgr.git rename state member functions. load -> on_load unload -> on_unload active -> on_active inactive -> on_inactive destroy -> on_destroy pause -> on_pause resume -> on_resume back -> on_back menu -> on_menu rotate -> on_rotate landscape -> on_landscape portrait -> on_portrait Change-Id: I86e1e6146fd75645bd2f71407bd636b0d495144e --- diff --git a/src/examples/efl/page1.h b/src/examples/efl/page1.h index e8b15b5..ed26619 100644 --- a/src/examples/efl/page1.h +++ b/src/examples/efl/page1.h @@ -39,7 +39,7 @@ public: { } - void load() + void on_load() { //Initialize contents. @@ -67,7 +67,7 @@ public: view->set_content(content, "Title"); } - bool menu() + bool on_menu() { ui_basic_view *view = dynamic_cast(this->get_view()); @@ -87,17 +87,17 @@ public: return true; } - void rotate(int degree) + void on_rotate(int degree) { LOGE("Current view's degree is %d\n", degree); } - void portrait() + void on_portrait() { LOGE("View is on portrait mode\n"); } - void landscape() + void on_landscape() { LOGE("View is on landscape mode\n"); } diff --git a/src/examples/efl/page2.h b/src/examples/efl/page2.h index d36c313..b62f12f 100644 --- a/src/examples/efl/page2.h +++ b/src/examples/efl/page2.h @@ -32,7 +32,7 @@ public: { } - void load() + void on_load() { //Initialize contents. ui_basic_view *view = dynamic_cast(this->get_view()); diff --git a/src/examples/efl/page3.h b/src/examples/efl/page3.h index f2a29eb..7c705d4 100644 --- a/src/examples/efl/page3.h +++ b/src/examples/efl/page3.h @@ -32,7 +32,7 @@ public: { } - void load() + void on_load() { //Initialize contents. diff --git a/src/examples/efl/page4.h b/src/examples/efl/page4.h index 168202d..e92ef77 100644 --- a/src/examples/efl/page4.h +++ b/src/examples/efl/page4.h @@ -32,7 +32,7 @@ public: { } - void load() + void on_load() { //Initialize contents. diff --git a/src/examples/efl/page5.h b/src/examples/efl/page5.h index ca8c4f5..ff8931b 100644 --- a/src/examples/efl/page5.h +++ b/src/examples/efl/page5.h @@ -33,7 +33,7 @@ public: { } - void load() + void on_load() { //Initialize contents. diff --git a/src/examples/efl/page6.h b/src/examples/efl/page6.h index 6cc43ce..501ccd7 100644 --- a/src/examples/efl/page6.h +++ b/src/examples/efl/page6.h @@ -32,7 +32,7 @@ public: { } - void load() + void on_load() { //Initialize contents. diff --git a/src/examples/efl/page8.h b/src/examples/efl/page8.h index 61bdafc..afcc5ca 100644 --- a/src/examples/efl/page8.h +++ b/src/examples/efl/page8.h @@ -21,7 +21,7 @@ private: appdata_s *ad; protected: - virtual void load() + virtual void on_load() { //Create a main content. Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 8
(View inheritance lazy load)", diff --git a/src/include/efl/mobile/ui_basic_controller.h b/src/include/efl/mobile/ui_basic_controller.h index 7a1aafd..d3ca1db 100644 --- a/src/include/efl/mobile/ui_basic_controller.h +++ b/src/include/efl/mobile/ui_basic_controller.h @@ -25,7 +25,7 @@ class ui_basic_controller: public ui_controller { public: virtual ~ui_basic_controller(); - virtual bool menu(); + virtual bool on_menu(); }; } diff --git a/src/include/efl/mobile/ui_basic_view.h b/src/include/efl/mobile/ui_basic_view.h index 1db146f..3fff884 100644 --- a/src/include/efl/mobile/ui_basic_view.h +++ b/src/include/efl/mobile/ui_basic_view.h @@ -32,8 +32,8 @@ private: bool destroy_layout(); protected: - virtual void load(); - virtual void unload(); + virtual void on_load(); + virtual void on_unload(); virtual void unload_content(); virtual void set_event_block(bool block); @@ -53,7 +53,7 @@ public: bool set_menu(Evas_Object *menu); Evas_Object * unset_menu(); - virtual void menu(); + virtual void on_menu(); virtual Evas_Object *get_base() { diff --git a/src/include/efl/ui_controller.h b/src/include/efl/ui_controller.h index dcab8e5..2a28bbe 100644 --- a/src/include/efl/ui_controller.h +++ b/src/include/efl/ui_controller.h @@ -53,7 +53,7 @@ public: * @note Now, this view is moving onto the screen. Get ready for this view. If this view content is alive, load callback won't be called. * In the most cases, this callback will be triggered with this step load -> inactive -> active. */ - virtual void load() {} + virtual void on_load() {} /** @brief unload callback. * @@ -62,7 +62,7 @@ public: * If the view content is not alive, the unload won't be called. * In the most cases, this callback will be triggered with this step. inactive -> unload -> destroy */ - virtual void unload() {} + virtual void on_unload() {} /** @brief active callback. * @@ -70,7 +70,7 @@ public: * From whatever the state, if the view is on the screen, the active callback will be called. * In the most cases, this callback will be triggered with this step. load -> inactive -> active */ - virtual void active() {} + virtual void on_active() {} /** @brief inactive callback. * @@ -79,7 +79,7 @@ public: * In the most cases, when view is going to be popped or destroyed or pushed one more depth, the inactive state will be triggered. * Some UI controls such as a center popup or a menu popup blocks the view, this view may be inactive but still visible in someway (with transparency) */ - virtual void inactive() {} + virtual void on_inactive() {} /** @brief pause callback. * @@ -87,7 +87,7 @@ public: * When Window turns to deactivate. (@see ui_viewmgr_base :: deactivate()). * If the view were inactive or unload state, the pause won't be called. */ - virtual void pause() {} + virtual void on_pause() {} /** @brief resume callback. * @@ -95,13 +95,13 @@ public: * When the system allows the application turns to activate. * When the Window turns to activate. (@see ui_viewmgr_base :: activate()) */ - virtual void resume() {} + virtual void on_resume() {} /** @brief destroy callback. * * @note When this view is on destroying by popping or deleting. */ - virtual void destroy() {} + virtual void on_destroy() {} /** @brief Back key callback. * @@ -109,7 +109,7 @@ public: * that viewmgr is requested to poo the current view. * If you return false in the overriding, then popping will be stopped. */ - virtual bool back() { return true; } + virtual bool on_back() { return true; } /** @brief View rotate callback. * @@ -117,19 +117,19 @@ public: * * @note This method will be called when view rotation occurred. */ - virtual void rotate(int degree) {} + virtual void on_rotate(int degree) {} /** @brief Portrait callback. * * @note When current view is on portrait mode. */ - virtual void portrait() {} + virtual void on_portrait() {} /** @brief Landscape callback. * * @note When current view is on landscape mode. */ - virtual void landscape() {} + virtual void on_landscape() {} }; } diff --git a/src/include/efl/ui_view.h b/src/include/efl/ui_view.h index 66a7425..b8991a9 100644 --- a/src/include/efl/ui_view.h +++ b/src/include/efl/ui_view.h @@ -89,19 +89,19 @@ public: /** @brief This is for calling controller's back method. */ - virtual void back(); + virtual void on_back(); /** @brief This is for calling controller's rotate method. */ - virtual void rotate(int degree); + virtual void on_rotate(int degree); /** @brief This is for calling controller's portrait method. */ - virtual void portrait(); + virtual void on_portrait(); /** @brief This is for calling controller's landscape method. */ - virtual void landscape(); + virtual void on_landscape(); /** @brief Set the indicator mode. * * @param indicator The mode to set, one of #ui_view_indicator. diff --git a/src/include/interface/ui_iface_controller.h b/src/include/interface/ui_iface_controller.h index e854c01..a2e6199 100644 --- a/src/include/interface/ui_iface_controller.h +++ b/src/include/interface/ui_iface_controller.h @@ -71,7 +71,7 @@ public: * @note Now, this view is moving onto the screen. Get ready for this view. If this view content is alive, load callback won't be called. * In the most cases, this callback will be triggered with this step load -> inactive -> active. */ - virtual void load() = 0; + virtual void on_load() = 0; /** @brief unload callback. * @@ -80,7 +80,7 @@ public: * If the view content is not alive, the unload won't be called. * In the most cases, this callback will be triggered with this step. inactive -> unload -> destroy */ - virtual void unload() = 0; + virtual void on_unload() = 0; /** @brief active callback. * @@ -88,7 +88,7 @@ public: * From whatever the state, if the view is on the screen, the active callback will be called. * In the most cases, this callback will be triggered with this step. load -> inactive -> active */ - virtual void active() = 0; + virtual void on_active() = 0; /** @brief inactive callback. * @@ -97,7 +97,7 @@ public: * In the most cases, when view is going to be popped or destroyed or pushed one more depth, the inactive state will be triggered. * Some UI controls such as a center popup or a menu popup blocks the view, this view may be inactive but still visible in someway (with transparency) */ - virtual void inactive() = 0; + virtual void on_inactive() = 0; /** @brief pause callback. * @@ -105,7 +105,7 @@ public: * When Window turns to deactivate. (@see ui_viewmgr_base :: deactivate()). * If the view were inactive or unload state, the pause won't be called. */ - virtual void pause() = 0; + virtual void on_pause() = 0; /** @brief resume callback. * @@ -113,13 +113,13 @@ public: * When the system allows the application turns to activate. * When the Window turns to activate. (@see ui_viewmgr_base :: activate()) */ - virtual void resume() = 0; + virtual void on_resume() = 0; /** @brief destroy callback. * * @note When this view is on destroying by popping or deleting. */ - virtual void destroy() = 0; + virtual void on_destroy() = 0; /** @brief Back key callback. * @@ -127,7 +127,7 @@ public: * that viewmgr is requested to poo the current view. * If you return false in the overriding, then popping will be stopped. */ - virtual bool back() = 0; + virtual bool on_back() = 0; /** @brief View rotate callback. * @@ -135,19 +135,19 @@ public: * * @note This method will be called when view rotation occurred. */ - virtual void rotate(int degree) = 0; + virtual void on_rotate(int degree) = 0; /** @brief Portrait callback. * * @note When current view is on portrait mode. */ - virtual void portrait() = 0; + virtual void on_portrait() = 0; /** @brief Landscape callback. * * @note When current view is on landscape mode. */ - virtual void landscape() = 0; + virtual void on_landscape() = 0; }; } diff --git a/src/include/interface/ui_iface_view.h b/src/include/interface/ui_iface_view.h index e063a0e..b745e49 100644 --- a/src/include/interface/ui_iface_view.h +++ b/src/include/interface/ui_iface_view.h @@ -85,7 +85,7 @@ protected: * * @see ui_iface_controller for this state in detail. */ - virtual void load(); + virtual void on_load(); /** @brief view unload state. * @@ -93,7 +93,7 @@ protected: * * @see ui_iface_controller for this state in detail. */ - virtual void unload(); + virtual void on_unload(); /** @brief view active state. * @@ -101,7 +101,7 @@ protected: * * @see ui_iface_controller for this state in detail. */ - virtual void active(); + virtual void on_active(); /** @brief view inactive state. * @@ -109,7 +109,7 @@ protected: * * @see ui_iface_controller for this state in detail. */ - virtual void inactive(); + virtual void on_inactive(); /** @brief view pause state. * @@ -117,7 +117,7 @@ protected: * * @see ui_iface_controller for this state in detail. */ - virtual void pause(); + virtual void on_pause(); /** @brief view resume state. * @@ -125,7 +125,7 @@ protected: * * @see ui_iface_controller for this state in detail. */ - virtual void resume(); + virtual void on_resume(); /** @brief view destroy state. * @@ -133,7 +133,7 @@ protected: * * @see ui_iface_controller for this state in detail. */ - virtual void destroy(); + virtual void on_destroy(); //Make this view's content as NULL, then destroy content. virtual void unload_content() = 0; diff --git a/src/lib/efl/mobile/ui_basic_controller.cpp b/src/lib/efl/mobile/ui_basic_controller.cpp index dc7654a..9a0d680 100644 --- a/src/lib/efl/mobile/ui_basic_controller.cpp +++ b/src/lib/efl/mobile/ui_basic_controller.cpp @@ -23,7 +23,7 @@ ui_basic_controller::~ui_basic_controller() { } -bool ui_basic_controller::menu() +bool ui_basic_controller::on_menu() { return true; } diff --git a/src/lib/efl/mobile/ui_basic_key_listener.cpp b/src/lib/efl/mobile/ui_basic_key_listener.cpp index c629c9d..8509f33 100644 --- a/src/lib/efl/mobile/ui_basic_key_listener.cpp +++ b/src/lib/efl/mobile/ui_basic_key_listener.cpp @@ -30,7 +30,7 @@ ui_basic_key_listener::ui_basic_key_listener(ui_viewmgr *viewmgr) void ui_basic_key_listener::extend_event_proc(ui_view *view, Evas_Event_Key_Down *ev) { if (strcmp(ev->keyname, KEY_MENU) && strcmp(ev->keyname, KEY_MENU2)) return; - dynamic_cast(view)->menu(); + dynamic_cast(view)->on_menu(); } bool ui_basic_key_listener::init() diff --git a/src/lib/efl/mobile/ui_basic_view.cpp b/src/lib/efl/mobile/ui_basic_view.cpp index bd1154a..4215e34 100644 --- a/src/lib/efl/mobile/ui_basic_view.cpp +++ b/src/lib/efl/mobile/ui_basic_view.cpp @@ -150,15 +150,15 @@ ui_basic_view::~ui_basic_view() destroy_layout(); } -void ui_basic_view::load() +void ui_basic_view::on_load() { if (!this->layout) this->create_layout(); - ui_view::load(); + ui_view::on_load(); } -void ui_basic_view::unload() +void ui_basic_view::on_unload() { - ui_view::unload(); + ui_view::on_unload(); } Evas_Object * @@ -353,7 +353,7 @@ void ui_basic_view::unload_content() this->destroy_layout(); } -void ui_basic_view::menu() +void ui_basic_view::on_menu() { if (this->ctxpopup && evas_object_visible_get(this->ctxpopup)) { @@ -363,7 +363,7 @@ void ui_basic_view::menu() if (this->get_controller()) { - (dynamic_cast(this->get_controller()))->menu(); + (dynamic_cast(this->get_controller()))->on_menu(); } if (this->ctxpopup) diff --git a/src/lib/efl/ui_key_listener.cpp b/src/lib/efl/ui_key_listener.cpp index c64350f..e808964 100644 --- a/src/lib/efl/ui_key_listener.cpp +++ b/src/lib/efl/ui_key_listener.cpp @@ -42,7 +42,7 @@ static void event_proc(ui_key_listener *key_listener, Evas_Event_Key_Down *ev) if (strcmp(ev->keyname, KEY_BACK) && strcmp(ev->keyname, KEY_BACK2)) return; - view->back(); + view->on_back(); } bool ui_key_listener::term() diff --git a/src/lib/efl/ui_view.cpp b/src/lib/efl/ui_view.cpp index b547925..924e8dd 100644 --- a/src/lib/efl/ui_view.cpp +++ b/src/lib/efl/ui_view.cpp @@ -81,11 +81,11 @@ void ui_view::set_indicator(ui_view_indicator indicator) viewmgr->set_indicator(indicator); } -void ui_view::back() +void ui_view::on_back() { if (this->get_controller()) { - if (!dynamic_cast(this->get_controller())->back()) + if (!dynamic_cast(this->get_controller())->on_back()) { return; } @@ -93,27 +93,27 @@ void ui_view::back() dynamic_cast(this->get_viewmgr())->pop_view(); } -void ui_view::rotate(int degree) +void ui_view::on_rotate(int degree) { if (this->get_controller()) { - dynamic_cast(this->get_controller())->rotate(degree); + dynamic_cast(this->get_controller())->on_rotate(degree); } } -void ui_view::portrait() +void ui_view::on_portrait() { if (this->get_controller()) { - dynamic_cast(this->get_controller())->portrait(); + dynamic_cast(this->get_controller())->on_portrait(); } } -void ui_view::landscape() +void ui_view::on_landscape() { if (this->get_controller()) { - dynamic_cast(this->get_controller())->landscape(); + dynamic_cast(this->get_controller())->on_landscape(); } } void ui_view::set_event_block(bool block) diff --git a/src/lib/efl/ui_viewmgr.cpp b/src/lib/efl/ui_viewmgr.cpp index fe954f9..6c66fde 100644 --- a/src/lib/efl/ui_viewmgr.cpp +++ b/src/lib/efl/ui_viewmgr.cpp @@ -203,11 +203,11 @@ ui_viewmgr::ui_viewmgr(const char *pkg, ui_key_listener *key_listener) ui_viewmgr *viewmgr = static_cast(data); ui_view *view = viewmgr->get_last_view(); - view->rotate(rot); + view->on_rotate(rot); //FIXME: Change this configurable? - if (rot == 0 || rot == 180) view->portrait(); - else view->landscape(); + if (rot == 0 || rot == 180) view->on_portrait(); + else view->on_landscape(); } , this); @@ -263,7 +263,7 @@ bool ui_viewmgr::activate() //FIXME: Necessary?? ui_view *view = this->get_last_view(); - view->active(); + view->on_active(); evas_object_show(this->win); @@ -278,7 +278,7 @@ bool ui_viewmgr::deactivate() if (true) { ui_view *view = this->get_last_view(); - if (view) view->inactive(); + if (view) view->on_inactive(); evas_object_lower(this->win); } else diff --git a/src/lib/interface/ui_iface_view.cpp b/src/lib/interface/ui_iface_view.cpp index 67c7112..6b0fe5a 100644 --- a/src/lib/interface/ui_iface_view.cpp +++ b/src/lib/interface/ui_iface_view.cpp @@ -23,15 +23,15 @@ void ui_iface_view::set_event_block(bool block) this->event_block = block; } -void ui_iface_view::load() +void ui_iface_view::on_load() { this->state = UI_VIEW_STATE_LOAD; if (this->content) return; if (!this->controller) return; - this->controller->load(); + this->controller->on_load(); } -void ui_iface_view::unload() +void ui_iface_view::on_unload() { this->state = UI_VIEW_STATE_UNLOAD; if (this->get_removable_content()) @@ -41,45 +41,45 @@ void ui_iface_view::unload() } if (!this->content) return; if (!this->controller) return; - this->controller->unload(); + this->controller->on_unload(); } -void ui_iface_view::active() +void ui_iface_view::on_active() { this->state = UI_VIEW_STATE_ACTIVE; if (!this->controller) return; - this->controller->active(); + this->controller->on_active(); } -void ui_iface_view::inactive() +void ui_iface_view::on_inactive() { this->state = UI_VIEW_STATE_INACTIVE; if (!this->controller) return; - this->controller->inactive(); + this->controller->on_inactive(); } -void ui_iface_view::pause() +void ui_iface_view::on_pause() { this->state = UI_VIEW_STATE_PAUSE; if (!this->content) return; if (state != UI_VIEW_STATE_ACTIVE) return; if (!this->controller) return; - this->controller->pause(); + this->controller->on_pause(); } -void ui_iface_view::resume() +void ui_iface_view::on_resume() { this->state = UI_VIEW_STATE_ACTIVE; if (state != UI_VIEW_STATE_PAUSE) return; if (!this->content) return; if (!this->controller) return; - this->controller->resume(); + this->controller->on_resume(); } -void ui_iface_view::destroy() +void ui_iface_view::on_destroy() { if (!this->controller) return; - this->controller->destroy(); + this->controller->on_destroy(); } ui_iface_view::ui_iface_view(ui_iface_controller *controller, const char *name) diff --git a/src/lib/interface/ui_iface_viewmgr.cpp b/src/lib/interface/ui_iface_viewmgr.cpp index 5df0e2e..f808004 100644 --- a/src/lib/interface/ui_iface_viewmgr.cpp +++ b/src/lib/interface/ui_iface_viewmgr.cpp @@ -63,12 +63,12 @@ bool ui_iface_viewmgr::push_view_finished(ui_iface_view *view) //The previous view has been pushed. This should be unload. if (last != view) { - view->unload(); + view->on_unload(); return true; } //A new view has been pushed. This should be active. - view->active(); + view->on_active(); this->set_event_block(view, false); return true; @@ -81,14 +81,14 @@ bool ui_iface_viewmgr::pop_view_finished(ui_iface_view *view) //This view has been popped. It should be destroyed. if (last == view) { - view->unload(); - view->destroy(); + view->on_unload(); + view->on_destroy(); delete (view); return true; } //The previous view has been popped. It should become active. - view->active(); + view->on_active(); this->set_event_block(view, false); return true; @@ -105,9 +105,9 @@ ui_iface_viewmgr::~ui_iface_viewmgr() for (typename std::list::reverse_iterator it = this->view_list.rbegin(); it != this->view_list.rend(); it++) { ui_iface_view *view = *it; - view->inactive(); - view->unload(); - view->destroy(); + view->on_inactive(); + view->on_unload(); + view->on_destroy(); delete (view); } @@ -136,7 +136,7 @@ ui_iface_viewmgr::push_view(ui_iface_view *view) if (this->view_list.size() > 0) { pview = this->view_list.back(); - pview->inactive(); + pview->on_inactive(); this->set_event_block(pview, true); } @@ -144,10 +144,10 @@ ui_iface_viewmgr::push_view(ui_iface_view *view) if (!view->get_content()) { - view->load(); + view->on_load(); } - view->inactive(); + view->on_inactive(); //FIXME: First view has no effect? if (this->view_list.size() != 1) this->set_event_block(view, true); @@ -169,9 +169,9 @@ bool ui_iface_viewmgr::pop_view() { //destroy viewmgr? ui_iface_view *view = this->view_list.back(); - view->inactive(); - view->unload(); - view->destroy(); + view->on_inactive(); + view->on_unload(); + view->on_destroy(); delete(view); return true; @@ -179,7 +179,7 @@ bool ui_iface_viewmgr::pop_view() //last page to be popped. ui_iface_view *view = this->view_list.back(); - view->inactive(); + view->on_inactive(); this->set_event_block(view, true); //Below object has to be used in child class... @@ -187,8 +187,8 @@ bool ui_iface_viewmgr::pop_view() //previous page to be current active. auto nx = std::prev(this->view_list.end(), 2); ui_iface_view *pview = *nx; - pview->load(); - pview->inactive(); + pview->on_load(); + pview->on_inactive(); this->set_event_block(pview, true); return true;