reorganize examples. 55/63755/2
authorHermet Park <hermet@hermet.pe.kr>
Fri, 25 Mar 2016 13:26:20 +0000 (22:26 +0900)
committerHermet Park <hermet@hermet.pe.kr>
Fri, 25 Mar 2016 13:27:45 +0000 (22:27 +0900)
move menu popup example from page1 to page12.
remove unnecessary virtual keywords from member functions.
change content texts for consistency..

Change-Id: I3ed108db4c183631f3267e16e32f56df6d82e7b7

src/examples/efl/main.cpp
src/examples/efl/page1.h
src/examples/efl/page10.h
src/examples/efl/page11.h
src/examples/efl/page12.h [new file with mode: 0644]
src/examples/efl/page8.h
src/examples/efl/page9.h
src/lib/interface/ui_iface_viewmgr.cpp

index 9e53ce8e2c68d26e482d600db3cf7ab5bf614fa0..37c74aaf6ee353673de113767e3d18c057ff5f12 100644 (file)
@@ -15,6 +15,7 @@
  *
  */
 #include "main.h"
+#include "page12.h"
 #include "page11.h"
 #include "page10.h"
 #include "page9.h"
index f31c8600db6e9f3f8bc7b4e37c0956f7ddfc36cd..c352516e00a0af5131096bdb299aae45b54ce286 100644 (file)
  *  limitations under the License.
  *
  */
-static void ctxpopup_item_select_cb(void *data, Evas_Object *obj, void *event_info)
-{
-       ui_view *view = static_cast<ui_view *>(data);
-       Elm_Object_Item *it = static_cast<Elm_Object_Item *>(event_info);
-       elm_ctxpopup_dismiss(obj);
-       LOGE("Item (%s) is selected", elm_object_item_text_get(it));
-}
-
 class page1: public ui_controller
 {
 private:
@@ -42,12 +34,8 @@ public:
        void on_load()
        {
                //Initialize contents.
-
                ui_view *view = dynamic_cast<ui_view *>(this->get_view());
 
-               //Check the current rotation for set portrait or landscape content if any.
-               LOGE("view 1 load rotation = %d\n", view->get_degree());
-
                //Create a main content.
                Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 1",
                                //Prev Button Callback
@@ -66,37 +54,6 @@ public:
 
                view->set_content(content, "Title");
        }
-
-       void on_menu(ui_menu *menu)
-       {
-               Elm_Ctxpopup *ctxpopup = elm_ctxpopup_add(menu->get_base());
-               elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, this);
-               elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, this);
-               elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, this);
-               elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, this);
-               elm_ctxpopup_item_append(ctxpopup, "Add contact", NULL, ctxpopup_item_select_cb, this);
-               elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, this);
-               elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, this);
-               elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, this);
-               elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, this);
-
-               menu->set_content(ctxpopup);
-       }
-
-       void on_rotate(int degree)
-       {
-               LOGE("Current view's degree is %d\n", degree);
-       }
-
-       void on_portrait()
-       {
-               LOGE("View is on portrait mode\n");
-       }
-
-       void on_landscape()
-       {
-               LOGE("View is on landscape mode\n");
-       }
 };
 
 void create_page1(appdata_s *ad)
index fbf48f1ed7fa369cf04951543a4e11c58b31949e..a3fca1c2778ceaea4829d5f1ecbda2ed60279bd5 100644 (file)
@@ -47,7 +47,7 @@ public:
        void on_portrait()
        {
                ui_view *view = dynamic_cast<ui_view *>(this->get_view());
-               Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 10 With<br>on_portrait(), on_landscape()",
+               Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 10<br>(Portrait + Landscape)",
                                                                //Prev Button Callback
                                                        [](void *data, Evas_Object *obj, void *event_info) -> void
                                                        {
@@ -61,13 +61,13 @@ public:
                                                                create_page11(ad);
                                                        },
                                                        this->ad);
-               view->set_content(content, "Title Portrait");
+               view->set_content(content, "Title");
        }
 
        void on_landscape()
        {
                ui_view *view = dynamic_cast<ui_view *>(this->get_view());
-               Evas_Object *content = create_landscape_content(view->get_base(), "ViewMgr Demo<br>Page 10 With<br>on_portrait(), on_landscape()",
+               Evas_Object *content = create_landscape_content(view->get_base(), "ViewMgr Demo<br>Page 10<br>(Portrait + Landscape)",
                                //Prev Button Callback
                        [](void *data, Evas_Object *obj, void *event_info) -> void
                        {
@@ -81,7 +81,7 @@ public:
                                create_page11(ad);
                        },
                        this->ad);
-               view->set_content(content, "Title Landscape");
+               view->set_content(content, "Title");
        }
 
 };
index c0a1873e707120ed39f933dd45d5aa17d7ea1aee..4bb95cafe7a902e7e07df158f99677136821a016 100644 (file)
@@ -21,17 +21,17 @@ private:
        appdata_s *ad;
 
 protected:
-       virtual void on_load()
+       void on_load()
        {
                this->on_rotate(this->get_degree());
        }
 
