code refactoring. 29/59929/1
authorHermet Park <hermet@hermet.pe.kr>
Fri, 19 Feb 2016 11:36:27 +0000 (20:36 +0900)
committerHermet Park <hermet@hermet.pe.kr>
Fri, 19 Feb 2016 11:36:27 +0000 (20:36 +0900)
reorganize classs domains.

Change-Id: I9c8faed884050b8b8ab9bb7813796b9a972dc4ee

48 files changed:
CMakeLists.txt
inc/main.h
src/efl/efl_viewmgr.h [deleted file]
src/efl/example/main.cpp [new file with mode: 0644]
src/efl/example/page1.h [new file with mode: 0644]
src/efl/example/page2.h [new file with mode: 0644]
src/efl/example/page3.h [new file with mode: 0644]
src/efl/example/page4.h [new file with mode: 0644]
src/efl/example/page5.h [new file with mode: 0644]
src/efl/mobile/efl_viewmgr.h [deleted file]
src/efl/mobile/mobile_key_handler.cpp [deleted file]
src/efl/mobile/mobile_key_handler.h [deleted file]
src/efl/mobile/ui_basic_key_listener.cpp [new file with mode: 0644]
src/efl/mobile/ui_basic_key_listener.h [new file with mode: 0644]
src/efl/mobile/ui_basic_view.cpp
src/efl/mobile/ui_basic_view.h
src/efl/mobile/ui_viewmanager.h [new file with mode: 0644]
src/efl/ui_controller.cpp
src/efl/ui_controller.h
src/efl/ui_key_handler.cpp [deleted file]
src/efl/ui_key_handler.h [deleted file]
src/efl/ui_key_listener.cpp [new file with mode: 0644]
src/efl/ui_key_listener.h [new file with mode: 0644]
src/efl/ui_view.cpp
src/efl/ui_view.h
src/efl/ui_viewmanager.h [new file with mode: 0644]
src/efl/ui_viewmgr.cpp
src/efl/ui_viewmgr.h
src/interface/ui_controller_base.cpp [deleted file]
src/interface/ui_controller_base.h [deleted file]
src/interface/ui_controller_interface.cpp [new file with mode: 0644]
src/interface/ui_controller_interface.h [new file with mode: 0644]
src/interface/ui_view_base.cpp [deleted file]
src/interface/ui_view_base.h [deleted file]
src/interface/ui_view_interface.cpp [new file with mode: 0644]
src/interface/ui_view_interface.h [new file with mode: 0644]
src/interface/ui_viewmanager_interface.h [new file with mode: 0644]
src/interface/ui_viewmgr.h [deleted file]
src/interface/ui_viewmgr_base.cpp [deleted file]
src/interface/ui_viewmgr_base.h [deleted file]
src/interface/ui_viewmgr_interface.cpp [new file with mode: 0644]
src/interface/ui_viewmgr_interface.h [new file with mode: 0644]
src/main.cpp [deleted file]
src/page1_controller.h [deleted file]
src/page2_controller.h [deleted file]
src/page3_controller.h [deleted file]
src/page4_controller.h [deleted file]
src/page5_controller.h [deleted file]

index 818aad6a35faf4310f0990ddfa8863c5b0954dcb..efecc3bcd48295f38d80c88f8dd543f2f79c233b 100644 (file)
@@ -3,16 +3,16 @@ PROJECT(ui-viewmgr)
 SET(PACKAGE org.tizen.ui-viewmgr)
 
 SET(SRCS
-       src/interface/ui_controller_base.cpp
-       src/interface/ui_view_base.cpp
-       src/interface/ui_viewmgr_base.cpp
+       src/interface/ui_controller_interface.cpp
+       src/interface/ui_view_interface.cpp
+       src/interface/ui_viewmgr_interface.cpp
        src/efl/ui_controller.cpp
        src/efl/ui_view.cpp
        src/efl/ui_viewmgr.cpp
-       src/efl/ui_key_handler.cpp
+       src/efl/ui_key_listener.cpp
        src/efl/mobile/ui_basic_view.cpp
-       src/efl/mobile/mobile_key_handler.cpp
-       src/main.cpp
+       src/efl/mobile/ui_basic_key_listener.cpp
+       src/efl/example/main.cpp
    )
 
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/inc)
index 9624a714241501b28dd617bee96cd4f56ed89575..783f49509b7866ccca86d910e1881b2cb301e281 100644 (file)
@@ -17,8 +17,7 @@
 #include <app.h>
 #include <system_settings.h>
 #include <dlog.h>
-#include <efl_extension.h>
-#include "../src/efl/mobile/efl_viewmgr.h"
+#include "../src/efl/mobile/ui_viewmanager.h"
 
 //uncomment if you want debug
 #ifndef TIZEN_ENGINEER_MODE
@@ -28,7 +27,7 @@
 #ifdef  LOG_TAG
 #undef  LOG_TAG
 #endif
-#define LOG_TAG "VIEWMGR"
+#define LOG_TAG "UI_VIEWMGR"
 
 #if !defined(PACKAGE)
 #define PACKAGE "org.tizen.ui-viewmgr"
