promote from ui_base_app to ui_iface_app. 52/72352/2
authorHermet Park <hermet@hermet.pe.kr>
Tue, 31 May 2016 13:47:56 +0000 (22:47 +0900)
committerHermet Park <hermet@hermet.pe.kr>
Wed, 1 Jun 2016 11:32:17 +0000 (20:32 +0900)
Change-Id: I2f3cdb85f12d1ec0d508c36503fa946ef83edeed

12 files changed:
src/include/efl/mobile/ui_app.h
src/include/efl/ui_base_app.h [deleted file]
src/include/efl/ui_base_viewmanager.h
src/include/efl/ui_base_viewmgr.h
src/include/interface/ui_iface_app.h [new file with mode: 0644]
src/include/interface/ui_iface_singleton.h [deleted file]
src/include/interface/ui_iface_viewmanager.h
src/include/interface/ui_iface_viewmgr.h
src/lib/CMakeLists.txt
src/lib/efl/mobile/ui_app.cpp
src/lib/efl/ui_base_app.cpp [deleted file]
src/lib/interface/ui_iface_app.cpp [new file with mode: 0644]

index 61d314be25030a9915962afc210347d24bde925c..b09de41210682ea65f59603e0279ea65d905fb20 100644 (file)
@@ -22,7 +22,7 @@ namespace efl_viewmanager
 
 class ui_viewmgr;
 
