char const* const THEME_EDJ_PATH = "/usr/share/edje/wrt/wrt_theme.edj";
char const* const ELM_STATE_SHOW_CONTENT = "elm,state,show,content";
char const* const ELM_SWALLOW_CONTENT = "elm.swallow.content";
+char const* const ELM_SWALLOW_BACKWARD = "elm.swallow.backward";
char const* const ELM_SWALLOW_TOOLBAR = "elm.swallow.toolbar";
char const* const ELM_RECT_HIDDENOPTION = "elm.rect.hiddenOption";
} // anonymous namespace
WindowData::WindowData(unsigned long pid, bool manualInit) :
- m_debugMode(false),
- m_win(NULL),
- m_naviBackButton(NULL),
- m_toolbarTimer(NULL)
+ m_win(NULL), m_naviBackButton(NULL),
+ m_toolbarTimer(NULL),
+ m_debugMode(false)
{
m_win = createWindow(pid);
// import button theme
elm_theme_overlay_add(NULL, THEME_EDJ_PATH);
- m_conformant = createConformant(m_win);
- evas_object_show(m_conformant);
- m_platform_layout = createPlatformLayout(m_conformant);
+ m_platform_layout = createPlatformLayout(m_win);
evas_object_show(m_platform_layout);
m_navigation = createNavigationBar(m_platform_layout);
evas_object_show(m_navigation);
m_user_layout = createUserLayout(m_navigation);
evas_object_show(m_user_layout);
-
+ m_conformant = createConformant(m_user_layout);
+ evas_object_show(m_conformant);
}
void WindowData::setEvasObjectForLayout(Evas_Object* evas_object)
void WindowData::toggleIndicator(bool fullscreen)
{
- LogDebug(__PRETTY_FUNCTION__);
- if (fullscreen) {
- elm_win_indicator_mode_set(m_win, ELM_WIN_INDICATOR_HIDE);
- }
- else {
+ LogDebug("fullscreen=" << (fullscreen?"true":"false"));
+
+ if (!fullscreen) {
elm_win_indicator_mode_set(m_win, ELM_WIN_INDICATOR_SHOW);
+ elm_layout_theme_set(m_platform_layout,
+ LAYOUT,
+ APPLICATION,
+ INDICATOR);
+ } else {
+ elm_win_indicator_mode_set(m_win, ELM_WIN_INDICATOR_HIDE);
+ elm_layout_theme_set(m_platform_layout,
+ LAYOUT,
+ APPLICATION,
+ NOINDICATOR);
}
-
}
void WindowData::setViewMode(
bool fullscreen,
+ bool backbutton,
CtxMenuItems ctxMenuItems)
{
- LogDebug("setViewMode");
- LogDebug("fullscreen: " << fullscreen );
+ LogDebug("setViewMode " <<m_debugMode);
+ LogDebug("fullscreen: " << fullscreen);
+ LogDebug("backbutton: " << backbutton);
m_fullscreen = fullscreen;
toggleIndicator(m_fullscreen);
+ if (backbutton) {
+ createFloatBackButton();
+ }
+
m_ctxMenuItems = ctxMenuItems;
if(m_debugMode) {
EVAS_HINT_EXPAND);
Evas_Object *ic = elm_icon_add(toolbar);
-
- // (*itor).icon.c_str() guarantied not to have format specifiers
- snprintf(buf, sizeof(buf), (*itor).icon.c_str());
-
- elm_icon_file_set(ic, buf, NULL);
+ snprintf(buf, sizeof(buf), (*itor).icon.c_str());
+ elm_icon_file_set(ic, buf, NULL);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE);
elm_object_part_content_set(toolbarButton, "icon", ic);
elm_object_item_part_content_set(toolbarIt, "object", toolbarButton);
}
+ toolbarButton = elm_button_add(toolbar);
+ if (!toolbarButton)
+ return;
+
+ Evas_Object *ic = elm_icon_add(toolbar);
+ snprintf(buf, sizeof(buf), WRT_OPTION_ICON_WINDOWVIEW);
+ elm_icon_file_set(ic, buf, NULL);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE);
+ elm_object_part_content_set(toolbarButton, "icon", ic);
+
+ evas_object_size_hint_align_set(toolbarButton,
+ EVAS_HINT_FILL,
+ EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(toolbarButton,
+ EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_smart_callback_add(toolbarButton,
+ "clicked",
+ changeViewModeCallback,
+ this);
+ toolbarIt = elm_toolbar_item_append(toolbar, NULL, NULL, NULL, NULL);
+ elm_object_item_part_content_set(toolbarIt, "object", toolbarButton);
+
optionheaderClose = TRUE;
elm_object_part_content_set(m_user_layout,
}
}
+void WindowData::createFloatBackButton()
+{
+ // Add float backbutton on the left coner
+ m_floatBackButton = elm_button_add(m_user_layout);
+ elm_object_style_set(m_floatBackButton, FLOATBACKWARD_BUTTON_STYLE);
+ elm_object_part_content_set(m_user_layout,
+ ELM_SWALLOW_BACKWARD,
+ m_floatBackButton);
+ evas_object_show(m_floatBackButton);
+}
+
Evas_Object* WindowData::createWindow(unsigned long pid)
{
Evas_Object* window = elm_win_add(NULL, "wrt-widget", ELM_WIN_BASIC);
ECORE_X_ATOM_NET_WM_PID,
ECORE_X_ATOM_CARDINAL, 32, &pid, 1);
elm_win_title_set(window, "wrt-widget");
+ elm_win_borderless_set(window, EINA_TRUE);
elm_win_conformant_set(window, EINA_TRUE);
int w, h;
ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
evas_object_resize(window, w, h);
-
- evas_object_smart_callback_add(window,
- "profile,changed",
- winProfileChangedCallback,
- this);
return window;
}
-Evas_Object* WindowData::createConformant(Evas_Object* parent)
-{
- Assert(parent != NULL && "Parent is null");
- Evas_Object* conformant = elm_conformant_add(parent);
-
- evas_object_size_hint_weight_set(
- conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(conformant, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_win_resize_object_add(parent, conformant);
- return conformant;
-}
-
Evas_Object* WindowData::createPlatformLayout(Evas_Object* parent)
{
Evas_Object* platform_layout = elm_layout_add(parent);
- elm_layout_file_set(platform_layout, PLATFORM_EDJ_PATH, "platformlayout");
+ if (!elm_layout_file_set(platform_layout, PLATFORM_EDJ_PATH, "platformlayout"))
+ elm_layout_theme_set(platform_layout, LAYOUT, APPLICATION, NOINDICATOR);
- evas_object_size_hint_align_set(platform_layout,
- EVAS_HINT_FILL,
- EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(platform_layout,
- EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
+ evas_object_size_hint_expand_set(platform_layout,
+ EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+
+ elm_win_resize_object_add(parent, platform_layout);
- elm_object_content_set(parent, platform_layout);
edje_object_signal_emit(
elm_layout_edje_get(platform_layout), ELM_STATE_SHOW_CONTENT, ELM);
return platform_layout;
}
-Evas_Object* WindowData::createNavigationBar(Evas_Object* parent)
-{
- Assert(parent != NULL && "Parent for naviframe is null");
- Evas_Object* navigation = elm_naviframe_add(parent);
-
- evas_object_size_hint_align_set(navigation,
- EVAS_HINT_FILL,
- EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(navigation,
- EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- elm_object_part_content_set(parent, ELM_SWALLOW_CONTENT, navigation);
- //elm_object_content_set(parent, navigation);
- return navigation;
-}
-
Evas_Object* WindowData::createUserLayout(Evas_Object* parent)
{
Assert(parent != NULL && "Parent for User Layout is null");
evas_object_size_hint_weight_set(
layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_win_resize_object_add(parent, layout);
Elm_Object_Item* naviIt = elm_naviframe_item_push(
/* Evas_Object *obj */
return layout;
}
+Evas_Object* WindowData::createConformant(Evas_Object* parent)
+{
+ Assert(parent != NULL && "Parent is null");
+ Evas_Object* conformant = elm_conformant_add(parent);
+ elm_object_style_set(conformant, INTERNAL_LAYOUT);
+ evas_object_size_hint_weight_set(
+ conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(conformant, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_part_content_set(parent, ELM_SWALLOW_CONTENT, conformant);
+ evas_object_show(conformant);
+ return conformant;
+}
+
+Evas_Object* WindowData::createNavigationBar(Evas_Object* parent)
+{
+ Assert(parent != NULL && "Parent for naviframe is null");
+ Evas_Object* navigation = elm_naviframe_add(parent);
+ elm_object_part_content_set(parent, ELM_SWALLOW_CONTENT, navigation);
+ return navigation;
+}
+
void WindowData::showHiddenOption(Evas_Object* parent)
{
Assert(parent != NULL && "Parent for Hiden Option");
showHiddenOption(m_user_layout);
}
-Evas_Object * WindowData::setDesktopIcon()
-{
- // set window icon
- Evas_Object *icon = evas_object_image_add(evas_object_evas_get(m_win));
- evas_object_image_file_set(icon,
- "/opt/share/icons/default/small/com.samsung.elm-demo-slp.png",
- NULL);
- elm_win_icon_object_set(m_win, icon);
-
- return icon;
-}
-
void WindowData::addNaviBackButtonCallback(
const char* event,
CallbackType callback,
return evas_object_smart_callback_del(m_naviBackButton, event, callBack);
}
+void WindowData::addFloatBackButtonCallback(
+ const char* event,
+ CallbackType callback,
+ const void* data)
+{
+ Assert(m_floatBackButton != NULL && "m_floatBackButton is null");
+ evas_object_smart_callback_add(m_floatBackButton, event, callback, data);
+}
+
+void* WindowData::delFloatBackButtonCallback(
+ const char* event,
+ CallbackType callBack)
+{
+ Assert(m_floatBackButton != NULL && "m_floatBackButton is null");
+ return evas_object_smart_callback_del(m_floatBackButton, event, callBack);
+}
+
void WindowData::userlayoutCallbackAdd(
const Evas_Callback_Type event,
EvasCallbackType callback,
}
void WindowData::controlHiddenOptionCallback(void *data,
- Evas_Object * /*obj*/,
- const char * /*emission*/,
- const char * /*source*/)
+ Evas_Object */*obj*/,
+ const char */*emission*/,
+ const char */*source*/)
{
LogDebug("controlHiddenOptionCallback");
WindowData* This = static_cast<WindowData *>(data);
- const char* state = edje_object_part_state_get(
- elm_layout_edje_get(This->m_user_layout), "elm.swallow.toolbar",
- NULL);
+ Elm_Object_Item *naviIt = elm_naviframe_top_item_get(This->m_navigation);
+
+ if(!elm_naviframe_item_title_visible_get(naviIt)) {
+ const char* state = edje_object_part_state_get(
+ elm_layout_edje_get(This->m_user_layout),
+ "elm.swallow.toolbar",
+ NULL);
+
+ if (state && !strncmp(state, "default", strlen("default"))) {
+ This->showToolbar();
+ This->hideHiddenOption(This->m_user_layout);
+ }
+ else {
+ This->initFullViewMode();
+ }
- if (state && !strncmp(state, "default", strlen("default"))) {
- This->showToolbar();
- This->hideHiddenOption(This->m_user_layout);
- } else {
- This->initFullViewMode();
}
}
return;
}
- if (m_indicator) //If indicator is shown by default, toggle it.
- toggleIndicator(!fullscreen);
-
- alreadyFullscreen = !alreadyFullscreen;
-}
-
-void WindowData::winProfileChangedCallback(void *data,
- Evas_Object* /*obj*/,
- void* /*eventInfo*/)
-{
- LogDebug("winProfileChangedCallback");
- if (data == NULL) {
- return;
+ if (!m_fullscreen) {
+ //If ViewMode is not fullscreen, toggle the title bar and indicator
+ toggleIndicator(fullscreen);
}
- WindowData* This = static_cast<WindowData *>(data);
- const char *profile = elm_config_profile_get();
-
- if (!strcmp(profile, "desktop")) {
- elm_win_indicator_mode_set(This->m_win, ELM_WIN_INDICATOR_HIDE);
- if (!This->m_icon)
- This->m_icon = This->setDesktopIcon();
- }
- else
- elm_win_indicator_mode_set(This->m_win, ELM_WIN_INDICATOR_SHOW);
+ alreadyFullscreen = !alreadyFullscreen;
}
-