{
}
- void load()
+ void on_load()
{
//Initialize contents.
view->set_content(content, "Title");
}
- bool menu()
+ bool on_menu()
{
ui_basic_view *view = dynamic_cast<ui_basic_view *>(this->get_view());
return true;
}
- void rotate(int degree)
+ void on_rotate(int degree)
{
LOGE("Current view's degree is %d\n", degree);
}
- void portrait()
+ void on_portrait()
{
LOGE("View is on portrait mode\n");
}
- void landscape()
+ void on_landscape()
{
LOGE("View is on landscape mode\n");
}
{
}
- void load()
+ void on_load()
{
//Initialize contents.
ui_basic_view *view = dynamic_cast<ui_basic_view *>(this->get_view());
{
}
- void load()
+ void on_load()
{
//Initialize contents.
{
}
- void load()
+ void on_load()
{
//Initialize contents.
{
}
- void load()
+ void on_load()
{
//Initialize contents.
{
}
- void load()
+ void on_load()
{
//Initialize contents.
appdata_s *ad;
protected:
- virtual void load()
+ virtual void on_load()
{
//Create a main content.
Evas_Object *content = create_content(this->get_base(), "ViewMgr Demo<br>Page 8<br>(View inheritance lazy load)",
{
public:
virtual ~ui_basic_controller();
- virtual bool menu();
+ virtual bool on_menu();
};
}
bool destroy_layout();
protected:
- virtual void load();
- virtual void unload();
+ virtual void on_load();
+ virtual void on_unload();
virtual void unload_content();
virtual void set_event_block(bool block);
bool set_menu(Evas_Object *menu);
Evas_Object * unset_menu();
- virtual void menu();
+ virtual void on_menu();
virtual Evas_Object *get_base()
{
* @note Now, this view is moving onto the screen. Get ready for this view. If this view content is alive, load callback won't be called.
* In the most cases, this callback will be triggered with this step load -> inactive -> active.
*/
- virtual void load() {}
+ virtual void on_load() {}
/** @brief unload callback.
*
* If the view content is not alive, the unload won't be called.
* In the most cases, this callback will be triggered with this step. inactive -> unload -> destroy
*/
- virtual void unload() {}
+ virtual void on_unload() {}
/** @brief active callback.
*
* From whatever the state, if the view is on the screen, the active callback will be called.
* In the most cases, this callback will be triggered with this step. load -> inactive -> active
*/
- virtual void active() {}
+ virtual void on_active() {}
/** @brief inactive callback.
*
* In the most cases, when view is going to be popped or destroyed or pushed one more depth, the inactive state will be triggered.
* Some UI controls such as a center popup or a menu popup blocks the view, this view may be inactive but still visible in someway (with transparency)
*/
- virtual void inactive() {}
+ virtual void on_inactive() {}
/** @brief pause callback.
*
* When Window turns to deactivate. (@see ui_viewmgr_base :: deactivate()).
* If the view were inactive or unload state, the pause won't be called.
*/
- virtual void pause() {}
+ virtual void on_pause() {}
/** @brief resume callback.
*
* When the system allows the application turns to activate.
* When the Window turns to activate. (@see ui_viewmgr_base :: activate())
*/
- virtual void resume() {}
+ virtual void on_resume() {}
/** @brief destroy callback.
*
* @note When this view is on destroying by popping or deleting.
*/
- virtual void destroy() {}
+ virtual void on_destroy() {}
/** @brief Back key callback.
*
* that viewmgr is requested to poo the current view.
* If you return false in the overriding, then popping will be stopped.
*/
- virtual bool back() { return true; }
+ virtual bool on_back() { return true; }
/** @brief View rotate callback.
*
*
* @note This method will be called when view rotation occurred.
*/
- virtual void rotate(int degree) {}
+ virtual void on_rotate(int degree) {}
/** @brief Portrait callback.
*
* @note When current view is on portrait mode.
*/
- virtual void portrait() {}
+ virtual void on_portrait() {}
/** @brief Landscape callback.
*
* @note When current view is on landscape mode.
*/
- virtual void landscape() {}
+ virtual void on_landscape() {}
};
}
/** @brief This is for calling controller's back method.
*/
- virtual void back();
+ virtual void on_back();
/** @brief This is for calling controller's rotate method.
*/
- virtual void rotate(int degree);
+ virtual void on_rotate(int degree);
/** @brief This is for calling controller's portrait method.
*/
- virtual void portrait();
+ virtual void on_portrait();
/** @brief This is for calling controller's landscape method.
*/
- virtual void landscape();
+ virtual void on_landscape();
/** @brief Set the indicator mode.
*
* @param indicator The mode to set, one of #ui_view_indicator.
* @note Now, this view is moving onto the screen. Get ready for this view. If this view content is alive, load callback won't be called.
* In the most cases, this callback will be triggered with this step load -> inactive -> active.
*/
- virtual void load() = 0;
+ virtual void on_load() = 0;
/** @brief unload callback.
*
* If the view content is not alive, the unload won't be called.
* In the most cases, this callback will be triggered with this step. inactive -> unload -> destroy
*/
- virtual void unload() = 0;
+ virtual void on_unload() = 0;
/** @brief active callback.
*
* From whatever the state, if the view is on the screen, the active callback will be called.
* In the most cases, this callback will be triggered with this step. load -> inactive -> active
*/
- virtual void active() = 0;
+ virtual void on_active() = 0;
/** @brief inactive callback.
*
* In the most cases, when view is going to be popped or destroyed or pushed one more depth, the inactive state will be triggered.
* Some UI controls such as a center popup or a menu popup blocks the view, this view may be inactive but still visible in someway (with transparency)
*/
- virtual void inactive() = 0;
+ virtual void on_inactive() = 0;
/** @brief pause callback.
*
* When Window turns to deactivate. (@see ui_viewmgr_base :: deactivate()).
* If the view were inactive or unload state, the pause won't be called.
*/
- virtual void pause() = 0;
+ virtual void on_pause() = 0;
/** @brief resume callback.
*
* When the system allows the application turns to activate.
* When the Window turns to activate. (@see ui_viewmgr_base :: activate())
*/
- virtual void resume() = 0;
+ virtual void on_resume() = 0;
/** @brief destroy callback.
*
* @note When this view is on destroying by popping or deleting.
*/
- virtual void destroy() = 0;
+ virtual void on_destroy() = 0;
/** @brief Back key callback.
*
* that viewmgr is requested to poo the current view.
* If you return false in the overriding, then popping will be stopped.
*/
- virtual bool back() = 0;
+ virtual bool on_back() = 0;
/** @brief View rotate callback.
*
*
* @note This method will be called when view rotation occurred.
*/
- virtual void rotate(int degree) = 0;
+ virtual void on_rotate(int degree) = 0;
/** @brief Portrait callback.
*
* @note When current view is on portrait mode.
*/
- virtual void portrait() = 0;
+ virtual void on_portrait() = 0;
/** @brief Landscape callback.
*
* @note When current view is on landscape mode.
*/
- virtual void landscape() = 0;
+ virtual void on_landscape() = 0;
};
}
*
* @see ui_iface_controller for this state in detail.
*/
- virtual void load();
+ virtual void on_load();
/** @brief view unload state.
*
*
* @see ui_iface_controller for this state in detail.
*/
- virtual void unload();
+ virtual void on_unload();
/** @brief view active state.
*
*
* @see ui_iface_controller for this state in detail.
*/
- virtual void active();
+ virtual void on_active();
/** @brief view inactive state.
*
*
* @see ui_iface_controller for this state in detail.
*/
- virtual void inactive();
+ virtual void on_inactive();
/** @brief view pause state.
*
*
* @see ui_iface_controller for this state in detail.
*/
- virtual void pause();
+ virtual void on_pause();
/** @brief view resume state.
*
*
* @see ui_iface_controller for this state in detail.
*/
- virtual void resume();
+ virtual void on_resume();
/** @brief view destroy state.
*
*
* @see ui_iface_controller for this state in detail.
*/
- virtual void destroy();
+ virtual void on_destroy();
//Make this view's content as NULL, then destroy content.
virtual void unload_content() = 0;
{
}
-bool ui_basic_controller::menu()
+bool ui_basic_controller::on_menu()
{
return true;
}
void ui_basic_key_listener::extend_event_proc(ui_view *view, Evas_Event_Key_Down *ev)
{
if (strcmp(ev->keyname, KEY_MENU) && strcmp(ev->keyname, KEY_MENU2)) return;
- dynamic_cast<ui_basic_view *>(view)->menu();
+ dynamic_cast<ui_basic_view *>(view)->on_menu();
}
bool ui_basic_key_listener::init()
destroy_layout();
}
-void ui_basic_view::load()
+void ui_basic_view::on_load()
{
if (!this->layout) this->create_layout();
- ui_view::load();
+ ui_view::on_load();
}
-void ui_basic_view::unload()
+void ui_basic_view::on_unload()
{
- ui_view::unload();
+ ui_view::on_unload();
}
Evas_Object *
this->destroy_layout();
}
-void ui_basic_view::menu()
+void ui_basic_view::on_menu()
{
if (this->ctxpopup && evas_object_visible_get(this->ctxpopup))
{
if (this->get_controller())
{
- (dynamic_cast<ui_basic_controller *>(this->get_controller()))->menu();
+ (dynamic_cast<ui_basic_controller *>(this->get_controller()))->on_menu();
}
if (this->ctxpopup)
if (strcmp(ev->keyname, KEY_BACK) && strcmp(ev->keyname, KEY_BACK2)) return;
- view->back();
+ view->on_back();
}
bool ui_key_listener::term()
viewmgr->set_indicator(indicator);
}
-void ui_view::back()
+void ui_view::on_back()
{
if (this->get_controller())
{
- if (!dynamic_cast<ui_controller *>(this->get_controller())->back())
+ if (!dynamic_cast<ui_controller *>(this->get_controller())->on_back())
{
return;
}
dynamic_cast<ui_viewmgr *>(this->get_viewmgr())->pop_view();
}
-void ui_view::rotate(int degree)
+void ui_view::on_rotate(int degree)
{
if (this->get_controller())
{
- dynamic_cast<ui_controller *>(this->get_controller())->rotate(degree);
+ dynamic_cast<ui_controller *>(this->get_controller())->on_rotate(degree);
}
}
-void ui_view::portrait()
+void ui_view::on_portrait()
{
if (this->get_controller())
{
- dynamic_cast<ui_controller *>(this->get_controller())->portrait();
+ dynamic_cast<ui_controller *>(this->get_controller())->on_portrait();
}
}
-void ui_view::landscape()
+void ui_view::on_landscape()
{
if (this->get_controller())
{
- dynamic_cast<ui_controller *>(this->get_controller())->landscape();
+ dynamic_cast<ui_controller *>(this->get_controller())->on_landscape();
}
}
void ui_view::set_event_block(bool block)
ui_viewmgr *viewmgr = static_cast<ui_viewmgr *>(data);
ui_view *view = viewmgr->get_last_view();
- view->rotate(rot);
+ view->on_rotate(rot);
//FIXME: Change this configurable?
- if (rot == 0 || rot == 180) view->portrait();
- else view->landscape();
+ if (rot == 0 || rot == 180) view->on_portrait();
+ else view->on_landscape();
}
, this);
//FIXME: Necessary??
ui_view *view = this->get_last_view();
- view->active();
+ view->on_active();
evas_object_show(this->win);
if (true)
{
ui_view *view = this->get_last_view();
- if (view) view->inactive();
+ if (view) view->on_inactive();
evas_object_lower(this->win);
}
else
this->event_block = block;
}
-void ui_iface_view::load()
+void ui_iface_view::on_load()
{
this->state = UI_VIEW_STATE_LOAD;
if (this->content) return;
if (!this->controller) return;
- this->controller->load();
+ this->controller->on_load();
}
-void ui_iface_view::unload()
+void ui_iface_view::on_unload()
{
this->state = UI_VIEW_STATE_UNLOAD;
if (this->get_removable_content())
}
if (!this->content) return;
if (!this->controller) return;
- this->controller->unload();
+ this->controller->on_unload();
}
-void ui_iface_view::active()
+void ui_iface_view::on_active()
{
this->state = UI_VIEW_STATE_ACTIVE;
if (!this->controller) return;
- this->controller->active();
+ this->controller->on_active();
}
-void ui_iface_view::inactive()
+void ui_iface_view::on_inactive()
{
this->state = UI_VIEW_STATE_INACTIVE;
if (!this->controller) return;
- this->controller->inactive();
+ this->controller->on_inactive();
}
-void ui_iface_view::pause()
+void ui_iface_view::on_pause()
{
this->state = UI_VIEW_STATE_PAUSE;
if (!this->content) return;
if (state != UI_VIEW_STATE_ACTIVE) return;
if (!this->controller) return;
- this->controller->pause();
+ this->controller->on_pause();
}
-void ui_iface_view::resume()
+void ui_iface_view::on_resume()
{
this->state = UI_VIEW_STATE_ACTIVE;
if (state != UI_VIEW_STATE_PAUSE) return;
if (!this->content) return;
if (!this->controller) return;
- this->controller->resume();
+ this->controller->on_resume();
}
-void ui_iface_view::destroy()
+void ui_iface_view::on_destroy()
{
if (!this->controller) return;
- this->controller->destroy();
+ this->controller->on_destroy();
}
ui_iface_view::ui_iface_view(ui_iface_controller *controller, const char *name)
//The previous view has been pushed. This should be unload.
if (last != view)
{
- view->unload();
+ view->on_unload();
return true;
}
//A new view has been pushed. This should be active.
- view->active();
+ view->on_active();
this->set_event_block(view, false);
return true;
//This view has been popped. It should be destroyed.
if (last == view)
{
- view->unload();
- view->destroy();
+ view->on_unload();
+ view->on_destroy();
delete (view);
return true;
}
//The previous view has been popped. It should become active.
- view->active();
+ view->on_active();
this->set_event_block(view, false);
return true;
for (typename std::list<ui_iface_view*>::reverse_iterator it = this->view_list.rbegin(); it != this->view_list.rend(); it++)
{
ui_iface_view *view = *it;
- view->inactive();
- view->unload();
- view->destroy();
+ view->on_inactive();
+ view->on_unload();
+ view->on_destroy();
delete (view);
}
if (this->view_list.size() > 0)
{
pview = this->view_list.back();
- pview->inactive();
+ pview->on_inactive();
this->set_event_block(pview, true);
}
if (!view->get_content())
{
- view->load();
+ view->on_load();
}
- view->inactive();
+ view->on_inactive();
//FIXME: First view has no effect?
if (this->view_list.size() != 1) this->set_event_block(view, true);
{
//destroy viewmgr?
ui_iface_view *view = this->view_list.back();
- view->inactive();
- view->unload();
- view->destroy();
+ view->on_inactive();
+ view->on_unload();
+ view->on_destroy();
delete(view);
return true;
//last page to be popped.
ui_iface_view *view = this->view_list.back();
- view->inactive();
+ view->on_inactive();
this->set_event_block(view, true);
//Below object has to be used in child class...
//previous page to be current active.
auto nx = std::prev(this->view_list.end(), 2);
ui_iface_view *pview = *nx;
- pview->load();
- pview->inactive();
+ pview->on_load();
+ pview->on_inactive();
this->set_event_block(pview, true);
return true;