updated implementation. 77/59777/1
authorHermet Park <hermet@hermet.pe.kr>
Thu, 18 Feb 2016 10:37:42 +0000 (19:37 +0900)
committerHermet Park <hermet@hermet.pe.kr>
Thu, 18 Feb 2016 10:37:42 +0000 (19:37 +0900)
reorganize folder hierarchy for view manager.

Change-Id: I1b1a88f6a71c4262eea4fc97f88d4e1d826732fb

27 files changed:
CMakeLists.txt
inc/main.h
src/app_controller.h [deleted file]
src/efl/efl_viewmgr.h [new file with mode: 0644]
src/efl/mobile/efl_viewmgr.h [new file with mode: 0644]
src/efl/mobile/ui_basic_view.cpp [moved from src/ui_basic_view.cpp with 93% similarity]
src/efl/mobile/ui_basic_view.h [moved from src/ui_basic_view.h with 97% similarity]
src/efl/ui_controller.cpp [moved from src/ui_controller.cpp with 73% similarity]
src/efl/ui_controller.h [new file with mode: 0644]
src/efl/ui_view.cpp [moved from src/ui_view.cpp with 88% similarity]
src/efl/ui_view.h [moved from src/ui_view.h with 92% similarity]
src/efl/ui_viewmgr.cpp [moved from src/ui_viewmgr.cpp with 96% similarity]
src/efl/ui_viewmgr.h [moved from src/ui_viewmgr.h with 66% similarity]
src/efl_viewmgr.h [deleted file]
src/interface/ui_controller_base.cpp [moved from src/ui_controller_base.cpp with 60% similarity]
src/interface/ui_controller_base.h [moved from src/ui_controller_base.h with 98% similarity]
src/interface/ui_view_base.cpp [moved from src/ui_view_base.cpp with 96% similarity]
src/interface/ui_view_base.h [moved from src/ui_view_base.h with 99% similarity]
src/interface/ui_viewmgr.h [new file with mode: 0644]
src/interface/ui_viewmgr_base.cpp [moved from src/ui_viewmgr_base.cpp with 96% similarity]
src/interface/ui_viewmgr_base.h [moved from src/ui_viewmgr_base.h with 98% similarity]
src/main.cpp
src/page1_controller.h [new file with mode: 0644]
src/page2_controller.h [new file with mode: 0644]
src/page3_controller.h [new file with mode: 0644]
src/page4_controller.h [new file with mode: 0644]
src/ui_controller.h [deleted file]

index 985d7ae..f25fd7c 100644 (file)
@@ -3,15 +3,15 @@ PROJECT(ui-viewmgr)
 SET(PACKAGE org.tizen.ui-viewmgr)
 
 SET(SRCS
-    src/ui_controller.cpp
-    src/ui_view.cpp
-    src/ui_viewmgr.cpp
-    src/ui_controller_base.cpp
-       src/ui_view_base.cpp
-    src/ui_viewmgr_base.cpp
-       src/ui_basic_view.cpp
-       src/main.cpp
-       )
+       src/efl/ui_controller.cpp
+       src/efl/ui_view.cpp
+       src/efl/ui_viewmgr.cpp
+       src/interface/ui_controller_base.cpp
+       src/interface/ui_view_base.cpp
+       src/interface/ui_viewmgr_base.cpp
+       src/efl/mobile/ui_basic_view.cpp
+       src/main.cpp
+   )
 
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/inc)
 
index 6052e48..4cf5095 100644 (file)
@@ -18,7 +18,7 @@
 #include <system_settings.h>
 #include <dlog.h>
 #include <efl_extension.h>
-#include "../src/efl_viewmgr.h"
+#include "../src/efl/mobile/efl_viewmgr.h"
 
 //uncomment if you want debug
 #ifndef TIZEN_ENGINEER_MODE
 #endif
 #define LOG_TAG "VIEWMGR"
 
-
 #if !defined(PACKAGE)
 #define PACKAGE "org.tizen.ui-viewmgr"
 #endif
 
