class ui_viewmgr;
-class ui_app : public ui_base_app
+class ui_app : public ui_iface_app
{
public:
/**
+++ /dev/null
-/*
- * 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_ */
#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())
_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);
};
}
--- /dev/null
+/*
+ * 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_ */
+++ /dev/null
-#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_ */
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;
*
* @see deactivate()
*/
- bool activate();
+ virtual bool activate();
/**
* @brief Deactivate this view manager.
*
* @see activate()
*/
- bool deactivate();
+ virtual bool deactivate();
/**
* @brief Return the active status of viewmgr.
_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);
};
}
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
* limitations under the License.
*
*/
-#include <system_settings.h>
#include "../../../include/efl/mobile/ui_mobile_viewmanager.h"
/***********************************************************************************************/
/***********************************************************************************************/
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))
{
}
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());
}
+++ /dev/null
-/*
- * 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;
-}
--- /dev/null
+/*
+ * 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;
+}