-       virtual void on_rotate(int degree)
+       void on_rotate(int degree)
        {
                //Portrait
                if (this->get_degree() == 0 || this->get_degree() == 180)
                {
-                       Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Page 11 (View inheritance)<br>With on_rotate()",
+                       Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Page 11<br>(Rotate)",
                                        //Prev Button Callback
                                [](void *data, Evas_Object *obj, void *event_info) -> void
                                {
@@ -42,7 +42,7 @@ protected:
                                [](void *data, Evas_Object *obj, void *event_info) -> void
                                {
                                        appdata_s *ad = static_cast<appdata_s *>(data);
-                                               ad->viewmgr->deactivate();
+                                       create_page12(ad);
                                },
                                this->ad);
                        this->set_content(content, "Title Portrait");
@@ -50,7 +50,7 @@ protected:
                //Landscape
                else
                {
-                       Evas_Object *content = create_landscape_content(this->get_base(), "ViewMgr Demo<br>Page 11 (View inheritance)<br>With on_rotate()",
+                       Evas_Object *content = create_landscape_content(this->get_base(), "ViewMgr Demo<br>Page 11<br>(Rotate)",
                                        //Prev Button Callback
                                [](void *data, Evas_Object *obj, void *event_info) -> void
                                {
@@ -61,7 +61,7 @@ protected:
                                [](void *data, Evas_Object *obj, void *event_info) -> void
                                {
                                        appdata_s *ad = static_cast<appdata_s *>(data);
-                                               ad->viewmgr->deactivate();
+                                       create_page12(ad);
                                },
                                this->ad);
                        this->set_content(content, "Title Landscape");
diff --git a/src/examples/efl/page12.h b/src/examples/efl/page12.h
new file mode 100644 (file)
index 0000000..548fa8b
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *               http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+static void ctxpopup_item_select_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       ui_view *view = static_cast<ui_view *>(data);
+       Elm_Object_Item *it = static_cast<Elm_Object_Item *>(event_info);
+       elm_ctxpopup_dismiss(obj);
+       LOGE("Item (%s) is selected", elm_object_item_text_get(it));
+}
+
+class page12: public ui_controller
+{
+private:
+       appdata_s *ad;
+
+protected:
+       void on_load()
+       {
+               //Initialize contents.
+               ui_view *view = dynamic_cast<ui_view *>(this->get_view());
+
+               //Create a main content.
+               Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 12<br>(Menu Popup)",
+                               //Prev Button Callback
+                               [](void *data, Evas_Object *obj, void *event_info) -> void
+                               {
+                                       appdata_s *ad = static_cast<appdata_s *>(data);
+                                       ad->viewmgr->deactivate();
+                               },
+                               //Next Button Callback
+                               [](void *data, Evas_Object *obj, void *event_info) -> void
+                               {
+                                       appdata_s *ad = static_cast<appdata_s *>(data);
+                                       ad->viewmgr->deactivate();
+                               },
+                               this->ad);
+
+               view->set_content(content, "Title");
+       }
+
+public:
+       page12(appdata_s *ad)
+                       : ad(ad)
+       {
+               ad->viewmgr->push_view(new ui_view(this, "page12"));
+       }
+
+       ~page12()
+       {
+       }
+
+       void on_menu(ui_menu *menu)
+       {
+               Elm_Ctxpopup *ctxpopup = elm_ctxpopup_add(menu->get_base());
+               elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, this);
+               elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, this);
+               elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, this);
+               elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, this);
+               elm_ctxpopup_item_append(ctxpopup, "Add contact", NULL, ctxpopup_item_select_cb, this);
+               elm_ctxpopup_item_append(ctxpopup, "Phone calls", NULL, ctxpopup_item_select_cb, this);
+               elm_ctxpopup_item_append(ctxpopup, "Favorites", NULL, ctxpopup_item_select_cb, this);
+               elm_ctxpopup_item_append(ctxpopup, "Search", NULL, ctxpopup_item_select_cb, this);
+               elm_ctxpopup_item_append(ctxpopup, "Dialer", NULL, ctxpopup_item_select_cb, this);
+
+               menu->set_content(ctxpopup);
+       }
+};
+
+void create_page12(appdata_s *ad)
+{
+       /* A example for view class extension instead of using controller class. */
+       new page12(ad);
+}
index ed07c65dcf7c05adf35ee4ea3017e0b57ca1ea33..5ca8d55ffa924927720019267f9dc80c2958e358 100644 (file)
@@ -21,10 +21,10 @@ private:
        appdata_s *ad;
 
 protected:
-       virtual void on_load()
+       void on_load()
        {
                //Create a main content.
-               Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Page 8<br>(View inheritance lazy load)",
+               Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Page 8<br>(View inheritance)",
                                //Prev Button Callback
                                [](void *data, Evas_Object *obj, void *event_info) -> void
                                {
index f07b62cb1640f8bb7c21f014253845f132a5c7e3..530591f3a10c4027f1f3e3e409157b4cae381f29 100644 (file)
@@ -28,7 +28,7 @@ public:
                this->set_viewmgr(ad->viewmgr);
 
                //Create a main content.
-               Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Page 9<br>(View inheritance)",
+               Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Page 9<br>(Content Preloading)",
                        //Prev Button Callback
                        [](void *data, Evas_Object *obj, void *event_info) -> void
                        {
index c2dc9ef7e5824bf97ed9ac43a3bfad154e7035b9..486884972a54ae65808a5a54e81c81b22c534a67 100644 (file)
@@ -184,7 +184,7 @@ bool ui_iface_viewmgr::pop_view()
 
        //Below object has to be used in child class...
        //Make this getter method? or define instance?
-       //previous page is to be active page.
+       //previous page is to be an active page.
        auto nx = std::prev(this->view_list.end(), 2);
        ui_iface_view *pview = *nx;
        pview->on_load();