#ifndef _UI_VIEW_H_
#define _UI_VIEW_H_
+#include <list>
+
+using namespace std;
+
namespace efl_viewmanager
{
protected:
//Don't allow to create ui_viewmgr instance
ui_viewmgr(const char *pkg);
- ui_viewmgr(const ui_viewmgr& viewmgr);
virtual ~ui_viewmgr();
};
}
#define _UI_BASE_VIEWMGR_H_
#include <map>
+#include <string>
+
+using namespace std;
//FIXME: ??
#ifndef Elm_Conformant
///Constructor.
ui_base_viewmgr(const char *pkg);
- ui_base_viewmgr(const ui_base_viewmgr& viewmgr);
///Destructor.
virtual ~ui_base_viewmgr();
#ifndef _UI_IFACE_VIEW_H_
#define _UI_IFACE_VIEW_H_
-#include <string>
-
-using namespace std;
-
namespace ui_viewmanager {
class ui_iface_viewmgr;
*/
class ui_iface_view : public ui_iface_rotatable
{
- friend class ui_iface_viewmgr;
-
-private:
- T content; ///< A content instance for a screen as a view.
- string name; ///< View name.
- string transition_style; ///< View transition style name.
- ui_iface_viewmgr *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_iface_viewmgr 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_iface_viewmgr.
- *
- */
- virtual void on_load();
-
- /** @brief view unload state.
- *
- * @note this state will be triggered by ui_iface_viewmgr.
- *
- */
- virtual void on_unload();
-
- /** @brief view activate state.
- *
- * @note this state will be triggered by ui_iface_viewmgr.
- *
- */
- virtual void on_activate();
-
- /** @brief view deactivate state.
- *
- * @note this state will be triggered by ui_iface_viewmgr.
- *
- */
- virtual void on_deactivate();
-
- /** @brief view pause state.
- *
- * @note this state will be triggered by ui_iface_viewmgr.
- *
- */
- virtual void on_pause();
-
- /** @brief view resume state.
- *
- * @note this state will be triggered by ui_iface_viewmgr.
- *
- */
- virtual void on_resume();
-
- /** @brief view destroy state.
- *
- * @note this state will be triggered by ui_iface_viewmgr.
- *
- */
- virtual void on_destroy();
-
- /** @brief Return the state of event block.
- *
- * @see set_event_block()
- */
- bool get_event_block();
-
- /** @brief Return a viewmgr which this view is belonging to.
- */
- //FIXME: Is it necessary?
- ui_iface_viewmgr *get_viewmgr();
-
- /** @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 true if it succeed, false otherwise.
- */
- virtual bool set_content(T content);
-
- /** @brief This is for unsetting a content of the view.
- *
- * @return A previous content. If it wasn't, return value will be @c NULL.
- */
- virtual T unset_content();
-
public:
/** @brief This is a constructor for initializing this view resources.
*
*/
T get_content();
+ /** @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 true if it succeed, false otherwise.
+ */
+ virtual bool set_content(T content);
+
+ /** @brief This is for unsetting a content of the view.
+ *
+ * @return A previous content. If it wasn't, return value will be @c NULL.
+ */
+ virtual T unset_content();
+
/** @brief Return a state of this view.
*
* #return current state of view.
ui_view_indicator get_indicator();
void on_back();
+
+protected:
+
+ /** @brief toggle event block.
+ *
+ * @note This interface is designed for toggling touch event on view transition.
+ * ui_iface_viewmgr 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_iface_viewmgr.
+ *
+ */
+ virtual void on_load();
+
+ /** @brief view unload state.
+ *
+ * @note this state will be triggered by ui_iface_viewmgr.
+ *
+ */
+ virtual void on_unload();
+
+ /** @brief view activate state.
+ *
+ * @note this state will be triggered by ui_iface_viewmgr.
+ *
+ */
+ virtual void on_activate();
+
+ /** @brief view deactivate state.
+ *
+ * @note this state will be triggered by ui_iface_viewmgr.
+ *
+ */
+ virtual void on_deactivate();
+
+ /** @brief view pause state.
+ *
+ * @note this state will be triggered by ui_iface_viewmgr.
+ *
+ */
+ virtual void on_pause();
+
+ /** @brief view resume state.
+ *
+ * @note this state will be triggered by ui_iface_viewmgr.
+ *
+ */
+ virtual void on_resume();
+
+ /** @brief view destroy state.
+ *
+ * @note this state will be triggered by ui_iface_viewmgr.
+ *
+ */
+ virtual void on_destroy();
+
+ /** @brief Return the state of event block.
+ *
+ * @see set_event_block()
+ */
+ bool get_event_block();
+
+private:
+ bool set_viewmgr(ui_iface_viewmgr *viewmgr);
+ ui_iface_viewmgr *get_viewmgr();
+
+ _UI_DECLARE_PRIVATE_IMPL(ui_iface_view);
+ _UI_DISABLE_COPY_AND_ASSIGN(ui_iface_view);
+ _UI_DECLARE_FRIENDS(ui_iface_viewmgr);
};
}
#include <app.h>
#include <dlog.h>
-#define UI_EFL 1
-
-#if UI_EFL
- #include <Elementary.h>
- typedef Evas_Object* T;
-#else if UI_DALI
-#endif
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "UI_VIEWMGR"
-
enum ui_view_indicator
{
UI_VIEW_INDICATOR_DEFAULT = 0,
UI_VIEW_STATE_LAST
};
+
+#define UI_EFL 1
+
+#if UI_EFL
+ #include <Elementary.h>
+ typedef Evas_Object* T;
+#elif UI_DALI
+#endif
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "UI_VIEWMGR"
+
+#define _UI_DECLARE_FRIENDS(A) \
+ friend class A##_impl
+
+#define _UI_DECLARE_PRIVATE_IMPL(A) \
+ class A##_impl *impl; \
+ friend class A##_impl
+
+#define _UI_DISABLE_COPY_AND_ASSIGN(A) \
+ A(const A&) = delete; \
+ const A& operator=(const A&) = delete
+
#include "ui_iface_singleton.h"
#include "ui_iface_rotatable.h"
#include "ui_iface_overlay.h"
using namespace ui_viewmanager;
-#define _UI_DECLARE_PRIVATE_IMPL(A) \
- class A_##impl *impl; \
- friend class A_##impl
-
-#define _UI_DISABLE_COPY_AND_ASSIGN(A) \
- A_##impl(const A_##impl&) = delete; \
- const A_##impl& operator=(const A_##impl&) = delete
-
#endif /* UI_IFACE_VIEWMANAGER_H */
#ifndef _UI_IFACE_VIEWMGR_H_
#define _UI_IFACE_VIEWMGR_H_
-#include <list>
-
-using namespace std;
-
namespace ui_viewmanager {
class ui_iface_view;
*/
class ui_iface_viewmgr
{
- friend class ui_iface_view;
-
-private:
- static ui_iface_viewmgr *inst;
- static bool soft_key; //If system doesn't support HW back key, then this value is @c true.
- static bool event_block; //Event block on view transition. This value should be configurable by system.
- list<ui_iface_view *> view_list; //View list.
- bool activated; //Activated status of this viewmgr.
+public:
+ /**
+ * @brief Activate this view manager.
+ *
+ * @note viewmgr window and views will be shown once activate() is called. Usually this activate() should be called after applications set their all views
+ * on initialization time.
+ *
+ * @return @c true on success or @c false otherwise.
+ *
+ * @see deactivate()
+ */
+ bool activate();
/**
- * @brief Connect a given view to this viewmgr.
+ * @brief Deactivate this view manager.
*
- * @param view A view to connect to this viewmgr which means the @p view is to belong to this viewmgr.
+ * @note viewmgr window and views will be hidden once deactivate() is called. deactivate() behavior is up ui system, but usually it hides(unmap)
+ * current window in order that application go background.
*
* @return @c true success or @c false not.
*
- * @warning If the given view is already connected to a viewmgr, this call will be failed.
- * @see disconnect_view()
+ * @see activate()
*/
- bool connect_view(ui_iface_view *view);
+ bool deactivate();
/**
- * @brief Disconnect a given view from this viewmgr.
+ * @brief Return the active status of viewmgr.
*
- * @param view A view to disconnect from this viewmgr.
+ * @return @c true if viewmgr is activated, @c false otherwise.
*
- * @return @c true on success or @c false otherwise.
+ * @see activate()
+ * @see deactivate()
+ */
+ bool is_activated();
+
+ /**
+ * @brief Return the number of views which this viewmgr has.
*
- * @see connect_view()
+ * @return the number of view
*/
- bool disconnect_view(ui_iface_view *view);
+ unsigned int get_view_count();
/**
- * @brief Toggle event blocking to the given view.
+ * @brief Return whether soft key is required or not.
*
- * @note If the event is blocked, product users won't be able to enter any inputs to this @p view. These inputs are mouse clicks, key press,
- * screen touches, etc. Event if this function is called, @p view will be event-blocked only when system requires event blocking.
- * Most of the times, This function should be used on transition. @see also push_view(), push_view_finished(), pop_view(), pop_view_finished().
+ * @note Soft key is kind of like the software back button. It's used for product users to change current view to a previous view (pop).
+ * If a device doesn't have any hardware back buttons, Soft back key is necessary which means this function will return @c true.
+ * Some devices may needs software back key as well as hardware back key at the same time. That decision is up to product design.
+ * And soft_key initial value should read from the system configuration.
*
- * @param view A view to toggle event blocking.
- * @param block @c true is blocking event, otherwise @c false.
+ * @return @c true if soft key is required, @c false otherwise.
*/
- void set_event_block(ui_iface_view *view, bool block);
+ static bool need_soft_key();
+
+ static ui_iface_viewmgr* get_instance();
protected:
/**
///Constructor.
ui_iface_viewmgr();
- ui_iface_viewmgr(const ui_iface_viewmgr& viewmgr);
///Destructor.
virtual ~ui_iface_viewmgr();
-public:
- /**
- * @brief Activate this view manager.
- *
- * @note viewmgr window and views will be shown once activate() is called. Usually this activate() should be called after applications set their all views
- * on initialization time.
- *
- * @return @c true on success or @c false otherwise.
- *
- * @see deactivate()
- */
- bool activate();
-
- /**
- * @brief Deactivate this view manager.
- *
- * @note viewmgr window and views will be hidden once deactivate() is called. deactivate() behavior is up ui system, but usually it hides(unmap)
- * current window in order that application go background.
- *
- * @return @c true success or @c false not.
- *
- * @see activate()
- */
- bool deactivate();
-
- /**
- * @brief Return the active status of viewmgr.
- *
- * @return @c true if viewmgr is activated, @c false otherwise.
- *
- * @see activate()
- * @see deactivate()
- */
- bool is_activated();
-
- /**
- * @brief Return the number of views which this viewmgr has.
- *
- * @return the number of view
- */
- unsigned int get_view_count();
-
- /**
- * @brief Return whether soft key is required or not.
- *
- * @note Soft key is kind of like the software back button. It's used for product users to change current view to a previous view (pop).
- * If a device doesn't have any hardware back buttons, Soft back key is necessary which means this function will return @c true.
- * Some devices may needs software back key as well as hardware back key at the same time. That decision is up to product design.
- * And soft_key initial value should read from the system configuration.
- *
- * @return @c true if soft key is required, @c false otherwise.
- */
- static bool need_soft_key();
- static ui_iface_viewmgr* get_instance();
+private:
+ _UI_DECLARE_PRIVATE_IMPL(ui_iface_viewmgr);
+ _UI_DISABLE_COPY_AND_ASSIGN(ui_iface_viewmgr);
+ _UI_DECLARE_FRIENDS(ui_iface_view);
};
}
ui_viewmgr::~ui_viewmgr()
{
}
-
-ui_viewmgr::ui_viewmgr(const ui_viewmgr& viewmgr)
- : ui_base_viewmgr(viewmgr)
-{
-
-}
{
}
-ui_base_viewmgr::ui_base_viewmgr(const ui_base_viewmgr& viewmgr)
- : ui_iface_viewmgr(viewmgr)
-{
-}
-
ui_base_viewmgr::~ui_base_viewmgr()
{
this->key_listener->term();
#include "../../include/interface/ui_iface_viewmanager.h"
-bool ui_iface_view::get_event_block()
+#include <string>
+
+using namespace std;
+
+/***********************************************************************************************/
+/* Internal class Implementation */
+/***********************************************************************************************/
+namespace ui_viewmanager {
+
+class ui_iface_view_impl
{
- return this->event_block;
+ friend class ui_iface_viewmgr_impl;
+ friend class ui_iface_view;
+
+private:
+ ui_iface_view *view;
+ T content; ///< A content instance for a screen as a view.
+ string name; ///< View name.
+ string transition_style; ///< View transition style name.
+ ui_iface_viewmgr *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.
+
+public:
+ void set_event_block(bool block);
+ void on_load();
+ void on_unload();
+ void on_activate();
+ void on_deactivate();
+ void on_pause();
+ void on_resume();
+ void on_destroy();
+ bool get_event_block();
+ bool set_content(T content);
+ T unset_content();
+
+ ui_iface_view_impl(ui_iface_view *view, const char *name);
+ ~ui_iface_view_impl();
+
+ bool set_transition_style(const char *style);
+ bool set_name(const char *name);
+ void set_removable_content(bool removable);
+ void set_indicator(ui_view_indicator indicator);
+ const char *get_transition_style();
+ const char *get_name();
+ T get_content();
+ ui_view_state get_state();
+ bool get_removable_content();
+ ui_view_indicator get_indicator();
+ void on_back();
+};
+
}
-ui_iface_viewmgr *ui_iface_view::get_viewmgr()
+bool ui_iface_view_impl::get_event_block()
{
- return this->viewmgr;
+ return this->event_block;
}
-void ui_iface_view::set_event_block(bool block)
+void ui_iface_view_impl::set_event_block(bool block)
{
this->event_block = block;
}
-void ui_iface_view::on_load()
+void ui_iface_view_impl::on_load()
{
this->state = UI_VIEW_STATE_LOAD;
}
-void ui_iface_view::on_unload()
+void ui_iface_view_impl::on_unload()
{
this->state = UI_VIEW_STATE_UNLOAD;
if (this->get_removable_content())
}
}
-void ui_iface_view::on_activate()
+void ui_iface_view_impl::on_activate()
{
this->state = UI_VIEW_STATE_ACTIVATE;
}
-void ui_iface_view::on_deactivate()
+void ui_iface_view_impl::on_deactivate()
{
this->state = UI_VIEW_STATE_DEACTIVATE;
}
-void ui_iface_view::on_pause()
+void ui_iface_view_impl::on_pause()
{
this->state = UI_VIEW_STATE_PAUSE;
}
-void ui_iface_view::on_resume()
+void ui_iface_view_impl::on_resume()
{
this->state = UI_VIEW_STATE_ACTIVATE;
}
-void ui_iface_view::on_destroy()
+void ui_iface_view_impl::on_destroy()
{
}
-ui_iface_view::ui_iface_view(const char *name)
- : content(NULL), name(string(name ? name : "")), transition_style(string("default")), viewmgr(NULL), state(UI_VIEW_STATE_LOAD),
+ui_iface_view_impl::ui_iface_view_impl(ui_iface_view *view, const char *name)
+ : view(view), content(NULL), name(string(name ? name : "")), transition_style(string("default")), viewmgr(NULL), state(UI_VIEW_STATE_LOAD),
indicator(UI_VIEW_INDICATOR_DEFAULT), event_block(false), removable_content(true)
{
this->state = UI_VIEW_STATE_UNLOAD;
}
-ui_iface_view::~ui_iface_view()
+ui_iface_view_impl::~ui_iface_view_impl()
{
- this->viewmgr->remove_view(this);
+ this->viewmgr->remove_view(this->view);
}
-bool ui_iface_view::set_content(T content)
+bool ui_iface_view_impl::set_content(T content)
{
this->content = content;
return true;
}
-T ui_iface_view::unset_content()
+T ui_iface_view_impl::unset_content()
{
T prev = this->content;
this->content = NULL;
return prev;
}
-bool ui_iface_view::set_transition_style(const char *style)
+bool ui_iface_view_impl::set_transition_style(const char *style)
{
this->transition_style.assign(style);
return true;
}
-bool ui_iface_view::set_name(const char *name)
+bool ui_iface_view_impl::set_name(const char *name)
{
this->name.assign(name);
return true;
}
-void ui_iface_view::set_removable_content(bool removable)
+void ui_iface_view_impl::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_iface_view::set_indicator(ui_view_indicator indicator)
+void ui_iface_view_impl::set_indicator(ui_view_indicator indicator)
{
this->indicator = indicator;
}
-const char *ui_iface_view::get_transition_style()
+const char *ui_iface_view_impl::get_transition_style()
{
return this->transition_style.c_str();
}
-const char *ui_iface_view::get_name()
+const char *ui_iface_view_impl::get_name()
{
return this->name.c_str();
}
-T ui_iface_view::get_content()
+T ui_iface_view_impl::get_content()
{
return this->content;
}
-ui_view_state ui_iface_view::get_state()
+ui_view_state ui_iface_view_impl::get_state()
{
return this->state;
}
-bool ui_iface_view::get_removable_content()
+bool ui_iface_view_impl::get_removable_content()
{
return this->removable_content;
}
-ui_view_indicator ui_iface_view::get_indicator()
+ui_view_indicator ui_iface_view_impl::get_indicator()
{
return this->indicator;
}
-void ui_iface_view::on_back()
+void ui_iface_view_impl::on_back()
{
- ui_iface_viewmgr *viewmgr = this->get_viewmgr();
+ ui_iface_viewmgr *viewmgr = this->viewmgr;
if (!viewmgr)
{
LOGE("Failed to get a viewmgr, view =%p", this);
}
viewmgr->pop_view();
}
+
+/***********************************************************************************************/
+/* External class Implementation */
+/***********************************************************************************************/
+
+bool ui_iface_view::get_event_block()
+{
+ return this->impl->get_event_block();
+}
+
+void ui_iface_view::set_event_block(bool block)
+{
+ this->impl->set_event_block(block);
+}
+
+void ui_iface_view::on_load()
+{
+ this->impl->on_load();
+}
+
+void ui_iface_view::on_unload()
+{
+ this->impl->on_unload();
+}
+
+void ui_iface_view::on_activate()
+{
+ this->impl->on_activate();
+}
+
+void ui_iface_view::on_deactivate()
+{
+ this->impl->on_deactivate();
+}
+
+void ui_iface_view::on_pause()
+{
+ this->impl->on_pause();
+}
+
+void ui_iface_view::on_resume()
+{
+ this->impl->on_resume();
+}
+
+void ui_iface_view::on_destroy()
+{
+ this->impl->on_destroy();
+}
+
+ui_iface_view::ui_iface_view(const char *name)
+{
+ this->impl = new ui_iface_view_impl(this, name);
+}
+
+ui_iface_view::~ui_iface_view()
+{
+ delete(this->impl);
+}
+
+bool ui_iface_view::set_content(T content)
+{
+ return this->impl->set_content(content);
+}
+
+T ui_iface_view::unset_content()
+{
+ return this->impl->unset_content();
+}
+
+bool ui_iface_view::set_transition_style(const char *style)
+{
+ return this->impl->set_transition_style(style);
+}
+
+bool ui_iface_view::set_name(const char *name)
+{
+ return this->impl->set_name(name);
+}
+
+void ui_iface_view::set_removable_content(bool removable)
+{
+ this->impl->set_removable_content(removable);
+}
+
+void ui_iface_view::set_indicator(ui_view_indicator indicator)
+{
+ this->impl->set_indicator(indicator);
+}
+
+const char *ui_iface_view::get_transition_style()
+{
+ return this->impl->get_transition_style();
+}
+
+const char *ui_iface_view::get_name()
+{
+ return this->impl->get_name();
+}
+
+T ui_iface_view::get_content()
+{
+ return this->impl->get_content();
+}
+
+ui_view_state ui_iface_view::get_state()
+{
+ return this->impl->get_state();
+}
+
+bool ui_iface_view::get_removable_content()
+{
+ return this->impl->get_removable_content();
+}
+
+ui_view_indicator ui_iface_view::get_indicator()
+{
+ return this->impl->get_indicator();
+}
+
+void ui_iface_view::on_back()
+{
+ this->impl->on_back();
+}
+
+bool ui_iface_view::set_viewmgr(ui_iface_viewmgr *viewmgr)
+{
+ this->impl->viewmgr = viewmgr;
+ return true;
+}
+
+ui_iface_viewmgr *ui_iface_view::get_viewmgr()
+{
+ return this->impl->viewmgr;
+}
+
*
*/
+#include <list>
#include "../../include/interface/ui_iface_viewmanager.h"
-ui_iface_viewmgr *ui_iface_viewmgr::inst = NULL;
+using namespace std;
-#define VIEW_ITR list<ui_iface_view *>::iterator
-#define VIEW_RITR list<ui_iface_view *>::reverse_iterator
+/***********************************************************************************************/
+/* Internal class Implementation */
+/***********************************************************************************************/
+namespace ui_viewmanager {
+
+class ui_iface_viewmgr_impl
+{
+ friend class ui_iface_view_impl;
+ friend class ui_iface_viewmgr;
+
+private:
+ static ui_iface_viewmgr *inst;
+ static bool soft_key; //If system doesn't support HW back key, then this value is @c true.
+ static bool event_block; //Event block on view transition. This value should be configurable by system.
+ list<ui_iface_view *> view_list; //View list.
+ bool activated; //Activated status of this viewmgr.
+
+public:
+ bool connect_view(ui_iface_view *view);
+ bool disconnect_view(ui_iface_view *view);
+ void set_event_block(ui_iface_view *view, bool block);
+
+ bool push_view_finished(ui_iface_view *view);
+ bool pop_view_finished(ui_iface_view *view);
+ ui_iface_view *push_view(ui_iface_view *view);
+ bool pop_view();
+ bool insert_view_before(ui_iface_view *view, ui_iface_view *before);
+ bool insert_view_after(ui_iface_view *view, ui_iface_view *after);
+ bool remove_view(ui_iface_view *view);
+ ui_iface_view* get_view(unsigned int idx);
+ ui_iface_view *get_view(const char *name);
+ ui_iface_view *get_last_view();
+ int get_view_index(const ui_iface_view *view);
+
+ ui_iface_viewmgr_impl(ui_iface_viewmgr *viewmgr);
+ ~ui_iface_viewmgr_impl();
+
+ bool activate();
+ bool deactivate();
+ bool is_activated();
+ unsigned int get_view_count();
+ static bool need_soft_key();
+ static ui_iface_viewmgr* get_instance();
+};
+}
+
+ui_iface_viewmgr* ui_iface_viewmgr_impl::inst = NULL;
//FIXME: Read system profile to decide whether support software key or not.
-bool ui_iface_viewmgr::soft_key = true;
+bool ui_iface_viewmgr_impl::soft_key = true;
//FIXME: Read system profile to decide whether support event block or not.
-bool ui_iface_viewmgr::event_block = true;
+bool ui_iface_viewmgr_impl::event_block = true;
-bool ui_iface_viewmgr::insert_view_after(ui_iface_view *view, ui_iface_view *after)
+#define VIEW_ITR list<ui_iface_view *>::iterator
+#define VIEW_RITR list<ui_iface_view *>::reverse_iterator
+
+bool ui_iface_viewmgr_impl::insert_view_after(ui_iface_view *view, ui_iface_view *after)
{
VIEW_ITR it;
return true;
}
-bool ui_iface_viewmgr::need_soft_key()
+bool ui_iface_viewmgr_impl::need_soft_key()
{
- return ui_iface_viewmgr::soft_key;
+ return ui_iface_viewmgr_impl::soft_key;
}
-bool ui_iface_viewmgr::connect_view(ui_iface_view *view)
+bool ui_iface_viewmgr_impl::connect_view(ui_iface_view *view)
{
//FIXME: If user call a set_viewmgr() before, It should not return false.
- /*
- if (view->viewmgr)
- {
- LOGE("view(%p) has already connected to viewmgr(%p)", view, this);
- return false;
- }
- */
-
- view->viewmgr = this;
- return true;
+ return view->set_viewmgr(this->get_instance());
}
-bool ui_iface_viewmgr::disconnect_view(ui_iface_view *view)
+bool ui_iface_viewmgr_impl::disconnect_view(ui_iface_view *view)
{
- if (!view->viewmgr) return false;
- view->viewmgr = NULL;
+ if (!view->get_viewmgr()) return false;
+ view->set_viewmgr(NULL);
return true;
}
-void ui_iface_viewmgr::set_event_block(ui_iface_view *view, bool block)
+void ui_iface_viewmgr_impl::set_event_block(ui_iface_view *view, bool block)
{
- if (!ui_iface_viewmgr::event_block) return;
+ if (!ui_iface_viewmgr_impl::event_block) return;
view->set_event_block(block);
}
-bool ui_iface_viewmgr::push_view_finished(ui_iface_view *view)
+bool ui_iface_viewmgr_impl::push_view_finished(ui_iface_view *view)
{
ui_iface_view *last = this->view_list.back();
return true;
}
-bool ui_iface_viewmgr::pop_view_finished(ui_iface_view *view)
+bool ui_iface_viewmgr_impl::pop_view_finished(ui_iface_view *view)
{
ui_iface_view *last = this->view_list.back();
return true;
}
-ui_iface_viewmgr::ui_iface_viewmgr(const ui_iface_viewmgr& viewmgr)
-{
-}
-
-ui_iface_viewmgr::ui_iface_viewmgr()
+ui_iface_viewmgr_impl::ui_iface_viewmgr_impl(ui_iface_viewmgr* viewmgr)
: activated(false)
{
- ui_iface_viewmgr::inst = this;
+ ui_iface_viewmgr_impl::inst = viewmgr;
}
-ui_iface_viewmgr::~ui_iface_viewmgr()
+ui_iface_viewmgr_impl::~ui_iface_viewmgr_impl()
{
//Terminate views
for (VIEW_RITR it = this->view_list.rbegin(); it != this->view_list.rend(); it++)
//FIXME: Window is destroyed. Terminate Application!
ui_app_exit();
- ui_iface_viewmgr::inst = NULL;
+ ui_iface_viewmgr_impl::inst = NULL;
}
-ui_iface_view *ui_iface_viewmgr::push_view(ui_iface_view *view)
+ui_iface_view *ui_iface_viewmgr_impl::push_view(ui_iface_view *view)
{
if (!view)
{
return view;
}
-bool ui_iface_viewmgr::pop_view()
+bool ui_iface_viewmgr_impl::pop_view()
{
//FIXME: No more view?
if (this->get_view_count() == 0)
return true;
}
-bool ui_iface_viewmgr::insert_view_before(ui_iface_view *view, ui_iface_view *before)
+bool ui_iface_viewmgr_impl::insert_view_before(ui_iface_view *view, ui_iface_view *before)
{
VIEW_ITR it;
return true;
}
-bool ui_iface_viewmgr::remove_view(ui_iface_view *view)
+bool ui_iface_viewmgr_impl::remove_view(ui_iface_view *view)
{
this->view_list.remove(view);
this->disconnect_view(view);
return true;
}
-ui_iface_view *ui_iface_viewmgr::get_view(unsigned int idx)
+ui_iface_view *ui_iface_viewmgr_impl::get_view(unsigned int idx)
{
if (idx < 0 || idx >= this->view_list.size())
{
return *it;
}
-int ui_iface_viewmgr::get_view_index(const ui_iface_view *view)
+int ui_iface_viewmgr_impl::get_view_index(const ui_iface_view *view)
{
int idx = 0;
return -1;
}
-ui_iface_view *ui_iface_viewmgr::get_last_view()
+ui_iface_view *ui_iface_viewmgr_impl::get_last_view()
{
int cnt = this->get_view_count();
return this->get_view(cnt - 1);
}
-bool ui_iface_viewmgr::activate()
+bool ui_iface_viewmgr_impl::activate()
{
if (this->activated) return false;
if (this->get_view_count() == 0) return false;
return true;
}
-bool ui_iface_viewmgr::deactivate()
+bool ui_iface_viewmgr_impl::deactivate()
{
if (!this->activated) return false;
this->activated = false;
return true;
}
-ui_iface_view *ui_iface_viewmgr::get_view(const char *name)
+ui_iface_view *ui_iface_viewmgr_impl::get_view(const char *name)
{
//FIXME: ...
return NULL;
}
-bool ui_iface_viewmgr::is_activated()
+bool ui_iface_viewmgr_impl::is_activated()
{
return this->activated;
}
-unsigned int ui_iface_viewmgr::get_view_count()
+unsigned int ui_iface_viewmgr_impl::get_view_count()
{
return this->view_list.size();
}
+ui_iface_viewmgr* ui_iface_viewmgr_impl::get_instance()
+{
+ return ui_iface_viewmgr_impl::inst;
+}
+
+/***********************************************************************************************/
+/* External class Implementation */
+/***********************************************************************************************/
+bool ui_iface_viewmgr::insert_view_after(ui_iface_view *view, ui_iface_view *after)
+{
+ return this->impl->insert_view_after(view, after);
+}
+
+bool ui_iface_viewmgr::need_soft_key()
+{
+ return ui_iface_viewmgr_impl::need_soft_key();
+}
+
+bool ui_iface_viewmgr::push_view_finished(ui_iface_view *view)
+{
+ return this->impl->push_view_finished(view);
+}
+
+bool ui_iface_viewmgr::pop_view_finished(ui_iface_view *view)
+{
+ return this->impl->pop_view_finished(view);
+}
+
+ui_iface_viewmgr::ui_iface_viewmgr()
+{
+ this->impl = new ui_iface_viewmgr_impl(this);
+}
+
+ui_iface_viewmgr::~ui_iface_viewmgr()
+{
+ delete(this->impl);
+}
+
+ui_iface_view *ui_iface_viewmgr::push_view(ui_iface_view *view)
+{
+ return this->impl->push_view(view);
+}
+
+bool ui_iface_viewmgr::pop_view()
+{
+ return this->impl->pop_view();
+}
+
+bool ui_iface_viewmgr::insert_view_before(ui_iface_view *view, ui_iface_view *before)
+{
+ return this->impl->insert_view_before(view, before);
+}
+
+bool ui_iface_viewmgr::remove_view(ui_iface_view *view)
+{
+ return this->impl->remove_view(view);
+}
+
+ui_iface_view *ui_iface_viewmgr::get_view(unsigned int idx)
+{
+ return this->impl->get_view(idx);
+}
+
+int ui_iface_viewmgr::get_view_index(const ui_iface_view *view)
+{
+ return this->get_view_index(view);
+}
+
+ui_iface_view *ui_iface_viewmgr::get_last_view()
+{
+ return this->impl->get_last_view();
+}
+
+bool ui_iface_viewmgr::activate()
+{
+ return this->impl->activate();
+}
+
+bool ui_iface_viewmgr::deactivate()
+{
+ return this->impl->deactivate();
+}
+
+ui_iface_view *ui_iface_viewmgr::get_view(const char *name)
+{
+ return this->impl->get_view(name);
+}
+
+bool ui_iface_viewmgr::is_activated()
+{
+ return this->impl->is_activated();
+}
+
+unsigned int ui_iface_viewmgr::get_view_count()
+{
+ return this->impl->get_view_count();
+}
+
ui_iface_viewmgr* ui_iface_viewmgr::get_instance()
{
- return ui_iface_viewmgr::inst;
+ return ui_iface_viewmgr_impl::get_instance();
}