reorganize classs domains.
Change-Id: I9c8faed884050b8b8ab9bb7813796b9a972dc4ee
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)
#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
#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"
*
*/
#include "main.h"
-#include "page5_controller.h"
-#include "page4_controller.h"
-#include "page3_controller.h"
-#include "page2_controller.h"
-#include "page1_controller.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)
//FIXME: Hide this creation.
ad->viewmgr = new ui_viewmgr(PACKAGE);
- page1(ad);
+ create_page1(ad);
ad->viewmgr->activate();
}
* limitations under the License.
*
*/
-class page1_controller: public ui_controller
+class page1: public ui_controller
{
private:
appdata_s *ad;
public:
- page1_controller(appdata_s *ad)
+ 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_controller()
+ ~page1()
{
}
[](void *data, Evas_Object *obj, void *event_info) -> void
{
appdata_s *ad = static_cast<appdata_s *>(data);
- page2(ad);
+ create_page2(ad);
},
this->ad);
}
};
-void page1(appdata_s *ad)
+void create_page1(appdata_s *ad)
{
- new page1_controller(ad);
+ new page1(ad);
}
* limitations under the License.
*
*/
-class page2_controller: public ui_controller
+class page2: public ui_controller
{
private:
appdata_s *ad;
public:
- page2_controller(appdata_s *ad)
+ page2(appdata_s *ad)
: ad(ad)
{
/* ui_basic_view(controller, identity name).
ad->viewmgr->push_view(new ui_basic_view(this, "page2"));
}
- ~page2_controller()
+ ~page2()
{
}
[](void *data, Evas_Object *obj, void *event_info) -> void
{
appdata_s *ad = static_cast<appdata_s *>(data);
- page3(ad);
+ create_page3(ad);
},
this->ad);
}
};
-void page2(appdata_s *ad)
+void create_page2(appdata_s *ad)
{
- new page2_controller(ad);
+ new page2(ad);
}
* limitations under the License.
*
*/
-class page3_controller: public ui_controller
+class page3: public ui_controller
{
private:
appdata_s *ad;
public:
- page3_controller(appdata_s *ad)
+ page3(appdata_s *ad)
: ad(ad)
{
/* ui_basic_view(controller, identity name).
ad->viewmgr->push_view(new ui_basic_view(this, "page3"));
}
- ~page3_controller()
+ ~page3()
{
}
[](void *data, Evas_Object *obj, void *event_info) -> void
{
appdata_s *ad = static_cast<appdata_s *>(data);
- page4(ad);
+ create_page4(ad);
},
this->ad);
}
};
-void page3(appdata_s *ad)
+void create_page3(appdata_s *ad)
{
- new page3_controller(ad);
+ new page3(ad);
}
* limitations under the License.
*
*/
-class page4_controller: public ui_controller
+class page4: public ui_controller
{
private:
appdata_s *ad;
public:
- page4_controller(appdata_s *ad)
+ page4(appdata_s *ad)
: ad(ad)
{
/* ui_basic_view(controller, identity name).
ad->viewmgr->push_view(new ui_basic_view(this, "page4"));
}
- ~page4_controller()
+ ~page4()
{
}
[](void *data, Evas_Object *obj, void *event_info) -> void
{
appdata_s *ad = static_cast<appdata_s *>(data);
- page5(ad);
+ create_page5(ad);
},
this->ad);
}
};
-void page4(appdata_s *ad)
+void create_page4(appdata_s *ad)
{
- new page4_controller(ad);
+ new page4(ad);
}
* limitations under the License.
*
*/
-class page5_controller: public ui_controller
+class page5: public ui_controller
{
private:
appdata_s *ad;
public:
- page5_controller(appdata_s *ad)
+ page5(appdata_s *ad)
: ad(ad)
{
//No basic form.
ui_view *view = ad->viewmgr->push_view(new ui_view(this, "page5"));
}
- ~page5_controller()
+ ~page5()
{
}
}
};
-void page5(appdata_s *ad)
+void create_page5(appdata_s *ad)
{
- new page5_controller(ad);
+ new page5(ad);
}
* limitations under the License.
*
*/
-#include "../efl_viewmgr.h"
-#include "mobile_key_handler.h"
+#include "ui_viewmanager.h"
using namespace efl;
static const char *KEY_BACK = "XF86Back";
static const char *KEY_MENU = "XF86Menu";
-enum mobile_key_event_type
+enum ui_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)
+ui_basic_key_listener::ui_basic_key_listener(ui_viewmgr *viewmgr)
+ : ui_key_listener(viewmgr)
{
}
-static void event_proc(mobile_key_handler *key_handler, Evas_Event_Key_Down *ev)
+static void event_proc(ui_basic_key_listener *key_handler, Evas_Event_Key_Down *ev)
{
- mobile_key_event_type type;
+ ui_key_event_type type;
if (!strcmp(ev->keyname, KEY_BACK))
type = UI_KEY_EVENT_BACK;
}
}
-bool mobile_key_handler::term()
+bool ui_basic_key_listener::term()
{
evas_object_del(this->key_grabber);
return true;
}
-bool mobile_key_handler::init()
+bool ui_basic_key_listener::init()
{
if (!this->viewmgr)
{
[](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);
+ ui_basic_key_listener *key_handler = static_cast<ui_basic_key_listener *>(data);
event_proc(key_handler, ev);
},
this);
* limitations under the License.
*
*/
-#ifndef MOBILE_KEY_HANDLER
-#define MOBILE_KEY_HANDLER
+#ifndef MOBILE_KEY_HANDLER_H
+#define MOBILE_KEY_HANDLER_H
-#include <Elementary.h>
-#include "../ui_key_handler.h"
+#include "../ui_viewmanager.h"
namespace efl
{
class ui_viewmgr;
-class mobile_key_handler : public ui_key_handler
+class ui_basic_key_listener : public ui_key_listener
{
public:
- mobile_key_handler(ui_viewmgr *viewmgr);
+ ui_basic_key_listener(ui_viewmgr *viewmgr);
bool init();
bool term();
}
-#endif /* MOBILE_KEY_HANDLER */
+#endif /* MOBILE_KEY_HANDLER_H */
* 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;
}
//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);
#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
{
* 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"
* 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);
}
* 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();
* limitations under the License.
*
*/
-#include "ui_viewmgr.h"
-#include "ui_key_handler.h"
+#include "ui_viewmanager.h"
using namespace efl;
UI_KEY_EVENT_BACK = 0,
};
-ui_key_handler::ui_key_handler(ui_viewmgr *viewmgr)
+ui_key_listener::ui_key_listener(ui_viewmgr *viewmgr)
: viewmgr(viewmgr), key_grabber(NULL)
{
}
-static void event_proc(ui_key_handler *key_handler, Evas_Event_Key_Down *ev)
+static void event_proc(ui_key_listener *key_handler, Evas_Event_Key_Down *ev)
{
ui_key_event_type type;
}
}
-bool ui_key_handler::term()
+bool ui_key_listener::term()
{
evas_object_del(this->key_grabber);
return true;
}
-bool ui_key_handler::init()
+bool ui_key_listener::init()
{
if (!this->viewmgr)
{
[](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);
+ ui_key_listener *key_handler = static_cast<ui_key_listener *>(data);
event_proc(key_handler, ev);
},
this);
* limitations under the License.
*
*/
-#ifndef UI_KEY_HANDLER
-#define UI_KEY_HANDLER
+#ifndef UI_KEY_LISTENER_H
+#define UI_KEY_LISTENER_H
#include <Elementary.h>
-#include "../interface/ui_viewmgr.h"
+#include "../interface/ui_viewmanager_interface.h"
namespace efl
{
class ui_viewmgr;
-class ui_key_handler
+class ui_key_listener
{
protected:
ui_viewmgr *viewmgr;
Evas_Object *key_grabber;
public:
- ui_key_handler(ui_viewmgr *viewmgr);
- virtual ~ui_key_handler() {}
+ ui_key_listener(ui_viewmgr *viewmgr);
+ virtual ~ui_key_listener() {}
virtual bool init();
virtual bool term();
}
-#endif /* UI_KEY_HANDLER */
+#endif /* UI_KEY_LISTENER_H */
* 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)
{
}
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;
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);
{
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());
* 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))
{
class ui_controller;
-class ui_view: public ui_view_base
+class ui_view: public ui_view_interface
{
friend class ui_viewmgr;
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 */
* 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"
+
* limitations under the License.
*
*/
-#include "efl_viewmgr.h"
+#include "ui_viewmanager.h"
using namespace efl;
}
ui_viewmgr::ui_viewmgr(const char *pkg)
- : ui_viewmgr_base(), key_handler(NULL)
+ : ui_viewmgr_interface(), key_listener(NULL)
{
if (!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");
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)
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());
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;
* 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;
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()
};
}
-#endif /* UI_VIEWMGR */
+#endif /* UI_VIEWMGR_H */
* limitations under the License.
*
*/
-#include "ui_viewmgr.h"
+#include "ui_viewmanager_interface.h"
-void ui_controller_base::set_view(ui_view_base *view)
+void ui_controller_interface::set_view(ui_view_interface *view)
{
if (this->view)
{
* limitations under the License.
*
*/
-#ifndef UI_CONTROLLER_BASE_H_
-#define UI_CONTROLLER_BASE_H_
+#ifndef UI_CONTROLLER_INTERFACE_H_
+#define UI_CONTROLLER_INTERFACE_H_
-class ui_view_base;
+class ui_view_interface;
/**
* @class ui_controller_base
* @author Hermet Park <chuneon.park@samsung.com>
*
*/
-class ui_controller_base
+class ui_controller_interface
{
- friend class ui_view_base;
+ friend class ui_view_interface;
private:
- ui_view_base *view;
+ ui_view_interface *view;
- void set_view(ui_view_base *view);
+ void set_view(ui_view_interface *view);
protected:
- ui_view_base *get_view()
+ ui_view_interface *get_view()
{
return this->view;
}
public:
- ui_controller_base() :
+ ui_controller_interface() :
view(NULL)
{
}
- virtual ~ui_controller_base()
+ virtual ~ui_controller_interface()
{
}
virtual void destroy() = 0;
};
-#endif /* UI_CONTROLLER_BASE_H_ */
+#endif /* UI_CONTROLLER_INTERFACE_H_ */
* limitations under the License.
*
*/
-#include "ui_viewmgr.h"
+#include "ui_viewmanager_interface.h"
-void ui_view_base::set_event_block(bool block)
+void ui_view_interface::set_event_block(bool block)
{
this->event_block = block;
}
-void ui_view_base::load()
+void ui_view_interface::load()
{
this->state = UI_VIEW_STATE_LOAD;
if (this->content) return;
this->controller->load();
}
-void ui_view_base::unload()
+void ui_view_interface::unload()
{
this->state = UI_VIEW_STATE_UNLOAD;
if (this->get_removable_content())
this->controller->unload();
}
-void ui_view_base::active()
+void ui_view_interface::active()
{
this->state = UI_VIEW_STATE_ACTIVE;
if (!this->controller) return;
this->controller->active();
}
-void ui_view_base::inactive()
+void ui_view_interface::inactive()
{
this->state = UI_VIEW_STATE_INACTIVE;
if (!this->controller) return;
this->controller->inactive();
}
-void ui_view_base::pause()
+void ui_view_interface::pause()
{
this->state = UI_VIEW_STATE_PAUSE;
if (!this->content) return;
this->controller->pause();
}
-void ui_view_base::resume()
+void ui_view_interface::resume()
{
this->state = UI_VIEW_STATE_ACTIVE;
if (state != UI_VIEW_STATE_PAUSE) return;
this->controller->resume();
}
-void ui_view_base::destroy()
+void ui_view_interface::destroy()
{
if (!this->controller) return;
this->controller->destroy();
}
-ui_view_base::ui_view_base(T content, ui_controller_base *controller, const char *name)
+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)
{
controller->set_view(this);
}
-ui_view_base::ui_view_base(ui_controller_base *controller, const char *name)
- : ui_view_base(NULL, controller, name)
+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_base::ui_view_base(const char *name)
- : ui_view_base(NULL, name)
+ui_view_interface::ui_view_interface(const char *name)
+ : ui_view_interface(NULL, name)
{
}
-ui_view_base::~ui_view_base()
+ui_view_interface::~ui_view_interface()
{
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_interface* ui_view_interface::set_controller(ui_controller_interface *controller)
{
- ui_controller_base *prev_controller = this->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_base::set_content(T content)
+T ui_view_interface::set_content(T content)
{
T prev = this->content;
this->content = content;
return prev;
}
-bool ui_view_base::set_style(const char *style)
+bool ui_view_interface::set_style(const char *style)
{
this->style.assign(style);
return true;
}
-void ui_view_base::set_removable_content(bool removable)
+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_base::set_indicator(ui_view_indicator indicator)
+void ui_view_interface::set_indicator(ui_view_indicator indicator)
{
this->indicator = indicator;
}
* limitations under the License.
*
*/
-#ifndef UI_VIEW_BASE_H_
-#define UI_VIEW_BASE_H_
+#ifndef UI_VIEW_INTERFACE_H_
+#define UI_VIEW_INTERFACE_H_
#include <string>
+using namespace std;
+
typedef void* T;
-class ui_viewmgr_base;
-class ui_controller_base;
+class ui_viewmgr_interface;
+class ui_controller_interface;
/**
- * @class ui_view_base
+ * @class ui_view_interface
*
* @ingroup ui_viewmgr
*
* 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.
+ * @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_base
+class ui_view_interface
{
- friend class ui_viewmgr_base;
- friend class ui_controller_base;
+ friend class ui_viewmgr_interface;
+ friend class ui_controller_interface;
private:
/// View state definition
};
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_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.
/** @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.
+ * 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.
*
/** @brief view load state
*
- * @note this state will be triggered by ui_viewmgr_base
+ * @note this state will be triggered by ui_viewmgr_interface
*
- * @see ui_controller_base for this state in detail.
+ * @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_base
+ * @note this state will be triggered by ui_viewmgr_interface
*
- * @see ui_controller_base for this state in detail.
+ * @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_base
+ * @note this state will be triggered by ui_viewmgr_interface
*
- * @see ui_controller_base for this state in detail.
+ * @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_base
+ * @note this state will be triggered by ui_viewmgr_interface
*
- * @see ui_controller_base for this state in detail.
+ * @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_base
+ * @note this state will be triggered by ui_viewmgr_interface
*
- * @see ui_controller_base for this state in detail.
+ * @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_base
+ * @note this state will be triggered by ui_viewmgr_interface
*
- * @see ui_controller_base for this state in detail.
+ * @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_base
+ * @note this state will be triggered by ui_viewmgr_interface
*
- * @see ui_controller_base for this state in detail.
+ * @see ui_controller_interface for this state in detail.
*/
virtual void destroy();
}
/// Return a controller of this view.
- const ui_controller_base* get_controller()
+ const ui_controller_interface* get_controller()
{
return this->controller;
}
/// Return a viewmgr which this view is belonging to
- ui_viewmgr_base *get_viewmgr()
+ ui_viewmgr_interface *get_viewmgr()
{
return this->viewmgr;
}
* @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.
+ * @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_base* set_controller(ui_controller_base *controller);
+ ui_controller_interface* set_controller(ui_controller_interface *controller);
public:
/** @brief This is a constructor for initializing this view resources.
* @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.
+ * @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_base(T content, ui_controller_base *controller, const char *name);
+ ui_view_interface(T content, ui_controller_interface *controller, const char *name);
///Constructor for initializing with controller.
- ui_view_base(ui_controller_base *controller, const char *name = NULL);
+ ui_view_interface(ui_controller_interface *controller, const char *name = NULL);
///Constructor for initializing with name.
- ui_view_base(const char *name = NULL);
+ ui_view_interface(const char *name = NULL);
///Destructor for terminating view.
- virtual ~ui_view_base();
+ virtual ~ui_view_interface();
/** @brief This is for replacing or setting a content of the view.
*
}
};
-#endif /* UI_VIEW_BASE_H_ */
+#endif /* UI_VIEW_INTERFACE_H_ */
* limitations under the License.
*
*/
-#ifndef UI_VIEWMGR_H_
-#define UI_VIEWMGR_H_
+#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 "VIEWMGR"
+#define LOG_TAG "UI_VIEWMGR"
enum ui_view_indicator
{
UI_VIEW_INDICATOR_LAST
};
-#include "ui_viewmgr_base.h"
-#include "ui_view_base.h"
-#include "ui_controller_base.h"
+#include "ui_viewmgr_interface.h"
+#include "ui_view_interface.h"
+#include "ui_controller_interface.h"
-
-#endif /* UI_VIEWMGR_H */
+#endif /* UI_VIEWMANAGER_INTERFACE_H */
* limitations under the License.
*
*/
-#include "ui_viewmgr.h"
+#include "ui_viewmanager_interface.h"
-bool ui_viewmgr_base::connect_view(ui_view_base *view)
+bool ui_viewmgr_interface::connect_view(ui_view_interface *view)
{
if (view->viewmgr)
{
return true;
}
-bool ui_viewmgr_base::disconnect_view(ui_view_base *view)
+bool ui_viewmgr_interface::disconnect_view(ui_view_interface *view)
{
if (!view->viewmgr) return false;
view->viewmgr = NULL;
return true;
}
-void ui_viewmgr_base::set_event_block(ui_view_base *view, bool block)
+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_base::push_view_finished(ui_view_base *view)
+bool ui_viewmgr_interface::push_view_finished(ui_view_interface *view)
{
- ui_view_base *last = this->view_list.back();
+ ui_view_interface *last = this->view_list.back();
//The previous view has been pushed. This should be unload.
if (last != view)
return true;
}
-bool ui_viewmgr_base::pop_view_finished(ui_view_base *view)
+bool ui_viewmgr_interface::pop_view_finished(ui_view_interface *view)
{
- ui_view_base *last = this->view_list.back();
+ ui_view_interface *last = this->view_list.back();
//This view has been popped. It should be destroyed.
if (last == view)
return true;
}
-ui_viewmgr_base::ui_viewmgr_base()
+ui_viewmgr_interface::ui_viewmgr_interface()
: event_block(true), activated(false)
{
//FIXME: Read binary profile to decide whether support software back key or not.
this->soft_back_key = true;
}
-ui_viewmgr_base::~ui_viewmgr_base()
+ui_viewmgr_interface::~ui_viewmgr_interface()
{
//Terminate views
- for (typename std::list<ui_view_base*>::reverse_iterator it = this->view_list.rbegin(); it != this->view_list.rend(); it++)
+ for (typename std::list<ui_view_interface*>::reverse_iterator it = this->view_list.rbegin(); it != this->view_list.rend(); it++)
{
- ui_view_base *view = *it;
+ ui_view_interface *view = *it;
view->inactive();
view->unload();
view->destroy();
ui_app_exit();
}
-ui_view_base *
-ui_viewmgr_base::push_view(ui_view_base *view)
+ui_view_interface *
+ui_viewmgr_interface::push_view(ui_view_interface *view)
{
if (!view)
{
return NULL;
}
- ui_view_base *pview;
+ ui_view_interface *pview;
//Previous view
if (this->view_list.size())
return view;
}
-bool ui_viewmgr_base::pop_view()
+bool ui_viewmgr_interface::pop_view()
{
//No more view? destroy viewmgr?
if (this->get_view_count() == 0)
if (this->get_view_count() == 1)
{
//destroy viewmgr?
- ui_view_base *view = this->view_list.back();
+ ui_view_interface *view = this->view_list.back();
view->inactive();
view->unload();
view->destroy();
}
//last page to be popped.
- ui_view_base *view = this->view_list.back();
+ ui_view_interface *view = this->view_list.back();
view->inactive();
this->set_event_block(view, true);
//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;
+ ui_view_interface *pview = *nx;
pview->load();
pview->inactive();
this->set_event_block(pview, true);
return true;
}
-bool ui_viewmgr_base::insert_view_before(ui_view_base *view, ui_view_base *before)
+bool ui_viewmgr_interface::insert_view_before(ui_view_interface *view, ui_view_interface *before)
{
//TODO: ...
return true;
}
-bool ui_viewmgr_base::insert_view_after(ui_view_base *view, ui_view_base *after)
+bool ui_viewmgr_interface::insert_view_after(ui_view_interface *view, ui_view_interface *after)
{
//TODO: ...
return true;
}
-bool ui_viewmgr_base::remove_view(ui_view_base *view)
+bool ui_viewmgr_interface::remove_view(ui_view_interface *view)
{
this->view_list.remove(view);
this->disconnect_view(view);
return true;
}
-ui_view_base*
-ui_viewmgr_base::get_view(unsigned int idx)
+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_base*>::iterator it = this->view_list.begin();
+ typename std::list<ui_view_interface*>::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 ui_viewmgr_interface::get_view_index(const ui_view_interface *view)
{
int idx = 0;
- for (typename std::list<ui_view_base*>::iterator it = this->view_list.begin(); it != this->view_list.end(); it++)
+ 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_base *
-ui_viewmgr_base::get_last_view()
+ui_view_interface *
+ui_viewmgr_interface::get_last_view()
{
int cnt = this->get_view_count();
return this->get_view(cnt - 1);
}
-bool ui_viewmgr_base::activate()
+bool ui_viewmgr_interface::activate()
{
if (this->activated) return false;
this->activated = true;
return true;
}
-bool ui_viewmgr_base::deactivate()
+bool ui_viewmgr_interface::deactivate()
{
if (!this->activated) return false;
this->activated = false;
* limitations under the License.
*
*/
-#ifndef UI_WINDOW_BASE_H_
-#define UI_WINDOW_BASE_H_
+#ifndef UI_VIEWMGR_INTERFACE_H_
+#define UI_VIEWMGR_INTERFACE_H_
#include <list>
using namespace std;
-class ui_view_base;
+class ui_view_interface;
/**
- * @class ui_viewmgr_base
+ * @class ui_viewmgr_interface
*
* @ingroup ui_viewmgr
*
* @date 2016/01/29
* @author Hermet Park <chuneon.park@samsung.com>
*/
-class ui_viewmgr_base
+class ui_viewmgr_interface
{
- friend class ui_view_base;
+ friend class ui_view_interface;
private:
- list<ui_view_base*> view_list; //view list.
+ 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.
* @param view a view to connect to this viewmgr.
* @return success or not.
*
- * @note This is s a friend function of ui_view_base
+ * @note This is s a friend function of ui_view_interface
*/
- bool connect_view(ui_view_base *view);
+ 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_base
+ * @note This is s a friend function of ui_view_interface
*/
- bool disconnect_view(ui_view_base *view);
+ 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_base
+ * @note This is s a friend function of ui_view_interface
*/
- void set_event_block(ui_view_base *view, bool block);
+ void set_event_block(ui_view_interface *view, bool block);
protected:
/**
* @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
+ * @note This is s a friend function of ui_view_interface
*/
- bool push_view_finished(ui_view_base *view);
+ bool push_view_finished(ui_view_interface *view);
/**
* @brief This function is designed for end of pop transition.
* @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
+ * @note This is s a friend function of ui_view_interface
*/
- bool pop_view_finished(ui_view_base *view);
+ 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_base*>* const get_view_list()
+ const list<ui_view_interface*>* const get_view_list()
{
return &this->view_list;
}
* @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);
+ ui_view_interface *push_view(ui_view_interface *view);
/**
* @brief Pop the top view from the viewmgr stack.
* 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);
+ 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
* 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);
+ 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_base *view);
+ bool remove_view(ui_view_interface *view);
/**
* @brief Return a stack index number of the given view.
*
* @warning the index number is variable since the view stack size is also variable.
*/
- ui_view_base* get_view(unsigned int idx);
+ ui_view_interface* get_view(unsigned int idx);
/**
* @brief Return a view which is matched with the @c name.
* If there were no views name matched, @c NULL will be returned.
*
*/
- ui_view_base *get_view(const char *name)
+ ui_view_interface *get_view(const char *name)
{
//FIXME: ...
return NULL;
*
* @warning the index number is variable since the view stack size is also variable.
*/
- int get_view_index(const ui_view_base *view);
+ int get_view_index(const ui_view_interface *view);
//Activate a viewmgr.
bool activate();
public:
///Constructor.
- ui_viewmgr_base();
+ ui_viewmgr_interface();
///Destructor. Delete all contained views.
- virtual ~ui_viewmgr_base();
+ virtual ~ui_viewmgr_interface();
//FIXME: Doc.
- ui_view_base *get_last_view();
+ ui_view_interface *get_last_view();
/**
* @brief Return the number of views which this viewmgr has.
};
-#endif /* UI_WINDOW_BASE_H_ */
+#endif /* UI_VIEWMGR_INTERFACE_H_ */