virtual bool isDesktopMode() const = 0;
/**
+ * Sets an absolute scroll of the given view.
+ *
+ * Both values are from zero to the contents size minus the viewport
+ * size.
+ *
+ * @param x horizontal position to scroll
+ * @param y vertical position to scroll
+ */
+ virtual void scrollView(const int& dx, const int& dy) = 0;
+
+ /**
* FavIcon of current page changed
*/
boost::signals2::signal<void (std::shared_ptr<tizen_browser::tools::BrowserImage>)> favIconChanged;
add_subdirectory(PlatformInputManager)
add_subdirectory(SessionStorage)
add_subdirectory(BookmarkService)
+add_subdirectory(ZoomUI)
break;
#endif
case SCREEN_ZOOM:
+ itemData->moreMenuUI->zoomUIClicked();
break;
#ifdef START_MINIBROWSER_ENABLED
case START_MINIBROWSER:
boost::signals2::signal<void ()> historyUIClicked;
boost::signals2::signal<void ()> settingsClicked;
boost::signals2::signal<void ()> closeMoreMenuClicked;
+ boost::signals2::signal<void ()> zoomUIClicked;
boost::signals2::signal<void ()> switchToMobileMode;
boost::signals2::signal<void ()> switchToDesktopMode;
boost::signals2::signal<bool ()> isBookmark;
include_directories(${CMAKE_SOURCE_DIR}/services/MainUI)
include_directories(${CMAKE_SOURCE_DIR}/services/SettingsUI)
include_directories(${CMAKE_SOURCE_DIR}/services/TabUI)
+include_directories(${CMAKE_SOURCE_DIR}/services/ZoomUI)
include_directories(${CMAKE_SOURCE_DIR}/services/PlatformInputManager)
include_directories(${CMAKE_SOURCE_DIR}/services/SessionStorage)
add_dependencies(${PROJECT_NAME} HistoryUI)
add_dependencies(${PROJECT_NAME} TabUI)
add_dependencies(${PROJECT_NAME} SettingsUI)
+add_dependencies(${PROJECT_NAME} ZoomUI)
add_dependencies(${PROJECT_NAME} PlatformInputManager)
add_dependencies(${PROJECT_NAME} SessionStorage)
target_link_libraries(${PROJECT_NAME} WebPageUI)
target_link_libraries(${PROJECT_NAME} TabUI)
target_link_libraries(${PROJECT_NAME} SettingsUI)
target_link_libraries(${PROJECT_NAME} BookmarkManagerUI)
+target_link_libraries(${PROJECT_NAME} ZoomUI)
target_link_libraries(${PROJECT_NAME} PlatformInputManager)
target_link_libraries(${PROJECT_NAME} SessionStorage)
target_link_libraries(${PROJECT_NAME} ${EFL_LDFLAGS})
std::dynamic_pointer_cast
<tizen_browser::base_ui::BookmarkManagerUI,tizen_browser::core::AbstractService>
(tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.bookmarkmanagerui"));
+
+ m_zoomUI =
+ std::dynamic_pointer_cast
+ <tizen_browser::base_ui::ZoomUI, tizen_browser::core::AbstractService>
+ (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.zoomui"));
}
void SimpleUI::connectUISignals()
m_moreMenuUI->addToBookmarkClicked.connect(boost::bind(&SimpleUI::addToBookmarks, this, _1));
m_moreMenuUI->isBookmark.connect(boost::bind(&SimpleUI::checkBookmark, this));
m_moreMenuUI->deleteBookmark.connect(boost::bind(&SimpleUI::deleteBookmark, this));
+ m_moreMenuUI->zoomUIClicked.connect(boost::bind(&SimpleUI::showZoomUI, this));
M_ASSERT(m_bookmarkManagerUI.get());
m_bookmarkManagerUI->closeBookmarkManagerClicked.connect(boost::bind(&SimpleUI::closeBookmarkManagerUI, this));
m_bookmarkManagerUI->bookmarkItemClicked.connect(boost::bind(&SimpleUI::onBookmarkClicked, this, _1));
+ M_ASSERT(m_zoomUI.get());
+ m_zoomUI->setZoom.connect(boost::bind(&SimpleUI::setZoomFactor, this, _1));
+ m_zoomUI->scrollView.connect(boost::bind(&SimpleUI::scrollView, this, _1, _2));
}
void SimpleUI::loadModelServices()
M_ASSERT(m_bookmarkManagerUI.get());
m_bookmarkManagerUI->init(m_viewManager->getContent());
+
+ M_ASSERT(m_zoomUI.get());
+ m_zoomUI->init(m_viewManager->getContent());
}
void SimpleUI::initModelServices()
m_webEngine->uriChanged.connect(boost::bind(&SimpleUI::webEngineURLChanged, this, _1));
m_webEngine->uriChanged.connect(boost::bind(&URIEntry::changeUri, &m_webPageUI->getURIEntry(), _1));
+ m_webEngine->uriChanged.connect(boost::bind(&MoreMenuUI::setURL, m_moreMenuUI.get(), _1));
m_webEngine->uriOnTabChanged.connect(boost::bind(&SimpleUI::checkTabId,this,_1));
+ m_webEngine->uriOnTabChanged.connect(boost::bind(&SimpleUI::closeZoomUI, this));
m_webEngine->webViewClicked.connect(boost::bind(&URIEntry::clearFocus, &m_webPageUI->getURIEntry()));
m_webEngine->backwardEnableChanged.connect(boost::bind(&WebPageUI::setBackButtonEnabled, m_webPageUI.get(), _1));
m_webEngine->forwardEnableChanged.connect(boost::bind(&WebPageUI::setForwardButtonEnabled, m_webPageUI.get(), _1));
m_webEngine->IMEStateChanged.connect(boost::bind(&SimpleUI::setwvIMEStatus, this, _1));
m_webEngine->favIconChanged.connect(boost::bind(&MoreMenuUI::setFavIcon, m_moreMenuUI.get(), _1));
m_webEngine->titleChanged.connect(boost::bind(&MoreMenuUI::setWebTitle, m_moreMenuUI.get(), _1));
- m_webEngine->uriChanged.connect(boost::bind(&MoreMenuUI::setURL, m_moreMenuUI.get(), _1));
m_favoriteService->bookmarkAdded.connect(boost::bind(&SimpleUI::onBookmarkAdded, this,_1));
m_favoriteService->bookmarkDeleted.connect(boost::bind(&SimpleUI::onBookmarkRemoved, this, _1));
m_webPageUI->getURIEntry().clearFocus();
}
+void SimpleUI::showZoomUI()
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ if(! m_webPageUI->isHomePageActive()) {
+ M_ASSERT(m_viewManager);
+ m_viewManager->popStackTo(m_webPageUI.get());
+ m_webPageUI->showTabUI.connect(boost::bind(&SimpleUI::closeZoomUI, this));
+ m_webPageUI->showMoreMenu.connect(boost::bind(&SimpleUI::closeZoomUI, this));
+ m_zoomUI->show(m_window.get());
+ }
+}
+
+void SimpleUI::closeZoomUI()
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ M_ASSERT(m_zoomUI);
+ m_webPageUI->showTabUI.disconnect(boost::bind(&SimpleUI::closeZoomUI, this));
+ m_webPageUI->showMoreMenu.disconnect(boost::bind(&SimpleUI::closeZoomUI, this));
+ m_zoomUI->hideUI();
+}
+
+void SimpleUI::setZoomFactor(int level)
+{
+ m_webEngine->setZoomFactor(level);
+}
+
+void SimpleUI::scrollView(const int& dx, const int& dy)
+{
+ m_webEngine->scrollView(dx, dy);
+}
+
void SimpleUI::showTabUI()
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
#include "SettingsUI.h"
#include "MainUI.h"
#include "TabUI.h"
+#include "ZoomUI.h"
#include "HistoryService.h"
#include "BookmarkManagerUI.h"
#include "PlatformInputManager.h"
*/
void deleteBookmark(void);
+ /**
+ * @brief show Zoom Menu
+ */
+ void showZoomUI();
+ void closeZoomUI();
+ void setZoomFactor(int level);
+ void scrollView(const int& dx, const int& dy);
+
void showTabUI();
void closeTabUI();
void showMoreMenu();
std::shared_ptr<services::PlatformInputManager> m_platformInputManager;
std::shared_ptr<services::SessionStorage> m_sessionService;
Session::Session m_currentSession;
+ std::shared_ptr<tizen_browser::base_ui::ZoomUI> m_zoomUI;
std::shared_ptr<BookmarksManager> m_bookmarks_manager;
bool m_initialised;
int m_tabLimit;
return m_currentWebView->isDesktopMode();
}
+void WebKitEngineService::scrollView(const int& dx, const int& dy)
+{
+ m_currentWebView->scrollView(dx, dy);
+}
+
} /* end of webkitengine_service */
} /* end of basic_webengine */
} /* end of tizen_browser */
void switchToDesktopMode();
bool isDesktopMode() const;
+ void scrollView(const int& dx, const int& dy);
+
private:
// callbacks from WebView
void _favIconChanged(std::shared_ptr<tizen_browser::tools::BrowserImage> bi);
if(m_ewkView){
//using zoomFactor = 0 sets zoom "fit to screen"
- ewk_view_page_zoom_set(m_ewkView, zoomFactor);
+ if(zoomFactor != getZoomFactor())
+ ewk_view_page_zoom_set(m_ewkView, zoomFactor);
}
#endif
}
+void WebView::scrollView(const int& dx, const int& dy)
+{
+ ewk_view_scroll_by(m_ewkView, dx, dy);
+}
const TabId& WebView::getTabId(){
return m_tabId;
virtual ~WebView();
void init(bool desktopMode, Evas_Object * opener = NULL);
-
void setURI(const std::string &);
std::string getURI(void);
*/
std::shared_ptr<tizen_browser::tools::BrowserImage> getFavicon();
+ /**
+ * Sets an absolute scroll of the given view.
+ *
+ * Both values are from zero to the contents size minus the viewport
+ * size.
+ *
+ * @param x horizontal position to scroll
+ * @param y vertical position to scroll
+ */
+ void scrollView(const int& dx, const int& dy);
+
// signals
boost::signals2::signal<void (std::shared_ptr<tizen_browser::tools::BrowserImage>)> favIconChanged;
boost::signals2::signal<void (const std::string &)> titleChanged;
--- /dev/null
+project(ZoomUI)
+
+set(ZoomUI_SRCS
+ ZoomUI.cpp
+ )
+
+set(ZoomUI_HEADERS
+ ZoomUI.h
+ )
+
+include(Coreheaders)
+include(EFLHelpers)
+
+include_directories(${CMAKE_SOURCE_DIR}/services/FavoriteService)
+
+add_library(${PROJECT_NAME} SHARED ${ZoomUI_SRCS})
+
+if(TIZEN_BUILD)
+ target_link_libraries(${PROJECT_NAME} ${pkgs_LDFLAGS})
+endif(TIZEN_BUILD)
+
+install(TARGETS ${PROJECT_NAME}
+ LIBRARY DESTINATION services
+ ARCHIVE DESTINATION services/static)
+
+#please do not add edc/ directory
+set(edcFiles
+ ZoomUI.edc
+ )
+
+foreach(edec ${edcFiles})
+ string(REPLACE ".edc" ".edj" target_name ${edec})
+ EDJ_TARGET(${target_name}
+ ${CMAKE_CURRENT_SOURCE_DIR}/edc/${edec}
+ ${CMAKE_CURRENT_BINARY_DIR})
+endforeach(edec)
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <Elementary.h>
+#include <boost/concept_check.hpp>
+#include <vector>
+#include <AbstractMainWindow.h>
+
+#include "ZoomUI.h"
+#include "BrowserLogger.h"
+#include "ServiceManager.h"
+
+#define DX 50
+#define iDX -50
+
+namespace tizen_browser{
+namespace base_ui{
+
+EXPORT_SERVICE(ZoomUI, "org.tizen.browser.zoomui")
+
+ZoomUI::ZoomUI()
+ : m_layout(nullptr)
+ , m_nav_layout(nullptr)
+ , m_zoom_slider(nullptr)
+ , m_current_translation_x(0)
+ , m_current_translation_y(0)
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ m_edjFilePath = EDJE_DIR;
+ m_edjFilePath.append("ZoomUI/ZoomUI.edj");
+ elm_theme_extension_add(nullptr, m_edjFilePath.c_str());
+}
+
+ZoomUI::~ZoomUI() {}
+
+void ZoomUI::init(Evas_Object* parent)
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ M_ASSERT(parent);
+ m_parent = parent;
+}
+
+Evas_Object* ZoomUI::getContent()
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ M_ASSERT(m_parent);
+ if(!m_layout)
+ createLayout(m_parent);
+ return m_layout;
+}
+
+void ZoomUI::showUI()
+{
+ evas_object_show(m_layout);
+ evas_object_show(m_nav_layout);
+ evas_object_show(m_zoom_slider);
+}
+
+void ZoomUI::hideUI()
+{
+ evas_object_hide(m_zoom_slider);
+ evas_object_hide(m_nav_layout);
+ evas_object_hide(m_layout);
+}
+
+void ZoomUI::show(Evas_Object* parent)
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ init(parent);
+ createLayout(parent);
+ showUI();
+}
+
+void ZoomUI::createLayout(Evas_Object *parent)
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+
+ m_layout = elm_layout_add(parent);
+ elm_layout_file_set(m_layout, m_edjFilePath.c_str(), "zoom-layout");
+ evas_object_size_hint_weight_set(m_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(m_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ createZoomSlider();
+ createNavigationButtons();
+}
+
+void ZoomUI::createZoomSlider()
+{
+ m_zoom_slider = elm_slider_add(m_layout);
+ evas_object_size_hint_weight_set(m_zoom_slider, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(m_zoom_slider, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(m_zoom_slider, "changed", _zoom_slider_changed, this);
+ elm_object_style_set(m_zoom_slider, "default");
+ elm_slider_horizontal_set(m_zoom_slider, EINA_TRUE);
+ elm_slider_min_max_set(m_zoom_slider, 1, 6);
+ elm_slider_step_set(m_zoom_slider, 1);
+ elm_slider_value_set(m_zoom_slider, 3);
+ elm_slider_indicator_format_set(m_zoom_slider, "%1.0f");
+
+ elm_object_part_content_set(m_layout, "slider_swallow", m_zoom_slider);
+}
+
+void ZoomUI::createNavigationButtons()
+{
+ m_nav_layout = elm_layout_add(m_layout);
+ elm_layout_file_set(m_nav_layout, m_edjFilePath.c_str(), "nav-layout");
+ evas_object_size_hint_weight_set(m_nav_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(m_nav_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_part_content_set(m_layout, "nav_buttons", m_nav_layout);
+
+ Evas_Object* icon = elm_icon_add(m_nav_layout);
+ setImageFile(icon, LEFT, false);
+ evas_object_smart_callback_add(icon, "clicked", _left_button_clicked, this);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_IN, _cb_focus_in_left_button, this);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_OUT, _cb_focus_out_left_button, this);
+ elm_object_part_content_set(m_nav_layout, "left_button", icon);
+
+ icon = elm_icon_add(m_nav_layout);
+ setImageFile(icon, RIGHT, false);
+ evas_object_smart_callback_add(icon, "clicked", _right_button_clicked, this);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_IN, _cb_focus_in_right_button, this);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_OUT, _cb_focus_out_right_button, this);
+ elm_object_part_content_set(m_nav_layout, "right_button", icon);
+
+ icon = elm_icon_add(m_nav_layout);
+ setImageFile(icon, DOWN, false);
+ evas_object_smart_callback_add(icon, "clicked", _down_button_clicked, this);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_IN, _cb_focus_in_down_button, this);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_OUT, _cb_focus_out_down_button, this);
+ elm_object_part_content_set(m_nav_layout, "down_button", icon);
+
+ icon = elm_icon_add(m_nav_layout);
+ setImageFile(icon, UP, false);
+ evas_object_smart_callback_add(icon, "clicked", _up_button_clicked, this);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_IN, _cb_focus_in_up_button, this);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_OUT, _cb_focus_out_up_button, this);
+ elm_object_part_content_set(m_nav_layout, "up_button", icon);
+}
+
+void ZoomUI::clearItems()
+{
+ evas_object_del(m_layout);
+ setZoom(ZOOM_DEFAULT);
+}
+
+void ZoomUI::setImageFile(Evas_Object* obj, int direction, bool focused)
+{
+ switch (direction) {
+ case LEFT: elm_image_file_set(obj, m_edjFilePath.c_str(), focused ? "ic_zoom_indicator_left_foc.png" : "ic_zoom_indicator_left_nor.png");
+ break;
+ case RIGHT: elm_image_file_set(obj, m_edjFilePath.c_str(), focused ? "ic_zoom_indicator_right_foc.png" : "ic_zoom_indicator_right_nor.png");
+ break;
+ case DOWN: elm_image_file_set(obj, m_edjFilePath.c_str(), focused ? "ic_zoom_indicator_down_foc.png" : "ic_zoom_indicator_down_nor.png");
+ break;
+ case UP: elm_image_file_set(obj, m_edjFilePath.c_str(), focused ? "ic_zoom_indicator_up_foc.png" : "ic_zoom_indicator_up_nor.png");
+ break;
+ default: BROWSER_LOGD("[%s:%d] Warning: Unhandled button", __PRETTY_FUNCTION__, __LINE__);
+ break;
+ }
+}
+
+void ZoomUI::_zoom_slider_changed(void *data, Evas_Object *obj, void *event_info)
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ if(data && obj) {
+ int val = elm_slider_value_get(obj);
+ int zoomLevel = ZOOM_DEFAULT;
+ ZoomUI *zoomUI = static_cast<ZoomUI*>(data);
+
+ switch (val) {
+ case 1: zoomLevel = ZOOM_50;
+ break;
+ case 2: zoomLevel = ZOOM_75;
+ break;
+ case 3: zoomLevel = ZOOM_DEFAULT;
+ break;
+ case 4: zoomLevel = ZOOM_150;
+ break;
+ case 5: zoomLevel = ZOOM_200;
+ break;
+ case 6: zoomLevel = ZOOM_300;
+ break;
+ default:BROWSER_LOGD("[%s:%d] Warning: Unhandled zoom level", __PRETTY_FUNCTION__, __LINE__);
+ break;
+ }
+ zoomUI->setZoom(zoomLevel);
+ }
+}
+
+void ZoomUI::_left_button_clicked(void * data, Evas_Object * obj, void * event_info)
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ if (data && obj) {
+ ZoomUI *zoomUI = static_cast<ZoomUI*>(data);
+ zoomUI->scrollView(iDX, 0);
+ }
+}
+
+void ZoomUI::_right_button_clicked(void * data, Evas_Object * obj, void * event_info)
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ if (data && obj) {
+ ZoomUI *zoomUI = static_cast<ZoomUI*>(data);
+ zoomUI->scrollView(DX, 0);
+ }
+}
+
+void ZoomUI::_up_button_clicked(void * data, Evas_Object * obj, void * event_info)
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ if (data && obj) {
+ ZoomUI *zoomUI = static_cast<ZoomUI*>(data);
+ zoomUI->scrollView(0, iDX);
+ }
+}
+
+void ZoomUI::_down_button_clicked(void * data, Evas_Object * obj, void * event_info)
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ if (data && obj) {
+ ZoomUI *zoomUI = static_cast<ZoomUI*>(data);
+ zoomUI->scrollView(0, DX);
+ }
+}
+
+void ZoomUI::_cb_focus_in_left_button(void * data, Evas *, Evas_Object *obj, void *)
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ if (data && obj) {
+ elm_object_focus_set(obj, EINA_TRUE);
+ ZoomUI *zoomUI = static_cast<ZoomUI*>(data);
+ zoomUI->setImageFile(obj, LEFT, true);
+ }
+}
+
+void ZoomUI::_cb_focus_out_left_button(void * data, Evas *, Evas_Object *obj, void *)
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ if (data && obj) {
+ elm_object_focus_set(obj, EINA_FALSE);
+ ZoomUI *zoomUI = static_cast<ZoomUI*>(data);
+ zoomUI->setImageFile(obj, LEFT, false);
+ }
+}
+
+void ZoomUI::_cb_focus_in_right_button(void * data, Evas *, Evas_Object *obj, void *)
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ if (data && obj) {
+ elm_object_focus_set(obj, EINA_TRUE);
+ ZoomUI *zoomUI = static_cast<ZoomUI*>(data);
+ zoomUI->setImageFile(obj, RIGHT, true);
+ }
+}
+
+void ZoomUI::_cb_focus_out_right_button(void * data, Evas *, Evas_Object *obj, void *)
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ if (data && obj) {
+ elm_object_focus_set(obj, EINA_FALSE);
+ ZoomUI *zoomUI = static_cast<ZoomUI*>(data);
+ zoomUI->setImageFile(obj, RIGHT, false);
+ }
+}
+
+void ZoomUI::_cb_focus_in_up_button(void * data, Evas *, Evas_Object *obj, void *)
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ if (data && obj) {
+ elm_object_focus_set(obj, EINA_TRUE);
+ ZoomUI *zoomUI = static_cast<ZoomUI*>(data);
+ zoomUI->setImageFile(obj, UP, true);
+ }
+}
+
+void ZoomUI::_cb_focus_out_up_button(void * data, Evas *, Evas_Object *obj, void *)
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ if (data && obj) {
+ elm_object_focus_set(obj, EINA_FALSE);
+ ZoomUI *zoomUI = static_cast<ZoomUI*>(data);
+ zoomUI->setImageFile(obj, UP, false);
+ }
+}
+
+void ZoomUI::_cb_focus_in_down_button(void * data, Evas *, Evas_Object *obj, void *)
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ if (data && obj) {
+ elm_object_focus_set(obj, EINA_TRUE);
+ ZoomUI *zoomUI = static_cast<ZoomUI*>(data);
+ zoomUI->setImageFile(obj, DOWN, true);
+ }
+}
+
+void ZoomUI::_cb_focus_out_down_button(void * data, Evas *, Evas_Object *obj, void *)
+{
+ BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
+ if (data && obj) {
+ elm_object_focus_set(obj, EINA_FALSE);
+ ZoomUI *zoomUI = static_cast<ZoomUI*>(data);
+ zoomUI->setImageFile(obj, DOWN, false);
+ }
+}
+
+
+}
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ZOOMUI_H
+#define ZOOMUI_H
+
+#include <Evas.h>
+#include <boost/signals2/signal.hpp>
+
+#include "AbstractUIComponent.h"
+#include "AbstractService.h"
+#include "ServiceFactory.h"
+#include "service_macros.h"
+
+namespace tizen_browser{
+namespace base_ui{
+
+class BROWSER_EXPORT ZoomUI
+ : public tizen_browser::interfaces::AbstractUIComponent
+ , public tizen_browser::core::AbstractService
+{
+public:
+ ZoomUI();
+ ~ZoomUI();
+
+ //AbstractUIComponent interface methods
+ void init(Evas_Object* parent);
+ Evas_Object* getContent();
+ void showUI();
+ void hideUI();
+ std::string getName();
+
+ void show(Evas_Object* parent);
+ void clearItems();
+
+ boost::signals2::signal<void ()> closeZoomUI;
+ boost::signals2::signal<void (int)> setZoom;
+ boost::signals2::signal<void (const int&, const int&)> scrollView;
+private:
+ void createLayout(Evas_Object* parent);
+ void createZoomSlider();
+ void createNavigationButtons();
+ void setImageFile(Evas_Object* obj, int direction, bool focused);
+
+ static void _zoom_slider_changed(void * data, Evas_Object * obj, void * event_info);
+ static void _left_button_clicked(void * data, Evas_Object * obj, void * event_info);
+ static void _right_button_clicked(void * data, Evas_Object * obj, void * event_info);
+ static void _up_button_clicked(void * data, Evas_Object * obj, void * event_info);
+ static void _down_button_clicked(void * data, Evas_Object * obj, void * event_info);
+ static void _close_button_clicked(void * data, Evas_Object * obj, void * event_info);
+ static void _cb_focus_in_left_button(void * data, Evas *, Evas_Object *obj, void *);
+ static void _cb_focus_out_left_button(void * data, Evas *, Evas_Object *obj, void *);
+ static void _cb_focus_in_right_button(void * data, Evas *, Evas_Object *obj, void *);
+ static void _cb_focus_out_right_button(void * data, Evas *, Evas_Object *obj, void *);
+ static void _cb_focus_in_up_button(void * data, Evas *, Evas_Object *obj, void *);
+ static void _cb_focus_out_up_button(void * data, Evas *, Evas_Object *obj, void *);
+ static void _cb_focus_in_down_button(void * data, Evas *, Evas_Object *obj, void *);
+ static void _cb_focus_out_down_button(void * data, Evas *, Evas_Object *obj, void *);
+
+ std::string m_edjFilePath;
+ Evas_Object* m_layout;
+ Evas_Object* m_zoom_slider;
+ Evas_Object* m_nav_layout;
+ Evas_Object* m_parent;
+
+ int m_current_translation_x;
+ int m_current_translation_y;
+
+ enum ZoomLevel {
+ ZOOM_50 = 50,
+ ZOOM_75 = 75,
+ ZOOM_100 = 100,
+ ZOOM_150 = 150,
+ ZOOM_200 = 200,
+ ZOOM_300 = 300,
+
+ ZOOM_MIN = ZOOM_50,
+ ZOOM_DEFAULT = ZOOM_100,
+ ZOOM_MAX = ZOOM_300
+ };
+ enum ArrowType {
+ LEFT = 1,
+ RIGHT = 2,
+ UP = 3,
+ DOWN = 4
+ };
+};
+
+}
+}
+
+#endif // ZOOMUI_H
--- /dev/null
+#define RESOURCE_IMAGE_LOSSY( FILE_NAME ) \
+ group { \
+ name: FILE_NAME; \
+ images.image: FILE_NAME LOSSY 100; \
+ parts { \
+ part { name: "image"; \
+ description { \
+ state: "default" 0.0; \
+ image.normal: FILE_NAME; \
+ aspect: 1 1; \
+ aspect_preference: BOTH; \
+ } \
+ } \
+ } \
+ }
+
+
+collections {
+
+#define WIDTH 1920
+#define HEIGHT 976
+
+RESOURCE_IMAGE_LOSSY("ic_zoom_indicator_down_foc.png");
+RESOURCE_IMAGE_LOSSY("ic_zoom_indicator_down_nor.png");
+RESOURCE_IMAGE_LOSSY("ic_zoom_indicator_left_foc.png");
+RESOURCE_IMAGE_LOSSY("ic_zoom_indicator_left_nor.png");
+RESOURCE_IMAGE_LOSSY("ic_zoom_indicator_right_foc.png");
+RESOURCE_IMAGE_LOSSY("ic_zoom_indicator_right_nor.png");
+RESOURCE_IMAGE_LOSSY("ic_zoom_indicator_up_foc.png");
+RESOURCE_IMAGE_LOSSY("ic_zoom_indicator_up_nor.png");
+
+ group {
+ name: "zoom-layout";
+ data.item: "contents" "close_button";
+
+ parts {
+
+ part { name: "bg";
+ type: RECT;
+ mouse_events: 1;
+ description { state: "default" 0.0;
+ color: 0 0 0 50;
+ visible: 1;
+ min: WIDTH HEIGHT;
+ max: WIDTH HEIGHT;
+ align: 0.0 0.0;
+ rel1 {relative: 0.0 0.0; offset: 0 104;}
+ rel2 {relative: 1.0 1.0;}
+ }
+ }
+
+ part { name: "zoom_rect";
+ type: RECT;
+ mouse_events: 1;
+ description { state: "default" 0.0;
+ color: 230 230 230 255;
+ min: 700 300;
+ max: 700 300;
+ visible: 1;
+ align: 0.0 1.0;
+ rel1 {
+ to: "bg";
+ offset: 0 0;
+ relative: 0.0 0.0;
+ }
+ rel2 {
+ to: "bg";
+ relative: 1.0 1.0;
+ }
+ }
+ }
+
+ part { name: "slider_swallow";
+ type: SWALLOW;
+ description {
+ min: 500 100;
+ max: 500 100;
+ visible: 1;
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1 {
+ relative: 0.15 0.4;
+ to: "zoom_rect";
+ }
+ rel2 {
+ relative: 0.0 0.0;
+ to: "zoom_rect";
+ }
+ }
+ }
+
+ part { name: "zoom_text";
+ type: TEXT;
+ description {
+ visible: 1;
+ min: 200 122;
+ max: 200 122;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ color: 51 51 51 255;
+ rel1 {
+ to: "zoom_rect";
+ relative: 0.45 0.0;
+ offset: 0 0;
+ }
+ rel2 {
+ to: "zoom_rect";
+ relative: 1.0 1.0;
+ }
+ text {
+ text: "Zoom";
+ font: "Sans";
+ size: 32;
+ align: 0 0.5;
+ }
+ }
+ }
+
+ part { name: "slider_begin_text";
+ type: TEXT;
+ description {
+ visible: 1;
+ min: 100 122;
+ max: 100 122;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ color: 51 51 51 255;
+ rel1 {
+ to: "slider_swallow";
+ relative: 0.0 0.0;
+ offset: -50 -10;
+ }
+ rel2 {
+ to: "slider_swallow";
+ relative: 1.0 1.0;
+ offset: 0 0;
+ }
+ text {
+ text: "50%";
+ font: "Sans";
+ size: 22;
+ align: 0 0.5;
+ }
+ }
+ }
+
+ part { name: "slider_end_text";
+ type: TEXT;
+ description {
+ visible: 1;
+ min: 100 122;
+ max: 100 122;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ color: 51 51 51 255;
+ rel1 {
+ to: "slider_swallow";
+ relative: 1.0 0.0;
+ offset: 5 -10;
+ }
+ rel2 {
+ to: "slider_swallow";
+ relative: 1.0 1.0;
+ offset: 0 0;
+ }
+ text {
+ text: "300%";
+ font: "Sans";
+ size: 22;
+ align: 0 0.5;
+ }
+ }
+ }
+
+
+ part {
+ name: "nav_buttons";
+ type : SWALLOW;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ min: WIDTH HEIGHT;
+ max: WIDTH HEIGHT;
+ align: 0.0 0.0;
+ fixed: 0 0;
+ rel1 { relative: 0.0 0.0; to: "bg"; }
+ rel2 { relative: 1.0 1.0; to: "bg"; }
+ }
+ }
+
+ }
+ }
+
+ group {
+ name: "nav-layout";
+ min: WIDTH HEIGHT;
+ max: WIDTH HEIGHT;
+ data.item: "contents" "left_button right_button up_button down_button";
+ parts {
+ part {
+ name: "left_button";
+ type: SWALLOW;
+ mouse_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ align: 0 0.5;
+ fixed: 1 1;
+ min: 90 90;
+ max: 90 90;
+ rel1 { relative: 0.0 0.0; offset: 38 0;}
+ rel2 { relative: 1.0 1.0;}
+ }
+ }
+ part {
+ name: "right_button";
+ type: SWALLOW;
+ scale: 1;
+ mouse_events: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ align: 1 0.5;
+ fixed: 1 1;
+ min: 90 90;
+ max: 90 90;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; offset: -38 0; }
+ }
+ }
+ part {
+ name: "up_button";
+ type: SWALLOW;
+ scale: 1;
+ mouse_events: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ align: 0.5 0;
+ fixed: 1 1;
+ min: 90 90;
+ max: 90 90;
+ rel1 { relative: 0.0 0.0; offset: 0 38; }
+ rel2 { relative: 1.0 1.0; }
+ }
+ }
+ part {
+ name: "down_button";
+ type: SWALLOW;
+ scale: 1;
+ mouse_events: 1;
+ description {
+ state: "default" 0.0;
+ visible: 1;
+ align: 0.5 1;
+ fixed: 1 1;
+ min: 90 90;
+ max: 90 90;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; offset: 0 -38; }
+ }
+ }
+ }
+ programs{
+ program {
+ name: "mouse_click";
+ signal: "mouse,clicked,1";
+ source: "*";
+ script {
+ emit("elm,action,click", "");
+ }
+ }
+ }
+ }
+}
\ No newline at end of file