-
-#define ELM_DEMO_EDJ "/opt/usr/apps/org.tizen.ui-viewmgr/res/ui-viewmgr.edj"
-
+using namespace efl;
 
 typedef struct appdata {
        ui_viewmgr *viewmgr;
 } appdata_s;
 
-void view_cb(void *data, Evas_Object *obj, void *event_info);
+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);
diff --git a/src/app_controller.h b/src/app_controller.h
deleted file mode 100644 (file)
index 80c8d44..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-#include "ui_controller.h"
-
-static 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)
-{
-       Evas_Object *grid, *box, *layout, *scroller, *btn, *button_layout;
-
-       /* Scroller */
-       scroller = elm_scroller_add(parent);
-       elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE);
-       elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
-
-       /* Grid */
-       grid = elm_grid_add(scroller);
-       evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
-       evas_object_show(grid);
-
-       /* NoContent Layout */
-       layout = elm_layout_add(grid);
-       elm_layout_theme_set(layout, "layout", "nocontents", "default");
-       elm_object_part_text_set(layout, "elm.text", text);
-       evas_object_show(layout);
-       elm_grid_pack(grid, layout, 0, 0, 100, 100);
-
-       /* Previous Page Button */
-       btn = elm_button_add(grid);
-       elm_object_text_set(btn, "Prev");
-       evas_object_smart_callback_add(btn, "clicked", prev_btn_clicked_cb, ad);
-       evas_object_show(btn);
-       elm_grid_pack(grid, btn, 10, 90, 30, 8);
-
-       /* Next Page Button */
-       btn = elm_button_add(grid);
-       elm_object_text_set(btn, "Next");
-       evas_object_smart_callback_add(btn, "clicked", next_btn_clicked_cb, ad);
-       evas_object_show(btn);
-       elm_grid_pack(grid, btn, 60, 90, 30, 8);
-
-       elm_object_content_set(scroller, grid);
-
-       return scroller;
-}
-
-
-class app_controller4: public ui_controller
-{
-private:
-       appdata_s *ad;
-
-public:
-       app_controller4(appdata_s *ad)
-                       : ad(ad)
-       {
-       }
-
-       ~app_controller4()
-       {
-       }
-
-       void load()
-       {
-               //Initialize contents.
-
-               ui_basic_view *view = dynamic_cast<ui_basic_view *>(this->get_view());
-
-               //Create a main content.
-               Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 4",
-                               //Prev Button
-                       [](void *data, Evas_Object *obj, void *event_info) -> void
-                       {
-                               appdata_s *ad = static_cast<appdata_s *>(data);
-                               ad->viewmgr->pop_view();
-                       },
-                       //Next Button
-                       [](void *data, Evas_Object *obj, void *event_info) -> void
-                       {
-                               appdata_s *ad = static_cast<appdata_s *>(data);
-                               ad->viewmgr->deactivate();
-                       }, this->ad);
-
-               //Arguments: content, title
-               view->set_content(content, "TitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitle");
-               view->set_title_badge("999+");
-       }
-
-       void unload()
-       {
-               //You could destroy the content here for save memory.
-               ui_view *view = this->get_view();
-               Evas_Object *content = view->set_content(NULL);
-               evas_object_del(content);
-       }
-
-};
-
-
-class app_controller3: public ui_controller
-{
-private:
-       appdata_s *ad;
-
-public:
-       app_controller3(appdata_s *ad)
-                       : ad(ad)
-       {
-       }
-
-       ~app_controller3()
-       {
-       }
-
-       void load()
-       {
-               //Initialize contents.
-
-               ui_basic_view *view = dynamic_cast<ui_basic_view *>(this->get_view());
-
-               //Create a main content.
-               Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 3",
-                               //Prev Button
-                       [](void *data, Evas_Object *obj, void *event_info) -> void
-                       {
-                               appdata_s *ad = static_cast<appdata_s *>(data);
-                               ad->viewmgr->pop_view();
-                       },
-                       //Next Button
-                       [](void *data, Evas_Object *obj, void *event_info) -> void
-                       {
-                               appdata_s *ad = static_cast<appdata_s *>(data);
-                               app_controller4 *controller = new app_controller4(ad);
-                               ad->viewmgr->push_view(new ui_basic_view(controller));
-                       }, this->ad);
-
-               //Arguments: content, title, subtitle, icon, title left button, title right button
-               view->set_content(content, "Title", "Subtitle", NULL, NULL, NULL);
-       }
-
-       void unload()
-       {
-               //You could destroy the content here for save memory.
-               ui_view *view = this->get_view();
-               Evas_Object *content = view->set_content(NULL);
-               evas_object_del(content);
-       }
-};
-
-
-class app_controller2: public ui_controller
-{
-private:
-       appdata_s *ad;
-
-public:
-       app_controller2(appdata_s *ad)
-                       : ad(ad)
-       {
-       }
-       ~app_controller2()
-       {
-       }
-
-       void load()
-       {
-               //Initialize contents.
-
-               ui_basic_view *view = dynamic_cast<ui_basic_view *>(ui_controller::get_view());
-
-               //Create a main content.
-               Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 2",
-                               //Prev Button
-                       [](void *data, Evas_Object *obj, void *event_info) -> void
-                       {
-                               appdata_s *ad = static_cast<appdata_s *>(data);
-                               ad->viewmgr->pop_view();
-                       },
-                       //Next Button
-                       [](void *data, Evas_Object *obj, void *event_info) -> void
-                       {
-                               appdata_s *ad = static_cast<appdata_s *>(data);
-                               app_controller3 *controller = new app_controller3(ad);
-                               ad->viewmgr->push_view(new ui_basic_view(controller));
-                       }, this->ad);
-
-               //Title left button
-               Evas_Object *left_title_btn = elm_button_add(view->get_base());
-               elm_object_text_set(left_title_btn, "Cancel");
-
-               //Title right button
-               Evas_Object *right_title_btn = elm_button_add(view->get_base());
-               elm_object_text_set(right_title_btn, "Done");
-
-               //Arguments: content, title, subtitle, icon, title left button, title right button
-               view->set_content(content, "Title Buttons", NULL, NULL, left_title_btn, right_title_btn);
-       }
-
-       void unload()
-       {
-               //You could destroy the content here for save memory.
-               ui_view *view = this->get_view();
-               Evas_Object *content = view->set_content(NULL);
-               evas_object_del(content);
-       }
-};
-
-class app_controller1: public ui_controller
-{
-private:
-       appdata_s *ad;
-
-public:
-       app_controller1(appdata_s *ad)
-                       : ad(ad)
-       {
-       }
-       ~app_controller1()
-       {
-       }
-
-       void load()
-       {
-               //Initialize contents.
-
-               ui_basic_view *view = dynamic_cast<ui_basic_view *>(ui_controller::get_view());
-
-               //Create a main content.
-               Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 1",
-                               //Prev Button
-                       [](void *data, Evas_Object *obj, void *event_info) -> void
-                       {
-                               appdata_s *ad = static_cast<appdata_s *>(data);
-                               ad->viewmgr->deactivate();
-                       },
-                       //Next Button
-                       [](void *data, Evas_Object *obj, void *event_info) -> void
-                       {
-                               appdata_s *ad = static_cast<appdata_s *>(data);
-                               app_controller2 *controller = new app_controller2(ad);
-                               ui_basic_view *view = new ui_basic_view(controller, "page2");
-                               ad->viewmgr->push_view(view);
-                       }, this->ad);
-
-               view->set_content(content, "Title");
-       }
-
-       void unload()
-       {
-               //You could destroy the content here for save memory.
-               ui_view *view = this->get_view();
-               Evas_Object *content = view->set_content(NULL);
-               evas_object_del(content);
-       }
-};
diff --git a/src/efl/efl_viewmgr.h b/src/efl/efl_viewmgr.h
new file mode 100644 (file)
index 0000000..7dc04b2
--- /dev/null
@@ -0,0 +1,3 @@
+#include "ui_viewmgr.h"
+#include "ui_controller.h"
+#include "ui_view.h"
diff --git a/src/efl/mobile/efl_viewmgr.h b/src/efl/mobile/efl_viewmgr.h
new file mode 100644 (file)
index 0000000..b2389bd
--- /dev/null
@@ -0,0 +1 @@
+#include "ui_basic_view.h"
similarity index 93%
rename from src/ui_basic_view.cpp
rename to src/efl/mobile/ui_basic_view.cpp
index f1dbb36..db2414c 100644 (file)
@@ -1,6 +1,4 @@
-#include <dlog.h>
-#include "ui_basic_view.h"
-#include "ui_viewmgr.h"
+#include "efl_viewmgr.h"
 
 using namespace efl;
 