-class ui_app : public ui_base_app
+class ui_app : public ui_iface_app
 {
 public:
        /**
diff --git a/src/include/efl/ui_base_app.h b/src/include/efl/ui_base_app.h
deleted file mode 100644 (file)
index 7f50d57..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.
- *
- */
-#ifndef _UI_BASE_APP_H_
-#define _UI_BASE_APP_H_
-
-namespace efl_viewmanager
-{
-
-class ui_base_viewmgr;
-
-class ui_base_app
-{
-public:
-       /**
-        *  @brief This is a constructor for initializing ui_base_app.
-        *
-        *  @param pkg The name of package.
-        *  @param loale_dir The path of locale directory.
-        *  @param viewmgr instance of ui_viewmgr.
-        */
-       ui_base_app(const char *pkg, const char *locale_dir, ui_base_viewmgr *viewmgr);
-
-       ///Destructor.
-       virtual ~ui_base_app();
-
-       /**
-        *  @brief Return the viewmgr instance.
-        *
-        *  @return ui_viewmgr instance.
-        */
-       ui_base_viewmgr *get_viewmgr();
-
-       /**
-        *  @brief Return ui_base_app instance.
-        *
-        *  @return The instance of ui_base_app.
-        */
-       static ui_base_app *get_instance();
-
-       /**
-        *  @brief Application life-cycle start and add application event callback functions add.
-        *
-        *  @note This is calling ui_base_app_main function to start application life-cycle start.
-        *        and adding all of the functions for application events handling such as
-        *        create, terminate, pause, resume, app_control, APP_EVENT_LOW_BATTERY, APP_EVENT_LOW_MEMORY
-        *        APP_EVENT_DEVICE_ORIENTATION_CHANGED, APP_EVENT_LANGUAGE_CHANGED, APP_EVENT_REGION_FORMAT_CHANGED.
-        *        Application can add those events using wrapping functions by viewmgr supported.
-        */
-       virtual int run(int argc, char **argv);
-
-protected:
-       /**
-        *  @brief Calling before the main event loop start.
-        *
-        *  @note Take necessary actions like a Initialize UI resources and application data.
-        *
-        *  @return If this function returns true, the application main loop starts.
-        *          If this function returns false, the application terminates.
-        */
-       virtual bool on_create();
-
-       /**
-        *  @brief Calling before the main event loop finish.
-        *
-        *  @note Release all resources here.
-        */
-       virtual void on_terminate();
-
-       /**
-        *  @brief Calling when application becomes invisible.
-        */
-       virtual void on_pause();
-
-       /**
-        *  @brief Calling when application becomes visible.
-        */
-       virtual void on_resume();
-
-       /**
-        *  @brief Calling when gets a launch request event.
-        *
-        *  @param app_control_h The instance of app_control_h.
-        */
-       virtual void on_control(app_control_h app_control);
-
-       /**
-        *  @brief Calling when device low battery.
-        *
-        *  @param app_event_info_h The instance of app_event_info_h.
-        */
-       virtual void on_low_battery(app_event_info_h event_info);
-
-       /**
-        *  @brief Calling when device low memory.
-        *
-        *  @param app_event_info_h The instance of app_event_info_h.
-        */
-       virtual void on_low_memory(app_event_info_h event_info);
-
-       /**
-        *  @brief Calling when device region changed.
-        *
-        *  @param app_event_info_h The instance of app_event_info_h.
-        */
-       virtual void on_region_changed(app_event_info_h event_info);
-
-       /**
-        *  @brief Calling when device orient changed.
-        *
-        *  @param app_event_info_h The instance of app_event_info_h.
-        */
-       virtual void on_orient_changed(app_event_info_h event_info);
-
-       /**
-        *  @brief Calling when language changed.
-        *
-        *  @param app_event_info_h The instance of app_event_info_h.
-        */
-       virtual void on_lang_changed(app_event_info_h event_info);
-
-private:
-       _UI_DECLARE_PRIVATE_IMPL(ui_base_app);
-       _UI_DISABLE_COPY_AND_ASSIGN(ui_base_app);
-};
-
-}
-
-#endif /* _UI_BASE_APP_H_ */
index 5c715c4bef3d5f7076f1fdc49b3bcb96b33b1f2a..6b5f37e3202b1993619680ca563ef398bc3fb09b 100644 (file)
 #define Elm_Conformant Evas_Object
 #endif
 
-#include <app.h>
 #include "../interface/ui_iface_viewmanager.h"
 #include "ui_base_overlay.h"
 #include "ui_base_key_listener.h"
 #include "ui_base_viewmgr.h"
 #include "ui_base_view.h"
-#include "ui_base_app.h"
 
 #define UI_BASE_VIEWMGR dynamic_cast<ui_base_viewmgr *>(ui_iface_viewmgr::get_instance())
 
index c124368554e14f8ba1c5e3f0d0b1ebd103c8560d..b44fdc8d792d60bd68d96e358103696859650da1 100644 (file)
@@ -192,7 +192,6 @@ private:
        _UI_DECLARE_PRIVATE_IMPL(ui_base_viewmgr);
        _UI_DISABLE_COPY_AND_ASSIGN(ui_base_viewmgr);
        _UI_DECLARE_FRIENDS(ui_base_view);
-       _UI_DECLARE_FRIENDS(ui_base_app);
 };
 
 }