diff --git a/src/efl/efl_viewmgr.h b/src/efl/efl_viewmgr.h
deleted file mode 100644 (file)
index 7a6c43b..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- *
- */
-#include "ui_viewmgr.h"
-#include "ui_controller.h"
-#include "ui_view.h"
diff --git a/src/efl/example/main.cpp b/src/efl/example/main.cpp
new file mode 100644 (file)
index 0000000..ff20a0d
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * 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.
+ *
+ */
+#include "main.h"
+#include "page5.h"
+#include "page4.h"
+#include "page3.h"
+#include "page2.h"
+#include "page1.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);
+
+       create_page1(ad);
+
+       ad->viewmgr->activate();
+}
+
+static bool app_create(void *data)
+{
+       /* Hook to take necessary actions before main event loop starts
+        Initialize UI resources and application's data
+        If this function returns true, the main loop of application starts
+        If this function returns false, the application is terminated */
+       appdata_s *ad = (appdata_s *) data;
+
+       elm_app_base_scale_set(2.6);
+
+       /* Bind package locale file */
+       bindtextdomain(PACKAGE, LOCALE_DIR);
+       textdomain(PACKAGE);
+
+       create_base_gui(ad);
+
+       return true;
+}
+
+static void app_control(app_control_h app_control, void *data)
+{
+       /* Handle the launch request. */
+}
+
+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)
+{
+}
+
+static void ui_app_lang_changed(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_LANGUAGE_CHANGED*/
+       char *locale = NULL;
+       system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+       elm_language_set(locale);
+       free(locale);
+
+       return;
+}
+
+static void ui_app_orient_changed(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
+       return;
+}
+
+static void ui_app_region_changed(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_REGION_FORMAT_CHANGED*/
+}
+
+static void ui_app_low_battery(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_LOW_BATTERY*/
+}
+
+static void ui_app_low_memory(app_event_info_h event_info, void *user_data)
+{
+       /*APP_EVENT_LOW_MEMORY*/
+}
+
+int main(int argc, char *argv[])
+{
+       appdata_s ad = { 0, };
+       int ret = 0;
+
+       ui_app_lifecycle_callback_s event_callback = { 0, };
+       app_event_handler_h handlers[5] = { NULL, };
+
+       event_callback.create = app_create;
+       event_callback.terminate = app_terminate;
+       event_callback.pause = app_pause;
+       event_callback.resume = app_resume;
+       event_callback.app_control = app_control;
+
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED,
+                       ui_app_orient_changed, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed,
+                       &ad);
+       ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);
+
+       ret = ui_app_main(argc, argv, &event_callback, &ad);
+       if (ret != APP_ERROR_NONE)
+       {
+               dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
+       }
+
+       return ret;
+}
diff --git a/src/efl/example/page1.h b/src/efl/example/page1.h
new file mode 100644 (file)
index 0000000..0951a61
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ *
+ */
+class page1: public ui_controller
+{
+private:
+       appdata_s *ad;
+
+public:
+       page1(appdata_s *ad)
+                       : ad(ad)
+       {
+               /* ui_basic_view(controller, identity name).
+                  Later, you could get the identity name using view->get_name(); */
+               ad->viewmgr->push_view(new ui_basic_view(this, "page1"));
+       }
+       ~page1()
+       {
+       }
+
+       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 1",
+                               //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);
+                                       create_page2(ad);
+                               },
+                               this->ad);
+
+               view->set_content(content, "Title");
+       }
+};
+
+void create_page1(appdata_s *ad)
+{
+       new page1(ad);
+}
diff --git a/src/efl/example/page2.h b/src/efl/example/page2.h
new file mode 100644 (file)
index 0000000..0f2a2d3
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ *
+ */
+class page2: public ui_controller
+{
+private:
+       appdata_s *ad;
+
+public:
+       page2(appdata_s *ad)
+                       : ad(ad)
+       {
+               /* ui_basic_view(controller, identity name).
+                  Later, you could get the identity name using view->get_name(); */
+               ad->viewmgr->push_view(new ui_basic_view(this, "page2"));
+       }
+
+       ~page2()
+       {
+       }
+
+       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 2",
+                               //Prev Button Callback
+                       [](void *data, Evas_Object *obj, void *event_info) -> void
+                       {
+                               appdata_s *ad = static_cast<appdata_s *>(data);
+                               ad->viewmgr->pop_view();
+                       },
+                       //Next Button Callback
+                       [](void *data, Evas_Object *obj, void *event_info) -> void
+                       {
+                               appdata_s *ad = static_cast<appdata_s *>(data);
+                               create_page3(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, title left button, title right button
+               view->set_content(content, "Title Buttons", NULL, left_title_btn, right_title_btn);
+       }
+};
+
+void create_page2(appdata_s *ad)
+{
+       new page2(ad);
+}
diff --git a/src/efl/example/page3.h b/src/efl/example/page3.h
new file mode 100644 (file)
index 0000000..dc5621b
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ *
+ */
+class page3: public ui_controller
+{
+private:
+       appdata_s *ad;
+
+public:
+       page3(appdata_s *ad)
+                       : ad(ad)
+       {
+               /* ui_basic_view(controller, identity name).
+                  Later, you could get the identity name using view->get_name(); */
+               ad->viewmgr->push_view(new ui_basic_view(this, "page3"));
+       }
+
+       ~page3()
+       {
+       }
+
+       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 Callback
+                               [](void *data, Evas_Object *obj, void *event_info) -> void
+                               {
+                                       appdata_s *ad = static_cast<appdata_s *>(data);
+                                       ad->viewmgr->pop_view();
+                               },
+                               //Next Button Callback
+                               [](void *data, Evas_Object *obj, void *event_info) -> void
+                               {
+                                       appdata_s *ad = static_cast<appdata_s *>(data);
+                                       create_page4(ad);
+                               },
+                               this->ad);
+
+               //Arguments: content, title, subtitle, title left button, title right button
+               view->set_content(content, "Title", "Subtitle", NULL, NULL);
+       }
+};
+
+void create_page3(appdata_s *ad)
+{
+       new page3(ad);
+}
diff --git a/src/efl/example/page4.h b/src/efl/example/page4.h
new file mode 100644 (file)
index 0000000..6c22cf5
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ *
+ */
+class page4: public ui_controller
+{
+private:
+       appdata_s *ad;
+
+public:
+       page4(appdata_s *ad)
+                       : ad(ad)
+       {
+               /* ui_basic_view(controller, identity name).
+                  Later, you could get the identity name using view->get_name(); */
+               ad->viewmgr->push_view(new ui_basic_view(this, "page4"));
+       }
+
+       ~page4()
+       {
+       }
+
+       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 Callback
+                               [](void *data, Evas_Object *obj, void *event_info) -> void
+                               {
+                                       appdata_s *ad = static_cast<appdata_s *>(data);
+                                       ad->viewmgr->pop_view();
+                               },
+                               //Next Button Callback
+                               [](void *data, Evas_Object *obj, void *event_info) -> void
+                               {
+                                       appdata_s *ad = static_cast<appdata_s *>(data);
+                                       create_page5(ad);
+                               },
+                               this->ad);
+
+               //Arguments: content, title
+               view->set_content(content, "TitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitle");
+               view->set_title_badge("999+");
+       }
+};
+
+void create_page4(appdata_s *ad)
+{
+       new page4(ad);
+}
diff --git a/src/efl/example/page5.h b/src/efl/example/page5.h
new file mode 100644 (file)
index 0000000..85f861a
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ *
+ */
+class page5: public ui_controller
+{
+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(); */
+               ui_view *view = ad->viewmgr->push_view(new ui_view(this, "page5"));
+       }
+
+       ~page5()
+       {
+       }
+
+       void 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 5<br>(Full View)",
+                               //Prev Button Callback
+                               [](void *data, Evas_Object *obj, void *event_info) -> void
+                               {
+                                       appdata_s *ad = static_cast<appdata_s *>(data);
+                                       ad->viewmgr->pop_view();
+                               },
+                               //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);
+               view->set_indicator(UI_VIEW_INDICATOR_HIDE);
+       }
+};
+
+void create_page5(appdata_s *ad)
+{
+       new page5(ad);
+}
diff --git a/src/efl/mobile/efl_viewmgr.h b/src/efl/mobile/efl_viewmgr.h
deleted file mode 100644 (file)
index 23fb3c3..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * 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.
- *
- */
-#include "ui_basic_view.h"
diff --git a/src/efl/mobile/mobile_key_handler.cpp b/src/efl/mobile/mobile_key_handler.cpp
deleted file mode 100644 (file)
index 9a3a1ba..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.
- *
- */
-#include "../efl_viewmgr.h"
-#include "mobile_key_handler.h"
-
-using namespace efl;
-
-static const char *KEY_BACK = "XF86Back";
-static const char *KEY_MENU = "XF86Menu";
-
-enum mobile_key_event_type
-{
-       UI_KEY_EVENT_BACK = 0,
-       UI_KEY_EVENT_MENU
-};
-
-mobile_key_handler::mobile_key_handler(ui_viewmgr *viewmgr)
-               : ui_key_handler(viewmgr)
-{
-}
-
-static void event_proc(mobile_key_handler *key_handler, Evas_Event_Key_Down *ev)
-{
-   mobile_key_event_type type;
-
-   if (!strcmp(ev->keyname, KEY_BACK))
-     type = UI_KEY_EVENT_BACK;
-   else if (!strcmp(ev->keyname, KEY_MENU))
-     type = UI_KEY_EVENT_MENU;
-   else return;
-
-   ui_viewmgr *viewmgr = key_handler->get_viewmgr();
-   if (!viewmgr->is_activated()) return;
-
-   //Get Top View
-   ui_view *view = reinterpret_cast<ui_view *>(viewmgr->get_last_view());
-   if (!view) return;
-
-   //call events
-   switch (type)
-   {
-   case UI_KEY_EVENT_BACK:
-          //view->back();
-          LOGE("BACK!");
-          break;
-   case UI_KEY_EVENT_MENU:
-          //view->menu();
-          LOGE("MENU!");
-          break;
-   }
-}
-
-bool mobile_key_handler::term()
-{
-       evas_object_del(this->key_grabber);
-       return true;
-}
-
-bool mobile_key_handler::init()
-{
-       if (!this->viewmgr)
-       {
-               LOGE("No view manager??");
-               return false;
-       }
-
-       Evas *e = evas_object_evas_get(this->viewmgr->get_window());
-       if (!e)
-       {
-               LOGE("Failed to get Evas from window");
-               return false;
-       }
-
-       Evas_Object *key_grab_rect = evas_object_rectangle_add(e);
-       if (!key_grab_rect)
-       {
-               LOGE("Failed to create a key grabber rectangle");
-               return false;
-       }
-
-       evas_object_event_callback_add(key_grab_rect, EVAS_CALLBACK_KEY_UP,
-                       [](void *data, Evas *e, Evas_Object *obj, void *event_info) -> void
-                       {
-                               Evas_Event_Key_Down *ev = static_cast<Evas_Event_Key_Down *>(event_info);
-                               mobile_key_handler *key_handler = static_cast<mobile_key_handler *>(data);
-                               event_proc(key_handler, ev);
-                       },
-                       this);
-
-       if (!evas_object_key_grab(key_grab_rect, KEY_BACK, 0, 0, EINA_FALSE))
-       {
-            LOGE("Failed to grab BACK KEY(%s)\n", KEY_BACK);
-            evas_object_del(key_grab_rect);
-            return false;
-       }
-
-       if (!evas_object_key_grab(key_grab_rect, KEY_MENU, 0, 0, EINA_FALSE))
-       {
-            LOGE("Failed to grab MENU KEY(%s)\n", KEY_MENU);
-            evas_object_del(key_grab_rect);
-            return false;
-       }
-
-       this->key_grabber = key_grab_rect;
-
-       return true;
-}
diff --git a/src/efl/mobile/mobile_key_handler.h b/src/efl/mobile/mobile_key_handler.h
deleted file mode 100644 (file)
index f30db1d..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.
- *
- */
-#ifndef MOBILE_KEY_HANDLER
-#define MOBILE_KEY_HANDLER
-
-#include <Elementary.h>
-#include "../ui_key_handler.h"
-
-namespace efl
-{
-class ui_viewmgr;
-
-class mobile_key_handler : public ui_key_handler
-{
-public:
-       mobile_key_handler(ui_viewmgr *viewmgr);
-
-       bool init();
-       bool term();
-
-       ui_viewmgr *get_viewmgr() { return this->viewmgr; }
-};
-
-}
-
-#endif /* MOBILE_KEY_HANDLER */
diff --git a/src/efl/mobile/ui_basic_key_listener.cpp b/src/efl/mobile/ui_basic_key_listener.cpp
new file mode 100644 (file)
index 0000000..5fe7c98
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ *
+ */
+#include "ui_viewmanager.h"
+
+using namespace efl;
+
+static const char *KEY_BACK = "XF86Back";
+static const char *KEY_MENU = "XF86Menu";
+
+enum ui_key_event_type
+{
+       UI_KEY_EVENT_BACK = 0,
+       UI_KEY_EVENT_MENU
+};
+
+ui_basic_key_listener::ui_basic_key_listener(ui_viewmgr *viewmgr)
+               : ui_key_listener(viewmgr)
+{
+}
+
+static void event_proc(ui_basic_key_listener *key_handler, Evas_Event_Key_Down *ev)
+{
+   ui_key_event_type type;
+
+   if (!strcmp(ev->keyname, KEY_BACK))
+     type = UI_KEY_EVENT_BACK;
+   else if (!strcmp(ev->keyname, KEY_MENU))
+     type = UI_KEY_EVENT_MENU;
+   else return;
+
+   ui_viewmgr *viewmgr = key_handler->get_viewmgr();
+   if (!viewmgr->is_activated()) return;
+
+   //Get Top View
+   ui_view *view = reinterpret_cast<ui_view *>(viewmgr->get_last_view());
+   if (!view) return;
+
+   //call events
+   switch (type)
+   {
+   case UI_KEY_EVENT_BACK:
+          //view->back();
+          LOGE("BACK!");
+          break;
+   case UI_KEY_EVENT_MENU:
+          //view->menu();
+          LOGE("MENU!");
+          break;
+   }
+}
+
+bool ui_basic_key_listener::term()
+{
+       evas_object_del(this->key_grabber);
+       return true;
+}
+
+bool ui_basic_key_listener::init()
+{
+       if (!this->viewmgr)
+       {
+               LOGE("No view manager??");
+               return false;
+       }
+
+       Evas *e = evas_object_evas_get(this->viewmgr->get_window());
+       if (!e)
+       {
+               LOGE("Failed to get Evas from window");
+               return false;
+       }
+
+       Evas_Object *key_grab_rect = evas_object_rectangle_add(e);
+       if (!key_grab_rect)
+       {
+               LOGE("Failed to create a key grabber rectangle");
+               return false;
+       }
+
+       evas_object_event_callback_add(key_grab_rect, EVAS_CALLBACK_KEY_UP,
+                       [](void *data, Evas *e, Evas_Object *obj, void *event_info) -> void
+                       {
+                               Evas_Event_Key_Down *ev = static_cast<Evas_Event_Key_Down *>(event_info);
+                               ui_basic_key_listener *key_handler = static_cast<ui_basic_key_listener *>(data);
+                               event_proc(key_handler, ev);
+                       },
+                       this);
+
+       if (!evas_object_key_grab(key_grab_rect, KEY_BACK, 0, 0, EINA_FALSE))
+       {
+            LOGE("Failed to grab BACK KEY(%s)\n", KEY_BACK);
+            evas_object_del(key_grab_rect);
+            return false;
+       }
+
+       if (!evas_object_key_grab(key_grab_rect, KEY_MENU, 0, 0, EINA_FALSE))
+       {
+            LOGE("Failed to grab MENU KEY(%s)\n", KEY_MENU);
+            evas_object_del(key_grab_rect);
+            return false;
+       }
+
+       this->key_grabber = key_grab_rect;
+
+       return true;
+}
diff --git a/src/efl/mobile/ui_basic_key_listener.h b/src/efl/mobile/ui_basic_key_listener.h
new file mode 100644 (file)
index 0000000..58d6ff8
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ *
+ */
+#ifndef MOBILE_KEY_HANDLER_H
+#define MOBILE_KEY_HANDLER_H
+
+#include "../ui_viewmanager.h"
+
+namespace efl
+{
+class ui_viewmgr;
+
+class ui_basic_key_listener : public ui_key_listener
+{
+public:
+       ui_basic_key_listener(ui_viewmgr *viewmgr);
+
+       bool init();
+       bool term();
+
+       ui_viewmgr *get_viewmgr() { return this->viewmgr; }
+};
+
+}
+
+#endif /* MOBILE_KEY_HANDLER_H */
index 754ff0e0265c3e67451b9516a5f457b5b07f0175..8fca093794873671a68db34e8d947300321a11e3 100644 (file)
  *  limitations under the License.
  *
  */
-#include "efl_viewmgr.h"
+#include "ui_viewmanager.h"
+
+//FIXME: is it correct to define here?
+#define EDJ_PATH "/opt/usr/apps/org.tizen.ui-viewmgr/res/ui-viewmgr.edj"
+#define GROUP "elm/layout/tizen_view/default"
 
 using namespace efl;
 
@@ -54,7 +58,7 @@ bool ui_basic_view::create_layout()
        }
 
        //Set soft back key, if it's needed