@@ -133,8 +131,7 @@ bool ui_basic_view::set_title_left_btn(Evas_Object *title_left_btn)
        return false;
 }
 
-bool
-ui_basic_view::set_title_right_btn(Evas_Object *title_right_btn)
+bool ui_basic_view::set_title_right_btn(Evas_Object *title_right_btn)
 {
        if (this->layout)
        {
@@ -166,8 +163,7 @@ bool ui_basic_view::set_title_badge(const char *text)
        return false;
 }
 
-bool
-ui_basic_view::set_title(const char *text)
+bool ui_basic_view::set_title(const char *text)
 {
        if (this->layout)
        {
@@ -180,8 +176,7 @@ ui_basic_view::set_title(const char *text)
        return false;
 }
 
-Evas_Object *
-ui_basic_view::set_content(Evas_Object *content, const char *title, const char *subtitle, Evas_Object *icon, Evas_Object *title_left_btn,
+Evas_Object *ui_basic_view::set_content(Evas_Object *content, const char *title, const char *subtitle, Evas_Object *icon, Evas_Object *title_left_btn,
         Evas_Object *title_right_btn)
 {
        Evas_Object *pcontent = this->set_content(content);
similarity index 97%
rename from src/ui_basic_view.h
rename to src/efl/mobile/ui_basic_view.h
index d942190..f99674f 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef UI_BASIC_VIEW
 #define UI_BASIC_VIEW
 
-#include "ui_view.h"
+#include "../efl_viewmgr.h"
 
 namespace efl
 {
similarity index 73%
rename from src/ui_controller.cpp
rename to src/efl/ui_controller.cpp
index e312012..d195cc0 100644 (file)
@@ -1,6 +1,4 @@
-#include <dlog.h>
-#include "ui_view.h"
-#include "ui_controller.h"
+#include "efl_viewmgr.h"
 
 using namespace efl;
 
diff --git a/src/efl/ui_controller.h b/src/efl/ui_controller.h
new file mode 100644 (file)
index 0000000..d9de73e
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef UI_CONTROLLER
+#define UI_CONTROLLER
+
+#include <Elementary.h>
+#include "../interface/ui_viewmgr.h"
+
+namespace efl
+{
+class ui_controller: public ui_controller_base
+{
+public:
+       virtual ~ui_controller()
+       {
+       }
+       ui_view *get_view();
+
+       virtual void load() {}
+       virtual void unload() {}
+       virtual void active() {}
+       virtual void inactive() {}
+       virtual void pause() {}
+       virtual void resume() {}
+       virtual void destroy() {}
+};
+}
+
+#endif /* UI_CONTROLLER_H */
similarity index 88%
rename from src/ui_view.cpp
rename to src/efl/ui_view.cpp
index 36d7bf3..c319203 100644 (file)
@@ -1,6 +1,4 @@
-#include "ui_view.h"
-#include "ui_controller.h"
-#include "ui_viewmgr.h"
+#include "efl_viewmgr.h"
 
 using namespace efl;
 
similarity index 92%
rename from src/ui_view.h
rename to src/efl/ui_view.h
index edf4d59..dfd825a 100644 (file)
@@ -2,7 +2,7 @@
 #define UI_VIEW
 
 #include <Elementary.h>
-#include "ui_view_base.h"
+#include "../interface/ui_viewmgr.h"
 
 #define CONVERT_TO_EO(T) static_cast<Evas_Object *>((T))
 #define CONVERT_TO_T(EO) static_cast<T>((EO))
similarity index 96%
rename from src/ui_viewmgr.cpp
rename to src/efl/ui_viewmgr.cpp
index 5845eb7..998b8a6 100644 (file)
@@ -1,6 +1,4 @@
-#include <dlog.h>
-#include "ui_view.h"
-#include "ui_viewmgr.h"
+#include "efl_viewmgr.h"
 
 using namespace efl;
 
@@ -9,9 +7,6 @@ win_delete_request_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info
 {
        ui_viewmgr *viewmgr = static_cast<ui_viewmgr*>(data);
        delete(viewmgr);
-
-       //FIXME: Window is destroyed. Terminate Application!
-       //ui_app_exit();
 }
 
 Evas_Object *
similarity index 66%
rename from src/ui_viewmgr.h
rename to src/efl/ui_viewmgr.h
index 409c550..bbb8258 100644 (file)
@@ -2,7 +2,7 @@
 #define UI_VIEWMGR
 
 #include <Elementary.h>
-#include "ui_viewmgr_base.h"
+#include "../interface/ui_viewmgr.h"
 
 namespace efl
 {
@@ -12,34 +12,32 @@ class ui_view;
 class ui_viewmgr: public ui_viewmgr_base
 {
 private:
-       Ecore_Job *animation_job;
-       bool animation_ongoing;
-       //CHECK is it really needed?
-       bool to_show;
        Evas_Object *win;
        Evas_Object *conform;
        Evas_Object *base_layout;
 
-       Evas_Object * create_conformant(Evas_Object *win);
-       Evas_Object * create_base_layout(Evas_Object *conform);
+       Evas_Object *create_conformant(Evas_Object *win);
+       Evas_Object *create_base_layout(Evas_Object *conform);
 
 public:
        ui_viewmgr(const char *pkg);
        ~ui_viewmgr();
+
        bool activate();
        bool deactivate();
-       Evas_Object *get_window()
-       {
-               return this->win;
-       }
        ui_view *push_view(ui_view *view);
        bool pop_view();
 
-       //TODO: Make this private
+       //FIXME: Make this private
        Evas_Object *get_base_layout()
        {
                return this->base_layout;
        }
+
+       Evas_Object *get_window()
+       {
+               return this->win;
+       }
 };
 }
 
diff --git a/src/efl_viewmgr.h b/src/efl_viewmgr.h
deleted file mode 100644 (file)
index a426a2a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <Elementary.h>
-#include "ui_viewmgr.h"
-#include "ui_controller.h"
-#include "ui_basic_view.h"
-#include "ui_view.h"
-
-
-using namespace efl;
similarity index 60%
rename from src/ui_controller_base.cpp
rename to src/interface/ui_controller_base.cpp
index 53d1cb9..b751a22 100644 (file)
@@ -1,6 +1,4 @@
-#include <dlog.h>
-#include "ui_view_base.h"
-#include "ui_controller_base.h"
+#include "ui_viewmgr.h"
 
 void ui_controller_base::set_view(ui_view_base *view)
 {
similarity index 98%
rename from src/ui_controller_base.h
rename to src/interface/ui_controller_base.h
index 352dd31..e5bfd47 100644 (file)
@@ -8,11 +8,6 @@
 #ifndef UI_CONTROLLER_BASE_H_
 #define UI_CONTROLLER_BASE_H_
 
-#ifdef  LOG_TAG
-#undef  LOG_TAG
-#endif
-#define LOG_TAG "VIEWMGR"
-
 class ui_view_base;
 
 /**
similarity index 96%
rename from src/ui_view_base.cpp
rename to src/interface/ui_view_base.cpp
index 637ffda..50a3357 100644 (file)
@@ -1,9 +1,4 @@
-#include <dlog.h>
-#include "ui_controller.h"
 #include "ui_viewmgr.h"
-#include "ui_view_base.h"
-
-using namespace efl;
 
 void ui_view_base::set_event_block(bool block)
 {
similarity index 99%
rename from src/ui_view_base.h
rename to src/interface/ui_view_base.h
index fbcc30b..dabaf10 100644 (file)
 
 #include <string>
 
-#ifdef  LOG_TAG
-#undef  LOG_TAG
-#endif
-#define LOG_TAG "VIEWMGR"
-
 typedef void* T;
 
 class ui_viewmgr_base;
diff --git a/src/interface/ui_viewmgr.h b/src/interface/ui_viewmgr.h
new file mode 100644 (file)
index 0000000..3a96621
--- /dev/null
@@ -0,0 +1,11 @@
+#include <app.h>
+#include <dlog.h>
+
+#ifdef  LOG_TAG
+#undef  LOG_TAG
+#endif
+#define LOG_TAG "VIEWMGR"
+
+#include "ui_viewmgr_base.h"
+#include "ui_view_base.h"
+#include "ui_controller_base.h"
similarity index 96%
rename from src/ui_viewmgr_base.cpp
rename to src/interface/ui_viewmgr_base.cpp
index d7f100b..34ef0a0 100644 (file)
@@ -1,7 +1,4 @@
-#include <dlog.h>
-#include <app.h>
-#include "ui_view_base.h"
-#include "ui_viewmgr_base.h"
+#include "ui_viewmgr.h"
 
 bool ui_viewmgr_base::_connect_view(ui_view_base *view)
 {
@@ -85,7 +82,7 @@ ui_viewmgr_base::~ui_viewmgr_base()
                delete (view);
        }
 
-       //Terminate applicationn when viewmgr is destroyed.
+       //FIXME: Window is destroyed. Terminate Application!
        ui_app_exit();
 }
 
similarity index 98%
rename from src/ui_viewmgr_base.h
rename to src/interface/ui_viewmgr_base.h
index eefb05e..01abae5 100644 (file)
 
 #include <list>
 
-#ifdef  LOG_TAG
-#undef  LOG_TAG
-#endif
-#define LOG_TAG "VIEWMGR"
-
 using namespace std;
 
 class ui_view_base;
index b8a8653..2288b7b 100644 (file)
  */
 
 #include "main.h"
-#include "app_controller.h"
+#include "page4_controller.h"
+#include "page3_controller.h"
+#include "page2_controller.h"
+#include "page1_controller.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)
+{
+       Evas_Object *grid, *box, *layout, *scroller, *btn, *button_layout;
+
+       /* Scroller */
+       scroller = elm_scroller_add(parent);
+       elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE);
+       elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+
+       /* Grid */
+       grid = elm_grid_add(scroller);
+       evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_show(grid);
+
+       /* NoContent Layout */
+       layout = elm_layout_add(grid);
+       elm_layout_theme_set(layout, "layout", "nocontents", "default");
+       elm_object_part_text_set(layout, "elm.text", text);
+       evas_object_show(layout);
+       elm_grid_pack(grid, layout, 0, 0, 100, 100);
+
+       /* Previous Page Button */
+       btn = elm_button_add(grid);
+       elm_object_text_set(btn, "Prev");
+       evas_object_smart_callback_add(btn, "clicked", prev_btn_clicked_cb, ad);
+       evas_object_show(btn);
+       elm_grid_pack(grid, btn, 10, 90, 30, 8);
+
+       /* Next Page Button */
+       btn = elm_button_add(grid);
+       elm_object_text_set(btn, "Next");
+       evas_object_smart_callback_add(btn, "clicked", next_btn_clicked_cb, ad);
+       evas_object_show(btn);
+       elm_grid_pack(grid, btn, 60, 90, 30, 8);
+
+       elm_object_content_set(scroller, grid);
+
+       return scroller;
+}
 
 static void create_base_gui(appdata_s *ad)
 {
+       //FIXME: Hide this creation.
        ad->viewmgr = new ui_viewmgr(PACKAGE);
 
-       //View 1
-       {
-               app_controller1 *controller = new app_controller1(ad);
-               ad->viewmgr->push_view(new ui_basic_view(controller, "page1"));
-       }
-/*
-       //View 2
-       {
-               app_controller2 *controller = new app_controller2(ad);
-               ad->viewmgr->push_view(new ui_basic_view(controller, "page2"));
-       }
-       //View 3
-       {
-               app_controller3 *controller = new app_controller3(ad);
-               ad->viewmgr->push_view(new ui_view(controller));
-       }
-       //View 4
-       {
-               app_controller4 *controller = new app_controller4();
-               ui_basic_view *view = ad->viewmgr->push_view(new ui_basic_view(controller));
-       }
-*/
+       page1_controller *page1 = new page1_controller(ad);
+
        ad->viewmgr->activate();
 }
 
@@ -77,6 +103,8 @@ static void app_pause(void *data)
 
 static void app_resume(void *data)
 {
+       appdata_s *ad = (appdata_s *) data;
+       ad->viewmgr->activate();
 }
 
 static void app_terminate(void *data)
diff --git a/src/page1_controller.h b/src/page1_controller.h
new file mode 100644 (file)
index 0000000..650a9ce
--- /dev/null
@@ -0,0 +1,47 @@
+class page1_controller: public ui_controller
+{
+private:
+       appdata_s *ad;
+
+public:
+       page1_controller(appdata_s *ad)
+                       : ad(ad)
+       {
+               ad->viewmgr->push_view(new ui_basic_view(this, "page1"));
+       }
+       ~page1_controller()
+       {
+       }
+
+       void load()
+       {
+               //Initialize contents.
+
+               ui_basic_view *view = dynamic_cast<ui_basic_view *>(ui_controller::get_view());
+
+               //Create a main content.
+               Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 1",
+                               //Prev Button
+                       [](void *data, Evas_Object *obj, void *event_info) -> void
+                       {
+                               appdata_s *ad = static_cast<appdata_s *>(data);
+                               ad->viewmgr->deactivate();
+                       },
+                       //Next Button
+                       [](void *data, Evas_Object *obj, void *event_info) -> void
+                       {
+                               appdata_s *ad = static_cast<appdata_s *>(data);
+                               page2_controller *controller = new page2_controller(ad);
+                       }, this->ad);
+
+               view->set_content(content, "Title");
+       }
+
+       void unload()
+       {
+               //You could destroy the content here for save memory.
+               ui_view *view = this->get_view();
+               Evas_Object *content = view->set_content(NULL);
+               evas_object_del(content);
+       }
+};
diff --git a/src/page2_controller.h b/src/page2_controller.h
new file mode 100644 (file)
index 0000000..ee63057
--- /dev/null
@@ -0,0 +1,56 @@
+class page2_controller: public ui_controller
+{
+private:
+       appdata_s *ad;
+
+public:
+       page2_controller(appdata_s *ad)
+                       : ad(ad)
+       {
+               ad->viewmgr->push_view(new ui_basic_view(this, "page2"));
+       }
+       ~page2_controller()
+       {
+       }
+
+       void load()
+       {
+               //Initialize contents.
+
+               ui_basic_view *view = dynamic_cast<ui_basic_view *>(ui_controller::get_view());
+
+               //Create a main content.
+               Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 2",
+                               //Prev Button
+                       [](void *data, Evas_Object *obj, void *event_info) -> void
+                       {
+                               appdata_s *ad = static_cast<appdata_s *>(data);
+                               ad->viewmgr->pop_view();
+                       },
+                       //Next Button
+                       [](void *data, Evas_Object *obj, void *event_info) -> void
+                       {
+                               appdata_s *ad = static_cast<appdata_s *>(data);
+                               page3_controller *controller = new page3_controller(ad);
+                       }, this->ad);
+
+               //Title left button
+               Evas_Object *left_title_btn = elm_button_add(view->get_base());
+               elm_object_text_set(left_title_btn, "Cancel");
+
+               //Title right button
+               Evas_Object *right_title_btn = elm_button_add(view->get_base());
+               elm_object_text_set(right_title_btn, "Done");
+
+               //Arguments: content, title, subtitle, icon, title left button, title right button
+               view->set_content(content, "Title Buttons", NULL, NULL, left_title_btn, right_title_btn);
+       }
+
+       void unload()
+       {
+               //You could destroy the content here for save memory.
+               ui_view *view = this->get_view();
+               Evas_Object *content = view->set_content(NULL);
+               evas_object_del(content);
+       }
+};
diff --git a/src/page3_controller.h b/src/page3_controller.h
new file mode 100644 (file)
index 0000000..56d7631
--- /dev/null
@@ -0,0 +1,49 @@
+class page3_controller: public ui_controller
+{
+private:
+       appdata_s *ad;
+
+public:
+       page3_controller(appdata_s *ad)
+                       : ad(ad)
+       {
+               ad->viewmgr->push_view(new ui_basic_view(this, "page3"));
+       }
+
+       ~page3_controller()
+       {
+       }
+
+       void load()
+       {
+               //Initialize contents.
+
+               ui_basic_view *view = dynamic_cast<ui_basic_view *>(this->get_view());
+
+               //Create a main content.
+               Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 3",
+                               //Prev Button
+                       [](void *data, Evas_Object *obj, void *event_info) -> void
+                       {
+                               appdata_s *ad = static_cast<appdata_s *>(data);
+                               ad->viewmgr->pop_view();
+                       },
+                       //Next Button
+                       [](void *data, Evas_Object *obj, void *event_info) -> void
+                       {
+                               appdata_s *ad = static_cast<appdata_s *>(data);
+                               page4_controller *controller = new page4_controller(ad);
+                       }, this->ad);
+
+               //Arguments: content, title, subtitle, icon, title left button, title right button
+               view->set_content(content, "Title", "Subtitle", NULL, NULL, NULL);
+       }
+
+       void unload()
+       {
+               //You could destroy the content here for save memory.
+               ui_view *view = this->get_view();
+               Evas_Object *content = view->set_content(NULL);
+               evas_object_del(content);
+       }
+};
diff --git a/src/page4_controller.h b/src/page4_controller.h
new file mode 100644 (file)
index 0000000..b612583
--- /dev/null
@@ -0,0 +1,51 @@
+class page4_controller: public ui_controller
+{
+private:
+       appdata_s *ad;
+
+public:
+       page4_controller(appdata_s *ad)
+                       : ad(ad)
+       {
+               ad->viewmgr->push_view(new ui_basic_view(this, "page4"));
+       }
+
+       ~page4_controller()
+       {
+       }
+
+       void load()
+       {
+               //Initialize contents.
+
+               ui_basic_view *view = dynamic_cast<ui_basic_view *>(this->get_view());
+
+               //Create a main content.
+               Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 4",
+                               //Prev Button
+                       [](void *data, Evas_Object *obj, void *event_info) -> void
+                       {
+                               appdata_s *ad = static_cast<appdata_s *>(data);
+                               ad->viewmgr->pop_view();
+                       },
+                       //Next Button
+                       [](void *data, Evas_Object *obj, void *event_info) -> void
+                       {
+                               appdata_s *ad = static_cast<appdata_s *>(data);
+                               ad->viewmgr->deactivate();
+                       }, this->ad);
+
+               //Arguments: content, title
+               view->set_content(content, "TitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitle");
+               view->set_title_badge("999+");
+       }
+
+       void unload()
+       {
+               //You could destroy the content here for save memory.
+               ui_view *view = this->get_view();
+               Evas_Object *content = view->set_content(NULL);
+               evas_object_del(content);
+       }
+
+};
diff --git a/src/ui_controller.h b/src/ui_controller.h
deleted file mode 100644 (file)
index ecc1324..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef UI_CONTROLLER
-#define UI_CONTROLLER
-
-#include <Elementary.h>
-#include <dlog.h>
-#include "ui_controller_base.h"
-#include "ui_view.h"
-
-namespace efl
-{
-class ui_controller: public ui_controller_base
-{
-public:
-       virtual ~ui_controller()
-       {
-       }
-
-       virtual void load()
-       {
-       }
-
-       virtual void unload()
-       {
-       }
-
-       virtual void active()
-       {
-       }
-
-       virtual void inactive()
-       {
-       }
-
-       virtual void pause()
-       {
-       }
-
-       virtual void resume()
-       {
-       }
-
-       virtual void destroy()
-       {
-       }
-
-       ui_view *get_view();
-};
-}
-
-#endif /* UI_CONTROLLER_H */