CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(ui-viewmgr)
-SET(PACKAGE org.tizen.ui-viewmgr)
-SET(SRCS
- src/interface/ui_iface_controller.cpp
- src/interface/ui_iface_view.cpp
- src/interface/ui_iface_viewmgr.cpp
- src/efl/ui_controller.cpp
- src/efl/ui_view.cpp
- src/efl/ui_viewmgr.cpp
- src/efl/ui_key_listener.cpp
- src/efl/mobile/ui_basic_controller.cpp
- src/efl/mobile/ui_basic_view.cpp
- src/efl/mobile/ui_basic_key_listener.cpp
- src/efl/mobile/ui_basic_viewmgr.cpp
- src/efl/example/main.cpp
- )
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/inc)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_DIR ${PREFIX})
+SET(BINDIR ${PREFIX}/bin)
+SET(LIBDIR ${PREFIX}/lib)
+SET(INCDIR ${PREFIX}/include)
+SET(VERSION_MAJOR 0)
+SET(VERSION ${VERSION_MAJOR}.1.0)
+SET(VENDOR "samsung")
+SET(PACKAGE ${PROJECT_NAME})
+
+SET(CMAKE_SKIP_BUILD_RPATH TRUE)
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+ SET(CMAKE_BUILD_TYPE "Release")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
+
+IF(NOT DBDIR)
+ SET(DBDIR "$ENV{HOME}")
+ENDIF(NOT DBDIR)
+ADD_DEFINITIONS("-DDBDIR=\"${DBDIR}\"")
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DVERSION=\"${VERSION}\"")
+ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"")
+ADD_DEFINITIONS("-DPLUGINDIR=\"${PLUGINDIR}\"")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -Wall")
-FIND_LIBRARY(LIB_M m)
-#FIXME: pthread is added for preventing build error
-SET(PKG_LDFLAGS "-pthread ${LIB_M} -pie")
-SET(PKG_CFLAGS "-g -Wall -fPIE")
+SET(EDJ_PATH "${RESDIR}/edje")
INCLUDE(FindPkgConfig)
-pkg_check_modules(BASE_PKG REQUIRED elementary efl-extension)
-FOREACH(flag ${BASE_PKG_CFLAGS})
- SET(PKG_CFLAGS "${PKG_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-FOREACH(flag ${BASE_PKG_LDFLAGS})
- SET(PKG_LDFLAGS "${PKG_LDFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-pkg_check_modules(TIZEN_PKG REQUIRED dlog capi-appfw-application capi-system-system-settings appcore-efl capi-appfw-app-manager)
-FOREACH(flag ${TIZEN_PKG_CFLAGS})
- SET(PKG_CFLAGS "${PKG_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-FOREACH(flag ${TIZEN_PKG_LDFLAGS})
- SET(PKG_LDFLAGS "${PKG_LDFLAGS} ${flag}")
-ENDFOREACH(flag)
-SET(GC_SECTIONS_FLAGS "-fdata-sections -ffunction-sections -Wl,--gc-sections")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PKG_CFLAGS}")
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PKG_CFLAGS} -Wall -Werror -Wno-unused -Wno-format-extra-args -Wl,--no-undefined -fvisibility=hidden -fPIC -std=c++0x ${GC_SECTIONS_FLAGS}")
+ADD_SUBDIRECTORY(src)
-# install desktop file & icon
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(BINDIR "${PREFIX}/bin")
-SET(RESDIR "${PREFIX}/res")
-SET(DATADIR "${PREFIX}/data")
-SET(LOCALEDIR "${RESDIR}/locale")
-SET(IMGDIR "${RESDIR}/images")
-
-ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"")
-ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
-ADD_DEFINITIONS("-DRESDIR=\"${RESDIR}\"")
-ADD_DEFINITIONS("-DDATADIR=\"${DATADIR}\"")
-ADD_DEFINITIONS("-DLOCALE_DIR=\"${LOCALEDIR}\"")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
-ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKG_LDFLAGS})
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
ADD_CUSTOM_TARGET(${PROJECT_NAME}.edj
- COMMAND edje_cc -no-save -id ${CMAKE_CURRENT_SOURCE_DIR}/res
- ${CMAKE_SOURCE_DIR}/res/${PROJECT_NAME}.edc ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.edj
- DEPENDS ${CMAKE_SOURCE_DIR}/res/${PROJECT_NAME}.edc
- )
+ COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/data/edc
+ ${CMAKE_SOURCE_DIR}/data/edc/${PROJECT_NAME}.edc ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.edj
+ DEPENDS ${CMAKE_SOURCE_DIR}/data/edc/${PROJECT_NAME}.edc
+ )
ADD_DEPENDENCIES(${PROJECT_NAME} ${PROJECT_NAME}.edj)
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
-# for workaround taskmanager behaviour
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PACKAGE}.png DESTINATION /usr/share/icons/default/small/)
-INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.edj DESTINATION ${RESDIR})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PACKAGE}.xml DESTINATION /usr/share/packages/)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.edj DESTINATION /usr/share/edje/${PROJECT_NAME})
--- /dev/null
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define TIZEN_VIEW_BG_PORTRAIT_HEIGHT_INC 1280
+#define TIZEN_VIEW_BG_LANDSPACPE_HEIGHT_INC 720
+#define TIZEN_VIEW_TITLE_HEIGHT_INC 110
+#define TIZEN_VIEW_TITLE_TEXT_FONT_SIZE_INC 50
+#define TIZEN_VIEW_SUBTITLE_VISIBLE_TEXT_FONT_SIZE_INC 42
+#define TIZEN_VIEW_VISIBLE_TEXT_FONT_SIZE_INC 28
+#define TIZEN_VIEW_TITLE_TEXT_FONT_RANGE_INC 36 50
+#define TIZEN_VIEW_SUBTITLE_VISIBLE_TEXT_FONT_RANGE_INC 36 42
+#define TIZEN_VIEW_TITLE_TOP_PADDING_HEIGHT_INC 3
+#define TIZEN_VIEW_SUBTITLE_HEIGHT_INC 38
+#define TIZEN_VIEW_SUBTITLE_BOTTOM_PADDING_HEIGHT_INC 3
+#define TIZEN_VIEW_BADGE_ICON_LEFT_PADDING_WIDTH_INC 22
+#define TIZEN_VIEW_BADGE_TEXT_LEFT_PADDING_WIDTH_INC 22
+#define TIZEN_VIEW_BADGE_HEIGHT_INC 48
+#define TIZEN_VIEW_BADGE2_PADDING_WIDTH_INC (TIZEN_VIEW_BADGE_ICON_LEFT_PADDING_WIDTH_INC + TIZEN_VIEW_BADGE_TEXT_LEFT_PADDING_WIDTH_INC + TIZEN_VIEW_BADGE_TEXT_LEFT_PADDING_WIDTH_INC)
+#define TIZEN_VIEW_TITLE_LEFT_PADDING_WIDTH_INC 32
+#define TIZEN_VIEW_TITLE_FUNC_BTN_SIZE_INC 176 110
+#define TIZEN_VIEW_BACK_BUTTON_LR_PADDING_WIDTH_INC 10
+#define TIZEN_VIEW_BACK_BUTTON_TITLE_RIGHT_PADDING_WIDTH_INC 90
+#define BUTTON_TIZEN_VIEW_BACK_BUTTON_SIZE_INC 80 80
+#define TIZEN_VIEW_TITLE_RIGHT_PADDING_WIDTH_INC 32
+#define TIZEN_VIEW_TOOLBAR_TITLE_TOP_PADDING_HEIGHT_INC 80
+#define TIZEN_VIEW_TOOLBAR_TITLE_HEIGHT_INC 100
+#define TIZEN_VIEW_TOOLBAR_TITLE_CLIPPER_HEIGHT_INC 80
+#define TIZEN_VIEW_TOOLBAR_LIGHT_VIEW_HEIGHT_INC 86
+#define TIZEN_VIEW_TOOLBAR_TOP_DIVIDER_HEIGHT_INC 0
+
+collections {
+ base_scale: 2.6;
+ styles {
+ style { name: "tizen_view_title_style";
+ base: "font=Tizen:style=Condensed align=center font_size="TIZEN_VIEW_TITLE_TEXT_FONT_SIZE_INC" color=#FFFFFFFF wrap=none ellipsis=1.0 text_class=tizen";
+ tag: "br" "\n";
+ tag: "tab" "\t";
+ }
+ style { name: "tizen_view_subtitle_visible_style";
+ base: "font=Tizen:style=Condensed align=center font_size="TIZEN_VIEW_SUBTITLE_VISIBLE_TEXT_FONT_SIZE_INC" color=#FFFFFFFF wrap=none ellipsis=1.0 text_class=tizen";
+ tag: "br" "\n";
+ tag: "tab" "\t";
+ }
+ style { name: "tizen_view_subtitle_style";
+ base: "font=Tizen:style=Condensed align=center font_size="TIZEN_VIEW_VISIBLE_TEXT_FONT_SIZE_INC" color=#FFFFFFFF wrap=none ellipsis=1.0 text_class=tizen";
+ tag: "br" "\n";
+ tag: "tab" "\t";
+ }
+ }
+
+ group { name: "elm/layout/tizen_view/default";
+ images {
+ image: "images/core_theme_bg_01.png" COMP;
+ image: "images/core_icon_badge_container.#.png" COMP;
+ }
+ script {
+ public landscape_mode = 0; //Landscape status
+ public prev_btn_visible = 0; //Previous button visible status
+ public title_left_btn_visible = 0; //Title left button visible status
+ public title_right_btn_visible = 0; //Title right button visible status
+ public toolbar_visible = 0; //Tabbar visible status (This value is used for toolbar group)
+ }
+ parts {
+ part { name: "base";
+ type: SPACER;
+ description { state: "default" 0.0;
+ }
+ }
+ part { name: "bg_img";
+ type: IMAGE;
+ scale: 1;
+ mouse_events: 0;
+ clip_to: "clipper";
+ description { state: "default" 0.0;
+ rel1.to: "base";
+ rel2.to: "base";
+ align: 0.5 0.0;
+ fixed: 0 1;
+ min: 0 TIZEN_VIEW_BG_PORTRAIT_HEIGHT_INC;
+ image.normal: "images/core_theme_bg_01.png";
+ }
+ description { state: "landscape" 0.0;
+ inherit: "default" 0.0;
+ min: 0 TIZEN_VIEW_BG_LANDSPACPE_HEIGHT_INC;
+ }
+ }
+ part { name: "clipper";
+ type: RECT;
+ mouse_events: 0;
+ description { state: "default" 0.0;
+ visible: 1;
+ }
+ description { state: "hidden" 0.0;
+ visible: 0;
+ }
+ }
+ part { name: "title_bg";
+ type: RECT;
+ scale: 1;
+ mouse_events: 0;
+ description { state: "default" 0.0;
+ min: 0 TIZEN_VIEW_TITLE_HEIGHT_INC;
+ max: -1 TIZEN_VIEW_TITLE_HEIGHT_INC;
+ align: 0.0 0.0;
+ fixed: 0 1;
+ rel1 { to: "base"; relative: 0.0 0.0; }
+ rel2 { to: "base"; relative: 1.0 0.0; }
+ color: 61 185 204 255;
+ }
+ description { state: "hidden" 0.0;
+ inherit: "default" 0.0;
+ min: 0 0;
+ max: -1 0;
+ }
+ }
+ part { name: "toolbar_top_padding";
+ type: SPACER;
+ scale: 1;
+ repeat_events: 1;
+ description { state: "default" 0.0;
+ min: 0 TIZEN_VIEW_TOOLBAR_TITLE_TOP_PADDING_HEIGHT_INC;
+ max: -1 TIZEN_VIEW_TOOLBAR_TITLE_TOP_PADDING_HEIGHT_INC;
+ fixed: 0 1;
+ align: 0.5 0.0;
+ rel1 { to: "title_bg"; relative: 0.0 0.0; }
+ rel2 { to: "title_bg"; relative: 1.0 0.0; }
+ }
+ }
+ part { name: "toolbar";
+ type: SWALLOW;
+ scale: 1;
+ clip_to: "toolbar_clipper";
+ description { state: "default" 0.0;
+ min: 0 0;
+ max: -1 0;
+ fixed: 0 1;
+ align: 0.5 0.0;
+ rel1 { to: "toolbar_top_padding"; relative: 0.0 1.0; }
+ rel2 { to: "toolbar_top_padding"; relative: 1.0 1.0; }
+ visible: 0;
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ min: 0 TIZEN_VIEW_TOOLBAR_TITLE_HEIGHT_INC;
+ max: -1 TIZEN_VIEW_TOOLBAR_TITLE_HEIGHT_INC;
+ visible: 1;
+ }
+ }
+ part { name: "toolbar_top_divider";
+ type: RECT;
+ scale: 1;
+ mouse_events: 0;
+ clip_to: "toolbar_clipper";
+ description { state: "default" 0.0;
+ min: 0 0;
+ max: -1 0;
+ fixed: 0 1;
+ align: 0.5 0.0;
+ rel1 { to: "toolbar_clipper"; relative: 0.0 0.0; }
+ rel2 { to: "toolbar_clipper"; relative: 1.0 0.0; }
+ color: 244 244 244 25;
+ visible: 0;
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ min: 0 TIZEN_VIEW_TOOLBAR_TOP_DIVIDER_HEIGHT_INC;
+ max: -1 TIZEN_VIEW_TOOLBAR_TOP_DIVIDER_HEIGHT_INC;
+ visible: 1;
+ }
+ }
+ part { name: "toolbar_clipper";
+ type: RECT;
+ scale: 1;
+ mouse_events: 0;
+ clip_to: "clipper";
+ description { state: "default" 0.0;
+ min: 0 TIZEN_VIEW_TOOLBAR_TITLE_CLIPPER_HEIGHT_INC;
+ max: -1 TIZEN_VIEW_TOOLBAR_TITLE_CLIPPER_HEIGHT_INC;
+ fixed: 0 1;
+ align: 0.5 1.0;
+ rel1 { to: "toolbar"; relative: 0.0 1.0; }
+ rel2 { to: "toolbar"; relative: 1.0 1.0; }
+ }
+ }
+ part { name: "title_clipper";
+ type: RECT;
+ mouse_events: 0;
+ clip_to: "clipper";
+ description { state: "default" 0.0;
+ rel1.to_y: "title_bg";
+ rel2.to_y: "title_bg";
+ }
+ description { state: "hidden" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part { name: "title_text_left_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1.to: "title_bg";
+ rel2.to: "title_left_btn_bg";
+ }
+ description { state: "title_badge_visible" 0.0;
+ rel1.to: "title_bg";
+ rel2.to: "title_badge2_padding";
+ }
+ description { state: "prev_btn_visible" 0.0;
+ rel1.to: "title_bg";
+ rel2 { to_x: "elm.swallow.prev_btn"; to_y: "title_bg"; relative: 1.0 1.0; }
+ }
+ }
+ part { name: "title_text_right_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1.to: "title_right_btn_bg";
+ rel2.to: "title_bg";
+ }
+ description { state: "title_badge_visible" 0.0;
+ rel1.to: "badge_icon_left_padding";
+ rel2.to: "title_bg";
+ }
+ description { state: "prev_btn_visible" 0.0;
+ rel1.to: "prev_btn_title_right_padding";
+ rel2.to: "title_bg";
+ }
+ }
+ part { name: "elm.text.title";
+ type: TEXTBLOCK;
+ scale: 1;
+ mouse_events: 0;
+ clip_to: "title_text_clipper";
+ description { state: "default" 0.0;
+ text {
+ style: "tizen_view_title_style";
+ size: TIZEN_VIEW_TITLE_TEXT_FONT_SIZE_INC;
+ size_range: TIZEN_VIEW_TITLE_TEXT_FONT_RANGE_INC;
+ fit: 1 0;
+ }
+ fixed: 1 1;
+ rel1 { to_x: "title_text_left_padding"; to_y: "title_bg"; relative: 1.0 0.0; }
+ rel2 { to_x: "title_text_right_padding"; to_y: "title_bg"; relative: 0.0 1.0; }
+ }
+ description { state: "subtitle_visible" 0.0;
+ text {
+ style: "tizen_view_subtitle_visible_style";
+ size: TIZEN_VIEW_SUBTITLE_VISIBLE_TEXT_FONT_SIZE_INC;
+ size_range: TIZEN_VIEW_SUBTITLE_VISIBLE_TEXT_FONT_RANGE_INC;
+ fit: 1 0;
+ }
+ fixed: 1 1;
+ rel1 { to_x: "title_text_left_padding"; to_y: "title_top_padding"; relative: 1.0 1.0; }
+ rel2 { to_x: "title_text_right_padding"; to_y: "elm.text.subtitle"; relative: 0.0 0.0; }
+ }
+ }
+ part { name: "title_text_clipper";
+ type: RECT;
+ mouse_events: 0;
+ clip_to: "title_clipper";
+ description { state: "default" 0.0;
+ rel1.to: "elm.text.title";
+ rel2.to: "elm.text.title";
+ }
+ }
+ part { name: "title_top_padding";
+ type: SPACER;
+ description { state: "default" 0.0;
+ min: 0 TIZEN_VIEW_TITLE_TOP_PADDING_HEIGHT_INC;
+ max: -1 TIZEN_VIEW_TITLE_TOP_PADDING_HEIGHT_INC;
+ fixed: 0 1;
+ align: 0.5 0.0;
+ rel1 { to: "title_bg"; relative: 0.0 0.0; }
+ rel2 { to: "title_bg"; relative: 1.0 0.0; }
+ }
+ }
+ part { name: "elm.text.subtitle";
+ type: TEXTBLOCK;
+ scale: 1;
+ mouse_events: 0;
+ description { state: "default" 0.0;
+ text { style: "tizen_view_subtitle_style";}
+ min: 0 TIZEN_VIEW_SUBTITLE_HEIGHT_INC;
+ max: -1 TIZEN_VIEW_SUBTITLE_HEIGHT_INC;
+ fixed: 1 1;
+ align: 0.5 1.0;
+ rel1 { to_x: "title_text_left_padding"; to_y: "subtitle_bottom_padding"; relative: 1.0 0.0; }
+ rel2 { to_x: "title_text_right_padding"; to_y: "subtitle_bottom_padding"; relative: 0.0 0.0; }
+ }
+ }
+ part { name: "subtitle_bottom_padding";
+ type: SPACER;
+ description { state: "default" 0.0;
+ min: 0 TIZEN_VIEW_SUBTITLE_BOTTOM_PADDING_HEIGHT_INC;
+ max: -1 TIZEN_VIEW_SUBTITLE_BOTTOM_PADDING_HEIGHT_INC;
+ fixed: 0 1;
+ align: 0.5 1.0;
+ rel1 { to: "title_bg"; relative: 0.0 1.0; }
+ rel2 { to: "title_bg"; relative: 1.0 1.0; }
+ }
+ }
+ part { name: "click_event_area";
+ type: RECT;
+ ignore_flags: ON_HOLD;
+ description { state: "default" 0.0;
+ rel1.to: "title_bg";
+ rel2.to: "title_bg";
+ color: 0 0 0 0;
+ }
+ }
+ part { name: "access.title";
+ type: RECT;
+ repeat_events: 1;
+ description { state: "default" 0.0;
+ rel1.to: "title_bg";
+ rel2.to: "title_bg";
+ color: 0 0 0 0;
+ }
+ }
+ part { name: "elm.swallow.icon";
+ type: SWALLOW;
+ scale: 1;
+ clip_to: "title_clipper";
+ description { state: "default" 0.0;
+ max: 0 0;
+ fixed: 1 0;
+ align: 0.0 0.5;
+ rel1 { relative: 1.0 0.0; to: "title_left_padding"; }
+ rel2 { relative: 1.0 1.0; to: "title_left_padding"; }
+ visible: 0;
+ }
+ }
+ part { name: "badge_icon_left_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 0;
+ max: 0 -1;
+ fixed: 1 0;
+ align: 1.0 0.5;
+ rel1 { to_x: "badge_text_left_padding"; to_y: "title_bg"; relative: 0.0 0.0; }
+ rel2 { to_x: "badge_text_left_padding"; to_y: "title_bg"; relative: 0.0 1.0; }
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ min: TIZEN_VIEW_BADGE_ICON_LEFT_PADDING_WIDTH_INC 0;
+ max: TIZEN_VIEW_BADGE_ICON_LEFT_PADDING_WIDTH_INC -1;
+ }
+ }
+ part { name: "badge_icon";
+ type: IMAGE;
+ scale: 1;
+ mouse_events: 0;
+ clip_to: "title_clipper";
+ description { state: "default" 0.0;
+ min: 0 0;
+ max: 0 0;
+ fixed: 1 1;
+ rel1 { to_x: "badge_text_left_padding"; to_y: "title_badge"; }
+ rel2 { to_x: "badge_text_right_padding"; to_y: "title_badge"; }
+ color: 195 219 226 255;
+ image.normal: "images/core_icon_badge_container.#.png";
+ visible: 0;
+ }
+ description { state: "visible" 0.0;
+ rel1 { to_x: "badge_text_left_padding"; to_y: "title_badge"; }
+ rel2 { to_x: "badge_text_right_padding"; to_y: "title_badge"; }
+ color: 195 219 226 255;
+ image.normal: "images/core_icon_badge_container.#.png";
+ visible: 1;
+ }
+ }
+ part { name: "badge_text_left_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 0;
+ max: 0 -1;
+ fixed: 1 0;
+ align: 1.0 0.5;
+ rel1 { to_x: "title_badge"; to_y: "title_bg"; relative: 0.0 0.0; }
+ rel2 { to_x: "title_badge"; to_y: "title_bg"; relative: 0.0 1.0; }
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ min: TIZEN_VIEW_BADGE_TEXT_LEFT_PADDING_WIDTH_INC 0;
+ max: TIZEN_VIEW_BADGE_TEXT_LEFT_PADDING_WIDTH_INC -1;
+ }
+ }
+ part { name: "badge_text_right_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 0;
+ max: 0 -1;
+ fixed: 1 0;
+ align: 1.0 0.5;
+ rel1 { to_x: "title_right_padding"; to_y: "title_bg"; relative: 0.0 0.0; }
+ rel2 { to_x: "title_right_padding"; to_y: "title_bg"; relative: 0.0 1.0; }
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ min: TIZEN_VIEW_BADGE_TEXT_LEFT_PADDING_WIDTH_INC 0;
+ max: TIZEN_VIEW_BADGE_TEXT_LEFT_PADDING_WIDTH_INC -1;
+ }
+ }
+ part { name: "title_badge";
+ type: TEXT;
+ scale: 1;
+ mouse_events: 0;
+ clip_to: "title_clipper";
+ description { state: "default" 0.0;
+ text {
+ font: "Tizen:style=Regular"; size: "32";
+ text_class: "tizen";
+ min: 1 0;
+ max: 1 0;
+ align: 1.0 0.5;
+ ellipsis: -1;
+ }
+ color: 7 7 7 255;
+ min: 0 TIZEN_VIEW_BADGE_HEIGHT_INC;
+ max: -1 TIZEN_VIEW_BADGE_HEIGHT_INC;
+ fixed: 1 1;
+ align: 1.0 0.5;
+ rel1 { to_x: "badge_text_right_padding"; to_y: "elm.text.title"; relative: 0.0 0.0; }
+ rel2 { to_x: "badge_text_right_padding"; to_y: "elm.text.title"; relative: 0.0 1.0; }
+ }
+ }
+ part { name: "title_badge2";
+ type: TEXT;
+ scale: 1;
+ mouse_events: 0;
+ clip_to: "title_clipper";
+ description { state: "default" 0.0;
+ text {
+ font: "Tizen:style=Regular"; size: "32";
+ text_class: "tizen";
+ min: 1 0;
+ max: 1 0;
+ align: 0.0 0.5;
+ ellipsis: -1;
+ }
+ color: 7 7 7 255;
+ min: 0 TIZEN_VIEW_BADGE_HEIGHT_INC;
+ max: -1 TIZEN_VIEW_BADGE_HEIGHT_INC;
+ fixed: 1 1;
+ align: 0.0 0.5;
+ rel1 { to_x: "title_left_padding"; to_y: "elm.text.title"; relative: 1.0 0.0; }
+ rel2 { to_x: "title_left_padding"; to_y: "elm.text.title"; relative: 1.0 1.0; }
+ visible: 0;
+ }
+ }
+ part { name: "title_badge2_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 0;
+ max: 0 -1;
+ fixed: 1 0;
+ align: 0.0 0.5;
+ rel1 { to_x: "title_badge2"; to_y: "title_bg"; relative: 1.0 0.0; }
+ rel2 { to_x: "title_badge2"; to_y: "title_bg"; relative: 1.0 1.0; }
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ min: TIZEN_VIEW_BADGE2_PADDING_WIDTH_INC 0;
+ max: TIZEN_VIEW_BADGE2_PADDING_WIDTH_INC -1;
+ }
+ }
+ part { name: "title_left_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: TIZEN_VIEW_TITLE_LEFT_PADDING_WIDTH_INC 0;
+ max: TIZEN_VIEW_TITLE_LEFT_PADDING_WIDTH_INC -1;
+ fixed: 1 0;
+ align: 0.0 0.0;
+ rel1 { to: "title_bg"; relative: 0.0 0.0; }
+ rel2 { to: "title_bg"; relative: 0.0 1.0; }
+ }
+ description { state: "hidden" 0.0;
+ inherit: "default" 0.0;
+ min: 0 0;
+ max: 0 -1;
+ }
+ }
+ part { name: "title_left_btn_bg";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 0;
+ fixed: 1 0;
+ align: 0.0 0.5;
+ rel1 { to: "title_left_padding"; relative: 1.0 0.0; }
+ rel2 { to: "title_left_padding"; relative: 1.0 1.0; }
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ min: TIZEN_VIEW_TITLE_FUNC_BTN_SIZE_INC;
+ max: TIZEN_VIEW_TITLE_FUNC_BTN_SIZE_INC;
+ }
+ }
+ part { name: "title_left_btn";
+ type: SWALLOW;
+ scale: 1;
+ clip_to: "title_clipper";
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ rel1.to: "title_left_btn_bg";
+ rel2.to: "title_left_btn_bg";
+ visible: 0;
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part { name: "title_right_btn_bg";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 0;
+ fixed: 1 0;
+ align: 1.0 0.5;
+ rel1 { to: "title_right_padding"; relative: 0.0 0.0; }
+ rel2 { to: "title_right_padding"; relative: 0.0 1.0; }
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ min: TIZEN_VIEW_TITLE_FUNC_BTN_SIZE_INC;
+ max: TIZEN_VIEW_TITLE_FUNC_BTN_SIZE_INC;
+ }
+ }
+ part { name: "title_right_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: TIZEN_VIEW_TITLE_RIGHT_PADDING_WIDTH_INC 0;
+ max: TIZEN_VIEW_TITLE_RIGHT_PADDING_WIDTH_INC -1;
+ fixed: 1 0;
+ align: 1.0 0.0;
+ rel1 { to: "title_bg"; relative: 1.0 0.0; }
+ rel2 { to: "title_bg"; relative: 1.0 1.0; }
+ }
+ description { state: "hidden" 0.0;
+ inherit: "default" 0.0;
+ min: 0 0;
+ max: 0 -1;
+ }
+ }
+ part { name: "title_right_btn";
+ type: SWALLOW;
+ scale: 1;
+ clip_to: "title_clipper";
+ description { state: "default" 0.0;
+ fixed: 1 1;
+ rel1.to: "title_right_btn_bg";
+ rel2.to: "title_right_btn_bg";
+ visible: 0;
+ }
+ description { state: "visible" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part { name: "elm.swallow.content";
+ type: SWALLOW;
+ scale: 1;
+ repeat_events: 0;
+ clip_to: "content_clipper";
+ description { state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1 { to_x: "base"; to_y: "title_bg"; relative: 0.0 1.0; }
+ rel2.to: "base";
+ }
+ description { state: "toolbar" 0.0;
+ align: 0.0 0.0;
+ rel1 { to_x: "base"; to_y: "toolbar"; relative: 0.0 1.0; }
+ rel2.to: "base";
+
+ }
+ }
+ part { name: "content_clipper";
+ type: RECT;
+ mouse_events: 0;
+ clip_to: "clipper";
+ description { state: "default" 0.0;
+ rel1.to_y: "elm.swallow.content";
+ rel2.to_y: "elm.swallow.content";
+ }
+ }
+ part { name: "prev_btn_left_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: TIZEN_VIEW_BACK_BUTTON_LR_PADDING_WIDTH_INC 0;
+ max: TIZEN_VIEW_BACK_BUTTON_LR_PADDING_WIDTH_INC -1;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ rel1 { to: "title_bg"; relative: 0.0 0.0; }
+ rel2 { to: "title_bg"; relative: 0.0 1.0; }
+ }
+ }
+ part { name: "elm.swallow.prev_btn";
+ type: SWALLOW;
+ clip_to: "title_clipper";
+ scale: 1;
+ description { state: "default" 0.0;
+ min: BUTTON_TIZEN_VIEW_BACK_BUTTON_SIZE_INC;
+ max: BUTTON_TIZEN_VIEW_BACK_BUTTON_SIZE_INC;
+ align: 0.0 0.5;
+ fixed: 1 1;
+ rel1 { to: "prev_btn_left_padding"; relative: 1.0 0.0; }
+ rel2 { to: "prev_btn_left_padding"; relative: 1.0 1.0; }
+ visible: 1;
+ }
+ description { state: "hidden" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part { name: "prev_btn_title_right_padding";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: TIZEN_VIEW_BACK_BUTTON_TITLE_RIGHT_PADDING_WIDTH_INC 0;
+ max: TIZEN_VIEW_BACK_BUTTON_TITLE_RIGHT_PADDING_WIDTH_INC -1;
+ align: 1.0 0.0;
+ fixed: 1 1;
+ rel1 { to: "title_bg"; relative: 1.0 0.0; }
+ rel2 { to: "title_bg"; relative: 1.0 1.0; }
+ }
+ }
+ part { name: "toolbar_more_btn";
+ type: SWALLOW;
+ clip_to: "title_clipper";
+ description { state: "default" 0.0;
+ min: 0 0;
+ max: 0 0;
+ align: 0.0 0.0;
+ fixed: 1 1;
+ rel1.to: "base";
+ rel2.to: "base";
+ visible: 0;
+ }
+ }
+ }
+ programs {
+ program { name: "visible";
+ signal: "elm,state,visible";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "clipper";
+ }
+ program { name: "invisible";
+ signal: "elm,state,invisible";
+ source: "elm";
+ action: STATE_SET "hidden" 0.0;
+ target: "clipper";
+ }
+ program { name: "title_show";
+ signal: "elm,state,title,show";
+ source: "elm";
+ script {
+ set_state(PART:"title_bg", "default", 0.0);
+ set_state(PART:"title_clipper", "default", 0.0);
+ if (get_int(title_left_btn_visible)) {
+ set_state(PART:"title_left_padding", "hidden", 0.0);
+ set_state(PART:"title_left_btn_bg", "visible", 0.0);
+ set_state(PART:"title_left_btn", "visible", 0.0);
+ set_state(PART:"title_right_btn_bg", "visible", 0.0);
+ set_state(PART:"title_right_padding", "hidden", 0.0);
+ }
+ else if (get_int(prev_btn_visible)) {
+ set_state(PART:"elm.swallow.prev_btn", "default", 0.0);
+ set_state(PART:"title_text_left_padding", "prev_btn_visible", 0.0);
+ set_state(PART:"title_text_right_padding", "prev_btn_visible", 0.0);
+ }
+ if (get_int(title_right_btn_visible)) {
+ set_state(PART:"title_right_padding", "hidden", 0.0);
+ set_state(PART:"title_right_btn_bg", "visible", 0.0);
+ set_state(PART:"title_right_btn", "visible", 0.0);
+ set_state(PART:"title_left_btn_bg", "visible", 0.0);
+ set_state(PART:"title_left_padding", "hidden", 0.0);
+ if (get_int(prev_btn_visible) == 1){
+ set_state(PART:"title_text_left_padding", "default", 0.0);
+ set_state(PART:"title_text_right_padding", "default", 0.0);
+ }
+ }
+ if (get_int(toolbar_visible)) {
+ set_state(PART:"toolbar", "visible", 0.0);
+ set_state(PART:"toolbar_top_divider", "visible", 0.0);
+ set_state(PART:"elm.swallow.content", "toolbar", 0.0);
+ }
+
+ }
+ }
+ program { name: "title_hide";
+ signal: "elm,state,title,hide";
+ source: "elm";
+ script {
+ set_state(PART:"title_bg", "hidden", 0.0);
+ set_state(PART:"title_clipper", "hidden", 0.0);
+ set_state(PART:"title_left_padding", "default", 0.0);
+ set_state(PART:"title_left_btn_bg", "default", 0.0);
+ set_state(PART:"title_left_btn", "default", 0.0);
+ set_state(PART:"title_right_btn_bg", "default", 0.0);
+ set_state(PART:"title_right_padding", "default", 0.0);
+ set_state(PART:"title_right_btn", "default", 0.0);
+ set_state(PART:"elm.swallow.prev_btn", "hidden", 0.0);
+ if (get_int(prev_btn_visible) == 1){
+ set_state(PART:"title_text_left_padding", "prev_btn_visible", 0.0);
+ set_state(PART:"title_text_right_padding", "prev_btn_visible", 0.0);
+ }
+ set_state(PART:"toolbar", "default", 0.0);
+ set_state(PART:"toolbar_top_divider", "default", 0.0);
+ set_state(PART:"elm.swallow.content", "default", 0.0);
+ }
+ }
+ program { name: "toolbar_show";
+ signal: "elm,state,toolbar,show";
+ source: "elm";
+ script {
+ set_state(PART:"toolbar", "visible", 0.0);
+ set_state(PART:"toolbar_top_divider", "visible", 0.0);
+ set_state(PART:"elm.swallow.content", "toolbar", 0.0);
+ set_int(toolbar_visible, 1);
+ }
+ }
+ program { name: "toolbar_hide";
+ signal: "elm,state,toolbar,hide";
+ source: "elm";
+ script {
+ set_state(PART:"toolbar", "default", 0.0);
+ set_state(PART:"toolbar_top_divider", "default", 0.0);
+ set_state(PART:"elm.swallow.content", "default", 0.0);
+ set_int(toolbar_visible, 0);
+ }
+ }
+ program { name: "subtitle_show";
+ signal: "elm,state,subtitle,show";
+ source: "elm";
+ script {
+ set_state(PART:"elm.text.title", "subtitle_visible", 0.0);
+ }
+ }
+ program { name: "subtitle_hide";
+ signal: "elm,state,subtitle,hide";
+ source: "elm";
+ script {
+ set_state(PART:"elm.text.title", "default", 0.0);
+ }
+ }
+ program { name: "prev_btn_show";
+ signal: "elm,state,prev_btn,show";
+ source: "elm";
+ script {
+ set_int(prev_btn_visible, 1);
+ if (get_int(title_left_btn_visible) == 0) {
+ set_state(PART:"elm.swallow.prev_btn", "default", 0.0);
+ set_state(PART:"title_text_left_padding", "prev_btn_visible", 0.0);
+ set_state(PART:"title_text_right_padding", "prev_btn_visible", 0.0);
+ }
+ }
+ }
+ program { name: "prev_btn_hide";
+ signal: "elm,state,prev_btn,hide";
+ source: "elm";
+ script {
+ set_state(PART:"elm.swallow.prev_btn", "hidden", 0.0);
+ set_state(PART:"title_text_left_padding", "default", 0.0);
+ set_state(PART:"title_text_right_padding", "default", 0.0);
+ set_int(prev_btn_visible, 0);
+ }
+ }
+ program { name: "title_left_btn_show";
+ signal: "elm,state,title_left_btn,show";
+ source: "elm";
+ script {
+ set_state(PART:"title_left_padding", "hidden", 0.0);
+ set_state(PART:"title_left_btn_bg", "visible", 0.0);
+ set_state(PART:"title_left_btn", "visible", 0.0);
+ set_state(PART:"title_right_btn_bg", "visible", 0.0);
+ set_state(PART:"title_right_padding", "hidden", 0.0);
+ set_state(PART:"elm.swallow.prev_btn", "hidden", 0.0);
+ set_state(PART:"title_text_left_padding", "default", 0.0);
+ set_state(PART:"title_text_right_padding", "default", 0.0);
+ set_int(title_left_btn_visible, 1);
+ }
+ }
+ program { name: "title_left_btn_hide";
+ signal: "elm,state,title_left_btn,hide";
+ source: "elm";
+ script {
+ set_state(PART:"title_left_padding", "default", 0.0);
+ set_state(PART:"title_left_btn_bg", "default", 0.0);
+ set_state(PART:"title_left_btn", "default", 0.0);
+ set_state(PART:"title_right_padding", "default", 0.0);
+ set_state(PART:"title_right_btn_bg", "default", 0.0);
+ set_int(title_left_btn_visible, 0);
+ if (get_int(prev_btn_visible) == 1) {
+ set_state(PART:"elm.swallow.prev_btn", "default", 0.0);
+ set_state(PART:"title_text_left_padding", "prev_btn_visible", 0.0);
+ set_state(PART:"title_text_right_padding", "prev_btn_visible", 0.0);
+ }
+ }
+ }
+ program { name: "title_right_btn_show";
+ signal: "elm,state,title_right_btn,show";
+ source: "elm";
+ script {
+ set_state(PART:"title_right_padding", "hidden", 0.0);
+ set_state(PART:"title_right_btn_bg", "visible", 0.0);
+ set_state(PART:"title_right_btn", "visible", 0.0);
+ set_state(PART:"title_left_btn_bg", "visible", 0.0);
+ set_state(PART:"title_left_padding", "hidden", 0.0);
+ if (get_int(prev_btn_visible) == 1){
+ set_state(PART:"title_text_left_padding", "default", 0.0);
+ set_state(PART:"title_text_right_padding", "default", 0.0);
+ }
+ set_int(title_right_btn_visible, 1);
+ }
+ }
+ program { name: "title_right_btn_hide";
+ signal: "elm,state,title_right_btn,hide";
+ source: "elm";
+ script {
+ set_state(PART:"title_right_padding", "default", 0.0);
+ set_state(PART:"title_right_btn_bg", "default", 0.0);
+ set_state(PART:"title_right_btn", "default", 0.0);
+ set_state(PART:"title_left_padding", "default", 0.0);
+ set_state(PART:"title_left_btn_bg", "default", 0.0);
+ set_int(title_right_btn_visible, 0);
+ if (get_int(prev_btn_visible) == 1){
+ set_state(PART:"title_text_left_padding", "prev_btn_visible", 0.0);
+ set_state(PART:"title_text_right_padding", "prev_btn_visible", 0.0);
+ }
+ }
+ }
+ program { name: "title_badge_show";
+ signal: "elm,state,title_badge,show";
+ source: "elm";
+ script {
+ new buf[128];
+
+ set_state(PART:"badge_text_left_padding", "visible", 0.0);
+ set_state(PART:"badge_text_right_padding", "visible", 0.0);
+ set_state(PART:"badge_icon", "visible", 0.0);
+ set_state(PART:"badge_icon_left_padding", "visible", 0.0);
+
+ get_text(PART:"title_badge", buf, 128);
+ set_text(PART:"title_badge2", buf);
+ set_state(PART:"title_badge2_padding", "visible", 0.0);
+ set_state(PART:"title_text_left_padding", "title_badge_visible", 0.0);
+ set_state(PART:"title_text_right_padding", "title_badge_visible", 0.0);
+ }
+ }
+ program { name: "title_badge_hide";
+ signal: "elm,state,title_badge,hide";
+ source: "elm";
+ script {
+ set_state(PART:"badge_text_left_padding", "default", 0.0);
+ set_state(PART:"badge_text_right_padding", "default", 0.0);
+ set_state(PART:"badge_icon", "default", 0.0);
+ set_state(PART:"badge_icon_left_padding", "default", 0.0);
+
+ set_text(PART:"title_badge2", "");
+ set_state(PART:"title_badge2_padding", "default", 0.0);
+ set_state(PART:"title_text_left_padding", "default", 0.0);
+ set_state(PART:"title_text_right_padding", "default", 0.0);
+ }
+ }
+ program { name: "title_clicked";
+ signal: "mouse,clicked,1";
+ source: "click_event_area";
+ script {
+ emit("elm,action,title,clicked", "");
+ }
+ }
+ program { name: "change_to_landscape";
+ script {
+ if (!get_int(landscape_mode)) {
+ set_int(landscape_mode, 1);
+ }
+ set_state(PART:"bg_img", "landscape", 0.0);
+ }
+ }
+ program { name: "change_to_portrait";
+ script {
+ if (get_int(landscape_mode)) {
+ set_int(landscape_mode, 0);
+ }
+ set_state(PART:"bg_img", "default", 0.0);
+ }
+ }
+ program { name: "landscape_mode";
+ source: "elm";
+ signal: "elm,state,orient,90";
+ after: "change_to_landscape";
+ }
+ program { name: "landscape_mode2";
+ source: "elm";
+ signal: "elm,state,orient,270";
+ after: "change_to_landscape";
+ }
+ program { name: "portrait_mode";
+ source: "elm";
+ signal: "elm,state,orient,0";
+ after: "change_to_portrait";
+ }
+ program { name: "portrait_mode2";
+ source: "elm";
+ signal: "elm,state,orient,180";
+ after: "change_to_portrait";
+ }
+ }
+ }
+}
+++ /dev/null
-(^( )*ui-viewmgr:).*
-ui viewmgr Shortcut Internal
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 <app.h>
-#include <system_settings.h>
-#include <dlog.h>
-#include "../src/efl/mobile/ui_viewmanager.h"
-
-//uncomment if you want debug
-#ifndef TIZEN_ENGINEER_MODE
-#define TIZEN_ENGINEER_MODE
-#endif
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "UI_VIEWMGR"
-
-#if !defined(PACKAGE)
-#define PACKAGE "org.tizen.ui-viewmgr"
-#endif
-
-using namespace efl_viewmgr;
-
-typedef struct appdata {
- ui_viewmgr *viewmgr;
-} appdata_s;
-
-Evas_Object *create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb, appdata_s *ad);
-Evas_Object *create_toolbar(Evas_Object *parent);
+++ /dev/null
-<manifest>
- <define>
- <domain name="org.tizen.ui-viewmgr"/>
- <request>
- <smack request="device::app_logging" type="rw"/>
- <smack request="device::sys_logging" type="rw"/>
- <smack request="pkgmgr::db" type="rl"/>
- <smack request="sdbd" type="rl"/>
- <smack request="tizen::vconf::setting::admin" type="rl"/>
- <smack request="system::homedir" type="rwx"/>
- <smack request="xorg" type="rw"/>
- <smack request="isf" type="rwx"/>
- <smack request="tizen::vconf::public::r" type="rwx" />
- <smack request="tizen::vconf::public::r::platform::rw" type="rwx" />
- <smack request="tizen::vconf::setting::admin" type="rwx" />
- <smack request="tizen::vconf::display" type="rwx" />
- </request>
- </define>
- <request>
- <domain name="org.tizen.ui-viewmgr"/>
- </request>
- <assign>
- <filesystem path="/usr/share/icons/default/small/org.tizen.ui-viewmgr.png" label="_"/>
- <filesystem path="/opt/usr/apps/org.tizen.ui-viewmgr/res/*" label="_"/>
- </assign>
-</manifest>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.ui-viewmgr" version="1.0.0" install-location="internal-only">
- <ui-application appid="org.tizen.ui-viewmgr" exec="/opt/usr/apps/org.tizen.ui-viewmgr/bin/ui-viewmgr" nodisplay="false" multiple="false" type="capp" taskmanage="true">
- <label>ui-viewmgr</label>
- <icon>org.tizen.ui-viewmgr.png</icon>
- <application-service>
- <mime name="ui-viewmgr.uri" />
- </application-service>
- </ui-application>
- <privileges>
- <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
- <privilege>http://tizen.org/privilege/appmanager.kill.bgapp</privilege>
- </privileges>
-</manifest>
+++ /dev/null
-Name: org.tizen.ui-viewmgr
-Summary: UI Viewmgr (Elementary)
-Version: 1.0.3
-Release: 1
-Group: TO_BE/FILLED_IN
-License: Apache License, Version 2.0
-Source0: %{name}-%{version}.tar.gz
-BuildRequires: pkgconfig(elementary)
-BuildRequires: pkgconfig(capi-appfw-application)
-BuildRequires: pkgconfig(capi-system-system-settings)
-BuildRequires: pkgconfig(capi-appfw-app-manager)
-BuildRequires: pkgconfig(dlog)
-BuildRequires: app-core-efl-devel
-BuildRequires: efl-extension-devel
-BuildRequires: cmake
-BuildRequires: edje-bin
-BuildRequires: gettext-tools
-
-%description
-UI Viewmgr (Elementary)
-
-%prep
-%setup -q
-
-%define prefix "/opt/usr/apps/org.tizen.ui-viewmgr"
-
-%build
-rm -rf CMakeFiles CMakeCache.txt && cmake . -DCMAKE_INSTALL_PREFIX=%{prefix}
-make %{?jobs:-j%jobs}
-
-%install
-%make_install
-
-mkdir -p %{buildroot}/%{_datadir}/packages/
-cp %{_builddir}/%{buildsubdir}/org.tizen.ui-viewmgr.xml %{buildroot}/%{_datadir}/packages/org.tizen.ui-viewmgr.xml
-
-mkdir -p %{buildroot}/%{_datadir}/license
-cp %{_builddir}/%{buildsubdir}/LICENSE %{buildroot}/%{_datadir}/license/%{name}
-
-%files
-%defattr(-,root,root,-)
-/opt/usr/apps/org.tizen.ui-viewmgr/bin/*
-/opt/usr/apps/org.tizen.ui-viewmgr/res/*
-%{_datadir}/packages/org.tizen.ui-viewmgr.xml
-%{_datadir}/icons/default/small/org.tizen.ui-viewmgr.png
-%{_datadir}/license/%{name}
-%manifest %{name}.manifest
--- /dev/null
+Name: ui-viewmgr
+Summary: UI VIEW MANAGER library
+Version: 0.1.1
+Release: 1
+Group: System/Libraries
+License: Apache License, Version 2.0
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-system-system-settings)
+BuildRequires: pkgconfig(capi-appfw-app-manager)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: app-core-efl-devel
+BuildRequires: efl-extension-devel
+BuildRequires: cmake
+BuildRequires: edje-bin
+BuildRequires: gettext-tools
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description
+UI VIEW MANAGER library
+
+%package example
+Summary: UI VIEW MANAGER Example Application
+Group: Development/Applications
+
+%description example
+UI VIEW MANAGER Example Application
+
+%package devel
+Summary: UI VIEW MANAGER library (devel)
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: capi-base-common-devel
+
+%description devel
+UI VIEW MANAGER library providing View management functionality(devel)
+
+%prep
+%setup -q
+
+%build
+cmake . -DCMAKE_INSTALL_PREFIX=/usr
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+mkdir -p %{buildroot}/usr/share/license
+cp %{_builddir}/%{buildsubdir}/LICENSE %{buildroot}/usr/share/license/%{name}
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/libui-viewmgr.so.*
+%manifest %{name}.manifest
+/usr/share/license/%{name}
+/usr/share/edje/ui-viewmgr/ui-viewmgr.edj
+
+%files example
+%defattr(-,root,root,-)
+/opt/usr/apps/ui-viewmgr/bin/*
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/ui-viewmgr/interface/*.h
+%{_includedir}/ui-viewmgr/efl/*.h
+%{_includedir}/ui-viewmgr/efl/mobile/*.h
+%{_includedir}/ui-viewmgr/*.h
+%{_libdir}/*.so
+%{_libdir}/pkgconfig/ui-viewmgr.pc
+++ /dev/null
-/*
- * Copyright (c) 2010 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define TIZEN_VIEW_BG_PORTRAIT_HEIGHT_INC 1280
-#define TIZEN_VIEW_BG_LANDSPACPE_HEIGHT_INC 720
-#define TIZEN_VIEW_TITLE_HEIGHT_INC 110
-#define TIZEN_VIEW_TITLE_TEXT_FONT_SIZE_INC 50
-#define TIZEN_VIEW_SUBTITLE_VISIBLE_TEXT_FONT_SIZE_INC 42
-#define TIZEN_VIEW_VISIBLE_TEXT_FONT_SIZE_INC 28
-#define TIZEN_VIEW_TITLE_TEXT_FONT_RANGE_INC 36 50
-#define TIZEN_VIEW_SUBTITLE_VISIBLE_TEXT_FONT_RANGE_INC 36 42
-#define TIZEN_VIEW_TITLE_TOP_PADDING_HEIGHT_INC 3
-#define TIZEN_VIEW_SUBTITLE_HEIGHT_INC 38
-#define TIZEN_VIEW_SUBTITLE_BOTTOM_PADDING_HEIGHT_INC 3
-#define TIZEN_VIEW_BADGE_ICON_LEFT_PADDING_WIDTH_INC 22
-#define TIZEN_VIEW_BADGE_TEXT_LEFT_PADDING_WIDTH_INC 22
-#define TIZEN_VIEW_BADGE_HEIGHT_INC 48
-#define TIZEN_VIEW_BADGE2_PADDING_WIDTH_INC (TIZEN_VIEW_BADGE_ICON_LEFT_PADDING_WIDTH_INC + TIZEN_VIEW_BADGE_TEXT_LEFT_PADDING_WIDTH_INC + TIZEN_VIEW_BADGE_TEXT_LEFT_PADDING_WIDTH_INC)
-#define TIZEN_VIEW_TITLE_LEFT_PADDING_WIDTH_INC 32
-#define TIZEN_VIEW_TITLE_FUNC_BTN_SIZE_INC 176 110
-#define TIZEN_VIEW_BACK_BUTTON_LR_PADDING_WIDTH_INC 10
-#define TIZEN_VIEW_BACK_BUTTON_TITLE_RIGHT_PADDING_WIDTH_INC 90
-#define BUTTON_TIZEN_VIEW_BACK_BUTTON_SIZE_INC 80 80
-#define TIZEN_VIEW_TITLE_RIGHT_PADDING_WIDTH_INC 32
-#define TIZEN_VIEW_TOOLBAR_TITLE_TOP_PADDING_HEIGHT_INC 80
-#define TIZEN_VIEW_TOOLBAR_TITLE_HEIGHT_INC 100
-#define TIZEN_VIEW_TOOLBAR_TITLE_CLIPPER_HEIGHT_INC 80
-#define TIZEN_VIEW_TOOLBAR_LIGHT_VIEW_HEIGHT_INC 86
-#define TIZEN_VIEW_TOOLBAR_TOP_DIVIDER_HEIGHT_INC 0
-
-collections {
- base_scale: 2.6;
- styles {
- style { name: "tizen_view_title_style";
- base: "font=Tizen:style=Condensed align=center font_size="TIZEN_VIEW_TITLE_TEXT_FONT_SIZE_INC" color=#FFFFFFFF wrap=none ellipsis=1.0 text_class=tizen";
- tag: "br" "\n";
- tag: "tab" "\t";
- }
- style { name: "tizen_view_subtitle_visible_style";
- base: "font=Tizen:style=Condensed align=center font_size="TIZEN_VIEW_SUBTITLE_VISIBLE_TEXT_FONT_SIZE_INC" color=#FFFFFFFF wrap=none ellipsis=1.0 text_class=tizen";
- tag: "br" "\n";
- tag: "tab" "\t";
- }
- style { name: "tizen_view_subtitle_style";
- base: "font=Tizen:style=Condensed align=center font_size="TIZEN_VIEW_VISIBLE_TEXT_FONT_SIZE_INC" color=#FFFFFFFF wrap=none ellipsis=1.0 text_class=tizen";
- tag: "br" "\n";
- tag: "tab" "\t";
- }
- }
-
- group { name: "elm/layout/tizen_view/default";
- images {
- image: "images/core_theme_bg_01.png" COMP;
- image: "images/core_icon_badge_container.#.png" COMP;
- }
- script {
- public landscape_mode = 0; //Landscape status
- public prev_btn_visible = 0; //Previous button visible status
- public title_left_btn_visible = 0; //Title left button visible status
- public title_right_btn_visible = 0; //Title right button visible status
- public toolbar_visible = 0; //Tabbar visible status (This value is used for toolbar group)
- }
- parts {
- part { name: "base";
- type: SPACER;
- description { state: "default" 0.0;
- }
- }
- part { name: "bg_img";
- type: IMAGE;
- scale: 1;
- mouse_events: 0;
- clip_to: "clipper";
- description { state: "default" 0.0;
- rel1.to: "base";
- rel2.to: "base";
- align: 0.5 0.0;
- fixed: 0 1;
- min: 0 TIZEN_VIEW_BG_PORTRAIT_HEIGHT_INC;
- image.normal: "images/core_theme_bg_01.png";
- }
- description { state: "landscape" 0.0;
- inherit: "default" 0.0;
- min: 0 TIZEN_VIEW_BG_LANDSPACPE_HEIGHT_INC;
- }
- }
- part { name: "clipper";
- type: RECT;
- mouse_events: 0;
- description { state: "default" 0.0;
- visible: 1;
- }
- description { state: "hidden" 0.0;
- visible: 0;
- }
- }
- part { name: "title_bg";
- type: RECT;
- scale: 1;
- mouse_events: 0;
- description { state: "default" 0.0;
- min: 0 TIZEN_VIEW_TITLE_HEIGHT_INC;
- max: -1 TIZEN_VIEW_TITLE_HEIGHT_INC;
- align: 0.0 0.0;
- fixed: 0 1;
- rel1 { to: "base"; relative: 0.0 0.0; }
- rel2 { to: "base"; relative: 1.0 0.0; }
- color: 61 185 204 255;
- }
- description { state: "hidden" 0.0;
- inherit: "default" 0.0;
- min: 0 0;
- max: -1 0;
- }
- }
- part { name: "toolbar_top_padding";
- type: SPACER;
- scale: 1;
- repeat_events: 1;
- description { state: "default" 0.0;
- min: 0 TIZEN_VIEW_TOOLBAR_TITLE_TOP_PADDING_HEIGHT_INC;
- max: -1 TIZEN_VIEW_TOOLBAR_TITLE_TOP_PADDING_HEIGHT_INC;
- fixed: 0 1;
- align: 0.5 0.0;
- rel1 { to: "title_bg"; relative: 0.0 0.0; }
- rel2 { to: "title_bg"; relative: 1.0 0.0; }
- }
- }
- part { name: "toolbar";
- type: SWALLOW;
- scale: 1;
- clip_to: "toolbar_clipper";
- description { state: "default" 0.0;
- min: 0 0;
- max: -1 0;
- fixed: 0 1;
- align: 0.5 0.0;
- rel1 { to: "toolbar_top_padding"; relative: 0.0 1.0; }
- rel2 { to: "toolbar_top_padding"; relative: 1.0 1.0; }
- visible: 0;
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- min: 0 TIZEN_VIEW_TOOLBAR_TITLE_HEIGHT_INC;
- max: -1 TIZEN_VIEW_TOOLBAR_TITLE_HEIGHT_INC;
- visible: 1;
- }
- }
- part { name: "toolbar_top_divider";
- type: RECT;
- scale: 1;
- mouse_events: 0;
- clip_to: "toolbar_clipper";
- description { state: "default" 0.0;
- min: 0 0;
- max: -1 0;
- fixed: 0 1;
- align: 0.5 0.0;
- rel1 { to: "toolbar_clipper"; relative: 0.0 0.0; }
- rel2 { to: "toolbar_clipper"; relative: 1.0 0.0; }
- color: 244 244 244 25;
- visible: 0;
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- min: 0 TIZEN_VIEW_TOOLBAR_TOP_DIVIDER_HEIGHT_INC;
- max: -1 TIZEN_VIEW_TOOLBAR_TOP_DIVIDER_HEIGHT_INC;
- visible: 1;
- }
- }
- part { name: "toolbar_clipper";
- type: RECT;
- scale: 1;
- mouse_events: 0;
- clip_to: "clipper";
- description { state: "default" 0.0;
- min: 0 TIZEN_VIEW_TOOLBAR_TITLE_CLIPPER_HEIGHT_INC;
- max: -1 TIZEN_VIEW_TOOLBAR_TITLE_CLIPPER_HEIGHT_INC;
- fixed: 0 1;
- align: 0.5 1.0;
- rel1 { to: "toolbar"; relative: 0.0 1.0; }
- rel2 { to: "toolbar"; relative: 1.0 1.0; }
- }
- }
- part { name: "title_clipper";
- type: RECT;
- mouse_events: 0;
- clip_to: "clipper";
- description { state: "default" 0.0;
- rel1.to_y: "title_bg";
- rel2.to_y: "title_bg";
- }
- description { state: "hidden" 0.0;
- inherit: "default" 0.0;
- visible: 0;
- }
- }
- part { name: "title_text_left_padding";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- rel1.to: "title_bg";
- rel2.to: "title_left_btn_bg";
- }
- description { state: "title_badge_visible" 0.0;
- rel1.to: "title_bg";
- rel2.to: "title_badge2_padding";
- }
- description { state: "prev_btn_visible" 0.0;
- rel1.to: "title_bg";
- rel2 { to_x: "elm.swallow.prev_btn"; to_y: "title_bg"; relative: 1.0 1.0; }
- }
- }
- part { name: "title_text_right_padding";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- rel1.to: "title_right_btn_bg";
- rel2.to: "title_bg";
- }
- description { state: "title_badge_visible" 0.0;
- rel1.to: "badge_icon_left_padding";
- rel2.to: "title_bg";
- }
- description { state: "prev_btn_visible" 0.0;
- rel1.to: "prev_btn_title_right_padding";
- rel2.to: "title_bg";
- }
- }
- part { name: "elm.text.title";
- type: TEXTBLOCK;
- scale: 1;
- mouse_events: 0;
- clip_to: "title_text_clipper";
- description { state: "default" 0.0;
- text {
- style: "tizen_view_title_style";
- size: TIZEN_VIEW_TITLE_TEXT_FONT_SIZE_INC;
- size_range: TIZEN_VIEW_TITLE_TEXT_FONT_RANGE_INC;
- fit: 1 0;
- }
- fixed: 1 1;
- rel1 { to_x: "title_text_left_padding"; to_y: "title_bg"; relative: 1.0 0.0; }
- rel2 { to_x: "title_text_right_padding"; to_y: "title_bg"; relative: 0.0 1.0; }
- }
- description { state: "subtitle_visible" 0.0;
- text {
- style: "tizen_view_subtitle_visible_style";
- size: TIZEN_VIEW_SUBTITLE_VISIBLE_TEXT_FONT_SIZE_INC;
- size_range: TIZEN_VIEW_SUBTITLE_VISIBLE_TEXT_FONT_RANGE_INC;
- fit: 1 0;
- }
- fixed: 1 1;
- rel1 { to_x: "title_text_left_padding"; to_y: "title_top_padding"; relative: 1.0 1.0; }
- rel2 { to_x: "title_text_right_padding"; to_y: "elm.text.subtitle"; relative: 0.0 0.0; }
- }
- }
- part { name: "title_text_clipper";
- type: RECT;
- mouse_events: 0;
- clip_to: "title_clipper";
- description { state: "default" 0.0;
- rel1.to: "elm.text.title";
- rel2.to: "elm.text.title";
- }
- }
- part { name: "title_top_padding";
- type: SPACER;
- description { state: "default" 0.0;
- min: 0 TIZEN_VIEW_TITLE_TOP_PADDING_HEIGHT_INC;
- max: -1 TIZEN_VIEW_TITLE_TOP_PADDING_HEIGHT_INC;
- fixed: 0 1;
- align: 0.5 0.0;
- rel1 { to: "title_bg"; relative: 0.0 0.0; }
- rel2 { to: "title_bg"; relative: 1.0 0.0; }
- }
- }
- part { name: "elm.text.subtitle";
- type: TEXTBLOCK;
- scale: 1;
- mouse_events: 0;
- description { state: "default" 0.0;
- text { style: "tizen_view_subtitle_style";}
- min: 0 TIZEN_VIEW_SUBTITLE_HEIGHT_INC;
- max: -1 TIZEN_VIEW_SUBTITLE_HEIGHT_INC;
- fixed: 1 1;
- align: 0.5 1.0;
- rel1 { to_x: "title_text_left_padding"; to_y: "subtitle_bottom_padding"; relative: 1.0 0.0; }
- rel2 { to_x: "title_text_right_padding"; to_y: "subtitle_bottom_padding"; relative: 0.0 0.0; }
- }
- }
- part { name: "subtitle_bottom_padding";
- type: SPACER;
- description { state: "default" 0.0;
- min: 0 TIZEN_VIEW_SUBTITLE_BOTTOM_PADDING_HEIGHT_INC;
- max: -1 TIZEN_VIEW_SUBTITLE_BOTTOM_PADDING_HEIGHT_INC;
- fixed: 0 1;
- align: 0.5 1.0;
- rel1 { to: "title_bg"; relative: 0.0 1.0; }
- rel2 { to: "title_bg"; relative: 1.0 1.0; }
- }
- }
- part { name: "click_event_area";
- type: RECT;
- ignore_flags: ON_HOLD;
- description { state: "default" 0.0;
- rel1.to: "title_bg";
- rel2.to: "title_bg";
- color: 0 0 0 0;
- }
- }
- part { name: "access.title";
- type: RECT;
- repeat_events: 1;
- description { state: "default" 0.0;
- rel1.to: "title_bg";
- rel2.to: "title_bg";
- color: 0 0 0 0;
- }
- }
- part { name: "elm.swallow.icon";
- type: SWALLOW;
- scale: 1;
- clip_to: "title_clipper";
- description { state: "default" 0.0;
- max: 0 0;
- fixed: 1 0;
- align: 0.0 0.5;
- rel1 { relative: 1.0 0.0; to: "title_left_padding"; }
- rel2 { relative: 1.0 1.0; to: "title_left_padding"; }
- visible: 0;
- }
- }
- part { name: "badge_icon_left_padding";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- min: 0 0;
- max: 0 -1;
- fixed: 1 0;
- align: 1.0 0.5;
- rel1 { to_x: "badge_text_left_padding"; to_y: "title_bg"; relative: 0.0 0.0; }
- rel2 { to_x: "badge_text_left_padding"; to_y: "title_bg"; relative: 0.0 1.0; }
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- min: TIZEN_VIEW_BADGE_ICON_LEFT_PADDING_WIDTH_INC 0;
- max: TIZEN_VIEW_BADGE_ICON_LEFT_PADDING_WIDTH_INC -1;
- }
- }
- part { name: "badge_icon";
- type: IMAGE;
- scale: 1;
- mouse_events: 0;
- clip_to: "title_clipper";
- description { state: "default" 0.0;
- min: 0 0;
- max: 0 0;
- fixed: 1 1;
- rel1 { to_x: "badge_text_left_padding"; to_y: "title_badge"; }
- rel2 { to_x: "badge_text_right_padding"; to_y: "title_badge"; }
- color: 195 219 226 255;
- image.normal: "images/core_icon_badge_container.#.png";
- visible: 0;
- }
- description { state: "visible" 0.0;
- rel1 { to_x: "badge_text_left_padding"; to_y: "title_badge"; }
- rel2 { to_x: "badge_text_right_padding"; to_y: "title_badge"; }
- color: 195 219 226 255;
- image.normal: "images/core_icon_badge_container.#.png";
- visible: 1;
- }
- }
- part { name: "badge_text_left_padding";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- min: 0 0;
- max: 0 -1;
- fixed: 1 0;
- align: 1.0 0.5;
- rel1 { to_x: "title_badge"; to_y: "title_bg"; relative: 0.0 0.0; }
- rel2 { to_x: "title_badge"; to_y: "title_bg"; relative: 0.0 1.0; }
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- min: TIZEN_VIEW_BADGE_TEXT_LEFT_PADDING_WIDTH_INC 0;
- max: TIZEN_VIEW_BADGE_TEXT_LEFT_PADDING_WIDTH_INC -1;
- }
- }
- part { name: "badge_text_right_padding";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- min: 0 0;
- max: 0 -1;
- fixed: 1 0;
- align: 1.0 0.5;
- rel1 { to_x: "title_right_padding"; to_y: "title_bg"; relative: 0.0 0.0; }
- rel2 { to_x: "title_right_padding"; to_y: "title_bg"; relative: 0.0 1.0; }
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- min: TIZEN_VIEW_BADGE_TEXT_LEFT_PADDING_WIDTH_INC 0;
- max: TIZEN_VIEW_BADGE_TEXT_LEFT_PADDING_WIDTH_INC -1;
- }
- }
- part { name: "title_badge";
- type: TEXT;
- scale: 1;
- mouse_events: 0;
- clip_to: "title_clipper";
- description { state: "default" 0.0;
- text {
- font: "Tizen:style=Regular"; size: "32";
- text_class: "tizen";
- min: 1 0;
- max: 1 0;
- align: 1.0 0.5;
- ellipsis: -1;
- }
- color: 7 7 7 255;
- min: 0 TIZEN_VIEW_BADGE_HEIGHT_INC;
- max: -1 TIZEN_VIEW_BADGE_HEIGHT_INC;
- fixed: 1 1;
- align: 1.0 0.5;
- rel1 { to_x: "badge_text_right_padding"; to_y: "elm.text.title"; relative: 0.0 0.0; }
- rel2 { to_x: "badge_text_right_padding"; to_y: "elm.text.title"; relative: 0.0 1.0; }
- }
- }
- part { name: "title_badge2";
- type: TEXT;
- scale: 1;
- mouse_events: 0;
- clip_to: "title_clipper";
- description { state: "default" 0.0;
- text {
- font: "Tizen:style=Regular"; size: "32";
- text_class: "tizen";
- min: 1 0;
- max: 1 0;
- align: 0.0 0.5;
- ellipsis: -1;
- }
- color: 7 7 7 255;
- min: 0 TIZEN_VIEW_BADGE_HEIGHT_INC;
- max: -1 TIZEN_VIEW_BADGE_HEIGHT_INC;
- fixed: 1 1;
- align: 0.0 0.5;
- rel1 { to_x: "title_left_padding"; to_y: "elm.text.title"; relative: 1.0 0.0; }
- rel2 { to_x: "title_left_padding"; to_y: "elm.text.title"; relative: 1.0 1.0; }
- visible: 0;
- }
- }
- part { name: "title_badge2_padding";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- min: 0 0;
- max: 0 -1;
- fixed: 1 0;
- align: 0.0 0.5;
- rel1 { to_x: "title_badge2"; to_y: "title_bg"; relative: 1.0 0.0; }
- rel2 { to_x: "title_badge2"; to_y: "title_bg"; relative: 1.0 1.0; }
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- min: TIZEN_VIEW_BADGE2_PADDING_WIDTH_INC 0;
- max: TIZEN_VIEW_BADGE2_PADDING_WIDTH_INC -1;
- }
- }
- part { name: "title_left_padding";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- min: TIZEN_VIEW_TITLE_LEFT_PADDING_WIDTH_INC 0;
- max: TIZEN_VIEW_TITLE_LEFT_PADDING_WIDTH_INC -1;
- fixed: 1 0;
- align: 0.0 0.0;
- rel1 { to: "title_bg"; relative: 0.0 0.0; }
- rel2 { to: "title_bg"; relative: 0.0 1.0; }
- }
- description { state: "hidden" 0.0;
- inherit: "default" 0.0;
- min: 0 0;
- max: 0 -1;
- }
- }
- part { name: "title_left_btn_bg";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- min: 0 0;
- fixed: 1 0;
- align: 0.0 0.5;
- rel1 { to: "title_left_padding"; relative: 1.0 0.0; }
- rel2 { to: "title_left_padding"; relative: 1.0 1.0; }
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- min: TIZEN_VIEW_TITLE_FUNC_BTN_SIZE_INC;
- max: TIZEN_VIEW_TITLE_FUNC_BTN_SIZE_INC;
- }
- }
- part { name: "title_left_btn";
- type: SWALLOW;
- scale: 1;
- clip_to: "title_clipper";
- description { state: "default" 0.0;
- fixed: 1 1;
- rel1.to: "title_left_btn_bg";
- rel2.to: "title_left_btn_bg";
- visible: 0;
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- }
- }
- part { name: "title_right_btn_bg";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- min: 0 0;
- fixed: 1 0;
- align: 1.0 0.5;
- rel1 { to: "title_right_padding"; relative: 0.0 0.0; }
- rel2 { to: "title_right_padding"; relative: 0.0 1.0; }
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- min: TIZEN_VIEW_TITLE_FUNC_BTN_SIZE_INC;
- max: TIZEN_VIEW_TITLE_FUNC_BTN_SIZE_INC;
- }
- }
- part { name: "title_right_padding";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- min: TIZEN_VIEW_TITLE_RIGHT_PADDING_WIDTH_INC 0;
- max: TIZEN_VIEW_TITLE_RIGHT_PADDING_WIDTH_INC -1;
- fixed: 1 0;
- align: 1.0 0.0;
- rel1 { to: "title_bg"; relative: 1.0 0.0; }
- rel2 { to: "title_bg"; relative: 1.0 1.0; }
- }
- description { state: "hidden" 0.0;
- inherit: "default" 0.0;
- min: 0 0;
- max: 0 -1;
- }
- }
- part { name: "title_right_btn";
- type: SWALLOW;
- scale: 1;
- clip_to: "title_clipper";
- description { state: "default" 0.0;
- fixed: 1 1;
- rel1.to: "title_right_btn_bg";
- rel2.to: "title_right_btn_bg";
- visible: 0;
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- }
- }
- part { name: "elm.swallow.content";
- type: SWALLOW;
- scale: 1;
- repeat_events: 0;
- clip_to: "content_clipper";
- description { state: "default" 0.0;
- align: 0.0 0.0;
- rel1 { to_x: "base"; to_y: "title_bg"; relative: 0.0 1.0; }
- rel2.to: "base";
- }
- description { state: "toolbar" 0.0;
- align: 0.0 0.0;
- rel1 { to_x: "base"; to_y: "toolbar"; relative: 0.0 1.0; }
- rel2.to: "base";
-
- }
- }
- part { name: "content_clipper";
- type: RECT;
- mouse_events: 0;
- clip_to: "clipper";
- description { state: "default" 0.0;
- rel1.to_y: "elm.swallow.content";
- rel2.to_y: "elm.swallow.content";
- }
- }
- part { name: "prev_btn_left_padding";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- min: TIZEN_VIEW_BACK_BUTTON_LR_PADDING_WIDTH_INC 0;
- max: TIZEN_VIEW_BACK_BUTTON_LR_PADDING_WIDTH_INC -1;
- align: 0.0 0.0;
- fixed: 1 1;
- rel1 { to: "title_bg"; relative: 0.0 0.0; }
- rel2 { to: "title_bg"; relative: 0.0 1.0; }
- }
- }
- part { name: "elm.swallow.prev_btn";
- type: SWALLOW;
- clip_to: "title_clipper";
- scale: 1;
- description { state: "default" 0.0;
- min: BUTTON_TIZEN_VIEW_BACK_BUTTON_SIZE_INC;
- max: BUTTON_TIZEN_VIEW_BACK_BUTTON_SIZE_INC;
- align: 0.0 0.5;
- fixed: 1 1;
- rel1 { to: "prev_btn_left_padding"; relative: 1.0 0.0; }
- rel2 { to: "prev_btn_left_padding"; relative: 1.0 1.0; }
- visible: 1;
- }
- description { state: "hidden" 0.0;
- inherit: "default" 0.0;
- visible: 0;
- }
- }
- part { name: "prev_btn_title_right_padding";
- type: SPACER;
- scale: 1;
- description { state: "default" 0.0;
- min: TIZEN_VIEW_BACK_BUTTON_TITLE_RIGHT_PADDING_WIDTH_INC 0;
- max: TIZEN_VIEW_BACK_BUTTON_TITLE_RIGHT_PADDING_WIDTH_INC -1;
- align: 1.0 0.0;
- fixed: 1 1;
- rel1 { to: "title_bg"; relative: 1.0 0.0; }
- rel2 { to: "title_bg"; relative: 1.0 1.0; }
- }
- }
- part { name: "toolbar_more_btn";
- type: SWALLOW;
- clip_to: "title_clipper";
- description { state: "default" 0.0;
- min: 0 0;
- max: 0 0;
- align: 0.0 0.0;
- fixed: 1 1;
- rel1.to: "base";
- rel2.to: "base";
- visible: 0;
- }
- }
- }
- programs {
- program { name: "visible";
- signal: "elm,state,visible";
- source: "elm";
- action: STATE_SET "default" 0.0;
- target: "clipper";
- }
- program { name: "invisible";
- signal: "elm,state,invisible";
- source: "elm";
- action: STATE_SET "hidden" 0.0;
- target: "clipper";
- }
- program { name: "title_show";
- signal: "elm,state,title,show";
- source: "elm";
- script {
- set_state(PART:"title_bg", "default", 0.0);
- set_state(PART:"title_clipper", "default", 0.0);
- if (get_int(title_left_btn_visible)) {
- set_state(PART:"title_left_padding", "hidden", 0.0);
- set_state(PART:"title_left_btn_bg", "visible", 0.0);
- set_state(PART:"title_left_btn", "visible", 0.0);
- set_state(PART:"title_right_btn_bg", "visible", 0.0);
- set_state(PART:"title_right_padding", "hidden", 0.0);
- }
- else if (get_int(prev_btn_visible)) {
- set_state(PART:"elm.swallow.prev_btn", "default", 0.0);
- set_state(PART:"title_text_left_padding", "prev_btn_visible", 0.0);
- set_state(PART:"title_text_right_padding", "prev_btn_visible", 0.0);
- }
- if (get_int(title_right_btn_visible)) {
- set_state(PART:"title_right_padding", "hidden", 0.0);
- set_state(PART:"title_right_btn_bg", "visible", 0.0);
- set_state(PART:"title_right_btn", "visible", 0.0);
- set_state(PART:"title_left_btn_bg", "visible", 0.0);
- set_state(PART:"title_left_padding", "hidden", 0.0);
- if (get_int(prev_btn_visible) == 1){
- set_state(PART:"title_text_left_padding", "default", 0.0);
- set_state(PART:"title_text_right_padding", "default", 0.0);
- }
- }
- if (get_int(toolbar_visible)) {
- set_state(PART:"toolbar", "visible", 0.0);
- set_state(PART:"toolbar_top_divider", "visible", 0.0);
- set_state(PART:"elm.swallow.content", "toolbar", 0.0);
- }
-
- }
- }
- program { name: "title_hide";
- signal: "elm,state,title,hide";
- source: "elm";
- script {
- set_state(PART:"title_bg", "hidden", 0.0);
- set_state(PART:"title_clipper", "hidden", 0.0);
- set_state(PART:"title_left_padding", "default", 0.0);
- set_state(PART:"title_left_btn_bg", "default", 0.0);
- set_state(PART:"title_left_btn", "default", 0.0);
- set_state(PART:"title_right_btn_bg", "default", 0.0);
- set_state(PART:"title_right_padding", "default", 0.0);
- set_state(PART:"title_right_btn", "default", 0.0);
- set_state(PART:"elm.swallow.prev_btn", "hidden", 0.0);
- if (get_int(prev_btn_visible) == 1){
- set_state(PART:"title_text_left_padding", "prev_btn_visible", 0.0);
- set_state(PART:"title_text_right_padding", "prev_btn_visible", 0.0);
- }
- set_state(PART:"toolbar", "default", 0.0);
- set_state(PART:"toolbar_top_divider", "default", 0.0);
- set_state(PART:"elm.swallow.content", "default", 0.0);
- }
- }
- program { name: "toolbar_show";
- signal: "elm,state,toolbar,show";
- source: "elm";
- script {
- set_state(PART:"toolbar", "visible", 0.0);
- set_state(PART:"toolbar_top_divider", "visible", 0.0);
- set_state(PART:"elm.swallow.content", "toolbar", 0.0);
- set_int(toolbar_visible, 1);
- }
- }
- program { name: "toolbar_hide";
- signal: "elm,state,toolbar,hide";
- source: "elm";
- script {
- set_state(PART:"toolbar", "default", 0.0);
- set_state(PART:"toolbar_top_divider", "default", 0.0);
- set_state(PART:"elm.swallow.content", "default", 0.0);
- set_int(toolbar_visible, 0);
- }
- }
- program { name: "subtitle_show";
- signal: "elm,state,subtitle,show";
- source: "elm";
- script {
- set_state(PART:"elm.text.title", "subtitle_visible", 0.0);
- }
- }
- program { name: "subtitle_hide";
- signal: "elm,state,subtitle,hide";
- source: "elm";
- script {
- set_state(PART:"elm.text.title", "default", 0.0);
- }
- }
- program { name: "prev_btn_show";
- signal: "elm,state,prev_btn,show";
- source: "elm";
- script {
- set_int(prev_btn_visible, 1);
- if (get_int(title_left_btn_visible) == 0) {
- set_state(PART:"elm.swallow.prev_btn", "default", 0.0);
- set_state(PART:"title_text_left_padding", "prev_btn_visible", 0.0);
- set_state(PART:"title_text_right_padding", "prev_btn_visible", 0.0);
- }
- }
- }
- program { name: "prev_btn_hide";
- signal: "elm,state,prev_btn,hide";
- source: "elm";
- script {
- set_state(PART:"elm.swallow.prev_btn", "hidden", 0.0);
- set_state(PART:"title_text_left_padding", "default", 0.0);
- set_state(PART:"title_text_right_padding", "default", 0.0);
- set_int(prev_btn_visible, 0);
- }
- }
- program { name: "title_left_btn_show";
- signal: "elm,state,title_left_btn,show";
- source: "elm";
- script {
- set_state(PART:"title_left_padding", "hidden", 0.0);
- set_state(PART:"title_left_btn_bg", "visible", 0.0);
- set_state(PART:"title_left_btn", "visible", 0.0);
- set_state(PART:"title_right_btn_bg", "visible", 0.0);
- set_state(PART:"title_right_padding", "hidden", 0.0);
- set_state(PART:"elm.swallow.prev_btn", "hidden", 0.0);
- set_state(PART:"title_text_left_padding", "default", 0.0);
- set_state(PART:"title_text_right_padding", "default", 0.0);
- set_int(title_left_btn_visible, 1);
- }
- }
- program { name: "title_left_btn_hide";
- signal: "elm,state,title_left_btn,hide";
- source: "elm";
- script {
- set_state(PART:"title_left_padding", "default", 0.0);
- set_state(PART:"title_left_btn_bg", "default", 0.0);
- set_state(PART:"title_left_btn", "default", 0.0);
- set_state(PART:"title_right_padding", "default", 0.0);
- set_state(PART:"title_right_btn_bg", "default", 0.0);
- set_int(title_left_btn_visible, 0);
- if (get_int(prev_btn_visible) == 1) {
- set_state(PART:"elm.swallow.prev_btn", "default", 0.0);
- set_state(PART:"title_text_left_padding", "prev_btn_visible", 0.0);
- set_state(PART:"title_text_right_padding", "prev_btn_visible", 0.0);
- }
- }
- }
- program { name: "title_right_btn_show";
- signal: "elm,state,title_right_btn,show";
- source: "elm";
- script {
- set_state(PART:"title_right_padding", "hidden", 0.0);
- set_state(PART:"title_right_btn_bg", "visible", 0.0);
- set_state(PART:"title_right_btn", "visible", 0.0);
- set_state(PART:"title_left_btn_bg", "visible", 0.0);
- set_state(PART:"title_left_padding", "hidden", 0.0);
- if (get_int(prev_btn_visible) == 1){
- set_state(PART:"title_text_left_padding", "default", 0.0);
- set_state(PART:"title_text_right_padding", "default", 0.0);
- }
- set_int(title_right_btn_visible, 1);
- }
- }
- program { name: "title_right_btn_hide";
- signal: "elm,state,title_right_btn,hide";
- source: "elm";
- script {
- set_state(PART:"title_right_padding", "default", 0.0);
- set_state(PART:"title_right_btn_bg", "default", 0.0);
- set_state(PART:"title_right_btn", "default", 0.0);
- set_state(PART:"title_left_padding", "default", 0.0);
- set_state(PART:"title_left_btn_bg", "default", 0.0);
- set_int(title_right_btn_visible, 0);
- if (get_int(prev_btn_visible) == 1){
- set_state(PART:"title_text_left_padding", "prev_btn_visible", 0.0);
- set_state(PART:"title_text_right_padding", "prev_btn_visible", 0.0);
- }
- }
- }
- program { name: "title_badge_show";
- signal: "elm,state,title_badge,show";
- source: "elm";
- script {
- new buf[128];
-
- set_state(PART:"badge_text_left_padding", "visible", 0.0);
- set_state(PART:"badge_text_right_padding", "visible", 0.0);
- set_state(PART:"badge_icon", "visible", 0.0);
- set_state(PART:"badge_icon_left_padding", "visible", 0.0);
-
- get_text(PART:"title_badge", buf, 128);
- set_text(PART:"title_badge2", buf);
- set_state(PART:"title_badge2_padding", "visible", 0.0);
- set_state(PART:"title_text_left_padding", "title_badge_visible", 0.0);
- set_state(PART:"title_text_right_padding", "title_badge_visible", 0.0);
- }
- }
- program { name: "title_badge_hide";
- signal: "elm,state,title_badge,hide";
- source: "elm";
- script {
- set_state(PART:"badge_text_left_padding", "default", 0.0);
- set_state(PART:"badge_text_right_padding", "default", 0.0);
- set_state(PART:"badge_icon", "default", 0.0);
- set_state(PART:"badge_icon_left_padding", "default", 0.0);
-
- set_text(PART:"title_badge2", "");
- set_state(PART:"title_badge2_padding", "default", 0.0);
- set_state(PART:"title_text_left_padding", "default", 0.0);
- set_state(PART:"title_text_right_padding", "default", 0.0);
- }
- }
- program { name: "title_clicked";
- signal: "mouse,clicked,1";
- source: "click_event_area";
- script {
- emit("elm,action,title,clicked", "");
- }
- }
- program { name: "change_to_landscape";
- script {
- if (!get_int(landscape_mode)) {
- set_int(landscape_mode, 1);
- }
- set_state(PART:"bg_img", "landscape", 0.0);
- }
- }
- program { name: "change_to_portrait";
- script {
- if (get_int(landscape_mode)) {
- set_int(landscape_mode, 0);
- }
- set_state(PART:"bg_img", "default", 0.0);
- }
- }
- program { name: "landscape_mode";
- source: "elm";
- signal: "elm,state,orient,90";
- after: "change_to_landscape";
- }
- program { name: "landscape_mode2";
- source: "elm";
- signal: "elm,state,orient,270";
- after: "change_to_landscape";
- }
- program { name: "portrait_mode";
- source: "elm";
- signal: "elm,state,orient,0";
- after: "change_to_portrait";
- }
- program { name: "portrait_mode2";
- source: "elm";
- signal: "elm,state,orient,180";
- after: "change_to_portrait";
- }
- }
- }
-}
--- /dev/null
+SET(LIB_NAME ${PROJECT_NAME})
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/lib)
+
+ADD_SUBDIRECTORY(include)
+ADD_SUBDIRECTORY(lib)
+ADD_SUBDIRECTORY(examples/efl)
+
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 "main.h"
-#include "page6.h"
-#include "page5.h"
-#include "page4.h"
-#include "page3.h"
-#include "page2.h"
-#include "page1.h"
-
-
-Evas_Object*
-create_toolbar(Evas_Object *parent)
-{
- Evas_Object *toolbar;
-
- toolbar = elm_toolbar_add(parent);
-
- //FIXME: :( UI_View can set this style instead.
- elm_object_style_set(toolbar, "toolbar_with_title");
- elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND);
- elm_toolbar_transverse_expanded_set(toolbar, EINA_TRUE);
-
- elm_toolbar_item_append(toolbar, NULL, "Tab1", NULL, NULL);
- elm_toolbar_item_append(toolbar, NULL, "Tab2", NULL, NULL);
-
- elm_toolbar_select_mode_set(toolbar, ELM_OBJECT_SELECT_MODE_ALWAYS);
-
- return toolbar;
-}
-
-Evas_Object*
-create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb, appdata_s *ad)
-{
- Evas_Object *grid, *box, *layout, *scroller, *btn, *button_layout;
-
- /* Scroller */
- scroller = elm_scroller_add(parent);
- elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE);
- elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
-
- /* Grid */
- grid = elm_grid_add(scroller);
- evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_show(grid);
-
- /* NoContent Layout */
- layout = elm_layout_add(grid);
- elm_layout_theme_set(layout, "layout", "nocontents", "default");
- elm_object_part_text_set(layout, "elm.text", text);
- evas_object_show(layout);
- elm_grid_pack(grid, layout, 0, 0, 100, 100);
-
- /* Box */
- box = elm_box_add(grid);
- elm_box_horizontal_set(box, EINA_TRUE);
- evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_box_padding_set(box, ELM_SCALE_SIZE(50), 0);
- evas_object_show(box);
- elm_grid_pack(grid, box, 0, 0, 100, 100);
-
- /* Previous Page Button */
- btn = elm_button_add(grid);
- evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 1.0);
- elm_object_text_set(btn, "Prev");
- evas_object_smart_callback_add(btn, "clicked", prev_btn_clicked_cb, ad);
- evas_object_show(btn);
- elm_box_pack_end(box, btn);
-
- /* Next Page Button */
- btn = elm_button_add(grid);
- evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 1.0);
- elm_object_text_set(btn, "Next");
- evas_object_smart_callback_add(btn, "clicked", next_btn_clicked_cb, ad);
- evas_object_show(btn);
- elm_box_pack_end(box, btn);
-
- elm_object_content_set(scroller, grid);
-
- return scroller;
-}
-
-static void create_base_gui(appdata_s *ad)
-{
- //FIXME: Hide this creation.
- ad->viewmgr = new ui_basic_viewmgr(PACKAGE);
-
- create_page1(ad);
-
- ad->viewmgr->activate();
-}
-
-static bool app_create(void *data)
-{
- /* Hook to take necessary actions before main event loop starts
- Initialize UI resources and application's data
- If this function returns true, the main loop of application starts
- If this function returns false, the application is terminated */
- appdata_s *ad = (appdata_s *) data;
-
- elm_app_base_scale_set(2.6);
-
- /* Bind package locale file */
- bindtextdomain(PACKAGE, LOCALE_DIR);
- textdomain(PACKAGE);
-
- create_base_gui(ad);
-
- return true;
-}
-
-static void app_control(app_control_h app_control, void *data)
-{
- /* Handle the launch request. */
-}
-
-static void app_pause(void *data)
-{
-}
-
-static void app_resume(void *data)
-{
- appdata_s *ad = (appdata_s *) data;
- ad->viewmgr->activate();
-}
-
-static void app_terminate(void *data)
-{
-}
-
-static void ui_app_lang_changed(app_event_info_h event_info, void *user_data)
-{
- /*APP_EVENT_LANGUAGE_CHANGED*/
- char *locale = NULL;
- system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
- elm_language_set(locale);
- free(locale);
-
- return;
-}
-
-static void ui_app_orient_changed(app_event_info_h event_info, void *user_data)
-{
- /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
- return;
-}
-
-static void ui_app_region_changed(app_event_info_h event_info, void *user_data)
-{
- /*APP_EVENT_REGION_FORMAT_CHANGED*/
-}
-
-static void ui_app_low_battery(app_event_info_h event_info, void *user_data)
-{
- /*APP_EVENT_LOW_BATTERY*/
-}
-
-static void ui_app_low_memory(app_event_info_h event_info, void *user_data)
-{
- /*APP_EVENT_LOW_MEMORY*/
-}
-
-int main(int argc, char *argv[])
-{
- appdata_s ad = { 0, };
- int ret = 0;
-
- ui_app_lifecycle_callback_s event_callback = { 0, };
- app_event_handler_h handlers[5] = { NULL, };
-
- event_callback.create = app_create;
- event_callback.terminate = app_terminate;
- event_callback.pause = app_pause;
- event_callback.resume = app_resume;
- event_callback.app_control = app_control;
-
- ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
- ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
- ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
- ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
- ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed,
- &ad);
- ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);
-
- ret = ui_app_main(argc, argv, &event_callback, &ad);
- if (ret != APP_ERROR_NONE)
- {
- dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
- }
-
- return ret;
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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.
- *
- */
-class page1: public ui_basic_controller
-{
-private:
- appdata_s *ad;
-
-public:
- page1(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()
- {
- }
-
- void load()
- {
- //Initialize contents.
-
- 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 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);
- create_page2(ad);
- },
- this->ad);
-
- view->set_content(content, "Title");
- }
-
- bool menu()
- {
- LOGE("Menu!");
- return true;
- }
-};
-
-void create_page1(appdata_s *ad)
-{
- new page1(ad);
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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.
- *
- */
-class page2: public ui_basic_controller
-{
-private:
- appdata_s *ad;
-
-public:
- page2(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()
- {
- }
-
- void load()
- {
- //Initialize contents.
- 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 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);
- create_page3(ad);
- },
- this->ad);
-
- //Title left button
- Evas_Object *left_title_btn = elm_button_add(view->get_base());
- elm_object_text_set(left_title_btn, "Cancel");
-
- //Title right button
- Evas_Object *right_title_btn = elm_button_add(view->get_base());
- elm_object_text_set(right_title_btn, "Done");
-
- //Arguments: content, title, subtitle, title left button, title right button
- view->set_content(content, "Title Buttons", NULL, left_title_btn, right_title_btn);
- }
-};
-
-void create_page2(appdata_s *ad)
-{
- new page2(ad);
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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.
- *
- */
-class page3: public ui_basic_controller
-{
-private:
- appdata_s *ad;
-
-public:
- page3(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"));
- }
-
- ~page3()
- {
- }
-
- void load()
- {
- //Initialize contents.
-
- 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 3",
- //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);
- create_page4(ad);
- },
- this->ad);
-
- //Arguments: content, title, subtitle, title left button, title right button
- view->set_content(content, "Title", "Subtitle", NULL, NULL);
- }
-};
-
-void create_page3(appdata_s *ad)
-{
- new page3(ad);
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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.
- *
- */
-class page4: public ui_basic_controller
-{
-private:
- appdata_s *ad;
-
-public:
- page4(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"));
- }
-
- ~page4()
- {
- }
-
- void load()
- {
- //Initialize contents.
-
- 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 4",
- //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);
- create_page5(ad);
- },
- this->ad);
-
- //Arguments: content, title
- view->set_content(content, "TitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitle");
- view->set_title_badge("999+");
- }
-};
-
-void create_page4(appdata_s *ad)
-{
- new page4(ad);
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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.
- *
- */
-class page5: public ui_basic_controller
-{
-private:
- appdata_s *ad;
-
-public:
- page5(appdata_s *ad)
- : ad(ad)
- {
- //No basic form.
- /* ui_view(controller, identity name).
- Later, you could get the identity name using view->get_name(); */
- ad->viewmgr->push_view(new ui_view(this, "page5"));
- }
-
- ~page5()
- {
- }
-
- void load()
- {
- //Initialize contents.
-
- 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>(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);
- create_page6(ad);
- },
- this->ad);
-
- view->set_content(content);
- view->set_indicator(UI_VIEW_INDICATOR_HIDE);
- }
-};
-
-void create_page5(appdata_s *ad)
-{
- new page5(ad);
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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.
- *
- */
-class page6: public ui_basic_controller
-{
-private:
- appdata_s *ad;
-
-public:
- page6(appdata_s *ad)
- : ad(ad)
- {
- /* ui_basic_view(controller, identity name, style name of view).
- Later, you could get the identity name using view->get_name();
- you could get the style name of view as well */
- ad->viewmgr->push_view(new ui_basic_view(this, "page6"));
- }
-
- ~page6()
- {
- }
-
- void load()
- {
-
- //Initialize contents.
-
- 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 6<br>With Tabar",
- //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);
-
- //Arguments: content, title
- view->set_content(content, "Title with toolbar");
- Evas_Object *toolbar = create_toolbar(view->get_base());
- view->set_toolbar(toolbar);
- }
-};
-
-void create_page6(appdata_s *ad)
-{
- new page6(ad);
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 "ui_viewmanager.h"
-
-using namespace efl_viewmgr;
-using namespace viewmgr;
-
-ui_basic_controller::~ui_basic_controller()
-{
-}
-
-bool ui_basic_controller::menu()
-{
- return true;
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 UI_BASIC_CONTROLLER_H
-#define UI_BASIC_CONTROLLER_H
-
-#include "../ui_viewmanager.h"
-
-namespace efl_viewmgr
-{
-class ui_basic_controller: public ui_controller
-{
-public:
- virtual ~ui_basic_controller();
- virtual bool menu();
-};
-}
-
-#endif /* UI_BASIC_CONTROLLER_H */
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 "ui_viewmanager.h"
-
-using namespace efl_viewmgr;
-using namespace viewmgr;
-
-static const char *KEY_MENU = "XF86Menu";
-
-enum ui_key_event_type
-{
- UI_KEY_EVENT_MENU
-};
-
-ui_basic_key_listener::ui_basic_key_listener(ui_viewmgr *viewmgr)
- : ui_key_listener(viewmgr)
-{
-}
-
-void ui_basic_key_listener::extend_event_proc(ui_view *view, Evas_Event_Key_Down *ev)
-{
- if (strcmp(ev->keyname, KEY_MENU)) return;
- dynamic_cast<ui_basic_view *>(view)->menu();
-}
-
-bool ui_basic_key_listener::init()
-{
- if (!ui_key_listener::init()) return false;
-
- if (!evas_object_key_grab(this->key_grabber, KEY_MENU, 0, 0, EINA_FALSE))
- {
- LOGE("Failed to grab MENU KEY(%s)\n", KEY_MENU);
- return false;
- }
- return true;
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 MOBILE_KEY_HANDLER_H
-#define MOBILE_KEY_HANDLER_H
-
-#include "../ui_viewmanager.h"
-
-namespace efl_viewmgr
-{
-class ui_viewmgr;
-
-class ui_basic_key_listener : public ui_key_listener
-{
-public:
- ui_basic_key_listener(ui_viewmgr *viewmgr);
-
- virtual bool init();
- virtual void extend_event_proc(ui_view *view, Evas_Event_Key_Down *ev);
-};
-
-}
-
-#endif /* MOBILE_KEY_HANDLER_H */
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 "ui_viewmanager.h"
-
-//FIXME: is it correct to define here?
-#define EDJ_PATH "/opt/usr/apps/org.tizen.ui-viewmgr/res/ui-viewmgr.edj"
-#define GROUP "elm/layout/tizen_view/default"
-#define TOOLBAR "elm/layout/tizen_view/toolbar"
-
-using namespace efl_viewmgr;
-using namespace viewmgr;
-
-bool ui_basic_view::destroy_layout()
-{
- if (!this->layout) return false;
- evas_object_del(this->layout);
- this->layout = NULL;
-
- return true;
-}
-
-bool ui_basic_view::create_layout()
-{
- if (this->layout) return false;
-
- Evas_Object *layout = elm_layout_add(this->get_parent());
-
- if (!layout)
- {
- LOGE("Failed to create a layout = ui_basic_view(%p)", this);
- return false;
- }
-
- if (!elm_layout_file_set(layout, EDJ_PATH, GROUP))
- {
- LOGE("Failed to set file = ui_basic_view(%p), path(%s), group(%s)", this, EDJ_PATH, GROUP);
- evas_object_del(layout);
- return false;
- }
- 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);
-
- if (this->get_content())
- {
- elm_object_part_content_set(layout, "elm.swallow.content", CONVERT_TO_EO(this->get_content()));
- }
-
- //Set software back key, if it's needed
- ui_viewmgr *viewmgr = dynamic_cast<ui_viewmgr *>(ui_iface_view::get_viewmgr());
- if (viewmgr->need_soft_key())
- {
- Evas_Object *prev_btn = elm_button_add(layout);
-
- if (!prev_btn)
- {
- LOGE("Failed to create a button = ui_basic_view(%p)", this);
- }
- else
- {
- evas_object_smart_callback_add(prev_btn, "clicked", [](void *data, Evas_Object *obj, void *event_info) -> void
- {
- ui_viewmgr *viewmgr = static_cast<ui_viewmgr *>(data);
- viewmgr->pop_view();
- }, viewmgr);
-
- elm_object_style_set(prev_btn, "tizen_view/prev_btn");
- elm_object_part_content_set(layout, "elm.swallow.prev_btn", prev_btn);
- elm_object_signal_emit(layout, "elm,state,prev_btn,show", "elm");
- }
- }
-
- this->layout = layout;
-
- return true;
-}
-
-ui_basic_view::ui_basic_view(ui_controller *controller, const char *name)
- : ui_view(controller, name), layout(NULL)
-{
-}
-
-ui_basic_view::~ui_basic_view()
-{
- destroy_layout();
-}
-
-void ui_basic_view::load()
-{
- this->create_layout();
- ui_view::load();
-}
-
-void ui_basic_view::unload()
-{
- ui_view::unload();
-}
-
-Evas_Object *
-ui_basic_view::set_content(Evas_Object *content, const char *title)
-{
- Evas_Object *pcontent = ui_view::set_content(content);
-
- if (this->layout)
- {
- elm_object_part_content_unset(this->layout, "elm.swallow.content");
- elm_object_part_content_set(this->layout, "elm.swallow.content", content);
- elm_object_part_text_set(this->layout, "elm.text.title", title);
- }
- else
- {
- LOGE("Layout is not exist!");
- }
-
- return pcontent;
-}
-
-bool ui_basic_view::set_subtitle(const char *text)
-{
- if (this->layout)
- {
- elm_object_part_text_set(this->layout, "elm.text.subtitle", text);
- if (text) elm_object_signal_emit(this->layout, "elm,state,subtitle,show", "elm");
- else elm_object_signal_emit(this->layout, "elm,state,subtitle,hide", "elm");
- return true;
- }
- LOGE("Layout is not exist!");
- return false;
-}
-
-bool ui_basic_view::set_title_left_btn(Evas_Object *title_left_btn)
-{
- if (this->layout)
- {
- if (title_left_btn)
- {
- elm_object_style_set(title_left_btn, "tizen_view/title_left");
- }
- elm_object_part_content_set(this->layout, "title_left_btn", title_left_btn);
- if (title_left_btn) elm_object_signal_emit(this->layout, "elm,state,title_left_btn,show", "elm");
- else elm_object_signal_emit(this->layout, "elm,state,title_left_btn,hide", "elm");
- return true;
- }
- LOGE("Layout is not exist!");
- return false;
-}
-
-bool ui_basic_view::set_title_right_btn(Evas_Object *title_right_btn)
-{
- if (this->layout)
- {
- if (title_right_btn)
- {
- elm_object_style_set(title_right_btn, "tizen_view/title_right");
- }
- elm_object_part_content_set(this->layout, "title_right_btn", title_right_btn);
- if (title_right_btn) elm_object_signal_emit(this->layout, "elm,state,title_right_btn,show", "elm");
- else elm_object_signal_emit(this->layout, "elm,state,title_right_btn,hide", "elm");
- return true;
- }
- LOGE("Layout is not exist!");
- return false;
-}
-
-bool ui_basic_view::set_title_badge(const char *text)
-{
- if (this->layout)
- {
- elm_object_part_text_set(this->layout, "title_badge", text);
- if (text) elm_object_signal_emit(this->layout, "elm,state,title_badge,show", "elm");
- else elm_object_signal_emit(this->layout, "elm,state,title_badge,hide", "elm");
- return true;
- }
- LOGE("Layout is not exist!");
- return false;
-}
-
-bool ui_basic_view::set_title(const char *text)
-{
- if (this->layout)
- {
- elm_object_part_text_set(this->layout, "elm.text.title", text);
- if (text) elm_object_signal_emit(this->layout, "elm,state,title,show", "elm");
- else elm_object_signal_emit(this->layout, "elm,state,title,hide", "elm");
- return true;
- }
- LOGE("Layout is not exist!");
- return false;
-}
-
-Evas_Object *ui_basic_view::set_content(Evas_Object *content, const char *title, const char *subtitle, Evas_Object *title_left_btn,
- Evas_Object *title_right_btn)
-{
- Evas_Object *pcontent = this->set_content(content);
-
- if (this->layout)
- {
- this->set_title(title);
- this->set_subtitle(subtitle);
- this->set_title_left_btn(title_left_btn);
- this->set_title_right_btn(title_right_btn);
- }
- else
- {
- LOGE("Layout is not exist!");
- }
-
- return pcontent;
-}
-
-bool ui_basic_view::set_toolbar(Evas_Object *toolbar)
-{
- Evas_Object *layout = this->get_base();
-
- if (layout)
- {
- elm_object_part_content_set(layout, "toolbar", toolbar);
- if (toolbar) elm_object_signal_emit(layout, "elm,state,toolbar,show", "elm");
- else elm_object_signal_emit(layout, "elm,state,toolbar,hide", "elm");
-
- return true;
- }
- LOGE("Layout is not exist!");
- return false;
-}
-
-void ui_basic_view::unload_content()
-{
- ui_view::set_content(NULL);
- this->destroy_layout();
-}
-
-void ui_basic_view::menu()
-{
- if (!this->get_controller()) return;
- (dynamic_cast<ui_basic_controller *>(this->get_controller()))->menu();
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 UI_BASIC_VIEW
-#define UI_BASIC_VIEW
-
-#include "../ui_viewmanager.h"
-
-namespace efl_viewmgr
-{
-
-class ui_basic_view: public ui_view
-{
-private:
- Evas_Object *layout; //Base layout for view
-
- bool create_layout();
- bool destroy_layout();
-
-protected:
- virtual void load();
- virtual void unload();
- virtual void unload_content();
-
-public:
- ui_basic_view(ui_controller *controller, const char *name = NULL);
- virtual ~ui_basic_view();
-
- Evas_Object *set_content(Evas_Object *content, const char *title = NULL);
- Evas_Object *set_content(Evas_Object *content, const char *title, const char *subtitle, Evas_Object *title_left_btn, Evas_Object *title_right_btn);
- bool set_title_badge(const char *text);
- bool set_subtitle(const char *text);
- bool set_title_left_btn(Evas_Object *title_left_btn);
- bool set_title_right_btn(Evas_Object *title_right_btn);
- bool set_title(const char *text);
- bool set_toolbar(Evas_Object *toolbar);
-
- virtual void menu();
-
- virtual Evas_Object *get_base()
- {
- return this->layout;
- }
-};
-
-}
-
-#endif /* UI_BASIC_VIEW */
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 "ui_viewmanager.h"
-
-using namespace efl_viewmgr;
-using namespace viewmgr;
-
-ui_basic_viewmgr::ui_basic_viewmgr(const char *pkg)
- : ui_viewmgr(pkg, new ui_basic_key_listener(this))
-{
-}
-
-ui_basic_viewmgr::~ui_basic_viewmgr()
-{
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 UI_BASIC_VIEWMGR_H
-#define UI_BASIC_VIEWMGR_H
-
-#include <Elementary.h>
-#include "../ui_viewmanager.h"
-
-namespace efl_viewmgr
-{
-
-class ui_basic_view;
-
-class ui_basic_viewmgr: public ui_viewmgr
-{
- friend class ui_basic_view;
-
-public:
- ui_basic_viewmgr(const char *pkg);
- virtual ~ui_basic_viewmgr();
-
-};
-}
-
-#endif /* UI_BASIC_VIEWMGR_H */
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 <dlog.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "UI_VIEWMGR"
-
-#include "ui_basic_controller.h"
-#include "ui_basic_view.h"
-#include "ui_basic_key_listener.h"
-#include "ui_basic_viewmgr.h"
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 "ui_viewmanager.h"
-
-using namespace efl_viewmgr;
-using namespace viewmgr;
-
-ui_view * ui_controller::get_view()
-{
- ui_iface_view *view = ui_iface_controller::get_view();
- if (!view) return NULL;
- return dynamic_cast<ui_view *>(view);
-}
-
-ui_controller::~ui_controller()
-{
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 UI_CONTROLLER_H
-#define UI_CONTROLLER_H
-
-#include "../interface/ui_viewmanager_interface.h"
-
-namespace efl_viewmgr
-{
-
-/**
- * @class ui_controller
- *
- * @ingroup viewmgr
- *
- * @brief UI Controller. This is a class for handling of life-cycle events from user side.
- */
-class ui_controller: public viewmgr::ui_iface_controller
-{
-public:
- ///Destructor.
- virtual ~ui_controller();
-
- /**
- * @brief Return a view which is matched with controller
- *
- * @return The view which is matched with controller
- *
- * @note User can set a controller 2 ways, 1. send a controller instance when view created,
- * 2. call set_view() method with controller instance.
- *
- * @see set_view()
- */
-
- ui_view *get_view();
-
- /** @brief load callback.
- *
- * @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() {}
-
- /** @brief unload callback.
- *
- * @note Remove resources with regards to this view for saving memory or keep the content for performance. It's up to your scenario.
- * Unload will be called just right before when the view is going to be deleted by popping or it's piled under the more than one view.
- * 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() {}
-
- /** @brief active callback.
- *
- * @note View is on active state after show transition is finished.
- * 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() {}
-
- /** @brief inactive callback.
- *
- * @note View is on inactive state. Get ready for unload. Hide transition may be triggered at this point.
- * Inactive state is triggered on this scenario that the view is still visible but it's not interactive with users.
- * 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() {}
-
- /** @brief pause callback.
- *
- * @note When the system blocks the application running in cases such as phone call, system notification, switching applications ...
- * 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() {}
-
- /** @brief resume callback.
- *
- * @note View is turning back to the active state again from pause.
- * When the system allows the application turns to activate.
- * When the Window turns to activate. (@see ui_viewmgr_base :: activate())
- */
- virtual void resume() {}
-
- /** @brief destroy callback.
- *
- * @note When this view is on destroying by popping or deleting.
- */
- virtual void destroy() {}
-
- virtual bool back() { return true; }
-};
-}
-
-#endif /* UI_CONTROLLER_H */
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 "ui_viewmanager.h"
-
-using namespace efl_viewmgr;
-using namespace viewmgr;
-
-static const char *KEY_BACK = "XF86Back";
-
-ui_key_listener::ui_key_listener(ui_viewmgr *viewmgr)
- : viewmgr(viewmgr), key_grabber(NULL)
-{
-
-}
-
-static void event_proc(ui_key_listener *key_listener, Evas_Event_Key_Down *ev)
-{
- //Only if view manager is activated
- ui_viewmgr *viewmgr = key_listener->get_viewmgr();
- if (!viewmgr->is_activated()) return;
-
- //Get Top View
- ui_view *view = dynamic_cast<ui_view *>(viewmgr->get_last_view());
- if (!view) return;
-
- key_listener->extend_event_proc(view, ev);
-
- if (strcmp(ev->keyname, KEY_BACK)) return;
-
- view->back();
-}
-
-bool ui_key_listener::term()
-{
- evas_object_del(this->key_grabber);
- return true;
-}
-
-bool ui_key_listener::init()
-{
- if (!this->viewmgr)
- {
- LOGE("No view manager??");
- return false;
- }
-
- Evas *e = evas_object_evas_get(this->viewmgr->get_window());
- if (!e)
- {
- LOGE("Failed to get Evas from window");
- return false;
- }
-
- Evas_Object *key_grab_rect = evas_object_rectangle_add(e);
- if (!key_grab_rect)
- {
- LOGE("Failed to create a key grabber rectangle");
- return false;
- }
-
- evas_object_event_callback_add(key_grab_rect, EVAS_CALLBACK_KEY_UP, [](void *data, Evas *e, Evas_Object *obj, void *event_info) -> void
- {
- Evas_Event_Key_Down *ev = static_cast<Evas_Event_Key_Down *>(event_info);
- ui_key_listener *key_listener = static_cast<ui_key_listener *>(data);
- event_proc(key_listener, ev);
- }, this);
-
- if (!evas_object_key_grab(key_grab_rect, KEY_BACK, 0, 0, EINA_FALSE))
- {
- LOGE("Failed to grab BACK KEY(%s)\n", KEY_BACK);
- evas_object_del(key_grab_rect);
- return false;
- }
-
- this->key_grabber = key_grab_rect;
-
- return true;
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 UI_KEY_LISTENER_H
-#define UI_KEY_LISTENER_H
-
-#include <Elementary.h>
-#include "../interface/ui_viewmanager_interface.h"
-
-namespace efl_viewmgr
-{
-class ui_viewmgr;
-class ui_view;
-
-class ui_key_listener
-{
-protected:
- ui_viewmgr *viewmgr;
- Evas_Object *key_grabber;
-
-public:
- ui_key_listener(ui_viewmgr *viewmgr);
- virtual ~ui_key_listener() {}
-
- virtual bool init();
- virtual bool term();
- virtual void extend_event_proc(ui_view *view, Evas_Event_Key_Down *ev) {}
-
- ui_viewmgr *get_viewmgr() { return this->viewmgr; }
-};
-
-}
-
-#endif /* UI_KEY_LISTENER_H */
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 "ui_viewmanager.h"
-
-using namespace efl_viewmgr;
-using namespace viewmgr;
-
-ui_view::ui_view(ui_controller *controller, const char *name)
- : ui_iface_view(controller, name)
-{
-}
-
-ui_view::~ui_view()
-{
-}
-
-Evas_Object *ui_view::set_content(Evas_Object *content)
-{
- T pcontent = ui_iface_view::set_content(CONVERT_TO_T(content));
- return static_cast<Evas_Object *>(pcontent);
-}
-
-Evas_Object *ui_view::get_base()
-{
- ui_viewmgr *viewmgr = dynamic_cast<ui_viewmgr *>(ui_iface_view::get_viewmgr());
- if (!viewmgr)
- {
- return NULL;
- }
- return viewmgr->get_base();
-}
-
-void ui_view::unload_content()
-{
- Evas_Object *pcontent = this->set_content(NULL);
- if (pcontent) evas_object_del(pcontent);
-}
-
-Evas_Object *ui_view ::get_parent()
-{
- 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_iface_view::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);
-}
-
-void ui_view::back()
-{
- if (this->get_controller())
- {
- if (!dynamic_cast<ui_controller *>(this->get_controller())->back())
- {
- return;
- }
- }
- dynamic_cast<ui_viewmgr *>(this->get_viewmgr())->pop_view();
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 UI_VIEW_H
-#define UI_VIEW_H
-
-#include <Elementary.h>
-#include "../interface/ui_viewmanager_interface.h"
-
-#define CONVERT_TO_EO(T) static_cast<Evas_Object *>((T))
-#define CONVERT_TO_T(EO) static_cast<T>((EO))
-
-namespace efl_viewmgr
-{
-class ui_controller;
-
-/**
- * @class ui_view
- *
- * @ingroup viewmgr
- *
- * @brief UI View Class. This is the class of view. A view must have one content instance which represents a view for a current screen.
- * UI View may have it's own show/hide transition styles. That means, it's available that views have different show/hide effects on demands.
- * It's not mandatory but view should describe the transitions in this class.
- *
- * @warning When the transitions are finished, the view must to call ui_iface_viewmgr :: _push_finished(), ui_iface_viewmgr :: _pop_finished() in order that
- * The ui_iface_viewmgr keeps the view states exactly.
- */
-class ui_view: public viewmgr::ui_iface_view
-{
- friend class ui_viewmgr;
-
-public:
- ///Constructor.
- ui_view(ui_controller *controller, const char *name = NULL);
-
- ///Destructor.
- virtual ~ui_view();
-
- /** @brief This is for replacing or setting a content of the view.
- *
- * @param content a new content. It allows @c NULL for canceling the previous content.
- *
- * @return A previous content. If it wasn't, return value will be @c NULL.
- */
- virtual Evas_Object *set_content(Evas_Object *content);
-
- /** @brief Get a base layout of viewmgr.
- */
- virtual Evas_Object *get_base();
-
- virtual void back();
-
- /** @brief Set the indicator mode.
- *
- * @param indicator The mode to set, one of #ui_view_indicator.
- */
- void set_indicator(ui_view_indicator indicator);
-
-protected:
- /** @brief Unload current view's content
- *
- * @note Make this view's content as NULL, then destroy content.
- */
- virtual void unload_content();
-
- /** @brief Get a parent object of view.
- *
- * @note This is calling viewmgr get_base() method internally.
- *
- * @return base layout of viewmgr.
- */
- Evas_Object *get_parent();
-};
-
-}
-
-#endif /* UI_VIEW_H */
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 <dlog.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "UI_VIEWMGR"
-
-#include "ui_viewmgr.h"
-#include "ui_controller.h"
-#include "ui_view.h"
-#include "ui_key_listener.h"
-
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 "ui_viewmanager.h"
-
-using namespace efl_viewmgr;
-using namespace viewmgr;
-
-bool ui_viewmgr::set_indicator(ui_view_indicator indicator)
-{
- 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)
-{
- Evas_Object *conform = elm_conformant_add(win);
- if (!conform) return false;
-
- evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(win, conform);
- elm_win_conformant_set(win, EINA_TRUE);
- evas_object_show(conform);
-
- this->conform = conform;
-
- return true;
-}
-
-bool ui_viewmgr::create_base_layout(Evas_Object *conform)
-{
- Evas_Object *layout = elm_layout_add(conform);
- if (!layout) return false;
-
- elm_layout_theme_set(layout, "layout", "application", "default");
- elm_object_content_set(conform, layout);
-
- this->layout = layout;
-
- return true;
-}
-
-ui_viewmgr::ui_viewmgr(const char *pkg, ui_key_listener *key_listener)
- : ui_iface_viewmgr(), key_listener(key_listener)
-{
- if (!pkg)
- {
- LOGE("Invalid package name");
- return;
- }
- //Window
- this->win = elm_win_util_standard_add(pkg, pkg);
-
- if (!this->win)
- {
- LOGE("Failed to create a window (%s)", pkg);
- return;
- }
-
- //Set window rotation
- if (elm_win_wm_rotation_supported_get(this->win))
- {
- int rots[4] =
- { 0, 90, 180, 270 };
- elm_win_wm_rotation_available_rotations_set(this->win, (const int *) (&rots), 4);
- }
-
- //Window is requested to delete.
- evas_object_smart_callback_add(this->win, "delete,request",
- [](void *data, Evas_Object *obj, void *event_info) -> void
- {
- ui_viewmgr *viewmgr = static_cast<ui_viewmgr*>(data);
- delete(viewmgr);
- //FIXME: Window is destroyed. Terminate Application!
- //ui_app_exit();
- },
- this);
-
- //Conformant: Make this configurable.
- if (!this->create_conformant(this->win))
- {
- LOGE("Failed to create a conformant (%s)", pkg);
- return;
- }
-
- if (!this->create_base_layout(this->conform))
- {
- LOGE("Failed to create a base layout (%s)", pkg);
- return;
- }
-
- //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);
-
- key_listener->init();
-}
-
-ui_viewmgr::ui_viewmgr(const char *pkg)
- : ui_viewmgr(pkg, new ui_key_listener(this))
-{
-}
-
-ui_viewmgr::~ui_viewmgr()
-{
- this->key_listener->term();
- delete(this->key_listener);
-}
-
-bool ui_viewmgr::activate()
-{
- ui_iface_viewmgr::activate();
-
- elm_object_part_content_unset(this->get_base(), "elm.swallow.content");
-
- ui_view *view = dynamic_cast<ui_view *>(this->get_last_view());
-
- //TODO: get parent?
- Evas_Object *content = view->get_base();
- if (content == this->get_base())
- {
- elm_object_part_content_set(this->get_base(), "elm.swallow.content", CONVERT_TO_EO(view->get_content()));
- }
- else
- {
- elm_object_part_content_set(this->get_base(), "elm.swallow.content", CONVERT_TO_EO(view->get_base()));
- }
-
- this->set_indicator(view->get_indicator());
- view->active();
-
- evas_object_show(this->win);
-
- return true;
-}
-
-bool ui_viewmgr::deactivate()
-{
- ui_iface_viewmgr::deactivate();
-
- //FIXME: based on the profile, we should app to go behind or terminate.
- if (true)
- {
- ui_view *view = dynamic_cast<ui_view *>(this->get_last_view());
- if (view) view->inactive();
- evas_object_lower(this->win);
- }
- else
- {
- //FIXME: exit app
- //ui_app_exit();
- }
-
- return true;
-}
-
-bool ui_viewmgr::pop_view()
-{
- if (this->get_view_count() == 1) this->deactivate();
- else if(!ui_iface_viewmgr::pop_view()) return false;
-
- ui_view *view = dynamic_cast<ui_view *>(this->get_last_view());
-
- //TODO: get parent?
- Evas_Object *content = view->get_base();
- if (content == this->get_base())
- {
- elm_object_part_content_set(this->get_base(), "elm.swallow.content", CONVERT_TO_EO(view->get_content()));
- }
- else
- {
- 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;
-}
-
-ui_view * ui_viewmgr::push_view(ui_view *view)
-{
- ui_iface_viewmgr::push_view(view);
-
- //Don't prepare yet if viewmgr is not activated.
- if (!this->is_activated()) return view;
-
- elm_object_part_content_unset(this->get_base(), "elm.swallow.content");
-
- Evas_Object *content = view->get_base();
-
- if (content == this->get_base())
- {
- elm_object_part_content_set(this->get_base(), "elm.swallow.content", CONVERT_TO_EO(view->get_content()));
- }
- else
- {
- 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;
-}
-
-ui_view *ui_viewmgr::get_last_view()
-{
- return dynamic_cast<ui_view *>(ui_iface_viewmgr::get_last_view());
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 UI_VIEWMGR_H
-#define UI_VIEWMGR_H
-
-#include <Elementary.h>
-#include "../interface/ui_viewmanager_interface.h"
-#include "ui_key_listener.h"
-
-namespace efl_viewmgr
-{
-
-class ui_view;
-
-/**
- * @class ui_viewmgr
- *
- * @ingroup viewmgr
- *
- * @brief This is a class of viewmgr. One viewmgr represents a window which contains multiple views.
- * A viewmgr manages not only views life-cycle but constructs basic infrastructures such as key events handling, transition effects, transient views.
- * This interface guide you a basic policy of a view manager.
- *
- * @warning viewmgr will remove all containing views when it's destroyed.
- */
-class ui_viewmgr: public viewmgr::ui_iface_viewmgr
-{
- friend class ui_view;
-
-private:
- Evas_Object *win; //This is acting like a base object of viewmgr.
- Evas_Object *conform; //Conformant for viewmgr.
- Evas_Object *layout; //Viewmgr's base layout.
- ui_key_listener *key_listener; //HW Key Handler such as "BACK" key...
- ui_view_indicator indicator; //Mode of indicator.
-
- /**
- * @brief Create a conformant.
- *
- * @param win viewmgr's window object. this will be parent of conformant object.
- *
- * @return @c true success or @c false not.
- */
- bool create_conformant(Evas_Object *win);
-
- /**
- * @brief Create a base layout.
- *
- * @param conform viewmgr's conformant object. this will be parent of layout object.
- *
- * @return @c true success or @c false not.
- */
- bool create_base_layout(Evas_Object *conform);
-
- /** @brief Set the indicator mode.
- *
- * @param indicator The mode to set, one of #ui_view_indicator.
- */
- bool set_indicator(ui_view_indicator indicator);
-
-protected:
- ui_viewmgr(const char *pkg, ui_key_listener *key_listener);
-
- /** @brief Get a base layout of viewmgr.
- */
- Evas_Object *get_base()
- {
- return this->layout;
- }
-
-public:
- ///Constructor.
- ui_viewmgr(const char *pkg);
- ///Destructor.
- virtual ~ui_viewmgr();
-
- /**
- * @brief Activate this view manager.
- *
- * @note viewmgr window and views will be shown once activate() is called. Usually this activate() should be called after applications set their all views
- * on initialization time.
- *
- * @return @c true on success or @c false otherwise.
- *
- * @see deactivate()
- */
- virtual bool activate();
-
- /**
- * @brief Deactivate this view manager.
- *
- * @note viewmgr window and views will be hidden once deactivate() is called. deactivate() behavior is up ui system, but usually it hides(unmap)
- * current window in order that application go background.
- *
- * @return @c true success or @c false not.
- *
- * @see activate()
- */
- virtual bool deactivate();
-
- /**
- * @brief Push a new view into this viewmgr. This function is used for when application switches a current view to a new one.
- *
- * @note Normally, the current view will be hidden by a new view. In default, when user calls this API, view will be switched to @p view instantly,
- * only when viewmgr state is activated. Otherwise, the @p view will be shown later when viewmgr is activated. push_view() is designed for providing
- * view transition effect. If you want push view instantly without any transition, you could use insert_view_before() or insert_view_after().
- * If you want to pop the current view, the please use pop_view().
- *
- * @param view A view to insert in the viewmgr view list.
- *
- * @return @p view, @c NULL when it fails to push a @p view.
- *
- * @see activated()
- * @see insert_view_before()
- * @see insert_view_after()
- * @see pop_view()
- */
- virtual ui_view *push_view(ui_view *view);
-
- /**
- * @brief Push a new view into this viewmgr. This function is used for when application switches a current view to a new one.
- *
- * @note Normally, the current view will be hidden by a new view. In default, when user calls this API, view will be switched to @p view instantly,
- * only when viewmgr state is activated. Otherwise, the @p view will be shown later when viewmgr is activated. push_view() is designed for providing
- * view transition effect. If you want push view instantly without any transition, you could use insert_view_before() or insert_view_after().
- * If you want to pop the current view, the please use pop_view().
- *
- * @param view A view to insert in the viewmgr view list.
- *
- * @return @p view, @c NULL when it fails to push a @p view.
- *
- * @see activated()
- * @see insert_view_before()
- * @see insert_view_after()
- * @see pop_view()
- */
- virtual bool pop_view();
-
- /** @brief Get a window object of viewmgr.
- */
- Evas_Object *get_window()
- {
- return this->win;
- }
-
- /** @brief Get a conformant object of viewmgr.
- */
- Evas_Object *get_conformant()
- {
- return this->conform;
- }
-
- /** @brief Get a last view of current view stack.
- */
- ui_view *get_last_view();
-};
-}
-
-#endif /* UI_VIEWMGR_H */
--- /dev/null
+SET(EXAM_NAME viewmgr_demo)
+SET(EXAM_SRCS
+ ../../lib/interface/ui_iface_controller.cpp
+ ../../lib/interface/ui_iface_view.cpp
+ ../../lib/interface/ui_iface_viewmgr.cpp
+ ../../lib/efl/ui_controller.cpp
+ ../../lib/efl/ui_view.cpp
+ ../../lib/efl/ui_viewmgr.cpp
+ ../../lib/efl/ui_key_listener.cpp
+ ../../lib/efl/mobile/ui_basic_controller.cpp
+ ../../lib/efl/mobile/ui_basic_view.cpp
+ ../../lib/efl/mobile/ui_basic_key_listener.cpp
+ ../../lib/efl/mobile/ui_basic_viewmgr.cpp
+ main.cpp
+ )
+
+ADD_EXECUTABLE(${EXAM_NAME} ${EXAM_SRCS})
+
+PKG_CHECK_MODULES(EXAM_PKGS REQUIRED elementary efl-extension dlog capi-appfw-application capi-system-system-settings appcore-efl capi-appfw-app-manager)
+
+PKG_CHECK_MODULES(EXAM_PKGS REQUIRED elementary dlog efl-extension)
+
+FOREACH(flag ${EXAM_PKGS_CFLAGS})
+ SET(EXAM_CFLAGS "${EXAM_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET_TARGET_PROPERTIES(${EXAM_NAME} PROPERTIES COMPILE_FLAGS "${EXAM_CFLAGS}")
+TARGET_LINK_LIBRARIES(${EXAM_NAME} ${EXAM_PKGS_LDFLAGS} ${EXAM_TARGET_PKGS_LDFLAGS})
+TARGET_LINK_LIBRARIES(${EXAM_NAME} ${EXAM_PKGS_LDFLAGS} ${LIB_NAME})
+
+SET(GC_SECTIONS_FLAGS "-fdata-sections -ffunction-sections -Wl,--gc-sections")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PKG_CFLAGS} -Wall -Werror -Wno-unused -Wno-format-extra-args -Wl,--no-undefined -fvisibility=hidden -fPIC -std=c++0x ${GC_SECTIONS_FLAGS}")
+
+INSTALL(TARGETS ${EXAM_NAME} DESTINATION /opt/usr/apps/ui-viewmgr/bin)
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "main.h"
+#include "page6.h"
+#include "page5.h"
+#include "page4.h"
+#include "page3.h"
+#include "page2.h"
+#include "page1.h"
+
+Evas_Object*
+create_toolbar(Evas_Object *parent)
+{
+ Evas_Object *toolbar;
+
+ toolbar = elm_toolbar_add(parent);
+
+ //FIXME: :( UI_View can set this style instead.
+ elm_object_style_set(toolbar, "toolbar_with_title");
+ elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND);
+ elm_toolbar_transverse_expanded_set(toolbar, EINA_TRUE);
+
+ elm_toolbar_item_append(toolbar, NULL, "Tab1", NULL, NULL);
+ elm_toolbar_item_append(toolbar, NULL, "Tab2", NULL, NULL);
+
+ elm_toolbar_select_mode_set(toolbar, ELM_OBJECT_SELECT_MODE_ALWAYS);
+
+ return toolbar;
+}
+
+Evas_Object*
+create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb, appdata_s *ad)
+{
+ Evas_Object *grid, *box, *layout, *scroller, *btn, *button_layout;
+
+ /* Scroller */
+ scroller = elm_scroller_add(parent);
+ elm_scroller_bounce_set(scroller, EINA_FALSE, EINA_TRUE);
+ elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+
+ /* Grid */
+ grid = elm_grid_add(scroller);
+ evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(grid);
+
+ /* NoContent Layout */
+ layout = elm_layout_add(grid);
+ elm_layout_theme_set(layout, "layout", "nocontents", "default");
+ elm_object_part_text_set(layout, "elm.text", text);
+ evas_object_show(layout);
+ elm_grid_pack(grid, layout, 0, 0, 100, 100);
+
+ /* Box */
+ box = elm_box_add(grid);
+ elm_box_horizontal_set(box, EINA_TRUE);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_padding_set(box, ELM_SCALE_SIZE(50), 0);
+ evas_object_show(box);
+ elm_grid_pack(grid, box, 0, 0, 100, 100);
+
+ /* Previous Page Button */
+ btn = elm_button_add(grid);
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 1.0);
+ elm_object_text_set(btn, "Prev");
+ evas_object_smart_callback_add(btn, "clicked", prev_btn_clicked_cb, ad);
+ evas_object_show(btn);
+ elm_box_pack_end(box, btn);
+
+ /* Next Page Button */
+ btn = elm_button_add(grid);
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 1.0);
+ elm_object_text_set(btn, "Next");
+ evas_object_smart_callback_add(btn, "clicked", next_btn_clicked_cb, ad);
+ evas_object_show(btn);
+ elm_box_pack_end(box, btn);
+
+ elm_object_content_set(scroller, grid);
+
+ return scroller;
+}
+
+static void create_base_gui(appdata_s *ad)
+{
+ //FIXME: Hide this creation.
+ ad->viewmgr = new ui_basic_viewmgr(PACKAGE);
+
+ create_page1(ad);
+
+ ad->viewmgr->activate();
+}
+
+int
+elm_main(int argc, char **argv)
+{
+ appdata_s *ad = {0,};
+
+ ad = static_cast<appdata_s *>(calloc(1, sizeof(appdata_s)));
+ create_base_gui(ad);
+
+ elm_run();
+ elm_shutdown();
+ return 0;
+}
+ELM_MAIN()
+
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 <system_settings.h>
+#include <dlog.h>
+#include "ui_viewmanager.h"
+
+//uncomment if you want debug
+#ifndef TIZEN_ENGINEER_MODE
+#define TIZEN_ENGINEER_MODE
+#endif
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "UI_VIEWMGR"
+
+#if !defined(PACKAGE)
+#define PACKAGE "ui-viewmgr"
+#endif
+
+using namespace efl_viewmgr;
+
+typedef struct appdata {
+ ui_viewmgr *viewmgr;
+} appdata_s;
+
+Evas_Object *create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb, appdata_s *ad);
+Evas_Object *create_toolbar(Evas_Object *parent);
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ *
+ */
+class page1: public ui_basic_controller
+{
+private:
+ appdata_s *ad;
+
+public:
+ page1(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()
+ {
+ }
+
+ void load()
+ {
+ //Initialize contents.
+
+ 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 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);
+ create_page2(ad);
+ },
+ this->ad);
+
+ view->set_content(content, "Title");
+ }
+
+ bool menu()
+ {
+ LOGE("Menu!");
+ return true;
+ }
+};
+
+void create_page1(appdata_s *ad)
+{
+ new page1(ad);
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ *
+ */
+class page2: public ui_basic_controller
+{
+private:
+ appdata_s *ad;
+
+public:
+ page2(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()
+ {
+ }
+
+ void load()
+ {
+ //Initialize contents.
+ 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 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);
+ create_page3(ad);
+ },
+ this->ad);
+
+ //Title left button
+ Evas_Object *left_title_btn = elm_button_add(view->get_base());
+ elm_object_text_set(left_title_btn, "Cancel");
+
+ //Title right button
+ Evas_Object *right_title_btn = elm_button_add(view->get_base());
+ elm_object_text_set(right_title_btn, "Done");
+
+ //Arguments: content, title, subtitle, title left button, title right button
+ view->set_content(content, "Title Buttons", NULL, left_title_btn, right_title_btn);
+ }
+};
+
+void create_page2(appdata_s *ad)
+{
+ new page2(ad);
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ *
+ */
+class page3: public ui_basic_controller
+{
+private:
+ appdata_s *ad;
+
+public:
+ page3(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"));
+ }
+
+ ~page3()
+ {
+ }
+
+ void load()
+ {
+ //Initialize contents.
+
+ 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 3",
+ //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);
+ create_page4(ad);
+ },
+ this->ad);
+
+ //Arguments: content, title, subtitle, title left button, title right button
+ view->set_content(content, "Title", "Subtitle", NULL, NULL);
+ }
+};
+
+void create_page3(appdata_s *ad)
+{
+ new page3(ad);
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ *
+ */
+class page4: public ui_basic_controller
+{
+private:
+ appdata_s *ad;
+
+public:
+ page4(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"));
+ }
+
+ ~page4()
+ {
+ }
+
+ void load()
+ {
+ //Initialize contents.
+
+ 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 4",
+ //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);
+ create_page5(ad);
+ },
+ this->ad);
+
+ //Arguments: content, title
+ view->set_content(content, "TitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitleTitle");
+ view->set_title_badge("999+");
+ }
+};
+
+void create_page4(appdata_s *ad)
+{
+ new page4(ad);
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ *
+ */
+class page5: public ui_basic_controller
+{
+private:
+ appdata_s *ad;
+
+public:
+ page5(appdata_s *ad)
+ : ad(ad)
+ {
+ //No basic form.
+ /* ui_view(controller, identity name).
+ Later, you could get the identity name using view->get_name(); */
+ ad->viewmgr->push_view(new ui_view(this, "page5"));
+ }
+
+ ~page5()
+ {
+ }
+
+ void load()
+ {
+ //Initialize contents.
+
+ 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>(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);
+ create_page6(ad);
+ },
+ this->ad);
+
+ view->set_content(content);
+ view->set_indicator(UI_VIEW_INDICATOR_HIDE);
+ }
+};
+
+void create_page5(appdata_s *ad)
+{
+ new page5(ad);
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ *
+ */
+class page6: public ui_basic_controller
+{
+private:
+ appdata_s *ad;
+
+public:
+ page6(appdata_s *ad)
+ : ad(ad)
+ {
+ /* ui_basic_view(controller, identity name, style name of view).
+ Later, you could get the identity name using view->get_name();
+ you could get the style name of view as well */
+ ad->viewmgr->push_view(new ui_basic_view(this, "page6"));
+ }
+
+ ~page6()
+ {
+ }
+
+ void load()
+ {
+
+ //Initialize contents.
+
+ 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 6<br>With Tabar",
+ //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);
+
+ //Arguments: content, title
+ view->set_content(content, "Title with toolbar");
+ Evas_Object *toolbar = create_toolbar(view->get_base());
+ view->set_toolbar(toolbar);
+ }
+};
+
+void create_page6(appdata_s *ad)
+{
+ new page6(ad);
+}
--- /dev/null
+INSTALL(
+ DIRECTORY ./ DESTINATION include/${LIB_NAME}
+ FILES_MATCHING
+ PATTERN "interface/*.h"
+ PATTERN "efl/*.h"
+ PATTERN "efl/mobile/*.h"
+ PATTERN "ui_viewmanager.h"
+ )
+
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 UI_BASIC_CONTROLLER_H
+#define UI_BASIC_CONTROLLER_H
+
+#include "../ui_viewmanager_efl.h"
+
+namespace efl_viewmgr
+{
+class ui_basic_controller: public ui_controller
+{
+public:
+ virtual ~ui_basic_controller();
+ virtual bool menu();
+};
+}
+
+#endif /* UI_BASIC_CONTROLLER_H */
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 MOBILE_KEY_HANDLER_H
+#define MOBILE_KEY_HANDLER_H
+
+#include "../ui_viewmanager_efl.h"
+
+namespace efl_viewmgr
+{
+class ui_viewmgr;
+
+class ui_basic_key_listener : public ui_key_listener
+{
+public:
+ ui_basic_key_listener(ui_viewmgr *viewmgr);
+
+ virtual bool init();
+ virtual void extend_event_proc(ui_view *view, Evas_Event_Key_Down *ev);
+};
+
+}
+
+#endif /* MOBILE_KEY_HANDLER_H */
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 UI_BASIC_VIEW
+#define UI_BASIC_VIEW
+
+#include "../ui_viewmanager_efl.h"
+
+namespace efl_viewmgr
+{
+
+class ui_basic_view: public ui_view
+{
+private:
+ Evas_Object *layout; //Base layout for view
+
+ bool create_layout();
+ bool destroy_layout();
+
+protected:
+ virtual void load();
+ virtual void unload();
+ virtual void unload_content();
+
+public:
+ ui_basic_view(ui_controller *controller, const char *name = NULL);
+ virtual ~ui_basic_view();
+
+ Evas_Object *set_content(Evas_Object *content, const char *title = NULL);
+ Evas_Object *set_content(Evas_Object *content, const char *title, const char *subtitle, Evas_Object *title_left_btn, Evas_Object *title_right_btn);
+ bool set_title_badge(const char *text);
+ bool set_subtitle(const char *text);
+ bool set_title_left_btn(Evas_Object *title_left_btn);
+ bool set_title_right_btn(Evas_Object *title_right_btn);
+ bool set_title(const char *text);
+ bool set_toolbar(Evas_Object *toolbar);
+
+ virtual void menu();
+
+ virtual Evas_Object *get_base()
+ {
+ return this->layout;
+ }
+};
+
+}
+
+#endif /* UI_BASIC_VIEW */
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 UI_BASIC_VIEWMGR_H
+#define UI_BASIC_VIEWMGR_H
+
+#include <Elementary.h>
+#include "../ui_viewmanager_efl.h"
+
+namespace efl_viewmgr
+{
+
+class ui_basic_view;
+
+class ui_basic_viewmgr: public ui_viewmgr
+{
+ friend class ui_basic_view;
+
+public:
+ ui_basic_viewmgr(const char *pkg);
+
+ virtual ~ui_basic_viewmgr();
+
+};
+}
+
+#endif /* UI_BASIC_VIEWMGR_H */
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "UI_VIEWMGR"
+
+#include "ui_basic_controller.h"
+#include "ui_basic_view.h"
+#include "ui_basic_key_listener.h"
+#include "ui_basic_viewmgr.h"
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 UI_CONTROLLER_H
+#define UI_CONTROLLER_H
+
+#include "../interface/ui_viewmanager_interface.h"
+
+namespace efl_viewmgr
+{
+
+/**
+ * @class ui_controller
+ *
+ * @ingroup viewmgr
+ *
+ * @brief UI Controller. This is a class for handling of life-cycle events from user side.
+ */
+class ui_controller: public viewmgr::ui_iface_controller
+{
+public:
+ ///Destructor.
+ virtual ~ui_controller();
+
+ /**
+ * @brief Return a view which is matched with controller
+ *
+ * @return The view which is matched with controller
+ *
+ * @note User can set a controller 2 ways, 1. send a controller instance when view created,
+ * 2. call set_view() method with controller instance.
+ *
+ * @see set_view()
+ */
+
+ ui_view *get_view();
+
+ /** @brief load callback.
+ *
+ * @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() {}
+
+ /** @brief unload callback.
+ *
+ * @note Remove resources with regards to this view for saving memory or keep the content for performance. It's up to your scenario.
+ * Unload will be called just right before when the view is going to be deleted by popping or it's piled under the more than one view.
+ * 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() {}
+
+ /** @brief active callback.
+ *
+ * @note View is on active state after show transition is finished.
+ * 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() {}
+
+ /** @brief inactive callback.
+ *
+ * @note View is on inactive state. Get ready for unload. Hide transition may be triggered at this point.
+ * Inactive state is triggered on this scenario that the view is still visible but it's not interactive with users.
+ * 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() {}
+
+ /** @brief pause callback.
+ *
+ * @note When the system blocks the application running in cases such as phone call, system notification, switching applications ...
+ * 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() {}
+
+ /** @brief resume callback.
+ *
+ * @note View is turning back to the active state again from pause.
+ * When the system allows the application turns to activate.
+ * When the Window turns to activate. (@see ui_viewmgr_base :: activate())
+ */
+ virtual void resume() {}
+
+ /** @brief destroy callback.
+ *
+ * @note When this view is on destroying by popping or deleting.
+ */
+ virtual void destroy() {}
+
+ virtual bool back() { return true; }
+};
+}
+
+#endif /* UI_CONTROLLER_H */
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 UI_KEY_LISTENER_H
+#define UI_KEY_LISTENER_H
+
+#include <Elementary.h>
+#include "../interface/ui_viewmanager_interface.h"
+
+namespace efl_viewmgr
+{
+class ui_viewmgr;
+class ui_view;
+
+class ui_key_listener
+{
+protected:
+ ui_viewmgr *viewmgr;
+ Evas_Object *key_grabber;
+
+public:
+ ui_key_listener(ui_viewmgr *viewmgr);
+ virtual ~ui_key_listener() {}
+
+ virtual bool init();
+ virtual bool term();
+ virtual void extend_event_proc(ui_view *view, Evas_Event_Key_Down *ev) {}
+
+ ui_viewmgr *get_viewmgr() { return this->viewmgr; }
+};
+
+}
+
+#endif /* UI_KEY_LISTENER_H */
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 UI_VIEW_H
+#define UI_VIEW_H
+
+#include <Elementary.h>
+#include "../interface/ui_viewmanager_interface.h"
+
+#define CONVERT_TO_EO(T) static_cast<Evas_Object *>((T))
+#define CONVERT_TO_T(EO) static_cast<T>((EO))
+
+namespace efl_viewmgr
+{
+class ui_controller;
+
+/**
+ * @class ui_view
+ *
+ * @ingroup viewmgr
+ *
+ * @brief UI View Class. This is the class of view. A view must have one content instance which represents a view for a current screen.
+ * UI View may have it's own show/hide transition styles. That means, it's available that views have different show/hide effects on demands.
+ * It's not mandatory but view should describe the transitions in this class.
+ *
+ * @warning When the transitions are finished, the view must to call ui_iface_viewmgr :: _push_finished(), ui_iface_viewmgr :: _pop_finished() in order that
+ * The ui_iface_viewmgr keeps the view states exactly.
+ */
+class ui_view: public viewmgr::ui_iface_view
+{
+ friend class ui_viewmgr;
+
+public:
+ ///Constructor.
+ ui_view(ui_controller *controller, const char *name = NULL);
+
+ ///Destructor.
+ virtual ~ui_view();
+
+ /** @brief This is for replacing or setting a content of the view.
+ *
+ * @param content a new content. It allows @c NULL for canceling the previous content.
+ *
+ * @return A previous content. If it wasn't, return value will be @c NULL.
+ */
+ virtual Evas_Object *set_content(Evas_Object *content);
+
+ /** @brief Get a base layout of viewmgr.
+ */
+ virtual Evas_Object *get_base();
+
+ virtual void back();
+
+ /** @brief Set the indicator mode.
+ *
+ * @param indicator The mode to set, one of #ui_view_indicator.
+ */
+ void set_indicator(ui_view_indicator indicator);
+
+protected:
+ /** @brief Unload current view's content
+ *
+ * @note Make this view's content as NULL, then destroy content.
+ */
+ virtual void unload_content();
+
+ /** @brief Get a parent object of view.
+ *
+ * @note This is calling viewmgr get_base() method internally.
+ *
+ * @return base layout of viewmgr.
+ */
+ Evas_Object *get_parent();
+};
+
+}
+
+#endif /* UI_VIEW_H */
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "UI_VIEWMGR"
+
+#include "ui_viewmgr.h"
+#include "ui_controller.h"
+#include "ui_view.h"
+#include "ui_key_listener.h"
+
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 UI_VIEWMGR_H
+#define UI_VIEWMGR_H
+
+#include <Elementary.h>
+#include "../interface/ui_viewmanager_interface.h"
+#include "ui_key_listener.h"
+
+namespace efl_viewmgr
+{
+
+class ui_view;
+
+/**
+ * @class ui_viewmgr
+ *
+ * @ingroup viewmgr
+ *
+ * @brief This is a class of viewmgr. One viewmgr represents a window which contains multiple views.
+ * A viewmgr manages not only views life-cycle but constructs basic infrastructures such as key events handling, transition effects, transient views.
+ * This interface guide you a basic policy of a view manager.
+ *
+ * @warning viewmgr will remove all containing views when it's destroyed.
+ */
+class ui_viewmgr: public viewmgr::ui_iface_viewmgr
+{
+ friend class ui_view;
+
+private:
+ Evas_Object *win; //This is acting like a base object of viewmgr.
+ Evas_Object *conform; //Conformant for viewmgr.
+ Evas_Object *layout; //Viewmgr's base layout.
+ ui_key_listener *key_listener; //HW Key Handler such as "BACK" key...
+ ui_view_indicator indicator; //Mode of indicator.
+
+ /**
+ * @brief Create a conformant.
+ *
+ * @param win viewmgr's window object. this will be parent of conformant object.
+ *
+ * @return @c true success or @c false not.
+ */
+ bool create_conformant(Evas_Object *win);
+
+ /**
+ * @brief Create a base layout.
+ *
+ * @param conform viewmgr's conformant object. this will be parent of layout object.
+ *
+ * @return @c true success or @c false not.
+ */
+ bool create_base_layout(Evas_Object *conform);
+
+ /** @brief Set the indicator mode.
+ *
+ * @param indicator The mode to set, one of #ui_view_indicator.
+ */
+ bool set_indicator(ui_view_indicator indicator);
+
+protected:
+ ui_viewmgr(const char *pkg, ui_key_listener *key_listener);
+
+ /** @brief Get a base layout of viewmgr.
+ */
+ Evas_Object *get_base()
+ {
+ return this->layout;
+ }
+
+public:
+ ///Constructor.
+ ui_viewmgr(const char *pkg);
+ ///Destructor.
+ virtual ~ui_viewmgr();
+
+ /**
+ * @brief Activate this view manager.
+ *
+ * @note viewmgr window and views will be shown once activate() is called. Usually this activate() should be called after applications set their all views
+ * on initialization time.
+ *
+ * @return @c true on success or @c false otherwise.
+ *
+ * @see deactivate()
+ */
+ virtual bool activate();
+
+ /**
+ * @brief Deactivate this view manager.
+ *
+ * @note viewmgr window and views will be hidden once deactivate() is called. deactivate() behavior is up ui system, but usually it hides(unmap)
+ * current window in order that application go background.
+ *
+ * @return @c true success or @c false not.
+ *
+ * @see activate()
+ */
+ virtual bool deactivate();
+
+ /**
+ * @brief Push a new view into this viewmgr. This function is used for when application switches a current view to a new one.
+ *
+ * @note Normally, the current view will be hidden by a new view. In default, when user calls this API, view will be switched to @p view instantly,
+ * only when viewmgr state is activated. Otherwise, the @p view will be shown later when viewmgr is activated. push_view() is designed for providing
+ * view transition effect. If you want push view instantly without any transition, you could use insert_view_before() or insert_view_after().
+ * If you want to pop the current view, the please use pop_view().
+ *
+ * @param view A view to insert in the viewmgr view list.
+ *
+ * @return @p view, @c NULL when it fails to push a @p view.
+ *
+ * @see activated()
+ * @see insert_view_before()
+ * @see insert_view_after()
+ * @see pop_view()
+ */
+ virtual ui_view *push_view(ui_view *view);
+
+ /**
+ * @brief Push a new view into this viewmgr. This function is used for when application switches a current view to a new one.
+ *
+ * @note Normally, the current view will be hidden by a new view. In default, when user calls this API, view will be switched to @p view instantly,
+ * only when viewmgr state is activated. Otherwise, the @p view will be shown later when viewmgr is activated. push_view() is designed for providing
+ * view transition effect. If you want push view instantly without any transition, you could use insert_view_before() or insert_view_after().
+ * If you want to pop the current view, the please use pop_view().
+ *
+ * @param view A view to insert in the viewmgr view list.
+ *
+ * @return @p view, @c NULL when it fails to push a @p view.
+ *
+ * @see activated()
+ * @see insert_view_before()
+ * @see insert_view_after()
+ * @see pop_view()
+ */
+ virtual bool pop_view();
+
+ /** @brief Get a window object of viewmgr.
+ */
+ Evas_Object *get_window()
+ {
+ return this->win;
+ }
+
+ /** @brief Get a conformant object of viewmgr.
+ */
+ Evas_Object *get_conformant()
+ {
+ return this->conform;
+ }
+
+ /** @brief Get a last view of current view stack.
+ */
+ ui_view *get_last_view();
+};
+}
+
+#endif /* UI_VIEWMGR_H */
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 UI_CONTROLLER_INTERFACE_H_
+#define UI_CONTROLLER_INTERFACE_H_
+
+namespace viewmgr {
+
+class ui_iface_view;
+
+/**
+ * @class ui_iface_controller.
+ *
+ * @internal
+ * @ingroup viewmgr
+ *
+ * @brief UI Controller Interface. This interface is designed for handling of life-cycle events from user side.
+ */
+class ui_iface_controller
+{
+ friend class ui_iface_view;
+
+private:
+ ui_iface_view *view;
+
+ void set_view(ui_iface_view *view);
+
+protected:
+ /**
+ * @brief Return a view which is matched with controller
+ *
+ * @return The view which is matched with controller
+ *
+ * @note User can set a controller 2 ways, 1. send a controller instance when view created,
+ * 2. call set_view() method with controller instance.
+ *
+ * @see set_view()
+ */
+ ui_iface_view *get_view()
+ {
+ return this->view;
+ }
+
+public:
+ ///Constructor.
+ ui_iface_controller() :
+ view(NULL)
+ {
+ }
+
+ ///Destructor.
+ virtual ~ui_iface_controller()
+ {
+ }
+
+ /** @brief load callback.
+ *
+ * @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;
+
+ /** @brief unload callback.
+ *
+ * @note Remove resources with regards to this view for saving memory or keep the content for performance. It's up to your scenario.
+ * Unload will be called just right before when the view is going to be deleted by popping or it's piled under the more than one view.
+ * 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;
+
+ /** @brief active callback.
+ *
+ * @note View is on active state after show transition is finished.
+ * 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;
+
+ /** @brief inactive callback.
+ *
+ * @note View is on inactive state. Get ready for unload. Hide transition may be triggered at this point.
+ * Inactive state is triggered on this scenario that the view is still visible but it's not interactive with users.
+ * 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;
+
+ /** @brief pause callback.
+ *
+ * @note When the system blocks the application running in cases such as phone call, system notification, switching applications ...
+ * 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;
+
+ /** @brief resume callback.
+ *
+ * @note View is turning back to the active state again from pause.
+ * When the system allows the application turns to activate.
+ * When the Window turns to activate. (@see ui_viewmgr_base :: activate())
+ */
+ virtual void resume() = 0;
+
+ /** @brief destroy callback.
+ *
+ * @note When this view is on destroying by popping or deleting.
+ */
+ virtual void destroy() = 0;
+};
+
+}
+
+#endif /* UI_CONTROLLER_INTERFACE_H_ */
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 UI_VIEW_INTERFACE_H_
+#define UI_VIEW_INTERFACE_H_
+
+#include <string>
+
+using namespace std;
+
+typedef void* T;
+
+namespace viewmgr {
+
+class ui_iface_viewmgr;
+class ui_iface_controller;
+
+/**
+ * @class ui_iface_view
+ *
+ * @internal
+ * @ingroup viewmgr
+ *
+ * @brief UI View Base Class. This is the base class of view. A view must have one content instance which represents a view for a current screen.
+ * UI View may have it's own show/hide transition styles. That means, it's available that views have different show/hide effects on demands.
+ * It's not mandatory but view should describe the transitions in this class.
+ *
+ * @warning When the transitions are finished, the view must to call ui_iface_viewmgr :: _push_finished(), ui_iface_viewmgr :: _pop_finished() in order that
+ * The ui_iface_viewmgr keeps the view states exactly.
+ */
+class ui_iface_view
+{
+ friend class ui_iface_viewmgr;
+ friend class ui_iface_controller;
+
+private:
+ /// View state definition
+ enum ui_view_state
+ {
+ UI_VIEW_STATE_LOAD = 0, ///< Load state
+ UI_VIEW_STATE_UNLOAD, ///< Unload state
+ UI_VIEW_STATE_ACTIVE, ///< Active state
+ UI_VIEW_STATE_INACTIVE, ///< Inactive state
+ UI_VIEW_STATE_PAUSE, ///< Pause state
+ UI_VIEW_STATE_LAST
+ };
+
+ T content; ///< A content instance for a screen as a view.
+ ui_iface_controller *controller; ///< View life-cycle controller interface.
+ string name; ///< View name.
+ string style; ///< View style name.
+ ui_iface_viewmgr *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.
+
+protected:
+
+ /** @brief toggle event block.
+ *
+ * @note This interface is designed for toggling touch event on view transition.
+ * ui_iface_viewmgr will call this interface for notifying event blocking toggling on transition time.
+ *
+ * @param block @c true, when blocking is enabled, otherwise @c false.
+ */
+ virtual void set_event_block(bool block);
+
+ /** @brief view load state.
+ *
+ * @note this state will be triggered by ui_iface_viewmgr.
+ *
+ * @see ui_iface_controller for this state in detail.
+ */
+ virtual void load();
+
+ /** @brief view unload state.
+ *
+ * @note this state will be triggered by ui_iface_viewmgr.
+ *
+ * @see ui_iface_controller for this state in detail.
+ */
+ virtual void unload();
+
+ /** @brief view active state.
+ *
+ * @note this state will be triggered by ui_iface_viewmgr.
+ *
+ * @see ui_iface_controller for this state in detail.
+ */
+ virtual void active();
+
+ /** @brief view inactive state.
+ *
+ * @note this state will be triggered by ui_iface_viewmgr.
+ *
+ * @see ui_iface_controller for this state in detail.
+ */
+ virtual void inactive();
+
+ /** @brief view pause state.
+ *
+ * @note this state will be triggered by ui_iface_viewmgr.
+ *
+ * @see ui_iface_controller for this state in detail.
+ */
+ virtual void pause();
+
+ /** @brief view resume state.
+ *
+ * @note this state will be triggered by ui_iface_viewmgr.
+ *
+ * @see ui_iface_controller for this state in detail.
+ */
+ virtual void resume();
+
+ /** @brief view destroy state.
+ *
+ * @note this state will be triggered by ui_iface_viewmgr.
+ *
+ * @see ui_iface_controller for this state in detail.
+ */
+ virtual void destroy();
+
+ //Make this view's content as NULL, then destroy content.
+ virtual void unload_content() = 0;
+
+ /** @brief Return the state of event block.
+ *
+ * @see set_event_block()
+ */
+ bool get_event_block()
+ {
+ return this->event_block;
+ }
+
+ /// Return a controller of this view.
+ ui_iface_controller* get_controller()
+ {
+ return this->controller;
+ }
+
+ /** @brief Return a viewmgr which this view is belonging to.
+ */
+ ui_iface_viewmgr *get_viewmgr()
+ {
+ return this->viewmgr;
+ }
+
+ /** @brief This is for replacing or setting a controller of the view.
+ *
+ * @return A previous controller. If it wasn't, the return value will be @c NULL.
+ * @note this state will be triggered by ui_iface_viewmgr.
+ * @param controller a new controller. It allows @c NULL for canceling the previous controller.
+ *
+ * @warning Be aware deletion of controller passed here will be taken cover by ui_iface_view.
+ * If you want to keep the controller for any reasons, please unset it using set_controller() before ui_iface_view is deleted.
+ */
+ ui_iface_controller* set_controller(ui_iface_controller *controller);
+
+public:
+ /** @brief This is a constructor for initializing this view resources.
+ *
+ * @param content A content instance for a screen as a view.
+ * @param controller view life-cycle controller interface.
+ * @param name view name.
+ *
+ * @warning Be aware the deletion of controller passed here will be covered by ui_iface_view.
+ * If you want to keep it for any reasons, please unset it using set_controller() before ui_iface_view is deleted.
+ */
+ ui_iface_view(T content, ui_iface_controller *controller, const char *name);
+ ///Constructor for initializing with controller.
+ ui_iface_view(ui_iface_controller *controller, const char *name = NULL);
+ ///Constructor for initializing with name.
+ ui_iface_view(const char *name = NULL);
+
+ ///Destructor for terminating view.
+ virtual ~ui_iface_view();
+
+ /** @brief This is for replacing or setting a content of the view.
+ *
+ * @note @p content is a logical object that represents a view in your framework. The actual type of the content could be translated to any certain types.
+ * For instance, the type could be Evas_Object * in EFL and Layer * in Dali.
+ *
+ * @param content a new content. It allows @c NULL for canceling the previous content.
+ *
+ * @return A previous content. If it wasn't, return value will be @c NULL.
+ */
+ T set_content(T content);
+
+ /** @brief set style of the view.
+ *
+ * @note style is reserved for supporting various kinds of view as well as it's transition effects.
+ * The actual behaviors with this style is up to your frameworks. Default value of the style is NULL.
+ *
+ * @param style a new style name.
+ *
+ * @return true if the given @c style is available, otherwise false.
+ *
+ * @warning When you override this member function, you should implement the logic to check the given style name is available or not.
+ * If your framework doesn't support any styles then just allow a @c NULL argument and return true. Otherwise return false.
+ */
+ bool set_style(const char *style);
+
+ /** @brief set name of the view.
+ *
+ * @note A view can gets a specific name. default value of the name is NULL.
+ *
+ * @param name a new name of view.
+ *
+ * @return true if the given @c name is available, otherwise false.
+ *
+ * @warning When you override this member function, you should check the name duplicate with other view or not.
+ */
+ bool set_name(const char *name);
+
+ /** @brief set content removable.
+ *
+ * @param removable if @p removable is @c true, content of this view will be removed on unload state. @c false otherwise.
+ *
+ * @warning You should not remove a view content manually on unload status if removable content is set.
+ */
+ void set_removable_content(bool removable);
+
+ /** @brief set the indicator of the view with mode.
+ *
+ * @param indicator The mode to set, one of #ui_view_indicator.
+ */
+ void set_indicator(ui_view_indicator indicator);
+
+ /** @brief Return a style name of this view.
+ *
+ * @return style name of view.
+ */
+ const char *get_style()
+ {
+ return this->style.c_str();
+ }
+
+ /** @brief Return a name of this view.
+ *
+ * @return name of view.
+ */
+ const char *get_name()
+ {
+ return this->name.c_str();
+ }
+
+ /** @brief Return a content instance of this view.
+ *
+ * @return content of view.
+ */
+ T get_content()
+ {
+ return this->content;
+ }
+
+ /** @brief Return a state of this view.
+ *
+ * #return current state of view.
+ */
+ ui_view_state get_state()
+ {
+ return this->state;
+ }
+
+
+ /** @brief Return a state of removeable content.
+ *
+ * @return true if the view's content is removable, otherwise false.
+ */
+ bool get_removable_content()
+ {
+ return this->removable_content;
+ }
+
+ /** @brief Return the indicator mode of this view.
+ *
+ * @return indicator state of view.
+ */
+ ui_view_indicator get_indicator()
+ {
+ return this->indicator;
+ }
+};
+
+}
+
+#endif /* UI_VIEW_INTERFACE_H_ */
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 UI_VIEWMGR_INTERFACE_H_
+#define UI_VIEWMGR_INTERFACE_H_
+
+#include <list>
+
+using namespace std;
+
+namespace viewmgr {
+
+class ui_iface_view;
+
+/**
+ * @class ui_iface_viewmgr
+ *
+ * @internal
+ * @ingroup viewmgr
+ *
+ * @brief This is a interface class of viewmgr. One viewmgr represents a window which contains multiple views.
+ * A viewmgr manages not only views life-cycle but constructs basic infrastructures such as key events handling, transition effects, transient views.
+ * This interface guide you a basic policy of a view manager.
+ *
+ * @warning viewmgr will remove all containing views when it's destroyed.
+ */
+class ui_iface_viewmgr
+{
+ friend class ui_iface_view;
+
+private:
+ static bool soft_key; //If system doesn't support HW back key, then this value is @c true.
+ static bool event_block; //Event block on view transition. This value should be configurable by system.
+ list<ui_iface_view*> view_list; //View list.
+ bool activated; //Activated status of this viewmgr.
+
+ /**
+ * @brief Connect a given view to this viewmgr.
+ *
+ * @param view A view to connect to this viewmgr which means the @p view is to belong to this viewmgr.
+ *
+ * @return @c true success or @c false not.
+ *
+ * @warning If the given view is already connected to a viewmgr, this call will be failed.
+ * @see disconnect_view()
+ */
+ bool connect_view(ui_iface_view *view);
+
+ /**
+ * @brief Disconnect a given view from this viewmgr.
+ *
+ * @param view A view to disconnect from this viewmgr.
+ *
+ * @return @c true on success or @c false otherwise.
+ *
+ * @see connect_view()
+ */
+ bool disconnect_view(ui_iface_view *view);
+
+ /**
+ * @brief Toggle event blocking to the given view.
+ *
+ * @note If the event is blocked, product users won't be able to enter any inputs to this @p view. These inputs are mouse clicks, key press,
+ * screen touches, etc. Event if this function is called, @p view will be event-blocked only when system requires event blocking.
+ * Most of the times, This function should be used on transition. @see also push_view(), push_view_finished(), pop_view(), pop_view_finished().
+ *
+ * @param view A view to toggle event blocking.
+ * @param block @c true is blocking event, otherwise @c false.
+ */
+ void set_event_block(ui_iface_view *view, bool block);
+
+protected:
+ /**
+ * @brief This function is designed for finishing process of push transition.
+ *
+ * @param view A view which is finished pushing.
+ *
+ * @return @c true on success or @c false otherwise.
+ *
+ * @warning This function must be called when push transition is finished.
+ */
+ bool push_view_finished(ui_iface_view *view);
+
+ /**
+ * @brief This function is designed for finishing process for pop transition.
+ *
+ * @note If a new view is pushed.
+ *
+ * @param view A view which is finished popping.
+ *
+ * @return @c true on success or @c false otherwise.
+ *
+ * @warning This function must be called when push transition is finished.
+ */
+ bool pop_view_finished(ui_iface_view *view);
+
+#if 0
+ /**
+ * @brief Return a list of views which this viewmgr has.
+ *
+ * @return a pointer of list of views.
+ *
+ * @warning Don't modify this view list.
+ */
+ const list<ui_iface_view*>* const get_view_list()
+ {
+ return &this->view_list;
+ }
+#endif
+
+ /**
+ * @brief Push a new view into this viewmgr. This function is used for when application switches a current view to a new one.
+ *
+ * @note Normally, the current view will be hidden by a new view. In default, when user calls this API, view will be switched to @p view instantly,
+ * only when viewmgr state is activated. Otherwise, the @p view will be shown later when viewmgr is activated. push_view() is designed for providing
+ * view transition effect. If you want push view instantly without any transition, you could use insert_view_before() or insert_view_after().
+ * If you want to pop the current view, the please use pop_view().
+ *
+ * @param view A view to insert at the end of viewmgr view list.
+ *
+ * @return @p view, @c NULL when it fails to push a @p view.
+ *
+ * @see activated()
+ * @see insert_view_before()
+ * @see insert_view_after()
+ * @see pop_view()
+ */
+ ui_iface_view *push_view(ui_iface_view *view);
+
+ /**
+ * @brief Pop the top(last) view from this viewmgr view list.
+ * This function is used for application switches the current view back to the previous view.
+ * The top view will be removed from the view stack and then it will be deleted by the viewmgr.
+ *
+ * @note If the view is just one left, then viewmgr would be deactivated since the ui application might be invalid anymore. Otherwise, the application will
+ * be terminated. It's up to system configuration.
+ *
+ * @return @c true on success or @c false otherwise.
+ *
+ * @see deactivate()
+ * @see push_view()
+ */
+ bool pop_view();
+
+ /**
+ * @brief Insert a view in this viewmgr view list. Specifically, insert a given @p view right before of the given view, @before.
+ *
+ * @param view A view to insert in the viewmgr view list.
+ * @param before A view that will be just inserted after @p view. If you pass @c NULL, @p view will be inserted at the front of the view list.
+ *
+ * @return @c true on success or @c false otherwise.
+ */
+ bool insert_view_before(ui_iface_view *view, ui_iface_view *before);
+
+ /**
+ * @brief Insert a view in this viewmgr view list. Specifically, insert a given @p view right after of the given view, @after.
+ *
+ * @param view A view to insert in the viewmgr view list.
+ * @param after A view that will be just inserted before the @p view. If you pass @c NULL, @p view will be inserted at the end of the view list.
+ *
+ * @return @c true on success or @c false otherwise.
+ */
+ bool insert_view_after(ui_iface_view *view, ui_iface_view *after);
+
+ /**
+ * @brief Remove the given view from this viewmgr view list.
+ *
+ * @param view A view to remove from the viewmgr view list.
+ *
+ * @return @c true on success or @c false otherwise.
+ *
+ * @see insert_view_before()
+ * @see insert_view_after()
+ * @see push_view()
+ */
+ bool remove_view(ui_iface_view *view);
+
+ /**
+ * @brief Return a view which is matched with the index @p idx.
+ *
+ * @param idx A index of the view which you are looking for.
+ *
+ * @return The view which index is matched with @p idx.
+ * If there were no views with index @p idx, @c NULL will be returned.
+ *
+ * @note You could use the index as the page numbers of the views.
+ * @warning the index number of views are variable since the view list is variable.
+ *
+ * @see get_view_index()
+ * @see get_view_count()
+ */
+ ui_iface_view* get_view(unsigned int idx);
+
+ /**
+ * @brief Return a view which is matched with the @p name.
+ *
+ * @note Every view have their names as their own identifiers.
+ *
+ * @param name The name of the view which you are looking for.
+ *
+ * @return The view which name is matched with @p name.
+ * If there were no views name matched, @c NULL will be returned.
+ *
+ * @see ui_iface_view::set_name()
+ */
+ ui_iface_view *get_view(const char *name);
+
+ /**
+ * @brief Return a last(top) view.
+ *
+ * @return The view which is last view of the viewmgr view list.
+ */
+ ui_iface_view *get_last_view();
+
+ /**
+ * @brief Return a view index(page) number of the given view.
+ * You could use this function to query the given @p view list order.
+ *
+ * @param view A view to query the index.
+ *
+ * @return An index of the give @p view on success, otherwise, -1.
+ *
+ * @warning The index number of views are variable since the view list is variable.
+ */
+ int get_view_index(const ui_iface_view *view);
+
+public:
+ ///Constructor.
+ ui_iface_viewmgr();
+
+ ///Destructor.
+ virtual ~ui_iface_viewmgr();
+
+ /**
+ * @brief Activate this view manager.
+ *
+ * @note viewmgr window and views will be shown once activate() is called. Usually this activate() should be called after applications set their all views
+ * on initialization time.
+ *
+ * @return @c true on success or @c false otherwise.
+ *
+ * @see deactivate()
+ */
+ bool activate();
+
+ /**
+ * @brief Deactivate this view manager.
+ *
+ * @note viewmgr window and views will be hidden once deactivate() is called. deactivate() behavior is up ui system, but usually it hides(unmap)
+ * current window in order that application go background.
+ *
+ * @return @c true success or @c false not.
+ *
+ * @see activate()
+ */
+ bool deactivate();
+
+ /**
+ * @brief Return the active status of viewmgr.
+ *
+ * @return @c true if viewmgr is active, @c false otherwise.
+ *
+ * @see activate()
+ * @see deactivate()
+ */
+ bool is_activated();
+
+ /**
+ * @brief Return the number of views which this viewmgr has.
+ *
+ * @return the number of view
+ */
+ unsigned int get_view_count();
+
+ /**
+ * @brief Return whether soft key is required or not.
+ *
+ * @note Soft key is kind of like the software back button. It's used for product users to change current view to a previous view (pop).
+ * If a device doesn't have any hardware back buttons, Soft back key is necessary which means this function will return @c true.
+ * Some devices may needs software back key as well as hardware back key at the same time. That decision is up to product design.
+ * And soft_key initial value should read from the system configuration.
+ *
+ * @return @c true if soft key is required, @c false otherwise.
+ */
+ static bool need_soft_key();
+};
+
+}
+
+#endif /* UI_VIEWMGR_INTERFACE_H_ */
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 UI_VIEWMANAGER_INTERFACE_H_
+#define UI_VIEWMANAGER_INTERFACE_H_
+
+#include <app.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "UI_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_SHOW,
+ UI_VIEW_INDICATOR_LAST
+};
+
+#include "ui_iface_viewmgr.h"
+#include "ui_iface_view.h"
+#include "ui_iface_controller.h"
+
+#endif /* UI_VIEWMANAGER_INTERFACE_H */
--- /dev/null
+#include "efl/mobile/ui_viewmanager_mobile.h"
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 "ui_viewmanager_interface.h"
-
-using namespace viewmgr;
-
-void ui_iface_controller::set_view(ui_iface_view *view)
-{
- if (this->view)
- {
- this->view->set_controller(NULL);
- }
- this->view = view;
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 UI_CONTROLLER_INTERFACE_H_
-#define UI_CONTROLLER_INTERFACE_H_
-
-namespace viewmgr {
-
-class ui_iface_view;
-
-/**
- * @class ui_iface_controller.
- *
- * @internal
- * @ingroup viewmgr
- *
- * @brief UI Controller Interface. This interface is designed for handling of life-cycle events from user side.
- */
-class ui_iface_controller
-{
- friend class ui_iface_view;
-
-private:
- ui_iface_view *view;
-
- void set_view(ui_iface_view *view);
-
-protected:
- /**
- * @brief Return a view which is matched with controller
- *
- * @return The view which is matched with controller
- *
- * @note User can set a controller 2 ways, 1. send a controller instance when view created,
- * 2. call set_view() method with controller instance.
- *
- * @see set_view()
- */
- ui_iface_view *get_view()
- {
- return this->view;
- }
-
-public:
- ///Constructor.
- ui_iface_controller() :
- view(NULL)
- {
- }
-
- ///Destructor.
- virtual ~ui_iface_controller()
- {
- }
-
- /** @brief load callback.
- *
- * @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;
-
- /** @brief unload callback.
- *
- * @note Remove resources with regards to this view for saving memory or keep the content for performance. It's up to your scenario.
- * Unload will be called just right before when the view is going to be deleted by popping or it's piled under the more than one view.
- * 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;
-
- /** @brief active callback.
- *
- * @note View is on active state after show transition is finished.
- * 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;
-
- /** @brief inactive callback.
- *
- * @note View is on inactive state. Get ready for unload. Hide transition may be triggered at this point.
- * Inactive state is triggered on this scenario that the view is still visible but it's not interactive with users.
- * 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;
-
- /** @brief pause callback.
- *
- * @note When the system blocks the application running in cases such as phone call, system notification, switching applications ...
- * 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;
-
- /** @brief resume callback.
- *
- * @note View is turning back to the active state again from pause.
- * When the system allows the application turns to activate.
- * When the Window turns to activate. (@see ui_viewmgr_base :: activate())
- */
- virtual void resume() = 0;
-
- /** @brief destroy callback.
- *
- * @note When this view is on destroying by popping or deleting.
- */
- virtual void destroy() = 0;
-};
-
-}
-
-#endif /* UI_CONTROLLER_INTERFACE_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 "ui_viewmanager_interface.h"
-
-using namespace viewmgr;
-
-void ui_iface_view::set_event_block(bool block)
-{
- this->event_block = block;
-}
-
-void ui_iface_view::load()
-{
- this->state = UI_VIEW_STATE_LOAD;
- if (this->content) return;
- if (!this->controller) return;
- this->controller->load();
-}
-
-void ui_iface_view::unload()
-{
- this->state = UI_VIEW_STATE_UNLOAD;
- if (this->get_removable_content())
- {
- this->unload_content();
- return;
- }
- if (!this->content) return;
- if (!this->controller) return;
- this->controller->unload();
-}
-
-void ui_iface_view::active()
-{
- this->state = UI_VIEW_STATE_ACTIVE;
- if (!this->controller) return;
- this->controller->active();
-}
-
-void ui_iface_view::inactive()
-{
- this->state = UI_VIEW_STATE_INACTIVE;
- if (!this->controller) return;
- this->controller->inactive();
-}
-
-void ui_iface_view::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();
-}
-
-void ui_iface_view::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();
-}
-
-void ui_iface_view::destroy()
-{
- if (!this->controller) return;
- this->controller->destroy();
-}
-
-ui_iface_view::ui_iface_view(T content, ui_iface_controller *controller, const char *name)
- : content(content), controller(controller), name(string(name ? name : "")), style(string("")), viewmgr(NULL), state(UI_VIEW_STATE_LOAD),
- 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;
- controller->set_view(this);
-}
-
-ui_iface_view::ui_iface_view(ui_iface_controller *controller, const char *name)
- : ui_iface_view(NULL, controller, name)
-{
- this->state = UI_VIEW_STATE_UNLOAD;
-}
-
-ui_iface_view::ui_iface_view(const char *name)
- : ui_iface_view(NULL, name)
-{
-
-}
-
-ui_iface_view::~ui_iface_view()
-{
- this->viewmgr->remove_view(this);
- if (this->controller) delete (this->controller);
-}
-
-ui_iface_controller* ui_iface_view::set_controller(ui_iface_controller *controller)
-{
- ui_iface_controller *prev_controller = this->controller;
- this->controller = controller;
- if (controller) controller->set_view(this);
- if (prev_controller) prev_controller->set_view(NULL);
- return prev_controller;
-}
-
-T ui_iface_view::set_content(T content)
-{
- T prev = this->content;
- this->content = content;
- return prev;
-}
-
-bool ui_iface_view::set_style(const char *style)
-{
- this->style.assign(style);
- return true;
-}
-
-bool ui_iface_view::set_name(const char *name)
-{
- this->name.assign(name);
- return true;
-}
-
-void ui_iface_view::set_removable_content(bool removable)
-{
- this->removable_content = removable;
-
- //FIXME: If this api is called on unload state? should we remove content right now?
-}
-
-void ui_iface_view::set_indicator(ui_view_indicator indicator)
-{
- this->indicator = indicator;
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 UI_VIEW_INTERFACE_H_
-#define UI_VIEW_INTERFACE_H_
-
-#include <string>
-
-using namespace std;
-
-typedef void* T;
-
-namespace viewmgr {
-
-class ui_iface_viewmgr;
-class ui_iface_controller;
-
-/**
- * @class ui_iface_view
- *
- * @internal
- * @ingroup viewmgr
- *
- * @brief UI View Base Class. This is the base class of view. A view must have one content instance which represents a view for a current screen.
- * UI View may have it's own show/hide transition styles. That means, it's available that views have different show/hide effects on demands.
- * It's not mandatory but view should describe the transitions in this class.
- *
- * @warning When the transitions are finished, the view must to call ui_iface_viewmgr :: _push_finished(), ui_iface_viewmgr :: _pop_finished() in order that
- * The ui_iface_viewmgr keeps the view states exactly.
- */
-class ui_iface_view
-{
- friend class ui_iface_viewmgr;
- friend class ui_iface_controller;
-
-private:
- /// View state definition
- enum ui_view_state
- {
- UI_VIEW_STATE_LOAD = 0, ///< Load state
- UI_VIEW_STATE_UNLOAD, ///< Unload state
- UI_VIEW_STATE_ACTIVE, ///< Active state
- UI_VIEW_STATE_INACTIVE, ///< Inactive state
- UI_VIEW_STATE_PAUSE, ///< Pause state
- UI_VIEW_STATE_LAST
- };
-
- T content; ///< A content instance for a screen as a view.
- ui_iface_controller *controller; ///< View life-cycle controller interface.
- string name; ///< View name.
- string style; ///< View style name.
- ui_iface_viewmgr *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.
-
-protected:
-
- /** @brief toggle event block.
- *
- * @note This interface is designed for toggling touch event on view transition.
- * ui_iface_viewmgr will call this interface for notifying event blocking toggling on transition time.
- *
- * @param block @c true, when blocking is enabled, otherwise @c false.
- */
- virtual void set_event_block(bool block);
-
- /** @brief view load state.
- *
- * @note this state will be triggered by ui_iface_viewmgr.
- *
- * @see ui_iface_controller for this state in detail.
- */
- virtual void load();
-
- /** @brief view unload state.
- *
- * @note this state will be triggered by ui_iface_viewmgr.
- *
- * @see ui_iface_controller for this state in detail.
- */
- virtual void unload();
-
- /** @brief view active state.
- *
- * @note this state will be triggered by ui_iface_viewmgr.
- *
- * @see ui_iface_controller for this state in detail.
- */
- virtual void active();
-
- /** @brief view inactive state.
- *
- * @note this state will be triggered by ui_iface_viewmgr.
- *
- * @see ui_iface_controller for this state in detail.
- */
- virtual void inactive();
-
- /** @brief view pause state.
- *
- * @note this state will be triggered by ui_iface_viewmgr.
- *
- * @see ui_iface_controller for this state in detail.
- */
- virtual void pause();
-
- /** @brief view resume state.
- *
- * @note this state will be triggered by ui_iface_viewmgr.
- *
- * @see ui_iface_controller for this state in detail.
- */
- virtual void resume();
-
- /** @brief view destroy state.
- *
- * @note this state will be triggered by ui_iface_viewmgr.
- *
- * @see ui_iface_controller for this state in detail.
- */
- virtual void destroy();
-
- //Make this view's content as NULL, then destroy content.
- virtual void unload_content() = 0;
-
- /** @brief Return the state of event block.
- *
- * @see set_event_block()
- */
- bool get_event_block()
- {
- return this->event_block;
- }
-
- /// Return a controller of this view.
- ui_iface_controller* get_controller()
- {
- return this->controller;
- }
-
- /** @brief Return a viewmgr which this view is belonging to.
- */
- ui_iface_viewmgr *get_viewmgr()
- {
- return this->viewmgr;
- }
-
- /** @brief This is for replacing or setting a controller of the view.
- *
- * @return A previous controller. If it wasn't, the return value will be @c NULL.
- * @note this state will be triggered by ui_iface_viewmgr.
- * @param controller a new controller. It allows @c NULL for canceling the previous controller.
- *
- * @warning Be aware deletion of controller passed here will be taken cover by ui_iface_view.
- * If you want to keep the controller for any reasons, please unset it using set_controller() before ui_iface_view is deleted.
- */
- ui_iface_controller* set_controller(ui_iface_controller *controller);
-
-public:
- /** @brief This is a constructor for initializing this view resources.
- *
- * @param content A content instance for a screen as a view.
- * @param controller view life-cycle controller interface.
- * @param name view name.
- *
- * @warning Be aware the deletion of controller passed here will be covered by ui_iface_view.
- * If you want to keep it for any reasons, please unset it using set_controller() before ui_iface_view is deleted.
- */
- ui_iface_view(T content, ui_iface_controller *controller, const char *name);
- ///Constructor for initializing with controller.
- ui_iface_view(ui_iface_controller *controller, const char *name = NULL);
- ///Constructor for initializing with name.
- ui_iface_view(const char *name = NULL);
-
- ///Destructor for terminating view.
- virtual ~ui_iface_view();
-
- /** @brief This is for replacing or setting a content of the view.
- *
- * @note @p content is a logical object that represents a view in your framework. The actual type of the content could be translated to any certain types.
- * For instance, the type could be Evas_Object * in EFL and Layer * in Dali.
- *
- * @param content a new content. It allows @c NULL for canceling the previous content.
- *
- * @return A previous content. If it wasn't, return value will be @c NULL.
- */
- T set_content(T content);
-
- /** @brief set style of the view.
- *
- * @note style is reserved for supporting various kinds of view as well as it's transition effects.
- * The actual behaviors with this style is up to your frameworks. Default value of the style is NULL.
- *
- * @param style a new style name.
- *
- * @return true if the given @c style is available, otherwise false.
- *
- * @warning When you override this member function, you should implement the logic to check the given style name is available or not.
- * If your framework doesn't support any styles then just allow a @c NULL argument and return true. Otherwise return false.
- */
- bool set_style(const char *style);
-
- /** @brief set name of the view.
- *
- * @note A view can gets a specific name. default value of the name is NULL.
- *
- * @param name a new name of view.
- *
- * @return true if the given @c name is available, otherwise false.
- *
- * @warning When you override this member function, you should check the name duplicate with other view or not.
- */
- bool set_name(const char *name);
-
- /** @brief set content removable.
- *
- * @param removable if @p removable is @c true, content of this view will be removed on unload state. @c false otherwise.
- *
- * @warning You should not remove a view content manually on unload status if removable content is set.
- */
- void set_removable_content(bool removable);
-
- /** @brief set the indicator of the view with mode.
- *
- * @param indicator The mode to set, one of #ui_view_indicator.
- */
- void set_indicator(ui_view_indicator indicator);
-
- /** @brief Return a style name of this view.
- *
- * @return style name of view.
- */
- const char *get_style()
- {
- return this->style.c_str();
- }
-
- /** @brief Return a name of this view.
- *
- * @return name of view.
- */
- const char *get_name()
- {
- return this->name.c_str();
- }
-
- /** @brief Return a content instance of this view.
- *
- * @return content of view.
- */
- T get_content()
- {
- return this->content;
- }
-
- /** @brief Return a state of this view.
- *
- * #return current state of view.
- */
- ui_view_state get_state()
- {
- return this->state;
- }
-
-
- /** @brief Return a state of removeable content.
- *
- * @return true if the view's content is removable, otherwise false.
- */
- bool get_removable_content()
- {
- return this->removable_content;
- }
-
- /** @brief Return the indicator mode of this view.
- *
- * @return indicator state of view.
- */
- ui_view_indicator get_indicator()
- {
- return this->indicator;
- }
-};
-
-}
-
-#endif /* UI_VIEW_INTERFACE_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 "ui_viewmanager_interface.h"
-
-using namespace viewmgr;
-
-//FIXME: Read system profile to decide whether support software key or not.
-bool ui_iface_viewmgr::soft_key = true;
-//FIXME: Read system profile to decide whether support event block or not.
-bool ui_iface_viewmgr::event_block = true;
-
-bool ui_iface_viewmgr::need_soft_key()
-{
- return ui_iface_viewmgr::soft_key;
-}
-
-bool ui_iface_viewmgr::connect_view(ui_iface_view *view)
-{
- if (view->viewmgr)
- {
- LOGE("view(%p) has already connected to viewmgr(%p)", view, this);
- return false;
- }
-
- view->viewmgr = this;
- return true;
-}
-
-bool ui_iface_viewmgr::disconnect_view(ui_iface_view *view)
-{
- if (!view->viewmgr) return false;
- view->viewmgr = NULL;
- return true;
-}
-
-void ui_iface_viewmgr::set_event_block(ui_iface_view *view, bool block)
-{
-
- if (!ui_iface_viewmgr::event_block) return;
- view->set_event_block(block);
-}
-
-bool ui_iface_viewmgr::push_view_finished(ui_iface_view *view)
-{
- ui_iface_view *last = this->view_list.back();
-
- //The previous view has been pushed. This should be unload.
- if (last != view)
- {
- view->unload();
- return true;
- }
-
- //A new view has been pushed. This should be active.
- view->active();
- this->set_event_block(view, true);
-
- return true;
-}
-
-bool ui_iface_viewmgr::pop_view_finished(ui_iface_view *view)
-{
- ui_iface_view *last = this->view_list.back();
-
- //This view has been popped. It should be destroyed.
- if (last == view)
- {
- view->unload();
- view->destroy();
- delete (view);
- return true;
- }
-
- //The previous view has been popped. It should become active.
- view->active();
- this->set_event_block(view, true);
-
- return true;
-}
-
-ui_iface_viewmgr::ui_iface_viewmgr()
- : activated(false)
-{
-}
-
-ui_iface_viewmgr::~ui_iface_viewmgr()
-{
- //Terminate views
- 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();
- delete (view);
- }
-
- //FIXME: Window is destroyed. Terminate Application!
- ui_app_exit();
-}
-
-ui_iface_view *
-ui_iface_viewmgr::push_view(ui_iface_view *view)
-{
- if (!view)
- {
- LOGE("invalid view argument. view(NULL)");
- return NULL;
- }
-
- if (!this->connect_view(view))
- {
- LOGE("connect view failed");
- return NULL;
- }
-
- ui_iface_view *pview;
-
- //Previous view
- if (this->view_list.size())
- {
- pview = this->view_list.back();
- pview->inactive();
- this->set_event_block(pview, true);
-
- //FIXME: Since we have no transition
- pview->unload();
- }
-
- view_list.push_back(view);
-
- if (!view->get_content())
- {
- view->load();
- }
-
- view->inactive();
- this->set_event_block(view, true);
-
- return view;
-}
-
-bool ui_iface_viewmgr::pop_view()
-{
- //No more view? destroy viewmgr?
- if (this->get_view_count() == 0)
- {
- return false;
- }
-
- //This is the last page. destroy viewmgr?
- if (this->get_view_count() == 1)
- {
- //destroy viewmgr?
- ui_iface_view *view = this->view_list.back();
- view->inactive();
- view->unload();
- view->destroy();
- delete(view);
-
- return false;
- }
-
- //last page to be popped.
- ui_iface_view *view = this->view_list.back();
- view->inactive();
- this->set_event_block(view, true);
-
- //Below object has to be used in child class...
- //Make this getter method? or define instance?
- //previous page to be current active.
- auto nx = std::prev(this->view_list.end(), 2);
- ui_iface_view *pview = *nx;
- pview->load();
- pview->inactive();
- this->set_event_block(pview, true);
-
- //FIXME: since we have no transition effect
- pview->active();
- view->inactive();
- view->unload();
- view->destroy();
- delete (view);
-
- return true;
-}
-
-bool ui_iface_viewmgr::insert_view_before(ui_iface_view *view, ui_iface_view *before)
-{
- //TODO: ...
- return true;
-}
-
-bool ui_iface_viewmgr::insert_view_after(ui_iface_view *view, ui_iface_view *after)
-{
- //TODO: ...
- return true;
-}
-
-bool ui_iface_viewmgr::remove_view(ui_iface_view *view)
-{
- this->view_list.remove(view);
- this->disconnect_view(view);
-
- //TODO: If this view is the top on the stack ?
- return true;
-}
-
-ui_iface_view*
-ui_iface_viewmgr::get_view(unsigned int idx)
-{
- if (idx < 0 || idx >= this->view_list.size())
- {
- LOGE("Invalid idx(%d)! =? (idx range: %d ~ %d)", idx, 0, this->view_list.size() - 1);
- return NULL;
- }
- typename std::list<ui_iface_view*>::iterator it = this->view_list.begin();
- std::advance(it, idx);
- return *it;
-}
-
-int ui_iface_viewmgr::get_view_index(const ui_iface_view *view)
-{
- int idx = 0;
-
- for (typename std::list<ui_iface_view*>::iterator it = this->view_list.begin(); it != this->view_list.end(); it++)
- {
- if (view == *it) return idx;
- ++idx;
- }
-
- return -1;
-}
-
-ui_iface_view *
-ui_iface_viewmgr::get_last_view()
-{
- int cnt = this->get_view_count();
- return this->get_view(cnt - 1);
-}
-
-bool ui_iface_viewmgr::activate()
-{
- if (this->activated) return false;
- this->activated = true;
- return true;
-}
-
-bool ui_iface_viewmgr::deactivate()
-{
- if (!this->activated) return false;
- this->activated = false;
- return true;
-}
-
-ui_iface_view *ui_iface_viewmgr::get_view(const char *name)
-{
- //FIXME: ...
- return NULL;
-}
-
-bool ui_iface_viewmgr::is_activated()
-{
- return this->activated;
-}
-
-unsigned int ui_iface_viewmgr::get_view_count()
-{
- return this->view_list.size();
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 UI_VIEWMGR_INTERFACE_H_
-#define UI_VIEWMGR_INTERFACE_H_
-
-#include <list>
-
-using namespace std;
-
-namespace viewmgr {
-
-class ui_iface_view;
-
-/**
- * @class ui_iface_viewmgr
- *
- * @internal
- * @ingroup viewmgr
- *
- * @brief This is a interface class of viewmgr. One viewmgr represents a window which contains multiple views.
- * A viewmgr manages not only views life-cycle but constructs basic infrastructures such as key events handling, transition effects, transient views.
- * This interface guide you a basic policy of a view manager.
- *
- * @warning viewmgr will remove all containing views when it's destroyed.
- */
-class ui_iface_viewmgr
-{
- friend class ui_iface_view;
-
-private:
- static bool soft_key; //If system doesn't support HW back key, then this value is @c true.
- static bool event_block; //Event block on view transition. This value should be configurable by system.
- list<ui_iface_view*> view_list; //View list.
- bool activated; //Activated status of this viewmgr.
-
- /**
- * @brief Connect a given view to this viewmgr.
- *
- * @param view A view to connect to this viewmgr which means the @p view is to belong to this viewmgr.
- *
- * @return @c true success or @c false not.
- *
- * @warning If the given view is already connected to a viewmgr, this call will be failed.
- * @see disconnect_view()
- */
- bool connect_view(ui_iface_view *view);
-
- /**
- * @brief Disconnect a given view from this viewmgr.
- *
- * @param view A view to disconnect from this viewmgr.
- *
- * @return @c true on success or @c false otherwise.
- *
- * @see connect_view()
- */
- bool disconnect_view(ui_iface_view *view);
-
- /**
- * @brief Toggle event blocking to the given view.
- *
- * @note If the event is blocked, product users won't be able to enter any inputs to this @p view. These inputs are mouse clicks, key press,
- * screen touches, etc. Event if this function is called, @p view will be event-blocked only when system requires event blocking.
- * Most of the times, This function should be used on transition. @see also push_view(), push_view_finished(), pop_view(), pop_view_finished().
- *
- * @param view A view to toggle event blocking.
- * @param block @c true is blocking event, otherwise @c false.
- */
- void set_event_block(ui_iface_view *view, bool block);
-
-protected:
- /**
- * @brief This function is designed for finishing process of push transition.
- *
- * @param view A view which is finished pushing.
- *
- * @return @c true on success or @c false otherwise.
- *
- * @warning This function must be called when push transition is finished.
- */
- bool push_view_finished(ui_iface_view *view);
-
- /**
- * @brief This function is designed for finishing process for pop transition.
- *
- * @note If a new view is pushed.
- *
- * @param view A view which is finished popping.
- *
- * @return @c true on success or @c false otherwise.
- *
- * @warning This function must be called when push transition is finished.
- */
- bool pop_view_finished(ui_iface_view *view);
-
-#if 0
- /**
- * @brief Return a list of views which this viewmgr has.
- *
- * @return a pointer of list of views.
- *
- * @warning Don't modify this view list.
- */
- const list<ui_iface_view*>* const get_view_list()
- {
- return &this->view_list;
- }
-#endif
-
- /**
- * @brief Push a new view into this viewmgr. This function is used for when application switches a current view to a new one.
- *
- * @note Normally, the current view will be hidden by a new view. In default, when user calls this API, view will be switched to @p view instantly,
- * only when viewmgr state is activated. Otherwise, the @p view will be shown later when viewmgr is activated. push_view() is designed for providing
- * view transition effect. If you want push view instantly without any transition, you could use insert_view_before() or insert_view_after().
- * If you want to pop the current view, the please use pop_view().
- *
- * @param view A view to insert at the end of viewmgr view list.
- *
- * @return @p view, @c NULL when it fails to push a @p view.
- *
- * @see activated()
- * @see insert_view_before()
- * @see insert_view_after()
- * @see pop_view()
- */
- ui_iface_view *push_view(ui_iface_view *view);
-
- /**
- * @brief Pop the top(last) view from this viewmgr view list.
- * This function is used for application switches the current view back to the previous view.
- * The top view will be removed from the view stack and then it will be deleted by the viewmgr.
- *
- * @note If the view is just one left, then viewmgr would be deactivated since the ui application might be invalid anymore. Otherwise, the application will
- * be terminated. It's up to system configuration.
- *
- * @return @c true on success or @c false otherwise.
- *
- * @see deactivate()
- * @see push_view()
- */
- bool pop_view();
-
- /**
- * @brief Insert a view in this viewmgr view list. Specifically, insert a given @p view right before of the given view, @before.
- *
- * @param view A view to insert in the viewmgr view list.
- * @param before A view that will be just inserted after @p view. If you pass @c NULL, @p view will be inserted at the front of the view list.
- *
- * @return @c true on success or @c false otherwise.
- */
- bool insert_view_before(ui_iface_view *view, ui_iface_view *before);
-
- /**
- * @brief Insert a view in this viewmgr view list. Specifically, insert a given @p view right after of the given view, @after.
- *
- * @param view A view to insert in the viewmgr view list.
- * @param after A view that will be just inserted before the @p view. If you pass @c NULL, @p view will be inserted at the end of the view list.
- *
- * @return @c true on success or @c false otherwise.
- */
- bool insert_view_after(ui_iface_view *view, ui_iface_view *after);
-
- /**
- * @brief Remove the given view from this viewmgr view list.
- *
- * @param view A view to remove from the viewmgr view list.
- *
- * @return @c true on success or @c false otherwise.
- *
- * @see insert_view_before()
- * @see insert_view_after()
- * @see push_view()
- */
- bool remove_view(ui_iface_view *view);
-
- /**
- * @brief Return a view which is matched with the index @p idx.
- *
- * @param idx A index of the view which you are looking for.
- *
- * @return The view which index is matched with @p idx.
- * If there were no views with index @p idx, @c NULL will be returned.
- *
- * @note You could use the index as the page numbers of the views.
- * @warning the index number of views are variable since the view list is variable.
- *
- * @see get_view_index()
- * @see get_view_count()
- */
- ui_iface_view* get_view(unsigned int idx);
-
- /**
- * @brief Return a view which is matched with the @p name.
- *
- * @note Every view have their names as their own identifiers.
- *
- * @param name The name of the view which you are looking for.
- *
- * @return The view which name is matched with @p name.
- * If there were no views name matched, @c NULL will be returned.
- *
- * @see ui_iface_view::set_name()
- */
- ui_iface_view *get_view(const char *name);
-
- /**
- * @brief Return a last(top) view.
- *
- * @return The view which is last view of the viewmgr view list.
- */
- ui_iface_view *get_last_view();
-
- /**
- * @brief Return a view index(page) number of the given view.
- * You could use this function to query the given @p view list order.
- *
- * @param view A view to query the index.
- *
- * @return An index of the give @p view on success, otherwise, -1.
- *
- * @warning The index number of views are variable since the view list is variable.
- */
- int get_view_index(const ui_iface_view *view);
-
-public:
- ///Constructor.
- ui_iface_viewmgr();
-
- ///Destructor.
- virtual ~ui_iface_viewmgr();
-
- /**
- * @brief Activate this view manager.
- *
- * @note viewmgr window and views will be shown once activate() is called. Usually this activate() should be called after applications set their all views
- * on initialization time.
- *
- * @return @c true on success or @c false otherwise.
- *
- * @see deactivate()
- */
- bool activate();
-
- /**
- * @brief Deactivate this view manager.
- *
- * @note viewmgr window and views will be hidden once deactivate() is called. deactivate() behavior is up ui system, but usually it hides(unmap)
- * current window in order that application go background.
- *
- * @return @c true success or @c false not.
- *
- * @see activate()
- */
- bool deactivate();
-
- /**
- * @brief Return the active status of viewmgr.
- *
- * @return @c true if viewmgr is active, @c false otherwise.
- *
- * @see activate()
- * @see deactivate()
- */
- bool is_activated();
-
- /**
- * @brief Return the number of views which this viewmgr has.
- *
- * @return the number of view
- */
- unsigned int get_view_count();
-
- /**
- * @brief Return whether soft key is required or not.
- *
- * @note Soft key is kind of like the software back button. It's used for product users to change current view to a previous view (pop).
- * If a device doesn't have any hardware back buttons, Soft back key is necessary which means this function will return @c true.
- * Some devices may needs software back key as well as hardware back key at the same time. That decision is up to product design.
- * And soft_key initial value should read from the system configuration.
- *
- * @return @c true if soft key is required, @c false otherwise.
- */
- static bool need_soft_key();
-};
-
-}
-
-#endif /* UI_VIEWMGR_INTERFACE_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 UI_VIEWMANAGER_INTERFACE_H_
-#define UI_VIEWMANAGER_INTERFACE_H_
-
-#include <app.h>
-#include <dlog.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "UI_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_SHOW,
- UI_VIEW_INDICATOR_LAST
-};
-
-#include "ui_iface_viewmgr.h"
-#include "ui_iface_view.h"
-#include "ui_iface_controller.h"
-
-#endif /* UI_VIEWMANAGER_INTERFACE_H */
--- /dev/null
+SET(LIB_SRCS
+ interface/ui_iface_controller.cpp
+ interface/ui_iface_view.cpp
+ interface/ui_iface_viewmgr.cpp
+ efl/ui_controller.cpp
+ efl/ui_view.cpp
+ efl/ui_viewmgr.cpp
+ efl/ui_key_listener.cpp
+ efl/mobile/ui_basic_controller.cpp
+ efl/mobile/ui_basic_view.cpp
+ efl/mobile/ui_basic_key_listener.cpp
+ efl/mobile/ui_basic_viewmgr.cpp
+ )
+
+ADD_LIBRARY(${LIB_NAME} SHARED ${LIB_SRCS})
+
+ADD_DEFINITIONS("-DEXPORT_API=__attribute__((visibility(\"default\")))")
+PKG_CHECK_MODULES(LIB_PKGS REQUIRED elementary efl-extension dlog capi-appfw-application capi-system-system-settings appcore-efl capi-appfw-app-manager)
+
+FOREACH(flag ${LIB_PKGS_CFLAGS})
+ SET(LIB_CFLAGS "${LIB_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES COMPILE_FLAGS "${LIB_CFLAGS}")
+SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${VERSION})
+SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
+TARGET_LINK_LIBRARIES(${LIB_NAME} ${LIB_PKGS_LDFLAGS} ${LIB_TARGET_PKGS_LDFLAGS})
+
+SET(GC_SECTIONS_FLAGS "-fdata-sections -ffunction-sections -Wl,--gc-sections")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PKG_CFLAGS} -Wall -Werror -Wno-unused -Wno-format-extra-args -Wl,--no-undefined -fvisibility=hidden -fPIC -std=c++0x ${GC_SECTIONS_FLAGS}")
+
+INSTALL(TARGETS ${LIB_NAME} DESTINATION lib)
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "../../../include/efl/mobile/ui_viewmanager_mobile.h"
+
+using namespace efl_viewmgr;
+using namespace viewmgr;
+
+ui_basic_controller::~ui_basic_controller()
+{
+}
+
+bool ui_basic_controller::menu()
+{
+ return true;
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "../../../include/efl/mobile/ui_viewmanager_mobile.h"
+
+using namespace efl_viewmgr;
+using namespace viewmgr;
+
+static const char *KEY_MENU = "XF86Menu";
+
+enum ui_key_event_type
+{
+ UI_KEY_EVENT_MENU
+};
+
+ui_basic_key_listener::ui_basic_key_listener(ui_viewmgr *viewmgr)
+ : ui_key_listener(viewmgr)
+{
+}
+
+void ui_basic_key_listener::extend_event_proc(ui_view *view, Evas_Event_Key_Down *ev)
+{
+ if (strcmp(ev->keyname, KEY_MENU)) return;
+ dynamic_cast<ui_basic_view *>(view)->menu();
+}
+
+bool ui_basic_key_listener::init()
+{
+ if (!ui_key_listener::init()) return false;
+
+ if (!evas_object_key_grab(this->key_grabber, KEY_MENU, 0, 0, EINA_FALSE))
+ {
+ LOGE("Failed to grab MENU KEY(%s)\n", KEY_MENU);
+ return false;
+ }
+ return true;
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "../../../include/efl/mobile/ui_viewmanager_mobile.h"
+
+//FIXME: is it correct to define here?
+//#define EDJ_PATH "/opt/usr/apps/org.tizen.ui-viewmgr/res/ui-viewmgr.edj"
+#define EDJ_PATH "/usr/share/edje/ui-viewmgr/ui-viewmgr.edj"
+#define GROUP "elm/layout/tizen_view/default"
+#define TOOLBAR "elm/layout/tizen_view/toolbar"
+
+using namespace efl_viewmgr;
+using namespace viewmgr;
+
+bool ui_basic_view::destroy_layout()
+{
+ if (!this->layout) return false;
+ evas_object_del(this->layout);
+ this->layout = NULL;
+
+ return true;
+}
+
+bool ui_basic_view::create_layout()
+{
+ if (this->layout) return false;
+
+ Evas_Object *layout = elm_layout_add(this->get_parent());
+
+ if (!layout)
+ {
+ LOGE("Failed to create a layout = ui_basic_view(%p)", this);
+ return false;
+ }
+
+ if (!elm_layout_file_set(layout, EDJ_PATH, GROUP))
+ {
+ LOGE("Failed to set file = ui_basic_view(%p), path(%s), group(%s)", this, EDJ_PATH, GROUP);
+ evas_object_del(layout);
+ return false;
+ }
+ 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);
+
+ if (this->get_content())
+ {
+ elm_object_part_content_set(layout, "elm.swallow.content", CONVERT_TO_EO(this->get_content()));
+ }
+
+ //Set software back key, if it's needed
+ ui_viewmgr *viewmgr = dynamic_cast<ui_viewmgr *>(ui_iface_view::get_viewmgr());
+ if (viewmgr->need_soft_key())
+ {
+ Evas_Object *prev_btn = elm_button_add(layout);
+
+ if (!prev_btn)
+ {
+ LOGE("Failed to create a button = ui_basic_view(%p)", this);
+ }
+ else
+ {
+ evas_object_smart_callback_add(prev_btn, "clicked", [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ ui_viewmgr *viewmgr = static_cast<ui_viewmgr *>(data);
+ viewmgr->pop_view();
+ }, viewmgr);
+
+ elm_object_style_set(prev_btn, "tizen_view/prev_btn");
+ elm_object_part_content_set(layout, "elm.swallow.prev_btn", prev_btn);
+ elm_object_signal_emit(layout, "elm,state,prev_btn,show", "elm");
+ }
+ }
+
+ this->layout = layout;
+
+ return true;
+}
+
+ui_basic_view::ui_basic_view(ui_controller *controller, const char *name)
+ : ui_view(controller, name), layout(NULL)
+{
+}
+
+ui_basic_view::~ui_basic_view()
+{
+ destroy_layout();
+}
+
+void ui_basic_view::load()
+{
+ this->create_layout();
+ ui_view::load();
+}
+
+void ui_basic_view::unload()
+{
+ ui_view::unload();
+}
+
+Evas_Object *
+ui_basic_view::set_content(Evas_Object *content, const char *title)
+{
+ Evas_Object *pcontent = ui_view::set_content(content);
+
+ if (this->layout)
+ {
+ elm_object_part_content_unset(this->layout, "elm.swallow.content");
+ elm_object_part_content_set(this->layout, "elm.swallow.content", content);
+ elm_object_part_text_set(this->layout, "elm.text.title", title);
+ }
+ else
+ {
+ LOGE("Layout is not exist!");
+ }
+
+ return pcontent;
+}
+
+bool ui_basic_view::set_subtitle(const char *text)
+{
+ if (this->layout)
+ {
+ elm_object_part_text_set(this->layout, "elm.text.subtitle", text);
+ if (text) elm_object_signal_emit(this->layout, "elm,state,subtitle,show", "elm");
+ else elm_object_signal_emit(this->layout, "elm,state,subtitle,hide", "elm");
+ return true;
+ }
+ LOGE("Layout is not exist!");
+ return false;
+}
+
+bool ui_basic_view::set_title_left_btn(Evas_Object *title_left_btn)
+{
+ if (this->layout)
+ {
+ if (title_left_btn)
+ {
+ elm_object_style_set(title_left_btn, "tizen_view/title_left");
+ }
+ elm_object_part_content_set(this->layout, "title_left_btn", title_left_btn);
+ if (title_left_btn) elm_object_signal_emit(this->layout, "elm,state,title_left_btn,show", "elm");
+ else elm_object_signal_emit(this->layout, "elm,state,title_left_btn,hide", "elm");
+ return true;
+ }
+ LOGE("Layout is not exist!");
+ return false;
+}
+
+bool ui_basic_view::set_title_right_btn(Evas_Object *title_right_btn)
+{
+ if (this->layout)
+ {
+ if (title_right_btn)
+ {
+ elm_object_style_set(title_right_btn, "tizen_view/title_right");
+ }
+ elm_object_part_content_set(this->layout, "title_right_btn", title_right_btn);
+ if (title_right_btn) elm_object_signal_emit(this->layout, "elm,state,title_right_btn,show", "elm");
+ else elm_object_signal_emit(this->layout, "elm,state,title_right_btn,hide", "elm");
+ return true;
+ }
+ LOGE("Layout is not exist!");
+ return false;
+}
+
+bool ui_basic_view::set_title_badge(const char *text)
+{
+ if (this->layout)
+ {
+ elm_object_part_text_set(this->layout, "title_badge", text);
+ if (text) elm_object_signal_emit(this->layout, "elm,state,title_badge,show", "elm");
+ else elm_object_signal_emit(this->layout, "elm,state,title_badge,hide", "elm");
+ return true;
+ }
+ LOGE("Layout is not exist!");
+ return false;
+}
+
+bool ui_basic_view::set_title(const char *text)
+{
+ if (this->layout)
+ {
+ elm_object_part_text_set(this->layout, "elm.text.title", text);
+ if (text) elm_object_signal_emit(this->layout, "elm,state,title,show", "elm");
+ else elm_object_signal_emit(this->layout, "elm,state,title,hide", "elm");
+ return true;
+ }
+ LOGE("Layout is not exist!");
+ return false;
+}
+
+Evas_Object *ui_basic_view::set_content(Evas_Object *content, const char *title, const char *subtitle, Evas_Object *title_left_btn,
+ Evas_Object *title_right_btn)
+{
+ Evas_Object *pcontent = this->set_content(content);
+
+ if (this->layout)
+ {
+ this->set_title(title);
+ this->set_subtitle(subtitle);
+ this->set_title_left_btn(title_left_btn);
+ this->set_title_right_btn(title_right_btn);
+ }
+ else
+ {
+ LOGE("Layout is not exist!");
+ }
+
+ return pcontent;
+}
+
+bool ui_basic_view::set_toolbar(Evas_Object *toolbar)
+{
+ Evas_Object *layout = this->get_base();
+
+ if (layout)
+ {
+ elm_object_part_content_set(layout, "toolbar", toolbar);
+ if (toolbar) elm_object_signal_emit(layout, "elm,state,toolbar,show", "elm");
+ else elm_object_signal_emit(layout, "elm,state,toolbar,hide", "elm");
+
+ return true;
+ }
+ LOGE("Layout is not exist!");
+ return false;
+}
+
+void ui_basic_view::unload_content()
+{
+ ui_view::set_content(NULL);
+ this->destroy_layout();
+}
+
+void ui_basic_view::menu()
+{
+ if (!this->get_controller()) return;
+ (dynamic_cast<ui_basic_controller *>(this->get_controller()))->menu();
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "../../../include/efl/mobile/ui_viewmanager_mobile.h"
+
+using namespace efl_viewmgr;
+using namespace viewmgr;
+
+ui_basic_viewmgr::ui_basic_viewmgr(const char *pkg)
+ : ui_viewmgr(pkg, new ui_basic_key_listener(this))
+{
+}
+
+ui_basic_viewmgr::~ui_basic_viewmgr()
+{
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "../../include/efl/ui_viewmanager_efl.h"
+
+using namespace efl_viewmgr;
+using namespace viewmgr;
+
+ui_view * ui_controller::get_view()
+{
+ ui_iface_view *view = ui_iface_controller::get_view();
+ if (!view) return NULL;
+ return dynamic_cast<ui_view *>(view);
+}
+
+ui_controller::~ui_controller()
+{
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "../../include/efl/ui_viewmanager_efl.h"
+
+using namespace efl_viewmgr;
+using namespace viewmgr;
+
+static const char *KEY_BACK = "XF86Back";
+
+ui_key_listener::ui_key_listener(ui_viewmgr *viewmgr)
+ : viewmgr(viewmgr), key_grabber(NULL)
+{
+
+}
+
+static void event_proc(ui_key_listener *key_listener, Evas_Event_Key_Down *ev)
+{
+ //Only if view manager is activated
+ ui_viewmgr *viewmgr = key_listener->get_viewmgr();
+ if (!viewmgr->is_activated()) return;
+
+ //Get Top View
+ ui_view *view = dynamic_cast<ui_view *>(viewmgr->get_last_view());
+ if (!view) return;
+
+ key_listener->extend_event_proc(view, ev);
+
+ if (strcmp(ev->keyname, KEY_BACK)) return;
+
+ view->back();
+}
+
+bool ui_key_listener::term()
+{
+ evas_object_del(this->key_grabber);
+ return true;
+}
+
+bool ui_key_listener::init()
+{
+ if (!this->viewmgr)
+ {
+ LOGE("No view manager??");
+ return false;
+ }
+
+ Evas *e = evas_object_evas_get(this->viewmgr->get_window());
+ if (!e)
+ {
+ LOGE("Failed to get Evas from window");
+ return false;
+ }
+
+ Evas_Object *key_grab_rect = evas_object_rectangle_add(e);
+ if (!key_grab_rect)
+ {
+ LOGE("Failed to create a key grabber rectangle");
+ return false;
+ }
+
+ evas_object_event_callback_add(key_grab_rect, EVAS_CALLBACK_KEY_UP, [](void *data, Evas *e, Evas_Object *obj, void *event_info) -> void
+ {
+ Evas_Event_Key_Down *ev = static_cast<Evas_Event_Key_Down *>(event_info);
+ ui_key_listener *key_listener = static_cast<ui_key_listener *>(data);
+ event_proc(key_listener, ev);
+ }, this);
+
+ if (!evas_object_key_grab(key_grab_rect, KEY_BACK, 0, 0, EINA_FALSE))
+ {
+ LOGE("Failed to grab BACK KEY(%s)\n", KEY_BACK);
+ evas_object_del(key_grab_rect);
+ return false;
+ }
+
+ this->key_grabber = key_grab_rect;
+
+ return true;
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "../../include/efl/ui_viewmanager_efl.h"
+
+using namespace efl_viewmgr;
+using namespace viewmgr;
+
+ui_view::ui_view(ui_controller *controller, const char *name)
+ : ui_iface_view(controller, name)
+{
+}
+
+ui_view::~ui_view()
+{
+}
+
+Evas_Object *ui_view::set_content(Evas_Object *content)
+{
+ T pcontent = ui_iface_view::set_content(CONVERT_TO_T(content));
+ return static_cast<Evas_Object *>(pcontent);
+}
+
+Evas_Object *ui_view::get_base()
+{
+ ui_viewmgr *viewmgr = dynamic_cast<ui_viewmgr *>(ui_iface_view::get_viewmgr());
+ if (!viewmgr)
+ {
+ return NULL;
+ }
+ return viewmgr->get_base();
+}
+
+void ui_view::unload_content()
+{
+ Evas_Object *pcontent = this->set_content(NULL);
+ if (pcontent) evas_object_del(pcontent);
+}
+
+Evas_Object *ui_view ::get_parent()
+{
+ 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_iface_view::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);
+}
+
+void ui_view::back()
+{
+ if (this->get_controller())
+ {
+ if (!dynamic_cast<ui_controller *>(this->get_controller())->back())
+ {
+ return;
+ }
+ }
+ dynamic_cast<ui_viewmgr *>(this->get_viewmgr())->pop_view();
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "../../include/efl/ui_viewmanager_efl.h"
+
+using namespace efl_viewmgr;
+using namespace viewmgr;
+
+bool ui_viewmgr::set_indicator(ui_view_indicator indicator)
+{
+ 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)
+{
+ Evas_Object *conform = elm_conformant_add(win);
+ if (!conform) return false;
+
+ evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, conform);
+ elm_win_conformant_set(win, EINA_TRUE);
+ evas_object_show(conform);
+
+ this->conform = conform;
+
+ return true;
+}
+
+bool ui_viewmgr::create_base_layout(Evas_Object *conform)
+{
+ Evas_Object *layout = elm_layout_add(conform);
+ if (!layout) return false;
+
+ elm_layout_theme_set(layout, "layout", "application", "default");
+ elm_object_content_set(conform, layout);
+
+ this->layout = layout;
+
+ return true;
+}
+
+ui_viewmgr::ui_viewmgr(const char *pkg, ui_key_listener *key_listener)
+ : ui_iface_viewmgr(), key_listener(key_listener)
+{
+ if (!pkg)
+ {
+ LOGE("Invalid package name");
+ return;
+ }
+ //Window
+ this->win = elm_win_util_standard_add(pkg, pkg);
+
+ if (!this->win)
+ {
+ LOGE("Failed to create a window (%s)", pkg);
+ return;
+ }
+
+ //Set window rotation
+ if (elm_win_wm_rotation_supported_get(this->win))
+ {
+ int rots[4] =
+ { 0, 90, 180, 270 };
+ elm_win_wm_rotation_available_rotations_set(this->win, (const int *) (&rots), 4);
+ }
+
+ //Window is requested to delete.
+ evas_object_smart_callback_add(this->win, "delete,request",
+ [](void *data, Evas_Object *obj, void *event_info) -> void
+ {
+ ui_viewmgr *viewmgr = static_cast<ui_viewmgr*>(data);
+ delete(viewmgr);
+ //FIXME: Window is destroyed. Terminate Application!
+ //ui_app_exit();
+ },
+ this);
+
+ //Conformant: Make this configurable.
+ if (!this->create_conformant(this->win))
+ {
+ LOGE("Failed to create a conformant (%s)", pkg);
+ return;
+ }
+
+ if (!this->create_base_layout(this->conform))
+ {
+ LOGE("Failed to create a base layout (%s)", pkg);
+ return;
+ }
+
+ //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);
+
+ key_listener->init();
+}
+
+ui_viewmgr::ui_viewmgr(const char *pkg)
+ : ui_viewmgr(pkg, new ui_key_listener(this))
+{
+}
+
+ui_viewmgr::~ui_viewmgr()
+{
+ this->key_listener->term();
+ delete(this->key_listener);
+}
+
+bool ui_viewmgr::activate()
+{
+ ui_iface_viewmgr::activate();
+
+ elm_object_part_content_unset(this->get_base(), "elm.swallow.content");
+
+ ui_view *view = dynamic_cast<ui_view *>(this->get_last_view());
+
+ //TODO: get parent?
+ Evas_Object *content = view->get_base();
+ if (content == this->get_base())
+ {
+ elm_object_part_content_set(this->get_base(), "elm.swallow.content", CONVERT_TO_EO(view->get_content()));
+ }
+ else
+ {
+ elm_object_part_content_set(this->get_base(), "elm.swallow.content", CONVERT_TO_EO(view->get_base()));
+ }
+
+ this->set_indicator(view->get_indicator());
+ view->active();
+
+ evas_object_show(this->win);
+
+ return true;
+}
+
+bool ui_viewmgr::deactivate()
+{
+ ui_iface_viewmgr::deactivate();
+
+ //FIXME: based on the profile, we should app to go behind or terminate.
+ if (true)
+ {
+ ui_view *view = dynamic_cast<ui_view *>(this->get_last_view());
+ if (view) view->inactive();
+ evas_object_lower(this->win);
+ }
+ else
+ {
+ //FIXME: exit app
+ //ui_app_exit();
+ }
+
+ return true;
+}
+
+bool ui_viewmgr::pop_view()
+{
+ if (this->get_view_count() == 1) this->deactivate();
+ else if(!ui_iface_viewmgr::pop_view()) return false;
+
+ ui_view *view = dynamic_cast<ui_view *>(this->get_last_view());
+
+ //TODO: get parent?
+ Evas_Object *content = view->get_base();
+ if (content == this->get_base())
+ {
+ elm_object_part_content_set(this->get_base(), "elm.swallow.content", CONVERT_TO_EO(view->get_content()));
+ }
+ else
+ {
+ 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;
+}
+
+ui_view * ui_viewmgr::push_view(ui_view *view)
+{
+ ui_iface_viewmgr::push_view(view);
+
+ //Don't prepare yet if viewmgr is not activated.
+ if (!this->is_activated()) return view;
+
+ elm_object_part_content_unset(this->get_base(), "elm.swallow.content");
+
+ Evas_Object *content = view->get_base();
+
+ if (content == this->get_base())
+ {
+ elm_object_part_content_set(this->get_base(), "elm.swallow.content", CONVERT_TO_EO(view->get_content()));
+ }
+ else
+ {
+ 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;
+}
+
+ui_view *ui_viewmgr::get_last_view()
+{
+ return dynamic_cast<ui_view *>(ui_iface_viewmgr::get_last_view());
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "../../include/interface/ui_viewmanager_interface.h"
+
+using namespace viewmgr;
+
+void ui_iface_controller::set_view(ui_iface_view *view)
+{
+ if (this->view)
+ {
+ this->view->set_controller(NULL);
+ }
+ this->view = view;
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "../../include/interface/ui_viewmanager_interface.h"
+
+using namespace viewmgr;
+
+void ui_iface_view::set_event_block(bool block)
+{
+ this->event_block = block;
+}
+
+void ui_iface_view::load()
+{
+ this->state = UI_VIEW_STATE_LOAD;
+ if (this->content) return;
+ if (!this->controller) return;
+ this->controller->load();
+}
+
+void ui_iface_view::unload()
+{
+ this->state = UI_VIEW_STATE_UNLOAD;
+ if (this->get_removable_content())
+ {
+ this->unload_content();
+ return;
+ }
+ if (!this->content) return;
+ if (!this->controller) return;
+ this->controller->unload();
+}
+
+void ui_iface_view::active()
+{
+ this->state = UI_VIEW_STATE_ACTIVE;
+ if (!this->controller) return;
+ this->controller->active();
+}
+
+void ui_iface_view::inactive()
+{
+ this->state = UI_VIEW_STATE_INACTIVE;
+ if (!this->controller) return;
+ this->controller->inactive();
+}
+
+void ui_iface_view::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();
+}
+
+void ui_iface_view::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();
+}
+
+void ui_iface_view::destroy()
+{
+ if (!this->controller) return;
+ this->controller->destroy();
+}
+
+ui_iface_view::ui_iface_view(T content, ui_iface_controller *controller, const char *name)
+ : content(content), controller(controller), name(string(name ? name : "")), style(string("")), viewmgr(NULL), state(UI_VIEW_STATE_LOAD),
+ 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;
+ controller->set_view(this);
+}
+
+ui_iface_view::ui_iface_view(ui_iface_controller *controller, const char *name)
+ : ui_iface_view(NULL, controller, name)
+{
+ this->state = UI_VIEW_STATE_UNLOAD;
+}
+
+ui_iface_view::ui_iface_view(const char *name)
+ : ui_iface_view(NULL, name)
+{
+
+}
+
+ui_iface_view::~ui_iface_view()
+{
+ this->viewmgr->remove_view(this);
+ if (this->controller) delete (this->controller);
+}
+
+ui_iface_controller* ui_iface_view::set_controller(ui_iface_controller *controller)
+{
+ ui_iface_controller *prev_controller = this->controller;
+ this->controller = controller;
+ if (controller) controller->set_view(this);
+ if (prev_controller) prev_controller->set_view(NULL);
+ return prev_controller;
+}
+
+T ui_iface_view::set_content(T content)
+{
+ T prev = this->content;
+ this->content = content;
+ return prev;
+}
+
+bool ui_iface_view::set_style(const char *style)
+{
+ this->style.assign(style);
+ return true;
+}
+
+bool ui_iface_view::set_name(const char *name)
+{
+ this->name.assign(name);
+ return true;
+}
+
+void ui_iface_view::set_removable_content(bool removable)
+{
+ this->removable_content = removable;
+
+ //FIXME: If this api is called on unload state? should we remove content right now?
+}
+
+void ui_iface_view::set_indicator(ui_view_indicator indicator)
+{
+ this->indicator = indicator;
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "../../include/interface/ui_viewmanager_interface.h"
+
+using namespace viewmgr;
+
+//FIXME: Read system profile to decide whether support software key or not.
+bool ui_iface_viewmgr::soft_key = true;
+//FIXME: Read system profile to decide whether support event block or not.
+bool ui_iface_viewmgr::event_block = true;
+
+bool ui_iface_viewmgr::need_soft_key()
+{
+ return ui_iface_viewmgr::soft_key;
+}
+
+bool ui_iface_viewmgr::connect_view(ui_iface_view *view)
+{
+ if (view->viewmgr)
+ {
+ LOGE("view(%p) has already connected to viewmgr(%p)", view, this);
+ return false;
+ }
+
+ view->viewmgr = this;
+ return true;
+}
+
+bool ui_iface_viewmgr::disconnect_view(ui_iface_view *view)
+{
+ if (!view->viewmgr) return false;
+ view->viewmgr = NULL;
+ return true;
+}
+
+void ui_iface_viewmgr::set_event_block(ui_iface_view *view, bool block)
+{
+
+ if (!ui_iface_viewmgr::event_block) return;
+ view->set_event_block(block);
+}
+
+bool ui_iface_viewmgr::push_view_finished(ui_iface_view *view)
+{
+ ui_iface_view *last = this->view_list.back();
+
+ //The previous view has been pushed. This should be unload.
+ if (last != view)
+ {
+ view->unload();
+ return true;
+ }
+
+ //A new view has been pushed. This should be active.
+ view->active();
+ this->set_event_block(view, true);
+
+ return true;
+}
+
+bool ui_iface_viewmgr::pop_view_finished(ui_iface_view *view)
+{
+ ui_iface_view *last = this->view_list.back();
+
+ //This view has been popped. It should be destroyed.
+ if (last == view)
+ {
+ view->unload();
+ view->destroy();
+ delete (view);
+ return true;
+ }
+
+ //The previous view has been popped. It should become active.
+ view->active();
+ this->set_event_block(view, true);
+
+ return true;
+}
+
+ui_iface_viewmgr::ui_iface_viewmgr()
+ : activated(false)
+{
+}
+
+ui_iface_viewmgr::~ui_iface_viewmgr()
+{
+ //Terminate views
+ 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();
+ delete (view);
+ }
+
+ //FIXME: Window is destroyed. Terminate Application!
+ ui_app_exit();
+}
+
+ui_iface_view *
+ui_iface_viewmgr::push_view(ui_iface_view *view)
+{
+ if (!view)
+ {
+ LOGE("invalid view argument. view(NULL)");
+ return NULL;
+ }
+
+ if (!this->connect_view(view))
+ {
+ LOGE("connect view failed");
+ return NULL;
+ }
+
+ ui_iface_view *pview;
+
+ //Previous view
+ if (this->view_list.size())
+ {
+ pview = this->view_list.back();
+ pview->inactive();
+ this->set_event_block(pview, true);
+
+ //FIXME: Since we have no transition
+ pview->unload();
+ }
+
+ view_list.push_back(view);
+
+ if (!view->get_content())
+ {
+ view->load();
+ }
+
+ view->inactive();
+ this->set_event_block(view, true);
+
+ return view;
+}
+
+bool ui_iface_viewmgr::pop_view()
+{
+ //No more view? destroy viewmgr?
+ if (this->get_view_count() == 0)
+ {
+ return false;
+ }
+
+ //This is the last page. destroy viewmgr?
+ if (this->get_view_count() == 1)
+ {
+ //destroy viewmgr?
+ ui_iface_view *view = this->view_list.back();
+ view->inactive();
+ view->unload();
+ view->destroy();
+ delete(view);
+
+ return false;
+ }
+
+ //last page to be popped.
+ ui_iface_view *view = this->view_list.back();
+ view->inactive();
+ this->set_event_block(view, true);
+
+ //Below object has to be used in child class...
+ //Make this getter method? or define instance?
+ //previous page to be current active.
+ auto nx = std::prev(this->view_list.end(), 2);
+ ui_iface_view *pview = *nx;
+ pview->load();
+ pview->inactive();
+ this->set_event_block(pview, true);
+
+ //FIXME: since we have no transition effect
+ pview->active();
+ view->inactive();
+ view->unload();
+ view->destroy();
+ delete (view);
+
+ return true;
+}
+
+bool ui_iface_viewmgr::insert_view_before(ui_iface_view *view, ui_iface_view *before)
+{
+ //TODO: ...
+ return true;
+}
+
+bool ui_iface_viewmgr::insert_view_after(ui_iface_view *view, ui_iface_view *after)
+{
+ //TODO: ...
+ return true;
+}
+
+bool ui_iface_viewmgr::remove_view(ui_iface_view *view)
+{
+ this->view_list.remove(view);
+ this->disconnect_view(view);
+
+ //TODO: If this view is the top on the stack ?
+ return true;
+}
+
+ui_iface_view*
+ui_iface_viewmgr::get_view(unsigned int idx)
+{
+ if (idx < 0 || idx >= this->view_list.size())
+ {
+ LOGE("Invalid idx(%d)! =? (idx range: %d ~ %d)", idx, 0, this->view_list.size() - 1);
+ return NULL;
+ }
+ typename std::list<ui_iface_view*>::iterator it = this->view_list.begin();
+ std::advance(it, idx);
+ return *it;
+}
+
+int ui_iface_viewmgr::get_view_index(const ui_iface_view *view)
+{
+ int idx = 0;
+
+ for (typename std::list<ui_iface_view*>::iterator it = this->view_list.begin(); it != this->view_list.end(); it++)
+ {
+ if (view == *it) return idx;
+ ++idx;
+ }
+
+ return -1;
+}
+
+ui_iface_view *
+ui_iface_viewmgr::get_last_view()
+{
+ int cnt = this->get_view_count();
+ return this->get_view(cnt - 1);
+}
+
+bool ui_iface_viewmgr::activate()
+{
+ if (this->activated) return false;
+ this->activated = true;
+ return true;
+}
+
+bool ui_iface_viewmgr::deactivate()
+{
+ if (!this->activated) return false;
+ this->activated = false;
+ return true;
+}
+
+ui_iface_view *ui_iface_viewmgr::get_view(const char *name)
+{
+ //FIXME: ...
+ return NULL;
+}
+
+bool ui_iface_viewmgr::is_activated()
+{
+ return this->activated;
+}
+
+unsigned int ui_iface_viewmgr::get_view_count()
+{
+ return this->view_list.size();
+}
--- /dev/null
+<manifest>
+ <define>
+ <domain name="ui-viewmgr"/>
+ <request>
+ <smack request="xorg" type="wx"/>
+ <smack request="system::homedir" type="rwx"/>
+ <smack request="isf" type="rx"/>
+ <smack request="tizen::vconf::public::r::platform::rw" type="rl"/>
+ <smack request="tizen::vconf::setting" type="rl"/>
+ <smack request="device::sys_logging" type="rw"/>
+ <smack request="tizen::vconf::camcorder" type="rl"/>
+ <smack request="tizen::vconf::setting::admin" type="rl"/>
+ <smack request="device::app_logging" type="rwx"/>
+ <smack request="pulseaudio" type="w"/>
+ <smack request="sdbd" type="rw"/>
+ <smack request="dbus" type="w"/>
+ <smack request="pkgmgr::db" type="rwl"/>
+ </request>
+ <permit>
+ <smack permit="xorg" type="rwx"/>
+ <smack permit="_" type="rw"/>
+ </permit>
+ </define>
+</manifest>
--- /dev/null
+prefix=@PREFIX@
+exec_prefix=@EXEC_DIR@
+libdir=@LIBDIR@
+includedir=@INCDIR@
+
+Name: UI VIEW MANAGER
+Description: An UI VIEW MANAGER library
+Version: @VERSION@
+Requires:
+Libs: -L${libdir} -lui-viewmgr
+Cflags: -I${includedir}/ui-viewmgr