diff --git a/src/include/interface/ui_iface_app.h b/src/include/interface/ui_iface_app.h
new file mode 100644 (file)
index 0000000..6eb4aa3
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * 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_IFACE_APP_H_
+#define _UI_IFACE_APP_H_
+
+namespace ui_viewmanager {
+
+class ui_iface_viewmgr;
+
+class ui_iface_app
+{
+public:
+       /**
+        *  @brief This is a constructor for initializing ui_iface_app.
+        *
+        *  @param pkg The name of package.
+        *  @param loale_dir The path of locale directory.
+        *  @param viewmgr instance of ui_viewmgr.
+        */
+       ui_iface_app(const char *pkg, const char *locale_dir, ui_iface_viewmgr *viewmgr);
+
+       ///Destructor.
+       virtual ~ui_iface_app();
+
+       /**
+        *  @brief Return the viewmgr instance.
+        *
+        *  @return ui_iface_viewmgr instance.
+        */
+       ui_iface_viewmgr *get_viewmgr();
+
+       /**
+        *  @brief Return ui_iface_app instance.
+        *
+        *  @return The instance of ui_iface_app.
+        */
+       static ui_iface_app *get_instance();
+
+       /**
+        *  @brief Application life-cycle start and add application event callback functions add.
+        *
+        *  @note This is calling ui_app_main function to start application life-cycle start.
+        *        and adding all of the functions for application events handling such as
+        *        create, terminate, pause, resume, app_control, APP_EVENT_LOW_BATTERY, APP_EVENT_LOW_MEMORY
+        *        APP_EVENT_DEVICE_ORIENTATION_CHANGED, APP_EVENT_LANGUAGE_CHANGED, APP_EVENT_REGION_FORMAT_CHANGED.
+        *        Application can add those events using wrapping functions by viewmgr supported.
+        */
+       virtual int run(int argc, char **argv);
+
+protected:
+       /**
+        *  @brief Calling before the main event loop start.
+        *
+        *  @note Take necessary actions like a Initialize UI resources and application data.
+        *
+        *  @return If this function returns true, the application main loop starts.
+        *          If this function returns false, the application terminates.
+        */
+       virtual bool on_create();
+
+       /**
+        *  @brief Calling before the main event loop finish.
+        *
+        *  @note Release all resources here.
+        */
+       virtual void on_terminate();
+
+       /**
+        *  @brief Calling when application becomes invisible.
+        */
+       virtual void on_pause();
+
+       /**
+        *  @brief Calling when application becomes visible.
+        */
+       virtual void on_resume();
+
+       /**
+        *  @brief Calling when gets a launch request event.
+        *
+        *  @param app_control_h The instance of app_control_h.
+        */
+       virtual void on_control(app_control_h app_control);
+
+       /**
+        *  @brief Calling when device low battery.
+        *
+        *  @param app_event_info_h The instance of app_event_info_h.
+        */
+       virtual void on_low_battery(app_event_info_h event_info);
+
+       /**
+        *  @brief Calling when device low memory.
+        *
+        *  @param app_event_info_h The instance of app_event_info_h.
+        */
+       virtual void on_low_memory(app_event_info_h event_info);
+
+       /**
+        *  @brief Calling when device region changed.
+        *
+        *  @param app_event_info_h The instance of app_event_info_h.
+        */
+       virtual void on_region_changed(app_event_info_h event_info);
+
+       /**
+        *  @brief Calling when device orient changed.
+        *
+        *  @param app_event_info_h The instance of app_event_info_h.
+        */
+       virtual void on_orient_changed(app_event_info_h event_info);
+
+       /**
+        *  @brief Calling when language changed.
+        *
+        *  @param app_event_info_h The instance of app_event_info_h.
+        */
+       virtual void on_lang_changed(app_event_info_h event_info);
+
+private:
+       _UI_DECLARE_PRIVATE_IMPL(ui_iface_app);
+       _UI_DISABLE_COPY_AND_ASSIGN(ui_iface_app);
+};
+
+}
+
+#endif /* _UI_IFACE_APP_H_ */
diff --git a/src/include/interface/ui_iface_singleton.h b/src/include/interface/ui_iface_singleton.h
deleted file mode 100644 (file)
index d351ad2..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef _UI_IFACE_SINGLETON_H_
-#define _UI_IFACE_SINGLETON_H_
-
-namespace ui_viewmanager
-{
-
-template<typename XX>
-class singleton
-{
-private:
-       static XX* inst;
-
-public:
-       singleton();
-       virtual ~singleton();
-       inline static XX* get_instance();
-};
-
-template<typename XX> XX* singleton<XX>::inst = NULL;
-
-template<typename XX>
-singleton<XX>::singleton()
-{
-       XX* pT = reinterpret_cast<XX*>(1);
-
-       //Derived Class - Singleton class
-       int offset = reinterpret_cast<int>(pT) - reinterpret_cast<int>(reinterpret_cast<singleton<XX>*>(pT));
-       singleton::inst = reinterpret_cast<XX*>((reinterpret_cast<int>(this) + offset));
-}
-
-template<typename XX>
-singleton<XX>::~singleton()
-{
-       singleton::inst = NULL;
-}
-
-template<typename XX>
-XX* singleton<XX>::get_instance()
-{
-       return singleton::inst;
-}
-
-}
-
-#endif /* _UI_IFACE_SINGLETON_H_ */
index 7ebe660c590478ba65658b04380004aab7ecd09c..a6ecb9319c8f32a6c52f0567c6b4217db15c8dfe 100644 (file)
@@ -70,11 +70,12 @@ enum ui_view_state
        A(const A&) = delete; \
        const A& operator=(const A&) = delete
 
