ui_viewmgr *viewmgr = dynamic_cast<ui_viewmgr *>(this->get_viewmgr());
return viewmgr->get_base();
}
+
+void ui_view::set_indicator(ui_view_indicator indicator)
+{
+ if (this->get_indicator() == indicator) return;
+
+ ui_view_base::set_indicator(indicator);
+
+ ui_viewmgr *viewmgr = dynamic_cast<ui_viewmgr *>(this->get_viewmgr());
+
+ if (!viewmgr->is_activated()) return;
+
+ if (dynamic_cast<ui_view *>(viewmgr->get_last_view()) != this) return;
+
+ viewmgr->set_indicator(indicator);
+}
virtual Evas_Object *set_content(Evas_Object *content);
virtual Evas_Object *get_base();
+ void set_indicator(ui_view_indicator indicator);
+
protected:
virtual void load();
virtual void unload();
using namespace efl;
-void
-win_delete_request_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+bool ui_viewmgr::set_indicator(ui_view_indicator indicator)
{
- ui_viewmgr *viewmgr = static_cast<ui_viewmgr*>(data);
- delete(viewmgr);
+ if (this->indicator == indicator) return false;
+ this->indicator = indicator;
+
+ Evas_Object *window = this->get_window();
+ Evas_Object *conform = this->get_conformant();
+
+ switch (indicator)
+ {
+ case UI_VIEW_INDICATOR_DEFAULT:
+ elm_win_indicator_opacity_set(window, ELM_WIN_INDICATOR_OPAQUE);
+ elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_SHOW);
+ /* Unset if you set the Indicator BG */
+ evas_object_del(elm_object_part_content_get(conform, "elm.swallow.indicator_bg"));
+ elm_object_signal_emit(conform, "elm,state,indicator,nooverlap", "elm");
+ break;
+ case UI_VIEW_INDICATOR_OPTIMAL:
+ elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_SHOW);
+ elm_win_indicator_opacity_set(window, ELM_WIN_INDICATOR_TRANSPARENT);
+ break;
+ case UI_VIEW_INDICATOR_OVERLAP:
+ elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_SHOW);
+ elm_object_signal_emit(conform, "elm,state,indicator,overlap", "elm");
+ break;
+ default:
+ elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_HIDE);
+ break;
+ }
+ return true;
}
-bool
-ui_viewmgr::create_conformant(Evas_Object *win)
+bool ui_viewmgr::create_conformant(Evas_Object *win)
{
Evas_Object *conform = elm_conformant_add(win);
if (!conform) return false;
return true;
}
-bool
-ui_viewmgr::create_base_layout(Evas_Object *conform)
+bool ui_viewmgr::create_base_layout(Evas_Object *conform)
{
Evas_Object *layout = elm_layout_add(conform);
if (!layout) return false;
{
ui_viewmgr *viewmgr = static_cast<ui_viewmgr*>(data);
delete(viewmgr);
-
//FIXME: Window is destroyed. Terminate Application!
//ui_app_exit();
},
//Set Indicator properties
elm_win_indicator_mode_set(this->win, ELM_WIN_INDICATOR_SHOW);
elm_win_indicator_opacity_set(this->win, ELM_WIN_INDICATOR_OPAQUE);
+
elm_win_autodel_set(this->win, EINA_TRUE);
}
bool ui_viewmgr::activate()
{
- ui_viewmgr_base :: activate();
+ ui_viewmgr_base::activate();
elm_object_part_content_unset(this->get_base(), "elm.swallow.content");
elm_object_part_content_set(this->get_base(), "elm.swallow.content", CONVERT_TO_EO(view->get_base()));
}
+ this->set_indicator(view->get_indicator());
+
evas_object_show(this->win);
return true;
bool ui_viewmgr::deactivate()
{
- ui_viewmgr_base ::deactivate();
+ ui_viewmgr_base::deactivate();
//FIXME: based on the profile, we should app to go behind or terminate.
if (true)
elm_object_part_content_set(this->get_base(), "elm.swallow.content", CONVERT_TO_EO(view->get_base()));
}
+ this->set_indicator(view->get_indicator());
+
return true;
}
}
else
{
- LOGE("view->base = %p", view->get_base());
elm_object_part_content_set(this->get_base(), "elm.swallow.content", CONVERT_TO_EO(view->get_base()));
}
+ this->set_indicator(view->get_indicator());
+
return view;
}
Evas_Object *win;
Evas_Object *conform;
Evas_Object *layout;
+ ui_view_indicator indicator;
bool create_conformant(Evas_Object *win);
bool create_base_layout(Evas_Object *conform);
+ bool set_indicator(ui_view_indicator indicator);
protected:
Evas_Object *get_base()
ui_view_base::ui_view_base(T content, ui_controller_base *controller, const char *name)
: content(content), controller(controller), name(string(name ? name : "")), style(string("")), viewmgr(NULL), state(UI_VIEW_STATE_LOAD),
- event_block(false), removable_content(true)
+ indicator(UI_VIEW_INDICATOR_DEFAULT), event_block(false), removable_content(true)
{
if (!content) this->state = UI_VIEW_STATE_UNLOAD;
else this->state = UI_VIEW_STATE_LOAD;
//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)
+{
+ this->indicator = indicator;
+}
std::string style; ///< View style name.
ui_viewmgr_base *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.
*/
void set_removable_content(bool removable);
+ void set_indicator(ui_view_indicator indicator);
+
/// Return a style name of this view.
const char *get_style()
{
return this->style.c_str();
}
- /// Return a content instance of this view.
+ const char *get_name()
+ {
+ return this->name.c_str();
+ }
+
+ /// Return the content instance of this view.
T get_content()
{
return this->content;
}
- /// Return a state of this view.
+ /// Return the state of this view.
ui_view_state get_state()
{
return this->state;
}
- /// Return a state of removeable content.
+ /// Return the state of removeable content.
bool get_removable_content()
{
return this->removable_content;
}
+
+ /// Return the indicator mode of this view.
+ ui_view_indicator get_indicator()
+ {
+ return this->indicator;
+ }
};
#endif /* UI_VIEW_BASE_H_ */
* limitations under the License.
*
*/
+#ifndef UI_VIEWMGR_H_
+#define UI_VIEWMGR_H_
+
#include <app.h>
#include <dlog.h>
#endif
#define LOG_TAG "VIEWMGR"
+enum ui_view_indicator
+{
+ UI_VIEW_INDICATOR_DEFAULT = 0,
+ UI_VIEW_INDICATOR_OPTIMAL,
+ UI_VIEW_INDICATOR_OVERLAP,
+ UI_VIEW_INDICATOR_HIDE,
+ UI_VIEW_INDICATOR_LAST
+};
+
#include "ui_viewmgr_base.h"
#include "ui_view_base.h"
#include "ui_controller_base.h"
+
+
+#endif /* UI_VIEWMGR_H */
page1_controller(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()
{
//Initialize contents.
- ui_basic_view *view = dynamic_cast<ui_basic_view *>(ui_controller::get_view());
+ ui_basic_view *view = dynamic_cast<ui_basic_view *>(this->get_view());
//Create a main content.
Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 1",
- //Prev Button
- [](void *data, Evas_Object *obj, void *event_info) -> void
- {
- appdata_s *ad = static_cast<appdata_s *>(data);
- ad->viewmgr->deactivate();
- },
- //Next Button
- [](void *data, Evas_Object *obj, void *event_info) -> void
- {
- appdata_s *ad = static_cast<appdata_s *>(data);
- page2(ad);
- },
- this->ad);
+ //Prev Button Callback
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ appdata_s *ad = static_cast<appdata_s *>(data);
+ ad->viewmgr->deactivate();
+ },
+ //Next Button Callback
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ appdata_s *ad = static_cast<appdata_s *>(data);
+ page2(ad);
+ },
+ this->ad);
view->set_content(content, "Title");
}
page2_controller(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, "page2"));
}
+
~page2_controller()
{
}
void load()
{
//Initialize contents.
-
- ui_basic_view *view = dynamic_cast<ui_basic_view *>(ui_controller::get_view());
+ ui_basic_view *view = dynamic_cast<ui_basic_view *>(this->get_view());
//Create a main content.
Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 2",
- //Prev Button
+ //Prev Button Callback
[](void *data, Evas_Object *obj, void *event_info) -> void
{
appdata_s *ad = static_cast<appdata_s *>(data);
ad->viewmgr->pop_view();
},
- //Next Button
+ //Next Button Callback
[](void *data, Evas_Object *obj, void *event_info) -> void
{
appdata_s *ad = static_cast<appdata_s *>(data);
page3_controller(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, "page3"));
}
//Create a main content.
Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 3",
- //Prev Button
- [](void *data, Evas_Object *obj, void *event_info) -> void
- {
- appdata_s *ad = static_cast<appdata_s *>(data);
- ad->viewmgr->pop_view();
- },
- //Next Button
- [](void *data, Evas_Object *obj, void *event_info) -> void
- {
- appdata_s *ad = static_cast<appdata_s *>(data);
- page4(ad);
- },
- this->ad);
+ //Prev Button Callback
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ appdata_s *ad = static_cast<appdata_s *>(data);
+ ad->viewmgr->pop_view();
+ },
+ //Next Button Callback
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ appdata_s *ad = static_cast<appdata_s *>(data);
+ page4(ad);
+ },
+ this->ad);
//Arguments: content, title, subtitle, title left button, title right button
view->set_content(content, "Title", "Subtitle", NULL, NULL);
page4_controller(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, "page4"));
}
//Create a main content.
Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 4",
- //Prev Button
- [](void *data, Evas_Object *obj, void *event_info) -> void
- {
- appdata_s *ad = static_cast<appdata_s *>(data);
- ad->viewmgr->pop_view();
- },
- //Next Button
- [](void *data, Evas_Object *obj, void *event_info) -> void
- {
- appdata_s *ad = static_cast<appdata_s *>(data);
- page5(ad);
- }, this->ad);
+ //Prev Button Callback
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ appdata_s *ad = static_cast<appdata_s *>(data);
+ ad->viewmgr->pop_view();
+ },
+ //Next Button Callback
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ appdata_s *ad = static_cast<appdata_s *>(data);
+ page5(ad);
+ },
+ this->ad);
//Arguments: content, title
view->set_content(content, "TitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitle");
: ad(ad)
{
//No basic form.
- ad->viewmgr->push_view(new ui_view(this, "page5"));
+ /* ui_view(controller, identity name).
+ Later, you could get the identity name using view->get_name(); */
+ ui_view *view = ad->viewmgr->push_view(new ui_view(this, "page5"));
}
~page5_controller()
ui_view *view = dynamic_cast<ui_view *>(this->get_view());
//Create a main content.
- Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 5<br>(No Title View)",
- //Prev Button
- [](void *data, Evas_Object *obj, void *event_info) -> void
- {
- appdata_s *ad = static_cast<appdata_s *>(data);
- ad->viewmgr->pop_view();
- },
- //Next Button
- [](void *data, Evas_Object *obj, void *event_info) -> void
- {
- appdata_s *ad = static_cast<appdata_s *>(data);
- ad->viewmgr->deactivate();
- }, this->ad);
+ Evas_Object *content = create_content(view->get_base(), "ViewMgr Demo<br>Page 5<br>(Full View)",
+ //Prev Button Callback
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ appdata_s *ad = static_cast<appdata_s *>(data);
+ ad->viewmgr->pop_view();
+ },
+ //Next Button Callback
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ appdata_s *ad = static_cast<appdata_s *>(data);
+ ad->viewmgr->deactivate();
+ },
+ this->ad);
view->set_content(content);
+ view->set_indicator(UI_VIEW_INDICATOR_HIDE);
}
};