From: Hermet Park Date: Fri, 25 Mar 2016 13:04:22 +0000 (+0900) Subject: refactoring page10, page11 X-Git-Tag: submit/tizen/20160617.075742~91 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F52%2F63752%2F2;p=platform%2Fcore%2Fuifw%2Fui-viewmgr.git refactoring page10, page11 rewrite for clean & nice code Change-Id: Ifd073bac2421c321d2ca197848b68599da72908d --- diff --git a/src/examples/efl/page10.h b/src/examples/efl/page10.h index 844a9e9..fbf48f1 100644 --- a/src/examples/efl/page10.h +++ b/src/examples/efl/page10.h @@ -32,56 +32,8 @@ public: { } - Evas_Object *create_page10_content(ui_view *view, bool is_portrait) - { - Evas_Object *content; - - if (is_portrait) - { - //Create portrait content. - content = create_content(view->get_base(), - "ViewMgr Demo
Page 10 With
on_portrait(), on_landscape()", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - appdata_s *ad = static_cast(data); - ad->viewmgr->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - appdata_s *ad = static_cast(data); - create_page11(ad); - }, - this->ad); - } - else - { - //Create landscape content. - content = create_landscape_content(view->get_base(), - "ViewMgr Demo
Page 10 With
on_portrait(), on_landscape()", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - appdata_s *ad = static_cast(data); - ad->viewmgr->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - appdata_s *ad = static_cast(data); - create_page11(ad); - }, - this->ad); - } - - return content; - } - void on_load() { - Evas_Object *content; - //Initialize contents. ui_view *view = dynamic_cast(this->get_view()); @@ -94,21 +46,41 @@ public: void on_portrait() { - Evas_Object *content; - ui_view *view = dynamic_cast(this->get_view()); - - content = this->create_page10_content(view, true); + Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo
Page 10 With
on_portrait(), on_landscape()", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + appdata_s *ad = static_cast(data); + ad->viewmgr->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + appdata_s *ad = static_cast(data); + create_page11(ad); + }, + this->ad); view->set_content(content, "Title Portrait"); } void on_landscape() { - Evas_Object *content; - ui_view *view = dynamic_cast(this->get_view()); - - content = this->create_page10_content(view, false); + Evas_Object *content = create_landscape_content(view->get_base(), "ViewMgr Demo
Page 10 With
on_portrait(), on_landscape()", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + appdata_s *ad = static_cast(data); + ad->viewmgr->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + appdata_s *ad = static_cast(data); + create_page11(ad); + }, + this->ad); view->set_content(content, "Title Landscape"); } diff --git a/src/examples/efl/page11.h b/src/examples/efl/page11.h index 115cf68..c0a1873 100644 --- a/src/examples/efl/page11.h +++ b/src/examples/efl/page11.h @@ -21,50 +21,6 @@ private: appdata_s *ad; protected: - Evas_Object *create_page11_content(bool is_portrait) - { - Evas_Object *content; - - if (is_portrait) - { - //Create portrait content. - content = create_content(this->get_base(), "ViewMgr Demo
Page 11 (View inheritance)
With on_rotate()", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - appdata_s *ad = static_cast(data); - ad->viewmgr->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - appdata_s *ad = static_cast(data); - ad->viewmgr->deactivate(); - }, - this->ad); - } - else - { - //Create landscape content. - content = create_landscape_content(this->get_base(), "ViewMgr Demo
Page 11 (View inheritance)
With on_rotate()", - //Prev Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - appdata_s *ad = static_cast(data); - ad->viewmgr->pop_view(); - }, - //Next Button Callback - [](void *data, Evas_Object *obj, void *event_info) -> void - { - appdata_s *ad = static_cast(data); - ad->viewmgr->deactivate(); - }, - this->ad); - } - - return content; - } - virtual void on_load() { this->on_rotate(this->get_degree()); @@ -72,16 +28,42 @@ protected: virtual void on_rotate(int degree) { - Evas_Object *content; - + //Portrait if (this->get_degree() == 0 || this->get_degree() == 180) { - content = this->create_page11_content(true); + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 11 (View inheritance)
With on_rotate()", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + appdata_s *ad = static_cast(data); + ad->viewmgr->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + appdata_s *ad = static_cast(data); + ad->viewmgr->deactivate(); + }, + this->ad); this->set_content(content, "Title Portrait"); } + //Landscape else { - content = this->create_page11_content(false); + Evas_Object *content = create_landscape_content(this->get_base(), "ViewMgr Demo
Page 11 (View inheritance)
With on_rotate()", + //Prev Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + appdata_s *ad = static_cast(data); + ad->viewmgr->pop_view(); + }, + //Next Button Callback + [](void *data, Evas_Object *obj, void *event_info) -> void + { + appdata_s *ad = static_cast(data); + ad->viewmgr->deactivate(); + }, + this->ad); this->set_content(content, "Title Landscape"); } }