-#include "ui_iface_singleton.h"
+#include <app.h>
 #include "ui_iface_rotatable.h"
 #include "ui_iface_overlay.h"
 #include "ui_iface_view.h"
 #include "ui_iface_viewmgr.h"
+#include "ui_iface_app.h"
 
 using namespace ui_viewmanager;
 
index fab8329c8b477c60f4a8cbe0ab3d249fadf2b9ba..e889f9ebfe65a3b1b9b7e6a972a330227a677749 100644 (file)
@@ -45,7 +45,7 @@ public:
         *
         *  @see deactivate()
         */
-       bool activate();
+       virtual bool activate();
 
        /**
         *  @brief Deactivate this view manager.
@@ -57,7 +57,7 @@ public:
         *
         *  @see activate()
         */
-       bool deactivate();
+       virtual bool deactivate();
 
        /**
         *  @brief Return the active status of viewmgr.
@@ -248,6 +248,7 @@ private:
        _UI_DECLARE_PRIVATE_IMPL(ui_iface_viewmgr);
        _UI_DISABLE_COPY_AND_ASSIGN(ui_iface_viewmgr);
        _UI_DECLARE_FRIENDS(ui_iface_view);
+       _UI_DECLARE_FRIENDS(ui_iface_app);
 };
 
 }
index 150b8920498be7cd30038c72a9c13b66476515f3..65d82923351f78f92d6a1c0642654297d2abeaea 100644 (file)
@@ -2,7 +2,7 @@ SET(SRCS
      interface/ui_iface_overlay.cpp
      interface/ui_iface_view.cpp
      interface/ui_iface_viewmgr.cpp
-     efl/ui_base_app.cpp
+     interface/ui_iface_app.cpp
      efl/ui_base_view.cpp
      efl/ui_base_viewmgr.cpp
      efl/ui_base_key_listener.cpp
index ce71b9eff249e48c8635440bce07105a2811eee1..6ff515711b77c42184a669e751e383b3d40a3974 100644 (file)
@@ -14,7 +14,6 @@
  *  limitations under the License.
  *
  */
-#include <system_settings.h>
 #include "../../../include/efl/mobile/ui_mobile_viewmanager.h"
 
 /***********************************************************************************************/
@@ -26,7 +25,7 @@
 /***********************************************************************************************/
 
 ui_app::ui_app(const char *pkg, const char *locale_dir)
-               : ui_base_app(pkg, locale_dir, new ui_viewmgr(pkg))
+               : ui_iface_app(pkg, locale_dir, new ui_viewmgr(pkg))
 {
 }
 
@@ -36,10 +35,10 @@ ui_app::~ui_app()
 
 ui_viewmgr *ui_app::get_viewmgr()
 {
-       return dynamic_cast<ui_viewmgr*>(ui_base_app::get_viewmgr());
+       return dynamic_cast<ui_viewmgr*>(ui_iface_app::get_viewmgr());
 }
 
 ui_app *ui_app::get_instance()
 {
-       return dynamic_cast<ui_app*>(ui_base_app::get_instance());
+       return dynamic_cast<ui_app*>(ui_iface_app::get_instance());
 }
