From: Woochan Lee Date: Sat, 26 Mar 2016 09:25:58 +0000 (+0900) Subject: Refactoring examples, page 5,6,7,8 X-Git-Tag: submit/tizen/20160617.075742~85 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=929904c86a3392d083c6ec0c35b17ef46daa3b84;p=platform%2Fcore%2Fuifw%2Fui-viewmgr.git Refactoring examples, page 5,6,7,8 replace inheritance origin from ui_controller to ui_view. Change-Id: Ib0a81606ae6d594872710ffa20a1a705400fb4fa --- diff --git a/src/examples/efl/page5.h b/src/examples/efl/page5.h index 1527986..c30a8e5 100644 --- a/src/examples/efl/page5.h +++ b/src/examples/efl/page5.h @@ -14,33 +14,20 @@ * limitations under the License. * */ -class page5: public ui_controller + +/** This page inherit ui_base_view to show how to create full view. + * And set indicator state as hide. + */ +class page5: public ui_base_view { private: appdata_s *ad; -public: - page5(appdata_s *ad) - : ad(ad) - { - //No basic form. - /* ui_view(controller, identity name). - Later, you could get the identity name using view->get_name(); */ - ad->viewmgr->push_view(new ui_base_view(this, "page5")); - } - - ~page5() - { - } - +protected: void on_load() { - //Initialize contents. - - ui_base_view *view = dynamic_cast(this->get_view()); - //Create a main content. - Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo
Page 5
(Full View)", + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 5
(Full View)", //Prev Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { @@ -55,8 +42,18 @@ public: }, this->ad); - view->set_content(content); - view->set_indicator(UI_VIEW_INDICATOR_HIDE); + this->set_content(content); + this->set_indicator(UI_VIEW_INDICATOR_HIDE); + } + +public: + page5(appdata_s *ad) : ui_base_view("page5"), ad(ad) + { + ad->viewmgr->push_view(this); + } + + ~page5() + { } }; diff --git a/src/examples/efl/page6.h b/src/examples/efl/page6.h index 9d93864..a7faccd 100644 --- a/src/examples/efl/page6.h +++ b/src/examples/efl/page6.h @@ -14,33 +14,19 @@ * limitations under the License. * */ -class page6: public ui_controller + +/** This page inherit ui_view to show title with toolbar sample. + */ +class page6: public ui_view { private: appdata_s *ad; -public: - page6(appdata_s *ad) - : ad(ad) - { - /* ui_view(controller, identity name). - Later, you could get the identity name using view->get_name(); */ - ad->viewmgr->push_view(new ui_view(this, "page6")); - } - - ~page6() - { - } - +protected: void on_load() { - - //Initialize contents. - - ui_view *view = dynamic_cast(this->get_view()); - //Create a main content. - Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo
Page 6", + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 6", //Prev Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { @@ -56,13 +42,24 @@ public: this->ad); //Arguments: content, title - view->set_content(content, "Title with toolbar"); - Elm_Toolbar *toolbar = create_toolbar(view->get_base(), "toolbar_with_title"); - view->set_toolbar(toolbar); + this->set_content(content, "Title with toolbar"); + Elm_Toolbar *toolbar = create_toolbar(this->get_base(), "toolbar_with_title"); + this->set_toolbar(toolbar); + } + +public: + page6(appdata_s *ad) : ui_view("page6"), ad(ad) + { + ad->viewmgr->push_view(this); + } + + ~page6() + { } }; void create_page6(appdata_s *ad) { + /* A example for view class extension instead of using controller class. */ new page6(ad); } diff --git a/src/examples/efl/page7.h b/src/examples/efl/page7.h index 6012dfa..bdf013e 100644 --- a/src/examples/efl/page7.h +++ b/src/examples/efl/page7.h @@ -14,26 +14,24 @@ * limitations under the License. * */ -class page7: public ui_controller + +/** This page inherit ui_view to show title with toolbar sample. + * And this page make a content in page constructor time. + */ +class page7: public ui_view { private: appdata_s *ad; public: - page7(appdata_s *ad) - : ad(ad) + page7(appdata_s *ad) : ui_view("page7"), ad(ad) { - /* ui_view(controller, identity name, style name of view). - Later, you could get the identity name using view->get_name(); - you could get the style name of view as well */ - ui_view *view = new ui_view(this, "page7"); - //FIXME: It will be deleted or change to other way :( // We don't have any way to support it now. - view->set_viewmgr(ad->viewmgr); + this->set_viewmgr(ad->viewmgr); //Create a main content. - Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo
Page 7
(Navigationbar style)", + Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 7
(Navigationbar style)", //Prev Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { @@ -49,11 +47,11 @@ public: this->ad); //Don't delete view's content when this view poped. - view->set_removable_content(false); - view->set_content(content, "Title with toolbar"); - Elm_Toolbar *toolbar = create_toolbar(view->get_base(), "navigationbar"); - view->set_toolbar(toolbar); - ad->viewmgr->push_view(view); + this->set_removable_content(false); + this->set_content(content, "Title with toolbar"); + Elm_Toolbar *toolbar = create_toolbar(this->get_base(), "navigationbar"); + this->set_toolbar(toolbar); + ad->viewmgr->push_view(this); } ~page7() diff --git a/src/examples/efl/page8.h b/src/examples/efl/page8.h index 5ca8d55..37e1d77 100644 --- a/src/examples/efl/page8.h +++ b/src/examples/efl/page8.h @@ -15,16 +15,32 @@ * */ -class page8: public ui_view +/** This page inherit ui_controller to show view create in controller side. + */ +class page8: public ui_controller { private: appdata_s *ad; -protected: +public: + page8(appdata_s *ad) + : ad(ad) + { + /* ui_view(controller, identity name). + Later, you could get the identity name using view->get_name(); */ + ad->viewmgr->push_view(new ui_view(this, "page8")); + } + ~page8() + { + } + void on_load() { + //Initialize contents. + ui_view *view = dynamic_cast(this->get_view()); + //Create a main content. - Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo
Page 8
(View inheritance)", + Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo
Page 8", //Prev Button Callback [](void *data, Evas_Object *obj, void *event_info) -> void { @@ -39,23 +55,11 @@ protected: }, this->ad); - this->set_content(content, "Title"); - } - -public: - page8(const char *name, appdata_s *ad) - : ui_view(name), ad(ad) - { - ad->viewmgr->push_view(this); - } - - ~page8() - { + view->set_content(content, "Title"); } }; void create_page8(appdata_s *ad) { - /* A example for view class extension instead of using controller class. */ - new page8("page8", ad); + new page8(ad); }