-       ui_viewmgr *viewmgr = dynamic_cast<ui_viewmgr *>(ui_view_base::get_viewmgr());
+       ui_viewmgr *viewmgr = dynamic_cast<ui_viewmgr *>(ui_view_interface::get_viewmgr());
        if (viewmgr->get_soft_back_key())
        {
                Evas_Object *prev_btn = elm_button_add(layout);
index 565614f133950d075c8130c44063ebdec6006ca2..6d81437b358f10ec68c4e33d81a7c631e22400c1 100644 (file)
 #ifndef UI_BASIC_VIEW
 #define UI_BASIC_VIEW
 
-#include "../efl_viewmgr.h"
-
-//FIXME: is it correct to define here?
-#define EDJ_PATH "/opt/usr/apps/org.tizen.ui-viewmgr/res/ui-viewmgr.edj"
-#define GROUP "elm/layout/tizen_view/default"
+#include "../ui_viewmanager.h"
 
 namespace efl
 {
diff --git a/src/efl/mobile/ui_viewmanager.h b/src/efl/mobile/ui_viewmanager.h
new file mode 100644 (file)
index 0000000..a2a23b5
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ *
+ */
+#include <dlog.h>
+
+#ifdef  LOG_TAG
+#undef  LOG_TAG
+#endif
+#define LOG_TAG "UI_VIEWMGR"
+
+#include "ui_basic_key_listener.h"
+#include "ui_basic_view.h"
index 68369f540e5bff4e4a9310c33ff6e220573c78ed..4f168282fea7fcea06b9333d42a6608495ba8f0a 100644 (file)
  *  limitations under the License.
  *
  */
-#include "efl_viewmgr.h"
+#include "ui_viewmanager.h"
 
 using namespace efl;
 
 ui_view * ui_controller::get_view()
 {
-       ui_view_base *view = ui_controller_base::get_view();
+       ui_view_interface *view = ui_controller_interface::get_view();
        if (!view) return NULL;
        return dynamic_cast<ui_view *>(view);
 }
index 34149308a6b7fa789d719104000316cf4dc3e894..9228b10621a3d8e6791c520f8fa7b0448b4c4614 100644 (file)
  *  limitations under the License.
  *
  */
-#ifndef UI_CONTROLLER
-#define UI_CONTROLLER
+#ifndef UI_CONTROLLER_H
+#define UI_CONTROLLER_H
 
-#include <Elementary.h>
-#include "../interface/ui_viewmgr.h"
+#include "../interface/ui_viewmanager_interface.h"
 
 namespace efl
 {
-class ui_controller: public ui_controller_base
+class ui_controller: public ui_controller_interface
 {
 public:
        virtual ~ui_controller();
diff --git a/src/efl/ui_key_handler.cpp b/src/efl/ui_key_handler.cpp
deleted file mode 100644 (file)
index 797ea47..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.
- *
- */
-#include "ui_viewmgr.h"
-#include "ui_key_handler.h"
-
-using namespace efl;
-
-static const char *KEY_BACK = "XF86Back";
-
-enum ui_key_event_type
-{
-       UI_KEY_EVENT_BACK = 0,
-};
-
-ui_key_handler::ui_key_handler(ui_viewmgr *viewmgr)
-               : viewmgr(viewmgr), key_grabber(NULL)
-{
-
-}
-
-static void event_proc(ui_key_handler *key_handler, Evas_Event_Key_Down *ev)
-{
-   ui_key_event_type type;
-
-   if (!strcmp(ev->keyname, KEY_BACK))
-     type = UI_KEY_EVENT_BACK;
-   else return;
-
-   ui_viewmgr *viewmgr = key_handler->get_viewmgr();
-   if (!viewmgr->is_activated()) return;
-
-   //Get Top View
-   ui_view *view = reinterpret_cast<ui_view *>(viewmgr->get_last_view());
-   if (!view) return;
-
-   //call events
-   switch (type)
-   {
-   case UI_KEY_EVENT_BACK:
-          //view->back();
-          LOGE("BACK!");
-          break;
-   }
-}
-
-bool ui_key_handler::term()
-{
-       evas_object_del(this->key_grabber);
-       return true;
-}
-
-bool ui_key_handler::init()
-{
-       if (!this->viewmgr)
-       {
-               LOGE("No view manager??");
-               return false;
-       }
-
-       Evas *e = evas_object_evas_get(this->viewmgr->get_window());
-       if (!e)
-       {
-               LOGE("Failed to get Evas from window");
-               return false;
-       }
-
-       Evas_Object *key_grab_rect = evas_object_rectangle_add(e);
-       if (!key_grab_rect)
-       {
-               LOGE("Failed to create a key grabber rectangle");
-               return false;
-       }
-
-       evas_object_event_callback_add(key_grab_rect, EVAS_CALLBACK_KEY_UP,
-                       [](void *data, Evas *e, Evas_Object *obj, void *event_info) -> void
-                       {
-                               Evas_Event_Key_Down *ev = static_cast<Evas_Event_Key_Down *>(event_info);
-                               ui_key_handler *key_handler = static_cast<ui_key_handler *>(data);
-                               event_proc(key_handler, ev);
-                       },
-                       this);
-
-       if (!evas_object_key_grab(key_grab_rect, KEY_BACK, 0, 0, EINA_FALSE))
-       {
-            LOGE("Failed to grab BACK KEY(%s)\n", KEY_BACK);
-            evas_object_del(key_grab_rect);
-            return false;
-       }
-
-       this->key_grabber = key_grab_rect;
-
-       return true;
-}
diff --git a/src/efl/ui_key_handler.h b/src/efl/ui_key_handler.h
deleted file mode 100644 (file)
index 112cd94..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.
- *
- */
-#ifndef UI_KEY_HANDLER
-#define UI_KEY_HANDLER
-
-#include <Elementary.h>
-#include "../interface/ui_viewmgr.h"
-
-namespace efl
-{
-class ui_viewmgr;
-
-class ui_key_handler
-{
-protected:
-       ui_viewmgr *viewmgr;
-       Evas_Object *key_grabber;
-
-public:
-       ui_key_handler(ui_viewmgr *viewmgr);
-       virtual ~ui_key_handler() {}
-
-       virtual bool init();
-       virtual bool term();
-
-       ui_viewmgr *get_viewmgr() { return this->viewmgr; }
-};
-
-}
-
-#endif /* UI_KEY_HANDLER */
diff --git a/src/efl/ui_key_listener.cpp b/src/efl/ui_key_listener.cpp
new file mode 100644 (file)
index 0000000..ec33380
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ *
+ */
+#include "ui_viewmanager.h"
+
+using namespace efl;
+
+static const char *KEY_BACK = "XF86Back";
+
+enum ui_key_event_type
+{
+       UI_KEY_EVENT_BACK = 0,
+};
+
+ui_key_listener::ui_key_listener(ui_viewmgr *viewmgr)
+               : viewmgr(viewmgr), key_grabber(NULL)
+{
+
+}
+
+static void event_proc(ui_key_listener *key_handler, Evas_Event_Key_Down *ev)
+{
+   ui_key_event_type type;
+
+   if (!strcmp(ev->keyname, KEY_BACK))
+     type = UI_KEY_EVENT_BACK;
+   else return;
+
+   ui_viewmgr *viewmgr = key_handler->get_viewmgr();
+   if (!viewmgr->is_activated()) return;
+
+   //Get Top View
+   ui_view *view = reinterpret_cast<ui_view *>(viewmgr->get_last_view());
+   if (!view) return;
+
+   //call events
+   switch (type)
+   {
+   case UI_KEY_EVENT_BACK:
+          //view->back();
+          LOGE("BACK!");
+          break;
+   }
+}
+
+bool ui_key_listener::term()
+{
+       evas_object_del(this->key_grabber);
+       return true;
+}
+
+bool ui_key_listener::init()
+{
+       if (!this->viewmgr)
+       {
+               LOGE("No view manager??");
+               return false;
+       }
+
+       Evas *e = evas_object_evas_get(this->viewmgr->get_window());
+       if (!e)
+       {
+               LOGE("Failed to get Evas from window");
+               return false;
+       }
+
+       Evas_Object *key_grab_rect = evas_object_rectangle_add(e);
+       if (!key_grab_rect)
+       {
+               LOGE("Failed to create a key grabber rectangle");
+               return false;
+       }
+
+       evas_object_event_callback_add(key_grab_rect, EVAS_CALLBACK_KEY_UP,
+                       [](void *data, Evas *e, Evas_Object *obj, void *event_info) -> void
+                       {
+                               Evas_Event_Key_Down *ev = static_cast<Evas_Event_Key_Down *>(event_info);
+                               ui_key_listener *key_handler = static_cast<ui_key_listener *>(data);
+                               event_proc(key_handler, ev);
+                       },
+                       this);
+
+       if (!evas_object_key_grab(key_grab_rect, KEY_BACK, 0, 0, EINA_FALSE))
+       {
+            LOGE("Failed to grab BACK KEY(%s)\n", KEY_BACK);
+            evas_object_del(key_grab_rect);
+            return false;
+       }
+
+       this->key_grabber = key_grab_rect;
+
+       return true;
+}
diff --git a/src/efl/ui_key_listener.h b/src/efl/ui_key_listener.h
new file mode 100644 (file)
index 0000000..7d94ac5
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ *
+ */
+#ifndef UI_KEY_LISTENER_H
+#define UI_KEY_LISTENER_H
+
+#include <Elementary.h>
+#include "../interface/ui_viewmanager_interface.h"
+
+namespace efl
+{
+class ui_viewmgr;
+
+class ui_key_listener
+{
+protected:
+       ui_viewmgr *viewmgr;
+       Evas_Object *key_grabber;
+
+public:
+       ui_key_listener(ui_viewmgr *viewmgr);
+       virtual ~ui_key_listener() {}
+
+       virtual bool init();
+       virtual bool term();
+
+       ui_viewmgr *get_viewmgr() { return this->viewmgr; }
+};
+
+}
+
+#endif /* UI_KEY_LISTENER_H */
index 11b64fdffdb528b2d9b269a1719af2caf23f28ab..a14f74b12d8359888924161ad9c27d1fa0ec3ed8 100644 (file)
  *  limitations under the License.
  *
  */
-#include "efl_viewmgr.h"
+#include "ui_viewmanager.h"
 
 using namespace efl;
 
 ui_view::ui_view(ui_controller *controller, const char *name)
-               : ui_view_base(controller, name)
+               : ui_view_interface(controller, name)
 {
 }
 
@@ -29,13 +29,13 @@ ui_view::~ui_view()
 
 Evas_Object *ui_view::set_content(Evas_Object *content)
 {
-       T pcontent = ui_view_base::set_content(CONVERT_TO_T(content));
+       T pcontent = ui_view_interface::set_content(CONVERT_TO_T(content));
        return static_cast<Evas_Object *>(pcontent);
 }
 
 Evas_Object *ui_view::get_base()
 {
-       ui_viewmgr *viewmgr = dynamic_cast<ui_viewmgr *>(ui_view_base::get_viewmgr());
+       ui_viewmgr *viewmgr = dynamic_cast<ui_viewmgr *>(ui_view_interface::get_viewmgr());
        if (!viewmgr)
        {
                return NULL;
@@ -43,16 +43,6 @@ Evas_Object *ui_view::get_base()
        return viewmgr->get_base();
 }
 
-void ui_view::load()
-{
-       ui_view_base::load();
-}
-
-void ui_view::unload()
-{
-       ui_view_base::unload();
-}
-
 void ui_view::unload_content()
 {
        Evas_Object *pcontent = this->set_content(NULL);
@@ -69,7 +59,7 @@ void ui_view::set_indicator(ui_view_indicator indicator)
 {
        if (this->get_indicator() == indicator) return;
 
-       ui_view_base::set_indicator(indicator);
+       ui_view_interface::set_indicator(indicator);
 
        ui_viewmgr *viewmgr = dynamic_cast<ui_viewmgr *>(this->get_viewmgr());
 
index df0fd13702d3f1455a5a7131e3f679f12f4fa5e4..6a16b5c57e68bc9ef4753d186a2eb320f867ed2d 100644 (file)
  *  limitations under the License.
  *
  */
-#ifndef UI_VIEW
-#define UI_VIEW
+#ifndef UI_VIEW_H
+#define UI_VIEW_H
 
 #include <Elementary.h>
-#include "../interface/ui_viewmgr.h"
+#include "../interface/ui_viewmanager_interface.h"
 
 #define CONVERT_TO_EO(T) static_cast<Evas_Object *>((T))
 #define CONVERT_TO_T(EO) static_cast<T>((EO))
@@ -27,7 +27,7 @@ namespace efl
 {
 class ui_controller;
 
-class ui_view: public ui_view_base
+class ui_view: public ui_view_interface
 {
        friend class ui_viewmgr;
 
@@ -41,12 +41,10 @@ public:
        void set_indicator(ui_view_indicator indicator);
 
 protected:
-       virtual void load();
-       virtual void unload();
        virtual void unload_content();
        Evas_Object *get_parent();
 };
 
 }
 
-#endif /* UI_VIEW */
+#endif /* UI_VIEW_H */
diff --git a/src/efl/ui_viewmanager.h b/src/efl/ui_viewmanager.h
new file mode 100644 (file)
index 0000000..ed2e034
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ *
+ */
+#include <dlog.h>
+
+#ifdef  LOG_TAG
+#undef  LOG_TAG
+#endif
+#define LOG_TAG "UI_VIEWMGR"
+
+#include "ui_viewmgr.h"
+#include "ui_controller.h"
+#include "ui_view.h"
+#include "ui_key_listener.h"
+
index 67ff19d83763eac56e9d679e1c4dd0cc0912dffc..20caf98d868785cf6bf1a1998e315752ca50ba33 100644 (file)
@@ -14,7 +14,7 @@
  *  limitations under the License.
  *
  */
-#include "efl_viewmgr.h"
+#include "ui_viewmanager.h"
 
 using namespace efl;
 
@@ -79,7 +79,7 @@ bool ui_viewmgr::create_base_layout(Evas_Object *conform)
 }
 
 ui_viewmgr::ui_viewmgr(const char *pkg)
-               : ui_viewmgr_base(), key_handler(NULL)
+               : ui_viewmgr_interface(), key_listener(NULL)
 {
        if (!pkg)
        {
@@ -133,23 +133,23 @@ ui_viewmgr::ui_viewmgr(const char *pkg)
 
        elm_win_autodel_set(this->win, EINA_TRUE);
 
-       this->set_key_handler();
+       this->set_key_listener();
 }
 
 ui_viewmgr::~ui_viewmgr()
 {
-       this->key_handler->term();
+       this->key_listener->term();
 }
 
-void ui_viewmgr::set_key_handler()
+void ui_viewmgr::set_key_listener()
 {
-       this->key_handler = new ui_key_handler(this);
-       this->key_handler->init();
+       this->key_listener = new ui_key_listener(this);
+       this->key_listener->init();
 }
 
 bool ui_viewmgr::activate()
 {
-       ui_viewmgr_base::activate();
+       ui_viewmgr_interface::activate();
 
        elm_object_part_content_unset(this->get_base(), "elm.swallow.content");
 
@@ -176,7 +176,7 @@ bool ui_viewmgr::activate()
 
 bool ui_viewmgr::deactivate()
 {
-       ui_viewmgr_base::deactivate();
+       ui_viewmgr_interface::deactivate();
 
        //FIXME: based on the profile, we should app to go behind or terminate.
        if (true)
@@ -197,7 +197,7 @@ bool ui_viewmgr::deactivate()
 bool ui_viewmgr::pop_view()
 {
        if (this->get_view_count() == 1) this->deactivate();
-       else if(!ui_viewmgr_base::pop_view()) return false;
+       else if(!ui_viewmgr_interface::pop_view()) return false;
 
        ui_view *view = dynamic_cast<ui_view *>(this->get_last_view());
 
@@ -220,7 +220,7 @@ bool ui_viewmgr::pop_view()
 ui_view *
 ui_viewmgr::push_view(ui_view *view)
 {
-       ui_viewmgr_base::push_view(view);
+       ui_viewmgr_interface::push_view(view);
 
        //Don't prepare yet if viewmgr is not activated.
        if (!this->is_activated()) return view;
index ba40d3634e6a36752345eb3379e141780af489bf..2a9c23a75d5a47336e3469d9b2af4e148fd62e3d 100644 (file)
  *  limitations under the License.
  *
  */
-#ifndef UI_VIEWMGR
-#define UI_VIEWMGR
+#ifndef UI_VIEWMGR_H
+#define UI_VIEWMGR_H
 
 #include <Elementary.h>
-#include "../interface/ui_viewmgr.h"
-#include "ui_key_handler.h"
+#include "../interface/ui_viewmanager_interface.h"
+#include "ui_key_listener.h"
 
 namespace efl
 {
 
 class ui_view;
 
-class ui_viewmgr: public ui_viewmgr_base
+class ui_viewmgr: public ui_viewmgr_interface
 {
        friend class ui_view;
 
@@ -34,13 +34,13 @@ private:
        Evas_Object *win;
        Evas_Object *conform;
        Evas_Object *layout;
-       ui_key_handler *key_handler;   //HW Key Handler such as "BACK" key...
+       ui_key_listener *key_listener;   //HW Key Handler such as "BACK" key...
        ui_view_indicator indicator;
 
        bool create_conformant(Evas_Object *win);
        bool create_base_layout(Evas_Object *conform);
        bool set_indicator(ui_view_indicator indicator);
-       virtual void set_key_handler();
+       virtual void set_key_listener();
 
 protected:
        Evas_Object *get_base()
@@ -69,4 +69,4 @@ public:
 };
 }
 
-#endif /* UI_VIEWMGR */
+#endif /* UI_VIEWMGR_H */
diff --git a/src/interface/ui_controller_base.cpp b/src/interface/ui_controller_base.cpp
deleted file mode 100644 (file)
index 84aa2b9..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- *
- */
-#include "ui_viewmgr.h"
-
-void ui_controller_base::set_view(ui_view_base *view)
-{
-       if (this->view)
-       {
-               this->view->set_controller(NULL);
-       }
-       this->view = view;
-}
diff --git a/src/interface/ui_controller_base.h b/src/interface/ui_controller_base.h
deleted file mode 100644 (file)
index 907ff2f..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.
- *
- */
-#ifndef UI_CONTROLLER_BASE_H_
-#define UI_CONTROLLER_BASE_H_
-
-class ui_view_base;
-
-/**
- *  @class ui_controller_base
- *
- *  @ingroup ui_viewmgr
- *
- *  @brief UI Controller Interface. This interface is designed for handling of life-cycle events from user side.
- *
- *  @date 2016/01/15
- *  @author Hermet Park <chuneon.park@samsung.com>
- *
- */
-class ui_controller_base
-{
-       friend class ui_view_base;
-
-private:
-       ui_view_base *view;
-
-       void set_view(ui_view_base *view);
-
-protected:
-       ui_view_base *get_view()
-       {
-               return this->view;
-       }
-
-public:
-       ui_controller_base() :
-                       view(NULL)
-       {
-       }
-       virtual ~ui_controller_base()
-       {
-       }
-
-       /** @brief load callback
-        *
-        *  @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;
-
-       /** @brief unload callback
-        *
-        *  @note Remove resources with regards to this view for saving memory or keep the content for performance. It's up to your scenario.
-        *        Unload will be called just right before when the view is going to be deleted by popping or it's piled under the more than one view.
-        *        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;
-
-       /** @brief active callback
-        *
-        *  @note View is on active state after show transition is finished.
-        *        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;
-
-       /** @brief inactive callback
-        *
-        *  @note View is on inactive state. Get ready for unload. Hide transition may be triggered at this point.
-        *        Inactive state is triggered on this scenario that the view is still visible but it's not interactive with users.
-        *        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;
-
-       /** @brief pause callback
-        *
-        *  @note When the system blocks the application running in cases such as phone call, system notification, switching applications ...
-        *        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;
-
-       /** @brief resume callback
-        *
-        *  @note View is turning back to the active state again from pause.
-        *        When the system allows the application turns to activate.
-        *        When the Window turns to activate. (@see ui_viewmgr_base :: activate())
-        */
-       virtual void resume() = 0;
-
-       /** @brief destroy callback
-        *
-        *  @note When this view is on destroying by popping or deleting.
-        */
-       virtual void destroy() = 0;
-};
-
-#endif /* UI_CONTROLLER_BASE_H_ */
diff --git a/src/interface/ui_controller_interface.cpp b/src/interface/ui_controller_interface.cpp
new file mode 100644 (file)
index 0000000..c62bf20
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ *
+ */
+#include "ui_viewmanager_interface.h"
+
+void ui_controller_interface::set_view(ui_view_interface *view)
+{
+       if (this->view)
+       {
+               this->view->set_controller(NULL);
+       }
+       this->view = view;
+}
diff --git a/src/interface/ui_controller_interface.h b/src/interface/ui_controller_interface.h
new file mode 100644 (file)
index 0000000..28ea496
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * 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.
+ *
+ */
+#ifndef UI_CONTROLLER_INTERFACE_H_
+#define UI_CONTROLLER_INTERFACE_H_
+
+class ui_view_interface;
+
+/**
+ *  @class ui_controller_base
+ *
+ *  @ingroup ui_viewmgr
+ *
+ *  @brief UI Controller Interface. This interface is designed for handling of life-cycle events from user side.
+ *
+ *  @date 2016/01/15
+ *  @author Hermet Park <chuneon.park@samsung.com>
+ *
+ */
+class ui_controller_interface
+{
+       friend class ui_view_interface;
+
+private:
+       ui_view_interface *view;
+
+       void set_view(ui_view_interface *view);
+
+protected:
+       ui_view_interface *get_view()
+       {
+               return this->view;
+       }
+
+public:
+       ui_controller_interface() :
+                       view(NULL)
+       {
+       }
+       virtual ~ui_controller_interface()
+       {
+       }
+
+       /** @brief load callback
+        *
+        *  @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;
+
+       /** @brief unload callback
+        *
+        *  @note Remove resources with regards to this view for saving memory or keep the content for performance. It's up to your scenario.
+        *        Unload will be called just right before when the view is going to be deleted by popping or it's piled under the more than one view.
+        *        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;
+
+       /** @brief active callback
+        *
+        *  @note View is on active state after show transition is finished.
+        *        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;
+
+       /** @brief inactive callback
+        *
+        *  @note View is on inactive state. Get ready for unload. Hide transition may be triggered at this point.
+        *        Inactive state is triggered on this scenario that the view is still visible but it's not interactive with users.
+        *        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;
+
+       /** @brief pause callback
+        *
+        *  @note When the system blocks the application running in cases such as phone call, system notification, switching applications ...
+        *        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;
+
+       /** @brief resume callback
+        *
+        *  @note View is turning back to the active state again from pause.
+        *        When the system allows the application turns to activate.
+        *        When the Window turns to activate. (@see ui_viewmgr_base :: activate())
+        */
+       virtual void resume() = 0;
+
+       /** @brief destroy callback
+        *
+        *  @note When this view is on destroying by popping or deleting.
+        */
+       virtual void destroy() = 0;
+};
+
+#endif /* UI_CONTROLLER_INTERFACE_H_ */
diff --git a/src/interface/ui_view_base.cpp b/src/interface/ui_view_base.cpp
deleted file mode 100644 (file)
index f708ec9..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.
- *
- */
-#include "ui_viewmgr.h"
-
-void ui_view_base::set_event_block(bool block)
-{
-       this->event_block = block;
-}
-
-void ui_view_base::load()
-{
-       this->state = UI_VIEW_STATE_LOAD;
-       if (this->content) return;
-       if (!this->controller) return;
-       this->controller->load();
-}
-
-void ui_view_base::unload()
-{
-       this->state = UI_VIEW_STATE_UNLOAD;
-       if (this->get_removable_content())
-       {
-               this->unload_content();
-               return;
-       }
-       if (!this->content) return;
-       if (!this->controller) return;
-       this->controller->unload();
-}
-
-void ui_view_base::active()
-{
-       this->state = UI_VIEW_STATE_ACTIVE;
-       if (!this->controller) return;
-       this->controller->active();
-}
-
-void ui_view_base::inactive()
-{
-       this->state = UI_VIEW_STATE_INACTIVE;
-       if (!this->controller) return;
-       this->controller->inactive();
-}
-
-void ui_view_base::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();
-}
-
-void ui_view_base::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();
-}
-
-void ui_view_base::destroy()
-{
-       if (!this->controller) return;
-       this->controller->destroy();
-}
-
-ui_view_base::ui_view_base(T content, ui_controller_base *controller, const char *name)
-               : content(content), controller(controller), name(string(name ? name : "")), style(string("")), viewmgr(NULL), state(UI_VIEW_STATE_LOAD),
-                 indicator(UI_VIEW_INDICATOR_DEFAULT), event_block(false), removable_content(true)
-{
-       if (!content) this->state = UI_VIEW_STATE_UNLOAD;
-       else this->state = UI_VIEW_STATE_LOAD;
-       controller->set_view(this);
-}
-
-ui_view_base::ui_view_base(ui_controller_base *controller, const char *name)
-               : ui_view_base(NULL, controller, name)
-{
-       this->state = UI_VIEW_STATE_UNLOAD;
-}
-
-ui_view_base::ui_view_base(const char *name)
-               : ui_view_base(NULL, name)
-{
-
-}
-
-ui_view_base::~ui_view_base()
-{
-       this->viewmgr->remove_view(this);
-       if (this->controller) delete (this->controller);
-}
-
-ui_controller_base* ui_view_base::set_controller(ui_controller_base *controller)
-{
-       ui_controller_base *prev_controller = this->controller;
-       this->controller = controller;
-       if (controller) controller->set_view(this);
-       if (prev_controller) prev_controller->set_view(NULL);
-       return prev_controller;
-}
-
-T ui_view_base::set_content(T content)
-{
-       T prev = this->content;
-       this->content = content;
-       return prev;
-}
-
-bool ui_view_base::set_style(const char *style)
-{
-       this->style.assign(style);
-       return true;
-}
-
-void ui_view_base::set_removable_content(bool removable)
-{
-       this->removable_content = removable;
-
-       //FIXME: If this api is called on unload state? should we remove content right now?
-}
-
-void ui_view_base::set_indicator(ui_view_indicator indicator)
-{
-       this->indicator = indicator;
-}
diff --git a/src/interface/ui_view_base.h b/src/interface/ui_view_base.h
deleted file mode 100644 (file)
index 08caea0..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * 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.
- *
- */
-#ifndef UI_VIEW_BASE_H_
-#define UI_VIEW_BASE_H_
-
-#include <string>
-
-typedef void* T;
-
-class ui_viewmgr_base;
-class ui_controller_base;
-
-/**
- *  @class ui_view_base
- *
- *  @ingroup ui_viewmgr
- *
- *     @brief UI View Base Class. This is the base class of view. A view must have one content instance which represents a view for a current screen.
- *            UI View may have it's own show/hide transition styles. That means, it's available that views have different show/hide effects on demands.
- *            It's not mandatory but view should describe the transitions in this class.
- *
- *     @warning When the transitions are finished, the view must to call ui_viewmgr_base :: _push_finished(), ui_viewmgr_base :: _pop_finished() in order that
- *              The ui_viewmgr_base keeps the view states exactly.
- *
- *     @date 2016/01/15
- *     @author Hermet Park <chuneon.park@samsung.com>
- */
-class ui_view_base
-{
-       friend class ui_viewmgr_base;
-       friend class ui_controller_base;
-
-private:
-       /// View state definition
-       enum ui_view_state
-       {
-               UI_VIEW_STATE_LOAD = 0,        ///< Load state
-               UI_VIEW_STATE_UNLOAD,          ///< Unload state
-               UI_VIEW_STATE_ACTIVE,          ///< Active state
-               UI_VIEW_STATE_INACTIVE,        ///< Inactive state
-               UI_VIEW_STATE_PAUSE,           ///< Pause state
-               UI_VIEW_STATE_LAST
-       };
-
-       T content;                              ///< A content instance for a screen as a view.
-       ui_controller_base *controller;         ///< View life-cycle controller interface.
-       std::string name;                       ///< View name
-       std::string style;                      ///< View style name.
-       ui_viewmgr_base *viewmgr;               ///< Viewmgr which this view belongs to.
-       ui_view_state state;                    ///< View state
-       ui_view_indicator indicator;            ///< View indicator mode
-       bool event_block;                       ///< State of event block.
-       bool removable_content;                 ///< When this value is true, view removes it's content internally on unload state.
-
-protected:
-
-       /** @brief toggle event block
-        *
-        *  @note This interface is designed for toggling touch event on view transition.
-        *        ui_viewmgr_base will call this interface for notifying event blocking toggling on transition time.
-        *
-        *  @param block @c true, when blocking is enabled, otherwise @c false.
-        *
-        */
-       virtual void set_event_block(bool block);
-
-       /** @brief view load state
-        *
-        *  @note this state will be triggered by ui_viewmgr_base
-        *
-        *  @see ui_controller_base for this state in detail.
-        */
-       virtual void load();
-
-       /** @brief view unload state
-        *
-        *  @note this state will be triggered by ui_viewmgr_base
-        *
-        *  @see ui_controller_base for this state in detail.
-        */
-       virtual void unload();
-
-       /** @brief view active state
-        *
-        *  @note this state will be triggered by ui_viewmgr_base
-        *
-        *  @see ui_controller_base for this state in detail.
-        */
-       virtual void active();
-
-       /** @brief view inactive state
-        *
-        *  @note this state will be triggered by ui_viewmgr_base
-        *
-        *  @see ui_controller_base for this state in detail.
-        */
-       virtual void inactive();
-
-       /** @brief view pause state
-        *
-        *  @note this state will be triggered by ui_viewmgr_base
-        *
-        *  @see ui_controller_base for this state in detail.
-        */
-       virtual void pause();
-
-       /** @brief view resume state
-        *
-        *  @note this state will be triggered by ui_viewmgr_base
-        *
-        *  @see ui_controller_base for this state in detail.
-        */
-       virtual void resume();
-
-       /** @brief view destroy state
-        *
-        *  @note this state will be triggered by ui_viewmgr_base
-        *
-        *  @see ui_controller_base for this state in detail.
-        */
-       virtual void destroy();
-
-       virtual void unload_content() = 0;
-
-       /// Return the state of event block.
-       bool get_event_block()
-       {
-               return this->event_block;
-       }
-
-       /// Return a controller of this view.
-       const ui_controller_base* get_controller()
-       {
-               return this->controller;
-       }
-
-       /// Return a viewmgr which this view is belonging to
-       ui_viewmgr_base *get_viewmgr()
-       {
-               return this->viewmgr;
-       }
-
-       /** @brief This is for replacing or setting a controller of the view.
-        *
-        *  @param controller a new controller. It allows @c NULL for canceling the previous controller.
-        *  @return A previous controller. If it wasn't, the return value will be @c NULL
-        *
-        *  @warning Be aware deletion of controller passed here will be taken cover by ui_view_base.
-        *           If you want to keep the controller for any reasons, please unset it using set_controller() before ui_view_base is deleted.
-        */
-       ui_controller_base* set_controller(ui_controller_base *controller);
-
-public:
-       /** @brief This is a constructor for initializing this view resources.
-        *
-        *  @param content A content instance for a screen as a view.
-        *  @param controller view life-cycle controller interface.
-        *  @param name view name.
-        *
-        *  @warning Be aware the deletion of controller passed here will be covered by ui_view_base.
-        *           If you want to keep it for any reasons, please unset it using set_controller() before ui_view_base is deleted.
-        */
-       ui_view_base(T content, ui_controller_base *controller, const char *name);
-       ///Constructor for initializing with controller.
-       ui_view_base(ui_controller_base *controller, const char *name = NULL);
-       ///Constructor for initializing with name.
-       ui_view_base(const char *name = NULL);
-
-       ///Destructor for terminating view.
-       virtual ~ui_view_base();
-
-       /** @brief This is for replacing or setting a content of the view.
-        *
-        *  @note @p content is a logical object that represents a view in your framework. The actual type of the content could be translated to any certain types.
-        *        For instance, the type could be Evas_Object * in EFL and Layer * in Dali.
-        *
-        *  @param content a new content. It allows @c NULL for canceling the previous content.
-        *  @return A previous content. If it wasn't, return value will be @c NULL
-        */
-       T set_content(T content);
-
-       /** @brief set style of the view.
-        *
-        *  @note style is reserved for supporting various kinds of view as well as it's transition effects.
-        *        The actual behaviors with this style is up to your frameworks. Default value of the style is NULL.
-        *
-        *  @param style a new style name.
-        *  @return true if the given @c style is available, otherwise false.
-        *
-        *  @warning When you override this member function, you should implement the logic to check the given style name is available or not.
-        *           If your framework doesn't support any styles then just allow a @c NULL argument and return true. Otherwise return false.
-        *
-        */
-       bool set_style(const char *style);
-
-       /** @brief set content removable
-        *
-        *  @param removable if @p removable is @c true, content of this view will be removed on unload state. @c false otherwise.
-        *
-        *  @warning You should not remove a view content manually on unload status if removable content is set.
-        *
-        */
-       void set_removable_content(bool removable);
-
-       void set_indicator(ui_view_indicator indicator);
-
-       /// Return a style name of this view.
-       const char *get_style()
-       {
-               return this->style.c_str();
-       }
-
-       const char *get_name()
-       {
-               return this->name.c_str();
-       }
-
-       /// Return the content instance of this view.
-       T get_content()
-       {
-               return this->content;
-       }
-
-       /// Return the state of this view.
-       ui_view_state get_state()
-       {
-               return this->state;
-       }
-       /// Return the state of removeable content.
-       bool get_removable_content()
-       {
-               return this->removable_content;
-       }
-
-       /// Return the indicator mode of this view.
-       ui_view_indicator get_indicator()
-       {
-               return this->indicator;
-       }
-};
-
-#endif /* UI_VIEW_BASE_H_ */
diff --git a/src/interface/ui_view_interface.cpp b/src/interface/ui_view_interface.cpp
new file mode 100644 (file)
index 0000000..fad60b2
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+ * 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.
+ *
+ */
+#include "ui_viewmanager_interface.h"
+
+void ui_view_interface::set_event_block(bool block)
+{
+       this->event_block = block;
+}
+
+void ui_view_interface::load()
+{
+       this->state = UI_VIEW_STATE_LOAD;
+       if (this->content) return;
+       if (!this->controller) return;
+       this->controller->load();
+}
+
+void ui_view_interface::unload()
+{
+       this->state = UI_VIEW_STATE_UNLOAD;
+       if (this->get_removable_content())
+       {
+               this->unload_content();
+               return;
+       }
+       if (!this->content) return;
+       if (!this->controller) return;
+       this->controller->unload();
+}
+
+void ui_view_interface::active()
+{
+       this->state = UI_VIEW_STATE_ACTIVE;
+       if (!this->controller) return;
+       this->controller->active();
+}
+
+void ui_view_interface::inactive()
+{
+       this->state = UI_VIEW_STATE_INACTIVE;
+       if (!this->controller) return;
+       this->controller->inactive();
+}
+
+void ui_view_interface::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();
+}
+
+void ui_view_interface::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();
+}
+
+void ui_view_interface::destroy()
+{
+       if (!this->controller) return;
+       this->controller->destroy();
+}
+
+ui_view_interface::ui_view_interface(T content, ui_controller_interface *controller, const char *name)
+               : content(content), controller(controller), name(string(name ? name : "")), style(string("")), viewmgr(NULL), state(UI_VIEW_STATE_LOAD),
+                 indicator(UI_VIEW_INDICATOR_DEFAULT), event_block(false), removable_content(true)
+{
+       if (!content) this->state = UI_VIEW_STATE_UNLOAD;
+       else this->state = UI_VIEW_STATE_LOAD;
+       controller->set_view(this);
+}
+
+ui_view_interface::ui_view_interface(ui_controller_interface *controller, const char *name)
+               : ui_view_interface(NULL, controller, name)
+{
+       this->state = UI_VIEW_STATE_UNLOAD;
+}
+
+ui_view_interface::ui_view_interface(const char *name)
+               : ui_view_interface(NULL, name)
+{
+
+}
+
+ui_view_interface::~ui_view_interface()
+{
+       this->viewmgr->remove_view(this);
+       if (this->controller) delete (this->controller);
+}
+
+ui_controller_interface* ui_view_interface::set_controller(ui_controller_interface *controller)
+{
+       ui_controller_interface *prev_controller = this->controller;
+       this->controller = controller;
+       if (controller) controller->set_view(this);
+       if (prev_controller) prev_controller->set_view(NULL);
+       return prev_controller;
+}
+
+T ui_view_interface::set_content(T content)
+{
+       T prev = this->content;
+       this->content = content;
+       return prev;
+}
+
+bool ui_view_interface::set_style(const char *style)
+{
+       this->style.assign(style);
+       return true;
+}
+
+void ui_view_interface::set_removable_content(bool removable)
+{
+       this->removable_content = removable;
+
+       //FIXME: If this api is called on unload state? should we remove content right now?
+}
+
+void ui_view_interface::set_indicator(ui_view_indicator indicator)
+{
+       this->indicator = indicator;
+}
diff --git a/src/interface/ui_view_interface.h b/src/interface/ui_view_interface.h
new file mode 100644 (file)
index 0000000..8d10364
--- /dev/null
@@ -0,0 +1,258 @@
+/*
+ * 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.
+ *
+ */
+#ifndef UI_VIEW_INTERFACE_H_
+#define UI_VIEW_INTERFACE_H_
+
+#include <string>
+
+using namespace std;
+
+typedef void* T;
+
+class ui_viewmgr_interface;
+class ui_controller_interface;
+
+/**
+ *  @class ui_view_interface
+ *
+ *  @ingroup ui_viewmgr
+ *
+ *     @brief UI View Base Class. This is the base class of view. A view must have one content instance which represents a view for a current screen.
+ *            UI View may have it's own show/hide transition styles. That means, it's available that views have different show/hide effects on demands.
+ *            It's not mandatory but view should describe the transitions in this class.
+ *
+ *     @warning When the transitions are finished, the view must to call ui_viewmgr_interface :: _push_finished(), ui_viewmgr_interface :: _pop_finished() in order that
+ *              The ui_viewmgr_interface keeps the view states exactly.
+ *
+ *     @date 2016/01/15
+ *     @author Hermet Park <chuneon.park@samsung.com>
+ */
+class ui_view_interface
+{
+       friend class ui_viewmgr_interface;
+       friend class ui_controller_interface;
+
+private:
+       /// View state definition
+       enum ui_view_state
+       {
+               UI_VIEW_STATE_LOAD = 0,        ///< Load state
+               UI_VIEW_STATE_UNLOAD,          ///< Unload state
+               UI_VIEW_STATE_ACTIVE,          ///< Active state
+               UI_VIEW_STATE_INACTIVE,        ///< Inactive state
+               UI_VIEW_STATE_PAUSE,           ///< Pause state
+               UI_VIEW_STATE_LAST
+       };
+
+       T content;                              ///< A content instance for a screen as a view.
+       ui_controller_interface *controller;         ///< View life-cycle controller interface.
+       string name;                                       ///< View name
+       string style;                                      ///< View style name.
+       ui_viewmgr_interface *viewmgr;               ///< Viewmgr which this view belongs to.
+       ui_view_state state;                    ///< View state
+       ui_view_indicator indicator;            ///< View indicator mode
+       bool event_block;                       ///< State of event block.
+       bool removable_content;                 ///< When this value is true, view removes it's content internally on unload state.
+
+protected:
+
+       /** @brief toggle event block
+        *
+        *  @note This interface is designed for toggling touch event on view transition.
+        *        ui_viewmgr_interface will call this interface for notifying event blocking toggling on transition time.
+        *
+        *  @param block @c true, when blocking is enabled, otherwise @c false.
+        *
+        */
+       virtual void set_event_block(bool block);
+
+       /** @brief view load state
+        *
+        *  @note this state will be triggered by ui_viewmgr_interface
+        *
+        *  @see ui_controller_interface for this state in detail.
+        */
+       virtual void load();
+
+       /** @brief view unload state
+        *
+        *  @note this state will be triggered by ui_viewmgr_interface
+        *
+        *  @see ui_controller_interface for this state in detail.
+        */
+       virtual void unload();
+
+       /** @brief view active state
+        *
+        *  @note this state will be triggered by ui_viewmgr_interface
+        *
+        *  @see ui_controller_interface for this state in detail.
+        */
+       virtual void active();
+
+       /** @brief view inactive state
+        *
+        *  @note this state will be triggered by ui_viewmgr_interface
+        *
+        *  @see ui_controller_interface for this state in detail.
+        */
+       virtual void inactive();
+
+       /** @brief view pause state
+        *
+        *  @note this state will be triggered by ui_viewmgr_interface
+        *
+        *  @see ui_controller_interface for this state in detail.
+        */
+       virtual void pause();
+
+       /** @brief view resume state
+        *
+        *  @note this state will be triggered by ui_viewmgr_interface
+        *
+        *  @see ui_controller_interface for this state in detail.
+        */
+       virtual void resume();
+
+       /** @brief view destroy state
+        *
+        *  @note this state will be triggered by ui_viewmgr_interface
+        *
+        *  @see ui_controller_interface for this state in detail.
+        */
+       virtual void destroy();
+
+       virtual void unload_content() = 0;
+
+       /// Return the state of event block.
+       bool get_event_block()
+       {
+               return this->event_block;
+       }
+
+       /// Return a controller of this view.
+       const ui_controller_interface* get_controller()
+       {
+               return this->controller;
+       }
+
+       /// Return a viewmgr which this view is belonging to
+       ui_viewmgr_interface *get_viewmgr()
+       {
+               return this->viewmgr;
+       }
+
+       /** @brief This is for replacing or setting a controller of the view.
+        *
+        *  @param controller a new controller. It allows @c NULL for canceling the previous controller.
+        *  @return A previous controller. If it wasn't, the return value will be @c NULL
+        *
+        *  @warning Be aware deletion of controller passed here will be taken cover by ui_view_interface.
+        *           If you want to keep the controller for any reasons, please unset it using set_controller() before ui_view_interface is deleted.
+        */
+       ui_controller_interface* set_controller(ui_controller_interface *controller);
+
+public:
+       /** @brief This is a constructor for initializing this view resources.
+        *
+        *  @param content A content instance for a screen as a view.
+        *  @param controller view life-cycle controller interface.
+        *  @param name view name.
+        *
+        *  @warning Be aware the deletion of controller passed here will be covered by ui_view_interface.
+        *           If you want to keep it for any reasons, please unset it using set_controller() before ui_view_interface is deleted.
+        */
+       ui_view_interface(T content, ui_controller_interface *controller, const char *name);
+       ///Constructor for initializing with controller.
+       ui_view_interface(ui_controller_interface *controller, const char *name = NULL);
+       ///Constructor for initializing with name.
+       ui_view_interface(const char *name = NULL);
+
+       ///Destructor for terminating view.
+       virtual ~ui_view_interface();
+
+       /** @brief This is for replacing or setting a content of the view.
+        *
+        *  @note @p content is a logical object that represents a view in your framework. The actual type of the content could be translated to any certain types.
+        *        For instance, the type could be Evas_Object * in EFL and Layer * in Dali.
+        *
+        *  @param content a new content. It allows @c NULL for canceling the previous content.
+        *  @return A previous content. If it wasn't, return value will be @c NULL
+        */
+       T set_content(T content);
+
+       /** @brief set style of the view.
+        *
+        *  @note style is reserved for supporting various kinds of view as well as it's transition effects.
+        *        The actual behaviors with this style is up to your frameworks. Default value of the style is NULL.
+        *
+        *  @param style a new style name.
+        *  @return true if the given @c style is available, otherwise false.
+        *
+        *  @warning When you override this member function, you should implement the logic to check the given style name is available or not.
+        *           If your framework doesn't support any styles then just allow a @c NULL argument and return true. Otherwise return false.
+        *
+        */
+       bool set_style(const char *style);
+
+       /** @brief set content removable
+        *
+        *  @param removable if @p removable is @c true, content of this view will be removed on unload state. @c false otherwise.
+        *
+        *  @warning You should not remove a view content manually on unload status if removable content is set.
+        *
+        */
+       void set_removable_content(bool removable);
+
+       void set_indicator(ui_view_indicator indicator);
+
+       /// Return a style name of this view.
+       const char *get_style()
+       {
+               return this->style.c_str();
+       }
+
+       const char *get_name()
+       {
+               return this->name.c_str();
+       }
+
+       /// Return the content instance of this view.
+       T get_content()
+       {
+               return this->content;
+       }
+
+       /// Return the state of this view.
+       ui_view_state get_state()
+       {
+               return this->state;
+       }
+       /// Return the state of removeable content.
+       bool get_removable_content()
+       {
+               return this->removable_content;
+       }
+
+       /// Return the indicator mode of this view.
+       ui_view_indicator get_indicator()
+       {
+               return this->indicator;
+       }
+};
+
+#endif /* UI_VIEW_INTERFACE_H_ */
diff --git a/src/interface/ui_viewmanager_interface.h b/src/interface/ui_viewmanager_interface.h
new file mode 100644 (file)
index 0000000..67fdd79
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ *
+ */
+#ifndef UI_VIEWMANAGER_INTERFACE_H_
+#define UI_VIEWMANAGER_INTERFACE_H_
+
+#include <app.h>
+#include <dlog.h>
+
+#ifdef  LOG_TAG
+#undef  LOG_TAG
+#endif
+#define LOG_TAG "UI_VIEWMGR"
+
+enum ui_view_indicator
+{
+       UI_VIEW_INDICATOR_DEFAULT = 0,
+       UI_VIEW_INDICATOR_OPTIMAL,
+       UI_VIEW_INDICATOR_OVERLAP,
+       UI_VIEW_INDICATOR_HIDE,
+       UI_VIEW_INDICATOR_LAST
+};
+
+#include "ui_viewmgr_interface.h"
+#include "ui_view_interface.h"
+#include "ui_controller_interface.h"
+
+#endif /* UI_VIEWMANAGER_INTERFACE_H */
diff --git a/src/interface/ui_viewmgr.h b/src/interface/ui_viewmgr.h
deleted file mode 100644 (file)
index cc56ba2..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.
- *
- */
-#ifndef UI_VIEWMGR_H_
-#define UI_VIEWMGR_H_
-
-#include <app.h>
-#include <dlog.h>
-
-#ifdef  LOG_TAG
-#undef  LOG_TAG
-#endif
-#define LOG_TAG "VIEWMGR"
-
-enum ui_view_indicator
-{
-       UI_VIEW_INDICATOR_DEFAULT = 0,
-       UI_VIEW_INDICATOR_OPTIMAL,
-       UI_VIEW_INDICATOR_OVERLAP,
-       UI_VIEW_INDICATOR_HIDE,
-       UI_VIEW_INDICATOR_LAST
-};
-
-#include "ui_viewmgr_base.h"
-#include "ui_view_base.h"
-#include "ui_controller_base.h"
-
-
-#endif /* UI_VIEWMGR_H */
diff --git a/src/interface/ui_viewmgr_base.cpp b/src/interface/ui_viewmgr_base.cpp
deleted file mode 100644 (file)
index afc835d..0000000
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * 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.
- *
- */
-#include "ui_viewmgr.h"
-
-bool ui_viewmgr_base::connect_view(ui_view_base *view)
-{
-       if (view->viewmgr)
-       {
-               LOGE("view(%p) has already connected to viewmgr(%p)", view, this);
-               return false;
-       }
-
-       view->viewmgr = this;
-       return true;
-}
-
-bool ui_viewmgr_base::disconnect_view(ui_view_base *view)
-{
-       if (!view->viewmgr) return false;
-       view->viewmgr = NULL;
-       return true;
-}
-
-void ui_viewmgr_base::set_event_block(ui_view_base *view, bool block)
-{
-
-       if (!this->event_block) return;
-       view->set_event_block(block);
-}
-
-bool ui_viewmgr_base::push_view_finished(ui_view_base *view)
-{
-       ui_view_base *last = this->view_list.back();
-
-       //The previous view has been pushed. This should be unload.
-       if (last != view)
-       {
-               view->unload();
-               return true;
-       }
-
-       //A new view has been pushed. This should be active.
-       view->active();
-       this->set_event_block(view, true);
-
-       return true;
-}
-
-bool ui_viewmgr_base::pop_view_finished(ui_view_base *view)
-{
-       ui_view_base *last = this->view_list.back();
-
-       //This view has been popped. It should be destroyed.
-       if (last == view)
-       {
-               view->unload();
-               view->destroy();
-               delete (view);
-               return true;
-       }
-
-       //The previous view has been popped. It should become active.
-       view->active();
-       this->set_event_block(view, true);
-
-       return true;
-}
-
-ui_viewmgr_base::ui_viewmgr_base()
-               : event_block(true), activated(false)
-{
-       //FIXME: Read binary profile to decide whether support software back key or not.
-       //       software back key is needed in latest UX(Tizen_2.4)
-       this->soft_back_key = true;
-}
-
-ui_viewmgr_base::~ui_viewmgr_base()
-{
-       //Terminate views
-       for (typename std::list<ui_view_base*>::reverse_iterator it = this->view_list.rbegin(); it != this->view_list.rend(); it++)
-       {
-               ui_view_base *view = *it;
-               view->inactive();
-               view->unload();
-               view->destroy();
-               delete (view);
-       }
-
-       //FIXME: Window is destroyed. Terminate Application!
-       ui_app_exit();
-}
-
-ui_view_base *
-ui_viewmgr_base::push_view(ui_view_base *view)
-{
-       if (!view)
-       {
-               LOGE("invalid view argument. view(NULL)");
-               return NULL;
-       }
-
-       if (!this->connect_view(view))
-       {
-               LOGE("connect view failed");
-               return NULL;
-       }
-
-       ui_view_base *pview;
-
-       //Previous view
-       if (this->view_list.size())
-       {
-               pview = this->view_list.back();
-               pview->inactive();
-               this->set_event_block(pview, true);
-
-               //FIXME: Since we have no transition
-               pview->unload();
-       }
-
-       view_list.push_back(view);
-
-       if (!view->get_content())
-       {
-               view->load();
-       }
-
-       view->inactive();
-       this->set_event_block(view, true);
-
-       return view;
-}
-
-bool ui_viewmgr_base::pop_view()
-{
-       //No more view? destroy viewmgr?
-       if (this->get_view_count() == 0)
-       {
-               return false;
-       }
-
-       //This is the last page. destroy viewmgr?
-       if (this->get_view_count() == 1)
-       {
-               //destroy viewmgr?
-               ui_view_base *view = this->view_list.back();
-               view->inactive();
-               view->unload();
-               view->destroy();
-               delete(view);
-
-               return false;
-       }
-
-       //last page to be popped.
-       ui_view_base *view = this->view_list.back();
-       view->inactive();
-       this->set_event_block(view, true);
-
-       //Below object has to be used in child class...
-       //Make this getter method? or define instance?
-       //previous page to be current active.
-       auto nx = std::prev(this->view_list.end(), 2);
-       ui_view_base *pview = *nx;
-       pview->load();
-       pview->inactive();
-       this->set_event_block(pview, true);
-
-       //FIXME: since we have no transition effect
-       pview->active();
-       view->inactive();
-       view->unload();
-       view->destroy();
-       delete (view);
-
-       return true;
-}
-
-bool ui_viewmgr_base::insert_view_before(ui_view_base *view, ui_view_base *before)
-{
-       //TODO: ...
-       return true;
-}
-
-bool ui_viewmgr_base::insert_view_after(ui_view_base *view, ui_view_base *after)
-{
-       //TODO: ...
-       return true;
-}
-
-bool ui_viewmgr_base::remove_view(ui_view_base *view)
-{
-       this->view_list.remove(view);
-       this->disconnect_view(view);
-
-       //TODO: If this view is the top on the stack ?
-       return true;
-}
-
-ui_view_base*
-ui_viewmgr_base::get_view(unsigned int idx)
-{
-       if (idx < 0 || idx >= this->view_list.size())
-       {
-               LOGE("Invalid idx(%d)! =? (idx range: %d ~ %d)", idx, 0, this->view_list.size() - 1);
-               return NULL;
-       }
-       typename std::list<ui_view_base*>::iterator it = this->view_list.begin();
-       std::advance(it, idx);
-       return *it;
-}
-
-int ui_viewmgr_base::get_view_index(const ui_view_base *view)
-{
-       int idx = 0;
-
-       for (typename std::list<ui_view_base*>::iterator it = this->view_list.begin(); it != this->view_list.end(); it++)
-       {
-               if (view == *it) return idx;
-               ++idx;
-       }
-
-       return -1;
-}
-
-ui_view_base *
-ui_viewmgr_base::get_last_view()
-{
-       int cnt = this->get_view_count();
-       return this->get_view(cnt - 1);
-}
-
-bool ui_viewmgr_base::activate()
-{
-       if (this->activated) return false;
-       this->activated = true;
-       return true;
-}
-
-bool ui_viewmgr_base::deactivate()
-{
-       if (!this->activated) return false;
-       this->activated = false;
-       return true;
-}
diff --git a/src/interface/ui_viewmgr_base.h b/src/interface/ui_viewmgr_base.h
deleted file mode 100644 (file)
index 9191c70..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * 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.
- *
- */
-#ifndef UI_WINDOW_BASE_H_
-#define UI_WINDOW_BASE_H_
-
-#include <list>
-
-using namespace std;
-
-class ui_view_base;
-
-/**
- *  @class ui_viewmgr_base
- *
- *  @ingroup ui_viewmgr
- *
- *  @brief This is a base class of viewmgr. One viewmgr represents a window which contains multiple views.
- *         A viewmgr manages not only views life-cycle but constructs some basic infrastructure. It's up to derived classes.
- *
- *  @warning viewmgr will remove all containing views when it's destroyed.
- *  @date 2016/01/29
- *  @author Hermet Park <chuneon.park@samsung.com>
- */
-class ui_viewmgr_base
-{
-       friend class ui_view_base;
-
-private:
-       list<ui_view_base*> view_list;      //view list.
-       bool event_block;   //event block on view transition. This value should be configurable by system.
-       bool activated;     //activated status of this viewmgr.
-       bool soft_back_key;  //If system doesn't support HW back key, then this value is true.
-
-       /**
-        *  @brief link a given view to this viewmgr.
-        *
-        *  @param view a view to connect to this viewmgr.
-        *  @return success or not.
-        *
-        *  @note This is s a friend function of ui_view_base
-        */
-       bool connect_view(ui_view_base *view);
-
-       /**
-        *  @brief unlink a given view from this viewmgr.
-        *
-        *  @param view a view to disconnect from this viewmgr.
-        *  @return @c true success or @c false not.
-        *
-        *  @note This is s a friend function of ui_view_base
-        */
-       bool disconnect_view(ui_view_base *view);
-
-       /**
-        *  @brief toggle event blocking to the given view.
-        *
-        *  @param view a view to toggle event blocking
-        *  @param block @c true is block event, otherwise @c false.
-        *
-        *  @note This is s a friend function of ui_view_base
-        */
-       void set_event_block(ui_view_base *view, bool block);
-
-protected:
-       /**
-        *  @brief This function is designed for end of push transition.
-        *
-        *  @param view view which is finished pushing.
-        *  @return @c true success or @c false not.
-        *
-        *  @warning This function must be called definitely when push transition is finished.
-        *  @note This is s a friend function of ui_view_base
-        */
-       bool push_view_finished(ui_view_base *view);
-
-       /**
-        *  @brief This function is designed for end of pop transition.
-        *
-        *  @param view view which is finished popping.
-        *  @return @c true success or @c false not.
-        *
-        *  @warning This function must be called definitely when push transition is finished.
-        *  @note This is s a friend function of ui_view_base
-        */
-       bool pop_view_finished(ui_view_base *view);
-
-       /**
-        *  @brief Return a list of views which this viewmgr has.
-        *
-        *  @return a pointer of list of views.
-        */
-       const list<ui_view_base*>* const get_view_list()
-       {
-               return &this->view_list;
-       }
-
-       /**
-        *  @brief Push a new view into the viewmgr stack.
-        *         This function is used for application switches the current view to a new one.
-        *
-        *  @note Normally, the current view will be hidden by a new view.
-        *  @return @c true on success, @c false otherwise.
-        */
-       ui_view_base *push_view(ui_view_base *view);
-
-       /**
-        *  @brief Pop the top view from the viewmgr stack.
-        *         This function is used for application switches the current view back to the previous view.
-        *         The top view will be removed from the view stack and then it will be deleted by the viewmgr.
-        *
-        *  @note If the view is just one left, then viewmgr would be destroyed since the application might be terminated.
-        *        But this behavior is optional.
-        *
-        *  @return A view pointer which was popped. If it's failed to pop, @c NULL will be returned.
-        */
-       bool pop_view();
-
-       /**
-        *  @brief Insert a view into this viewmgr stack. Specially, right before of the given view, @before
-        *
-        *  @param view a view to push into the viewmgr stack
-        *  @param before a view that will be just after the @c view.
-        *         If you pass @c NULL, @c view will be inserted at the front of the view stack.
-        *  @return @c true success or @c false not.
-        */
-       bool insert_view_before(ui_view_base *view, ui_view_base *before);
-
-       /**
-        *  @brief Insert a view into this viewmgr stack. Specially, right after of the given view, @after
-        *
-        *  @param view a view to push into the viewmgr stack
-        *  @param after a view that will be just before the @c view.
-        *         If you pass @c NULL, @c view will be inserted at the end of the view stack.
-        *  @return @c true success or @c false not.
-        */
-       bool insert_view_after(ui_view_base *view, ui_view_base *after);
-
-       /**
-        *  @brief Remove the given view from this viewmgr stack.
-        *
-        *  @return @c true on success or @c false if not.
-        *
-        */
-       bool remove_view(ui_view_base *view);
-
-       /**
-        *  @brief Return a stack index number of the given view.
-        *         You could use this function to query the given view stack order.
-        *
-        *  @param idx a view to query the index.
-        *  @return an index of the give view.
-        *          If there were no views on the idx, @c NULL will be returned.
-        *
-        *  @warning the index number is variable since the view stack size is also variable.
-        */
-       ui_view_base* get_view(unsigned int idx);
-
-       /**
-        *  @brief Return a view which is matched with the @c name.
-        *
-        *  @param name the name of the view which you find.
-        *  @return the view which name is matched with @c name.
-        *          If there were no views name matched, @c NULL will be returned.
-        *
-        */
-       ui_view_base *get_view(const char *name)
-       {
-               //FIXME: ...
-               return NULL;
-       }
-
-       /**
-        *  @brief Return a stack index number of the given view.
-        *         You could use this function to query the given view stack order.
-        *
-        *  @param a view to query the index.
-        *  @return an index of the give view on success, otherwise, -1.
-        *
-        *  @warning the index number is variable since the view stack size is also variable.
-        */
-       int get_view_index(const ui_view_base *view);
-
-       //Activate a viewmgr.
-       bool activate();
-
-       //Deactivate a viewmgr.
-       bool deactivate();
-
-public:
-       ///Constructor.
-       ui_viewmgr_base();
-
-       ///Destructor. Delete all contained views.
-       virtual ~ui_viewmgr_base();
-
-       //FIXME: Doc.
-       ui_view_base *get_last_view();
-
-       /**
-        *  @brief Return the number of views which this viewmgr has.
-        *
-        *  @return the number of view
-        *
-        */
-       unsigned int get_view_count()
-       {
-               return this->view_list.size();
-       }
-
-       /**
-        *  @brief Return the active status of viewmgr.
-        *
-        *  @return active status
-        *
-        */
-       bool is_activated()
-       {
-               return this->activated;
-       }
-
-       /**
-        *  @brief Return the whether software back key need or not.
-        *
-        *  @return whether need software back key.
-        *
-        */
-       bool get_soft_back_key()
-       {
-               return this->soft_back_key;
-       }
-
-};
-
-#endif /* UI_WINDOW_BASE_H_ */
diff --git a/src/interface/ui_viewmgr_interface.cpp b/src/interface/ui_viewmgr_interface.cpp
new file mode 100644 (file)
index 0000000..392ab9a
--- /dev/null
@@ -0,0 +1,259 @@
+/*
+ * 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.
+ *
+ */
+#include "ui_viewmanager_interface.h"
+
+bool ui_viewmgr_interface::connect_view(ui_view_interface *view)
+{
+       if (view->viewmgr)
+       {
+               LOGE("view(%p) has already connected to viewmgr(%p)", view, this);
+               return false;
+       }
+
+       view->viewmgr = this;
+       return true;
+}
+
+bool ui_viewmgr_interface::disconnect_view(ui_view_interface *view)
+{
+       if (!view->viewmgr) return false;
+       view->viewmgr = NULL;
+       return true;
+}
+
+void ui_viewmgr_interface::set_event_block(ui_view_interface *view, bool block)
+{
+
+       if (!this->event_block) return;
+       view->set_event_block(block);
+}
+
+bool ui_viewmgr_interface::push_view_finished(ui_view_interface *view)
+{
+       ui_view_interface *last = this->view_list.back();
+
+       //The previous view has been pushed. This should be unload.
+       if (last != view)
+       {
+               view->unload();
+               return true;
+       }
+
+       //A new view has been pushed. This should be active.
+       view->active();
+       this->set_event_block(view, true);
+
+       return true;
+}
+
+bool ui_viewmgr_interface::pop_view_finished(ui_view_interface *view)
+{
+       ui_view_interface *last = this->view_list.back();
+
+       //This view has been popped. It should be destroyed.
+       if (last == view)
+       {
+               view->unload();
+               view->destroy();
+               delete (view);
+               return true;
+       }
+
+       //The previous view has been popped. It should become active.
+       view->active();
+       this->set_event_block(view, true);
+
+       return true;
+}
+
+ui_viewmgr_interface::ui_viewmgr_interface()
+               : event_block(true), activated(false)
+{
+       //FIXME: Read binary profile to decide whether support software back key or not.
+       //       software back key is needed in latest UX(Tizen_2.4)
+       this->soft_back_key = true;
+}
+
+ui_viewmgr_interface::~ui_viewmgr_interface()
+{
+       //Terminate views
+       for (typename std::list<ui_view_interface*>::reverse_iterator it = this->view_list.rbegin(); it != this->view_list.rend(); it++)
+       {
+               ui_view_interface *view = *it;
+               view->inactive();
+               view->unload();
+               view->destroy();
+               delete (view);
+       }
+
+       //FIXME: Window is destroyed. Terminate Application!
+       ui_app_exit();
+}
+
+ui_view_interface *
+ui_viewmgr_interface::push_view(ui_view_interface *view)
+{
+       if (!view)
+       {
+               LOGE("invalid view argument. view(NULL)");
+               return NULL;
+       }
+
+       if (!this->connect_view(view))
+       {
+               LOGE("connect view failed");
+               return NULL;
+       }
+
+       ui_view_interface *pview;
+
+       //Previous view
+       if (this->view_list.size())
+       {
+               pview = this->view_list.back();
+               pview->inactive();
+               this->set_event_block(pview, true);
+
+               //FIXME: Since we have no transition
+               pview->unload();
+       }
+
+       view_list.push_back(view);
+
+       if (!view->get_content())
+       {
+               view->load();
+       }
+
+       view->inactive();
+       this->set_event_block(view, true);
+
+       return view;
+}
+
+bool ui_viewmgr_interface::pop_view()
+{
+       //No more view? destroy viewmgr?
+       if (this->get_view_count() == 0)
+       {
+               return false;
+       }
+
+       //This is the last page. destroy viewmgr?
+       if (this->get_view_count() == 1)
+       {
+               //destroy viewmgr?
+               ui_view_interface *view = this->view_list.back();
+               view->inactive();
+               view->unload();
+               view->destroy();
+               delete(view);
+
+               return false;
+       }
+
+       //last page to be popped.
+       ui_view_interface *view = this->view_list.back();
+       view->inactive();
+       this->set_event_block(view, true);
+
+       //Below object has to be used in child class...
+       //Make this getter method? or define instance?
+       //previous page to be current active.
+       auto nx = std::prev(this->view_list.end(), 2);
+       ui_view_interface *pview = *nx;
+       pview->load();
+       pview->inactive();
+       this->set_event_block(pview, true);
+
+       //FIXME: since we have no transition effect
+       pview->active();
+       view->inactive();
+       view->unload();
+       view->destroy();
+       delete (view);
+
+       return true;
+}
+
+bool ui_viewmgr_interface::insert_view_before(ui_view_interface *view, ui_view_interface *before)
+{
+       //TODO: ...
+       return true;
+}
+
+bool ui_viewmgr_interface::insert_view_after(ui_view_interface *view, ui_view_interface *after)
+{
+       //TODO: ...
+       return true;
+}
+
+bool ui_viewmgr_interface::remove_view(ui_view_interface *view)
+{
+       this->view_list.remove(view);
+       this->disconnect_view(view);
+
+       //TODO: If this view is the top on the stack ?
+       return true;
+}
+
+ui_view_interface*
+ui_viewmgr_interface::get_view(unsigned int idx)
+{
+       if (idx < 0 || idx >= this->view_list.size())
+       {
+               LOGE("Invalid idx(%d)! =? (idx range: %d ~ %d)", idx, 0, this->view_list.size() - 1);
+               return NULL;
+       }
+       typename std::list<ui_view_interface*>::iterator it = this->view_list.begin();
+       std::advance(it, idx);
+       return *it;
+}
+
+int ui_viewmgr_interface::get_view_index(const ui_view_interface *view)
+{
+       int idx = 0;
+
+       for (typename std::list<ui_view_interface*>::iterator it = this->view_list.begin(); it != this->view_list.end(); it++)
+       {
+               if (view == *it) return idx;
+               ++idx;
+       }
+
+       return -1;
+}
+
+ui_view_interface *
+ui_viewmgr_interface::get_last_view()
+{
+       int cnt = this->get_view_count();
+       return this->get_view(cnt - 1);
+}
+
+bool ui_viewmgr_interface::activate()
+{
+       if (this->activated) return false;
+       this->activated = true;
+       return true;
+}
+
+bool ui_viewmgr_interface::deactivate()
+{
+       if (!this->activated) return false;
+       this->activated = false;
+       return true;
+}
diff --git a/src/interface/ui_viewmgr_interface.h b/src/interface/ui_viewmgr_interface.h
new file mode 100644 (file)
index 0000000..ed025fd
--- /dev/null
@@ -0,0 +1,248 @@
+/*
+ * 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.
+ *
+ */
+#ifndef UI_VIEWMGR_INTERFACE_H_
+#define UI_VIEWMGR_INTERFACE_H_
+
+#include <list>
+
+using namespace std;
+
+class ui_view_interface;
+
+/**
+ *  @class ui_viewmgr_interface
+ *
+ *  @ingroup ui_viewmgr
+ *
+ *  @brief This is a base class of viewmgr. One viewmgr represents a window which contains multiple views.
+ *         A viewmgr manages not only views life-cycle but constructs some basic infrastructure. It's up to derived classes.
+ *
+ *  @warning viewmgr will remove all containing views when it's destroyed.
+ *  @date 2016/01/29
+ *  @author Hermet Park <chuneon.park@samsung.com>
+ */
+class ui_viewmgr_interface
+{
+       friend class ui_view_interface;
+
+private:
+       list<ui_view_interface*> view_list;      //view list.
+       bool event_block;   //event block on view transition. This value should be configurable by system.
+       bool activated;     //activated status of this viewmgr.
+       bool soft_back_key;  //If system doesn't support HW back key, then this value is true.
+
+       /**
+        *  @brief link a given view to this viewmgr.
+        *
+        *  @param view a view to connect to this viewmgr.
+        *  @return success or not.
+        *
+        *  @note This is s a friend function of ui_view_interface
+        */
+       bool connect_view(ui_view_interface *view);
+
+       /**
+        *  @brief unlink a given view from this viewmgr.
+        *
+        *  @param view a view to disconnect from this viewmgr.
+        *  @return @c true success or @c false not.
+        *
+        *  @note This is s a friend function of ui_view_interface
+        */
+       bool disconnect_view(ui_view_interface *view);
+
+       /**
+        *  @brief toggle event blocking to the given view.
+        *
+        *  @param view a view to toggle event blocking
+        *  @param block @c true is block event, otherwise @c false.
+        *
+        *  @note This is s a friend function of ui_view_interface
+        */
+       void set_event_block(ui_view_interface *view, bool block);
+
+protected:
+       /**
+        *  @brief This function is designed for end of push transition.
+        *
+        *  @param view view which is finished pushing.
+        *  @return @c true success or @c false not.
+        *
+        *  @warning This function must be called definitely when push transition is finished.
+        *  @note This is s a friend function of ui_view_interface
+        */
+       bool push_view_finished(ui_view_interface *view);
+
+       /**
+        *  @brief This function is designed for end of pop transition.
+        *
+        *  @param view view which is finished popping.
+        *  @return @c true success or @c false not.
+        *
+        *  @warning This function must be called definitely when push transition is finished.
+        *  @note This is s a friend function of ui_view_interface
+        */
+       bool pop_view_finished(ui_view_interface *view);
+
+       /**
+        *  @brief Return a list of views which this viewmgr has.
+        *
+        *  @return a pointer of list of views.
+        */
+       const list<ui_view_interface*>* const get_view_list()
+       {
+               return &this->view_list;
+       }
+
+       /**
+        *  @brief Push a new view into the viewmgr stack.
+        *         This function is used for application switches the current view to a new one.
+        *
+        *  @note Normally, the current view will be hidden by a new view.
+        *  @return @c true on success, @c false otherwise.
+        */
+       ui_view_interface *push_view(ui_view_interface *view);
+
+       /**
+        *  @brief Pop the top view from the viewmgr stack.
+        *         This function is used for application switches the current view back to the previous view.
+        *         The top view will be removed from the view stack and then it will be deleted by the viewmgr.
+        *
+        *  @note If the view is just one left, then viewmgr would be destroyed since the application might be terminated.
+        *        But this behavior is optional.
+        *
+        *  @return A view pointer which was popped. If it's failed to pop, @c NULL will be returned.
+        */
+       bool pop_view();
+
+       /**
+        *  @brief Insert a view into this viewmgr stack. Specially, right before of the given view, @before
+        *
+        *  @param view a view to push into the viewmgr stack
+        *  @param before a view that will be just after the @c view.
+        *         If you pass @c NULL, @c view will be inserted at the front of the view stack.
+        *  @return @c true success or @c false not.
+        */
+       bool insert_view_before(ui_view_interface *view, ui_view_interface *before);
+
+       /**
+        *  @brief Insert a view into this viewmgr stack. Specially, right after of the given view, @after
+        *
+        *  @param view a view to push into the viewmgr stack
+        *  @param after a view that will be just before the @c view.
+        *         If you pass @c NULL, @c view will be inserted at the end of the view stack.
+        *  @return @c true success or @c false not.
+        */
+       bool insert_view_after(ui_view_interface *view, ui_view_interface *after);
+
+       /**
+        *  @brief Remove the given view from this viewmgr stack.
+        *
+        *  @return @c true on success or @c false if not.
+        *
+        */
+       bool remove_view(ui_view_interface *view);
+
+       /**
+        *  @brief Return a stack index number of the given view.
+        *         You could use this function to query the given view stack order.
+        *
+        *  @param idx a view to query the index.
+        *  @return an index of the give view.
+        *          If there were no views on the idx, @c NULL will be returned.
+        *
+        *  @warning the index number is variable since the view stack size is also variable.
+        */
+       ui_view_interface* get_view(unsigned int idx);
+
+       /**
+        *  @brief Return a view which is matched with the @c name.
+        *
+        *  @param name the name of the view which you find.
+        *  @return the view which name is matched with @c name.
+        *          If there were no views name matched, @c NULL will be returned.
+        *
+        */
+       ui_view_interface *get_view(const char *name)
+       {
+               //FIXME: ...
+               return NULL;
+       }
+
+       /**
+        *  @brief Return a stack index number of the given view.
+        *         You could use this function to query the given view stack order.
+        *
+        *  @param a view to query the index.
+        *  @return an index of the give view on success, otherwise, -1.
+        *
+        *  @warning the index number is variable since the view stack size is also variable.
+        */
+       int get_view_index(const ui_view_interface *view);
+
+       //Activate a viewmgr.
+       bool activate();
+
+       //Deactivate a viewmgr.
+       bool deactivate();
+
+public:
+       ///Constructor.
+       ui_viewmgr_interface();
+
+       ///Destructor. Delete all contained views.
+       virtual ~ui_viewmgr_interface();
+
+       //FIXME: Doc.
+       ui_view_interface *get_last_view();
+
+       /**
+        *  @brief Return the number of views which this viewmgr has.
+        *
+        *  @return the number of view
+        *
+        */
+       unsigned int get_view_count()
+       {
+               return this->view_list.size();
+       }
+
+       /**
+        *  @brief Return the active status of viewmgr.
+        *
+        *  @return active status
+        *
+        */
+       bool is_activated()
+       {
+               return this->activated;
+       }
+
+       /**
+        *  @brief Return the whether software back key need or not.
+        *
+        *  @return whether need software back key.
+        *
+        */
+       bool get_soft_back_key()
+       {
+               return this->soft_back_key;
+       }
+
+};
+
+#endif /* UI_VIEWMGR_INTERFACE_H_ */
diff --git a/src/main.cpp b/src/main.cpp
deleted file mode 100644 (file)
index e3483ad..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * 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.
- *
- */
-#include "main.h"
-#include "page5_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);
-
-       page1(ad);
-
-       ad->viewmgr->activate();
-}
-
-static bool app_create(void *data)
-{
-       /* Hook to take necessary actions before main event loop starts
-        Initialize UI resources and application's data
-        If this function returns true, the main loop of application starts
-        If this function returns false, the application is terminated */
-       appdata_s *ad = (appdata_s *) data;
-
-       elm_app_base_scale_set(2.6);
-
-       /* Bind package locale file */
-       bindtextdomain(PACKAGE, LOCALE_DIR);
-       textdomain(PACKAGE);
-
-       create_base_gui(ad);
-
-       return true;
-}
-
-static void app_control(app_control_h app_control, void *data)
-{
-       /* Handle the launch request. */
-}
-
-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)
-{
-}
-
-static void ui_app_lang_changed(app_event_info_h event_info, void *user_data)
-{
-       /*APP_EVENT_LANGUAGE_CHANGED*/
-       char *locale = NULL;
-       system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
-       elm_language_set(locale);
-       free(locale);
-
-       return;
-}
-
-static void ui_app_orient_changed(app_event_info_h event_info, void *user_data)
-{
-       /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
-       return;
-}
-
-static void ui_app_region_changed(app_event_info_h event_info, void *user_data)
-{
-       /*APP_EVENT_REGION_FORMAT_CHANGED*/
-}
-
-static void ui_app_low_battery(app_event_info_h event_info, void *user_data)
-{
-       /*APP_EVENT_LOW_BATTERY*/
-}
-
-static void ui_app_low_memory(app_event_info_h event_info, void *user_data)
-{
-       /*APP_EVENT_LOW_MEMORY*/
-}
-
-int main(int argc, char *argv[])
-{
-       appdata_s ad = { 0, };
-       int ret = 0;
-
-       ui_app_lifecycle_callback_s event_callback = { 0, };
-       app_event_handler_h handlers[5] = { NULL, };
-
-       event_callback.create = app_create;
-       event_callback.terminate = app_terminate;
-       event_callback.pause = app_pause;
-       event_callback.resume = app_resume;
-       event_callback.app_control = app_control;
-
-       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
-       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
-       ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED,
-                       ui_app_orient_changed, &ad);
-       ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
-       ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed,
-                       &ad);
-       ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);
-
-       ret = ui_app_main(argc, argv, &event_callback, &ad);
-       if (ret != APP_ERROR_NONE)
-       {
-               dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
-       }
-
-       return ret;
-}
diff --git a/src/page1_controller.h b/src/page1_controller.h
deleted file mode 100644 (file)
index b34d122..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.
- *
- */
-class page1_controller: public ui_controller
-{
-private:
-       appdata_s *ad;
-
-public:
-       page1_controller(appdata_s *ad)
-                       : ad(ad)
-       {
-               /* ui_basic_view(controller, identity name).
-                  Later, you could get the identity name using view->get_name(); */
-               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 *>(this->get_view());
-
-               //Create a main content.
-               Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 1",
-                               //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);
-                                       page2(ad);
-                               },
-                               this->ad);
-
-               view->set_content(content, "Title");
-       }
-};
-
-void page1(appdata_s *ad)
-{
-       new page1_controller(ad);
-}
diff --git a/src/page2_controller.h b/src/page2_controller.h
deleted file mode 100644 (file)
index 5e71b8d..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.
- *
- */
-class page2_controller: public ui_controller
-{
-private:
-       appdata_s *ad;
-
-public:
-       page2_controller(appdata_s *ad)
-                       : ad(ad)
-       {
-               /* ui_basic_view(controller, identity name).
-                  Later, you could get the identity name using view->get_name(); */
-               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 *>(this->get_view());
-
-               //Create a main content.
-               Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 2",
-                               //Prev Button Callback
-                       [](void *data, Evas_Object *obj, void *event_info) -> void
-                       {
-                               appdata_s *ad = static_cast<appdata_s *>(data);
-                               ad->viewmgr->pop_view();
-                       },
-                       //Next Button Callback
-                       [](void *data, Evas_Object *obj, void *event_info) -> void
-                       {
-                               appdata_s *ad = static_cast<appdata_s *>(data);
-                               page3(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, title left button, title right button
-               view->set_content(content, "Title Buttons", NULL, left_title_btn, right_title_btn);
-       }
-};
-
-void page2(appdata_s *ad)
-{
-       new page2_controller(ad);
-}
diff --git a/src/page3_controller.h b/src/page3_controller.h
deleted file mode 100644 (file)
index 67a6070..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.
- *
- */
-class page3_controller: public ui_controller
-{
-private:
-       appdata_s *ad;
-
-public:
-       page3_controller(appdata_s *ad)
-                       : ad(ad)
-       {
-               /* ui_basic_view(controller, identity name).
-                  Later, you could get the identity name using view->get_name(); */
-               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 Callback
-                               [](void *data, Evas_Object *obj, void *event_info) -> void
-                               {
-                                       appdata_s *ad = static_cast<appdata_s *>(data);
-                                       ad->viewmgr->pop_view();
-                               },
-                               //Next Button Callback
-                               [](void *data, Evas_Object *obj, void *event_info) -> void
-                               {
-                                       appdata_s *ad = static_cast<appdata_s *>(data);
-                                       page4(ad);
-                               },
-                               this->ad);
-
-               //Arguments: content, title, subtitle, title left button, title right button
-               view->set_content(content, "Title", "Subtitle", NULL, NULL);
-       }
-};
-
-void page3(appdata_s *ad)
-{
-       new page3_controller(ad);
-}
diff --git a/src/page4_controller.h b/src/page4_controller.h
deleted file mode 100644 (file)
index 6e97a38..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.
- *
- */
-class page4_controller: public ui_controller
-{
-private:
-       appdata_s *ad;
-
-public:
-       page4_controller(appdata_s *ad)
-                       : ad(ad)
-       {
-               /* ui_basic_view(controller, identity name).
-                  Later, you could get the identity name using view->get_name(); */
-               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 Callback
-                               [](void *data, Evas_Object *obj, void *event_info) -> void
-                               {
-                                       appdata_s *ad = static_cast<appdata_s *>(data);
-                                       ad->viewmgr->pop_view();
-                               },
-                               //Next Button Callback
-                               [](void *data, Evas_Object *obj, void *event_info) -> void
-                               {
-                                       appdata_s *ad = static_cast<appdata_s *>(data);
-                                       page5(ad);
-                               },
-                               this->ad);
-
-               //Arguments: content, title
-               view->set_content(content, "TitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitle");
-               view->set_title_badge("999+");
-       }
-};
-
-void page4(appdata_s *ad)
-{
-       new page4_controller(ad);
-}
diff --git a/src/page5_controller.h b/src/page5_controller.h
deleted file mode 100644 (file)
index 744de44..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.
- *
- */
-class page5_controller: public ui_controller
-{
-private:
-       appdata_s *ad;
-
-public:
-       page5_controller(appdata_s *ad)
-                       : ad(ad)
-       {
-               //No basic form.
-               /* ui_view(controller, identity name).
-                  Later, you could get the identity name using view->get_name(); */
-               ui_view *view = ad->viewmgr->push_view(new ui_view(this, "page5"));
-       }
-
-       ~page5_controller()
-       {
-       }
-
-       void 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 5<br>(Full View)",
-                               //Prev Button Callback
-                               [](void *data, Evas_Object *obj, void *event_info) -> void
-                               {
-                                       appdata_s *ad = static_cast<appdata_s *>(data);
-                                       ad->viewmgr->pop_view();
-                               },
-                               //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);
-               view->set_indicator(UI_VIEW_INDICATOR_HIDE);
-       }
-};
-
-void page5(appdata_s *ad)
-{
-       new page5_controller(ad);
-}