diff --git a/src/lib/efl/ui_base_app.cpp b/src/lib/efl/ui_base_app.cpp
deleted file mode 100644 (file)
index 6e43db9..0000000
+++ /dev/null
@@ -1,311 +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 <system_settings.h>
-#include "../../include/efl/ui_base_viewmanager.h"
-
-/***********************************************************************************************/
-/* Internal class Implementation                                                               */
-/***********************************************************************************************/
-namespace efl_viewmanager
-{
-
-class ui_base_app_impl
-{
-public:
-       friend class ui_base_app;
-
-       ui_base_app *app;
-       ui_base_viewmgr *viewmgr;
-       Eina_Stringshare *pkg;
-       Eina_Stringshare *locale_dir;
-
-       ui_base_app_impl(ui_base_app *app, const char *pkg, const char *locale_dir, ui_base_viewmgr* viewmgr);
-       ~ui_base_app_impl();
-
-       int run(int argc, char **argv);
-
-       bool init();
-       bool on_create();
-       void on_terminate();
-       void on_pause();
-       void on_resume();
-       void on_control(app_control_h app_control);
-       void on_low_battery(app_event_info_h event_info);
-       void on_low_memory(app_event_info_h event_info);
-       void on_region_changed(app_event_info_h event_info);
-       void on_orient_changed(app_event_info_h event_info);
-       void on_lang_changed(app_event_info_h event_info);
-};
-
-}
-
-static bool app_create(void *data)
-{
-       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
-       return app->on_create();
-}
-
-static void app_terminate(void *data)
-{
-       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
-       app->on_terminate();
-}
-
-static void app_pause(void *data)
-{
-       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
-       app->on_pause();
-}
-
-static void app_resume(void *data)
-{
-       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
-       app->on_resume();
-}
-
-static void app_control(app_control_s *app_control, void *data)
-{
-       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
-       app->on_control(app_control);
-}
-
-static void ui_app_lang_changed(app_event_info_h event_info, void *data)
-{
-       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
-       app->on_lang_changed(event_info);
-}
-
-static void ui_app_orient_changed(app_event_info_h event_info, void *data)
-{
-       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
-       app->on_orient_changed(event_info);
-}
-
-static void ui_app_region_changed(app_event_info_h event_info, void *data)
-{
-       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
-       app->on_region_changed(event_info);
-}
-
-static void ui_app_low_battery(app_event_info_h event_info, void *data)
-{
-       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
-       app->on_low_battery(event_info);
-}
-
-static void ui_app_low_memory(app_event_info_h event_info, void *data)
-{
-       ui_base_app_impl *app = static_cast<ui_base_app_impl *>(data);
-       app->on_low_memory(event_info);
-}
-
-bool ui_base_app_impl::init()
-{
-       //FIXME: this scale value should be configurable.
-       elm_app_base_scale_set(2.6);
-
-       /* Bind package locale file */
-       bindtextdomain(this->pkg, this->locale_dir);
-       textdomain(this->pkg);
-
-       return true;
-}
-
-ui_base_app_impl::ui_base_app_impl(ui_base_app *app, const char *pkg, const char *locale_dir, ui_base_viewmgr *viewmgr)
-               : app(app), viewmgr(viewmgr)
-{
-       this->pkg = eina_stringshare_add(pkg);
-       this->locale_dir = eina_stringshare_add(locale_dir);
-}
-
-int ui_base_app_impl::run(int argc, char **argv)
-{
-       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, this);
-       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, this);
-       ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, this);
-       ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, this);
-       ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, this);
-
-       int ret = ui_app_main(argc, argv, &event_callback, this);
-
-       if (ret != APP_ERROR_NONE)
-       {
-               LOGE("ui_app_main() is failed. err = %d", ret);
-       }
-
-       return ret;
-}
-
-ui_base_app_impl::~ui_base_app_impl()
-{
-       delete (this->viewmgr);
-       eina_stringshare_del(this->pkg);
-       eina_stringshare_del(this->locale_dir);
-}
-
-void ui_base_app_impl::on_lang_changed(app_event_info_h event_info)
-{
-       this->app->on_lang_changed(event_info);
-}
-
-void ui_base_app_impl::on_low_memory(app_event_info_h event_info)
-{
-       this->app->on_low_memory(event_info);
-}
-
-void ui_base_app_impl::on_low_battery(app_event_info_h event_info)
-{
-       this->app->on_low_battery(event_info);
-}
-
-void ui_base_app_impl::on_region_changed(app_event_info_h event_info)
-{
-       this->app->on_region_changed(event_info);
-}
-
-void ui_base_app_impl::on_orient_changed(app_event_info_h event_info)
-{
-       this->app->on_orient_changed(event_info);
-}
-
-bool ui_base_app_impl::on_create()
-{
-       return this->app->on_create();
-}
-
-void ui_base_app_impl::on_pause()
-{
-       this->app->on_pause();
-}
-
-void ui_base_app_impl::on_resume()
-{
-       this->app->on_resume();
-}
-
-void ui_base_app_impl::on_control(app_control_h app_control)
-{
-       this->app->on_control(app_control);
-}
-
-void ui_base_app_impl::on_terminate()
-{
-       this->app->on_terminate();
-}
-
-/***********************************************************************************************/
-/* External class Implementation                                                               */
-/***********************************************************************************************/
-
-static ui_base_app *inst = NULL;
-
-void ui_base_app::on_lang_changed(app_event_info_h event_info)
-{
-       char *locale = NULL;
-       system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
-       elm_language_set(locale);
-       free(locale);
-}
-
-void ui_base_app::on_low_memory(app_event_info_h event_info)
-{
-
-}
-
-void ui_base_app::on_low_battery(app_event_info_h event_info)
-{
-
-}
-
-void ui_base_app::on_region_changed(app_event_info_h event_info)
-{
-
-}
-
-void ui_base_app::on_orient_changed(app_event_info_h event_info)
-{
-
-}
-
-bool ui_base_app::on_create()
-{
-       return this->impl->init();
-}
-
-void ui_base_app::on_pause()
-{
-       this->impl->viewmgr->deactivate();
-}
-
-void ui_base_app::on_resume()
-{
-//     this->impl->viewmgr->activate();
-}
-
-void ui_base_app::on_control(app_control_h app_control)
-{
-       /* Handle the launch request. */
-       this->impl->viewmgr->activate();
-}
-
-void ui_base_app::on_terminate()
-{
-       delete(this);
-}
-
-ui_base_app::ui_base_app(const char *pkg, const char *locale_dir, ui_base_viewmgr *viewmgr)
-{
-       if (inst)
-       {
-               LOGE("You created ui_base_app multiple times!!");
-       }
-       inst = this;
-
-       this->impl = new ui_base_app_impl(this, pkg, locale_dir, viewmgr);
-}
-
-int ui_base_app::run(int argc, char **argv)
-{
-       return this->impl->run(argc, argv);
-}
-
-ui_base_app::~ui_base_app()
-{
-       delete (this->impl);
-       inst = NULL;
-}
-
-ui_base_viewmgr *ui_base_app::get_viewmgr()
-{
-       return this->impl->viewmgr;
-}
-
-ui_base_app *ui_base_app::get_instance()
-{
-       return inst;
-}
diff --git a/src/lib/interface/ui_iface_app.cpp b/src/lib/interface/ui_iface_app.cpp
new file mode 100644 (file)
index 0000000..ecaec2d
--- /dev/null
@@ -0,0 +1,311 @@
+/*
+ * 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 <system_settings.h>
+#include "../../include/interface/ui_iface_viewmanager.h"
+
+/***********************************************************************************************/
+/* Internal class Implementation                                                               */
+/***********************************************************************************************/
+namespace ui_viewmanager
+{
+
+class ui_iface_app_impl
+{
+public:
+       friend class ui_iface_app;
+
+       ui_iface_app *app;
+       ui_iface_viewmgr *viewmgr;
+       Eina_Stringshare *pkg;
+       Eina_Stringshare *locale_dir;
+
+       ui_iface_app_impl(ui_iface_app *app, const char *pkg, const char *locale_dir, ui_iface_viewmgr* viewmgr);
+       ~ui_iface_app_impl();
+
+       int run(int argc, char **argv);
+
+       bool init();
+       bool on_create();
+       void on_terminate();
+       void on_pause();
+       void on_resume();
+       void on_control(app_control_h app_control);
+
+       //
+       void on_low_battery(app_event_info_h event_info);
+       void on_low_memory(app_event_info_h event_info);
+       void on_region_changed(app_event_info_h event_info);
+       void on_orient_changed(app_event_info_h event_info);
+       void on_lang_changed(app_event_info_h event_info);
+};
+
+}
+
+static bool app_create(void *data)
+{
+       ui_iface_app_impl *app = static_cast<ui_iface_app_impl *>(data);
+       return app->on_create();
+}
+
+static void app_terminate(void *data)
+{
+       ui_iface_app_impl *app = static_cast<ui_iface_app_impl *>(data);
+       app->on_terminate();
+}
+
+static void app_pause(void *data)
+{
+       ui_iface_app_impl *app = static_cast<ui_iface_app_impl *>(data);
+       app->on_pause();
+}
+
+static void app_resume(void *data)
+{
+       ui_iface_app_impl *app = static_cast<ui_iface_app_impl *>(data);
+       app->on_resume();
+}
+
+static void app_control(app_control_s *app_control, void *data)
+{
+       ui_iface_app_impl *app = static_cast<ui_iface_app_impl *>(data);
+       app->on_control(app_control);
+}
+
+static void ui_app_lang_changed(app_event_info_h event_info, void *data)
+{
+       ui_iface_app_impl *app = static_cast<ui_iface_app_impl *>(data);
+       app->on_lang_changed(event_info);
+}
+
+static void ui_app_orient_changed(app_event_info_h event_info, void *data)
+{
+       ui_iface_app_impl *app = static_cast<ui_iface_app_impl *>(data);
+       app->on_orient_changed(event_info);
+}
+
+static void ui_app_region_changed(app_event_info_h event_info, void *data)
+{
+       ui_iface_app_impl *app = static_cast<ui_iface_app_impl *>(data);
+       app->on_region_changed(event_info);
+}
+
+static void ui_app_low_battery(app_event_info_h event_info, void *data)
+{
+       ui_iface_app_impl *app = static_cast<ui_iface_app_impl *>(data);
+       app->on_low_battery(event_info);
+}
+
+static void ui_app_low_memory(app_event_info_h event_info, void *data)
+{
+       ui_iface_app_impl *app = static_cast<ui_iface_app_impl *>(data);
+       app->on_low_memory(event_info);
+}
+
+bool ui_iface_app_impl::init()
+{
+       //FIXME: this scale value should be configurable.
+       elm_app_base_scale_set(2.6);
+
+       /* Bind package locale file */
+       bindtextdomain(this->pkg, this->locale_dir);
+       textdomain(this->pkg);
+
+       return true;
+}
+
+ui_iface_app_impl::ui_iface_app_impl(ui_iface_app *app, const char *pkg, const char *locale_dir, ui_iface_viewmgr *viewmgr)
+               : app(app), viewmgr(viewmgr)
+{
+       this->pkg = eina_stringshare_add(pkg);
+       this->locale_dir = eina_stringshare_add(locale_dir);
+}
+
+int ui_iface_app_impl::run(int argc, char **argv)
+{
+       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, this);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, this);
+       ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, this);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, this);
+       ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, this);
+
+       int ret = ui_app_main(argc, argv, &event_callback, this);
+
+       if (ret != APP_ERROR_NONE)
+       {
+               LOGE("ui_app_main() is failed. err = %d", ret);
+       }
+
+       return ret;
+}
+
+ui_iface_app_impl::~ui_iface_app_impl()
+{
+       delete (this->viewmgr);
+       eina_stringshare_del(this->pkg);
+       eina_stringshare_del(this->locale_dir);
+}
+
+void ui_iface_app_impl::on_lang_changed(app_event_info_h event_info)
+{
+       this->app->on_lang_changed(event_info);
+}
+
+void ui_iface_app_impl::on_low_memory(app_event_info_h event_info)
+{
+       this->app->on_low_memory(event_info);
+}
+
+void ui_iface_app_impl::on_low_battery(app_event_info_h event_info)
+{
+       this->app->on_low_battery(event_info);
+}
+
+void ui_iface_app_impl::on_region_changed(app_event_info_h event_info)
+{
+       this->app->on_region_changed(event_info);
+}
+
+void ui_iface_app_impl::on_orient_changed(app_event_info_h event_info)
+{
+       this->app->on_orient_changed(event_info);
+}
+
+bool ui_iface_app_impl::on_create()
+{
+       return this->app->on_create();
+}
+
+void ui_iface_app_impl::on_pause()
+{
+       this->app->on_pause();
+}
+
+void ui_iface_app_impl::on_resume()
+{
+       this->app->on_resume();
+}
+
+void ui_iface_app_impl::on_control(app_control_h app_control)
+{
+       this->app->on_control(app_control);
+}
+
+void ui_iface_app_impl::on_terminate()
+{
+       this->app->on_terminate();
+}
+
+/***********************************************************************************************/
+/* External class Implementation                                                               */
+/***********************************************************************************************/
+
+static ui_iface_app *inst = NULL;
+
+void ui_iface_app::on_lang_changed(app_event_info_h event_info)
+{
+       char *locale = NULL;
+       system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+       elm_language_set(locale);
+       free(locale);
+}
+
+void ui_iface_app::on_low_memory(app_event_info_h event_info)
+{
+
+}
+
+void ui_iface_app::on_low_battery(app_event_info_h event_info)
+{
+
+}
+
+void ui_iface_app::on_region_changed(app_event_info_h event_info)
+{
+
+}
+
+void ui_iface_app::on_orient_changed(app_event_info_h event_info)
+{
+
+}
+
+bool ui_iface_app::on_create()
+{
+       return this->impl->init();
+}
+
+void ui_iface_app::on_pause()
+{
+       this->impl->viewmgr->deactivate();
+}
+
+void ui_iface_app::on_resume()
+{
+//     this->impl->viewmgr->activate();
+}
+
+void ui_iface_app::on_control(app_control_h app_control)
+{
+       /* Handle the launch request. */
+       this->impl->viewmgr->activate();
+}
+
+void ui_iface_app::on_terminate()
+{
+       delete(this);
+}
+
+ui_iface_app::ui_iface_app(const char *pkg, const char *locale_dir, ui_iface_viewmgr *viewmgr)
+{
+       if (inst)
+       {
+               LOGE("You created ui_iface_app multiple times!!");
+       }
+       inst = this;
+
+       this->impl = new ui_iface_app_impl(this, pkg, locale_dir, viewmgr);
+}
+
+int ui_iface_app::run(int argc, char **argv)
+{
+       return this->impl->run(argc, argv);
+}
+
+ui_iface_app::~ui_iface_app()
+{
+       delete (this->impl);
+       inst = NULL;
+}
+
+ui_iface_viewmgr *ui_iface_app::get_viewmgr()
+{
+       return this->impl->viewmgr;
+}
+
+ui_iface_app *ui_iface_app::get_instance()
+{
+       return inst;
+}