INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/default_icon_wac.png
DESTINATION share/wrt-engine/
)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/images/icon_left_arrow.png
- DESTINATION /usr/etc/wrt/
- PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE
- )
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/images/icon_refresh.png
- DESTINATION /usr/etc/wrt/
- PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE
- )
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/images/icon_right_arrow.png
- DESTINATION /usr/etc/wrt/
- PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE
- )
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/images/mp_stop.png
- DESTINATION /usr/etc/wrt/
- PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE
- )
INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/userAgentProfile.xml
DESTINATION share/wrt-engine/
)
}
}
part {
- name: "elm.swallow.toolbar";
- type: SWALLOW;
- mouse_events: 1;
- repeat_events: 0;
- scale: 1;
- description {
- state: "default" 0.0;
- visible: 0;
- min: 700 100;
- max: 800 100;
- align: 1.0 1.0;
- rel1 { relative: 0.0 1.0; }
- rel2 { relative: 1.0 1.0; }
- }
- description {
- state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- }
- }
- part {
- name: "elm.rect.hiddenOption";
- type: RECT;
- mouse_events: 1;
- description {
- state: "default" 0.0;
- visible: 0;
- min: 50 50;
- max: 50 50;
- fixed: 1 1;
- align: 1.0 1.0;
- rel1 { relative: 1.0 1.0; to: base; }
- rel2 { relative: 1.0 1.0; to: base; }
- }
- description {
- state: "visible" 0.0;
- inherit: "default" 0.0;
- color: 100 55 55 100;
- visible: 1;
- }
- }
- part {
name: "elm.rect.comboboxPickerBG";
type: RECT;
mouse_events: 0;
action: STATE_SET "default" 0.0;
target: "elm.swallow.backward";
}
- program { name: "show,toolbar";
- signal: "show,toolbar,signal";
- action: STATE_SET "visible" 0.0;
- target: "elm.swallow.toolbar";
- }
- program { name: "hide,toolbar";
- signal: "hide,toolbar,signal";
- action: STATE_SET "default" 0.0;
- target: "elm.swallow.toolbar";
- }
- program { name: "show,hiddenOption";
- signal: "show,hiddenOption,signal";
- action: STATE_SET "visible" 0.0;
- target: "elm.rect.hiddenOption";
- }
- program { name: "hide,hiddenOption";
- signal: "hide,hiddenOption,signal";
- action: STATE_SET "default" 0.0;
- target: "elm.rect.hiddenOption";
- }
program { name: "showComboboxPicker";
signal: "show,comboboxPicker";
action: STATE_SET "showComboboxPicker" 0.0;
* Call goBack() on webkit
*/
virtual void Backward() = 0;
- virtual void Reload() = 0;
- virtual void Forward() = 0;
/**
* fire custom javascript event
*/
change.commit();
}
-void RunnableWidgetObject::Reload() {
- State::StateChange change = m_guardstate->allowReload();
- m_view->reload();
-
- change.commit();
-}
-
-void RunnableWidgetObject::Forward() {
- State::StateChange change = m_guardstate->allowForward();
- m_view->forward();
-
- change.commit();
-}
-
void RunnableWidgetObject::FireJavascriptEvent(int event, void* data)
{
State::StateChange change = m_guardstate->allowFireJavascriptEvent();
Evas_Object* GetCurrentWebview();
void SetUserDelegates(const UserDelegatesPtr& cbs);
void Backward();
- void Reload();
- void Forward();
void FireJavascriptEvent(int event, void* data);
private:
virtual void resumeWidget() = 0;
virtual void resetWidget() = 0;
virtual void backward() = 0;
- virtual void reload() = 0;
- virtual void forward() = 0;
virtual void reloadStartPage() = 0;
virtual Evas_Object* getCurrentWebview() = 0;
virtual void fireJavascriptEvent(int event, void* data) = 0;
}
}
-void ViewLogic::reload()
-{
- ewk_view_reload(m_currentEwkView);
-}
-
-void ViewLogic::forward()
-{
- if (ewk_view_forward_possible(m_currentEwkView)) {
- ewk_view_forward(m_currentEwkView);
- }
-}
-
void ViewLogic::reloadStartPage()
{
LogInfo("Reload Start Page");
void resumeWidget();
void resetWidget();
void backward();
- void reload();
- void forward();
void reloadStartPage();
Evas_Object* getCurrentWebview();
void fireJavascriptEvent(int event, void* data);
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";
-
-const char *EDJE_SHOW_TOOLBAR_SIGNAL = "show,toolbar,signal";
-const char *EDJE_HIDE_TOOLBAR_SIGNAL = "hide,toolbar,signal";
-const char *EDJE_SHOW_HIDDENOPTION_SIGNAL = "show,hiddenOption,signal";
-const char *EDJE_HIDE_HIDDENOPTION_SIGNAL = "hide,hiddenOption,signal";
char const* const ELM = "elm";
char const* const LAYOUT = "layout";
} // anonymous namespace
WindowData::WindowData(unsigned long pid, bool manualInit) :
- m_debugMode(false),
m_win(NULL),
- m_naviBackButton(NULL),
- m_toolbarTimer(NULL)
+ m_naviBackButton(NULL)
{
m_win = createWindow(pid);
void WindowData::setViewMode(
bool fullscreen,
- bool backbutton,
- CtxMenuItems ctxMenuItems)
+ bool backbutton)
{
LogDebug("setViewMode");
LogDebug("fullscreen: " << fullscreen);
createFloatBackButton();
}
- m_ctxMenuItems = ctxMenuItems;
-
- if(m_debugMode) {
- showHiddenOption(m_user_layout);
- createToolbar(m_ctxMenuItems);
- }
-}
-
-void WindowData::createToolbar(CtxMenuItems ctxMenuItems)
-{
- Elm_Object_Item *toolbarIt;
- Evas_Object *toolbarButton;
- Evas_Object *toolbar;
- char buf[100];
-
- toolbar = elm_toolbar_add(m_user_layout);
- if (!toolbar)
- return;
-
- elm_object_style_set(toolbar, "naviframe");
- elm_object_part_content_set(m_user_layout,
- ELM_SWALLOW_TOOLBAR,
- toolbar);
-
- std::list<CtxMenuItem>::iterator itor;
- for (itor = ctxMenuItems.begin(); itor != ctxMenuItems.end(); ++itor) {
- toolbarButton = elm_button_add(toolbar);
- if (!toolbarButton)
- return;
-
- 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 *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);
- 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_smart_callback_add(toolbarButton,
- "clicked",
- (*itor).callback,
- (*itor).data);
- toolbarIt = elm_toolbar_item_append(toolbar, NULL, NULL, NULL, NULL);
- elm_object_item_part_content_set(toolbarIt, "object", toolbarButton);
-
- //for margin button between buttons
- toolbarButton = elm_button_add(toolbar);
- if (!toolbarButton)
- return;
- evas_object_color_set(
- toolbarButton,
- 255,
- 255,
- 255,
- 0);
- 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,
- ELM_SWALLOW_TOOLBAR,
- toolbar);
-}
-
-void WindowData::showToolbar()
-{
- emitSignalForUserLayout(EDJE_SHOW_TOOLBAR_SIGNAL, "");
- m_toolbarTimer = ecore_timer_add(10.0, hideToolbarCallback, this);
-}
-
-void WindowData::hideToolbar()
-{
- emitSignalForUserLayout(EDJE_HIDE_TOOLBAR_SIGNAL, "");
- if(m_toolbarTimer) {
- ecore_timer_del(m_toolbarTimer);
- m_toolbarTimer = NULL;
- }
}
void WindowData::createFloatBackButton()
return layout;
}
-void WindowData::showHiddenOption(Evas_Object* parent)
-{
- Assert(parent != NULL && "Parent for Hiden Option");
-
- emitSignalForUserLayout(EDJE_SHOW_HIDDENOPTION_SIGNAL, "");
-
- edje_object_signal_callback_add(elm_layout_edje_get(parent),
- "mouse,clicked,1",
- "elm.rect.hiddenOption",
- controlHiddenOptionCallback,
- this);
-}
-
-void WindowData::hideHiddenOption(Evas_Object* parent)
-{
- Assert(parent != NULL && "Parent for Hiden Option");
-
- emitSignalForUserLayout(EDJE_HIDE_HIDDENOPTION_SIGNAL, "");
-
- edje_object_signal_callback_del(elm_layout_edje_get(parent),
- "mouse,clicked,1",
- "elm.rect.hiddenOption",
- controlHiddenOptionCallback);
-}
-
-void WindowData::initFullViewMode ()
-{
- hideToolbar();
- showHiddenOption(m_user_layout);
-}
-
void WindowData::addNaviBackButtonCallback(
const char* event,
CallbackType callback,
elm_layout_edje_get(m_user_layout), emission, source);
}
-void WindowData::moreButtonCallback(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- WindowData* This = static_cast<WindowData*>(data);
- Elm_Object_Item *naviIt = elm_naviframe_top_item_get(This->m_navigation);
-
- if (This->optionheaderClose)
- elm_object_item_signal_emit(naviIt, "elm,state,optionheader,open", "");
- else
- elm_object_item_signal_emit(naviIt, "elm,state,optionheader,close", "");
-
- This->optionheaderClose = !This->optionheaderClose;
-}
-
-
-void WindowData::changeViewModeCallback(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- WindowData* This = static_cast<WindowData*>(data);
- Elm_Object_Item *naviIt = elm_naviframe_top_item_get(This->m_navigation);
-
- if(elm_naviframe_item_title_visible_get(naviIt)) {
- This->showHiddenOption(This->m_user_layout);
-
- } else {
- This ->hideToolbar();
- }
-}
-
-void WindowData::controlHiddenOptionCallback(void *data,
- 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);
-
- if (state && !strncmp(state, "default", strlen("default"))) {
- This->showToolbar();
- This->hideHiddenOption(This->m_user_layout);
- } else {
- This->initFullViewMode();
- }
-}
-
-Eina_Bool WindowData::hideToolbarCallback(void *data)
-{
- WindowData *This = static_cast<WindowData *>(data);
-
- This->initFullViewMode();
- return TRUE;
-}
-
void WindowData::toggleFullscreen(bool fullscreen)
{
LogDebug(__PRETTY_FUNCTION__);
#include <vector>
#include <string>
#include <dpl/noncopyable.h>
-#include <list>
/*
* Current layout structure
* widget_area (elm_webview)
*
*/
-namespace {
-const char *const WRT_OPTION_LABEL_BACKWARD = "Backward";
-const char *const WRT_OPTION_LABEL_FORWARD = "Forward";
-const char *const WRT_OPTION_LABEL_RELOAD = "Reload";
-
-const char *const WRT_OPTION_ICON_BACKWARD = "/usr/etc/wrt/icon_left_arrow.png";
-const char *const WRT_OPTION_ICON_FORWARD = "/usr/etc/wrt/icon_right_arrow.png";
-const char *const WRT_OPTION_ICON_RELOAD = "/usr/etc/wrt/icon_refresh.png";
-}
class WindowData : private DPL::Noncopyable
{
typedef std::vector<EventWithFunction> EventWithFunctionVector;
public:
- bool m_debugMode;
Evas_Object* m_win;
Evas_Object* m_user_layout;
-
- struct CtxMenuItem
- {
- std::string label;
- std::string icon;
- Evas_Smart_Cb callback;
- void* data;
- };
- typedef std::list<CtxMenuItem> CtxMenuItems;
-
explicit WindowData(unsigned long pid, bool manualInit=false);
virtual ~WindowData();
const char* emission,
const char* source);
- void changeViewMode();
- void createToolbar(CtxMenuItems ctxMenuItems);
- void showToolbar();
- void hideToolbar();
- void createOptionButton();
- void destroyOptionButton();
void setViewMode(
bool fullscreen,
- bool backbutton,
- CtxMenuItems ctxMenuItems);
- void initFullViewMode();
+ bool backbutton);
- static void moreButtonCallback(void *data,
- Evas_Object *obj,
- void *event_info);
- static void changeViewModeCallback(void *data,
- Evas_Object *obj,
- void *event_info);
- static void controlHiddenOptionCallback(void *data,
- Evas_Object *obj,
- const char *emission,
- const char *source);
- static Eina_Bool hideToolbarCallback(void *data);
void toggleFullscreen(bool fullscreen);
protected:
Evas_Object* m_navigation;
Evas_Object* m_naviBackButton;
Evas_Object* m_floatBackButton;
- bool optionheaderClose;
- std::string m_title;
- CtxMenuItems m_ctxMenuItems;
- Ecore_Timer *m_toolbarTimer;
bool m_fullscreen;
Evas_Object* createWindow(unsigned long pid);
Evas_Object* createNavigationBar(Evas_Object* parent);
Evas_Object* createUserLayout(Evas_Object* parent);
Evas_Object* createConformant(Evas_Object* parent);
- Evas_Object* createProgress(Evas_Object* parent);
- void showHiddenOption(Evas_Object* parent);
- void hideHiddenOption(Evas_Object* parent);
void alignProgressPosition();
void toggleIndicator(bool fullscreen);
}
}
- LogInfo("initializeWindowModes " << m_debugMode);
-
- if(m_debugMode) {
- m_windowData->m_debugMode = TRUE;
- }
- else {
- m_windowData->m_debugMode = FALSE;
- }
-
- WindowData::CtxMenuItems ctxMenuItems;
-
- WindowData::CtxMenuItem ctxMenuBackword;
- ctxMenuBackword.label = WRT_OPTION_LABEL_BACKWARD;
- ctxMenuBackword.icon = WRT_OPTION_ICON_BACKWARD;
- ctxMenuBackword.callback = backwardCallback;
- ctxMenuBackword.data = this;
- ctxMenuItems.push_back(ctxMenuBackword);
-
- WindowData::CtxMenuItem ctxMenuReload;
- ctxMenuReload.label = WRT_OPTION_LABEL_RELOAD;
- ctxMenuReload.icon = WRT_OPTION_ICON_RELOAD;
- ctxMenuReload.callback = reloadCallback;
- ctxMenuReload.data = this;
- ctxMenuItems.push_back(ctxMenuReload);
-
- WindowData::CtxMenuItem ctxMenuForward;
- ctxMenuForward.label = WRT_OPTION_LABEL_FORWARD;
- ctxMenuForward.icon = WRT_OPTION_ICON_FORWARD;
- ctxMenuForward.callback = forwardCallback;
- ctxMenuForward.data = this;
- ctxMenuItems.push_back(ctxMenuForward);
-
m_windowData->setViewMode(fullscreen,
- backbutton,
- ctxMenuItems);
+ backbutton);
}
void WrtClient::backButtonCallback(void* data,
This->m_widget->Backward();
}
-void WrtClient::backwardCallback(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- LogInfo("BackButtonCallback");
- Assert(data);
-
- WrtClient* This = static_cast<WrtClient*>(data);
-
- This->m_widget->Backward();
- This->m_windowData->initFullViewMode();
-}
-
-void WrtClient::reloadCallback(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- LogInfo("reloadCallback");
-
- WrtClient* This = static_cast<WrtClient*>(data);
-
- This->m_widget->Reload();
- This->m_windowData->initFullViewMode();
-}
-
-void WrtClient::forwardCallback(void *data,
- Evas_Object */*obj*/,
- void */*event_info*/)
-{
- LogInfo("forwardCallback");
-
- WrtClient* This = static_cast<WrtClient*>(data);
-
- This->m_widget->Forward();
- This->m_windowData->initFullViewMode();
-}
-
-
void WrtClient::connectElmCallback()
{
Assert(m_windowData);
static void backButtonCallback(void* data,
Evas_Object* obj,
void* event_info);
- static void backwardCallback(void* data,
- Evas_Object* obj,
- void* event_info);
- static void reloadCallback(void* data,
- Evas_Object* obj,
- void* event_info);
- static void forwardCallback(void* data,
- Evas_Object* obj,
- void* event_info);
// launching steps
void initStep();