--- /dev/null
+# Copyright (c) 2014 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.
+#
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT("homescreen-tv-ref" C)
+
+IF(NOT DEFINED PACKAGE_NAME)
+ SET(PACKAGE_NAME "org.tizen.homescreen-tv-ref")
+ENDIF(NOT DEFINED PACKAGE_NAME)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+IF(NOT DEFINED BINDIR)
+ SET(BINDIR"${PREFIX}/bin")
+ENDIF(NOT DEFINED BINDIR)
+IF(NOT DEFINED IMAGEDIR)
+ SET(IMAGEDIR "${PREFIX}/res/images")
+ENDIF(NOT DEFINED IMAGEDIR)
+IF(NOT DEFINED CFGDIR)
+ SET(CFGDIR "${PREFIX}/res/config")
+ENDIF(NOT DEFINED CFGDIR)
+IF(NOT DEFINED LOCALEDIR)
+ SET(LOCALEDIR "${PREFIX}/res/locale")
+ENDIF(NOT DEFINED LOCALEDIR)
+IF(NOT DEFINED MANIFESTDIR)
+ SET(MANIFESTDIR "/usr/share/packages")
+ENDIF(NOT DEFINED MANIFESTDIR)
+
+SET(TARGET_EDJ "${PROJECT_NAME}.edj")
+SET(THEME_EDJ "${PROJECT_NAME}-theme.edj")
+SET(DEF_CONFIG "${PROJECT_NAME}.json")
+SET(DEF_CONFIG_USER "${PROJECT_NAME}-user.json")
+SET(SRCS
+ src/homescreen.c
+ src/hbar.c
+ src/ubar.c
+ src/dbar.c
+ src/cbar.c
+ src/xbar.c
+ src/engine.c
+ src/bus.c
+ src/main.c)
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE_NAME}\"")
+ADD_DEFINITIONS("-DEDJEDIR=\"${EDJEDIR}\"")
+ADD_DEFINITIONS("-DEDJEFILE=\"${EDJEDIR}/${TARGET_EDJ}\"")
+ADD_DEFINITIONS("-DTHEMEFILE=\"${EDJEDIR}/${THEME_EDJ}\"")
+ADD_DEFINITIONS("-DIMAGEDIR=\"${IMAGEDIR}\"")
+ADD_DEFINITIONS("-DDEF_CONFIG=\"${CFGDIR}/${DEF_CONFIG}\"")
+ADD_DEFINITIONS("-DDEF_CONFIG_USER=\"${CFGDIR}/${DEF_CONFIG_USER}\"")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(PKGS REQUIRED
+ elementary
+ dlog
+ ecore-x
+ x11
+ utilX
+ json-glib-1.0
+ gio-2.0
+ aul
+ app-content-favorite
+ app-content-provider
+ capi-appfw-application)
+
+FOREACH(flag ${PKGS_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_LDFLAGS})
+CONFIGURE_FILE(${PACKAGE_NAME}.xml.in ${PACKAGE_NAME}.xml)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
+INSTALL(FILES ${PACKAGE_NAME}.xml DESTINATION ${MANIFESTDIR})
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/images/ DESTINATION ${IMAGEDIR} FILES_MATCHING PATTERN "*.png")
+
+ADD_SUBDIRECTORY(edje)
+ADD_SUBDIRECTORY(config)
--- /dev/null
+# Copyright (c) 2014 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.
+#
+
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${DEF_CONFIG}.in ${CMAKE_CURRENT_SOURCE_DIR}/${DEF_CONFIG})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${DEF_CONFIG} DESTINATION ${CFGDIR})
+
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${DEF_CONFIG_USER}.in ${CMAKE_CURRENT_SOURCE_DIR}/${DEF_CONFIG_USER})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${DEF_CONFIG_USER} DESTINATION ${CFGDIR})
--- /dev/null
+/* authority - 0: guest user, 1: authorized user */
+{
+ "ubar.items": [
+ {
+ "name": "GUEST",
+ "thumb_bg": "@IMAGEDIR@/ico_bg_98.png",
+ "thumb": "@IMAGEDIR@/ico_family_mini.png",
+ "authority": 0,
+ "password": "",
+ "age": 0
+ },
+ {
+ "name": "MAN",
+ "thumb_bg": "@IMAGEDIR@/ico_bg_98.png",
+ "thumb": "@IMAGEDIR@/ico_man.png",
+ "authority": 1,
+ "password": "abcd",
+ "age": 0
+ },
+ {
+ "name": "WOMAN",
+ "thumb_bg": "@IMAGEDIR@/ico_bg_98.png",
+ "thumb": "@IMAGEDIR@/ico_woman_mini.png",
+ "authority": 1,
+ "password": "abcd",
+ "age": 0
+ },
+ {
+ "name": "ADD",
+ "thumb_bg": "@IMAGEDIR@/ico_bg_98.png",
+ "thumb": "@IMAGEDIR@/homebar_uc_ico_add.png",
+ "authority": 0,
+ "password": "",
+ "age": 0
+ },
+ {
+ "name": "GRANDFATHER",
+ "thumb_bg": "@IMAGEDIR@/ico_bg_98.png",
+ "thumb": "@IMAGEDIR@/ico_grandfather_mini.png",
+ "authority": 1,
+ "password": "abcd",
+ "age": 0
+ },
+ {
+ "name": "GRANDMOTHER",
+ "thumb_bg": "@IMAGEDIR@/ico_bg_98.png",
+ "thumb": "@IMAGEDIR@/ico_grandmother_mini.png",
+ "authority": 1,
+ "password": "abcd",
+ "age": 0
+ },
+ {
+ "name": "KIDS",
+ "thumb_bg": "@IMAGEDIR@/ico_bg_98.png",
+ "thumb": "@IMAGEDIR@/ico_boy_mini.png",
+ "authority": 1,
+ "password": "abcd",
+ "age": 7
+ },
+ {
+ "name": "KIDS",
+ "thumb_bg": "@IMAGEDIR@/ico_bg_98.png",
+ "thumb": "@IMAGEDIR@/ico_girl_mini.png",
+ "authority": 1,
+ "password": "abcd",
+ "age": 7
+ }
+ ]
+}
--- /dev/null
+{
+ "items": [
+ {
+ "name": "LIVE TV",
+ "object_path": "/org/tizen/tv/livetv",
+ "bus_name": "org.tizen.tv.homescreen.livetv",
+ "icon": "@IMAGEDIR@/icn_live_tv_nor.png",
+ "icon_focus": "@IMAGEDIR@/icn_live_tv_foc.png",
+ "color": {
+ "red": 69,
+ "green": 143,
+ "blue": 255
+ },
+ "content_column": 1,
+ "noctnt_title": "No Channels",
+ "noctnt_desc": "To find channels, search channels in setting",
+ "app": "org.tizen.live-tv-ref",
+ "qlink_items": [
+ {
+ "title": "EPG",
+ "package": "org.tizen.epg-tv-ref",
+ "category": "all"
+ },
+ {
+ "title": "Live",
+ "package": "org.tizen.live-tv-ref",
+ "category": "all"
+ }
+ ],
+ "in": "homebar"
+ },
+ {
+ "name": "GALLERY",
+ "object_path": "/org/tizen/tv/gallery",
+ "bus_name": "org.tizen.tv.homescreen.gallery",
+ "icon": "@IMAGEDIR@/ico_native_photo_nor.png",
+ "icon_focus": "@IMAGEDIR@/ico_native_photo_foc.png",
+ "color": {
+ "red": 147,
+ "green": 170,
+ "blue": 0
+ },
+ "content_column": 1,
+ "noctnt_title": "No Contents",
+ "noctnt_desc": "There is no photo/video content",
+ "app": "org.tizen.gallery-tv-ref",
+ "qlink_items": [
+ {
+ "title": "Events",
+ "package": "org.tizen.gallery-tv-ref",
+ "category": "events"
+ },
+ {
+ "title": "Places",
+ "package": "org.tizen.gallery-tv-ref",
+ "category": "places"
+ }
+ ],
+ "in": "homebar"
+ },
+ {
+ "name": "MUSIC",
+ "object_path": "/org/tizen/tv/music",
+ "bus_name": "org.tizen.tv.homescreen.music",
+ "icon": "@IMAGEDIR@/ico_native_music_nor.png",
+ "icon_focus": "@IMAGEDIR@/ico_native_music_foc.png",
+ "color": {
+ "red": 255,
+ "green": 99,
+ "blue": 86
+ },
+ "content_column": 2,
+ "noctnt_title": "No Music",
+ "noctnt_desc": "There is no favorite music album",
+ "app": "org.tizen.music-player-tv-ref",
+ "qlink_items": [
+ {
+ "title": "Song",
+ "package": "org.tizen.music-player-tv-ref",
+ "category": "song"
+ },
+ {
+ "title": "Album",
+ "package": "org.tizen.music-player-tv-ref",
+ "category": "album"
+ }
+ ],
+ "in": "homebar"
+ },
+ {
+ "name": "APPS",
+ "object_path": "/org/tizen/tv/apps",
+ "bus_name": "org.tizen.tv.homescreen.apps",
+ "icon": "@IMAGEDIR@/icn_app_nor.png",
+ "icon_focus": "@IMAGEDIR@/icn_app_foc.png",
+ "color": {
+ "red": 71,
+ "green": 210,
+ "blue": 188
+ },
+ "content_column": 1,
+ "noctnt_title": "No Apps",
+ "noctnt_desc": "There is no favorite application",
+ "app": "org.tizen.app-launcher-tv-ref",
+ "qlink_items": [
+ {
+ "title": "Website",
+ "package": "org.tizen.browser-tv-ref",
+ "category": "web"
+ },
+ {
+ "title": "Apps",
+ "package": "org.tizen.app-launcher-tv-ref",
+ "category": "apps"
+ }
+ ],
+ "in": "homebar"
+ },
+ {
+ "name": "SOURCE",
+ "object_path": "/org/tizen/tv/sourcelist",
+ "bus_name": "org.tizen.tv.homescreen.sourcelist",
+ "icon": "@IMAGEDIR@/icn_source_nor.png",
+ "icon_focus": "@IMAGEDIR@/icn_source_foc.png",
+ "color": {
+ "red": 155,
+ "green": 122,
+ "blue": 255
+ },
+ "content_column": 2,
+ "noctnt_title": "No Sources",
+ "noctnt_desc": "To connect source, plug a source into TV or set up the network configuration",
+ "app": "org.tizen.source-list-tv-ref",
+ "qlink_items": [
+ {
+ "title" : "Plugged",
+ "package": "org.tizen.source-list-tv-ref",
+ "category": "plugged"
+ },
+ {
+ "title": "Nearby",
+ "package": "org.tizen.source-list-tv-ref",
+ "category": "nearby"
+ }
+ ],
+ "in": "homebar"
+ },
+ {
+ "name": "NOTIFICATION",
+ "object_path": "/org/tizen/tv/notification",
+ "bus_name": "org.tizen.tv.homescreen.notification",
+ "icon": "@IMAGEDIR@/icn_noti_nor.png",
+ "icon_focus": "@IMAGEDIR@/icn_noti_foc.png",
+ "color": {
+ "red": 255,
+ "green": 99,
+ "blue": 86
+ },
+ "content_column": 1,
+ "noctnt_title": "No Notification",
+ "noctnt_desc": "There is no notification data",
+ "app": "",
+ "in": "custombar"
+ }
+ ]
+}
--- /dev/null
+ADD_CUSTOM_TARGET(${TARGET_EDJ}
+ COMMAND edje_cc -id images
+ ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.edc
+ ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_EDJ}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} ${TARGET_EDJ})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_EDJ} DESTINATION ${EDJEDIR})
+
+ADD_CUSTOM_TARGET(${THEME_EDJ}
+ COMMAND edje_cc -id images
+ ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}-theme.edc
+ ${CMAKE_CURRENT_BINARY_DIR}/${THEME_EDJ}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}-theme.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} ${THEME_EDJ})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${THEME_EDJ} DESTINATION ${EDJEDIR})
--- /dev/null
+/*
+ * Copyright (c) 2014 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/defs.h"
+
+group {
+ name, GRP_PIN;
+ data.item, DATA_PIN_HEIGHT "115";
+ images{
+ image, "ico_pin.png" COMP;
+ }
+ parts {
+ part {
+ name, "area";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 270 115;
+ color, 20 20 21 80;
+ }
+ }
+ part {
+ name, "padding.pin";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel2 {
+ to, "area";
+ relative, 0.0 0.0;
+ }
+ min, 40 27;
+ align, 0.0 0.0;
+ fixed, 1 1;
+ visible, 0;
+ }
+ }
+ part {
+ name, "img.pin";
+ type, IMAGE;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "padding.pin";
+ relative, 1.0 1.0;
+ }
+ rel2.to, "padding.pin";
+ min, 60 60;
+ align, 0.0 0.0;
+ fixed, 1 1;
+ image.normal, "ico_pin.png";
+ }
+ description {
+ state, "dim" 0.0;
+ inherit, "default" 0.0;
+ color, 255 255 255 50;
+ }
+ }
+ part {
+ name, "text.pin";
+ type, TEXT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "img.pin";
+ relative, 1.0 0.0;
+ }
+ rel2 {
+ to, "img.pin";
+ relative, 1.0 0.0;
+ }
+ min, 130 60;
+ align, 0.0 0.0;
+ text {
+ font, "TizenSans:style=Bold";
+ size, 25;
+ align, 0.5 0.5;
+ text, "PINNED";
+ }
+ align, 0.0 0.0;
+ fixed, 1 1;
+ color, 255 255 255 255;
+ }
+ description {
+ state, "dim" 0.0;
+ inherit, "default" 0.0;
+ color, 255 255 255 20;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "dim,pin";
+ signal, SIG_DIM_ITEM;
+ source, SRC_PROG;
+ action, STATE_SET "dim" 0.0;
+ transition, LINEAR 0.2;
+ target, "img.pin";
+ target, "text.pin";
+ }
+
+ program {
+ name, "undim,pin";
+ signal, SIG_UNDIM_ITEM;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.2;
+ target, "img.pin";
+ target, "text.pin";
+ }
+ }
+}
+
+group {
+ name, GRP_EDIT_X;
+ images {
+ image, "ico_delete.png" COMP;
+ }
+ parts {
+ part {
+ name, "area";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 64 150;
+ align, 0.0 0.0;
+ color, 0 0 0 216;
+ }
+ }
+ part {
+ name, "clip.bg";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "area";
+ relative, -1.0 0.0;
+ }
+ rel2 {
+ to, "area";
+ relative, 0.0 1.0;
+ }
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ rel1 {
+ to, "area";
+ relative, 0.0 0.0;
+ }
+ rel2 {
+ to, "area";
+ relative, 1.0 1.0;
+ }
+ }
+ }
+ part {
+ name, PART_BG;
+ type, SWALLOW;
+ clip_to, "clip.bg";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, "area";
+ rel2.to, "area";
+ min, 64 150;
+ }
+ }
+ part {
+ name, "icon";
+ type, IMAGE;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "area";
+ relative, 0.5 0.5;
+ }
+ rel2 {
+ to, "area";
+ relative, 0.5 0.5;
+ }
+ min, 40 40;
+ image.normal, "ico_delete.png";
+ fixed, 1 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "initial_focus_pre";
+ signal, SIG_INITIAL_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus";
+ signal, SIG_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_pre";
+ signal, SIG_UNFOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus";
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "hide";
+ signal, SIG_HIDE;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ }
+ }
+}
+
+group {
+ name, GRP_EDIT_ARROW_UP;
+ images {
+ image, "ico_arrow_up.png" COMP;
+ }
+ parts {
+ part {
+ name, "area";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 270 50;
+ align, 0.0 0.0;
+ visible, 0;
+ }
+ }
+ part {
+ name, "pad.arrow";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "area";
+ relative, 0.5 0.0;
+ }
+ rel2 {
+ to, "area";
+ relative, 0.5 0.0;
+ }
+ min, 0 5;
+ fixed, 1 1;
+ align, 0.5 0.0;
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ min, 0 0;
+ }
+ }
+ part {
+ name, "arrow";
+ type, IMAGE;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "pad.arrow";
+ relative, 1.0 1.0;
+ }
+ rel2 {
+ to, "pad.arrow";
+ relative, 1.0 1.0;
+ }
+ min, 40 40;
+ image.normal, "ico_arrow_up.png";
+ fixed, 1 1;
+ align, 0.5 0.0;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "focus,arrow,after";
+ source, SRC_PROG;
+ transition, DECEL 0.01;
+ action, STATE_SET "default" 0.0;
+ target, "pad.arrow";
+ }
+ program {
+ name, "focus,arrow";
+ signal, SIG_FOCUS_ARROW;
+ source, SRC_PROG;
+ transition, BOUNCE 0.6 1 6;
+ action, STATE_SET "focus" 0.0;
+ target, "pad.arrow";
+ after, "focus,arrow,after";
+ }
+ }
+}
+
+group {
+ name, GRP_EDIT_ARROW_DOWN;
+ images {
+ image, "ico_arrow_down.png" COMP;
+ }
+ parts {
+ part {
+ name, "area";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 270 50;
+ align, 0.0 0.0;
+ visible, 0;
+ }
+ }
+ part {
+ name, "pad.arrow";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "area";
+ relative, 0.5 1.0;
+ }
+ rel2 {
+ to, "area";
+ relative, 0.5 1.0;
+ }
+ min, 0 5;
+ fixed, 1 0;
+ align, 0.5 1.0;
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ min, 0 0;
+ }
+ }
+ part {
+ name, "arrow";
+ type, IMAGE;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "pad.arrow";
+ relative, 0.0 0.0;
+ }
+ rel2 {
+ to, "pad.arrow";
+ relative, 0.0 0.0;
+ }
+ min, 40 40;
+ image.normal, "ico_arrow_down.png";
+ fixed, 1 1;
+ align, 0.5 1.0;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "focus,arrow,after";
+ source, SRC_PROG;
+ transition, DECEL 0.03;
+ action, STATE_SET "default" 0.0;
+ target, "pad.arrow";
+ }
+ program {
+ name, "focus,arrow";
+ signal, SIG_FOCUS_ARROW;
+ source, SRC_PROG;
+ transition, BOUNCE 0.6 1 6;
+ action, STATE_SET "focus" 0.0;
+ target, "pad.arrow";
+ after, "focus,arrow,after";
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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/defs.h"
+
+group {
+ name, GRP_DBAR_APP;
+ parts {
+ part {
+ name, "over";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 0 0 0 0;
+ }
+ }
+ part {
+ name, "clip";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 596 288;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, PART_THUMB;
+ type, SWALLOW;
+ scale, 1;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ }
+ }
+ part {
+ name, "text.bg";
+ type, RECT;
+ scale, 1;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ min, 0 87;
+ fixed, 0 1;
+ align, 0.5 1.0;
+ visible, 0;
+ }
+ }
+ part {
+ name, "clip.bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "text.bg";
+ relative, -1.0 0.0;
+ }
+ rel2 {
+ to, "text.bg";
+ relative, 0.0 1.0;
+ }
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 1.0;
+ }
+ description {
+ state, "prev" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 -1.0;
+ rel2.relative, 1.0 0.0;
+ }
+ description {
+ state, "next" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ rel2.relative, 1.0 2.0;
+ }
+ }
+ part {
+ name, PART_BG;
+ type, SWALLOW;
+ scale, 1;
+ clip_to, "clip.bg";
+ description {
+ state, "default" 0.0;
+ rel1.to, "text.bg";
+ rel2.to, "text.bg";
+ }
+ }
+ part {
+ name, "padding.icon";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, "text.bg";
+ rel2 {
+ to, "text.bg";
+ relative, 0.0 1.0;
+ }
+ min, 25 0;
+ fixed, 1 0;
+ align, 0.0 0.5;
+ visible, 0;
+ }
+ }
+ part {
+ name, PART_ICON;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "padding.icon";
+ relative, 1.0 0.5;
+ }
+ rel2 {
+ to, "padding.icon";
+ relative, 1.0 0.5;
+ }
+ min, 37 37;
+ fixed, 1 1;
+ align, 0.0 0.5;
+ }
+ }
+ part {
+ name, "padding.title";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_ICON;
+ relative, 1.0 0.0;
+ }
+ rel2 {
+ to, PART_ICON;
+ relative, 1.0 1.0;
+ }
+ min, 12 0;
+ fixed, 1 0;
+ align, 0.0 0.5;
+ visible, 0;
+ }
+ }
+ part {
+ name, PART_TITLE;
+ type, TEXT;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to_x, "padding.title";
+ to_y, "text.bg";
+ relative, 1.0 0.0;
+ }
+ rel2 {
+ to, "text.bg";
+ relative, 1.0 1.0;
+ }
+ align, 0.5 0.5;
+ text {
+ font, "TizenSans:style=Bold";
+ size, 30;
+ min, 0 0;
+ align, 0.0 0.5;
+ }
+ }
+ }
+ }
+ programs {
+ program {
+ name, "initial_focus_pre";
+ signal, SIG_INITIAL_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus";
+ signal, SIG_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "focus_from_next";
+ signal, SIG_FOCUS_FROM_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "next" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus_from_prev";
+ signal, SIG_FOCUS_FROM_UP;
+ source, SRC_PROG;
+ action, STATE_SET "prev" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "unfocus_to_next";
+ signal, SIG_UNFOCUS_TO_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "next" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_to_prev";
+ signal, SIG_UNFOCUS_TO_UP;
+ source, SRC_PROG;
+ action, STATE_SET "prev" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus";
+ signal, SIG_UNFOCUS_TO_HBAR;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "hide";
+ signal, SIG_HIDE;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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/defs.h"
+
+group {
+ name, GRP_DBAR_BROADCAST;
+ data.item, DATA_TITLE_WIDTH "140";
+ images {
+ image, "ico_default_program_180.png" COMP;
+ }
+ parts {
+ part {
+ name, "over";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 0 0 0 0;
+ }
+ }
+ part {
+ name, "clip";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 596 126;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, "clip.thumb";
+ type, RECT;
+ scale, 1;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel2 {
+ to, "text.bg";
+ relative, 1.0 0.0;
+ }
+ }
+ }
+ part {
+ name, PART_THUMB;
+ type, SWALLOW;
+ clip_to, "clip.thumb";
+ description {
+ state, "default" 0.0;
+ rel1.to, "clip.thumb";
+ rel2.to, "clip.thumb";
+ }
+ }
+ part {
+ name, "text.bg";
+ type, RECT;
+ scale, 1;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ min, 0 126;
+ fixed, 0 1;
+ align, 0.5 1.0;
+ color, 40 40 40 191;
+ }
+ }
+ part {
+ name, "clip.bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "text.bg";
+ relative, -1.0 0.0;
+ }
+ rel2 {
+ to, "text.bg";
+ relative, 0.0 1.0;
+ }
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 1.0;
+ }
+ description {
+ state, "prev" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 -1.0;
+ rel2.relative, 1.0 0.0;
+ }
+ description {
+ state, "next" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ rel2.relative, 1.0 2.0;
+ }
+ }
+ part {
+ name, PART_BG;
+ type, SWALLOW;
+ scale, 1;
+ clip_to, "clip.bg";
+ description {
+ state, "default" 0.0;
+ rel1.to, "text.bg";
+ rel2.to, "text.bg";
+ }
+ }
+ part {
+ name, "padding.number";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, "text.bg";
+ rel2 {
+ to, "text.bg";
+ relative, 0.0 0.0;
+ }
+ align, 0.0 0.0;
+ min, 75 25;
+ fixed, 1 1;
+ visible, 1;
+ color, 255 0 0 0;
+ }
+ }
+ part {
+ name, PART_NUMBER;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "padding.number";
+ relative, 1.0 1.0;
+ }
+ rel2 {
+ to, "padding.number";
+ relative, 1.0 1.0;
+ }
+ align, 0.5 0.5;
+ min, 100 129;
+ fixed, 1 1;
+ }
+ }
+ part {
+ name, "padding.info";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, "text.bg";
+ rel2 {
+ to, "text.bg";
+ relative, 0.0 1.0;
+ }
+ min, 145 0;
+ align, 0.0 0.0;
+ fixed, 1 1;
+ visible, 0;
+ }
+ }
+ part {
+ name, PART_PROGRAM;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "padding.info";
+ relative, 1.0 0.5;
+ }
+ rel2 {
+ to, "padding.info";
+ relative, 1.0 0.5;
+ }
+ min, 420 42;
+ align, 0.0 0.5;
+ fixed, 1 1;
+ }
+ }
+ part {
+ name, PART_CHANNEL;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_PROGRAM;
+ relative, 0.0 0.0;
+ }
+ rel2 {
+ to, PART_PROGRAM;
+ relative, 0.0 0.0;
+ }
+ min, 200 15;
+ align, 0.0 1.0;
+ fixed, 1 1;
+ }
+ }
+ part {
+ name, PART_DURATION;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_PROGRAM;
+ relative, 0.0 1.0;
+ }
+ rel2 {
+ to, PART_PROGRAM;
+ relative, 1.0 1.0;
+ }
+ min, 100 25;
+ fixed, 1 1;
+ align, 0.0 0.0;
+ }
+ }
+ part {
+ name, "padding.funcs";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "text.bg";
+ relative, 1.0 0.0;
+ }
+ rel2 {
+ to, "text.bg";
+ relative, 1.0 0.0;
+ }
+ min, 33 12;
+ fixed, 1 1;
+ align, 1.0 0.0;
+ visible, 0;
+ }
+ }
+ part {
+ name, PART_FUNCS;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "padding.funcs";
+ relative, 0.0 1.0;
+ }
+ rel2 {
+ to, "padding.funcs";
+ relative, 0.0 1.0;
+ }
+ min, 0 25;
+ fixed, 0 1;
+ align, 1.0 0.0;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "initial_focus_pre";
+ signal, SIG_INITIAL_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus";
+ signal, SIG_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "focus_from_next";
+ signal, SIG_FOCUS_FROM_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "next" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus_from_prev";
+ signal, SIG_FOCUS_FROM_UP;
+ source, SRC_PROG;
+ action, STATE_SET "prev" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "unfocus_info_next";
+ signal, SIG_UNFOCUS_TO_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "next" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_info_prev";
+ signal, SIG_UNFOCUS_TO_UP;
+ source, SRC_PROG;
+ action, STATE_SET "prev" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_info";
+ signal, SIG_UNFOCUS_TO_HBAR;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "hide";
+ signal, SIG_HIDE;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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/defs.h"
+
+group {
+ name, GRP_DBAR_HISTORY;
+ parts {
+ part {
+ name, "over";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 0 0 0 0;
+ }
+ }
+ part {
+ name, "clip";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 596 96;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, PART_THUMB;
+ type, SWALLOW;
+ scale, 1;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ }
+ }
+ part {
+ name, "text.bg";
+ type, RECT;
+ scale, 1;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ min, 0 96;
+ fixed, 0 1;
+ align, 0.5 1.0;
+ color, 40 40 40 100;
+ }
+ }
+ part {
+ name, "clip.bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "text.bg";
+ relative, -1.0 0.0;
+ }
+ rel2 {
+ to, "text.bg";
+ relative, 0.0 1.0;
+ }
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 1.0;
+ }
+ description {
+ state, "prev" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 -1.0;
+ rel2.relative, 1.0 0.0;
+ }
+ description {
+ state, "next" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ rel2.relative, 1.0 2.0;
+ }
+ description {
+ state, "xbar" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 1.0 0.0;
+ rel2.relative, 2.0 1.0;
+ }
+ }
+ part {
+ name, "clip.bg2";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ color, 0 0 0 0;
+ }
+ description {
+ state, "xbar" 0.0;
+ color, 132 132 132 132;
+ }
+ }
+ part {
+ name, PART_BG;
+ type, SWALLOW;
+ scale, 1;
+ clip_to, "clip.bg";
+ description {
+ state, "default" 0.0;
+ rel1.to, "text.bg";
+ rel2.to, "text.bg";
+ }
+ }
+ part {
+ name, PART_BG2;
+ type, SWALLOW;
+ clip_to, "clip.bg2";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, PART_BG;
+ rel2.to, PART_BG;
+ }
+ }
+ part {
+ name, "padding.icon";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, "text.bg";
+ rel2 {
+ to, "text.bg";
+ relative, 0.0 1.0;
+ }
+ min, 38 0;
+ fixed, 1 0;
+ align, 0.0 0.5;
+ visible, 0;
+ }
+ }
+ part {
+ name, PART_ICON;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "padding.icon";
+ relative, 1.0 0.5;
+ }
+ rel2 {
+ to, "padding.icon";
+ relative, 1.0 0.5;
+ }
+ min, 60 60;
+ fixed, 1 1;
+ align, 0.0 0.5;
+ }
+ }
+ part {
+ name, "padding.title";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_ICON;
+ relative, 1.0 0.0;
+ }
+ rel2 {
+ to, PART_ICON;
+ relative, 1.0 1.0;
+ }
+ min, 32 0;
+ fixed, 1 0;
+ align, 0.0 0.5;
+ visible, 0;
+ }
+ }
+ part {
+ name, PART_TITLE;
+ type, TEXT;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "padding.title";
+ relative, 1.0 0.0;
+ }
+ rel2 {
+ to, "padding.title";
+ relative, 1.0 1.0;
+ }
+ min, 296 0;
+ color, 255 255 255 255;
+ align, 0.0 0.0;
+ fixed, 1 0;
+ text {
+ font, "TizenSans";
+ size, 30;
+ align, 0.0 0.5;
+ }
+ }
+ }
+ }
+ programs {
+ program {
+ name, "initial_focus_pre";
+ signal, SIG_INITIAL_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ target, "clip.bg2";
+ after, "focus";
+ }
+ program {
+ name, "focus";
+ signal, SIG_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ after, "focus_post";
+ }
+ program {
+ name, "focus_post";
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg2";
+ }
+ program {
+ name, "focus_from_next";
+ signal, SIG_FOCUS_FROM_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "next" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus_from_prev";
+ signal, SIG_FOCUS_FROM_UP;
+ source, SRC_PROG;
+ action, STATE_SET "prev" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "unfocus_to_next";
+ signal, SIG_UNFOCUS_TO_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "next" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_to_prev";
+ signal, SIG_UNFOCUS_TO_UP;
+ source, SRC_PROG;
+ action, STATE_SET "prev" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus";
+ signal, SIG_UNFOCUS_TO_HBAR;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus2";
+ signal, SIG_UNFOCUS_TO_HBAR;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg2";
+ }
+ program {
+ name, "unfocus_from_xbar";
+ signal, SIG_UNFOCUS_FROM_XBAR;
+ source, SRC_PROG;
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_from_xbar2";
+ signal, SIG_UNFOCUS_FROM_XBAR;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg2";
+ }
+ program {
+ name, "unfocus_to_xbar";
+ signal, SIG_UNFOCUS_TO_XBAR;
+ source, SRC_PROG;
+ action, STATE_SET "xbar" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_to_xbar2";
+ signal, SIG_UNFOCUS_TO_XBAR;
+ source, SRC_PROG;
+ action, STATE_SET "xbar" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg2";
+ }
+ program {
+ name, "hide";
+ signal, SIG_HIDE;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ target, "clip.bg2";
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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/defs.h"
+
+group {
+ name, GRP_DBAR_ALBUM;
+ parts {
+ part {
+ name, "over";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 0 0 0 0;
+ }
+ }
+ part {
+ name, "clip";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 596 397;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, PART_THUMB;
+ type, SWALLOW;
+ scale, 1;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel2 {
+ to, PART_TITLE;
+ relative, 1.0 0.0;
+ }
+ }
+ }
+ part {
+ name, "text.bg";
+ type, RECT;
+ scale, 1;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel1.to, PART_TITLE;
+ rel2.to, PART_TITLE;
+ color, 40 40 40 191;
+ }
+ }
+ part {
+ name, "clip.bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "text.bg";
+ relative, -1.0 0.0;
+ }
+ rel2 {
+ to, "text.bg";
+ relative, 0.0 1.0;
+ }
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 1.0;
+ }
+ description {
+ state, "prev" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 -1.0;
+ rel2.relative, 1.0 0.0;
+ }
+ description {
+ state, "next" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ rel2.relative, 1.0 2.0;
+ }
+ }
+ part {
+ name, PART_BG;
+ type, SWALLOW;
+ scale, 1;
+ clip_to, "clip.bg";
+ description {
+ state, "default" 0.0;
+ rel1.to, "text.bg";
+ rel2.to, "text.bg";
+ }
+ }
+ part {
+ name, PART_TITLE;
+ type, TEXT;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ min, 0 63;
+ fixed, 0 1;
+ align, 0.5 1.0;
+ text {
+ font, "TizenSans:style=Bold";
+ size, 20;
+ min, 0 0;
+ align, 0.041 0.5;
+ }
+ }
+ }
+ }
+ programs {
+ program {
+ name, "initial_focus_pre";
+ signal, SIG_INITIAL_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus";
+ signal, SIG_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "focus_from_next";
+ signal, SIG_FOCUS_FROM_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "next" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus_from_prev";
+ signal, SIG_FOCUS_FROM_UP;
+ source, SRC_PROG;
+ action, STATE_SET "prev" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "unfocus_to_next";
+ signal, SIG_UNFOCUS_TO_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "next" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_to_prev";
+ signal, SIG_UNFOCUS_TO_UP;
+ source, SRC_PROG;
+ action, STATE_SET "prev" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus";
+ signal, SIG_UNFOCUS_TO_HBAR;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "hide";
+ signal, SIG_HIDE;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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/defs.h"
+
+group {
+ name, GRP_DBAR_MUSIC;
+ images {
+ image, "ico_default_music_126.png" COMP;
+ }
+ data.item, DATA_TITLE_WIDTH "240";
+ parts {
+ part {
+ name, "over";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 0 0 0 0;
+ }
+ }
+ part {
+ name, "clip";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 284 382;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, "clip.thumb";
+ type, RECT;
+ scale, 1;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel2 {
+ to_y, PART_BG;
+ relative, 1.0 0.0;
+ }
+ }
+ }
+ part {
+ name, "default_icon";
+ type, IMAGE;
+ scale, 1;
+ clip_to, "clip.thumb";
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_THUMB;
+ relative, 0.5 0.5;
+ }
+ rel2 {
+ to, PART_THUMB;
+ relative, 0.5 0.5;
+ }
+ min, 126 126;
+ fixed, 1 1;
+ image.normal, "ico_default_music_126.png";
+ }
+ }
+ part {
+ name, PART_THUMB;
+ type, SWALLOW;
+ scale, 1;
+ clip_to, "clip.thumb";
+ description {
+ state, "default" 0.0;
+ rel1.to, "clip.thumb";
+ rel2.to, "clip.thumb";
+ }
+ }
+ part {
+ name, "text.bg";
+ type, RECT;
+ scale, 1;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel1.to, PART_BG;
+ rel2.to, PART_BG;
+ color, 40 40 40 191;
+ }
+ }
+ part {
+ name, "clip.bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "text.bg";
+ relative, -1.0 0.0;
+ }
+ rel2 {
+ to, "text.bg";
+ relative, 0.0 1.0;
+ }
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 1.0;
+ }
+ description {
+ state, "up" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 -1.0;
+ rel2.relative, 1.0 0.0;
+ }
+ description {
+ state, "down" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ rel2.relative, 1.0 2.0;
+ }
+ description {
+ state, "right" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 1.0 0.0;
+ rel2.relative, 2.0 1.0;
+ }
+ description {
+ state, "left" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, -1.0 0.0;
+ rel2.relative, 0.0 1.0;
+ }
+ }
+ part {
+ name, PART_BG;
+ type, SWALLOW;
+ scale, 1;
+ clip_to, "clip.bg";
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ min, 0 91;
+ fixed, 0 1;
+ align, 0.5 1.0;
+ }
+ }
+ part {
+ name, PART_TITLE;
+ type, SWALLOW;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_BG;
+ relative, 0.5 0.5;
+ }
+ rel2 {
+ to, PART_BG;
+ relative, 0.5 0.5;
+ }
+ min, 240 0;
+ fixed, 1 1;
+ align, 0.5 1.0;
+ }
+ }
+ part {
+ name, PART_SUBTITLE;
+ type, TEXT;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_BG;
+ relative, 0.5 0.5;
+ }
+ rel2 {
+ to, PART_BG;
+ relative, 0.5 0.5;
+ }
+ min, 240 25;
+ fixed, 1 1;
+ align, 0.5 0.0;
+ text {
+ font, "TizenSans:style=Bold";
+ size, 20;
+ min, 0 0;
+ align, 0.0 0.5;
+ }
+ color, 180 180 180 255;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "initial_focus_pre";
+ signal, SIG_INITIAL_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus";
+ signal, SIG_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "focus_from_down";
+ signal, SIG_FOCUS_FROM_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "down" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus_from_up";
+ signal, SIG_FOCUS_FROM_UP;
+ source, SRC_PROG;
+ action, STATE_SET "up" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus_from_right";
+ signal, SIG_FOCUS_FROM_RIGHT;
+ source, SRC_PROG;
+ action, STATE_SET "right" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus_from_left";
+ signal, SIG_FOCUS_FROM_LEFT;
+ source, SRC_PROG;
+ action, STATE_SET "left" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "unfocus_to_down";
+ signal, SIG_UNFOCUS_TO_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "down" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_to_up";
+ signal, SIG_UNFOCUS_TO_UP;
+ source, SRC_PROG;
+ action, STATE_SET "up" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_to_left";
+ signal, SIG_UNFOCUS_TO_LEFT;
+ source, SRC_PROG;
+ action, STATE_SET "left" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_to_right";
+ signal, SIG_UNFOCUS_TO_RIGHT;
+ source, SRC_PROG;
+ action, STATE_SET "right" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus";
+ signal, SIG_UNFOCUS_TO_HBAR;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "hide";
+ signal, SIG_HIDE;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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/defs.h"
+
+group {
+ name, GRP_DBAR_NOTIFICATION;
+ parts {
+ part {
+ name, "over";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 0 0 0 0;
+ }
+ }
+ part {
+ name, "clip";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 596 126;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, "text.bg";
+ type, RECT;
+ scale, 1;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ min, 0 126;
+ fixed, 0 1;
+ align, 0.5 1.0;
+ color, 40 40 40 100;
+ }
+ }
+ part {
+ name, "clip.bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "text.bg";
+ relative, -1.0 0.0;
+ }
+ rel2 {
+ to, "text.bg";
+ relative, 0.0 1.0;
+ }
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 1.0;
+ }
+ description {
+ state, "prev" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 -1.0;
+ rel2.relative, 1.0 0.0;
+ }
+ description {
+ state, "next" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ rel2.relative, 1.0 2.0;
+ }
+ description {
+ state, "xbar" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 1.0 0.0;
+ rel2.relative, 2.0 1.0;
+ }
+ }
+ part {
+ name, "clip.bg2";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ color, 0 0 0 0;
+ }
+ description {
+ state, "xbar" 0.0;
+ color, 132 132 132 132;
+ }
+ }
+ part {
+ name, PART_BG;
+ type, SWALLOW;
+ scale, 1;
+ clip_to, "clip.bg";
+ description {
+ state, "default" 0.0;
+ rel1.to, "text.bg";
+ rel2.to, "text.bg";
+ }
+ }
+ part {
+ name, PART_BG2;
+ type, SWALLOW;
+ clip_to, "clip.bg2";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, PART_BG;
+ rel2.to, PART_BG;
+ }
+ }
+ part {
+ name, "pad.top_left";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, "text.bg";
+ rel2 {
+ to, "text.bg";
+ relative, 0.0 0.0;
+ }
+ align, 0.0 0.0;
+ fixed, 1 1;
+ min, 38 18;
+ visible, 0;
+ }
+ }
+ part {
+ name, PART_TITLE;
+ type, TEXT;
+ clip_to, "clip";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "pad.top_left";
+ relative, 1.0 1.0;
+ }
+ rel2.to, "pad.top_left";
+ text {
+ font, "TizenSans";
+ size, 30;
+ align, 0.0 0.5;
+ }
+ fixed, 1 1;
+ align, 0.0 0.0;
+ min, 414 50;
+ color, 255 255 255 255;
+
+ }
+ }
+ part {
+ name, PART_SUBTITLE;
+ type, TEXT;
+ clip_to, "clip";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_TITLE;
+ relative, 0.0 1.0;
+ }
+ rel2 {
+ to, PART_TITLE;
+ relative, 0.0 1.0;
+ }
+ text {
+ font, "TizenSans";
+ size, 22;
+ align, 0.0 0.5;
+ }
+ min, 414 26;
+ fixed, 1 1;
+ align, 0.0 0.0;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, PART_DESCRIPTION;
+ type, TEXT;
+ clip_to, "clip";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_SUBTITLE;
+ relative, 0.0 1.0;
+ }
+ rel2 {
+ to, PART_SUBTITLE;
+ relative, 0.0 1.0;
+ }
+ text {
+ font, "TizenSans";
+ size, 22;
+ align, 0.0 0.5;
+ }
+ min, 414 26;
+ fixed, 1 1;
+ align, 0.0 0.0;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, "pad.top_right";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "text.bg";
+ relative, 1.0 0.0;
+ }
+ rel2 {
+ to, "text.bg";
+ relative, 1.0 0.0;
+ }
+ align, 1.0 0.0;
+ fixed, 1 1;
+ min, 32 30;
+ visible, 0;
+ }
+ }
+ part {
+ name, PART_THUMB;
+ type, SWALLOW;
+ clip_to, "clip";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "pad.top_right";
+ relative, 0.0 1.0 ;
+ }
+ rel2 {
+ to, "pad.top_right";
+ relative, 0.0 1.0 ;
+ }
+ min, 70 70;
+ align, 1.0 0.0;
+ fixed, 1 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "initial_focus_pre";
+ signal, SIG_INITIAL_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ target, "clip.bg2";
+ after, "focus";
+ }
+ program {
+ name, "focus";
+ signal, SIG_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ after, "focus_post";
+ }
+ program {
+ name, "focus_post";
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg2";
+ }
+ program {
+ name, "focus_from_next";
+ signal, SIG_FOCUS_FROM_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "next" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus_from_prev";
+ signal, SIG_FOCUS_FROM_UP;
+ source, SRC_PROG;
+ action, STATE_SET "prev" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "unfocus_to_next";
+ signal, SIG_UNFOCUS_TO_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "next" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_to_prev";
+ signal, SIG_UNFOCUS_TO_UP;
+ source, SRC_PROG;
+ action, STATE_SET "prev" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus";
+ signal, SIG_UNFOCUS_TO_HBAR;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus2";
+ signal, SIG_UNFOCUS_TO_HBAR;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg2";
+ }
+ program {
+ name, "unfocus_from_xbar";
+ signal, SIG_UNFOCUS_FROM_XBAR;
+ source, SRC_PROG;
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_from_xbar2";
+ signal, SIG_UNFOCUS_FROM_XBAR;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg2";
+ }
+ program {
+ name, "unfocus_to_xbar";
+ signal, SIG_UNFOCUS_TO_XBAR;
+ source, SRC_PROG;
+ action, STATE_SET "xbar" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_to_xbar2";
+ signal, SIG_UNFOCUS_TO_XBAR;
+ source, SRC_PROG;
+ action, STATE_SET "xbar" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg2";
+ }
+ program {
+ name, "hide";
+ signal, SIG_HIDE;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ target, "clip.bg2";
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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/defs.h"
+
+group {
+ name, GRP_DBAR_SOURCE;
+ parts {
+ part {
+ name, "over";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 40 40 40 191;
+ }
+ }
+ part {
+ name, "clip";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 284 288;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, "pad.thumb";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 0 21;
+ rel1.relative, 0.5 0.0;
+ rel2.relative, 0.5 0.0;
+ align, 0.5 0.0;
+ }
+ }
+ part {
+ name, "clip.thumb";
+ type, RECT;
+ scale, 1;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "pad.thumb";
+ relative, 0.5 1.0;
+ }
+ rel2 {
+ to, "pad.thumb";
+ relative, 0.5 1.0;
+ }
+ align, 0.5 0.0;
+ min, 160 160;
+ fixed, 1 1;
+ }
+ }
+ part {
+ name, PART_BG;
+ type, SWALLOW;
+ scale, 1;
+ clip_to, "clip.bg";
+ description {
+ state, "default" 0.0;
+ }
+ }
+ part {
+ name, PART_THUMB;
+ type, SWALLOW;
+ scale, 1;
+ clip_to, "clip.thumb";
+ description {
+ state, "default" 0.0;
+ rel1.to, "clip.thumb";
+ rel2.to, "clip.thumb";
+ }
+ }
+ part {
+ name, "clip.bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.relative, -1.0 0.0;
+ rel2.relative, 0.0 1.0;
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 1.0;
+ }
+ description {
+ state, "up" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 -1.0;
+ rel2.relative, 1.0 0.0;
+ }
+ description {
+ state, "down" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ rel2.relative, 1.0 2.0;
+ }
+ description {
+ state, "right" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 1.0 0.0;
+ rel2.relative, 2.0 1.0;
+ }
+ description {
+ state, "left" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, -1.0 0.0;
+ rel2.relative, 0.0 1.0;
+ }
+ }
+ part {
+ name, PART_TITLE;
+ type, TEXT;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_THUMB;
+ relative, 0.5 1.0;
+ }
+ rel2 {
+ to, PART_THUMB;
+ relative, 0.5 1.0;
+ }
+ min, 238 30;
+ fixed, 1 1;
+ align, 0.5 0.0;
+ text {
+ font, "TizenSans:style=Bold";
+ size, 24;
+ min, 0 1;
+ align, 0.5 0.5;
+ }
+ color, 211 211 211 255;
+ }
+ }
+ part {
+ name, PART_SUBTITLE;
+ type, TEXT;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_TITLE;
+ relative, 0.5 1.0;
+ }
+ rel2 {
+ to, PART_TITLE;
+ relative, 0.5 1.0;
+ }
+ min, 238 30;
+ fixed, 1 1;
+ align, 0.5 0.0;
+ text {
+ font, "TizenSans:style=Bold";
+ size, 20;
+ min, 0 0;
+ align, 0.5 0.5;
+ }
+ color, 180 180 180 255;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "initial_focus_pre";
+ signal, SIG_INITIAL_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus";
+ signal, SIG_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "focus_from_down";
+ signal, SIG_FOCUS_FROM_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "down" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus_from_up";
+ signal, SIG_FOCUS_FROM_UP;
+ source, SRC_PROG;
+ action, STATE_SET "up" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus_from_right";
+ signal, SIG_FOCUS_FROM_RIGHT;
+ source, SRC_PROG;
+ action, STATE_SET "right" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus_from_left";
+ signal, SIG_FOCUS_FROM_LEFT;
+ source, SRC_PROG;
+ action, STATE_SET "left" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "unfocus_to_down";
+ signal, SIG_UNFOCUS_TO_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "down" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_to_up";
+ signal, SIG_UNFOCUS_TO_UP;
+ source, SRC_PROG;
+ action, STATE_SET "up" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_to_left";
+ signal, SIG_UNFOCUS_TO_LEFT;
+ source, SRC_PROG;
+ action, STATE_SET "left" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_to_right";
+ signal, SIG_UNFOCUS_TO_RIGHT;
+ source, SRC_PROG;
+ action, STATE_SET "right" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus";
+ signal, SIG_UNFOCUS_TO_HBAR;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "hide";
+ signal, SIG_HIDE;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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/defs.h"
+
+group {
+ name, GRP_ALBUM_THUMB;
+ images {
+ image, "ico_default_video_180_w.png" COMP;
+ image, "ico_default_video_94_w.png" COMP;
+ image, "round_rectangle_4X4.png" COMP;
+ }
+ parts {
+ part {
+ name, "bg";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ min, 596 334;
+ visible, 0;
+ }
+ }
+ part {
+ name, "clip.1";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ }
+ description {
+ state, "3" 0.0;
+ inherit, "default" 0.0;
+ rel2.relative, 0.0 1.0;
+ align, 0.0 0.5;
+ min, 396 0;
+ fixed, 1 0;
+ }
+ description {
+ state, "6" 0.0;
+ inherit, "default" 0.0;
+ rel2.relative, 0.0 0.0;
+ align, 0.0 0.0;
+ min, 198 166;
+ fixed, 1 1;
+ }
+ }
+ part {
+ name, PART_THUMB_1;
+ type, SWALLOW;
+ clip_to, "clip.1";
+ description {
+ state, "default" 0.0;
+ rel1.to, "clip.1";
+ rel2.to, "clip.1";
+ }
+ }
+ part {
+ name, "clip.default.1";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ rel1.to, PART_THUMB_1;
+ rel2.to, PART_THUMB_1;
+ visible, 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ }
+ part {
+ name, "bg.thumb1.default_video";
+ type, IMAGE;
+ clip_to, "clip.default.1";
+ description {
+ state, "default" 0.0;
+ rel1.to, "thumb1.default_video";
+ rel2.to, "thumb1.default_video";
+ image.normal, "round_rectangle_4X4.png";
+ image.border, 4 4 4 4;
+ color, 0 0 0 76;
+ }
+ }
+ part {
+ name, "thumb1.default_video";
+ type, IMAGE;
+ clip_to, "clip.default.1";
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_THUMB_1;
+ relative, 0.5 0.5;
+ }
+ rel2 {
+ to, PART_THUMB_1;
+ relative, 0.5 0.5;
+ }
+ image.normal, "ico_default_video_180_w.png";
+ min, 180 180;
+ fixed, 1 1;
+ }
+ description {
+ state, "3" 0.0;
+ inherit, "default" 0.0;
+ }
+ description {
+ state, "6" 0.0;
+ inherit, "default" 0.0;
+ image.normal, "ico_default_video_94_w.png";
+ min, 94 94;
+ }
+ }
+ part {
+ name, "clip.2";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ visible, 0;
+ }
+ description {
+ state, "3" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 1.0 0.0;
+ rel2.relative, 1.0 0.0;
+ visible, 1;
+ align, 1.0 0.0;
+ min, 198 166;
+ fixed, 1 1;
+ }
+ description {
+ state, "6" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.5 0.0;
+ rel2.relative, 0.5 0.0;
+ visible, 1;
+ align, 0.5 0.0;
+ min, 198 166;
+ fixed, 1 1;
+ }
+ }
+ part {
+ name, PART_THUMB_2;
+ type, SWALLOW;
+ clip_to, "clip.2";
+ description {
+ state, "default" 0.0;
+ rel1.to, "clip.2";
+ rel2.to, "clip.2";
+ }
+ }
+ part {
+ name, "clip.default.2";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ rel1.to, PART_THUMB_2;
+ rel2.to, PART_THUMB_2;
+ visible, 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ }
+ part {
+ name, "bg.thumb2.default_video";
+ type, IMAGE;
+ clip_to, "clip.default.2";
+ description {
+ state, "default" 0.0;
+ rel1.to, "thumb2.default_video";
+ rel2.to, "thumb2.default_video";
+ image.normal, "round_rectangle_4X4.png";
+ image.border, 4 4 4 4;
+ color, 0 0 0 76;
+ }
+ }
+ part {
+ name, "thumb2.default_video";
+ type, IMAGE;
+ clip_to, "clip.default.2";
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_THUMB_2;
+ relative, 0.5 0.5;
+ }
+ rel2 {
+ to, PART_THUMB_2;
+ relative, 0.5 0.5;
+ }
+ image.normal, "ico_default_video_180_w.png";
+ min, 180 180;
+ fixed, 1 1;
+ }
+ description {
+ state, "3" 0.0;
+ inherit, "default" 0.0;
+ image.normal, "ico_default_video_94_w.png";
+ min, 94 94;
+ }
+ description {
+ state, "6" 0.0;
+ inherit, "default" 0.0;
+ image.normal, "ico_default_video_94_w.png";
+ min, 94 94;
+ }
+ }
+ part {
+ name, "clip.3";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ visible, 0;
+ }
+ description {
+ state, "3" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 1.0 1.0;
+ visible, 1;
+ align, 1.0 1.0;
+ min, 198 166;
+ fixed, 1 1;
+ }
+ description {
+ state, "6" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 1.0 0.0;
+ rel2.relative, 1.0 0.0;
+ visible, 1;
+ align, 1.0 0.0;
+ min, 198 166;
+ fixed, 1 1;
+ }
+ }
+ part {
+ name, PART_THUMB_3;
+ type, SWALLOW;
+ clip_to, "clip.3";
+ description {
+ state, "default" 0.0;
+ rel1.to, "clip.3";
+ rel2.to, "clip.3";
+ }
+ }
+ part {
+ name, "bg.thumb3.default_video";
+ type, IMAGE;
+ clip_to, "clip.default.3";
+ description {
+ state, "default" 0.0;
+ rel1.to, "thumb3.default_video";
+ rel2.to, "thumb3.default_video";
+ image.normal, "round_rectangle_4X4.png";
+ image.border, 4 4 4 4;
+ color, 0 0 0 76;
+ }
+ }
+ part {
+ name, "clip.default.3";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ rel1.to, PART_THUMB_3;
+ rel2.to, PART_THUMB_3;
+ visible, 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ }
+ part {
+ name, "thumb3.default_video";
+ type, IMAGE;
+ clip_to, "clip.default.3";
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_THUMB_3;
+ relative, 0.5 0.5;
+ }
+ rel2 {
+ to, PART_THUMB_3;
+ relative, 0.5 0.5;
+ }
+ image.normal, "ico_default_video_180_w.png";
+ min, 180 180;
+ fixed, 1 1;
+ }
+ description {
+ state, "3" 0.0;
+ inherit, "default" 0.0;
+ image.normal, "ico_default_video_94_w.png";
+ min, 94 94;
+ }
+ description {
+ state, "6" 0.0;
+ inherit, "default" 0.0;
+ image.normal, "ico_default_video_94_w.png";
+ min, 94 94;
+ }
+ }
+ part {
+ name, "clip.4";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ visible, 0;
+ }
+ description {
+ state, "3" 0.0;
+ inherit, "default" 0.0;
+ visible, 0;
+ }
+ description {
+ state, "6" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ rel2.relative, 0.0 1.0;
+ visible, 1;
+ align, 0.0 1.0;
+ min, 198 166;
+ fixed, 1 1;
+ }
+ }
+ part {
+ name, PART_THUMB_4;
+ type, SWALLOW;
+ clip_to, "clip.4";
+ description {
+ state, "default" 0.0;
+ rel1.to, "clip.4";
+ rel2.to, "clip.4";
+ }
+ }
+ part {
+ name, "clip.default.4";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ rel1.to, PART_THUMB_4;
+ rel2.to, PART_THUMB_4;
+ visible, 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ }
+ part {
+ name, "bg.thumb4.default_video";
+ type, IMAGE;
+ clip_to, "clip.default.4";
+ description {
+ state, "default" 0.0;
+ rel1.to, "thumb4.default_video";
+ rel2.to, "thumb4.default_video";
+ image.normal, "round_rectangle_4X4.png";
+ image.border, 4 4 4 4;
+ color, 0 0 0 76;
+ }
+ }
+ part {
+ name, "thumb4.default_video";
+ type, IMAGE;
+ clip_to, "clip.default.4";
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_THUMB_4;
+ relative, 0.5 0.5;
+ }
+ rel2 {
+ to, PART_THUMB_4;
+ relative, 0.5 0.5;
+ }
+ image.normal, "ico_default_video_180_w.png";
+ min, 180 180;
+ fixed, 1 1;
+ }
+ description {
+ state, "3" 0.0;
+ inherit, "default" 0.0;
+ }
+ description {
+ state, "6" 0.0;
+ inherit, "default" 0.0;
+ image.normal, "ico_default_video_94_w.png";
+ min, 94 94;
+ }
+ }
+ part {
+ name, "clip.5";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ visible, 0;
+ }
+ description {
+ state, "3" 0.0;
+ inherit, "default" 0.0;
+ visible, 0;
+ }
+ description {
+ state, "6" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.5 1.0;
+ rel2.relative, 0.5 1.0;
+ visible, 1;
+ align, 0.5 1.0;
+ min, 198 166;
+ fixed, 1 1;
+ }
+ }
+ part {
+ name, PART_THUMB_5;
+ type, SWALLOW;
+ clip_to, "clip.5";
+ description {
+ state, "default" 0.0;
+ rel1.to, "clip.5";
+ rel2.to, "clip.5";
+ }
+ }
+ part {
+ name, "clip.default.5";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ rel1.to, PART_THUMB_5;
+ rel2.to, PART_THUMB_5;
+ visible, 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ }
+ part {
+ name, "bg.thumb5.default_video";
+ type, IMAGE;
+ clip_to, "clip.default.5";
+ description {
+ state, "default" 0.0;
+ rel1.to, "thumb5.default_video";
+ rel2.to, "thumb5.default_video";
+ image.normal, "round_rectangle_4X4.png";
+ image.border, 4 4 4 4;
+ color, 0 0 0 76;
+ }
+ }
+ part {
+ name, "thumb5.default_video";
+ type, IMAGE;
+ clip_to, "clip.default.5";
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_THUMB_5;
+ relative, 0.5 0.5;
+ }
+ rel2 {
+ to, PART_THUMB_5;
+ relative, 0.5 0.5;
+ }
+ image.normal, "ico_default_video_180_w.png";
+ min, 180 180;
+ fixed, 1 1;
+ }
+ description {
+ state, "3" 0.0;
+ inherit, "default" 0.0;
+ }
+ description {
+ state, "6" 0.0;
+ inherit, "default" 0.0;
+ image.normal, "ico_default_video_94_w.png";
+ min, 94 94;
+ }
+ }
+ part {
+ name, "clip.6";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ visible, 0;
+ }
+ description {
+ state, "3" 0.0;
+ inherit, "default" 0.0;
+ visible, 0;
+ }
+ description {
+ state, "6" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 1.0 1.0;
+ rel2.relative, 1.0 1.0;
+ visible, 1;
+ align, 1.0 1.0;
+ min, 198 166;
+ fixed, 1 1;
+ }
+ }
+ part {
+ name, PART_THUMB_6;
+ type, SWALLOW;
+ clip_to, "clip.6";
+ description {
+ state, "default" 0.0;
+ rel1.to, "clip.6";
+ rel2.to, "clip.6";
+ }
+ }
+ part {
+ name, "clip.default.6";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ rel1.to, PART_THUMB_6;
+ rel2.to, PART_THUMB_6;
+ visible, 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ }
+ part {
+ name, "bg.thumb6.default_video";
+ type, IMAGE;
+ clip_to, "clip.default.6";
+ description {
+ state, "default" 0.0;
+ rel1.to, "thumb6.default_video";
+ rel2.to, "thumb6.default_video";
+ image.normal, "round_rectangle_4X4.png";
+ image.border, 4 4 4 4;
+ color, 0 0 0 76;
+ }
+ }
+ part {
+ name, "thumb6.default_video";
+ type, IMAGE;
+ clip_to, "clip.default.6";
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_THUMB_6;
+ relative, 0.5 0.5;
+ }
+ rel2 {
+ to, PART_THUMB_6;
+ relative, 0.5 0.5;
+ }
+ image.normal, "ico_default_video_180_w.png";
+ min, 180 180;
+ fixed, 1 1;
+ }
+ description {
+ state, "3" 0.0;
+ inherit, "default" 0.0;
+ }
+ description {
+ state, "6" 0.0;
+ inherit, "default" 0.0;
+ image.normal, "ico_default_video_94_w.png";
+ min, 94 94;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "mode.3";
+ signal, SIG_THUMB_3;
+ source, SRC_PROG;
+ action, STATE_SET "3" 0.0;
+ target, "clip.1";
+ target, "clip.2";
+ target, "clip.3";
+ target, "clip.4";
+ target, "clip.5";
+ target, "clip.6";
+ target, "thumb1.default_video";
+ target, "thumb2.default_video";
+ target, "thumb3.default_video";
+ target, "thumb4.default_video";
+ target, "thumb5.default_video";
+ target, "thumb6.default_video";
+ }
+ program {
+ name, "mode.6";
+ signal, SIG_THUMB_6;
+ source, SRC_PROG;
+ action, STATE_SET "6" 0.0;
+ target, "clip.1";
+ target, "clip.2";
+ target, "clip.3";
+ target, "clip.4";
+ target, "clip.5";
+ target, "clip.6";
+ target, "thumb1.default_video";
+ target, "thumb2.default_video";
+ target, "thumb3.default_video";
+ target, "thumb4.default_video";
+ target, "thumb5.default_video";
+ target, "thumb6.default_video";
+ }
+ program {
+ name, "thumb1.video";
+ signal, SIG_SHOW_THUMB1_VIDEO;
+ source, SRC_PROG;
+ action, STATE_SET "show" 0.0;
+ target, "clip.default.1";
+ }
+ program {
+ name, "thumb2.video";
+ signal, SIG_SHOW_THUMB2_VIDEO;
+ source, SRC_PROG;
+ action, STATE_SET "show" 0.0;
+ target, "clip.default.2";
+ }
+ program {
+ name, "thumb3.video";
+ signal, SIG_SHOW_THUMB3_VIDEO;
+ source, SRC_PROG;
+ action, STATE_SET "show" 0.0;
+ target, "clip.default.3";
+ }
+ program {
+ name, "thumb4.video";
+ signal, SIG_SHOW_THUMB4_VIDEO;
+ source, SRC_PROG;
+ action, STATE_SET "show" 0.0;
+ target, "clip.default.4";
+ }
+ program {
+ name, "thumb5.video";
+ signal, SIG_SHOW_THUMB5_VIDEO;
+ source, SRC_PROG;
+ action, STATE_SET "show" 0.0;
+ target, "clip.default.5";
+ }
+ program {
+ name, "thumb6.video";
+ signal, SIG_SHOW_THUMB6_VIDEO;
+ source, SRC_PROG;
+ action, STATE_SET "show" 0.0;
+ target, "clip.default.6";
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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/defs.h"
+
+group {
+ name, GRP_DBAR_ITEM;
+ styles {
+ style {
+ name: "noctnt_desc_style";
+ base: "font=TizenSans:style=Bold font_size=24 color=#868686 wrap=word left_margin=2 right_margin=2 align=center";
+ tag: "hilight" "+ font_weight=Bold";
+ tag: "b" "+ font_weight=Bold";
+ }
+ }
+ parts {
+ part {
+ name, "bg";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ color, 0 0 0 0;
+ }
+ }
+ part {
+ name, "clip";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ color, 0 0 0 0;
+ }
+ description {
+ state, "show" 0.0;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, PART_DEFAULT_TITLE;
+ type, TEXT;
+ clip_to, "clip";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.5 0.5;
+ rel2.relative, 0.5 0.5;
+ text {
+ font, "TizenSans:style=Bold";
+ size, 35;
+ }
+ align, 0.5 1.0;
+ color, 211 211 211 255;
+ }
+ }
+ part {
+ name, PART_DEFAULT_DESC;
+ type, TEXTBLOCK;
+ clip_to, "clip";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.05 0.5;
+ rel2.relative, 0.95 0.5;
+ text {
+ font, "TizenSans:style=Bold";
+ style, "noctnt_desc_style";
+ min, 0 1;
+ }
+ align, 0.5 0.0;
+ fixed, 1 1;
+ color, 134 134 134 255;
+ }
+ }
+ part {
+ name, PART_CONTENT;
+ type, SWALLOW;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "show";
+ signal, SIG_SHOW;
+ source, SRC_PROG;
+ action, STATE_SET "show" 0.0;
+ transition, LINEAR 0.3;
+ target, "clip";
+ }
+ program {
+ name, "hide";
+ signal, SIG_HIDE;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.1;
+ target, "clip";
+ }
+ }
+}
+
+group {
+ name, GRP_DBAR_LABEL;
+ parts {
+ part {
+ name, "bg";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ min, 586 90;
+ visible, 0;
+ }
+ }
+ part {
+ name, "guide";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ min, 0 20;
+ align, 0.5 0.0;
+ visible, 0;
+ }
+ }
+ part {
+ name, PART_TITLE;
+ type, TEXT;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "guide";
+ relative, 0.5 1.0;
+ }
+ rel2 {
+ to, "guide";
+ relative, 0.5 1.0;
+ }
+ min, 568 73;
+ fixed, 1 1;
+ align, 0.5 1.0;
+ text {
+ font, "TizenSans:style=Bold";
+ size, 27;
+ align, 0.0 0.5;
+ min, 0 0;
+ }
+ color, 211 211 211 255;
+ }
+ }
+ }
+}
+
+group {
+ name, GRP_DBAR_COMMON;
+ parts {
+ part {
+ name, "over";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 0 0 0 0;
+ }
+ }
+ part {
+ name, "clip";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 596 255;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, PART_THUMB;
+ type, SWALLOW;
+ scale, 1;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel2 {
+ to, PART_TITLE;
+ relative, 1.0 0.0;
+ }
+ }
+ }
+ part {
+ name, "text.bg";
+ type, RECT;
+ scale, 1;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel1.to, PART_TITLE;
+ rel2.to, PART_TITLE;
+ color, 40 40 40 191;
+ }
+ }
+ part {
+ name, "clip.bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "text.bg";
+ relative, -1.0 0.0;
+ }
+ rel2 {
+ to, "text.bg";
+ relative, 0.0 1.0;
+ }
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 1.0;
+ }
+ description {
+ state, "prev" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 -1.0;
+ rel2.relative, 1.0 0.0;
+ }
+ description {
+ state, "next" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ rel2.relative, 1.0 2.0;
+ }
+ }
+ part {
+ name, PART_BG;
+ type, SWALLOW;
+ scale, 1;
+ clip_to, "clip.bg";
+ description {
+ state, "default" 0.0;
+ rel1.to, "text.bg";
+ rel2.to, "text.bg";
+ }
+ }
+ part {
+ name, PART_TITLE;
+ type, TEXT;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ min, 0 63;
+ fixed, 0 1;
+ align, 0.5 1.0;
+ text {
+ font, "TizenSans:style=Bold";
+ size, 20;
+ min, 0 0;
+ align, 0.041 0.5;
+ }
+ }
+ }
+ }
+ programs {
+ program {
+ name, "initial_focus_pre";
+ signal, SIG_INITIAL_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus";
+ signal, SIG_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "focus_from_next";
+ signal, SIG_FOCUS_FROM_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "next" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "focus_from_prev";
+ signal, SIG_FOCUS_FROM_UP;
+ source, SRC_PROG;
+ action, STATE_SET "prev" 0.0;
+ target, "clip.bg";
+ after, "focus";
+ }
+ program {
+ name, "unfocus_to_next";
+ signal, SIG_UNFOCUS_TO_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "next" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_to_prev";
+ signal, SIG_UNFOCUS_TO_UP;
+ source, SRC_PROG;
+ action, STATE_SET "prev" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus";
+ signal, SIG_UNFOCUS_TO_HBAR;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "hide";
+ signal, SIG_HIDE;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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/defs.h"
+
+group {
+ name, GRP_HOMEBAR_ITEM;
+ data.item, DATA_TITLE_WIDTH "220";
+ parts {
+ part {
+ name, "part_map";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ perspective {
+ zplane, 0;
+ focal, 1000;
+ }
+ visible, 0;
+ }
+ description {
+ state, "clicked" 0.0;
+ inherit, "default" 0.0;
+ perspective {
+ zplane, 50;
+ focal, 1000;
+ }
+ }
+ }
+ part {
+ name, "clip.bg";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ rel1.relative, -1.0 0.0;
+ rel2.relative, 0.0 1.0;
+ color, 0 0 0 0;
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 1.0;
+ color, 255 255 255 255;
+ }
+ description {
+ state, "prev" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 -1.0;
+ rel2.relative, 1.0 0.0;
+ color, 255 255 255 255;
+ }
+ description {
+ state, "next" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ rel2.relative, 1.0 2.0;
+ color, 255 255 255 255;
+ }
+ description {
+ state, "dbar" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 1.0 0.0;
+ rel2.relative, 2.0 1.0;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, "clip.bg2";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ color, 0 0 0 0;
+ }
+ description {
+ state, "dbar" 0.0;
+ color, 132 132 132 132;
+ }
+ }
+ part {
+ name, "clip.icon";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ color, 0 0 0 0;
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ color, 255 255 255 255;
+ }
+ description {
+ state, "prev" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 -1.0;
+ rel2.relative, 1.0 0.0;
+ color, 255 255 255 255;
+ }
+ description {
+ state, "next" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ rel2.relative, 1.0 2.0;
+ color, 255 255 255 255;
+ }
+ description {
+ state, "dbar" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 1.0 0.0;
+ rel2.relative, 2.0 1.0;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, PART_BG2;
+ type, SWALLOW;
+ clip_to, "clip.bg2";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, PART_BG;
+ rel2.to, PART_BG;
+ }
+ }
+ part {
+ name, PART_BG;
+ type, SWALLOW;
+ clip_to, "clip.bg";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 270 150;
+ }
+ }
+ part {
+ name, "padding.t";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel2.relative, 1.0 0.0;
+ min, 0 26;
+ fixed, 0 1;
+ align, 0.5 0.0;
+ visible, 0;
+ }
+ }
+ part {
+ name, PART_ICON;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "padding.t";
+ relative, 0.5 1.0;
+ }
+ rel2 {
+ to, "padding.t";
+ relative, 0.5 1.0;
+ }
+ min, 76 76;
+ fixed, 1 1;
+ align, 0.5 0.0;
+ color, 255 255 255 255;
+ map {
+ on, 0;
+ perspective_on, 1;
+ alpha, 1;
+ perspective, "part_map";
+ }
+ }
+ description {
+ state, "clicked" 0.0;
+ inherit, "default" 0.0;
+ map.on, 1;
+ }
+ }
+ part {
+ name, PART_ICON_FOCUS;
+ type, SWALLOW;
+ clip_to, "clip.icon";
+ description {
+ state, "default" 0.0;
+ rel1.to, PART_ICON;
+ rel2.to, PART_ICON;
+ map {
+ on, 0;
+ perspective_on, 1;
+ alpha, 1;
+ perspective, "part_map";
+ }
+ }
+ description {
+ state, "clicked" 0.0;
+ inherit, "default" 0.0;
+ map.on, 1;
+ }
+ }
+ part {
+ name, PART_NAME;
+ type, SWALLOW;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_ICON;
+ relative, 0.5 1.0;
+ }
+ rel2 {
+ to, PART_ICON;
+ relative, 0.5 1.0;
+ }
+ min, 220 36;
+ align, 0.5 0.0;
+ fixed, 1 1;
+ map {
+ on, 0;
+ perspective_on, 1;
+ alpha, 1;
+ perspective, "part_map";
+ }
+ }
+ description {
+ state, "clicked" 0.0;
+ inherit, "default" 0.0;
+ map.on, 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "initial_focus_pre";
+ signal, SIG_INITIAL_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ target, "clip.icon";
+ target, "clip.bg2";
+ target, PART_ICON;
+ after, "focus";
+ }
+ program {
+ name, "focus";
+ signal, SIG_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ target, "clip.icon";
+ after, "focus_post";
+ }
+ program {
+ name, "focus_post";
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg2";
+ }
+ program {
+ name, "focus_from_edit";
+ signal, SIG_FOCUS_FROM_EDIT;
+ source, SRC_PROG;
+ action, STATE_SET "dbar" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ target, "clip.icon";
+ after, "focus";
+ }
+ program {
+ name, "focus_from_next";
+ signal, SIG_FOCUS_FROM_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "next" 0.0;
+ target, "clip.bg";
+ target, "clip.icon";
+ }
+ program {
+ name, "focus_from_next2";
+ signal, SIG_FOCUS_FROM_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, PART_ICON;
+ target, "clip.bg2";
+ after, "focus_from2";
+ }
+ program {
+ name, "focus_from_prev";
+ signal, SIG_FOCUS_FROM_UP;
+ source, SRC_PROG;
+ action, STATE_SET "prev" 0.0;
+ target, "clip.bg";
+ target, "clip.icon";
+ }
+ program {
+ name, "focus_from_prev2";
+ signal, SIG_FOCUS_FROM_UP;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, PART_ICON;
+ target, "clip.bg2";
+ after, "focus_from2";
+ }
+ program {
+ name, "focus_from2";
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ target, "clip.icon";
+ }
+ program {
+ name, "unfocus_to_next";
+ signal, SIG_UNFOCUS_TO_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "next" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ target, "clip.icon";
+ }
+ program {
+ name, "unfocus_to_next2";
+ signal, SIG_UNFOCUS_TO_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg2";
+ }
+ program {
+ name, "unfocus_to_prev";
+ signal, SIG_UNFOCUS_TO_UP;
+ source, SRC_PROG;
+ action, STATE_SET "prev" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ target, "clip.icon";
+ }
+ program {
+ name, "unfocus_to_prev2";
+ signal, SIG_UNFOCUS_TO_UP;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg2";
+ }
+ program {
+ name, "unfocus_to_dbar";
+ signal, SIG_UNFOCUS_TO_DBAR;
+ source, SRC_PROG;
+ action, STATE_SET "dbar" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_to_dbar2";
+ signal, SIG_UNFOCUS_TO_DBAR;
+ source, SRC_PROG;
+ action, STATE_SET "dbar" 0.0;
+ target, "clip.bg2";
+ }
+ program {
+ name, "hide";
+ signal, SIG_HIDE;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ target, "clip.bg2";
+ target, "clip.icon";
+ target, PART_ICON;
+ }
+ program {
+ name, "click_edit_item_on";
+ signal, SIG_SHOW_EDIT_ITEM;
+ source, SRC_PROG;
+ action, STATE_SET "clicked" 0.0;
+ target, PART_NAME;
+ target, PART_ICON;
+ target, PART_ICON_FOCUS;
+ }
+ program {
+ name, "click_edit_item";
+ signal, SIG_SHOW_EDIT_ITEM;
+ source, SRC_PROG;
+ action, STATE_SET "clicked" 0.0;
+ target, "part_map";
+ transition, DECELERATE 0.2;
+ after, "after_clicked";
+ }
+ program {
+ name, "after_clicked";
+ action, STATE_SET "default" 0.0;
+ target, "part_map";
+ transition, DECELERATE 0.2;
+ }
+ }
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 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/defs.h"
+
+group {
+ name, GRP_MAIN;
+ images {
+ image, "ico_homebar_menu_arrow.png" COMP;
+ image, "dynamicbar_shadow.png" COMP;
+ }
+ script {
+ public mouse_on;
+ }
+ parts {
+ part {
+ name, "guide.hbar";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel2.relative, 0.0 1.0;
+ min, 300 0;
+ align, 1.0 0.5;
+ fixed, 1 1;
+ visible, 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ min, 0 0;
+ }
+ }
+ part {
+ name, "clip.hbar";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ color, 0 0 0 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, "bg.larrow";
+ type, RECT;
+ clip_to, "clip.hbar";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, "guide.hbar";
+ rel2 {
+ to, "guide.hbar";
+ relative, 0.0 1.0;
+ }
+ min, 30 0;
+ align, 0.0 0.5;
+ color, 0 0 0 150;
+ fixed, 1 0;
+ }
+ }
+ part {
+ name, "larrow";
+ type, IMAGE;
+ clip_to, "clip.hbar";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "bg.larrow";
+ relative, 0.0 0.5;
+ }
+ rel2 {
+ to, "bg.larrow";
+ relative, 1.0 0.5;
+ }
+ min, 0 30;
+ fixed, 0 1;
+ image.normal, "ico_homebar_menu_arrow.png";
+ visible, 1;
+ }
+ description {
+ state, "dim" 0.0;
+ inherit, "default" 0.0;
+ visible, 0;
+ }
+ }
+ part {
+ name, "bg.hbar";
+ type, RECT;
+ clip_to, "clip.hbar";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "bg.larrow";
+ relative, 1.0 0.0;
+ }
+ rel2.to, "bg.larrow";
+ min, 270 0;
+ fixed, 1 0;
+ align, 0.0 0.5;
+ color, 0 0 0 216;
+ }
+ }
+ part {
+ name, PART_HOMEBAR;
+ type, SWALLOW;
+ clip_to, "clip.hbar";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_USER;
+ relative, 0.0 1.0;
+ }
+ rel2.to, "bg.hbar";
+ }
+ }
+ part {
+ name, PART_USER;
+ type, SWALLOW;
+ clip_to, "clip.hbar";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, "bg.hbar";
+ rel2 {
+ to, "bg.hbar";
+ relative, 1.0 0.0;
+ }
+ min, 270 0;
+ fixed, 1 0;
+ align, 0.5 0.0;
+ }
+ }
+ part {
+ name, "clip.ubar";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_USER;
+ relative, 1.0 0.0;
+ }
+ rel2.to, PART_USER;
+ min, 553 0;
+ fixed, 1 0;
+ align, 0.0 0.5;
+ color, 0 0 0 0;
+ visible, 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ color, 255 255 255 255;
+ visible, 1;
+ }
+ }
+ part {
+ name, "bg.ubar";
+ type, RECT;
+ clip_to, "clip.ubar";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, "clip.ubar";
+ rel2.to, "clip.ubar";
+ color, 23 31 54 192;
+ }
+ }
+ part {
+ name, "shadow.ubar";
+ type, IMAGE;
+ clip_to, "clip.ubar";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, "bg.ubar";
+ rel2 {
+ to, "bg.ubar";
+ relative, 0.0 1.0;
+ }
+ min, 9 0;
+ fixed, 1 0;
+ align, 0.0 0.5;
+ image.normal, "dynamicbar_shadow.png";
+ }
+ }
+ part {
+ name, PART_UBAR;
+ type, SWALLOW;
+ clip_to, "clip.ubar";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "shadow.ubar";
+ relative, 1.0 0.0;
+ }
+ rel2.to, "shadow.ubar";
+ min, 553 0;
+ fixed, 1 0;
+ align, 0.0 0.5;
+ }
+ }
+ part {
+ name, "clip.dbar";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "bg.hbar";
+ relative, 1.0 0.0;
+ }
+ rel2 {
+ to, "bg.hbar";
+ relative, 1.0 1.0;
+ }
+ min, 636 0;
+ fixed, 1 1;
+ align, 0.0 0.5;
+ color, 0 0 0 0;
+ visible, 1;
+ }
+ description {
+ state, "show.pre" 0.0;
+ inherit, "default" 0.0;
+ min, 580 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ color, 255 255 255 255;
+ min, 636 0;
+ }
+ description {
+ state, "hide" 0.0;
+ inherit, "default" 0.0;
+ visible, 0;
+ }
+ }
+ part {
+ name, "bg.dbar";
+ type, RECT;
+ clip_to, "clip.dbar";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, "clip.dbar";
+ rel2.to, "clip.dbar";
+ color, 0 0 0 240;
+ }
+ }
+ part {
+ name, "shadow.dbar";
+ type, IMAGE;
+ clip_to, "clip.dbar";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, "bg.dbar";
+ rel2 {
+ to, "bg.dbar";
+ relative, 0.0 1.0;
+ }
+ min, 9 0;
+ fixed, 1 0;
+ align, 0.0 0.5;
+ image.normal, "dynamicbar_shadow.png";
+ }
+ }
+ part {
+ name, PART_DYNAMICBAR;
+ type, SWALLOW;
+ clip_to, "clip.dbar";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "bg.dbar";
+ relative, 0.5 0.0;
+ }
+ rel2 {
+ to, "bg.dbar";
+ relative, 0.5 1.0;
+ }
+ min, 596 0;
+ fixed, 1 0;
+ }
+ }
+ part {
+ name, "outside.right";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "bg.dbar";
+ relative, 1.0 0.0;
+ }
+ color, 0 0 0 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "outside.right.clicked";
+ source, "outside.right";
+ signal, "mouse,clicked,1";
+ action, SIGNAL_EMIT SIG_OUTSIDE_CLICKED SRC_EDJE;
+ }
+ program {
+ name, "larrow.down";
+ action, SIGNAL_EMIT SIG_ARROW_CLICKED SRC_EDJE;
+ }
+ program {
+ name, "bg.larrow.down";
+ source, "bg.larrow";
+ signal, "mouse,clicked,1";
+ script {
+ if (get_int(mouse_on) == 0)
+ run_program(PROGRAM:"larrow.down");
+ }
+ }
+ program {
+ name, "larrow.down.clicked";
+ source, "larrow";
+ signal, "mouse,clicked,1";
+ script {
+ if (get_int(mouse_on) == 0)
+ run_program(PROGRAM:"larrow.down");
+ }
+ }
+ program {
+ name, "show.hbar";
+ source, SRC_PROG;
+ signal, SIG_SHOW_HOMEBAR;
+ action, STATE_SET "show" 0.0;
+ transition, LINEAR 0.5;
+ target, "guide.hbar";
+ target, "clip.hbar";
+ after, "show.hbar.done";
+ }
+ program {
+ name, "show.hbar.done";
+ action, SIGNAL_EMIT SIG_SHOW_HOMEBAR_DONE SRC_PROG;
+ }
+ program {
+ name, "show.hbar2";
+ source, SRC_PROG;
+ signal, SIG_SHOW_HOMEBAR;
+ action, STATE_SET "show.pre" 0.0;
+ target, "clip.dbar";
+ }
+ program {
+ name, "show.hbar.post";
+ source, SRC_PROG;
+ signal, SIG_SHOW_HOMEBAR_DONE;
+ action, STATE_SET "show" 0.0;
+ transition, LINEAR 0.2 CURRENT;
+ target, "clip.dbar";
+ }
+ program {
+ name, "hide.hbar";
+ source, SRC_PROG;
+ signal, SIG_HIDE_HOMEBAR;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.5;
+ target, "guide.hbar";
+ target, "clip.hbar";
+ target, "clip.ubar";
+ target, "clip.dbar";
+ after, "hide.hbar.done";
+ }
+ program {
+ name, "hide.hbar.done";
+ action, SIGNAL_EMIT SIG_HIDE_HOMEBAR_DONE SRC_PROG;
+ }
+ program {
+ name, "show.ubar";
+ source, SRC_PROG;
+ signal, SIG_SHOW_UBAR;
+ action, STATE_SET "show" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.ubar";
+ }
+ program {
+ name, "hide.ubar";
+ source, SRC_PROG;
+ signal, SIG_HIDE_UBAR;
+ action, STATE_SET "default" 0.0;
+ target, "clip.ubar";
+ }
+ program {
+ name, "show.dbar";
+ source, SRC_PROG;
+ signal, SIG_SHOW_DBAR;
+ action, STATE_SET "show" 0.0;
+ transition, LINEAR 0.5;
+ target, "clip.dbar";
+ }
+ program {
+ name, "hide.dbar";
+ source, SRC_PROG;
+ signal, SIG_HIDE_DBAR;
+ action, STATE_SET "hide" 0.0;
+ transition, LINEAR 0.5;
+ target, "clip.dbar";
+ }
+ program {
+ name, "dim.larrow";
+ source, SRC_PROG;
+ action, STATE_SET "dim" 0.0;
+ transition, LINEAR 0.2;
+ target, "larrow";
+ }
+ program {
+ source, SRC_PROG;
+ signal, SIG_DIM_ITEM;
+ script {
+ set_int(mouse_on, 1);
+ }
+ after, "dim.larrow";
+ }
+ program {
+ name, "undim.larrow";
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.2;
+ target, "larrow";
+ }
+ program {
+ source, SRC_PROG;
+ signal, SIG_UNDIM_ITEM;
+ script {
+ set_int(mouse_on, 0);
+ }
+ after, "undim.larrow";
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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/defs.h"
+
+group {
+ name, GRP_USER;
+ parts {
+ part {
+ name, "area";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 270 215;
+ color, 20 20 21 80;
+ }
+ }
+ part {
+ name, "clip.bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.relative, -1.0 0.0;
+ rel2.relative, 0.0 1.0;
+ color, 0 0 0 0;
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 1.0;
+ color, 69 143 255 255;
+ }
+ description {
+ state, "hbar" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ rel2.relative, 1.0 2.0;
+ color, 69 143 255 255;
+ }
+ description {
+ state, "ubar" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 1.0 0.0;
+ rel2.relative, 2.0 1.0;
+ color, 69 143 255 255;
+ }
+ }
+ part {
+ name, "clip.bg2";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 0 0 0 0;
+ }
+ description {
+ state, "hlight" 0.0;
+ color, 30 68 125 132;
+ }
+ }
+ part {
+ name, "clip.thumb_bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 0 0 0 25;
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ color, 255 255 255 255;
+ }
+ description {
+ state, "hlight" 0.0;
+ inherit, "default" 0.0;
+ color, 255 255 255 132;
+ }
+ }
+ part {
+ name, "clip.thumb";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 136 148 186 255;
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ color, 69 143 255 255;
+ }
+ description {
+ state, "hlight" 0.0;
+ inherit, "default" 0.0;
+ color, 10 33 70 210;
+ }
+ }
+ part {
+ name, PART_BG2;
+ type, RECT;
+ clip_to, "clip.bg2";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, PART_BG;
+ rel2.to, PART_BG;
+ }
+ }
+ part {
+ name, PART_BG;
+ type, RECT;
+ clip_to, "clip.bg";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 270 215;
+ }
+ }
+ part {
+ name, "padding.tl";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel2 {
+ to, "area";
+ relative, 0.0 0.0;
+ }
+ min, 78 35;
+ align, 0.0 0.0;
+ fixed, 1 1;
+ visible, 0;
+ }
+ }
+ part {
+ name, PART_USER_THUMB_BG;
+ clip_to, "clip.thumb_bg";
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "padding.tl";
+ relative, 1.0 1.0;
+ }
+ rel2.to, "padding.tl";
+ min, 114 114;
+ align, 0.0 0.0;
+ fixed, 1 1;
+ color, 0 0 0 25;
+ }
+ }
+ part {
+ name, PART_USER_THUMB;
+ clip_to, "clip.thumb";
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "padding.tl";
+ relative, 1.0 1.0;
+ }
+ rel2.to, "padding.tl";
+ min, 114 114;
+ align, 0.0 0.0;
+ fixed, 1 1;
+ color, 136 148 186 255;
+ }
+ }
+ part {
+ name, PART_USER_NAME;
+ type, TEXT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, PART_USER_THUMB;
+ relative, 0.0 1.0;
+ }
+ rel2.to, PART_USER_THUMB;
+ text {
+ font, "TizenSans:style=Bold";
+ size, 27;
+ }
+ min, 230 40;
+ align, 0.5 0.0;
+ fixed, 1 1;
+ color, 255 255 255 255;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "focus";
+ signal, SIG_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "focus" 0.0;
+ target, "clip.bg";
+ target, "clip.thumb_bg";
+ target, "clip.thumb";
+ after, "focus_post";
+ }
+ program {
+ name, "focus_post";
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg2";
+ }
+ program {
+ name, "unfocus";
+ signal, SIG_UNFOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ target, "clip.thumb_bg";
+ target, "clip.thumb";
+ after, "focus_post";
+ }
+ program {
+ name, "unfocus_post";
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg2";
+ }
+ program {
+ name, "focus_from_hbar";
+ signal, SIG_FOCUS_FROM_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "hbar" 0.0;
+ target, "clip.bg";
+ }
+ program {
+ name, "focus_from_hbar2";
+ signal, SIG_FOCUS_FROM_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg2";
+ after, "from_hbar2";
+ }
+ program {
+ name, "from_hbar2";
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.40;
+ target, "clip.bg";
+ target, "clip.thumb_bg";
+ target, "clip.thumb";
+ }
+ program {
+ name, "focus_from_ubar";
+ signal, SIG_FOCUS_FROM_RIGHT;
+ source, SRC_PROG;
+ action, STATE_SET "ubar" 0.0;
+ target, "clip.bg";
+ }
+ program {
+ name, "focus_from_ubar2";
+ signal, SIG_FOCUS_FROM_RIGHT;
+ source, SRC_PROG;
+ action, STATE_SET "hlight" 0.0;
+ target, "clip.bg2";
+ after, "from_hbar2";
+ }
+ program {
+ name, "from_ubar2";
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ target, "clip.thumb_bg";
+ target, "clip.thumb";
+ }
+ program {
+ name, "unfocus_to_hbar_pre";
+ signal, SIG_UNFOCUS_TO_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "focus" 0.0;
+ target, "clip.bg";
+ target, "clip.thumb_bg";
+ target, "clip.thumb";
+ }
+ program {
+ name, "unfocus_to_hbar";
+ signal, SIG_UNFOCUS_TO_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "hbar" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_to_hbar2";
+ signal, SIG_UNFOCUS_TO_DOWN;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg2";
+ target, "clip.thumb_bg";
+ target, "clip.thumb";
+ }
+ program {
+ name, "highlight";
+ signal, SIG_HIGHLIGHT;
+ source, SRC_PROG;
+ action, STATE_SET "ubar" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "highlight_post";
+ signal, SIG_HIGHLIGHT;
+ source, SRC_PROG;
+ action, STATE_SET "hlight" 0.0;
+ target, "clip.bg2";
+ target, "clip.thumb_bg";
+ target, "clip.thumb";
+ }
+ program {
+ name, "highlight_from_popover";
+ signal, SIG_HLIGHT_FROM_POPOVER;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ }
+ program {
+ name, "highlight_from_popover2";
+ signal, SIG_HLIGHT_FROM_POPOVER;
+ source, SRC_PROG;
+ action, STATE_SET "hlight" 0.0;
+ target, "clip.bg2";
+ target, "clip.thumb_bg";
+ target, "clip.thumb";
+ }
+ program {
+ name, "hide";
+ signal, SIG_HIDE;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ target, "clip.bg2";
+ target, "clip.thumb_bg";
+ target, "clip.thumb";
+ }
+ }
+}
+
+group {
+ name, GRP_UBAR;
+ parts {
+ part {
+ name, "bg";
+ type, RECT;
+ scale, 1;
+ clip_to, "clip";
+ description {
+ state, "default" 0.0;
+ color, 0 0 0 0;
+ }
+ }
+ part {
+ name, "clip";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 255 255 255 255;
+ }
+ description {
+ state, "hide" 0.0;
+ inherit, "default" 0.0;
+ color, 0 0 0 0;
+ }
+ }
+ part {
+ name, PART_UBAR_CONTENT;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "show";
+ signal, SIG_SHOW;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip";
+ }
+ program {
+ name, "hide";
+ signal, SIG_HIDE;
+ source, SRC_PROG;
+ action, STATE_SET "hide" 0.0;
+ target, "clip";
+ }
+ }
+}
+
+group {
+ name, GRP_UBAR_POPUP_ITEM;
+ data.item, DATA_TITLE_WIDTH "114";
+ images {
+ image, "box_years_nor.png" COMP;
+ image, "box_years_foc.png" COMP;
+ }
+ parts {
+ part {
+ name, PART_BG;
+ type, RECT;
+ scale, 1;
+ clip_to, "clip.bg";
+ description {
+ state, "default" 0.0;
+ min, 114 142;
+ color, 0 0 0 0;
+ }
+ }
+ part {
+ name, "clip.bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 1.0;
+ }
+ description {
+ state, "hide" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, -1.0 0.0;
+ rel2.relative, 0.0 1.0;
+ }
+ }
+ part {
+ name, "clip.thumb_bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 27 32 45 55;
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ color, 69 143 255 255;
+ }
+ }
+ part {
+ name, "clip.thumb";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 10 33 70 170;
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, PART_USER_THUMB_BG;
+ type, SWALLOW;
+ clip_to, "clip.thumb_bg";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, PART_BG;
+ rel2.relative, 0.0 0.0;
+ rel2.to, PART_BG;
+ min, 114 114;
+ align, 0.0 0.0;
+ fixed, 1 1;
+ color, 27 32 45 55;
+ }
+ }
+ part {
+ name, PART_USER_THUMB;
+ type, SWALLOW;
+ clip_to, "clip.thumb";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, PART_BG;
+ rel2.relative, 0.0 0.0;
+ rel2.to, PART_BG;
+ min, 114 114;
+ align, 0.0 0.0;
+ fixed, 1 1;
+ }
+ }
+ part {
+ name, "padding.name";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ relative, 0.5 1.0;
+ to, PART_USER_THUMB_BG;
+ }
+ rel2 {
+ relative, 0.5 1.0;
+ to, PART_USER_THUMB_BG;
+ }
+ min, 0 5;
+ align, 0.0 0.0;
+ fixed, 0 0;
+ visible, 0;
+ }
+ }
+ part {
+ name, PART_USER_NAME_POPUP;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ relative, 0.0 1.0;
+ to, "padding.name";
+ }
+ rel2 {
+ relative, 0.0 1.0;
+ to, "padding.name";
+ }
+ min, 114 16;
+ align, 0.5 0.0;
+ fixed, 1 1;
+ }
+ }
+ part {
+ name, "age.bg";
+ type, IMAGE;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 41 26;
+ rel1 {
+ to, PART_USER_THUMB_BG;
+ relative, 1.0 1.0;
+ }
+ rel2.to, PART_USER_THUMB_BG;
+ fixed, 1 1;
+ align, 1.0 1.0;
+ image {
+ normal, "box_years_nor.png";
+ border, 13 13 0 0;
+ }
+ visible, 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ image.normal, "box_years_foc.png";
+ visible, 1;
+ }
+ }
+ part {
+ name, PART_USER_AGE;
+ type, TEXT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, "age.bg";
+ rel2.to, "age.bg";
+ text {
+ size, 19;
+ font, "TizenSans";
+ text, "14";
+ }
+ color, 121 136 155 255;
+ visible, 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ color, 255 255 255 255;
+ visible, 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "focus";
+ signal, SIG_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.15;
+ target, "clip.thumb_bg";
+ target, "clip.thumb";
+ // after, "focus.age";
+ }
+ program {
+ name, "unfocus";
+ signal, SIG_UNFOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.15;
+ target, "clip.thumb_bg";
+ target, "clip.thumb";
+ // after, "unfocus.age";
+ }
+ program {
+ name, "hide";
+ signal, SIG_HIDE;
+ source, SRC_PROG;
+ action, STATE_SET "hide" 0.0;
+ target, "clip.bg";
+ }
+ program {
+ name, "show.age";
+ signal, SIG_SHOW_AGE;
+ source, SRC_PROG;
+ action, STATE_SET "show" 0.0;
+ target, PART_USER_AGE;
+ target, "age.bg";
+ }
+ program {
+ name, "focus.age";
+ source, SRC_PROG;
+ script {
+ new st[31];
+ new Float:vl;
+ get_state(PART:PART_USER_AGE, st, 30, vl);
+ if (!strcmp(st, "show")) {
+ set_state(PART:PART_USER_AGE, "focus", 0.0);
+ set_state(PART:"age.bg", "focus", 0.0);
+ }
+ }
+ }
+ program {
+ name, "unfocus.age";
+ source, SRC_PROG;
+ script {
+ new st[31];
+ new Float:vl;
+ get_state(PART:PART_USER_AGE, st, 30, vl);
+ if (!strcmp(st, "focus")) {
+ set_state(PART:PART_USER_AGE, "show", 0.0);
+ set_state(PART:"age.bg", "show", 0.0);
+ }
+
+ }
+ }
+ }
+}
+
+group {
+ name, GRP_UBAR_ITEM;
+ parts {
+ part {
+ name, PART_BG;
+ type, RECT;
+ scale, 1;
+ clip_to, "clip.bg";
+ description {
+ state, "default" 0.0;
+ min, 115 142;
+ color, 0 0 0 0;
+ }
+ }
+ part {
+ name, "clip.bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 1.0;
+ }
+ description {
+ state, "hide" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, -1.0 0.0;
+ rel2.relative, 0.0 1.0;
+ }
+ }
+ part {
+ name, "clip.thumb_bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 27 32 45 102;
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ color, 69 143 255 255;
+ }
+ description {
+ state, "hlight" 0.0;
+ inherit, "default" 0.0;
+ color, 69 143 255 102;
+ }
+ }
+ part {
+ name, "clip.thumb";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 151 165 207 255;
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ color, 255 255 255 255;
+ }
+ description {
+ state, "hlight" 0.0;
+ inherit, "default" 0.0;
+ color, 255 255 255 192;
+ }
+ }
+ part {
+ name,"padding.thumb";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, PART_BG;
+ rel2.relative, 0.0 0.0;
+ rel2.to, PART_BG;
+ min, 8 8;
+ align, 0.0 .0.0;
+ fixed, 1 1;
+ visible, 0;
+ }
+ }
+ part {
+ name, PART_USER_THUMB_BG;
+ type, SWALLOW;
+ clip_to, "clip.thumb_bg";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ relative, 1.0 1.0;
+ to, "padding.thumb";
+ }
+ rel2.to, "padding.thumb";
+ min, 98 98;
+ align, 0.0 0.0;
+ fixed, 1 1;
+ color, 27 32 45 102;
+ }
+ }
+ part {
+ name, PART_USER_THUMB;
+ type, SWALLOW;
+ clip_to, "clip.thumb";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ relative, 1.0 1.0;
+ to, "padding.thumb";
+ }
+ rel2.to, "padding.thumb";
+ min, 98 98;
+ align, 0.0 0.0;
+ fixed, 1 1;
+ color, 151 165 207 255;
+ }
+ }
+ part {
+ name, "padding.name";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ relative, 0.0 1.0;
+ to, PART_USER_THUMB;
+ }
+ rel2 {
+ relative, 0.0 1.0;
+ to, PART_USER_THUMB;
+ }
+ min, 8 8;
+ align, 1.0 0.0;
+ fixed, 0 0;
+ visible, 0;
+ }
+ }
+ part {
+ name, PART_USER_NAME;
+ type, TEXT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ relative, 0.0 1.0;
+ to, "padding.name";
+ }
+ rel2 {
+ relative, 0.0 1.0;
+ to, "padding.name";
+ }
+ text {
+ font, "TizenSans:style=Bold";
+ size, 21;
+ }
+ min, 115 27;
+ align, 0.0 0.0;
+ fixed, 1 1;
+ color, 255 255 255 255;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "focus";
+ signal, SIG_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.thumb_bg";
+ target, "clip.thumb";
+ }
+ program {
+ name, "unfocus";
+ signal, SIG_UNFOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.thumb_bg";
+ target, "clip.thumb";
+ }
+ program {
+ name, "hide";
+ signal, SIG_HIDE;
+ source, SRC_PROG;
+ action, STATE_SET "hide" 0.0;
+ target, "clip.bg";
+ }
+ program {
+ name, "highlight_from_popover";
+ signal, SIG_HLIGHT_FROM_POPOVER;
+ source, SRC_PROG;
+ action, STATE_SET "hlight" 0.0;
+ transition, LINEAR 0.1;
+ target, "clip.thumb_bg";
+ target, "clip.thumb";
+ }
+ }
+}
+
+group {
+ name, GRP_UBAR_POPUP;
+ parts {
+ part {
+ name, "area";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 926 381;
+ visible, 1;
+ }
+ }
+ part {
+ name, "pad.description";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 0 48;
+ fixed, 0 1;
+ align, 0.0 0.0;
+ rel1.to, "area";
+ rel2 {
+ to, "area";
+ relative, 1.0 0.0;
+ }
+ color, 210 215 222 255;
+ visible, 0;
+ }
+ }
+ part {
+ name, PART_KIDS;
+ type, TEXT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, "pad.description";
+ rel2.to, "pad.description";
+ text {
+ font, "TizenSans";
+ size, 22;
+ }
+ color, 121 136 155 255;
+ visible, 0;
+ }
+ }
+ part {
+ name, "pad.left.arrow";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 48 130;
+ fixed, 1 1;
+ align, 0.0 0.0;
+ rel1 {
+ to, "pad.description";
+ relative, 0.0 1.0;
+ }
+ rel2 {
+ to, "pad.description";
+ relative, 0.0 1.0;
+ }
+ visible, 0;
+ }
+ }
+ part {
+ name, "pad.right.arrow";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 48 130;
+ fixed, 1 1;
+ align, 1.0 0.0;
+ rel1 {
+ to, "pad.description";
+ relative, 1.0 1.0;
+ }
+ rel2 {
+ to, "pad.description";
+ relative, 1.0 1.0;
+ }
+ visible, 0;
+ }
+ }
+ part {
+ name, PART_LEFT_ARROW;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 40 40;
+ fixed, 1 1;
+ align, 0.0 0.0;
+ rel1 {
+ to, "pad.left.arrow";
+ relative, 1.0 1.0;
+ }
+ rel2 {
+ to, "pad.left.arrow";
+ relative, 1.0 1.0;
+ }
+ }
+ }
+ part {
+ name, PART_RIGHT_ARROW;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 40 40;
+ fixed, 1 1;
+ align, 1.0 0.0;
+ rel1 {
+ to, "pad.right.arrow";
+ relative, 0.0 1.0;
+ }
+ rel2 {
+ to, "pad.right.arrow";
+ relative, 0.0 1.0;
+ }
+ }
+ }
+ part {
+ name, "pad.user";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 0 143;
+ fixed, 1 1;
+ rel1 {
+ to, "area";
+ relative, 0.5 0.0;
+ }
+ rel2 {
+ to, "area";
+ relative, 0.5 0.0;
+ }
+ align, 0.0 0.0;
+ }
+ }
+ part {
+ name, PART_POPUP_USER;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 690 142;
+ fixed, 1 1;
+ rel1 {
+ to, "pad.user";
+ relative, 1.0 1.0;
+ }
+ rel2.to, "pad.user";
+ }
+ }
+ part {
+ name, "pad.entry";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 0 82;
+ fixed, 1 1;
+ rel1 {
+ to, "area";
+ relative, 0.5 1.0;
+ }
+ rel2 {
+ to, "area";
+ relative, 0.5 1.0;
+ }
+ align, 0.5 1.0;
+ }
+ }
+ part {
+ name, "bg.entry";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 456 59;
+ fixed, 1 1;
+ rel1.to, "pad.entry";
+ rel2 {
+ to, "pad.entry";
+ relative, 0.0 0.0;
+ }
+ color, 27 32 45 40;
+ }
+ }
+ part {
+ name, "bg.entry.border";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 452 55;
+ fixed, 1 1;
+ rel1.to, "pad.entry";
+ rel2 {
+ to, "pad.entry";
+ relative, 0.0 0.0;
+ }
+ }
+ }
+ part {
+ name, PART_POPUP_ENTRY;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ fixed, 0 0;
+ rel1.to, "bg.entry.border";
+ rel2.to, "bg.entry.border";
+ }
+ }
+ }
+}
+
+group {
+ name, GRP_UBAR_LEFT_ARROW;
+ images {
+ image, "ico_arrow_left.png" COMP;
+ }
+ parts {
+ part {
+ name, "area";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 40 40;
+ visible, 0;
+ }
+ }
+ part {
+ name, "arrow";
+ type, IMAGE;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, "area";
+ rel2.to, "area";
+ image.normal, "ico_arrow_left.png";
+ visible, 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "show";
+ signal, SIG_SHOW;
+ source, SRC_PROG;
+ action, STATE_SET "show" 0.0;
+ target, "arrow";
+ }
+ program {
+ name, "hide";
+ signal, SIG_HIDE;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "arrow";
+ }
+ }
+}
+
+group {
+ name, GRP_UBAR_RIGHT_ARROW;
+ images {
+ image, "ico_arrow_right.png" COMP;
+ }
+ parts {
+ part {
+ name, "area";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 40 40;
+ visible, 0;
+ }
+ }
+ part {
+ name, "arrow";
+ type, IMAGE;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, "area";
+ rel2.to, "area";
+ image.normal, "ico_arrow_right.png";
+ visible, 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "show";
+ signal, SIG_SHOW;
+ source, SRC_PROG;
+ action, STATE_SET "show" 0.0;
+ target, "arrow";
+ }
+ program {
+ name, "hide";
+ signal, SIG_HIDE;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "arrow";
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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/defs.h"
+
+group {
+ name, GRP_CBAR_X;
+ images {
+ image, "ico_delete.png" COMP;
+ }
+ parts {
+ part {
+ name, "area";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 63 63;
+ color, 0 0 0 0;
+ visible, 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ }
+ part {
+ name, "clip.area";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "area";
+ relative, -1.0 0.0;
+ }
+ rel2 {
+ to, "area";
+ relative, 0.0 1.0;
+ }
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ rel1 {
+ to, "area";
+ relative, 0.0 0.0;
+ }
+ rel2 {
+ to, "area";
+ relative, 1.0 1.0;
+ }
+ }
+ }
+ part {
+ name, "clip.bg";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "area";
+ relative, -1.0 0.0;
+ }
+ rel2 {
+ to, "area";
+ relative, 0.0 1.0;
+ }
+ }
+ description {
+ state, "focus" 0.0;
+ inherit, "default" 0.0;
+ rel1 {
+ to, "area";
+ relative, 0.0 0.0;
+ }
+ rel2 {
+ to, "area";
+ relative, 1.0 1.0;
+ }
+ }
+ }
+ part {
+ name, PART_BG2;
+ type, SWALLOW;
+ clip_to, "clip.area";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, "area";
+ rel2.to, "area";
+ min, 63 63;
+ }
+ }
+ part {
+ name, PART_BG;
+ type, SWALLOW;
+ clip_to, "clip.bg";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.to, "area";
+ rel2.to, "area";
+ min, 63 63;
+ }
+ }
+ part {
+ name, "icon";
+ type, IMAGE;
+ clip_to, "clip.area";
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "area";
+ relative, 0.5 0.5;
+ }
+ rel2 {
+ to, "area";
+ relative, 0.5 0.5;
+ }
+ min, 40 40;
+ image.normal, "ico_delete.png";
+ fixed, 1 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "initial_focus_pre";
+ signal, SIG_INITIAL_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ target, "icon";
+ target, "area";
+ after, "focus";
+ }
+ program {
+ name, "focus";
+ signal, SIG_FOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "focus" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus_pre";
+ signal, SIG_UNFOCUS;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "unfocus";
+ signal, SIG_UNFOCUS_TO_DBAR;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.35;
+ target, "clip.bg";
+ }
+ program {
+ name, "hide";
+ signal, SIG_HIDE;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ target, "clip.bg";
+ target, "clip.area";
+ target, "area";
+ }
+ program {
+ name, "hide1";
+ signal, SIG_HIDE_TO_HBAR;
+ source, SRC_PROG;
+ transition, LINEAR 0.35;
+ action, STATE_SET "default" 0.0;
+ target, "clip.area";
+ }
+ program {
+ name, "show";
+ signal, SIG_SHOW;
+ source, SRC_PROG;
+ transition, LINEAR 0.35;
+ action, STATE_SET "show" 0.0;
+ target, "area";
+ target, "clip.area";
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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/defs.h"
+
+collections {
+
+#include "widget/label.edc"
+#include "widget/ctxpopup.edc"
+#include "widget/button.edc"
+#include "widget/popup.edc"
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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/defs.h"
+
+collections {
+ #include "bar/homescreen.edc"
+ #include "bar/hbar.edc"
+ #include "bar/cbar.edc"
+ #include "bar/dbar.edc"
+ #include "bar/ubar.edc"
+ #include "bar/xbar.edc"
+
+ #include "bar/contents/app.edc"
+ #include "bar/contents/image.edc"
+ #include "bar/contents/video.edc"
+ #include "bar/contents/music.edc"
+ #include "bar/contents/source.edc"
+ #include "bar/contents/broadcast.edc"
+ #include "bar/contents/notification.edc"
+ #include "bar/contents/history.edc"
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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/defs.h"
+
+#define STATE_NORMAL 0
+#define STATE_HIGHLIGHT 1
+
+group {
+ name, "elm/button/base/shorttext";
+ images {
+ image, ICON_CHECK_FOC_PNG COMP;
+ }
+ script {
+ public cur_state;
+ public hide_line;
+ }
+ parts {
+ part {
+ name, "bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 254 75;
+ color, 255 255 255 255;
+ }
+ description {
+ state, "selected" 0.0;
+ inherit, "default" 0.0;
+ color, 69 143 255 255;
+ }
+ description {
+ state, "highlight" 0.0;
+ inherit, "default" 0.0;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, "division_line";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 254 2;
+ color, 89 89 89 51;
+ rel1 {
+ to, "bg";
+ relative, 1.0 1.0;
+ }
+ rel2 {
+ to, "bg";
+ }
+ align, 1.0 1.0;
+ fixed, 1 1;
+ }
+ description {
+ state, "selected" 0.0;
+ inherit, "default" 0.0;
+ visible, 0;
+ }
+ description {
+ state, "highlight" 0.0;
+ inherit, "default" 0.0;
+ }
+ }
+ part {
+ name, "padding_text";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 0 0;
+ rel1 {
+ to, "bg";
+ }
+ rel2 {
+ to, "bg";
+ relative, 0.0 1.0;
+ }
+ fixed, 1 0;
+ visible, 0;
+ align, 0.0 0.0;
+ }
+ }
+ part {
+ name, "elm.text";
+ type, TEXT;
+ mouse_events, 0;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 190 80;
+ rel1 {
+ to, "padding_text";
+ relative, 1.0 0.0;
+ }
+ rel2 {
+ to, "padding_text";
+ }
+ text {
+ font, FONT_STYLE_SANS_REGULAR;
+ size, 30;
+ align, 0.0 0.5;
+ }
+ color, 89 89 89 255;
+ fixed, 1 1;
+ align, 0.0 0.0;
+ }
+ description {
+ state, "selected" 0.0;
+ inherit, "default" 0.0;
+ text {
+ font, FONT_STYLE_SANS_MEDIUM;
+ }
+ color, 255 255 255 255;
+ }
+ description {
+ state, "highlight" 0.0;
+ inherit, "default" 0.0;
+ text {
+ font, FONT_STYLE_SANS_MEDIUM;
+ }
+ color, 71 210 188 255;
+ }
+ }
+ part {
+ name, "padding_icon";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 20 30;
+ rel1 {
+ to, "elm.text";
+ relative, 1.0 0.0;
+ }
+ rel2 {
+ to, "elm.text";
+ relative, 1.0 0.0;
+ }
+ fixed, 1 1;
+ visible, 0;
+ align, 0.0 0.0;
+ }
+ }
+ part {
+ name, PART_ELM_SWALLOWICON;
+ mouse_events, 0;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 20 20;
+ rel1 {
+ to, "padding_icon";
+ relative, 1.0 1.0;
+ }
+ rel2 {
+ to, "padding_icon";
+ }
+ image.normal, ICON_CHECK_FOC_PNG;
+ fixed, 1 1;
+ align, 0.0 0.0;
+ visible, 0;
+ }
+ description {
+ state, "selected" 0.0;
+ inherit, "default" 0.0;
+ visible, 1;
+ }
+ description {
+ state, "highlight" 0.0;
+ inherit, "default" 0.0;
+ image.normal, ICON_CHECK_FOC_PNG;
+ color, 71 210 188 255;
+ visible, 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name, "load";
+ signal, "load";
+ source, "";
+ script {
+ set_int(cur_state, STATE_NORMAL);
+ set_int(hide_line, 0);
+ }
+ }
+ program {
+ name, "button_down";
+ signal, "mouse,down,1";
+ source, "bg";
+ action, SIGNAL_EMIT "elm,action,press" "";
+ }
+ program {
+ name, "button_mouseup";
+ signal, "mouse,up,1";
+ source, "bg";
+ action, SIGNAL_EMIT "elm,action,unpress" "";
+ }
+ program {
+ name, "button_clicked";
+ signal, "mouse,clicked,1";
+ source, "bg";
+ action, SIGNAL_EMIT "elm,action,click" "";
+ }
+ program {
+ name, "focused";
+ signal, "elm,action,focus";
+ source, "elm";
+ script {
+ new state;
+ state = get_int(cur_state);
+
+ if (state == STATE_HIGHLIGHT)
+ set_state(PART:PART_ELM_SWALLOWICON,
+ "selected", 0.0);
+ set_state(PART:"bg", "selected", 0.0);
+ set_state(PART:"division_line", "selected",
+ 0.0);
+ set_state(PART:"elm.text", "selected", 0.0);
+ }
+ }
+ program {
+ name, "unfocused";
+ signal, "elm,action,unfocus";
+ source, "elm";
+ script {
+ new state;
+ new var;
+ new buf[100];
+ state = get_int(cur_state);
+
+ if (state == STATE_HIGHLIGHT)
+ snprintf(buf, sizeof(buf), "highlight");
+ else
+ snprintf(buf, sizeof(buf), "default");
+
+ var = get_int(hide_line);
+ set_state(PART:"bg", buf, 0.0);
+ if (!var)
+ set_state(PART:"division_line", buf,
+ 0.0);
+ set_state(PART:"elm.text", buf, 0.0);
+ set_state(PART:PART_ELM_SWALLOWICON, buf, 0.0);
+ }
+ }
+ program {
+ name, "highlight";
+ signal, "elm,action,highlight";
+ source, "elm";
+ script {
+ set_int(cur_state, STATE_HIGHLIGHT);
+ }
+ after, "highlight1";
+ }
+ program {
+ name, "highlight1";
+ action, STATE_SET "highlight" 0.0;
+ target, "bg";
+ target, "elm.text";
+ target, PART_ELM_SWALLOWICON;
+ target, "division_line";
+ }
+ program {
+ name, "hide_line";
+ signal, "elm,action,hideline";
+ source, "elm";
+ script {
+ set_int(hide_line, 1);
+ set_state(PART:"division_line", "selected",
+ 0.0);
+ }
+ }
+ }
+}
+
+group {
+ name, "elm/button/base/hovertext";
+ inherit, "elm/button/base/shorttext";
+ parts {
+ part {
+ name, "bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 254 75;
+ color, 255 255 255 255;
+ }
+ description {
+ state, "selected" 0.0;
+ inherit, "default" 0.0;
+ color, 69 143 255 255;
+ }
+ description {
+ state, "highlight" 0.0;
+ inherit, "default" 0.0;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, "division_line";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 254 2;
+ color, 89 89 89 51;
+ rel1 {
+ to, "bg";
+ relative, 1.0 1.0;
+ }
+ rel2 {
+ to, "bg";
+ }
+ align, 1.0 1.0;
+ fixed, 1 1;
+ }
+ description {
+ state, "selected" 0.0;
+ inherit, "default" 0.0;
+ visible, 0;
+ }
+ description {
+ state, "highlight" 0.0;
+ inherit, "default" 0.0;
+ }
+ }
+ part {
+ name, "elm.text";
+ type, TEXT;
+ mouse_events, 0;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 254 75;
+ rel1 {
+ to, "padding_text";
+ relative, 1.0 0.0;
+ }
+ rel2 {
+ to, "padding_text";
+ }
+ text {
+ font, FONT_STYLE_SANS_REGULAR;
+ size, 30;
+ align, 0.5 0.5;
+ }
+ color, 89 89 89 255;
+ fixed, 1 1;
+ align, 0.0 0.0;
+ }
+ description {
+ state, "selected" 0.0;
+ inherit, "default" 0.0;
+ text {
+ font, FONT_STYLE_SANS_MEDIUM;
+ }
+ color, 255 255 255 255;
+ }
+ description {
+ state, "highlight" 0.0;
+ inherit, "default" 0.0;
+ text {
+ font, FONT_STYLE_SANS_MEDIUM;
+ }
+ color, 71 210 188 255;
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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.
+ */
+
+group {
+ name, "elm/ctxpopup/base/hoverpopup";
+ images {
+ image, "popover_arrow.png" COMP;
+ }
+
+ parts {
+ part {
+ name, "elm.swallow.content";
+ type, SWALLOW;
+ description {
+ state, "default" 0.0;
+ }
+ }
+
+ part {
+ name, "padding.arrow";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1 {
+ relative, 0.0 0.0;
+ to, "elm.swallow.content";
+ }
+ rel2 {
+ relative, 0.0 0.0;
+ to, "elm.swallow.content";
+ }
+ min, 120 0;
+ align, 0.0 1.0;
+ }
+ }
+
+ part {
+ name, "arrow";
+ type, IMAGE;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ image.normal, "popover_arrow.png";
+ rel1 {
+ relative, 1.0 0.0;
+ to, "padding.arrow";
+ }
+ rel2 {
+ relative, 1.0 0.0;
+ to, "padding.arrow";
+ }
+ min, 15 10;
+ align, 0.0 1.0;
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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.
+ */
+
+styles {
+ style {
+ name, "text_style_24_unfocused_left";
+ base, "font=TizenSans:style=Bold font_size=24 color=#ffffff align=left";
+ }
+ style {
+ name, "text_style_24_focused_left";
+ base, "font=TizenSans:style=Bold font_size=24 color=#ffffff align=left";
+ }
+ style {
+ name, "text_style_24_unfocused_center";
+ base, "font=TizenSans:style=Bold font_size=22 color=#ffffff align=center";
+ }
+ style {
+ name, "text_style_24_focused_center";
+ base, "font=TizenSans:style=Bold font_size=22 color=#ffffff align=center";
+ }
+ style {
+ name, "text_style_24_dim_center";
+ base, "font=TizenSans:style=Bold font_size=22 color=#bdbdbd align=center";
+ }
+ style {
+ name, "text_style_32_unfocused_left";
+ base, "font=TizenSans font_size=32 color=#ffffff align=left";
+ }
+ style {
+ name, "text_style_32_focused_left";
+ base, "font=TizenSans font_size=32 color=#ffffff align=left";
+ }
+ style {
+ name, "text_style_40_unfocused_center";
+ base, "font=TizenSans font_size=40 color=#ffffff align=center";
+ }
+ style {
+ name, "text_style_40_focused_center";
+ base, "font=TizenSans font_size=40 color=#ffffff align=center";
+ }
+ style {
+ name, "text_style_20_unfocused_left";
+ base, "font=TizenSans font_size=20 color=#ffffff align=left";
+ }
+ style {
+ name, "text_style_20_focused_left";
+ base, "font=TizenSans font_size=20 color=#ffffff align=left";
+ }
+ style {
+ name, "text_style_22_center";
+ base, "font=TizenSans:style=Bold font_size=22 color=#79889b align=center";
+ }
+}
+
+group {
+ name, "elm/label/base/slide_style_24_left";
+ script {
+ public g_duration = 0, g_stopslide, g_timer_id, g_anim_id;
+ public message(Msg_Type:type, id, ...) {
+ if (type == MSG_FLOAT_SET) {
+ new Float:duration;
+ duration = getfarg(2);
+ set_float(g_duration, duration);
+ }
+ }
+ public slide_to_end_anim(val, Float:pos) {
+ new stopflag;
+ new id;
+ stopflag = get_int(g_stopslide);
+ if (stopflag == 1)
+ return;
+ set_tween_state(PART:"elm.text", pos, "slide_begin", 0.0, "slide_end", 0.0);
+ if (pos >= 1.0) {
+ id = timer(0.5, "slide_to_begin", 1);
+ set_int(g_timer_id, id);
+ }
+ }
+ public slide_to_end() {
+ new stopflag;
+ new id;
+ new Float:duration;
+ stopflag = get_int(g_stopslide);
+ if (stopflag == 1)
+ return;
+ duration = get_float(g_duration);
+ id = anim(duration, "slide_to_end_anim", 1);
+ set_int(g_anim_id, id);
+ }
+ public slide_to_begin() {
+ new stopflag;
+ new id;
+ stopflag = get_int(g_stopslide);
+ if (stopflag == 1) return;
+ set_state(PART:"elm.text", "slide_begin", 0.0);
+ id = timer(0.5, "slide_to_end", 1);
+ set_int(g_timer_id, id);
+ }
+ public start_slide() {
+ set_int(g_stopslide, 0);
+ set_state(PART:"elm.text", "slide_begin", 0.0);
+ slide_to_end();
+ }
+ public stop_slide() {
+ new id;
+ set_int(g_stopslide, 1);
+ id = get_int(g_anim_id);
+ cancel_anim(id);
+ id = get_int(g_timer_id);
+ cancel_timer(id);
+ set_state(PART:"elm.text", "default", 0.0);
+ }
+ }
+ parts {
+ part {
+ name, "label.text.clip";
+ type, RECT;
+ description {
+ state, "default" 0.0;
+ }
+ }
+ part {
+ name, "elm.text";
+ type, TEXTBLOCK;
+ scale, 1;
+ clip_to, "label.text.clip";
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 1.0;
+ align, 0.0 0.5;
+ text {
+ style, "text_style_24_unfocused_left";
+ align, 0.0 0.0;
+ }
+ }
+ description {
+ state, "slide_end" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 1.0 0.0;
+ rel2.relative, 1.0 1.0;
+ align, 1.0 0.5;
+ text {
+ style, "text_style_24_focused_left";
+ align, 0.0 0.0;
+ }
+ }
+ description {
+ state, "slide_begin" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 0.0 1.0;
+ align, 0.0 0.5;
+ text {
+ style, "text_style_24_focused_left";
+ align, 0.0 0.0;
+ }
+ }
+ }
+ }
+ programs {
+ program {
+ name, "start_slide";
+ signal, "elm,state,slide,start";
+ source, "elm";
+ script {
+ start_slide();
+ }
+ }
+ program {
+ name, "stop_slide";
+ signal, "elm,state,slide,stop";
+ source, "elm";
+ script {
+ stop_slide();
+ }
+ }
+ }
+}
+
+group {
+ name, "elm/label/base/slide_style_20_left";
+ inherit, "elm/label/base/slide_style_24_left";
+ parts {
+ part {
+ name, "elm.text";
+ type, TEXTBLOCK;
+ scale, 1;
+ clip_to, "label.text.clip";
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 1.0;
+ align, 0.0 0.5;
+ text {
+ style, "text_style_20_unfocused_left";
+ align, 0.0 1.0;
+ }
+ }
+ description {
+ state, "slide_end" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 1.0 0.0;
+ rel2.relative, 1.0 1.0;
+ align, 1.0 0.5;
+ text {
+ style, "text_style_20_focused_left";
+ align, 0.0 1.0;
+ }
+ }
+ description {
+ state, "slide_begin" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 0.0 1.0;
+ align, 0.0 0.5;
+ text {
+ style, "text_style_20_focused_left";
+ align, 0.0 1.0;
+ }
+ }
+ description {
+ state, "dim" 0.0;
+ inherit, "default" 0.0;
+ text.style, "text_style_20_unfocused_left";
+ color, 255 255 255 20;
+ }
+ }
+ programs {
+ program {
+ name, "dim,label";
+ signal, SIG_DIM_ITEM;
+ source, SRC_PROG;
+ action, STATE_SET "dim" 0.0;
+ transition, LINEAR 0.2;
+ target, "elm.text";
+ }
+ program {
+ name, "undim,label";
+ signal, SIG_UNDIM_ITEM;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.2;
+ target, "elm.text";
+ }
+ }
+ }
+}
+
+group {
+ name, "elm/label/base/slide_style_40_center";
+ inherit, "elm/label/base/slide_style_24_left";
+ parts {
+ part {
+ name, "elm.text";
+ type, TEXTBLOCK;
+ scale, 1;
+ clip_to, "label.text.clip";
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 1.0;
+ align, 0.0 0.5;
+ text {
+ style, "text_style_40_unfocused_center";
+ align, 0.0 1.0;
+ }
+ }
+ description {
+ state, "slide_end" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 1.0 0.0;
+ rel2.relative, 1.0 1.0;
+ align, 1.0 0.5;
+ text {
+ style, "text_style_40_focused_center";
+ align, 0.0 1.0;
+ }
+ }
+ description {
+ state, "slide_begin" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 0.0 1.0;
+ align, 0.0 0.5;
+ text {
+ style, "text_style_40_focused_center";
+ align, 0.0 1.0;
+ }
+ }
+ description {
+ state, "dim" 0.0;
+ inherit, "default" 0.0;
+ text.style, "text_style_40_unfocused_center";
+ color, 255 255 255 20;
+ }
+ }
+ programs {
+ program {
+ name, "dim,label";
+ signal, SIG_DIM_ITEM;
+ source, SRC_PROG;
+ action, STATE_SET "dim" 0.0;
+ transition, LINEAR 0.2;
+ target, "elm.text";
+ }
+ program {
+ name, "undim,label";
+ signal, SIG_UNDIM_ITEM;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.2;
+ target, "elm.text";
+ }
+ }
+ }
+}
+
+group {
+ name, "elm/label/base/slide_style_32_left";
+ inherit, "elm/label/base/slide_style_24_left";
+ parts {
+ part {
+ name, "elm.text";
+ type, TEXTBLOCK;
+ scale, 1;
+ clip_to, "label.text.clip";
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 1.0;
+ align, 0.0 0.5;
+ text {
+ style, "text_style_32_unfocused_left";
+ align, 0.0 1.0;
+ }
+ }
+ description {
+ state, "slide_end" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 1.0 0.0;
+ rel2.relative, 1.0 1.0;
+ align, 1.0 0.5;
+ text {
+ style, "text_style_32_focused_left";
+ align, 0.0 1.0;
+ }
+ }
+ description {
+ state, "slide_begin" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 0.0 1.0;
+ align, 0.0 0.5;
+ text {
+ style, "text_style_32_focused_left";
+ align, 0.0 1.0;
+ }
+ }
+ description {
+ state, "dim" 0.0;
+ inherit, "default" 0.0;
+ text.style, "text_style_32_unfocused_left";
+ color, 255 255 255 20;
+ }
+ }
+ programs {
+ program {
+ name, "dim,label";
+ signal, SIG_DIM_ITEM;
+ source, SRC_PROG;
+ action, STATE_SET "dim" 0.0;
+ transition, LINEAR 0.2;
+ target, "elm.text";
+ }
+ program {
+ name, "undim,label";
+ signal, SIG_UNDIM_ITEM;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.2;
+ target, "elm.text";
+ }
+ }
+ }
+}
+
+group {
+ name, "elm/label/base/slide_style_24_center";
+ inherit, "elm/label/base/slide_style_24_left";
+ parts {
+ part {
+ name, "elm.text";
+ type, TEXTBLOCK;
+ scale, 1;
+ clip_to, "label.text.clip";
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 1.0;
+ align, 0.0 0.5;
+ text {
+ style, "text_style_24_unfocused_center";
+ align, 0.0 1.0;
+ }
+ }
+ description {
+ state, "slide_end" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 1.0 0.0;
+ rel2.relative, 1.0 1.0;
+ align, 1.0 0.5;
+ text {
+ style, "text_style_24_focused_center";
+ align, 0.0 1.0;
+ }
+ }
+ description {
+ state, "slide_begin" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 0.0 1.0;
+ align, 0.0 0.5;
+ text {
+ style, "text_style_24_focused_center";
+ align, 0.0 1.0;
+ }
+ }
+ description {
+ state, "dim" 0.0;
+ inherit, "default" 0.0;
+ text.style, "text_style_24_dim_center";
+ color, 255 255 255 20;
+ }
+ }
+ programs {
+ program {
+ name, "dim,label";
+ signal, SIG_DIM_ITEM;
+ source, SRC_PROG;
+ action, STATE_SET "dim" 0.0;
+ transition, LINEAR 0.2;
+ target, "elm.text";
+ }
+ program {
+ name, "undim,label";
+ signal, SIG_UNDIM_ITEM;
+ source, SRC_PROG;
+ action, STATE_SET "default" 0.0;
+ transition, LINEAR 0.2;
+ target, "elm.text";
+ }
+ }
+ }
+}
+
+group {
+ name, "elm/label/base/slide_style_22_center";
+ inherit, "elm/label/base/slide_style_24_left";
+ parts {
+ part {
+ name, "elm.text";
+ type, TEXTBLOCK;
+ scale, 1;
+ clip_to, "label.text.clip";
+ description {
+ state, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 1.0;
+ align, 0.0 0.5;
+ text {
+ style, "text_style_22_center";
+ align, 0.0 1.0;
+ }
+ }
+ description {
+ state, "slide_end" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 1.0 0.0;
+ rel2.relative, 1.0 1.0;
+ align, 1.0 0.5;
+ text {
+ style, "text_style_22_center";
+ align, 0.0 1.0;
+ }
+ }
+ description {
+ state, "slide_begin" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 0.0 1.0;
+ align, 0.0 0.5;
+ text {
+ style, "text_style_22_center";
+ align, 0.0 1.0;
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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.
+ */
+
+group {
+ name, "elm/popup/base/user";
+ images {
+ image, "modal_dialogs_bg.png" RAW;
+ image, "round_rectangle_8X8_top.png" COMP;
+ }
+ parts {
+ part {
+ name, "base";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 926 603;
+ visible, 0;
+ }
+ }
+ part {
+ name, "pad.left";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 1 1;
+ fixed, 1 1;
+ align, 0.0 0.0;
+ rel1.to, "base";
+ rel2 {
+ to, "base";
+ relative, 0.0 0.0;
+ }
+ visible, 0;
+ }
+ }
+ part {
+ name, "pad.right";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 1 1;
+ fixed, 1 1;
+ align, 0.0 0.0;
+ rel1 {
+ to, "base";
+ relative, 1.0 0.0;
+ }
+ rel2 {
+ to, "base";
+ relative, 1.0 0.0;
+ }
+ visible, 0;
+ }
+ }
+ part {
+ name, "base_image";
+ type, IMAGE;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ fixed, 0 0;
+ align, 0.0 0.0;
+ rel1 {
+ to, "pad.left";
+ relative, 1.0 1.0;
+ }
+ rel2 {
+ to, "pad.right";
+ relative, 0.0 1.0;
+ }
+ image {
+ normal, "modal_dialogs_bg.png";
+ border, 9 9 9 9;
+ }
+ }
+ }
+ part {
+ name, "upper_image";
+ type, IMAGE;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 0 90;
+ fixed, 0 1;
+ align, 0.5 0.0;
+ color, 42 76 130 255;
+ rel1.to, "base_image";
+ rel2 {
+ to, "base_image";
+ relative, 1.0 0.0;
+ }
+ image {
+ normal, "round_rectangle_8X8_top.png";
+ border, 8 8 9 0;
+ }
+ }
+ }
+ part {
+ name, "elm.text.title";
+ type, TEXT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ text {
+ font, "TizenSans";
+ size, 23;
+ }
+ rel1.to, "upper_image";
+ rel2.to, "upper_image";
+ }
+ }
+ part {
+ name, "elm.swallow.content";
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 0 394;
+ fixed, 0 1;
+ align, 0.5 0.0;
+ rel1 {
+ to, "upper_image";
+ relative, 0.0 1.0;
+ }
+ rel2.to, "upper_image";
+ }
+ }
+ part {
+ name, "elm.bg.action_area";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 926 135;
+ fixed, 1 1;
+ align, 0.5 1.0;
+ color, 0 0 0 0;
+ rel1 {
+ relative, 0.0 1.0;
+ to, "base";
+ }
+ rel2.to, "base";
+ }
+ }
+ part {
+ name, "elm.swallow.action_area";
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ align, 0.0 0.0;
+ rel1.to, "elm.bg.action_area";
+ rel2.to, "elm.bg.action_area";
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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 __BAR_H__
+#define __BAR_H__
+
+#include <Evas.h>
+
+/**
+ * BAR_DIR
+ */
+enum bar_direction {
+ BAR_DIR_LEFT,
+ BAR_DIR_RIGHT,
+ BAR_DIR_UP,
+ BAR_DIR_DOWN,
+ BAR_DIR_BACK,
+ BAR_DIR_MAX,
+};
+
+/**
+ * BAR_EVENT
+ *
+ * DONE event is done and will not be passed on
+ * PASS event will not be handled and just passed on
+ * MOVE caller should handle bar move event
+ * BACK caller should handle back key event
+ * ERROR error is occured, it will be passed on
+ */
+enum bar_event {
+ BAR_EVENT_DONE,
+ BAR_EVENT_PASS,
+ BAR_EVENT_MOVE,
+ BAR_EVENT_BACK,
+ BAR_EVENT_ERROR = -1,
+};
+
+struct bar_info;
+
+/**
+ * bar operations
+ *
+ * The homescreen is consist of bars.
+ * There's two main bars - home bar and custom bar
+ * and three sub bars - dynamic bar, user bar, delete bar.
+ *
+ * Here is hierarchy of bars.
+ *
+ * homescreen -> home bar -> dynamic bar
+ * -> user bar
+ * -> custom bar -> dynamic bar -> delete bar
+ *
+ * Bars are operated by following functions.
+ *
+ * add_bar: create new bar
+ * update: update the bar
+ * get_object: get the base evas object of bar
+ * get_item: get the evas object of specific item
+ * show: show the bar
+ * hide: hide the bar
+ * move: move (the focus) to bar
+ * is_move: check that the bar can be moved
+ * key_down: event callback for key down
+ * key_up: event callback for key up
+ * release: release the bar
+ */
+struct bar_ops {
+ int (*add_bar)(struct bar_info *info, Evas_Object *base);
+ int (*update)(struct bar_info *info, void *eng, void *data);
+ Evas_Object *(*get_object)(struct bar_info *info);
+ Evas_Object *(*get_item)(struct bar_info *info);
+ void (*show)(struct bar_info *info);
+ void (*hide)(struct bar_info *info);
+ Eina_Bool (*move)(struct bar_info *info);
+ Eina_Bool (*is_move)(struct bar_info *info, int dir);
+ enum bar_event (*key_down)(struct bar_info *info, void *ei);
+ enum bar_event (*key_up)(struct bar_info *info, void *ei);
+ void (*release)(struct bar_info *info);
+};
+
+/**
+ * bar callback
+ *
+ * func: function called by parent bar
+ * data: parameter for func
+ */
+struct bar_cb {
+ Eina_Bool (*func)(void *data, Evas_Object *foc);
+ void *data;
+};
+
+struct bar_info {
+ struct bar_ops *ops;
+ struct bar_cb cb;
+ void *data;
+};
+
+/* bar initialize functions */
+int init_home_bar(struct bar_info *info);
+int init_user_bar(struct bar_info *info);
+int init_dynamic_bar(struct bar_info *info);
+int init_custom_bar(struct bar_info *info);
+int init_delete_bar(struct bar_info *info);
+
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2014 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 __BUS_H__
+#define __BUS_H__
+
+#include <stdbool.h>
+#include <cp_config.h>
+
+struct bus;
+struct client_bus;
+
+enum bus_op {
+ BUS_OP_ADD_LABEL,
+ BUS_OP_ADD_ALBUM,
+ BUS_OP_ADD_CONTENT,
+ BUS_OP_ADD_PIN,
+ BUS_OP_MAX
+};
+
+enum bus_data_action_op {
+ BUS_DATA_ACTION_LAUNCH_NONE,
+ BUS_DATA_ACTION_LAUNCH_APP,
+ BUS_DATA_ACTION_LAUNCH_SERVICE,
+ BUS_DATA_ACTION_MAX
+};
+
+enum bus_data_content_type {
+ BUS_DATA_CONTENT_IMAGE,
+ BUS_DATA_CONTENT_VIDEO,
+ BUS_DATA_CONTENT_MUSIC,
+ BUS_DATA_CONTENT_BROADCAST,
+ BUS_DATA_CONTENT_APP,
+ BUS_DATA_CONTENT_SOURCE,
+ BUS_DATA_CONTENT_NOTIFICATION_NOTI,
+ BUS_DATA_CONTENT_NOTIFICATION_ONGOING,
+ BUS_DATA_CONTENT_HISTORY,
+ BUS_DATA_CONTENT_MAX
+};
+
+enum bus_data_pin_type {
+ BUS_DATA_PIN_CHANNEL,
+ BUS_DATA_PIN_PACKAGE,
+ BUS_DATA_PIN_MAX
+};
+
+#define BUS_DATA_ALBUM_CONTENT_MAX 6
+
+struct bus_data_label {
+ const char *svcid;
+ const char *title;
+
+ enum bus_data_action_op action;
+ const char *actor;
+ const char *args;
+};
+
+struct bus_data_content {
+ const char *svcid;
+ enum bus_data_content_type type;
+ const char *title;
+ const char *subtitle;
+ const char *description;
+ const char *detail;
+ const char *thumbnail;
+ const char *icon;
+};
+
+struct bus_data_pin {
+ const char *svcid;
+ enum bus_data_pin_type type;
+ const char *title;
+ const char *icon;
+ const char *pinid;
+};
+
+struct bus_data_album {
+ const char *svcid;
+ const char *title;
+ struct bus_data_content contents[BUS_DATA_ALBUM_CONTENT_MAX];
+ int content_cnt;
+};
+
+struct bus_data_action {
+ enum bus_data_action_op action;
+ const char *actor;
+ const char *args;
+};
+
+struct bus_cbs {
+ void (*ready)(struct bus *bus, void *data);
+ int (*add_ctnt)(struct bus *bus, enum bus_op op, void *opdata,
+ struct bus_data_action *act, void *data);
+ int (*del_ctnt)(struct bus *bus, const char *svcid, int ctnt_id,
+ void *data);
+ int (*del_all)(struct bus *bus, const char *svcid, bool reload,
+ void *data);
+ void (*end)(struct bus *bus, void *data);
+};
+
+struct bus *bus_init(struct bus_cbs *cbs, void *data);
+void bus_fini(struct bus *bus);
+int bus_send_signal(struct bus *bus, const char *sig);
+
+struct client_bus *bus_client_init(const char *bus_name,
+ const char *object_path, const char *svcid);
+void bus_client_fini(struct client_bus *cbusinfo);
+void bus_client_send_svcid(struct client_bus *cbus);
+
+#endif /* __BUS_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 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 __DBG_H__
+#define __DBG_H__
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "org.tizen.homescreen-tv-ref"
+
+#ifndef _ERR
+#define _ERR(fmt, args...) LOGE("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef _DBG
+#define _DBG(fmt, args...) LOGD("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef _INFO
+#define _INFO(fmt, args...) LOGI("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+
+#endif /* __DBG_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 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 __DEFS_H__
+#define __DEFS_H__
+
+#define GRP_MAIN "main"
+#define GRP_USER "user"
+#define GRP_UBAR "ubar"
+#define GRP_HOMEBAR_ITEM "homebar.item"
+#define GRP_UBAR_ITEM "ubar.item"
+#define GRP_DBAR_ITEM "dbar.item"
+#define GRP_DBAR_LABEL "dbar.title"
+#define GRP_DBAR_COMMON "dbar.common"
+#define GRP_DBAR_APP "dbar.app"
+#define GRP_DBAR_BROADCAST "dbar.broadcast"
+#define GRP_DBAR_ALBUM "dbar.album"
+#define GRP_ALBUM_THUMB "album.thumb"
+#define GRP_DBAR_MUSIC "dbar.music"
+#define GRP_DBAR_NOTIFICATION "dbar.notification"
+#define GRP_DBAR_SOURCE "dbar.source"
+#define GRP_DBAR_HISTORY "dbar.history"
+#define GRP_PIN "pin"
+#define GRP_EDIT_X "edit.x"
+#define GRP_EDIT_ARROW_UP "edit.arrow.up"
+#define GRP_EDIT_ARROW_DOWN "edit.arrow.down"
+#define GRP_CBAR_X "cbar.x"
+#define GRP_UBAR_LEFT_ARROW "ubar.left.arrow"
+#define GRP_UBAR_RIGHT_ARROW "ubar.right.arrow"
+#define GRP_UBAR_POPUP "ubar.popup"
+#define GRP_UBAR_POPUP_ITEM "ubar.popup.item"
+
+#define PART_HOMEBAR "homebar"
+#define PART_DYNAMICBAR "dynamicbar"
+#define PART_USER "user"
+#define PART_USER_THUMB_BG "user.thumb_bg"
+#define PART_USER_THUMB "user.thumb"
+#define PART_USER_NAME "user.name"
+#define PART_USER_NAME_POPUP "user.name.popup"
+#define PART_UBAR "ubar"
+#define PART_UBAR_CONTENT "ubar.content"
+#define PART_BG "bg"
+#define PART_BG2 "bg2"
+#define PART_ICON "icon"
+#define PART_ICON_FOCUS "icon.focus"
+#define PART_NAME "name"
+#define PART_TITLE "title"
+#define PART_SUBTITLE "subtitle"
+#define PART_DESCRIPTION "description"
+#define PART_THUMB "thumb"
+#define PART_NUMBER "number"
+#define PART_CHANNEL "channel"
+#define PART_PROGRAM "program"
+#define PART_DURATION "duration"
+#define PART_FUNCS "functions"
+#define PART_DEFAULT_TITLE "default.title"
+#define PART_DEFAULT_DESC "default.desc"
+#define PART_CONTENT "content"
+#define PART_ELM_SWALLOWICON "elm.swallow.icon"
+#define PART_POPUP_TEXT "title,text"
+#define PART_POPUP_USER "popup.user"
+#define PART_POPUP_ENTRY "popup.entry"
+#define PART_RIGHT_ARROW "right.arrow"
+#define PART_LEFT_ARROW "left.arrow"
+#define PART_KIDS "kids"
+#define PART_USER_AGE "user.age"
+
+#define PART_THUMB_1 "thumb.1"
+#define PART_THUMB_2 "thumb.2"
+#define PART_THUMB_3 "thumb.3"
+#define PART_THUMB_4 "thumb.4"
+#define PART_THUMB_5 "thumb.5"
+#define PART_THUMB_6 "thumb.6"
+
+#define SIG_SHOW_HOMEBAR "show,hbar"
+#define SIG_SHOW_HOMEBAR_DONE "show,hbar,done"
+#define SIG_HIDE_HOMEBAR "hide,hbar"
+#define SIG_HIDE_HOMEBAR_DONE "hide,hbar,done"
+#define SIG_SHOW_UBAR "show,ubar"
+#define SIG_HIDE_UBAR "hide,ubar"
+#define SIG_SHOW_DBAR "show,dbar"
+#define SIG_HIDE_DBAR "hide,dbar"
+#define SIG_INITIAL_FOCUS "initial,focus"
+#define SIG_FOCUS_FROM_UP "focus,from,up"
+#define SIG_FOCUS_FROM_DOWN "focus,from,down"
+#define SIG_FOCUS_FROM_LEFT "focus,from,left"
+#define SIG_FOCUS_FROM_RIGHT "focus,from,right"
+#define SIG_FOCUS_FROM_EDIT "focus,form,edit"
+#define SIG_FOCUS "focus"
+#define SIG_UNFOCUS "unfocus"
+#define SIG_UNFOCUS_TO_UP "unfocus,to,up"
+#define SIG_UNFOCUS_TO_DOWN "unfocus,to,down"
+#define SIG_UNFOCUS_TO_LEFT "unfocus,to,left"
+#define SIG_UNFOCUS_TO_RIGHT "unfocus,to,right"
+#define SIG_UNFOCUS_TO_DBAR "unfocus,to,dbar"
+#define SIG_UNFOCUS_TO_HBAR "unfocus,to,hbar"
+#define SIG_UNFOCUS_TO_XBAR "unfocus,to,xbar"
+#define SIG_UNFOCUS_FROM_XBAR "unfocus,from,xbar"
+#define SIG_HLIGHT_FROM_POPOVER "hlight,from,popover"
+#define SIG_HIGHLIGHT "highlight"
+#define SIG_HIDE "hide"
+#define SIG_SHOW "show"
+#define SIG_THUMB_3 "thumb,3"
+#define SIG_THUMB_6 "thumb,6"
+#define SIG_SHOW_DEFAULT_THUMB "show,default_thumb"
+#define SIG_SHOW_DEFAULT_ICON "show,default_icon"
+#define SIG_SHOW_THUMB1_VIDEO "show,thumb1,video"
+#define SIG_SHOW_THUMB2_VIDEO "show,thumb2,video"
+#define SIG_SHOW_THUMB3_VIDEO "show,thumb3,video"
+#define SIG_SHOW_THUMB4_VIDEO "show,thumb4,video"
+#define SIG_SHOW_THUMB5_VIDEO "show,thumb5,video"
+#define SIG_SHOW_THUMB6_VIDEO "show,thumb6,video"
+#define SIG_OUTSIDE_CLICKED "outside,clicked"
+#define SIG_ARROW_CLICKED "arrow,clicked"
+#define SIG_SHOW_EDIT_ITEM "show,edit,item"
+#define SIG_DIM_ITEM "dim,item"
+#define SIG_UNDIM_ITEM "undim,item"
+#define SIG_FOCUS_ARROW "focus,arrow"
+#define SIG_FOCUS_X "focus,x"
+#define SIG_HIDE_NO_TITLE "no.title"
+#define SIG_HIDE_TO_HBAR "hide,hbar"
+#define SIG_SCROLL_DOWN "elm,action,scroll,down"
+#define SIG_SCROLL_UP "elm,action,scroll,up"
+#define SIG_CANCEL_CLICKED "cancel,clicked"
+#define SIG_SHOW_AGE "show.age"
+
+#define SRC_PROG "prog"
+#define SRC_EDJE "edje"
+#define SRC_ELM "elm"
+
+#define DEF_USER_NAME "No Name"
+#define DEF_USER_THUMB IMAGEDIR"/ico_man.png"
+#define DEF_USER_THUMB_BG IMAGEDIR"/ico_bg_114.png"
+#define DEF_UBAR_ITEM_THUMB IMAGEDIR"/ico_boy_mini.png"
+#define DEF_UBAR_ITEM_THUMB_BG IMAGEDIR"/ico_bg_98.png"
+#define DEF_PIN_ITEM_DEFAULT_ICON IMAGEDIR"/icn_default.png"
+#define DEF_PIN_ITEM_DEFAULT_ICON_FOCUS IMAGEDIR"/icn_default.png"
+#define DEF_PIN_ITEM_CHANNEL_ICON IMAGEDIR"/icn_live_tv_nor.png"
+#define DEF_PIN_ITEM_CHANNEL_ICON_FOCUS IMAGEDIR"/icn_live_tv_nor.png"
+#define ICON_CHECK_FOC_PNG "ico_check_foc.png"
+
+#define DATA_TITLE_WIDTH "title_width"
+#define DATA_PIN_HEIGHT "pin_height"
+
+#define STYLE_BTN_HOVERTEXT "hovertext"
+#define STYLE_CTXPOPUP_HOVER "hoverpopup"
+#define STYLE_LABEL_SLIDE_LEFT "slide_style_24_left"
+#define STYLE_LABEL_SLIDE_CENTER "slide_style_24_center"
+#define STYLE_LABEL_SLIDE_LEFT_32 "slide_style_32_left"
+#define STYLE_LABEL_SLIDE_CENTER_40 "slide_style_40_center"
+#define STYLE_LABEL_SLIDE_CENTER_22 "slide_style_22_center"
+#define STYLE_LABEL_SLIDE_LEFT_20 "slide_style_20_left"
+#define STYLE_POPUP_1LINE_2BUTTON "title.1line.2button"
+#define STYLE_POPUP_BOTTOM_1LINE "bottom.1line"
+#define STYLE_POPUP_USER "user"
+#define LABEL_SLIDE_SPEED (40.0)
+
+#define POSITION_CTXPOPUP_X 40
+#define POSITION_CTXPOPUP_Y 200
+
+#define ITEM_DEFAULT_BG_R 69
+#define ITEM_DEFAULT_BG_G 143
+#define ITEM_DEFAULT_BG_B 255
+#define ITEM_CHANNEL_BG_R 50
+#define ITEM_CHANNEL_BG_G 81
+#define ITEM_CHANNEL_BG_B 128
+#define ITEM_PACKAGE_BG_R 57
+#define ITEM_PACKAGE_BG_G 114
+#define ITEM_PACKAGE_BG_B 106
+
+#define KEY_UP "Up"
+#define KEY_DOWN "Down"
+#define KEY_LEFT "Left"
+#define KEY_RIGHT "Right"
+#define KEY_ENTER "Return"
+
+#endif /* __DEFS_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 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 __ENGINE_H__
+#define __ENGINE_H__
+
+#include <Eina.h>
+#include <stdbool.h>
+
+struct engine;
+struct engine_bar_item;
+struct engine_ubar_item;
+struct engine_dbar_item;
+struct engine_dbar_item_content;
+
+enum engine_dbar_item_style {
+ ENGINE_DBAR_ITEM_STYLE_CONTENT,
+ ENGINE_DBAR_ITEM_STYLE_LABEL,
+ ENGINE_DBAR_ITEM_STYLE_ALBUM,
+ ENGINE_DBAR_ITEM_STYLE_MAX
+};
+
+enum engine_dbar_content_type {
+ ENGINE_DBAR_CONTENT_TYPE_IMAGE,
+ ENGINE_DBAR_CONTENT_TYPE_VIDEO,
+ ENGINE_DBAR_CONTENT_TYPE_MUSIC,
+ ENGINE_DBAR_CONTENT_TYPE_BROADCAST,
+ ENGINE_DBAR_CONTENT_TYPE_APP,
+ ENGINE_DBAR_CONTENT_TYPE_SOURCE,
+ ENGINE_DBAR_CONTENT_TYPE_NOTIFICATION_NOTI,
+ ENGINE_DBAR_CONTENT_TYPE_NOTIFICATION_ONGOING,
+ ENGINE_DBAR_CONTENT_TYPE_HISTORY,
+ ENGINE_DBAR_CONTENT_TYPE_MAX
+};
+
+struct engine *engine_init(void);
+void engine_fini(struct engine *eng);
+int engine_get_user_info(struct engine *eng, const char **name,
+ const char **thumb_bg, const char **thumb);
+
+const Eina_List *engine_get_bar_items(struct engine *eng);
+const Eina_List *engine_get_ubar_items(struct engine *eng);
+const Eina_List *engine_get_dbar_items(struct engine_bar_item *it);
+
+/* bar */
+const char *engine_bar_item_get_name(struct engine_bar_item *it);
+const char *engine_bar_item_get_icon(struct engine_bar_item *it);
+const char *engine_bar_item_get_icon_focus(struct engine_bar_item *it);
+const char *engine_bar_item_get_dbus_path(struct engine_bar_item *it);
+const char *engine_bar_item_get_noctnt_title(struct engine_bar_item *it);
+const char *engine_bar_item_get_noctnt_desc(struct engine_bar_item *it);
+const char *engine_bar_item_get_in(struct engine_bar_item *it);
+const char *engine_bar_item_get_svcid(struct engine_bar_item *it);
+const char *engine_bar_item_get_bus_name(struct engine_bar_item *it);
+const char *engine_bar_item_get_object_path(struct engine_bar_item *it);
+int engine_bar_item_get_color(struct engine_bar_item *it,
+ int *r, int *g, int *b);
+int engine_bar_item_get_content_column(struct engine_bar_item *it,
+ int *content_column);
+int engine_bar_item_launch(struct engine_bar_item *it);
+int engine_bar_item_del_pin(struct engine *eng, struct engine_bar_item *it);
+int engine_bar_item_get_pin_count(void);
+int engine_bar_item_swap_pin(struct engine *eng, struct engine_bar_item *it1,
+ struct engine_bar_item *it2);
+Eina_Bool engine_bar_item_get_is_pinned(struct engine_bar_item *it);
+void engine_bar_item_set_update_cb(struct engine_bar_item *it,
+ void (*update_cb)(struct engine_bar_item *it, void *data),
+ void *data);
+void engine_bar_item_set_pin_update_cb(struct engine *eng,
+ void (*update_cb)(void *data, bool focus),
+ void *data);
+
+/* ubar */
+int engine_ubar_item_get_info(struct engine_ubar_item *it, const char **name,
+ const char **thumb_bg, const char **thumb, int *age,
+ bool *visible);
+void engine_ubar_item_set_visible(struct engine_ubar_item *it, bool visible);
+
+/* dbar */
+enum engine_dbar_item_style engine_dbar_item_get_style(
+ struct engine_dbar_item *it);
+enum engine_dbar_content_type engine_dbar_item_get_content_type(
+ struct engine_dbar_item_content *ctnt);
+const Eina_List *engine_dbar_item_get_contents(struct engine_dbar_item *it);
+const char *engine_dbar_item_get_name(struct engine_dbar_item *it);
+const char *engine_dbar_item_get_in(struct engine_dbar_item *it);
+const char *engine_dbar_item_get_content_subtitle(
+ struct engine_dbar_item_content *ctnt);
+const char *engine_dbar_item_get_content_description(
+ struct engine_dbar_item_content *ctnt);
+const char *engine_dbar_item_get_content_detail(
+ struct engine_dbar_item_content *ctnt);
+const char *engine_dbar_item_get_content_thumbnail(
+ struct engine_dbar_item_content *ctnt);
+const char *engine_dbar_item_get_content_icon(
+ struct engine_dbar_item_content *ctnt);
+int engine_dbar_item_get_color(struct engine_dbar_item *it,
+ int *r, int *g, int *b);
+int engine_dbar_item_launch(struct engine_dbar_item *it);
+
+#endif /* __ErGINE_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 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 __HOMESCREEN_H__
+#define __HOMESCREEN_H__
+
+#include <Evas.h>
+
+#include "engine.h"
+
+struct homescreen;
+
+struct homescreen *homescreen_init(struct engine *eng);
+int homescreen_load(struct homescreen *hscr, Evas_Object *win);
+void homescreen_fini(struct homescreen *hscr);
+void homescreen_show(struct homescreen *hscr);
+void homescreen_hide(struct homescreen *hscr);
+
+#endif /* __HOMESCREEN_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2014 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 __I18N_H__
+#define __I18N_H__
+
+#include <libintl.h>
+
+#define gettext_noop(s) (s)
+
+#ifdef _
+#undef _
+#endif /* _ */
+#define _(s) gettext(s)
+
+#ifdef N_
+#undef N_
+#endif /* N_ */
+#define N_(s) gettext_noop(s)
+
+#endif /* __I18N_H__ */
--- /dev/null
+<manifest>
+ <define>
+ <domain name="dtv-org.tizen.homescreen-tv-ref"/>
+ <request>
+ <smack request="ail::db" type="w"/>
+ <smack request="system::vconf" type="wx"/>
+ <smack request="system::homedir" type="wx"/>
+ <smack request="system::use_internet" type="r"/>
+ <smack request="system::media" type="rx"/>
+ <smack request="device::app_logging" type="w"/>
+ <smack request="xorg" type="w"/>
+ <smack request="isf" type="rx"/>
+ <smack request="dtv-content-provider-samples" type="rx"/>
+ </request>
+ </define>
+ <request>
+ <domain name="dtv-org.tizen.homescreen-tv-ref"/>
+ </request>
+</manifest>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="@PACKAGE_NAME@" version="@VERSION@" install-location="internal-only">
+ <label>homescreen</label>
+ <author email="PUT YOUR EMAIL" href="www.samsung.com">PUT YOUR NAME</author>
+ <description>homescreen</description>
+ <ui-application appid="@PACKAGE_NAME@" exec="@BINDIR@/@PROJECT_NAME@" nodisplay="true" multiple="false" type="capp" taskmanage="true">
+ <label>homescreen</label>
+ </ui-application>
+</manifest>
--- /dev/null
+[Unit]
+Description=Homescreen-tv
+
+[Service]
+ExecStart=/usr/bin/launch_app org.tizen.homescreen-tv-ref
+ExecStartPost=/bin/sh -c 'sleep 1; /usr/bin/launch_app org.tizen.homescreen-tv-ref;'
+
+[Install]
+WantedBy=core-efl.target
--- /dev/null
+Name: org.tizen.homescreen-tv-ref
+Summary: TV homescreen reference application
+Version: 0.1
+Release: 1
+Group: Applications/Core Applications
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+Source1: %{name}.service
+
+BuildRequires: cmake
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(ecore-x)
+BuildRequires: pkgconfig(x11)
+BuildRequires: pkgconfig(utilX)
+BuildRequires: pkgconfig(json-glib-1.0)
+BuildRequires: pkgconfig(gio-2.0)
+BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(notification)
+BuildRequires: pkgconfig(app-content-favorite)
+BuildRequires: pkgconfig(app-content-provider)
+BuildRequires: edje-bin
+BuildRequires: gettext-devel
+
+%define _pkgdir /opt/usr/apps/%{name}
+%define _bindir %{_pkgdir}/bin
+%define _resdir %{_pkgdir}/res
+%define _datadir %{_pkgdir}/data
+%define _imagedir %{_resdir}/images
+%define _cfgdir %{_resdir}/config
+%define _edjedir %{_resdir}/edje
+%define _manifestdir /usr/share/packages
+%define _libdir /usr/lib
+
+%description
+Application for providing user status and tv contents
+
+%prep
+%setup -q
+
+%build
+cmake \
+ -DCMAKE_INSTALL_PREFIX=%{_pkgdir} \
+ -DPACKAGE_NAME=%{name} \
+ -DBINDIR=%{_bindir} \
+ -DEDJEDIR=%{_edjedir} \
+ -DIMAGEDIR=%{_imagedir} \
+ -DCFGDIR=%{_cfgdir} \
+ -DMANIFESTDIR=%{_manifestdir} \
+ -DVERSION=%{version}
+
+make %{?jobs:-j%jobs}
+
+%install
+%make_install
+install --directory %{buildroot}/%{_datadir}
+install --directory %{buildroot}%{_libdir}/systemd/user/core-efl.target.wants
+install -m 0644 %{SOURCE1} %{buildroot}%{_libdir}/systemd/user/
+ln -sf ../%{name}.service %{buildroot}%{_libdir}/systemd/user/core-efl.target.wants/
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%manifest %{name}.manifest
+%defattr(-,root,root,-)
+%{_bindir}/*
+%{_resdir}/*
+%{_datadir}
+%{_manifestdir}/%{name}.xml
+%{_libdir}/systemd/user/%{name}.service
+%{_libdir}/systemd/user/core-efl.target.wants/%{name}.service
--- /dev/null
+/*
+ * Copyright (c) 2014 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 <gio/gio.h>
+#include <stdlib.h>
+
+#include "bus.h"
+#include "dbg.h"
+
+#define RESEND_TIMEOUT 5
+
+struct bus {
+ guint owner_id;
+ GDBusNodeInfo *node;
+ GDBusConnection *conn;
+ struct bus_cbs cbs;
+ void *cb_data;
+};
+
+struct _method_handler {
+ const char *method;
+ int (*handler)(struct bus *bus, GVariant *param);
+};
+
+struct client_bus {
+ const char *bus_name;
+ const char *object_path;
+ const char *svcid;
+
+ guint resend_handler;
+ gulong notify_handler;
+
+ GDBusProxy *proxy;
+ GCancellable *cancellable;
+};
+
+/**
+ * Gets the string from g_variant value.
+ *
+ * @param it The GVariangIter value
+ * @return This function returns string on success, or NULL
+ */
+static inline const gchar *_get_iter_string(GVariantIter *it)
+{
+ GVariant *val;
+ const gchar *r;
+
+ if (!it)
+ return NULL;
+
+ val = g_variant_iter_next_value(it);
+ if (!val)
+ return NULL;
+
+ if (!g_variant_is_of_type(val, G_VARIANT_TYPE_STRING)) {
+ _ERR("Not string");
+ g_variant_unref(val);
+ return NULL;
+ }
+
+ r = g_variant_get_string(val, NULL);
+ g_variant_unref(val);
+
+ return r;
+}
+
+/**
+ * Gets the byte from g_variant value.
+ *
+ * @param it The GVariangIter value
+ * @return This function returns gchar on success, or 0
+ */
+static inline guchar _get_iter_byte(GVariantIter *it)
+{
+ GVariant *val;
+ gchar r;
+
+ if (!it)
+ return 0;
+
+ val = g_variant_iter_next_value(it);
+ if (!val)
+ return 0;
+
+ if (!g_variant_is_of_type(val, G_VARIANT_TYPE_BYTE)) {
+ _ERR("Not byte");
+ g_variant_unref(val);
+ return 0;
+ }
+
+ r = g_variant_get_byte(val);
+ g_variant_unref(val);
+
+ return r;
+}
+
+/**
+ * Gets the boolean from g_variant value.
+ *
+ * @param it The GVariangIter value
+ * @return This function returns gboolean on success, or 0
+ */
+static inline gboolean _get_iter_boolean(GVariantIter *it)
+{
+ GVariant *val;
+ gboolean r;
+
+ if (!it)
+ return 0;
+
+ val = g_variant_iter_next_value(it);
+ if (!val)
+ return 0;
+
+ if (!g_variant_is_of_type(val, G_VARIANT_TYPE_BOOLEAN)) {
+ _ERR("Not boolean");
+ g_variant_unref(val);
+ return 0;
+ }
+
+ r = g_variant_get_boolean(val);
+ g_variant_unref(val);
+
+ return r;
+}
+
+/**
+ * Gets the int from g_variant value.
+ *
+ * @param it The GVariangIter value
+ * @return This function returns int on success, or 0
+ */
+static inline gint32 _get_iter_int(GVariantIter *it)
+{
+ GVariant *val;
+ gint32 r;
+
+ if (!it)
+ return 0;
+
+ val = g_variant_iter_next_value(it);
+ if (!val)
+ return 0;
+
+ if (!g_variant_is_of_type(val, G_VARIANT_TYPE_INT32)) {
+ _ERR("Not integer 32");
+ g_variant_unref(val);
+ return 0;
+ }
+
+ r = g_variant_get_int32(val);
+ g_variant_unref(val);
+
+ return r;
+}
+
+/**
+ * Gets the type and thumbnail from g_variant value.
+ *
+ * @param it The GVariangIter value
+ * @param content The bus_data_content object
+ * @return This function returns int on success, or negative value
+ */
+static inline int _get_iter_content(GVariantIter *it,
+ struct bus_data_content *content)
+{
+ guchar type;
+ const gchar *thumbnail;
+ gboolean r;
+
+ if (!it || !content)
+ return -1;
+
+ r = g_variant_iter_next(it, "(ys)", &type, &thumbnail);
+ if (!r)
+ return -1;
+
+ content->type = type;
+ content->thumbnail = thumbnail;
+
+ return 0;
+}
+
+/**
+ * Gets the content array from g_variant value.
+ *
+ * @param it The GVariangIter value
+ * @param contents The array of bus_data_content objects
+ * @param arraymax The max value of array
+ * @param cnt The index value
+ * @return This function returns int on success, or 0
+ */
+static inline int _get_iter_content_array(GVariantIter *it,
+ struct bus_data_content contents[], int arraymax,
+ int *cnt)
+{
+ GVariant *val;
+ GVariantIter _it;
+ int r;
+ int i;
+
+ if (!it || !contents)
+ return -1;
+
+ val = g_variant_iter_next_value(it);
+ if (!val)
+ return -1;
+
+ if (!g_variant_is_of_type(val, G_VARIANT_TYPE_ARRAY)) {
+ _ERR("Not array");
+ g_variant_unref(val);
+ return -1;
+ }
+
+ g_variant_iter_init(&_it, val);
+
+ for (i = 0; i < arraymax; i++) {
+ r = _get_iter_content(&_it, &contents[i]);
+ if (r != 0)
+ break;
+ }
+
+ if (cnt)
+ *cnt = i;
+
+ g_variant_unref(val);
+
+ if (i == 0)
+ return -1;
+
+ return 0;
+}
+
+/**
+ * Releases content array.
+ *
+ * @param contents The array of bus data content objects
+ */
+static inline void _free_content_array(struct bus_data_content contents[],
+ int arraymax)
+{
+ int i;
+
+ for (i = 0; i < arraymax; i++)
+ g_free((gpointer)contents[i].thumbnail);
+}
+
+/**
+ * Invoked when METHOD_ADD_LABEL of method called.
+ *
+ * Unmarshals the following data from parameter and calls the bus add_ctnt
+ * callback function.
+ * - service id
+ * - title
+ * - args
+ *
+ * @param bus The bus object
+ * @param param The message the remote caller would send
+ * @return This function returns zero on success, or negative value
+ */
+static int _add_label(struct bus *bus, GVariant *param)
+{
+ struct bus_data_album data;
+ GVariantIter iter;
+
+ if (!bus || !bus->cbs.add_ctnt || !param) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ memset(&data, 0x00, sizeof(data));
+
+ g_variant_iter_init(&iter, param);
+ data.svcid = _get_iter_string(&iter);
+ if (!data.svcid) {
+ _ERR("Service id get failed");
+ return -1;
+ }
+
+ data.title = _get_iter_string(&iter);
+ if (!data.title) {
+ _ERR("title get failed");
+ return -1;
+ }
+
+ return bus->cbs.add_ctnt(bus, BUS_OP_ADD_LABEL, &data,
+ NULL, bus->cb_data);
+}
+
+/**
+ * Invoked when METHOD_ADD_ALBUM of method called.
+ *
+ * Unmarshals the following data from parameter and calls the bus add_ctnt
+ * callback function.
+ * - service id
+ * - title
+ * - contents
+ * - action
+ * - actor
+ * - args
+ *
+ * @param bus The bus object
+ * @param param The message the remote caller would send
+ * @return This function returns zero on success, or negative value
+ */
+static int _add_album(struct bus *bus, GVariant *param)
+{
+ struct bus_data_album data;
+ struct bus_data_action act;
+ GVariantIter iter;
+ int r;
+
+ if (!bus || !bus->cbs.add_ctnt || !param) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ memset(&data, 0x00, sizeof(data));
+
+ g_variant_iter_init(&iter, param);
+ data.svcid = _get_iter_string(&iter);
+ if (!data.svcid) {
+ _ERR("Service id get failed");
+ return -1;
+ }
+
+ data.title = _get_iter_string(&iter);
+ if (!data.title) {
+ _ERR("title get failed");
+ return -1;
+ }
+
+ r = _get_iter_content_array(&iter, data.contents,
+ BUS_DATA_ALBUM_CONTENT_MAX, &data.content_cnt);
+ if (r != 0) {
+ _ERR("contents get failed");
+ return -1;
+ }
+
+ act.action = _get_iter_byte(&iter);
+ act.actor = _get_iter_string(&iter);
+ act.args = _get_iter_string(&iter);
+
+ r = bus->cbs.add_ctnt(bus, BUS_OP_ADD_ALBUM, &data,
+ &act, bus->cb_data);
+ _free_content_array(data.contents, BUS_DATA_ALBUM_CONTENT_MAX);
+
+ return r;
+}
+
+/**
+ * Invoked when METHOD_ADD_CONTENT of method called.
+ *
+ * Unmarshals the following data from parameter and calls the bus add_ctnt
+ * callback function.
+ * - service id
+ * - title
+ * - subtitle
+ * - description
+ * - detail
+ * - type
+ * - thumbnail
+ * - icon
+ * - action
+ * - actor
+ * - args
+ *
+ * @param bus The bus object
+ * @param param The message the remote caller would send
+ * @return This function returns zero on success, or negative value
+ */
+static int _add_ctnt(struct bus *bus, GVariant *param)
+{
+ struct bus_data_content data;
+ struct bus_data_action act;
+ GVariantIter iter;
+
+ if (!bus || !bus->cbs.add_ctnt || !param) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ memset(&data, 0x00, sizeof(data));
+
+ g_variant_iter_init(&iter, param);
+ data.svcid = _get_iter_string(&iter);
+ if (!data.svcid) {
+ _ERR("Service id get failed");
+ return -1;
+ }
+
+ data.title = _get_iter_string(&iter);
+ if (!data.title) {
+ _ERR("title get failed");
+ return -1;
+ }
+
+ data.subtitle = _get_iter_string(&iter);
+ data.description = _get_iter_string(&iter);
+ data.detail = _get_iter_string(&iter);
+ data.type = _get_iter_byte(&iter);
+ data.thumbnail = _get_iter_string(&iter);
+ data.icon = _get_iter_string(&iter);
+ act.action = _get_iter_byte(&iter);
+ act.actor = _get_iter_string(&iter);
+ act.args = _get_iter_string(&iter);
+
+ return bus->cbs.add_ctnt(bus, BUS_OP_ADD_CONTENT, &data,
+ &act, bus->cb_data);
+}
+
+/**
+ * Invoked when METHOD_ADD_PIN of method called.
+ *
+ * Unmarshals the following data from parameter and calls the bus add_ctnt
+ * callback function.
+ * - service id
+ * - title
+ * - type
+ * - icon
+ * - pinid
+ * - action
+ * - actor
+ * - args
+ *
+ * @param bus The bus object
+ * @param param The message the remote caller would send
+ * @return This function returns zero on success, or negative value
+ */
+static int _add_pin(struct bus *bus, GVariant *param)
+{
+ struct bus_data_pin data;
+ struct bus_data_action act;
+ GVariantIter iter;
+
+ if (!bus || !bus->cbs.add_ctnt || !param) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ memset(&data, 0x00, sizeof(data));
+
+ g_variant_iter_init(&iter, param);
+ data.svcid = _get_iter_string(&iter);
+ if (!data.svcid) {
+ _ERR("Service id get failed");
+ return -1;
+ }
+
+ data.title = _get_iter_string(&iter);
+ if (!data.title) {
+ _ERR("title get failed");
+ return -1;
+ }
+ data.type = _get_iter_byte(&iter);
+ data.icon = _get_iter_string(&iter);
+ data.pinid = _get_iter_string(&iter);
+ act.action = _get_iter_byte(&iter);
+ act.actor = _get_iter_string(&iter);
+ act.args = _get_iter_string(&iter);
+
+ return bus->cbs.add_ctnt(bus, BUS_OP_ADD_PIN, &data,
+ &act, bus->cb_data);
+}
+
+/**
+ * Invoked when METHOD_DEL_CONTENT of method called.
+ *
+ * Unmarshals the following data from parameter and calls the bus del_ctnt
+ * callback function.
+ * - service id
+ * - content id
+ *
+ * @param bus The bus object
+ * @param param The message the remote caller would send
+ * @return This function returns zero on success, or negative value
+ */
+static int _del_ctnt(struct bus *bus, GVariant *param)
+{
+ GVariantIter iter;
+ const gchar *svcid;
+ int ctnt_id;
+
+ if (!bus || !bus->cbs.del_ctnt || !param) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ g_variant_iter_init(&iter, param);
+ svcid = _get_iter_string(&iter);
+ if (!svcid) {
+ _ERR("Service id get failed");
+ return -1;
+ }
+
+ ctnt_id = _get_iter_int(&iter);
+ if (ctnt_id < 0) {
+ _ERR("Invalid content id");
+ return -1;
+ }
+
+ return bus->cbs.del_ctnt(bus, svcid, ctnt_id, bus->cb_data);
+}
+
+/**
+ * Invoked when METHOD_DEL_ALL of method called.
+ *
+ * Unmarshals the following data from parameter and calls the bus del_all
+ * callback function.
+ * - service id
+ * - reload or not
+ *
+ * @param bus The bus object
+ * @param param The message the remote caller would send
+ * @return This function returns zero on success, or negative value
+ */
+static int _del_all_ctnt(struct bus *bus, GVariant *param)
+{
+ GVariantIter iter;
+ const gchar *svcid;
+ bool reload;
+
+ if (!bus || !bus->cbs.del_all || !param) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ g_variant_iter_init(&iter, param);
+ svcid = _get_iter_string(&iter);
+ if (!svcid) {
+ _ERR("Service id get failed");
+ return -1;
+ }
+
+ reload = _get_iter_boolean(&iter);
+
+ return bus->cbs.del_all(bus, svcid, reload, bus->cb_data);
+}
+
+static struct _method_handler _methods[] = {
+ {
+ .method = BUS_METHOD_ADD_LABEL,
+ .handler = _add_label
+ },
+ {
+ .method = BUS_METHOD_ADD_ALBUM,
+ .handler = _add_album
+ },
+ {
+ .method = BUS_METHOD_ADD_CONTENT,
+ .handler = _add_ctnt
+ },
+ {
+ .method = BUS_METHOD_ADD_PIN,
+ .handler = _add_pin
+ },
+ {
+ .method = BUS_METHOD_DEL_CONTENT,
+ .handler = _del_ctnt,
+ },
+ {
+ .method = BUS_METHOD_DEL_ALL,
+ .handler = _del_all_ctnt
+ }
+};
+
+/**
+ * Registers method and handler callback function.
+ *
+ * @param conn The GDBusConnection
+ * @param sender The unique bus name
+ * @param obj_path The object path that the method was invoked on
+ * @param if_name The D-Bus interface name the method was invoked on
+ * @param method The name of the method that was invoked
+ * @param param The message the remote caller would send
+ * @param iv The GDBusMethodInvocation object that can be used to return a value
+ * @param data The bus object
+ */
+static void _method_call(GDBusConnection *conn,
+ const gchar *sender, const gchar *obj_path,
+ const gchar *if_name, const gchar *method,
+ GVariant *param, GDBusMethodInvocation *iv,
+ gpointer data)
+{
+ struct bus *bus;
+ int i;
+ int r;
+
+
+ if (!data || !param || !iv) {
+ _ERR("Invalid arguments");
+ return;
+ }
+
+ bus = data;
+
+ r = -1;
+ for (i = 0; i < sizeof(_methods) / sizeof(*_methods);
+ i++) {
+ if (!strcmp(_methods[i].method, method)) {
+ r = _methods[i].handler(bus, param);
+ break;
+ }
+ }
+
+ g_dbus_method_invocation_return_value(iv, g_variant_new("(i)", r));
+}
+
+static const GDBusInterfaceVTable _bus_ifaces = {
+ _method_call,
+ NULL,
+ NULL
+};
+
+/**
+ * Invoked function to register callbacks in interface table if bus is acquired.
+ *
+ * @param connection The GDBusConnection to a message bus
+ * @param name The name tha is requested to be owned
+ * @param data The bus object
+ */
+static void _bus_acquired(GDBusConnection *conn, const gchar *name,
+ gpointer data)
+{
+ GError *err;
+ struct bus *bus;
+ guint regid;
+
+ if (!conn || !data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ bus = data;
+
+ err = NULL;
+ regid = g_dbus_connection_register_object(conn,
+ BUS_OBJECT_PATH,
+ bus->node->interfaces[0],
+ &_bus_ifaces,
+ bus, NULL, &err);
+ if (!regid) {
+ _ERR("register object failed: %s", err ? err->message : "");
+ g_error_free(err);
+ if (!bus->cbs.end)
+ return;
+ bus->cbs.end(bus, bus->cb_data);
+ return;
+ }
+
+ bus->conn = conn;
+}
+
+/**
+ * Invoked when bus name is acquired and calls bus ready callback function
+ * to emit the SIGNAL_REFRESH signal to daemons.
+ *
+ * @param connection The GDBusConnection on which to acquired the name
+ * @param name The name being owned
+ * @param data The bus object
+ */
+static void _name_acquired(GDBusConnection *conn, const char *name,
+ gpointer data)
+{
+ struct bus *bus;
+
+ if (!conn || !data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ _DBG("Name acquired: %s", name);
+ bus = data;
+ if (!bus->cbs.ready)
+ return;
+ bus->cbs.ready(bus, bus->cb_data);
+}
+
+/**
+ * Invoked when bus name lost and calls bus end callback function.
+ *
+ * @param conn The GDBusConnection on which to acquire the name or NULL
+ * if the connection was disconected
+ * @param name The name being owned
+ * @param data The bus object
+ */
+static void _name_lost(GDBusConnection *conn, const char *name,
+ gpointer data)
+{
+ struct bus *bus;
+
+ if (!conn || !data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ bus = data;
+ _DBG("Name lost: %s", name);
+ if (!bus->cbs.end)
+ return;
+
+ bus->cbs.end(bus, bus->cb_data);
+}
+
+/**
+ * Initialize bus for sending the dynamic bar contents.
+ *
+ * Parses BUS_INTROSPECTION_XML data and creates bus.
+ *
+ * @param bus The bus object
+ * @return This function returns zero on success, or negative value
+ */
+static int _init_bus(struct bus *bus)
+{
+ guint owner_id;
+ GDBusNodeInfo *node;
+ GError *err;
+
+ if (!bus) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ err = NULL;
+ node = g_dbus_node_info_new_for_xml(BUS_INTROSPECTION_XML, &err);
+ if (!node) {
+ _ERR("get node failed: %s", err->message);
+ g_error_free(err);
+ return -1;
+ }
+
+ if (!node->interfaces) {
+ _ERR("no interface received");
+ goto unref_node;
+ }
+
+ owner_id = g_bus_own_name(BUS_TYPE, BUS_NAME,
+ G_BUS_NAME_OWNER_FLAGS_NONE,
+ _bus_acquired, _name_acquired,
+ _name_lost, bus, NULL);
+ if (!owner_id) {
+ _ERR("bus own name failed");
+ goto unref_node;
+ }
+
+ bus->node = node;
+ bus->owner_id = owner_id;
+
+ return 0;
+
+unref_node:
+ g_object_unref(node);
+
+ return -1;
+}
+
+/**
+ * Initializes bus.
+ *
+ * @param cbs The bus_cbs object
+ * @param data The engine object
+ * @return This function returns bus object on success, or NULL
+ */
+struct bus *bus_init(struct bus_cbs *cbs, void *data)
+{
+ struct bus *bus;
+ int r;
+
+ bus = calloc(1, sizeof(*bus));
+ if (!bus) {
+ _ERR("calloc failed");
+ return NULL;
+ }
+
+ r = _init_bus(bus);
+ if (r != 0) {
+ free(bus);
+ return NULL;
+ }
+
+ memcpy(&bus->cbs, cbs, sizeof(*cbs));
+ bus->cb_data = data;
+
+ return bus;
+}
+
+/**
+ * Finalizes bus.
+ *
+ * @param bus The bus object
+ */
+void bus_fini(struct bus *bus)
+{
+ g_dbus_node_info_unref(bus->node);
+ g_bus_unown_name(bus->owner_id);
+ free(bus);
+}
+
+/**
+ * Invoked for sending the signal to bus.
+ *
+ * @param bus The bus object
+ * @param sig The char of signal
+ * @param This function returns zero on success, or negative value
+ */
+int bus_send_signal(struct bus *bus, const char *sig)
+{
+ GError *err;
+ gboolean r;
+
+ if (!bus || !sig) {
+ _ERR("Invalid argument\n");
+ return -1;
+ }
+
+ err = NULL;
+ r = g_dbus_connection_emit_signal(bus->conn, NULL,
+ BUS_OBJECT_PATH, BUS_INTERFACE, sig, NULL, &err);
+ if (r == FALSE) {
+ _ERR("emit %s signal failed: %s\n",
+ sig, err ? err->message : NULL);
+ g_error_free(err);
+ return -1;
+ }
+
+ return 0;
+}
+
+/**
+ * bus send svcid, client program start
+ */
+
+static void _invoke_send_svcid_method(struct client_bus *cbus);
+
+/**
+ * Invoked when 5 seconds is passed for calling send service method
+ *
+ * @param data The client bus object
+ * @return G_SOURCE_REMOVE
+ */
+static gboolean _resend_handler(gpointer data)
+{
+ struct client_bus *cbus;
+
+ if (!data)
+ return G_SOURCE_REMOVE;
+
+ cbus = data;
+ cbus->resend_handler = 0;
+ _invoke_send_svcid_method(cbus);
+
+ return G_SOURCE_REMOVE;
+}
+
+/**
+ * Invoked when proxy call has not been complted or name owner did not allowed.
+ *
+ * generates the resend callback function every 5 seconds.
+ *
+ * @param cbus The client bus object
+ */
+static void _resend_svcid(struct client_bus *cbus)
+{
+ if (!cbus)
+ return;
+
+ cbus->resend_handler = g_timeout_add_seconds(
+ RESEND_TIMEOUT, _resend_handler, cbus);
+}
+
+/**
+ * Invoked when proxy call has been completed.
+ *
+ * @param sobj The Gobject object the asychronous was started with
+ * @param res The GAsyncResult
+ * @param data The user data passed to the callback
+ */
+static void _method_cb(GObject *sobj, GAsyncResult *res, gpointer data)
+{
+ GVariant *v;
+ GError *err;
+ int success;
+ struct client_bus *cbus;
+
+ if (!data)
+ return;
+
+ cbus = data;
+
+ if (g_cancellable_is_cancelled(cbus->cancellable))
+ goto end;
+
+ err = NULL;
+ v = g_dbus_proxy_call_finish(G_DBUS_PROXY(sobj), res, &err);
+ if (!v) {
+ _ERR("%s", err ? err->message : "");
+ g_error_free(err);
+ g_object_unref(cbus->cancellable);
+ _resend_svcid(cbus);
+ return;
+ }
+ g_variant_get(v, "(i)", &success);
+ g_variant_unref(v);
+
+end:
+ g_object_unref(cbus->cancellable);
+}
+
+/**
+ * Build the message according to each type.
+ *
+ * @param The char value of service id
+ * @return parameter or NULL
+ */
+static GVariant *_build_param_send_svcid(const char *svcid)
+{
+ GVariantBuilder *builder;
+ GVariant *param;
+
+ if (!svcid) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ builder = g_variant_builder_new(G_VARIANT_TYPE_TUPLE);
+ if (!builder) {
+ _ERR("builder new failed");
+ return NULL;
+ }
+ g_variant_builder_add(builder, "s", svcid);
+
+ param = g_variant_builder_end(builder);
+
+ g_variant_builder_unref(builder);
+
+ return param;
+}
+
+/**
+ * Invoked when there is notification which is related with bua name.
+ *
+ * If there is no bus name owner, resend the service id each 5 seconds.
+ *
+ * @param object The GOjbect object
+ * @param pspec The GParamSpec object
+ * @param user_data The client data object
+ */
+static void _name_owner_notify(GObject *object, GParamSpec *pspec,
+ gpointer user_data)
+{
+ struct client_bus *cbus;
+ GDBusProxy *proxy;
+
+ if (!object || !user_data)
+ return;
+
+ cbus = user_data;
+ proxy = G_DBUS_PROXY(object);
+
+ if (proxy && !g_dbus_proxy_get_name_owner(proxy)) {
+ _resend_svcid(cbus);
+ return;
+ }
+
+ _INFO("Owner Connected:%s", g_dbus_proxy_get_name_owner(proxy));
+}
+
+/**
+ * Marshalls message and sends to daemons by bus.
+ *
+ * @param cbus The client bus object
+ */
+static void _invoke_send_svcid_method(struct client_bus *cbus)
+{
+ GCancellable *cancellable;
+ GVariant *param;
+
+ if (!cbus || !cbus->proxy)
+ return;
+
+ cancellable = g_cancellable_new();
+ if (!cancellable) {
+ _ERR("cancellable new failed");
+ return;
+ }
+ cbus->cancellable = cancellable;
+
+ param = _build_param_send_svcid(cbus->svcid);
+ if (!param)
+ return;
+
+ g_dbus_proxy_call(cbus->proxy, BUS_METHOD_SEND_SVCID,
+ param, G_DBUS_CALL_FLAGS_NO_AUTO_START,
+ -1, cancellable, _method_cb, cbus);
+}
+
+/**
+ * Invoked when proxy is ready successfully.
+ *
+ * @param obj The GObject the asynchronous operation was started with
+ * @param res The GAsyncResult
+ * @param data The user data passed to the callback
+ */
+static void _proxy_cb(GObject *obj, GAsyncResult *res, gpointer data)
+{
+ GError *err;
+ GDBusProxy *proxy;
+ struct client_bus *cbus;
+
+ if (!data || !obj) {
+ _ERR("Invalid data, returning");
+ return;
+ }
+
+ cbus = data;
+ err = NULL;
+
+ proxy = g_dbus_proxy_new_for_bus_finish(res, &err);
+ if (!proxy) {
+ _ERR("bus proxy new failed: %s\n",
+ err ? err->message : "");
+ g_error_free(err);
+ }
+ cbus->proxy = proxy;
+
+ cbus->notify_handler = g_signal_connect(proxy,
+ "notify::g-name-owner",
+ G_CALLBACK(_name_owner_notify),
+ cbus);
+
+ _invoke_send_svcid_method(cbus);
+}
+
+/**
+ * Sends service id to client daemons as creating proxy to bus.
+ *
+ * @param cbus The client bus object
+ */
+void bus_client_send_svcid(struct client_bus *cbus)
+{
+ if (!cbus || !cbus->bus_name || !cbus->object_path)
+ return;
+
+ g_type_init();
+
+ g_dbus_proxy_new_for_bus(BUS_TYPE, G_DBUS_PROXY_FLAGS_NONE,
+ NULL, cbus->bus_name, cbus->object_path,
+ BUS_INTERFACE, NULL, _proxy_cb, cbus);
+}
+
+/**
+ * Initializes client bus for sending uniquer service id to daemons.
+ *
+ * @param bus name The char value of bus name
+ * @param object path The char value of bus object path
+ * @param svcid The char value of client service
+ * @return This function returns client_bus object on success, or NULL
+ */
+struct client_bus *bus_client_init(const char *bus_name,
+ const char *object_path, const char *svcid)
+{
+ struct client_bus *cbus;
+
+ if (!bus_name || !object_path || !svcid)
+ return NULL;
+
+ cbus = calloc(1, sizeof(*cbus));
+ if (!cbus)
+ return NULL;
+
+ cbus->bus_name = bus_name;
+ cbus->object_path = object_path;
+ cbus->svcid = svcid;
+
+ return cbus;
+}
+
+/**
+ * Disconnects the proxy to bus for finalize the client bus.
+ *
+ * @param cbus The client bus object
+ */
+void bus_client_fini(struct client_bus *cbus)
+{
+ if (!cbus)
+ return;
+
+ cbus->resend_handler = 0;
+ if (cbus->notify_handler > 0)
+ g_signal_handler_disconnect(cbus->proxy,
+ cbus->notify_handler);
+
+ g_object_unref(cbus->proxy);
+
+ free(cbus);
+}
+
+/**
+ * bus send svcid, client program end
+ */
--- /dev/null
+/*
+ * Copyright (c) 2014 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 <utilX.h>
+#include <ctype.h>
+
+#include "i18n.h"
+#include "bar.h"
+#include "engine.h"
+#include "defs.h"
+#include "dbg.h"
+
+#define KEY_LONG_DUR 1.0
+#define EDIT_ARROW_UP_H 50
+#define BTN_MAX 2
+#define NO_PIN_ITEM 3
+#define BUF_MESSAGE_MAX 256
+#define POPUP_DUR 3.0
+#define CBAR_HEIGHT (1080 * elm_config_scale_get())
+
+#define TITLE_DELETE "Delete Menu"
+#define MESSAGE_DELETE "Are you sure you want to delete the"
+#define MESSAGE_PIN_BANNER "is deleted"
+
+enum _cbar_state {
+ CBAR_STATE_HIDE,
+ CBAR_STATE_CBAR,
+ CBAR_STATE_DBAR,
+ CBAR_STATE_EDIT,
+ CBAR_STATE_X
+};
+
+struct _cbar_item;
+struct _edit_item;
+
+struct _cbar_data {
+ Evas_Object *ly;
+ Evas_Object *bx;
+ Evas_Object *pin;
+ Evas_Object *scr;
+ Eina_List *list;
+ Ecore_Timer *key_timer;
+
+ struct _cbar_item *cur;
+ struct engine *eng;
+ enum _cbar_state state;
+ struct bar_info *cbar;
+};
+
+struct _cbar_item {
+ Evas_Object *eo;
+ Evas_Object *lbl;
+ Evas_Object *ic;
+ Elm_Transit *trans;
+
+ struct engine_bar_item *it;
+ Eina_Bool dirty;
+ struct _cbar_data *bar;
+ struct bar_info *dbar;
+ struct _edit_item *edit;
+};
+
+struct _edit_item {
+ Evas_Object *x;
+ Evas_Object *up;
+ Evas_Object *down;
+ Evas_Object *popup;
+ Evas_Object *btn[BTN_MAX];
+};
+
+struct _btn_info {
+ const char *part;
+ const char *text;
+ void (*click_cb)(void *, Evas *, Evas_Object *, void *);
+};
+
+static const char *_trim(char *str)
+{
+ int i;
+
+ if (!str || strlen(str) == 0)
+ return "";
+
+ i = strlen(str);
+ i--;
+
+ while (i > 0) {
+ if (isspace(str[i]))
+ str[i] = '\0';
+ else
+ break;
+ i++;
+ }
+
+ return str;
+}
+
+static Eina_Bool _move_edit_item(struct _cbar_data *bar)
+{
+ struct _cbar_item *item;
+
+ if (!bar) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ item = bar->cur;
+ if (!item || !item->eo)
+ return EINA_FALSE;
+
+ elm_object_signal_emit(item->edit->x, SIG_UNFOCUS, SRC_PROG);
+ elm_object_signal_emit(item->eo, SIG_FOCUS_FROM_EDIT, SRC_PROG);
+
+ bar->state = CBAR_STATE_EDIT;
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool _move(struct bar_info *info);
+
+static enum bar_event _move_left(struct bar_info *info)
+{
+ struct _cbar_item *item;
+ struct _cbar_data *bar;
+ Eina_Bool r;
+
+ if (!info || !info->data)
+ return BAR_EVENT_ERROR;
+
+ bar = info->data;
+ item = bar->cur;
+
+ if (!item)
+ return BAR_EVENT_ERROR;
+
+ switch (bar->state) {
+ case CBAR_STATE_CBAR:
+ return BAR_EVENT_MOVE;
+ case CBAR_STATE_EDIT:
+ return BAR_EVENT_PASS;
+ case CBAR_STATE_X:
+ if (item->edit && item->edit->popup)
+ return BAR_EVENT_PASS;
+ r = _move_edit_item(bar);
+ break;
+ default:
+ return BAR_EVENT_ERROR;
+ }
+
+ return r ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+}
+
+static int _launch_app(struct bar_info *info)
+{
+ struct _cbar_data *bar;
+ struct _cbar_item *item;
+
+ if (!info || !info->data)
+ return EINA_FALSE;
+
+ bar = info->data;
+ item = bar->cur;
+
+ if (!item) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ return engine_bar_item_launch(item->it);
+}
+
+static void _locate_edit_item(Evas_Object *eo, Evas_Object *p,
+ const char *file)
+{
+ Evas_Coord x, y, w, h;
+ Evas_Coord mx, my;
+ double s;
+
+ if (!eo || !p || !file) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ s = elm_config_scale_get();
+ evas_object_geometry_get(p, &x, &y, &w, &h);
+
+ if (!strcmp(file, GRP_EDIT_X)) {
+ mx = x * s + w * s;
+ my = y * s;
+ } else if (!strcmp(file, GRP_EDIT_ARROW_DOWN)) {
+ mx = x * s;
+ my = y * s + h * s;
+ } else if (!strcmp(file, GRP_EDIT_ARROW_UP)) {
+ mx = x * s;
+ my = y * s - EDIT_ARROW_UP_H * s;
+ } else
+ return;
+
+ evas_object_move(eo, mx, my);
+}
+
+static Eina_Bool _set_x_item(struct _cbar_data *bar)
+{
+ struct _cbar_item *item;
+ struct _edit_item *edit;
+
+ if (!bar) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ item = bar->cur;
+ edit = item->edit;
+ if (!edit || !edit->x)
+ return EINA_FALSE;
+
+ elm_object_signal_emit(item->eo, SIG_UNFOCUS_TO_DBAR, SRC_PROG);
+ elm_object_signal_emit(edit->x, SIG_INITIAL_FOCUS, SRC_PROG);
+
+ bar->state = CBAR_STATE_X;
+
+ return EINA_TRUE;
+}
+
+static void _x_mouse_over(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ struct _cbar_item *item;
+
+ if (!data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ item = data;
+
+ if (item->bar->state != CBAR_STATE_EDIT)
+ return;
+
+ _set_x_item(item->bar);
+}
+
+static Eina_Bool _add_del_popup(struct _cbar_data *);
+
+static void _x_clicked(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ struct _cbar_item *item;
+
+ if (!data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ item = data;
+
+ if (item->bar->state != CBAR_STATE_X)
+ return;
+
+ _add_del_popup(item->bar);
+}
+
+static inline Evas_Object *_add_cbar_item_bg(Evas_Object *,
+ struct engine_bar_item *);
+
+static Evas_Object *_add_edit_item(struct _cbar_item *item, const char *file)
+{
+ Evas_Object *eo, *bg;
+
+ if (!item || !item->eo || !file) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ eo = elm_layout_add(item->eo);
+ if (!eo) {
+ _ERR("layout add failed");
+ return NULL;
+ }
+ elm_layout_file_set(eo, EDJEFILE, file);
+ evas_object_show(eo);
+
+ if (!strcmp(file, GRP_EDIT_X)) {
+ bg = _add_cbar_item_bg(eo, item->it);
+ if (!bg) {
+ evas_object_del(eo);
+ return NULL;
+ }
+ elm_object_part_content_set(eo, PART_BG, bg);
+ evas_object_show(bg);
+
+ evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_MOVE,
+ _x_mouse_over, item);
+ evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_UP,
+ _x_clicked, item);
+ }
+
+ _locate_edit_item(eo, item->eo, file);
+
+ return eo;
+}
+
+enum _edit_item_order {
+ EDIT_ITEM_ORDER_ONE,
+ EDIT_ITEM_ORDER_FIRST,
+ EDIT_ITEM_ORDER_LAST,
+ EDIT_ITEM_ORDER_OTHERS,
+ EDIT_ITEM_ORDER_MAX
+};
+
+static enum _edit_item_order _get_edit_item_order(struct _cbar_data *bar)
+{
+ struct _cbar_item *item;
+ Eina_List *l;
+ int i, cnt;
+
+ if (!bar) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ i = 0;
+ cnt = 0;
+ EINA_LIST_FOREACH(bar->list, l, item) {
+ if (engine_bar_item_get_is_pinned(item->it)) {
+ if (item == bar->cur)
+ i = cnt;
+ cnt++;
+ }
+ }
+
+ if (cnt == 1)
+ return EDIT_ITEM_ORDER_ONE;
+
+ if (i == 0)
+ return EDIT_ITEM_ORDER_FIRST;
+ else if (i == cnt - 1)
+ return EDIT_ITEM_ORDER_LAST;
+
+ return EDIT_ITEM_ORDER_OTHERS;
+}
+
+static Elm_Transit *_set_transit_icon(Evas_Object *ic)
+{
+ Elm_Transit *trans;
+
+ if (!ic)
+ return NULL;
+
+ trans = elm_transit_add();
+ if (!trans) {
+ _ERR("transit add failed");
+ return NULL;
+ }
+
+ elm_transit_object_add(trans, ic);
+ elm_transit_effect_color_add(trans, 255, 255, 255,
+ 255, 255, 255, 255, 50);
+ elm_transit_objects_final_state_keep_set(trans, EINA_TRUE);
+ elm_transit_duration_set(trans, 0.3);
+ elm_transit_go(trans);
+
+ return trans;
+}
+
+static void _dim_item(struct _cbar_data *bar)
+{
+ struct _cbar_item *item;
+ Eina_List *l;
+
+ if (!bar) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ elm_object_signal_emit(bar->pin, SIG_DIM_ITEM, SRC_PROG);
+ elm_object_signal_emit(bar->ly, SIG_DIM_ITEM, SRC_PROG);
+ elm_object_focus_set(bar->scr, EINA_FALSE);
+
+ EINA_LIST_FOREACH(bar->list, l, item) {
+ elm_object_focus_allow_set(item->eo, EINA_FALSE);
+ if (item == bar->cur)
+ continue;
+
+ elm_object_signal_emit(item->eo, SIG_DIM_ITEM, SRC_PROG);
+ elm_object_signal_emit(item->lbl, SIG_DIM_ITEM, SRC_PROG);
+ item->trans = _set_transit_icon(item->ic);
+ }
+}
+
+static void _undim_item(struct _cbar_data *bar)
+{
+ struct _cbar_item *item;
+ Eina_List *l;
+
+ if (!bar) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ elm_object_signal_emit(bar->pin, SIG_UNDIM_ITEM, SRC_PROG);
+ elm_object_signal_emit(bar->ly, SIG_UNDIM_ITEM, SRC_PROG);
+ elm_object_focus_set(bar->scr, EINA_TRUE);
+
+ EINA_LIST_FOREACH(bar->list, l, item) {
+ elm_object_focus_allow_set(item->eo, EINA_TRUE);
+ if (item == bar->cur)
+ continue;
+
+ elm_object_signal_emit(item->eo, SIG_UNDIM_ITEM, SRC_PROG);
+ elm_object_signal_emit(item->lbl, SIG_UNDIM_ITEM, SRC_PROG);
+ evas_object_color_set(item->ic, 255, 255, 255, 255);
+ elm_transit_del(item->trans);
+ }
+}
+
+static void _emit_arrow_signal(struct _cbar_item *item)
+{
+ struct _edit_item *edit;
+
+ if (!item || !item->edit) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ edit = item->edit;
+
+ if (item->eo)
+ elm_object_signal_emit(item->eo, SIG_SHOW_EDIT_ITEM, SRC_PROG);
+ if (edit->up)
+ elm_object_signal_emit(edit->up, SIG_FOCUS_ARROW, SRC_PROG);
+ if (edit->down)
+ elm_object_signal_emit(edit->down, SIG_FOCUS_ARROW, SRC_PROG);
+}
+
+static void _free_item(struct _edit_item *edit)
+{
+ if (!edit) {
+ _ERR("Invalid Argument");
+ return;
+ }
+
+ if (edit->x) {
+ evas_object_del(edit->x);
+ edit->x = NULL;
+ }
+ if (edit->up) {
+ evas_object_del(edit->up);
+ edit->up = NULL;
+ }
+ if (edit->down) {
+ evas_object_del(edit->down);
+ edit->down = NULL;
+ }
+ if (edit->popup) {
+ evas_object_del(edit->popup);
+ edit->popup = NULL;
+ }
+
+ free(edit);
+}
+
+static Eina_Bool _change_edit_mode(struct _cbar_data *bar)
+{
+ struct _cbar_item *item;
+ struct _edit_item *edit;
+ enum _edit_item_order order;
+
+ if (!bar) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ item = bar->cur;
+ if (!item || !item->eo) {
+ _ERR("There is no item");
+ return EINA_FALSE;
+ }
+
+ if (item->edit) {
+ _ERR("Already edit mode");
+ return EINA_FALSE;
+ }
+
+ edit = calloc(1, sizeof(*edit));
+ if (!edit) {
+ _ERR("failed to calloc edit item");
+ return EINA_FALSE;
+ }
+
+ order = _get_edit_item_order(bar);
+ switch (order) {
+ case EDIT_ITEM_ORDER_ONE:
+ edit->x = _add_edit_item(item, GRP_EDIT_X);
+ if (!edit->x)
+ goto err;
+ break;
+ case EDIT_ITEM_ORDER_OTHERS:
+ edit->up = _add_edit_item(item, GRP_EDIT_ARROW_UP);
+ if (!edit->up)
+ goto err;
+ /* fallthrough */
+ case EDIT_ITEM_ORDER_FIRST:
+ edit->x = _add_edit_item(item, GRP_EDIT_X);
+ if (!edit->x)
+ goto err;
+
+ edit->down = _add_edit_item(item, GRP_EDIT_ARROW_DOWN);
+ if (!edit->down)
+ goto err;
+ break;
+ case EDIT_ITEM_ORDER_LAST:
+ edit->up = _add_edit_item(item, GRP_EDIT_ARROW_UP);
+ if (!edit->up)
+ goto err;
+
+ edit->x = _add_edit_item(item, GRP_EDIT_X);
+ if (!edit->x)
+ goto err;
+ break;
+ default:
+ goto err;
+ }
+
+ bar->state = CBAR_STATE_EDIT;
+ item->edit = edit;
+
+ _dim_item(bar);
+ _emit_arrow_signal(item);
+
+ return EINA_TRUE;
+
+err:
+ _ERR("item add failed");
+ _free_item(edit);
+ return EINA_FALSE;
+}
+
+static Eina_Bool _long_key_cb(void *data)
+{
+ struct _cbar_data *bar;
+ struct _cbar_item *item;
+
+ if (!data)
+ return EINA_FALSE;
+
+ bar = data;
+ item = bar->cur;
+
+ if (engine_bar_item_get_is_pinned(item->it))
+ return _change_edit_mode(bar);
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool _change_cbar_mode(struct _cbar_data *bar)
+{
+ struct _cbar_item *item;
+
+ if (!bar) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ item = bar->cur;
+
+ _free_item(item->edit);
+ _undim_item(bar);
+ item->edit = NULL;
+
+ elm_object_focus_set(item->eo, EINA_TRUE);
+ elm_object_signal_emit(item->eo, SIG_SHOW_EDIT_ITEM, SRC_PROG);
+
+ bar->state = CBAR_STATE_CBAR;
+
+ return EINA_TRUE;
+}
+
+static void _free_popup(struct _cbar_data *bar)
+{
+ if (!bar) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ if (!bar->cur->edit->popup)
+ return;
+
+ evas_object_del(bar->cur->edit->popup);
+ bar->cur->edit->popup = NULL;
+}
+
+static void _add_banner(struct _cbar_data *bar, char *text)
+{
+ Evas_Object *banner, *win;
+
+ if (!bar || !text) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ win = elm_object_parent_widget_get(bar->ly);
+ if (!win) {
+ _ERR("failed to get win eo");
+ return;
+ }
+
+ banner = elm_popup_add(win);
+ if (!banner) {
+ _ERR("failed to create popup");
+ return;
+ }
+
+ elm_object_style_set(banner, STYLE_POPUP_BOTTOM_1LINE);
+ elm_popup_orient_set(banner, ELM_POPUP_ORIENT_BOTTOM);
+ elm_object_text_set(banner, text);
+ elm_popup_timeout_set(banner, POPUP_DUR);
+ elm_object_focus_allow_set(banner, EINA_FALSE);
+ evas_object_show(banner);
+}
+
+static void _update_pin(void *data, bool focus);
+
+static void _del_pin(struct _cbar_data *bar)
+{
+ struct _cbar_item *item;
+ char buf[BUF_MESSAGE_MAX];
+ const char *name;
+ int r;
+
+ if (!bar) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ item = bar->cur;
+
+ name = engine_bar_item_get_name(item->it);
+ snprintf(buf, sizeof(buf), "'%s' %s", _trim((char *)name),
+ MESSAGE_PIN_BANNER);
+
+ r = engine_bar_item_del_pin(bar->eng, item->it);
+ if (r < 0) {
+ _ERR("failed to del pin");
+ return;
+ }
+
+ _free_popup(bar);
+ _free_item(item->edit);
+ _undim_item(bar);
+ _add_banner(bar, buf);
+
+ bar->state = CBAR_STATE_CBAR;
+}
+
+static void _del_clicked(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ _del_pin(data);
+}
+
+static void _cancel_clicked(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ _free_popup(data);
+}
+
+static void _btn_mouse_over(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ elm_object_focus_set(obj, EINA_TRUE);
+}
+
+static int _add_btn(Evas_Object *p, struct _cbar_item *item)
+{
+ Evas_Object *btn;
+ struct _edit_item *edit;
+ struct _btn_info btn_info[] = {
+ {
+ "button1",
+ "Delete",
+ _del_clicked
+ },
+ {
+ "button2",
+ "Cancel",
+ _cancel_clicked
+ }
+ };
+ int i;
+
+ if (!p || !item) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ edit = item->edit;
+ for (i = 0; i < sizeof(btn_info) / sizeof(*btn_info); i++) {
+ btn = elm_button_add(p);
+ if (!btn) {
+ _ERR("failed to create button");
+ memset(edit->btn, 0x00, sizeof(edit->btn));
+ return -1;
+ }
+ elm_object_part_content_set(p, btn_info[i].part, btn);
+ elm_object_text_set(btn, btn_info[i].text);
+ evas_object_show(btn);
+ edit->btn[i] = btn;
+
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_DOWN,
+ btn_info[i].click_cb, item->bar);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_MOVE,
+ _btn_mouse_over, item);
+
+ if (i == 0)
+ elm_object_focus_set(btn, EINA_TRUE);
+ }
+
+ return 0;
+}
+
+static Eina_Bool _add_del_popup(struct _cbar_data *bar)
+{
+ struct _cbar_item *item;
+ struct _edit_item *edit;
+ Evas_Object *popup, *win;
+ char buf[BUF_MESSAGE_MAX];
+ int r;
+
+ if (!bar) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ item = bar->cur;
+ edit = item->edit;
+
+ if (edit->popup) {
+ _ERR("Already popup created");
+ return EINA_FALSE;
+ }
+
+ win = elm_object_parent_widget_get(bar->ly);
+ if (!win) {
+ _ERR("failed to get win eo");
+ return EINA_FALSE;
+ }
+
+ popup = elm_popup_add(win);
+ if (!popup) {
+ _ERR("failed to create popup");
+ return EINA_FALSE;
+ }
+ elm_object_style_set(popup, STYLE_POPUP_1LINE_2BUTTON);
+ elm_object_part_text_set(popup, PART_POPUP_TEXT, TITLE_DELETE);
+ elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER);
+ elm_object_focus_allow_set(popup, EINA_FALSE);
+ evas_object_show(popup);
+ snprintf(buf, sizeof(buf), "%s %s?", MESSAGE_DELETE,
+ _trim((char *)engine_bar_item_get_name(item->it)));
+ elm_object_text_set(popup, buf);
+
+ r = _add_btn(popup, item);
+ if (r < 0) {
+ _ERR("failed to add btn");
+ evas_object_del(popup);
+ return EINA_FALSE;
+ }
+
+ edit->popup = popup;
+
+ return EINA_TRUE;
+}
+
+static enum bar_event _enter(struct bar_info *info)
+{
+ struct _cbar_data *bar;
+ struct _cbar_item *item;
+ Eina_Bool r;
+
+ if (!info || !info->data)
+ return BAR_EVENT_ERROR;
+
+ bar = info->data;
+ item = bar->cur;
+
+ if (!item)
+ return BAR_EVENT_ERROR;
+
+ r = EINA_FALSE;
+
+ switch (bar->state) {
+ case CBAR_STATE_CBAR:
+ if (!bar->key_timer)
+ bar->key_timer = ecore_timer_add(KEY_LONG_DUR,
+ _long_key_cb, bar);
+ r = EINA_TRUE;
+ break;
+ case CBAR_STATE_EDIT:
+ if (item->edit)
+ r = _change_cbar_mode(bar);
+ break;
+ case CBAR_STATE_X:
+ if (!item->edit)
+ break;
+
+ if (item->edit->popup) {
+ if (elm_object_focus_get(item->edit->btn[0]))
+ _del_pin(bar);
+ else
+ _free_popup(bar);
+ r = EINA_TRUE;
+ } else {
+ r = _add_del_popup(bar);
+ }
+ break;
+ default:
+ return BAR_EVENT_ERROR;
+ }
+
+ return r ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+}
+
+static enum bar_event _move_right(struct bar_info *info)
+{
+ struct _cbar_data *bar;
+ struct _cbar_item *item;
+ Eina_Bool r;
+
+ if (!info || !info->data)
+ return BAR_EVENT_ERROR;
+
+ bar = info->data;
+ item = bar->cur;
+
+ if (!item)
+ return BAR_EVENT_ERROR;
+
+ r = EINA_FALSE;
+
+ switch (bar->state) {
+ case CBAR_STATE_X:
+ if (item->edit && item->edit->popup)
+ return BAR_EVENT_PASS;
+ break;
+ case CBAR_STATE_CBAR:
+ if (!item->dbar) {
+ r = EINA_FALSE;
+ break;
+ }
+
+ r = item->dbar->ops->move(item->dbar);
+ break;
+ case CBAR_STATE_EDIT:
+ r = _set_x_item(bar);
+ break;
+ default:
+ return BAR_EVENT_ERROR;
+ }
+
+ return r ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+}
+
+static enum bar_event _back(struct bar_info *info)
+{
+ struct _cbar_item *item;
+ struct _cbar_data *bar;
+ Eina_Bool r;
+
+ if (!info || !info->data)
+ return BAR_EVENT_ERROR;
+
+ bar = info->data;
+ item = bar->cur;
+
+ r = EINA_FALSE;
+
+ if (!item)
+ return BAR_EVENT_ERROR;
+
+ switch (bar->state) {
+ case CBAR_STATE_DBAR:
+ r = _move(info);
+ break;
+ case CBAR_STATE_CBAR:
+ return BAR_EVENT_BACK;
+ case CBAR_STATE_EDIT:
+ if (item->edit)
+ r = _change_cbar_mode(bar);
+ break;
+ case CBAR_STATE_X:
+ if (item->edit && item->edit->popup) {
+ _free_popup(bar);
+ return BAR_EVENT_DONE;
+ }
+ r = _move_edit_item(bar);
+ break;
+ default:
+ return BAR_EVENT_ERROR;
+ }
+
+ return r ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+}
+
+static int _update(struct bar_info *info, void *eng, void *data);
+
+static Eina_Bool _swap_pin(struct _cbar_data *bar, enum bar_direction dir)
+{
+ struct _cbar_item *item, *_item, *swap_item;
+ Eina_List *l;
+ int i, cnt, r;
+
+ if (!bar || !bar->cur || !bar->list) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ item = bar->cur;
+
+ i = 0;
+ EINA_LIST_FOREACH(bar->list, l, _item) {
+ if (item == _item)
+ break;
+
+ i++;
+ }
+
+ if (i == 0) {
+ _ERR("There is no pin item");
+ return EINA_FALSE;
+ }
+
+ cnt = eina_list_count(bar->list);
+
+ switch (dir) {
+ case BAR_DIR_DOWN:
+ if (i == cnt - 1) {
+ _ERR("There is no lower pin item");
+ return EINA_FALSE;
+ }
+ i++;
+ break;
+ case BAR_DIR_UP:
+ if (i < NO_PIN_ITEM) {
+ _ERR("There is no upper pin item");
+ return EINA_FALSE;
+ }
+ i--;
+ break;
+ default:
+ _ERR("Not appropriate direction");
+ return EINA_FALSE;
+ }
+
+ swap_item = eina_list_nth(bar->list, i);
+ if (!swap_item) {
+ _ERR("failed to get lower pin item");
+ return EINA_FALSE;
+ }
+
+ r = engine_bar_item_swap_pin(bar->eng, item->it, swap_item->it);
+ if (r < 0) {
+ _ERR("failed to swap pin");
+ return EINA_FALSE;
+ }
+
+ _change_cbar_mode(bar);
+ _update(bar->cbar, bar->eng, NULL);
+
+ bar->state = CBAR_STATE_EDIT;
+ bar->cur = eina_list_nth(bar->list, i);
+ elm_object_focus_set(bar->cur->eo, EINA_TRUE);
+
+ return EINA_TRUE;
+}
+
+static enum bar_event _move_up(struct bar_info *info)
+{
+ struct _cbar_data *bar;
+ Eina_Bool r;
+
+ if (!info || !info->data)
+ return BAR_EVENT_ERROR;
+
+ bar = info->data;
+
+ r = EINA_FALSE;
+
+ switch (bar->state) {
+ case CBAR_STATE_EDIT:
+ r = _swap_pin(bar, BAR_DIR_UP);
+ break;
+ default:
+ return BAR_EVENT_PASS;
+ }
+
+ return r ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+}
+
+static enum bar_event _move_down(struct bar_info *info)
+{
+ struct _cbar_data *bar;
+ Eina_Bool r;
+
+ if (!info || !info->data)
+ return BAR_EVENT_ERROR;
+
+ bar = info->data;
+
+ r = EINA_FALSE;
+
+ switch (bar->state) {
+ case CBAR_STATE_EDIT:
+ r = _swap_pin(bar, BAR_DIR_DOWN);
+ break;
+ default:
+ return BAR_EVENT_PASS;
+ }
+
+ return r ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+}
+
+static enum bar_event _key_event(struct bar_info *info, void *ei)
+{
+ Ecore_Event_Key *ev;
+ enum bar_event r;
+
+ if (!info || !ei)
+ return BAR_EVENT_ERROR;
+
+ ev = ei;
+
+ if (!strcmp(ev->keyname, KEY_BACK))
+ r = _back(info);
+ else if (!strcmp(ev->keyname, KEY_ENTER))
+ r = _enter(info);
+ else if (!strcmp(ev->keyname, KEY_RIGHT))
+ r = _move_right(info);
+ else if (!strcmp(ev->keyname, KEY_LEFT))
+ r = _move_left(info);
+ else if (!strcmp(ev->keyname, KEY_UP))
+ r = _move_up(info);
+ else if (!strcmp(ev->keyname, KEY_DOWN))
+ r = _move_down(info);
+ else
+ r = BAR_EVENT_PASS;
+
+ return r;
+}
+
+static enum bar_event _bar_event(struct bar_info *info,
+ void *ei, enum bar_event ev)
+{
+ struct _cbar_data *bar;
+ enum bar_event r;
+
+ if (!info || !ei)
+ return BAR_EVENT_ERROR;
+
+ bar = info->data;
+
+ switch (ev) {
+ case BAR_EVENT_DONE:
+ case BAR_EVENT_ERROR:
+ return ev;
+ case BAR_EVENT_PASS:
+ r = _key_event(info, ei);
+ break;
+ case BAR_EVENT_MOVE:
+ if (bar->state == CBAR_STATE_DBAR)
+ _move(info);
+ r = BAR_EVENT_DONE;
+ break;
+ default:
+ r = BAR_EVENT_PASS;
+ break;
+ }
+
+ return r;
+}
+
+static enum bar_event _key_down(struct bar_info *info, void *ei)
+{
+ struct _cbar_data *bar;
+ struct _cbar_item *item;
+ enum bar_event r;
+
+ if (!info || !ei)
+ return BAR_EVENT_ERROR;
+
+ bar = info->data;
+ item = bar->cur;
+
+ if (!item)
+ return BAR_EVENT_ERROR;
+
+ r = BAR_EVENT_PASS;
+
+ switch (bar->state) {
+ case CBAR_STATE_EDIT:
+ case CBAR_STATE_X:
+ case CBAR_STATE_CBAR:
+ r = BAR_EVENT_PASS;
+ break;
+ case CBAR_STATE_DBAR:
+ if (!item->dbar) {
+ r = BAR_EVENT_PASS;
+ break;
+ }
+ r = item->dbar->ops->key_down(item->dbar, ei);
+ break;
+ default:
+ return BAR_EVENT_ERROR;
+ }
+
+ return _bar_event(info, ei, r);
+}
+
+static int _bring_in_middle(Evas_Object *scr,
+ Evas_Object *obj, Evas_Object *pin)
+{
+ Evas_Coord y, h, sy, sh, rx, ry, rw, rh, my, smy, ch;
+ Evas_Coord min_h, max_h;
+ const char *s;
+
+ if (!scr || !obj || !pin)
+ return -1;
+
+ evas_object_geometry_get(obj, NULL, &y, NULL, &h);
+ evas_object_geometry_get(scr, NULL, &sy, NULL, &sh);
+ elm_scroller_region_get(scr, &rx, &ry, &rw, &rh);
+ elm_scroller_child_size_get(scr, NULL, &ch);
+
+ if (ch < rh)
+ return 0;
+
+ s = edje_object_data_get(elm_layout_edje_get(pin), DATA_PIN_HEIGHT);
+ min_h = atoi(s);
+ max_h = CBAR_HEIGHT - h;
+
+ if (y >= min_h && y <= max_h)
+ return 0;
+
+ my = y + (h >> 1);
+ smy = sy + (sh >> 1);
+
+ ry = ry - smy + my;
+
+ if (ry < 0)
+ ry = 0;
+ else if (ry + rh > ch)
+ ry = ch - rh;
+
+ elm_scroller_region_show(scr, rx, ry, rw, rh);
+
+ return 1;
+}
+
+static enum bar_event _key_up(struct bar_info *info, void *ei)
+{
+ struct _cbar_data *bar;
+ Ecore_Event_Key *ev;
+ int r;
+
+ if (!info || !info->data || !ei)
+ return BAR_EVENT_ERROR;
+
+ ev = ei;
+ bar = info->data;
+
+ if (!strcmp(ev->keyname, KEY_ENTER)) {
+ if (!bar->key_timer)
+ return BAR_EVENT_DONE;
+
+ ecore_timer_del(bar->key_timer);
+ bar->key_timer = NULL;
+
+ if (bar->state == CBAR_STATE_CBAR)
+ return _launch_app(info);
+ } else if (!strcmp(ev->keyname, KEY_UP) ||
+ !strcmp(ev->keyname, KEY_DOWN)) {
+ if (bar->state != CBAR_STATE_EDIT)
+ return BAR_EVENT_DONE;
+
+ r = _bring_in_middle(bar->scr, bar->cur->eo, bar->pin);
+ if (!r)
+ _change_edit_mode(bar);
+
+ return BAR_EVENT_DONE;
+ }
+
+ return BAR_EVENT_PASS;
+}
+
+static Eina_Bool _move(struct bar_info *info)
+{
+ struct _cbar_data *bar;
+ struct _cbar_item *item;
+ Eina_List *l;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ bar = info->data;
+ item = bar->cur;
+
+ if (!item) {
+ EINA_LIST_FOREACH(bar->list, l, item) {
+ if (elm_object_focus_allow_get(item->eo))
+ break;
+ }
+
+ if (!item)
+ return EINA_FALSE;
+ }
+
+ elm_object_focus_set(item->eo, EINA_TRUE);
+
+ return EINA_TRUE;
+}
+
+static void _hide(struct bar_info *info)
+{
+ struct _cbar_data *bar;
+ struct _cbar_item *item;
+ Eina_List *l;
+
+ bar = info->data;
+
+ item = bar->cur;
+ if (item)
+ elm_object_focus_set(item->eo, EINA_FALSE);
+
+ EINA_LIST_FOREACH(bar->list, l, item) {
+ elm_object_signal_emit(item->eo, SIG_HIDE, SRC_PROG);
+ elm_object_focus_allow_set(item->eo, EINA_FALSE);
+ }
+
+ bar->state = CBAR_STATE_HIDE;
+}
+
+static void _show(struct bar_info *info)
+{
+ struct _cbar_data *bar;
+ struct _cbar_item *item;
+ Eina_List *l;
+
+ bar = info->data;
+
+ EINA_LIST_FOREACH(bar->list, l, item)
+ elm_object_focus_allow_set(item->eo, EINA_TRUE);
+
+ item = bar->cur;
+ if (!item) {
+ item = eina_list_data_get(bar->list);
+ bar->cur = item;
+ }
+
+ if (bar->state == CBAR_STATE_HIDE)
+ bar->state = CBAR_STATE_CBAR;
+
+ elm_object_focus_set(item->eo, EINA_TRUE);
+}
+
+static inline Evas_Object *_add_cbar_item_bg(Evas_Object *base,
+ struct engine_bar_item *it)
+{
+ Evas_Object *bg;
+ int r, g, b;
+
+ if (!base || !it)
+ return NULL;
+
+ bg = evas_object_rectangle_add(evas_object_evas_get(base));
+ if (!bg) {
+ _ERR("bg add failed");
+ return NULL;
+ }
+ r = ITEM_DEFAULT_BG_R;
+ g = ITEM_DEFAULT_BG_G;
+ b = ITEM_DEFAULT_BG_B;
+
+ engine_bar_item_get_color(it, &r, &g, &b);
+ evas_object_color_set(bg, r, g, b, 255);
+
+ return bg;
+}
+
+static inline Evas_Object *_add_icon(Evas_Object *base, const char *file)
+{
+ Evas_Object *ic;
+
+ if (!base || !file)
+ return NULL;
+
+ ic = elm_icon_add(base);
+ if (!ic) {
+ _ERR("icon add failed");
+ return NULL;
+ }
+
+ elm_image_file_set(ic, file, NULL);
+
+ return ic;
+}
+
+static void _mouse_over(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ struct _cbar_item *item;
+
+ if (!data) {
+ _ERR("Invalide argument");
+ return;
+ }
+
+ item = data;
+
+ switch (item->bar->state) {
+ case CBAR_STATE_DBAR:
+ case CBAR_STATE_CBAR:
+ elm_object_focus_set(item->eo, EINA_TRUE);
+ break;
+ case CBAR_STATE_X:
+ if (obj == item->bar->cur->eo)
+ _move_edit_item(item->bar);
+ break;
+ default:
+ break;
+ }
+}
+
+static int _is_next_object(Evas_Object *target, Evas_Object *from)
+{
+ Evas_Coord y1, y2;
+
+ if (!target || !from) {
+ _ERR("Invalide argument");
+ return -1;
+ }
+
+ evas_object_geometry_get(target, NULL, &y1, NULL, NULL);
+ evas_object_geometry_get(from, NULL, &y2, NULL, NULL);
+
+ return y2 < y1;
+}
+
+static void _update_child_bars(struct _cbar_data *bar,
+ struct _cbar_item *item)
+{
+ struct _cbar_item *_item;
+ Eina_List *l;
+ Evas_Object *dbar, *_dbar;
+
+ if (!bar || !item) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ if (!item->dbar) {
+ elm_object_signal_emit(bar->ly,
+ SIG_HIDE_DBAR, SRC_PROG);
+ return;
+ }
+
+ if (item->dirty) {
+ if (item->dbar)
+ item->dbar->ops->update(item->dbar, item->it, NULL);
+ item->dirty = EINA_FALSE;
+ }
+
+ dbar = item->dbar->ops->get_object(item->dbar);
+
+ if (bar->cur != item)
+ return;
+
+ elm_object_part_content_unset(bar->ly, PART_DYNAMICBAR);
+
+ EINA_LIST_FOREACH(bar->list, l, _item) {
+ if (!_item->dbar)
+ continue;
+
+ if (_item == item) {
+ _item->dbar->ops->show(_item->dbar);
+ continue;
+ }
+
+ _dbar = _item->dbar->ops->get_object(_item->dbar);
+ _item->dbar->ops->hide(_item->dbar);
+ evas_object_stack_below(_dbar, bar->ly);
+ }
+
+ elm_object_part_content_set(bar->ly, PART_DYNAMICBAR, dbar);
+ elm_object_signal_emit(dbar, SIG_SHOW, SRC_PROG);
+ elm_object_signal_emit(bar->ly, SIG_SHOW_DBAR, SRC_PROG);
+}
+
+static void _updated(struct engine_bar_item *it, void *data)
+{
+ struct _cbar_item *item;
+
+ if (!it || !data) {
+ _ERR("invalid argument");
+ return;
+ }
+
+ item = data;
+
+ if (item->bar->state == CBAR_STATE_HIDE)
+ return;
+
+ item->dirty = EINA_TRUE;
+ item->bar->state = CBAR_STATE_CBAR;
+ _update_child_bars(item->bar, item);
+
+ if (item->bar->cur == item)
+ elm_object_focus_set(item->eo, EINA_TRUE);
+}
+
+static int _get_effect_direction(Evas_Object *target, Evas_Object *from)
+{
+ Evas_Coord x1, y1, x2, y2;
+
+ evas_object_geometry_get(target, &x1, &y1, NULL, NULL);
+ evas_object_geometry_get(from, &x2, &y2, NULL, NULL);
+
+ if (y2 == y1) {
+ if (x1 > x2)
+ return BAR_DIR_RIGHT;
+ else
+ return BAR_DIR_LEFT;
+ } else if (y2 < y1) {
+ return BAR_DIR_DOWN;
+ } else {
+ return BAR_DIR_UP;
+ }
+}
+
+static void _set_effect(Evas_Object *target, Evas_Object *from, int dir)
+{
+ const char *t_sig, *f_sig;
+
+ switch (dir) {
+ case BAR_DIR_RIGHT:
+ t_sig = SIG_FOCUS_FROM_LEFT;
+ f_sig = SIG_UNFOCUS_TO_RIGHT;
+ break;
+ case BAR_DIR_LEFT:
+ t_sig = SIG_FOCUS_FROM_RIGHT;
+ f_sig = SIG_UNFOCUS_TO_LEFT;
+ break;
+ case BAR_DIR_UP:
+ t_sig = SIG_FOCUS_FROM_DOWN;
+ f_sig = SIG_UNFOCUS_TO_UP;
+ break;
+ case BAR_DIR_DOWN:
+ t_sig = SIG_FOCUS_FROM_UP;
+ f_sig = SIG_UNFOCUS_TO_DOWN;
+ break;
+ default:
+ return;
+ }
+
+ elm_object_signal_emit(target, t_sig, SRC_PROG);
+ elm_object_signal_emit(from, f_sig, SRC_PROG);
+}
+
+static inline Evas_Object *_get_item_object(struct bar_info *bar)
+{
+ if (!bar)
+ return NULL;
+
+ return bar->ops->get_item(bar);
+}
+
+static void _focused(void *data, Evas_Object *obj, void *ei)
+{
+ struct _cbar_item *foc;
+ struct _cbar_item *cur;
+ struct _cbar_data *bar;
+ Evas_Object *eo;
+ int next;
+
+ if (!data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ foc = data;
+ bar = foc->bar;
+ cur = bar->cur;
+
+ switch (bar->state) {
+ case CBAR_STATE_DBAR:
+ if (!cur) {
+ elm_object_signal_emit(foc->eo,
+ SIG_INITIAL_FOCUS, SRC_PROG);
+ } else {
+ elm_object_signal_emit(foc->eo, SIG_FOCUS, SRC_PROG);
+ if (cur != foc) {
+ elm_object_signal_emit(cur->eo,
+ SIG_HIDE, SRC_PROG);
+ }
+
+ eo = _get_item_object(cur->dbar);
+ if (eo) {
+ elm_object_signal_emit(eo,
+ SIG_UNFOCUS_TO_HBAR, SRC_PROG);
+ if (cur != foc)
+ cur->dbar->ops->hide(cur->dbar);
+ }
+ }
+
+ break;
+ case CBAR_STATE_CBAR:
+ if (!cur) {
+ elm_object_signal_emit(foc->eo,
+ SIG_INITIAL_FOCUS, SRC_PROG);
+ } else if (cur == foc) {
+ elm_object_signal_emit(foc->eo,
+ SIG_FOCUS, SRC_PROG);
+ } else {
+ next = _is_next_object(foc->eo, cur->eo);
+ if (next < 0)
+ break;
+
+ elm_object_signal_emit(foc->eo,
+ next ? SIG_FOCUS_FROM_UP :
+ SIG_FOCUS_FROM_DOWN,
+ SRC_PROG);
+ elm_object_signal_emit(cur->eo,
+ next ? SIG_UNFOCUS_TO_DOWN :
+ SIG_UNFOCUS_TO_UP,
+ SRC_PROG);
+
+ if (cur->dbar)
+ cur->dbar->ops->hide(cur->dbar);
+ }
+ break;
+ case CBAR_STATE_EDIT:
+ elm_object_signal_emit(foc->eo, SIG_FOCUS, SRC_PROG);
+ return;
+ case CBAR_STATE_X:
+ return;
+ case CBAR_STATE_HIDE:
+ elm_object_signal_emit(foc->eo, SIG_INITIAL_FOCUS, SRC_PROG);
+ break;
+ }
+
+ bar->cur = foc;
+ bar->state = CBAR_STATE_CBAR;
+
+ _update_child_bars(bar, foc);
+}
+
+static Eina_Bool _dbar_focused(void *data, Evas_Object *foc)
+{
+ struct _cbar_data *bar;
+ struct bar_info *dbar;
+ Evas_Object *cur;
+ int dir;
+ Eina_Bool r;
+
+ if (!data || !foc) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ r = EINA_FALSE;
+ bar = data;
+
+ if (!bar) {
+ _ERR("bar is NULL");
+ return EINA_FALSE;
+ }
+
+ dbar = bar->cur->dbar;
+
+ cur = _get_item_object(dbar);
+ if (!cur)
+ return EINA_FALSE;
+
+ switch (bar->state) {
+ case CBAR_STATE_CBAR:
+ case CBAR_STATE_HIDE:
+ elm_object_signal_emit(foc, SIG_INITIAL_FOCUS, SRC_PROG);
+ elm_object_signal_emit(bar->cur->eo,
+ SIG_UNFOCUS_TO_DBAR, SRC_PROG);
+ r = EINA_TRUE;
+ break;
+ case CBAR_STATE_DBAR:
+ if (cur != foc) {
+ dir = _get_effect_direction(foc, cur);
+ _set_effect(foc, cur, dir);
+ }
+ r = EINA_TRUE;
+ break;
+ default:
+ break;
+ }
+
+ bar->state = CBAR_STATE_DBAR;
+
+ return r;
+}
+
+static void _mouse_down(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ struct _cbar_data *bar;
+ struct _cbar_item *item;
+ Evas_Event_Mouse_Up *ev;
+ Evas_Coord x, y, w, h;
+
+ if (!data || !ei)
+ return;
+
+ ev = ei;
+ item = data;
+ bar = item->bar;
+
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
+
+ if (ev->canvas.x < x || ev->canvas.x > x + w ||
+ ev->canvas.y < y || ev->canvas.y > y + h)
+ return;
+
+ switch (bar->state) {
+ case CBAR_STATE_CBAR:
+ if (!bar->key_timer)
+ bar->key_timer = ecore_timer_add(KEY_LONG_DUR,
+ _long_key_cb, bar);
+ break;
+ case CBAR_STATE_EDIT:
+ _change_cbar_mode(bar);
+ break;
+ default:
+ return;
+ }
+}
+
+static void _mouse_up(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ struct _cbar_item *item;
+ struct _cbar_data *bar;
+
+ if (!data || !ei)
+ return;
+
+ item = data;
+ bar = item->bar;
+
+ if (!bar->key_timer)
+ return;
+
+ ecore_timer_del(bar->key_timer);
+ bar->key_timer = NULL;
+
+ if (bar->state == CBAR_STATE_CBAR)
+ engine_bar_item_launch(item->it);
+}
+
+static void _lbl_start_slide(void *data, Evas_Object *obj, void *ei)
+{
+ elm_label_ellipsis_set(data, EINA_FALSE);
+ elm_label_slide_mode_set(data, ELM_LABEL_SLIDE_MODE_AUTO);
+ elm_label_slide_go(data);
+}
+
+static void _lbl_stop_slide(void *data, Evas_Object *obj, void *ei)
+{
+ elm_label_ellipsis_set(data, EINA_TRUE);
+ elm_label_slide_mode_set(data, ELM_LABEL_SLIDE_MODE_NONE);
+ elm_label_slide_go(data);
+}
+
+static Evas_Object *_add_label(Evas_Object *ly, const char *name)
+{
+ Evas_Object *lbl;
+ const char *s;
+
+ if (!ly || !name) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ lbl = elm_label_add(ly);
+ if (!lbl) {
+ _ERR("failed to add label");
+ return NULL;
+ }
+ elm_object_style_set(lbl, STYLE_LABEL_SLIDE_CENTER);
+ s = edje_object_data_get(elm_layout_edje_get(ly),
+ DATA_TITLE_WIDTH);
+ if (s)
+ elm_label_wrap_width_set(lbl, atoi(s));
+ else
+ _ERR("No title width exist");
+
+ elm_object_text_set(lbl, name);
+ elm_label_slide_speed_set(lbl, LABEL_SLIDE_SPEED);
+ evas_object_smart_callback_add(ly, "focused", _lbl_start_slide, lbl);
+ evas_object_smart_callback_add(ly, "unfocused", _lbl_stop_slide, lbl);
+
+ return lbl;
+}
+
+static Evas_Object *_new_cbar_item(Evas_Object *p,
+ struct _cbar_item *item, struct engine_bar_item *it)
+{
+ Evas_Object *ly, *eo, *lbl, *ic;
+
+ if (!p || !it || !item) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ ly = elm_layout_add(p);
+ if (!ly) {
+ _ERR("layout add failed");
+ return NULL;
+ }
+
+ elm_layout_file_set(ly, EDJEFILE, GRP_HOMEBAR_ITEM);
+ eo = _add_cbar_item_bg(ly, it);
+ if (!eo)
+ goto err;
+ elm_object_part_content_set(ly, PART_BG, eo);
+
+ eo = _add_cbar_item_bg(ly, it);
+ if (!eo)
+ goto err;
+ elm_object_part_content_set(ly, PART_BG2, eo);
+
+ ic = _add_icon(ly, engine_bar_item_get_icon(it));
+ if (!ic)
+ goto err;
+ elm_object_part_content_set(ly, PART_ICON, ic);
+
+ eo = _add_icon(ly, engine_bar_item_get_icon_focus(it));
+ if (!eo)
+ goto err;
+ elm_object_part_content_set(ly, PART_ICON_FOCUS, eo);
+
+ lbl = _add_label(ly, _trim((char *)engine_bar_item_get_name(it)));
+ if (!lbl)
+ goto err;
+ elm_object_part_content_set(ly, PART_NAME, lbl);
+
+ evas_object_show(ly);
+ elm_object_focus_allow_set(ly, EINA_TRUE);
+
+ evas_object_event_callback_add(ly,
+ EVAS_CALLBACK_MOUSE_MOVE, _mouse_over, item);
+ evas_object_event_callback_add(ly,
+ EVAS_CALLBACK_MOUSE_UP, _mouse_up, item);
+ evas_object_event_callback_add(ly,
+ EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, item);
+ evas_object_smart_callback_add(ly, "focused", _focused, item);
+
+ item->lbl = lbl;
+ item->ic = ic;
+
+ return ly;
+err:
+ evas_object_del(ly);
+ return NULL;
+}
+
+static int _init_child_bar(struct _cbar_item *item)
+{
+ struct bar_info *dbar;
+ int r;
+
+ dbar = calloc(1, sizeof(*dbar));
+ if (!dbar)
+ goto err;
+
+ dbar->cb.func = _dbar_focused;
+ dbar->cb.data = item->bar;
+
+ r = init_dynamic_bar(dbar);
+ if (r < 0)
+ goto dbar_err;
+
+ item->dbar = dbar;
+
+ return 0;
+
+dbar_err:
+ free(dbar);
+ dbar = NULL;
+err:
+ return -1;
+}
+
+static struct _cbar_item *_pack_item(struct _cbar_data *bar,
+ struct engine_bar_item *it)
+{
+ Evas_Object *base;
+ struct _cbar_item *item;
+ int r;
+
+ if (!bar || !it)
+ return NULL;
+
+ item = calloc(1, sizeof(*item));
+ if (!item) {
+ _ERR("calloc failed");
+ return NULL;
+ }
+
+ base = _new_cbar_item(bar->bx, item, it);
+ if (!base) {
+ free(item);
+ return NULL;
+ }
+
+ elm_box_pack_end(bar->bx, base);
+
+ item->eo = base;
+ item->bar = bar;
+ item->it = it;
+
+ if (engine_bar_item_get_is_pinned(it)) {
+ item->dirty = EINA_FALSE;
+ return item;
+ }
+
+ r = _init_child_bar(item);
+ if (r < 0)
+ goto err;
+
+ r = item->dbar->ops->add_bar(item->dbar, bar->ly);
+ if (r < 0)
+ item->dbar->ops->release(item->dbar);
+
+ item->dirty = EINA_TRUE;
+
+ return item;
+
+err:
+ evas_object_del(base);
+ free(item);
+
+ return NULL;
+}
+
+static void _update_pin(void *data, bool focus)
+{
+ struct bar_info *info;
+ struct _cbar_data *bar;
+ struct _cbar_item *item;
+
+ if (!data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ info = data;
+ bar = info->data;
+
+ if (bar->eng)
+ _update(info, bar->eng, NULL);
+
+ item = bar->cur;
+ if (!item) {
+ item = eina_list_data_get(bar->list);
+ bar->cur = item;
+ }
+
+ if (focus)
+ elm_object_focus_set(item->eo, EINA_TRUE);
+}
+
+static int _update(struct bar_info *info, void *eng, void *data)
+{
+ struct _cbar_data *bar;
+ const Eina_List *list;
+ Eina_List *l;
+ struct engine_bar_item *it;
+ struct _cbar_item *item;
+ int cnt, r;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ bar = info->data;
+
+ EINA_LIST_FREE(bar->list, item) {
+ engine_bar_item_set_update_cb(item->it, NULL, NULL);
+ engine_bar_item_set_pin_update_cb(eng, NULL, NULL);
+ evas_object_del(item->eo);
+ if (item->dbar)
+ item->dbar->ops->release(item->dbar);
+ free(item);
+ }
+ bar->cur = NULL;
+ bar->list = NULL;
+
+ cnt = 0;
+ list = engine_get_bar_items(eng);
+ if (!list)
+ return cnt;
+
+ EINA_LIST_FOREACH((Eina_List *)list, l, it) {
+ r = strcmp(engine_bar_item_get_in(it), "custombar");
+ if (r != 0)
+ continue;
+
+ item = _pack_item(bar, it);
+ if (!item)
+ continue;
+
+ bar->list = eina_list_append(bar->list, item);
+ engine_bar_item_set_update_cb(item->it, _updated, item);
+ cnt++;
+ }
+ engine_bar_item_set_pin_update_cb(eng, _update_pin, info);
+ bar->eng = eng;
+
+ return cnt;
+}
+
+static Evas_Object *_add_pin(Evas_Object *p)
+{
+ Evas_Object *ly;
+
+ if (!p) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ ly = elm_layout_add(p);
+ if (!ly) {
+ _ERR("layout add failed");
+ return NULL;
+ }
+ elm_layout_file_set(ly, EDJEFILE, GRP_PIN);
+ elm_object_part_content_set(p, PART_USER, ly);
+ evas_object_show(ly);
+
+ return ly;
+}
+
+static void _scroll_cb(void *data, Evas_Object *obj,
+ const char *emission, const char *source)
+{
+ struct _cbar_data *bar;
+
+ if (!data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ bar = data;
+
+ if (bar->state != CBAR_STATE_EDIT)
+ return;
+
+ _change_edit_mode(bar);
+}
+
+static int _add_bar(struct bar_info *info, Evas_Object *base)
+{
+ Evas_Object *scr, *bx, *pin;
+ struct _cbar_data *bar;
+
+ if (!base || !info || !info->data) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ bar = info->data;
+
+ pin = _add_pin(base);
+ if (!pin) {
+ _ERR("pin add failed");
+ return -1;
+ }
+
+ scr = elm_scroller_add(pin);
+ if (!scr) {
+ _ERR("scroller add failed");
+ evas_object_del(pin);
+ return -1;
+ }
+ elm_scroller_policy_set(scr, ELM_SCROLLER_POLICY_OFF,
+ ELM_SCROLLER_POLICY_OFF);
+ elm_object_signal_callback_add(scr, SIG_SCROLL_DOWN, SRC_ELM,
+ _scroll_cb, bar);
+ elm_object_signal_callback_add(scr, SIG_SCROLL_UP, SRC_ELM,
+ _scroll_cb, bar);
+
+
+ bx = elm_box_add(scr);
+ if (!bx) {
+ _ERR("box add failed");
+ evas_object_del(scr);
+ return -1;
+ }
+ evas_object_show(bx);
+ elm_object_content_set(scr, bx);
+
+ elm_object_part_content_set(base, PART_HOMEBAR, scr);
+
+ bar->ly = base;
+ bar->pin = pin;
+ bar->bx = bx;
+ bar->scr = scr;
+ bar->cbar = info;
+
+ return 0;
+}
+
+static void _release(struct bar_info *info)
+{
+ struct _cbar_data *bar;
+ struct _cbar_item *item;
+
+ if (!info) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ bar = info->data;
+
+ _hide(info);
+
+ if (bar) {
+ EINA_LIST_FREE(bar->list, item) {
+ engine_bar_item_set_update_cb(item->it, NULL, NULL);
+ evas_object_del(item->eo);
+ if (item->dbar)
+ item->dbar->ops->release(item->dbar);
+ free(item);
+ }
+ engine_bar_item_set_pin_update_cb(bar->eng, NULL, NULL);
+ evas_object_del(bar->pin);
+ free(bar);
+ bar = NULL;
+ }
+
+ free(info);
+ info = NULL;
+}
+
+static struct bar_ops cbar_ops = {
+ .add_bar = _add_bar,
+ .update = _update,
+ .show = _show,
+ .hide = _hide,
+ .move = _move,
+ .key_down = _key_down,
+ .key_up = _key_up,
+ .release = _release,
+};
+
+int init_custom_bar(struct bar_info *info)
+{
+ struct _cbar_data *bar;
+
+ if (!info)
+ return -1;
+
+ bar = calloc(1, sizeof(*bar));
+ if (!bar) {
+ _ERR("calloc failed");
+ return -1;
+ }
+
+ info->data = bar;
+ info->ops = &cbar_ops;
+
+ bar->state = CBAR_STATE_HIDE;
+
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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 <utilX.h>
+#include <ctype.h>
+#include <string.h>
+
+#include "i18n.h"
+#include "bar.h"
+#include "engine.h"
+#include "defs.h"
+#include "dbg.h"
+
+#define STYLE_TITLE "title"
+#define STYLE_VIDEO "video"
+#define STYLE_AUDIO "audio"
+#define STYLE_ALBUM "album"
+#define STYLE_COMMON "common"
+
+#define DEFAULT_TITLE "No Information"
+#define UNKNOWN_DEVICE "Unknown device"
+#define MESSAGE_DELETE "Are you sure you want to delete the"
+#define MESSAGE_HISTORY_BANNER "Your history has been cleared"
+#define KEY_DBAR_ITEM "dbar.item"
+#define ICON_PIN "pin"
+#define ICON_LOCK "lock"
+
+#define ASPECT_RATIO ((double)198 / (double)(166))
+#define LABEL_BUFMAX 512
+#define DBAR_PADDING 10
+#define FUNCS_PADDING 3
+#define BUF_DELIMITER 2
+#define BUF_STRING 128
+
+#define IMG_FUNCS_FAVORITE IMAGEDIR"/ico_favorite_channel_nor.png"
+#define IMG_FUNCS_PIN IMAGEDIR"/ico_pin_channel_nor.png"
+#define IMG_FUNCS_LOCK IMAGEDIR"/ico_locked_channel_nor.png"
+
+enum _dbar_state {
+ DBAR_STATE_HIDE,
+ DBAR_STATE_DBAR,
+ DBAR_STATE_XBAR
+};
+
+struct _dbar_item;
+
+struct _dbar_data {
+ Evas_Object *base;
+ Evas_Object *ly;
+ Evas_Object *scr;
+ Evas_Object *tbl;
+ Eina_List *list;
+ struct _dbar_item *cur;
+ struct bar_cb focus_cb;
+ int tbl_idx;
+ int content_column;
+
+ enum _dbar_state state;
+};
+
+struct _dbar_item {
+ Evas_Object *eo;
+ struct engine_dbar_item *it;
+ struct _dbar_data *bar;
+ struct bar_info *xbar;
+ Eina_Bool focus;
+};
+
+struct _dbar_item_loader {
+ enum engine_dbar_item_style style;
+ Evas_Object *(*loader)(Evas_Object *p, struct engine_dbar_item *it,
+ Eina_Bool *fill);
+};
+
+static void _bring_in_middle(Evas_Object *scr, Evas_Object *obj)
+{
+ Evas_Coord y, h, sy, sh, rx, ry, rw, rh, my, smy, ch;
+
+ if (!scr || !obj)
+ return;
+
+ evas_object_geometry_get(obj, NULL, &y, NULL, &h);
+ evas_object_geometry_get(scr, NULL, &sy, NULL, &sh);
+ elm_scroller_region_get(scr, &rx, &ry, &rw, &rh);
+ elm_scroller_child_size_get(scr, NULL, &ch);
+
+ my = y + (h >> 1);
+ smy = sy + (sh >> 1);
+
+ ry = ry - smy + my;
+
+ if (ry < 0)
+ ry = 0;
+ else if (ry + rh > ch)
+ ry = ch - rh;
+
+ elm_scroller_region_bring_in(scr, rx, ry, rw, rh);
+}
+
+static void _focused(void *data, Evas_Object *obj, void *ei)
+{
+ struct _dbar_item *foc;
+ struct _dbar_data *bar;
+ Eina_Bool r;
+ Evas_Object *eo;
+
+ if (!data)
+ return;
+
+ foc = data;
+ bar = foc->bar;
+
+ if (!foc->xbar) {
+ r = bar->focus_cb.func(bar->focus_cb.data, foc->eo);
+ if (r)
+ _bring_in_middle(bar->scr, foc->eo);
+
+ bar->cur = foc;
+ bar->state = DBAR_STATE_DBAR;
+
+ return;
+ }
+
+ switch (bar->state) {
+ case DBAR_STATE_XBAR:
+ eo = bar->cur->xbar->ops->get_object(bar->cur->xbar);
+ if (eo)
+ elm_object_signal_emit(eo, SIG_UNFOCUS_TO_DBAR,
+ SRC_PROG);
+ elm_object_signal_emit(foc->eo, SIG_UNFOCUS_FROM_XBAR,
+ SRC_PROG);
+
+ if (foc != bar->cur) {
+ elm_object_signal_emit(bar->cur->eo, SIG_HIDE,
+ SRC_PROG);
+ bar->cur->xbar->ops->hide(bar->cur->xbar);
+ foc->xbar->ops->update(foc->xbar, foc->it, foc->eo);
+ foc->xbar->ops->show(foc->xbar);
+ }
+ break;
+ case DBAR_STATE_HIDE:
+ eo = foc->xbar->ops->get_object(foc->xbar);
+ if (eo)
+ elm_object_signal_emit(eo, SIG_SHOW, SRC_PROG);
+ r = bar->focus_cb.func(bar->focus_cb.data, foc->eo);
+ if (r)
+ _bring_in_middle(bar->scr, foc->eo);
+
+ foc->xbar->ops->update(foc->xbar, foc->it, foc->eo);
+ break;
+ case DBAR_STATE_DBAR:
+ eo = foc->xbar->ops->get_object(foc->xbar);
+ if (eo)
+ elm_object_signal_emit(eo, SIG_SHOW, SRC_PROG);
+
+ r = bar->focus_cb.func(bar->focus_cb.data, foc->eo);
+ if (r)
+ _bring_in_middle(bar->scr, foc->eo);
+
+ if (foc != bar->cur && bar->cur->xbar)
+ bar->cur->xbar->ops->hide(bar->cur->xbar);
+
+ foc->xbar->ops->update(foc->xbar, foc->it, foc->eo);
+
+ break;
+ default:
+ return;
+ }
+
+ bar->cur = foc;
+ bar->state = DBAR_STATE_DBAR;
+}
+
+static void _mouse_over(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ struct _dbar_item *item;
+
+ if (!data) {
+ _ERR("Invalide argument");
+ return;
+ }
+
+ item = data;
+
+ if (elm_object_focus_get(item->eo))
+ return;
+
+ elm_object_focus_set(item->eo, EINA_TRUE);
+}
+
+static void _clicked(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ struct _dbar_item *item;
+ Evas_Event_Mouse_Up *ev;
+ Evas_Coord x, y, w, h;
+
+ if (!data || !ei)
+ return;
+
+ ev = ei;
+
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
+ if (ev->canvas.x < x || ev->canvas.x > x + w ||
+ ev->canvas.y < y || ev->canvas.y > y + h)
+ return;
+
+ item = data;
+ engine_dbar_item_launch(item->it);
+}
+
+static int _launch_app(struct bar_info *info)
+{
+ struct _dbar_data *bar;
+ struct _dbar_item *item;
+
+ if (!info)
+ return EINA_FALSE;
+
+ bar = info->data;
+ item = bar->cur;
+
+ if (!item) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ return engine_dbar_item_launch(item->it);
+}
+
+static inline Evas_Object *_load_bg(Evas_Object *base,
+ struct engine_dbar_item *it)
+{
+ Evas_Object *bg;
+ int r, g, b;
+
+ if (!base || !it)
+ return NULL;
+
+ bg = evas_object_rectangle_add(evas_object_evas_get(base));
+ if (!bg) {
+ _ERR("bg add failed");
+ return NULL;
+ }
+
+ r = 128;
+ g = 128;
+ b = 128;
+ engine_dbar_item_get_color(it, &r, &g, &b);
+ evas_object_color_set(bg, r, g, b, 255);
+
+ return bg;
+}
+
+static Evas_Object *_load_title(Evas_Object *p, struct engine_dbar_item *it,
+ Eina_Bool *fill)
+{
+ Evas_Object *ly;
+ const char *name;
+
+ if (!p || !it)
+ return NULL;
+
+ name = engine_dbar_item_get_name(it);
+ if (!name)
+ name = "";
+
+ ly = elm_layout_add(p);
+ if (!ly) {
+ _ERR("layout add failed");
+ return NULL;
+ }
+
+ elm_layout_file_set(ly, EDJEFILE, GRP_DBAR_LABEL);
+ elm_object_part_text_set(ly, PART_TITLE,
+ engine_dbar_item_get_name(it));
+ if (fill)
+ *fill = EINA_TRUE;
+
+ return ly;
+}
+
+static Evas_Object *_load_ly(Evas_Object *p,
+ struct engine_dbar_item *it,
+ const char *group)
+{
+ Evas_Object *ly;
+ Evas_Object *bg;
+
+ if (!p || !it || !group)
+ return NULL;
+
+ ly = elm_layout_add(p);
+ if (!ly) {
+ _ERR("layout add failed");
+ return NULL;
+ }
+ elm_layout_file_set(ly, EDJEFILE, group);
+
+ bg = _load_bg(ly, it);
+ if (!bg) {
+ evas_object_del(ly);
+ return NULL;
+ }
+ elm_object_part_content_set(ly, PART_BG, bg);
+
+ return ly;
+}
+
+static const char *_trim(char *str)
+{
+ int i;
+
+ if (!str)
+ return str;
+
+ i = strlen(str);
+ i--;
+
+ while (i > 0) {
+ if (isspace(str[i]))
+ str[i] = '\0';
+ else
+ break;
+ i++;
+ }
+
+ return str;
+}
+
+static void _put_icon(Evas_Object *ly, const char *file, const char *part,
+ const char *def_sig, const char *def_src,
+ Eina_Bool make_thumbnail)
+{
+ Evas_Object *ic;
+
+ if (file && strlen(file) > 0) {
+ ic = elm_icon_add(ly);
+ if (ic) {
+ if (make_thumbnail) {
+ elm_need_ethumb();
+ elm_icon_thumb_set(ic, file, NULL);
+ } else {
+ elm_image_file_set(ic, file, NULL);
+ }
+ elm_image_fill_outside_set(ic, EINA_TRUE);
+ elm_object_part_content_set(ly, part, ic);
+ return;
+ }
+ _ERR("icon add failed");
+ }
+
+ elm_object_signal_emit(ly, def_sig, def_src);
+}
+
+static void _lbl_start_slide(void *data, Evas_Object *obj, void *ei)
+{
+ elm_label_ellipsis_set(data, EINA_FALSE);
+ elm_label_slide_mode_set(data, ELM_LABEL_SLIDE_MODE_AUTO);
+ elm_label_slide_go(data);
+}
+
+static void _lbl_stop_slide(void *data, Evas_Object *obj, void *ei)
+{
+ elm_label_ellipsis_set(data, EINA_TRUE);
+ elm_label_slide_mode_set(data, ELM_LABEL_SLIDE_MODE_NONE);
+ elm_label_slide_go(data);
+}
+
+static Evas_Object *_add_icon(Evas_Object *box, const char *file)
+{
+ Evas_Object *ic;
+
+ if (!box || !file) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ ic = elm_icon_add(box);
+ if (!ic) {
+ _ERR("icon add failed");
+ return NULL;
+ }
+
+ elm_image_file_set(ic, file, NULL);
+ elm_image_no_scale_set(ic, EINA_TRUE);
+ evas_object_show(ic);
+
+ elm_box_pack_end(box, ic);
+
+ return ic;
+}
+
+static void _load_funcs(const char *icon, Evas_Object *p)
+{
+ Evas_Object *box, *ic;
+ int padding;
+ char delimiter[BUF_DELIMITER] = ",";
+ char *iter;
+ char str[BUF_STRING];
+ bool lock, pin;
+
+ if (!icon || !p) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ padding = elm_config_scale_get() * FUNCS_PADDING;
+ box = elm_box_add(p);
+ if (!box) {
+ _ERR("box add failed");
+ return;
+ }
+ elm_object_part_content_set(p, PART_FUNCS, box);
+ elm_box_padding_set(box, padding, padding);
+ elm_box_horizontal_set(box, EINA_TRUE);
+
+ strcpy(str, icon);
+
+ iter = NULL;
+ lock = false;
+ pin = false;
+
+ iter = strtok(str, delimiter);
+ while (iter) {
+ if (!strcmp(iter, ICON_PIN))
+ pin = true;
+ else if (!strcmp(iter, ICON_LOCK))
+ lock = true;
+
+ iter = strtok(NULL, delimiter);
+ }
+
+ if (pin) {
+ ic = _add_icon(box, IMG_FUNCS_PIN);
+ if (!ic) {
+ _ERR("icon add failed");
+ evas_object_del(box);
+ return;
+ }
+ }
+
+ if (lock) {
+ ic = _add_icon(box, IMG_FUNCS_LOCK);
+ if (!ic) {
+ _ERR("icon add failed");
+ evas_object_del(box);
+ return;
+ }
+ }
+}
+
+static Evas_Object *_add_label(Evas_Object *ly,
+ const char *style, const char *name)
+{
+ Evas_Object *lbl;
+
+ if (!ly || !style || !name) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ lbl = elm_label_add(ly);
+ if (!lbl) {
+ _ERR("failed to create label");
+ return NULL;
+ }
+ elm_object_style_set(lbl, style);
+ elm_object_text_set(lbl, name);
+ evas_object_show(lbl);
+
+ return lbl;
+}
+
+static Evas_Object *_add_slide_label(Evas_Object *ly,
+ const char *name, const char *style)
+{
+ Evas_Object *lbl;
+ const char *s;
+
+ if (!ly || !name || !style) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ lbl = _add_label(ly, style, name);
+ if (!lbl) {
+ evas_object_del(ly);
+ return NULL;
+ }
+ elm_label_ellipsis_set(lbl, EINA_TRUE);
+ s = edje_object_data_get(elm_layout_edje_get(ly),
+ DATA_TITLE_WIDTH);
+ if (s)
+ elm_label_wrap_width_set(lbl, atoi(s));
+ else
+ _ERR("No title width exist");
+
+ elm_label_slide_speed_set(lbl, LABEL_SLIDE_SPEED);
+ evas_object_smart_callback_add(ly, "focused", _lbl_start_slide, lbl);
+ evas_object_smart_callback_add(ly, "unfocused", _lbl_stop_slide, lbl);
+
+ return lbl;
+}
+
+static Evas_Object *_load_content_broadcast(Evas_Object *p,
+ const char *style, struct engine_dbar_item_content *ctnt,
+ struct engine_dbar_item *it)
+{
+ Evas_Object *ly, *lbl;
+ const char *channel, *progname, *progtime, *icon;
+
+ if (!p || !style || !ctnt || !it) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ ly = _load_ly(p, it, style);
+ if (!ly)
+ return NULL;
+
+ channel = engine_dbar_item_get_content_subtitle(ctnt);
+ _trim((char *)channel);
+
+ progname = engine_dbar_item_get_content_description(ctnt);
+ _trim((char *)progname);
+
+ progtime = engine_dbar_item_get_content_detail(ctnt);
+ _trim((char *)progtime);
+
+ icon = engine_dbar_item_get_content_icon(ctnt);
+ if (icon && strlen(icon) != 0)
+ _load_funcs(_trim((char *)icon), ly);
+
+ lbl = _add_label(ly, STYLE_LABEL_SLIDE_CENTER_40,
+ _trim((char *)engine_dbar_item_get_name(it)));
+ if (!lbl)
+ goto err;
+ elm_object_part_content_set(ly, PART_NUMBER, lbl);
+
+ if (!progname || strlen(progname) <= 0) {
+ if (!channel || strlen(channel) <= 0)
+ channel = _(DEFAULT_TITLE);
+
+ lbl = _add_slide_label(ly, channel, STYLE_LABEL_SLIDE_LEFT_32);
+ if (!lbl)
+ goto err;
+ elm_object_part_content_set(ly, PART_PROGRAM, lbl);
+
+ return ly;
+ }
+
+ lbl = _add_slide_label(ly, progname, STYLE_LABEL_SLIDE_LEFT_32);
+ if (!lbl)
+ goto err;
+ elm_object_part_content_set(ly, PART_PROGRAM, lbl);
+
+ lbl = _add_label(ly, STYLE_LABEL_SLIDE_LEFT_20, channel);
+ if (!lbl)
+ goto err;
+ elm_object_part_content_set(ly, PART_CHANNEL, lbl);
+
+ lbl = _add_label(ly, STYLE_LABEL_SLIDE_LEFT_20, progtime);
+ if (!lbl)
+ goto err;
+ elm_object_part_content_set(ly, PART_DURATION, lbl);
+
+ return ly;
+err:
+ _ERR("failed to create label");
+ evas_object_del(ly);
+ return NULL;
+}
+
+static Evas_Object *_load_content_history(Evas_Object *p,
+ const char *style, struct engine_dbar_item_content *ctnt,
+ struct engine_dbar_item *it)
+{
+ Evas_Object *ly;
+ const char *name;
+ Evas_Object *bg;
+
+ ly = _load_ly(p, it, style);
+ if (!ly)
+ return NULL;
+
+ bg = _load_bg(ly, it);
+ if (!bg) {
+ evas_object_del(ly);
+ return NULL;
+ }
+ elm_object_part_content_set(ly, PART_BG2, bg);
+
+ name = engine_dbar_item_get_name(it);
+ _trim((char *)name);
+ if (!name || strlen(name) <= 0)
+ name = _(DEFAULT_TITLE);
+
+ _put_icon(ly, engine_dbar_item_get_content_icon(ctnt),
+ PART_ICON, SIG_SHOW_DEFAULT_ICON, SRC_PROG,
+ EINA_FALSE);
+
+ elm_object_part_text_set(ly, PART_TITLE, name);
+
+ return ly;
+}
+
+static Evas_Object *_load_content_common(Evas_Object *p,
+ const char *style, struct engine_dbar_item_content *ctnt,
+ struct engine_dbar_item *it)
+{
+ Evas_Object *ly;
+ const char *name;
+
+ ly = _load_ly(p, it, style);
+ if (!ly)
+ return NULL;
+
+ name = engine_dbar_item_get_name(it);
+ _trim((char *)name);
+ if (!name || strlen(name) <= 0)
+ name = _(DEFAULT_TITLE);
+
+ _put_icon(ly, engine_dbar_item_get_content_thumbnail(ctnt),
+ PART_THUMB, SIG_SHOW_DEFAULT_THUMB, SRC_PROG,
+ EINA_FALSE);
+ _put_icon(ly, engine_dbar_item_get_content_icon(ctnt),
+ PART_ICON, SIG_SHOW_DEFAULT_ICON, SRC_PROG,
+ EINA_FALSE);
+
+ elm_object_part_text_set(ly, PART_TITLE, name);
+ elm_object_part_text_set(ly, PART_SUBTITLE, _trim((char *)
+ engine_dbar_item_get_content_subtitle(ctnt)));
+
+ return ly;
+}
+
+static Evas_Object *_load_content_music(Evas_Object *p,
+ const char *style, struct engine_dbar_item_content *ctnt,
+ struct engine_dbar_item *it)
+{
+ Evas_Object *ly;
+ Evas_Object *lbl;
+ const char *name;
+
+ ly = _load_ly(p, it, style);
+ if (!ly)
+ return NULL;
+
+ name = engine_dbar_item_get_name(it);
+ _trim((char *)name);
+ if (!name || strlen(name) <= 0)
+ name = _(DEFAULT_TITLE);
+
+ _put_icon(ly, engine_dbar_item_get_content_thumbnail(ctnt),
+ PART_THUMB, SIG_SHOW_DEFAULT_THUMB, SRC_PROG,
+ EINA_TRUE);
+ _put_icon(ly, engine_dbar_item_get_content_icon(ctnt),
+ PART_ICON, SIG_SHOW_DEFAULT_ICON, SRC_PROG,
+ EINA_FALSE);
+
+ lbl = _add_slide_label(ly, name, STYLE_LABEL_SLIDE_LEFT);
+ if (!lbl) {
+ evas_object_del(ly);
+ return NULL;
+ }
+ elm_object_part_content_set(ly, PART_TITLE, lbl);
+
+ elm_object_part_text_set(ly, PART_SUBTITLE, _trim((char *)
+ engine_dbar_item_get_content_subtitle(ctnt)));
+
+ return ly;
+}
+
+static Evas_Object *_load_content_source(Evas_Object *p,
+ const char *style, struct engine_dbar_item_content *ctnt,
+ struct engine_dbar_item *it)
+{
+ Evas_Object *ly;
+ const char *name;
+
+ ly = _load_ly(p, it, style);
+ if (!ly)
+ return NULL;
+
+ _put_icon(ly, engine_dbar_item_get_content_thumbnail(ctnt),
+ PART_THUMB, SIG_SHOW_DEFAULT_THUMB, SRC_PROG,
+ EINA_FALSE);
+
+ name = engine_dbar_item_get_name(it);
+ _trim((char *)name);
+ if (!name || strlen(name) <= 0)
+ name = _(UNKNOWN_DEVICE);
+ elm_object_part_text_set(ly, PART_TITLE, name);
+ elm_object_part_text_set(ly, PART_SUBTITLE, _trim((char *)
+ engine_dbar_item_get_content_subtitle(ctnt)));
+
+ return ly;
+}
+
+static Evas_Object *_load_content_notification(Evas_Object *p,
+ const char *style, struct engine_dbar_item_content *ctnt,
+ struct engine_dbar_item *it)
+{
+ Evas_Object *ly;
+ const char *title, *subtitle, *icon, *description;
+ Evas_Object *bg;
+
+ icon = engine_dbar_item_get_content_icon(ctnt);
+ title = engine_dbar_item_get_name(it);
+ subtitle = engine_dbar_item_get_content_subtitle(ctnt);
+ description = engine_dbar_item_get_content_description(ctnt);
+
+ ly = _load_ly(p, it, GRP_DBAR_NOTIFICATION);
+ if (!ly)
+ return NULL;
+
+ bg = _load_bg(ly, it);
+ if (!bg) {
+ evas_object_del(ly);
+ return NULL;
+ }
+ elm_object_part_content_set(ly, PART_BG2, bg);
+
+ if (title)
+ elm_object_part_text_set(ly, PART_TITLE, title);
+
+ if (subtitle)
+ elm_object_part_text_set(ly, PART_SUBTITLE, subtitle);
+
+ if (description)
+ elm_object_part_text_set(ly, PART_DESCRIPTION, description);
+
+ if (icon)
+ _put_icon(ly, icon, PART_THUMB,
+ SIG_SHOW_DEFAULT_THUMB, SRC_PROG,
+ EINA_FALSE);
+
+ elm_object_focus_allow_set(ly, EINA_TRUE);
+
+ return ly;
+}
+
+static Evas_Object *_load_content(Evas_Object *p, struct engine_dbar_item *it,
+ Eina_Bool *fill)
+{
+ struct engine_dbar_item_content *ctnt;
+ const Eina_List *ctnts;
+ Evas_Object *eo;
+
+ ctnts = engine_dbar_item_get_contents(it);
+ if (!ctnts)
+ return NULL;
+
+ ctnt = eina_list_data_get(ctnts);
+ if (!ctnt)
+ return NULL;
+
+ eo = NULL;
+ switch (engine_dbar_item_get_content_type(ctnt)) {
+ case ENGINE_DBAR_CONTENT_TYPE_IMAGE:
+ case ENGINE_DBAR_CONTENT_TYPE_VIDEO:
+ eo = _load_content_common(p, GRP_DBAR_COMMON, ctnt, it);
+ if (eo && fill)
+ *fill = EINA_TRUE;
+ break;
+ case ENGINE_DBAR_CONTENT_TYPE_BROADCAST:
+ eo = _load_content_broadcast(p, GRP_DBAR_BROADCAST, ctnt, it);
+ if (eo && fill)
+ *fill = EINA_TRUE;
+ break;
+ case ENGINE_DBAR_CONTENT_TYPE_APP:
+ eo = _load_content_common(p, GRP_DBAR_APP, ctnt, it);
+ if (eo && fill)
+ *fill = EINA_TRUE;
+ break;
+ case ENGINE_DBAR_CONTENT_TYPE_MUSIC:
+ eo = _load_content_music(p, GRP_DBAR_MUSIC, ctnt, it);
+ if (eo && fill)
+ *fill = EINA_FALSE;
+ break;
+ case ENGINE_DBAR_CONTENT_TYPE_SOURCE:
+ eo = _load_content_source(p, GRP_DBAR_SOURCE, ctnt, it);
+ if (eo && fill)
+ *fill = EINA_FALSE;
+ break;
+ case ENGINE_DBAR_CONTENT_TYPE_NOTIFICATION_ONGOING:
+ case ENGINE_DBAR_CONTENT_TYPE_NOTIFICATION_NOTI:
+ eo = _load_content_notification(p, NULL, ctnt, it);
+ if (eo && fill)
+ *fill = EINA_TRUE;
+ break;
+ case ENGINE_DBAR_CONTENT_TYPE_HISTORY:
+ eo = _load_content_history(p, GRP_DBAR_HISTORY, ctnt, it);
+ if (eo && fill)
+ *fill = EINA_TRUE;
+ break;
+ default:
+ eo = _load_content_common(p, GRP_DBAR_COMMON, ctnt, it);
+ if (eo && fill)
+ *fill = EINA_TRUE;
+ break;
+ }
+
+ return eo;
+}
+
+static void _img_resized(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ Evas_Coord w, h;
+
+ evas_object_geometry_get(obj, NULL, NULL, &w, &h);
+ evas_object_image_fill_set(obj, 0, 0, w, h);
+}
+
+static Evas_Object *_load_album_thumb(Evas_Object *p, const Eina_List *ctnts)
+{
+ Evas_Object *ly;
+ Evas_Object *ic;
+ Eina_List *l;
+ int ctnt_cnt;
+ int i;
+ const char *thumb;
+ const char *sig;
+ const char * const parts[] = {
+ PART_THUMB_1,
+ PART_THUMB_2,
+ PART_THUMB_3,
+ PART_THUMB_4,
+ PART_THUMB_5,
+ PART_THUMB_6
+ };
+ const char * const sig_video[] = {
+ SIG_SHOW_THUMB1_VIDEO,
+ SIG_SHOW_THUMB2_VIDEO,
+ SIG_SHOW_THUMB3_VIDEO,
+ SIG_SHOW_THUMB4_VIDEO,
+ SIG_SHOW_THUMB5_VIDEO,
+ SIG_SHOW_THUMB6_VIDEO
+ };
+ struct engine_dbar_item_content *ctnt;
+
+ if (!p || !ctnts) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ ly = elm_layout_add(p);
+ if (!ly) {
+ _ERR("icon add failed");
+ return NULL;
+ }
+ elm_layout_file_set(ly, EDJEFILE, GRP_ALBUM_THUMB);
+
+ ctnt_cnt = eina_list_count(ctnts);
+ if (ctnt_cnt >= 6) {
+ ctnt_cnt = 6;
+ sig = SIG_THUMB_6;
+ } else if (ctnt_cnt >= 3) {
+ ctnt_cnt = 3;
+ sig = SIG_THUMB_3;
+ } else {
+ ctnt_cnt = 1;
+ sig = NULL;
+ }
+
+ l = (Eina_List *)ctnts;
+
+ /* TODO, show default photo/video icon */
+ for (i = 0; i < ctnt_cnt; i++) {
+ ctnt = eina_list_data_get(l);
+ thumb = engine_dbar_item_get_content_thumbnail(ctnt);
+ ic = evas_object_image_add(evas_object_evas_get(ly));
+ if (!ic) {
+ evas_object_del(ly);
+ return NULL;
+ }
+ evas_object_image_preload(ic, EINA_TRUE);
+ evas_object_image_file_set(ic, thumb, NULL);
+ evas_object_event_callback_add(ic, EVAS_CALLBACK_RESIZE,
+ _img_resized, NULL);
+ elm_object_part_content_set(ly, parts[i], ic);
+
+ if (engine_dbar_item_get_content_type(ctnt) ==
+ ENGINE_DBAR_CONTENT_TYPE_VIDEO)
+ elm_object_signal_emit(ly, sig_video[i], SRC_PROG);
+
+ l = eina_list_next(l);
+ if (!l)
+ break;
+ }
+
+ if (sig)
+ elm_object_signal_emit(ly, sig, SRC_PROG);
+
+ return ly;
+}
+
+static Evas_Object *_load_album(Evas_Object *p, struct engine_dbar_item *it,
+ Eina_Bool *fill)
+{
+ Evas_Object *ly;
+ Evas_Object *ly2;
+ const char *name;
+
+ ly = _load_ly(p, it, GRP_DBAR_ALBUM);
+ if (!ly)
+ return NULL;
+
+ name = engine_dbar_item_get_name(it);
+ if (!name)
+ name = "No Title";
+
+ ly2 = _load_album_thumb(ly, engine_dbar_item_get_contents(it));
+ if (!ly2) {
+ evas_object_del(ly);
+ return NULL;
+ }
+
+ elm_object_part_content_set(ly, PART_THUMB, ly2);
+ elm_object_part_text_set(ly, PART_TITLE, name);
+ if (fill)
+ *fill = EINA_TRUE;
+
+ return ly;
+}
+
+Evas_Object *_item_load(Evas_Object *p, struct engine_dbar_item *it,
+ Eina_Bool *fill, Eina_Bool *focus)
+{
+ static struct _dbar_item_loader loaders[] = {
+ {
+ .style = ENGINE_DBAR_ITEM_STYLE_CONTENT,
+ .loader = _load_content
+ },
+ {
+ .style = ENGINE_DBAR_ITEM_STYLE_LABEL,
+ .loader = _load_title
+ },
+ {
+ .style = ENGINE_DBAR_ITEM_STYLE_ALBUM,
+ .loader = _load_album
+ },
+ };
+ Evas_Object *eo;
+ enum engine_dbar_item_style style;
+ int i;
+
+ if (!it) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ style = engine_dbar_item_get_style(it);
+ if (style >= ENGINE_DBAR_ITEM_STYLE_MAX)
+ style = ENGINE_DBAR_ITEM_STYLE_CONTENT;
+
+ for (i = 0; i < sizeof(loaders) / sizeof(*loaders); i++) {
+ if (loaders[i].style == style) {
+ eo = loaders[i].loader(p, it, fill);
+ if (!eo)
+ return NULL;
+
+ if (style == ENGINE_DBAR_ITEM_STYLE_LABEL)
+ *focus = EINA_FALSE;
+ else
+ *focus = EINA_TRUE;
+
+ return eo;
+ }
+ }
+
+ _ERR("cannot find style: %d", style);
+
+ return NULL;
+}
+
+static int _add_bar(struct bar_info *info, Evas_Object *base)
+{
+ Evas_Object *ly, *scr, *tbl, *bx;
+ struct _dbar_data *bar;
+ int padding;
+
+ if (!base || !info || !info->data) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ bar = info->data;
+ padding = elm_config_scale_get() * DBAR_PADDING;
+
+ ly = elm_layout_add(base);
+ if (!ly) {
+ _ERR("layout add failed");
+ return -1;
+ }
+ elm_layout_file_set(ly, EDJEFILE, GRP_DBAR_ITEM);
+
+ scr = elm_scroller_add(ly);
+ if (!scr) {
+ _ERR("scroller add failed");
+ evas_object_del(ly);
+ return -1;
+ }
+ elm_scroller_policy_set(scr, ELM_SCROLLER_POLICY_OFF,
+ ELM_SCROLLER_POLICY_OFF);
+
+ bx = elm_box_add(scr);
+ if (!bx) {
+ _ERR("box add failed");
+ evas_object_del(ly);
+ return -1;
+ }
+
+ tbl = elm_table_add(bx);
+ if (!tbl) {
+ _ERR("table add failed");
+ evas_object_del(ly);
+ return -1;
+ }
+
+ evas_object_size_hint_align_set(tbl, 0.5, 0.0);
+ evas_object_size_hint_weight_set(tbl, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ elm_table_homogeneous_set(tbl, EINA_FALSE);
+ elm_table_padding_set(tbl, padding, padding);
+
+ evas_object_show(tbl);
+ evas_object_show(bx);
+ elm_box_pack_end(bx, tbl);
+ elm_object_content_set(scr, bx);
+ elm_object_part_content_set(ly, PART_CONTENT, scr);
+
+ bar->base = base;
+ bar->ly = ly;
+ bar->scr = scr;
+ bar->tbl = tbl;
+
+ return 0;
+}
+
+static inline int _get_dbar_row_col(struct _dbar_data *bar,
+ Eina_Bool fill, int *row, int *col)
+{
+ int r;
+
+ if (!bar || !row || !col || bar->content_column <= 0)
+ return -1;
+
+ *row = bar->tbl_idx / bar->content_column;
+ *col = bar->tbl_idx % bar->content_column;
+
+ if (!fill)
+ return 1;
+
+ if (bar->content_column > 1 && *col > 0) {
+ *col = 0;
+ *row = *row + 1;
+ }
+ r = bar->content_column - *col;
+
+ return r;
+}
+
+static Eina_Bool _xbar_focused(void *data, Evas_Object *foc)
+{
+ struct _dbar_data *bar;
+ struct _dbar_item *cur;
+
+ if (!data || !foc) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ bar = data;
+ if (!bar->cur) {
+ _ERR("There is no dbar item");
+ return EINA_FALSE;
+ }
+ cur = bar->cur;
+
+ switch (bar->state) {
+ case DBAR_STATE_DBAR:
+ elm_object_signal_emit(foc, SIG_INITIAL_FOCUS, SRC_PROG);
+ elm_object_signal_emit(cur->eo, SIG_UNFOCUS_TO_XBAR,
+ SRC_PROG);
+ break;
+ default:
+ return EINA_FALSE;
+ }
+
+ bar->state = DBAR_STATE_XBAR;
+
+ return EINA_TRUE;
+}
+
+static int _init_child_bars(struct _dbar_item *item)
+{
+ struct bar_info *xbar;
+ int r;
+
+ if (!item) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ xbar = calloc(1, sizeof(*xbar));
+ if (!xbar) {
+ _ERR("failed to calloc xbar");
+ return -1;
+ }
+
+ xbar->cb.func = _xbar_focused;
+ xbar->cb.data = item->bar;
+
+ r = init_delete_bar(xbar);
+ if (r < 0) {
+ free(xbar);
+ return -1;
+ }
+
+ item->xbar = xbar;
+
+ return 0;
+}
+
+static void _unfocused(void *data, Evas_Object *obj, const char *emission,
+ const char *source)
+{
+ struct _dbar_item *cur;
+ struct _dbar_data *bar;
+
+ if (!data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ cur = data;
+ bar = cur->bar;
+
+ bar->state = DBAR_STATE_HIDE;
+
+ if (!cur->xbar)
+ return;
+
+ cur->xbar->ops->hide(cur->xbar);
+}
+
+static void _cancel_delete_popup(void *data, Evas_Object *obj,
+ const char *emission, const char *source)
+{
+ struct _dbar_item *cur;
+
+ if (!data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ cur = data;
+
+ if (cur->eo)
+ elm_object_focus_set(cur->eo, EINA_TRUE);
+}
+
+static struct _dbar_item *_pack_item(struct _dbar_data *bar,
+ struct engine_dbar_item *it)
+{
+ Evas_Object *eo;
+ struct _dbar_item *item;
+ Eina_Bool fill;
+ Eina_Bool focus;
+ int row, col;
+ int step;
+ int r;
+ enum engine_dbar_content_type type;
+ struct engine_dbar_item_content *ctnt;
+
+ if (!bar || !it)
+ return NULL;
+
+ item = calloc(1, sizeof(*item));
+ if (!item) {
+ _ERR("Calloc failed");
+ return NULL;
+ }
+
+ fill = EINA_FALSE;
+ focus = EINA_FALSE;
+
+ eo = _item_load(bar->tbl, it, &fill, &focus);
+ if (!eo) {
+ free(item);
+ return NULL;
+ }
+
+ step = _get_dbar_row_col(bar, fill, &row, &col);
+ if (step <= 0) {
+ evas_object_del(eo);
+ free(item);
+ return NULL;
+ }
+
+ evas_object_size_hint_align_set(eo, EVAS_HINT_FILL, 0.0);
+ elm_table_pack(bar->tbl, eo, col, row,
+ fill ? bar->content_column : 1, 1);
+ evas_object_show(eo);
+
+ bar->tbl_idx += step;
+ bar->state = DBAR_STATE_HIDE;
+ item->eo = eo;
+ item->it = it;
+ item->bar = bar;
+ item->focus = focus;
+
+ evas_object_event_callback_add(eo,
+ EVAS_CALLBACK_MOUSE_MOVE, _mouse_over, item);
+ evas_object_event_callback_add(eo,
+ EVAS_CALLBACK_MOUSE_UP, _clicked, item);
+ evas_object_smart_callback_add(eo, "focused", _focused, item);
+ elm_object_signal_callback_add(eo, SIG_UNFOCUS_TO_HBAR, SRC_PROG,
+ _unfocused, item);
+
+ ctnt = eina_list_data_get(engine_dbar_item_get_contents(it));
+ if (!ctnt) {
+ _ERR("failed to get ci");
+ return item;
+ }
+
+ type = engine_dbar_item_get_content_type(ctnt);
+ if ((type == ENGINE_DBAR_CONTENT_TYPE_NOTIFICATION_NOTI ||
+ type == ENGINE_DBAR_CONTENT_TYPE_HISTORY) &&
+ item->focus) {
+ r = _init_child_bars(item);
+ if (r < 0) {
+ free(item->xbar);
+ item->xbar = NULL;
+ }
+
+ r = item->xbar->ops->add_bar(item->xbar, bar->base);
+ if (r < 0) {
+ item->xbar->ops->release(item->xbar);
+ free(item->xbar);
+ item->xbar = NULL;
+ }
+
+ eo = item->xbar->ops->get_object(item->xbar);
+ if (eo)
+ elm_object_signal_callback_add(eo,
+ SIG_CANCEL_CLICKED,
+ SRC_PROG, _cancel_delete_popup, item);
+ }
+
+ return item;
+}
+
+static int _update(struct bar_info *info, void *eng, void *data)
+{
+ struct _dbar_data *bar;
+ const Eina_List *list;
+ Eina_List *l;
+ struct engine_dbar_item *it;
+ struct _dbar_item *item;
+ const char *noctnt_title;
+ const char *noctnt_desc;
+ int cnt;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ bar = info->data;
+
+ elm_table_clear(bar->tbl, EINA_TRUE);
+ bar->tbl_idx = 0;
+
+ EINA_LIST_FREE(bar->list, item) {
+ if (item->xbar)
+ item->xbar->ops->release(item->xbar);
+
+ evas_object_del(item->eo);
+ free(item);
+ }
+ bar->cur = NULL;
+ bar->list = NULL;
+
+ engine_bar_item_get_content_column(eng, &bar->content_column);
+
+ cnt = 0;
+ list = engine_get_dbar_items(eng);
+ if (!list) {
+ noctnt_title = engine_bar_item_get_noctnt_title(eng);
+ noctnt_desc = engine_bar_item_get_noctnt_desc(eng);
+ elm_object_part_text_set(bar->ly,
+ PART_DEFAULT_TITLE,
+ noctnt_title ? noctnt_title : "");
+ elm_object_part_text_set(bar->ly,
+ PART_DEFAULT_DESC,
+ noctnt_desc ? noctnt_desc : "");
+ return cnt;
+ }
+ elm_object_part_text_set(bar->ly, PART_DEFAULT_TITLE, "");
+ elm_object_part_text_set(bar->ly, PART_DEFAULT_DESC, "");
+
+ EINA_LIST_FOREACH((Eina_List *)list, l, it) {
+ item = _pack_item(bar, it);
+ if (!item)
+ continue;
+
+ bar->list = eina_list_append(bar->list, item);
+ cnt++;
+ }
+
+ return cnt;
+}
+
+static Evas_Object *_get_object(struct bar_info *info)
+{
+ struct _dbar_data *bar;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ bar = info->data;
+
+ return bar->ly;
+}
+
+static Evas_Object *_get_item(struct bar_info *info)
+{
+ struct _dbar_data *bar;
+ struct _dbar_item *item;
+ Eina_List *l;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ bar = info->data;
+ if (bar->cur)
+ return bar->cur->eo;
+
+ EINA_LIST_FOREACH(bar->list, l, item) {
+ if (elm_object_focus_allow_get(item->eo)) {
+ bar->cur = item;
+ return bar->cur->eo;
+ }
+ }
+
+ return NULL;
+}
+
+static void _show(struct bar_info *info)
+{
+ struct _dbar_data *bar;
+ struct _dbar_item *item;
+ Eina_List *l;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ bar = info->data;
+
+ EINA_LIST_FOREACH(bar->list, l, item) {
+ if (item->focus)
+ elm_object_focus_allow_set(item->eo, EINA_TRUE);
+ }
+ elm_object_signal_emit(bar->ly, SIG_SHOW, SRC_PROG);
+}
+
+static void _hide(struct bar_info *info)
+{
+ struct _dbar_data *bar;
+ struct _dbar_item *item;
+ Eina_List *l;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ bar = info->data;
+
+ EINA_LIST_FOREACH(bar->list, l, item) {
+ elm_object_signal_emit(item->eo, SIG_HIDE, SRC_PROG);
+ elm_object_focus_allow_set(item->eo, EINA_FALSE);
+
+ if (item->xbar)
+ item->xbar->ops->hide(item->xbar);
+ }
+ elm_object_signal_emit(bar->ly, SIG_HIDE, SRC_PROG);
+}
+
+static Eina_Bool _is_move(struct bar_info *info, int dir)
+{
+ struct _dbar_data *bar;
+ struct _dbar_item *item;
+ struct _dbar_item *_item;
+ Eina_List *l;
+ int x;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ bar = info->data;
+ item = bar->cur;
+
+ if (!item)
+ return EINA_FALSE;
+
+ if (bar->content_column == 1)
+ return EINA_TRUE;
+
+ elm_table_pack_get(item->eo, &x, NULL, NULL, NULL);
+
+ switch (dir) {
+ case BAR_DIR_LEFT:
+ if (x > 0)
+ return EINA_FALSE;
+ break;
+ case BAR_DIR_RIGHT:
+ if (x > 0)
+ return EINA_TRUE;
+
+ l = eina_list_last(bar->list);
+ _item = eina_list_data_get(l);
+ if (item->eo != _item->eo)
+ return EINA_FALSE;
+ break;
+ default:
+ return EINA_FALSE;
+ }
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool _move(struct bar_info *info)
+{
+ struct _dbar_data *bar;
+ struct _dbar_item *item;
+ Eina_List *l;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ bar = info->data;
+ item = bar->cur;
+
+ if (!item) {
+ EINA_LIST_FOREACH(bar->list, l, item) {
+ if (elm_object_focus_allow_get(item->eo))
+ break;
+ }
+
+ if (!item)
+ return EINA_FALSE;
+ }
+
+ elm_object_focus_set(item->eo, EINA_TRUE);
+
+ return EINA_TRUE;
+}
+
+static enum bar_event _enter(struct bar_info *info)
+{
+ Eina_Bool r;
+ struct _dbar_data *bar;
+
+ if (!info) {
+ _ERR("Invalid argument");
+ return BAR_EVENT_ERROR;
+ }
+
+ bar = info->data;
+ r = EINA_FALSE;
+
+ switch (bar->state) {
+ case DBAR_STATE_DBAR:
+ r = _launch_app(info);
+ break;
+ default:
+ return BAR_EVENT_DONE;
+ }
+
+ return r ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+}
+
+static enum bar_event _move_right(struct bar_info *info)
+{
+ Eina_Bool r;
+ struct _dbar_data *bar;
+
+ if (!info) {
+ _ERR("Invalid argument");
+ return BAR_EVENT_ERROR;
+ }
+
+ bar = info->data;
+ r = EINA_FALSE;
+
+ switch (bar->state) {
+ case DBAR_STATE_DBAR:
+ if (_is_move(info, BAR_DIR_RIGHT)) {
+ if (bar->cur->xbar)
+ r = bar->cur->xbar->ops->move(bar->cur->xbar);
+ }
+ break;
+ default:
+ return BAR_EVENT_ERROR;
+ }
+
+ return r ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+}
+
+static enum bar_event _move_left(struct bar_info *info)
+{
+ struct _dbar_data *bar;
+
+ if (!info) {
+ _ERR("Invalid argument");
+ return BAR_EVENT_ERROR;
+ }
+
+ bar = info->data;
+
+ switch (bar->state) {
+ case DBAR_STATE_XBAR:
+ break;
+ case DBAR_STATE_DBAR:
+ if (_is_move(info, BAR_DIR_LEFT)) {
+ if (bar->cur->xbar) {
+ bar->cur->xbar->ops->hide(bar->cur->xbar);
+ bar->state = DBAR_STATE_HIDE;
+ }
+ return BAR_EVENT_MOVE;
+ }
+ break;
+ default:
+ return BAR_EVENT_ERROR;
+ }
+
+ return BAR_EVENT_PASS;
+}
+
+static enum bar_event _key_event(struct bar_info *info, void *ei)
+{
+ Ecore_Event_Key *ev;
+ enum bar_event r;
+
+ if (!info || !ei)
+ return BAR_EVENT_ERROR;
+
+ ev = ei;
+
+ if (!strcmp(ev->keyname, KEY_ENTER))
+ r = _enter(info);
+ else if (!strcmp(ev->keyname, KEY_RIGHT))
+ r = _move_right(info);
+ else if (!strcmp(ev->keyname, KEY_LEFT) ||
+ !strcmp(ev->keyname, KEY_BACK))
+ r = _move_left(info);
+ else
+ r = BAR_EVENT_PASS;
+
+ return r;
+}
+
+static enum bar_event _bar_event(struct bar_info *info, void *ei,
+ enum bar_event ev)
+{
+ struct _dbar_data *bar;
+ enum bar_event r;
+
+ if (!info || !ei)
+ return BAR_EVENT_ERROR;
+
+ bar = info->data;
+
+ switch (ev) {
+ case BAR_EVENT_DONE:
+ case BAR_EVENT_ERROR:
+ return ev;
+ case BAR_EVENT_PASS:
+ r = _key_event(info, ei);
+ break;
+ case BAR_EVENT_MOVE:
+ if (bar->state == DBAR_STATE_XBAR)
+ _move(info);
+ r = BAR_EVENT_DONE;
+ break;
+ default:
+ r = BAR_EVENT_PASS;
+ break;
+ }
+
+ return r;
+}
+
+static enum bar_event _key_down(struct bar_info *info, void *ei)
+{
+ struct _dbar_data *bar;
+ struct _dbar_item *item;
+ enum bar_event r;
+
+ if (!info || !ei)
+ return BAR_EVENT_ERROR;
+
+ bar = info->data;
+ item = bar->cur;
+
+ if (!item)
+ return BAR_EVENT_ERROR;
+
+ r = BAR_EVENT_PASS;
+
+ switch (bar->state) {
+ case DBAR_STATE_HIDE:
+ case DBAR_STATE_DBAR:
+ r = BAR_EVENT_PASS;
+ break;
+ case DBAR_STATE_XBAR:
+ if (!bar->cur->xbar)
+ break;
+
+ r = bar->cur->xbar->ops->key_down(bar->cur->xbar, ei);
+ break;
+ default:
+ return BAR_EVENT_ERROR;
+ }
+
+ return _bar_event(info, ei, r);
+}
+
+static void _release(struct bar_info *info)
+{
+ struct _dbar_data *bar;
+ struct _dbar_item *item;
+
+ if (!info) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ bar = info->data;
+
+ _hide(info);
+
+ if (bar) {
+ EINA_LIST_FREE(bar->list, item) {
+ if (item->xbar)
+ item->xbar->ops->release(item->xbar);
+
+ evas_object_del(item->eo);
+ free(item);
+ }
+ evas_object_del(bar->ly);
+ free(bar);
+ bar = NULL;
+ }
+
+ free(info);
+ info = NULL;
+}
+
+static struct bar_ops dbar_ops = {
+ .add_bar = _add_bar,
+ .update = _update,
+ .get_object = _get_object,
+ .get_item = _get_item,
+ .is_move = _is_move,
+ .move = _move,
+ .show = _show,
+ .hide = _hide,
+ .key_down = _key_down,
+ .release = _release,
+};
+
+int init_dynamic_bar(struct bar_info *info)
+{
+ struct _dbar_data *bar;
+
+ if (!info)
+ return -1;
+
+ bar = calloc(1, sizeof(*bar));
+ if (!bar) {
+ _ERR("calloc failed");
+ return -1;
+ }
+
+ info->data = bar;
+ info->ops = &dbar_ops;
+
+ if (!info->cb.func) {
+ _ERR("invalid callback function");
+ free(bar);
+ return -1;
+ }
+
+ bar->focus_cb = info->cb;
+
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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 <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <Eina.h>
+#include <json-glib/json-glib.h>
+#include <aul.h>
+#include <ctype.h>
+#include <sys/time.h>
+#include <app-content-favorite.h>
+
+#include "engine.h"
+#include "bus.h"
+#include "defs.h"
+#include "dbg.h"
+
+#define SECTION_USER "user"
+#define SECTION_UBAR_ITEMS "ubar.items"
+#define SECTION_ITEMS "items"
+
+#define ATTR_NAME "name"
+#define ATTR_THUMB_BG "thumb_bg"
+#define ATTR_THUMB "thumb"
+#define ATTR_AGE "age"
+#define ATTR_PASSWORD "password"
+#define ATTR_AUTHORITY "authority"
+#define ATTR_ICON "icon"
+#define ATTR_ICON_FOCUS "icon_focus"
+#define ATTR_BUS_NAME "bus_name"
+#define ATTR_OBJECT_PATH "object_path"
+#define ATTR_APP "app"
+#define ATTR_COLOR "color"
+#define ATTR_RED "red"
+#define ATTR_GREEN "green"
+#define ATTR_BLUE "blue"
+#define ATTR_CONTENTS "contents"
+#define ATTR_NOCTNT_TITLE "noctnt_title"
+#define ATTR_NOCTNT_DESC "noctnt_desc"
+#define ATTR_CONTENT_COLUMN "content_column"
+#define ATTR_TITLE "title"
+#define ATTR_PACKAGE "package"
+#define ATTR_CATEGORY "category"
+#define ATTR_IN "in"
+
+#define SIZE_32 32
+#define SIZE_4 4
+#define MULTIPLIER 1024
+#define PACKAGE_LIVE_TV "org.tizen.live-tv-ref"
+
+struct engine {
+ struct {
+ char *name;
+ char *thumb_bg;
+ char *thumb;
+ } user;
+
+ struct bus *bus;
+ Eina_List *client_buslist;
+
+ Eina_List *hbar_its;
+ Eina_List *ubar_its;
+ Eina_List *pin_its;
+ Eina_Bool is_full;
+
+ void (*update_cb)(void *data, bool focus);
+ void *update_cb_data;
+};
+
+struct engine_bar_item {
+ struct engine *eng;
+ char *icon;
+ char *icon_focus;
+ char *name;
+ char *svcid;
+ char *bus_name;
+ char *object_path;
+ char *app;
+ char *noctnt_title;
+ char *noctnt_desc;
+ int r;
+ int g;
+ int b;
+ int content_column;
+ Eina_List *dbar_its;
+ int ctnt_id;
+ char *in;
+ char *args;
+ char *pinid;
+ enum app_content_favorite_type type;
+ Eina_Bool is_pinned;
+
+ void (*update_cb)(struct engine_bar_item *it, void *data);
+ void *update_cb_data;
+};
+
+struct engine_dbar_item_content {
+ enum engine_dbar_content_type type;
+ char *subtitle;
+ char *description;
+ char *detail;
+ char *thumbnail;
+ char *icon;
+};
+
+struct engine_ubar_item {
+ struct engine *eng;
+ char *name;
+ char *thumb_bg;
+ char *thumb;
+ char *password;
+ int age;
+ int authority;
+ bool visible;
+};
+
+struct engine_dbar_item {
+ int ctnt_id;
+ struct engine_bar_item *hit;
+ enum engine_dbar_item_style style;
+ char *name;
+ enum bus_data_action_op action;
+ char *actor;
+ char *args;
+ Eina_List *ctnts;
+};
+
+static int _is_member_exist(JsonReader *reader, const char *member_name)
+{
+ gchar **members;
+ int i, cnt;
+ int r;
+
+ cnt = json_reader_count_members(reader);
+ if (cnt == -1) {
+ _ERR("No member");
+ return 0;
+ }
+ members = json_reader_list_members(reader);
+ if (!members) {
+ _ERR("No member");
+ return 0;
+ }
+
+ r = 0;
+ for (i = 0; i < cnt; i++) {
+ if (!strcmp(member_name, members[i])) {
+ r = 1;
+ break;
+ }
+ }
+
+ g_strfreev(members);
+
+ return r;
+}
+
+static inline const char *_read_attr(JsonReader *reader, const char *attr)
+{
+ const char *val;
+
+ if (!reader || !attr)
+ return NULL;
+
+ if (!_is_member_exist(reader, attr)) {
+ _ERR("There is no %s attribute", attr);
+ return NULL;
+ }
+
+ json_reader_read_member(reader, attr);
+ val = json_reader_get_string_value(reader);
+ json_reader_end_member(reader);
+
+ return val;
+}
+
+static inline gint64 _read_attr_int(JsonReader *reader, const char *attr)
+{
+ gint64 val;
+
+ if (!reader || !attr)
+ return 0;
+
+ if (!_is_member_exist(reader, attr)) {
+ _ERR("There is no %s attribute", attr);
+ return 0;
+ }
+
+ json_reader_read_member(reader, attr);
+ val = json_reader_get_int_value(reader);
+ json_reader_end_member(reader);
+
+ return val;
+}
+
+static JsonReader *_get_reader(JsonParser *parser)
+{
+ if (!parser) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ return json_reader_new(json_parser_get_root(parser));
+}
+
+static inline void _unload_config_user(struct engine *eng)
+{
+ if (!eng)
+ return;
+
+ free(eng->user.name);
+ free(eng->user.thumb_bg);
+ free(eng->user.thumb);
+}
+
+static int _read_color(JsonReader *reader, gint64 *r, gint64 *g, gint64 *b)
+{
+ if (!reader || !r || !g || !b) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ if (!_is_member_exist(reader, ATTR_COLOR)) {
+ _ERR("There is no "ATTR_COLOR" attribute");
+ return -1;
+ }
+ json_reader_read_member(reader, ATTR_COLOR);
+ *r = _read_attr_int(reader, ATTR_RED);
+ *g = _read_attr_int(reader, ATTR_GREEN);
+ *b = _read_attr_int(reader, ATTR_BLUE);
+ json_reader_end_member(reader);
+
+ return 0;
+}
+
+static void _string_to_uppercase(char *str)
+{
+ while (*str != '\0')
+ *(str++) = toupper(*str);
+}
+
+static char *_get_unique_id(const char *object_path)
+{
+ struct timezone timezone;
+ struct timeval timeval;
+ char uuid[SIZE_32];
+ unsigned int len;
+ int i;
+ union {
+ unsigned int t;
+ unsigned char ct[SIZE_4];
+ } u1, u2;
+
+ if (!object_path)
+ return NULL;
+
+ gettimeofday(&timeval, &timezone);
+
+ u1.t = (unsigned int)timeval.tv_usec;
+
+ len = strlen(object_path);
+ u2.t = 0;
+ for (i = 0; i < len; i++)
+ u2.t = u2.t + MULTIPLIER * (unsigned int)object_path[i];
+
+ snprintf(uuid, sizeof(uuid), "%02x%02x.%02x%02x.%02x%02x.%02x%02x",
+ (unsigned char)u2.ct[3], (unsigned char)u2.ct[2],
+ (unsigned char)u2.ct[1], (unsigned char)u2.ct[0],
+ (unsigned char)u1.ct[3], (unsigned char)u1.ct[2],
+ (unsigned char)u1.ct[1], (unsigned char)u1.ct[0]);
+
+ _string_to_uppercase(uuid);
+
+ return strdup(uuid);
+}
+
+static struct engine_bar_item *_new_bar_item(JsonReader *reader, int idx)
+{
+ struct engine_bar_item *it;
+ const char *name, *icon, *icon_focus, *app, *in;
+ const char *object_path, *bus_name;
+ const char *noctnt_title, *noctnt_desc;
+ gint64 r, g, b;
+ gint64 column;
+
+ if (!json_reader_read_element(reader, idx)) {
+ _ERR("Cannot read element of index %d", idx);
+ return NULL;
+ }
+
+ it = calloc(1, sizeof(*it));
+ if (!it) {
+ _ERR("calloc failed");
+ return NULL;
+ }
+
+ name = _read_attr(reader, ATTR_NAME);
+ if (!name)
+ goto err;
+ icon = _read_attr(reader, ATTR_ICON);
+ if (!icon)
+ goto err;
+ icon_focus = _read_attr(reader, ATTR_ICON_FOCUS);
+ if (!icon_focus)
+ goto err;
+ bus_name = _read_attr(reader, ATTR_BUS_NAME);
+ if (!bus_name)
+ goto err;
+ object_path = _read_attr(reader, ATTR_OBJECT_PATH);
+ if (!object_path)
+ goto err;
+ in = _read_attr(reader, ATTR_IN);
+ if (!in)
+ goto err;
+ app = _read_attr(reader, ATTR_APP);
+ noctnt_title = _read_attr(reader, ATTR_NOCTNT_TITLE);
+ noctnt_desc = _read_attr(reader, ATTR_NOCTNT_DESC);
+ column = _read_attr_int(reader, ATTR_CONTENT_COLUMN);
+ if (!column)
+ column = 1;
+
+ if (_read_color(reader, &r, &g, &b) != 0) {
+ r = 69;
+ g = 143;
+ b = 255;
+ }
+
+ json_reader_end_element(reader);
+
+ it->name = strdup(name);
+ it->icon = strdup(icon);
+ it->icon_focus = strdup(icon_focus);
+ it->object_path = strdup(object_path);
+ it->bus_name = strdup(bus_name);
+ it->svcid = _get_unique_id(it->object_path);
+ it->in = strdup(in);
+ if (app)
+ it->app = strdup(app);
+ if (noctnt_title)
+ it->noctnt_title = strdup(noctnt_title);
+ if (noctnt_desc)
+ it->noctnt_desc = strdup(noctnt_desc);
+ it->r = r;
+ it->g = g;
+ it->b = b;
+ it->content_column = column;
+
+ return it;
+
+err:
+ json_reader_end_element(reader);
+ free(it);
+
+ return NULL;
+}
+
+static struct engine_ubar_item *_new_ubar_item(JsonReader *reader, int idx)
+{
+ struct engine_ubar_item *it;
+ const char *name, *thumb_bg, *thumb, *password;
+ int age, authority;
+
+ if (!json_reader_read_element(reader, idx)) {
+ _ERR("Cannot read element of index %d", idx);
+ return NULL;
+ }
+
+ it = calloc(1, sizeof(*it));
+ if (!it) {
+ _ERR("calloc failed");
+ return NULL;
+ }
+
+ name = _read_attr(reader, ATTR_NAME);
+ if (!name)
+ goto err;
+ thumb_bg = _read_attr(reader, ATTR_THUMB_BG);
+ if (!thumb_bg)
+ goto err;
+ thumb = _read_attr(reader, ATTR_THUMB);
+ if (!thumb)
+ goto err;
+ password = _read_attr(reader, ATTR_PASSWORD);
+ age = _read_attr_int(reader, ATTR_AGE);
+ authority = _read_attr_int(reader, ATTR_AUTHORITY);
+
+ it->name = strdup(name);
+ it->thumb_bg = strdup(thumb_bg);
+ it->thumb = strdup(thumb);
+ if (password)
+ it->password = strdup(password);
+ if (age)
+ it->age = age;
+ if (authority)
+ it->authority = authority;
+
+ json_reader_end_member(reader);
+
+ return it;
+
+err:
+ json_reader_end_member(reader);
+ free(it);
+
+ return NULL;
+}
+
+static inline void _unload_bar_item(struct engine_bar_item *it)
+{
+ if (!it)
+ return;
+
+ free(it->name);
+ free(it->icon);
+ free(it->icon_focus);
+ free(it->svcid);
+ free(it->bus_name);
+ free(it->object_path);
+ free(it->app);
+ free(it->args);
+ free(it->noctnt_title);
+ free(it->noctnt_desc);
+ free(it->in);
+ free(it);
+}
+
+static int _load_bar_items(JsonReader *reader, struct engine *eng)
+{
+ struct engine_bar_item *it;
+ int i, cnt;
+ struct client_bus *cbus;
+
+ if (!reader || !eng) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ if (!_is_member_exist(reader, SECTION_ITEMS)) {
+ _ERR("There is no "SECTION_ITEMS" field");
+ return -1;
+ }
+ json_reader_read_member(reader, SECTION_ITEMS);
+ if (!json_reader_is_array(reader)) {
+ _ERR(SECTION_ITEMS" is not array");
+ goto err;
+ }
+
+ cnt = json_reader_count_elements(reader);
+ for (i = 0; i < cnt; i++) {
+ it = _new_bar_item(reader, i);
+ if (!it)
+ continue;
+ it->eng = eng;
+ eng->hbar_its = eina_list_append(eng->hbar_its, it);
+
+ /* send unique id to each content provider */
+ cbus = bus_client_init(it->bus_name,
+ it->object_path, it->svcid);
+ if (!cbus) {
+ _ERR(" Unable to init client bus ");
+ continue;
+ }
+ bus_client_send_svcid(cbus);
+ eng->client_buslist = eina_list_append(eng->client_buslist,
+ cbus);
+ }
+ json_reader_end_member(reader);
+
+ return 0;
+
+err:
+ json_reader_end_member(reader);
+
+ return -1;
+}
+
+static inline void _unload_bar_items(struct engine *eng)
+{
+ struct engine_bar_item *it;
+
+ if (!eng || !eng->hbar_its) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ EINA_LIST_FREE(eng->hbar_its, it)
+ _unload_bar_item(it);
+ eng->hbar_its = NULL;
+}
+
+static int _load_ubar_items(JsonReader *reader, struct engine *eng)
+{
+ struct engine_ubar_item *it;
+ int i, cnt;
+
+ if (!reader || !eng) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ if (!_is_member_exist(reader, SECTION_UBAR_ITEMS)) {
+ _ERR("There is no "SECTION_UBAR_ITEMS" field");
+ return -1;
+ }
+ json_reader_read_member(reader, SECTION_UBAR_ITEMS);
+ if (!json_reader_is_array(reader)) {
+ _ERR(SECTION_UBAR_ITEMS" is not array");
+ goto err;
+ }
+
+ cnt = json_reader_count_elements(reader);
+ for (i = 0; i < cnt; i++) {
+ it = _new_ubar_item(reader, i);
+ if (!it)
+ continue;
+ it->eng = eng;
+ eng->ubar_its = eina_list_append(eng->ubar_its, it);
+ }
+ json_reader_end_member(reader);
+
+ return 0;
+
+err:
+ json_reader_end_member(reader);
+
+ return -1;
+}
+
+static inline void _unload_ubar_items(struct engine *eng)
+{
+ struct engine_ubar_item *it;
+
+ if (!eng || !eng->ubar_its) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ EINA_LIST_FREE(eng->ubar_its, it) {
+ free(it->name);
+ free(it->thumb_bg);
+ free(it->thumb);
+ }
+ eng->ubar_its = NULL;
+}
+
+static JsonParser *_get_parser(const char *config)
+{
+ JsonParser *parser;
+ gboolean r;
+
+ if (!config) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ parser = json_parser_new();
+ if (!parser) {
+ _ERR("json parser new failed");
+ return NULL;
+ }
+
+ r = json_parser_load_from_file(parser, config, NULL);
+ if (!r) {
+ _ERR("parser load from file failed");
+ g_object_unref(parser);
+ return NULL;
+ }
+
+ return parser;
+}
+
+static int _load_item_config(struct engine *eng)
+{
+ JsonParser *parser;
+ JsonReader *reader;
+
+ if (!eng) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ parser = _get_parser(DEF_CONFIG);
+ if (!parser) {
+ _ERR("json parser new failed");
+ return -1;
+ }
+
+ reader = _get_reader(parser);
+ if (!reader) {
+ _ERR("reader get failed");
+ goto unref_parser;
+ }
+
+ if (_load_bar_items(reader, eng) != 0)
+ goto unref_reader;
+
+ g_object_unref(reader);
+ g_object_unref(parser);
+
+ return 0;
+
+unref_reader:
+ g_object_unref(reader);
+unref_parser:
+ g_object_unref(parser);
+
+ return -1;
+}
+
+static int _load_user_config(struct engine *eng)
+{
+ JsonParser *parser;
+ JsonReader *reader;
+
+ if (!eng) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ parser = _get_parser(DEF_CONFIG_USER);
+ if (!parser) {
+ _ERR("json parser new failed");
+ return -1;
+ }
+
+ reader = _get_reader(parser);
+ if (!reader) {
+ _ERR("reader get failed");
+ goto unref_parser;
+ }
+
+ if (_load_ubar_items(reader, eng) != 0)
+ goto unref_reader;
+
+ g_object_unref(reader);
+ g_object_unref(parser);
+
+ return 0;
+
+unref_reader:
+ g_object_unref(reader);
+unref_parser:
+ g_object_unref(parser);
+
+ return -1;
+}
+
+static void _unload_config(struct engine *eng)
+{
+ if (!eng)
+ return;
+
+ _unload_config_user(eng);
+ _unload_bar_items(eng);
+ _unload_ubar_items(eng);
+}
+
+static void _bus_ready(struct bus *bus, void *data)
+{
+ bus_send_signal(bus, BUS_SIGNAL_REFRESH);
+}
+
+static void _bus_end(struct bus *bus, void *data)
+{
+}
+
+static inline struct engine_dbar_item_content *_new_ctnt(
+ struct bus_data_content *bus_ctnt)
+{
+ struct engine_dbar_item_content *ctnt;
+
+ if (!bus_ctnt)
+ return NULL;
+
+ ctnt = calloc(1, sizeof(*ctnt));
+ if (!ctnt) {
+ _ERR("calloc failed");
+ return NULL;
+ }
+
+ switch (bus_ctnt->type) {
+ case BUS_DATA_CONTENT_IMAGE:
+ ctnt->type = ENGINE_DBAR_CONTENT_TYPE_IMAGE;
+ break;
+ case BUS_DATA_CONTENT_VIDEO:
+ ctnt->type = ENGINE_DBAR_CONTENT_TYPE_VIDEO;
+ break;
+ case BUS_DATA_CONTENT_MUSIC:
+ ctnt->type = ENGINE_DBAR_CONTENT_TYPE_MUSIC;
+ break;
+ case BUS_DATA_CONTENT_BROADCAST:
+ ctnt->type = ENGINE_DBAR_CONTENT_TYPE_BROADCAST;
+ break;
+ case BUS_DATA_CONTENT_APP:
+ ctnt->type = ENGINE_DBAR_CONTENT_TYPE_APP;
+ break;
+ case BUS_DATA_CONTENT_SOURCE:
+ ctnt->type = ENGINE_DBAR_CONTENT_TYPE_SOURCE;
+ break;
+ case BUS_DATA_CONTENT_NOTIFICATION_NOTI:
+ ctnt->type = ENGINE_DBAR_CONTENT_TYPE_NOTIFICATION_NOTI;
+ break;
+ case BUS_DATA_CONTENT_NOTIFICATION_ONGOING:
+ ctnt->type = ENGINE_DBAR_CONTENT_TYPE_NOTIFICATION_ONGOING;
+ break;
+ case BUS_DATA_CONTENT_HISTORY:
+ ctnt->type = ENGINE_DBAR_CONTENT_TYPE_HISTORY;
+ break;
+ default:
+ _ERR("Invalid content type");
+ free(ctnt);
+ return NULL;
+ }
+
+ if (bus_ctnt->subtitle)
+ ctnt->subtitle = strdup(bus_ctnt->subtitle);
+ if (bus_ctnt->description)
+ ctnt->description = strdup(bus_ctnt->description);
+ if (bus_ctnt->detail)
+ ctnt->detail = strdup(bus_ctnt->detail);
+ if (bus_ctnt->thumbnail)
+ ctnt->thumbnail = strdup(bus_ctnt->thumbnail);
+ if (bus_ctnt->icon)
+ ctnt->icon = strdup(bus_ctnt->icon);
+
+ return ctnt;
+}
+
+static inline void _free_ctnt(struct engine_dbar_item_content *ctnt)
+{
+ if (!ctnt)
+ return;
+
+ free(ctnt->subtitle);
+ free(ctnt->description);
+ free(ctnt->detail);
+ free(ctnt->icon);
+ free(ctnt->thumbnail);
+ free(ctnt);
+}
+
+static int _add_dbar_item(struct engine_bar_item *hit,
+ enum engine_dbar_item_style style,
+ const char *name, struct bus_data_content bus_ctnt[],
+ int ctnt_cnt, enum bus_data_action_op action,
+ const char *actor, const char *args)
+{
+ struct engine_dbar_item *dit;
+ struct engine_dbar_item_content *ctnt;
+ int i;
+
+ if (!hit) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ dit = calloc(1, sizeof(*dit));
+ if (!dit) {
+ _ERR("calloc failed");
+ return -1;
+ }
+
+ dit->name = strdup(name ? name : "No Information");
+
+ if (ctnt_cnt > BUS_DATA_ALBUM_CONTENT_MAX)
+ ctnt_cnt = BUS_DATA_ALBUM_CONTENT_MAX;
+
+ if (bus_ctnt) {
+ for (i = 0; i < ctnt_cnt; i++) {
+ ctnt = _new_ctnt(&bus_ctnt[i]);
+ if (!ctnt)
+ break;
+ dit->ctnts = eina_list_append(dit->ctnts, ctnt);
+ }
+ }
+
+ dit->ctnt_id = hit->ctnt_id++;
+ dit->hit = hit;
+ dit->style = style;
+ dit->action = action;
+ if (actor)
+ dit->actor = strdup(actor);
+ if (args)
+ dit->args = strdup(args);
+
+ hit->dbar_its = eina_list_append(hit->dbar_its, dit);
+ if (hit->update_cb)
+ hit->update_cb(hit, hit->update_cb_data);
+
+ return dit->ctnt_id;
+}
+
+static inline void _free_dbar_item(struct engine_dbar_item *dit)
+{
+ struct engine_dbar_item_content *ctnt;
+
+ EINA_LIST_FREE(dit->ctnts, ctnt)
+ _free_ctnt(ctnt);
+
+ free(dit->actor);
+ free(dit->args);
+ free(dit->name);
+ free(dit);
+}
+
+static int _del_dbar_item(struct engine_bar_item *hit, int ctnt_id)
+{
+ struct engine_dbar_item *dit;
+ Eina_List *l;
+
+ if (!hit)
+ return -1;
+
+ EINA_LIST_FOREACH(hit->dbar_its, l, dit) {
+ if (dit->ctnt_id == ctnt_id) {
+ hit->dbar_its = eina_list_remove_list(
+ hit->dbar_its, l);
+ _free_dbar_item(dit);
+ if (hit->update_cb)
+ hit->update_cb(hit, hit->update_cb_data);
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
+static int _del_dbar_item_all(struct engine_bar_item *hit)
+{
+ struct engine_dbar_item *dit;
+
+ if (!hit)
+ return -1;
+
+ EINA_LIST_FREE(hit->dbar_its, dit)
+ _free_dbar_item(dit);
+ hit->dbar_its = NULL;
+
+ if (hit->update_cb)
+ hit->update_cb(hit, hit->update_cb_data);
+
+ return 0;
+}
+
+static int _bus_add_label(struct bus_data_label *lbl, void *data)
+{
+ struct engine_bar_item *hit;
+ struct engine *eng;
+ Eina_List *l;
+
+ if (!lbl || !data) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ eng = data;
+ EINA_LIST_FOREACH(eng->hbar_its, l, hit) {
+ if (strcmp(hit->svcid, lbl->svcid))
+ continue;
+
+ return _add_dbar_item(hit, ENGINE_DBAR_ITEM_STYLE_LABEL,
+ lbl->title, NULL, 0,
+ BUS_DATA_ACTION_LAUNCH_NONE,
+ NULL, NULL);
+ }
+
+ return -1;
+}
+
+static int _bus_add_album(struct bus_data_album *album,
+ struct bus_data_action *act, void *data)
+{
+ struct engine_bar_item *hit;
+ struct engine *eng;
+ Eina_List *l;
+
+ if (!album || !act || !data) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ eng = data;
+ EINA_LIST_FOREACH(eng->hbar_its, l, hit) {
+ if (strcmp(hit->svcid, album->svcid))
+ continue;
+
+ return _add_dbar_item(hit, ENGINE_DBAR_ITEM_STYLE_ALBUM,
+ album->title, album->contents,
+ album->content_cnt,
+ act->action,
+ act->actor,
+ act->args);
+ }
+
+ return -1;
+}
+
+static int _bus_add_content(struct bus_data_content *content,
+ struct bus_data_action *act, void *data)
+{
+ struct engine_bar_item *hit;
+ struct engine *eng;
+ Eina_List *l;
+
+ if (!content || !act || !data) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ eng = data;
+ EINA_LIST_FOREACH(eng->hbar_its, l, hit) {
+ if (strcmp(hit->svcid, content->svcid))
+ continue;
+
+ return _add_dbar_item(hit, ENGINE_DBAR_ITEM_STYLE_CONTENT,
+ content->title, content, 1,
+ act->action,
+ act->actor,
+ act->args);
+ }
+
+ return -1;
+}
+
+static void _get_item_bg_and_icon(enum bus_data_pin_type type, const char *icon,
+ struct engine_bar_item *it)
+{
+ switch (type) {
+ case BUS_DATA_PIN_CHANNEL:
+ it->r = ITEM_CHANNEL_BG_R;
+ it->g = ITEM_CHANNEL_BG_G;
+ it->b = ITEM_CHANNEL_BG_B;
+ it->icon = strdup(DEF_PIN_ITEM_CHANNEL_ICON);
+ it->icon_focus = strdup(DEF_PIN_ITEM_CHANNEL_ICON_FOCUS);
+ it->type = APP_CF_CHANNEL;
+ break;
+ case BUS_DATA_PIN_PACKAGE:
+ it->r = ITEM_PACKAGE_BG_R;
+ it->g = ITEM_PACKAGE_BG_G;
+ it->b = ITEM_PACKAGE_BG_B;
+ if (icon) {
+ it->icon = strdup(icon);
+ it->icon_focus = strdup(icon);
+ } else {
+ it->icon = strdup(DEF_PIN_ITEM_DEFAULT_ICON);
+ it->icon_focus =
+ strdup(DEF_PIN_ITEM_DEFAULT_ICON_FOCUS);
+ }
+ it->type = APP_CF_APPS;
+ break;
+ default:
+ it->r = ITEM_DEFAULT_BG_R;
+ it->g = ITEM_DEFAULT_BG_G;
+ it->b = ITEM_DEFAULT_BG_B;
+ it->icon = strdup(DEF_PIN_ITEM_DEFAULT_ICON);
+ it->icon_focus = strdup(DEF_PIN_ITEM_DEFAULT_ICON_FOCUS);
+ break;
+ }
+}
+
+static struct engine_bar_item *_new_pin_item(struct engine *eng,
+ const char *title, enum bus_data_pin_type type,
+ const char *icon, const char *svcid,
+ enum bus_data_action_op action, const char *actor,
+ const char *args, const char *pinid)
+{
+ struct engine_bar_item *it;
+
+ if (!title || !svcid || type > BUS_DATA_PIN_MAX || !pinid)
+ return NULL;
+
+ it = calloc(1, sizeof(*it));
+ if (!it) {
+ _ERR("calloc failed");
+ return NULL;
+ }
+
+ it->name = strdup(title);
+ it->svcid = strdup(svcid);
+ it->in = strdup("custombar");
+ it->is_pinned = EINA_TRUE;
+ it->ctnt_id++;
+ it->pinid = strdup(pinid);
+
+ _get_item_bg_and_icon(type, icon, it);
+
+ if (action == BUS_DATA_ACTION_LAUNCH_APP)
+ it->app = strdup(actor);
+ if (args)
+ it->args = strdup(args);
+
+ return it;
+}
+
+static void _update_pin_list(struct engine *eng)
+{
+ GList *cp_list;
+ Eina_List *l;
+ struct engine_bar_item *hit;
+ int i;
+ const char *pinid;
+
+ if (!eng) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ cp_list = app_content_pin_get_list();
+ if (!cp_list) {
+ _ERR("failed to get pin list");
+ return;
+ }
+
+ for (i = 0; i < g_list_length(cp_list); i++) {
+ pinid = g_list_nth_data(cp_list, i);
+ if (!pinid)
+ continue;
+
+ EINA_LIST_FOREACH(eng->pin_its, l, hit) {
+ if (!strcmp(hit->pinid, pinid))
+ eng->hbar_its = eina_list_append(eng->hbar_its,
+ hit);
+ }
+ }
+ eng->is_full = EINA_TRUE;
+}
+
+static void _unload_pin_item(struct engine_bar_item *it)
+{
+ if (!it)
+ return;
+
+ free(it->name);
+ free(it->icon);
+ free(it->icon_focus);
+ free(it->svcid);
+ free(it->app);
+ free(it->args);
+ free(it->in);
+ free(it->pinid);
+ free(it);
+}
+
+static int _del_pin_item(struct engine *eng, Eina_Bool free)
+{
+ struct engine_bar_item *hit;
+ Eina_List *l;
+
+ if (!eng || !eng->hbar_its)
+ return -1;
+
+ EINA_LIST_FOREACH(eng->hbar_its, l, hit) {
+ if (!hit->is_pinned)
+ continue;
+
+ eng->hbar_its = eina_list_remove_list(eng->hbar_its, l);
+ if (free)
+ _unload_pin_item(hit);
+ }
+
+ return 0;
+}
+
+static int _bus_add_pin(struct bus_data_pin *pin,
+ struct bus_data_action *act, void *data)
+{
+ struct engine_bar_item *hit;
+ struct engine *eng;
+ Eina_List *l;
+ int cnt;
+ int r;
+
+ if (!pin || !act || !data) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ eng = data;
+
+ r = _del_pin_item(eng, EINA_TRUE);
+ if (r < 0) {
+ _ERR("failed to delete pin item in hbar list");
+ return -1;
+ }
+
+ if (eng->is_full) {
+ EINA_LIST_FOREACH(eng->pin_its, l, hit)
+ eng->pin_its = eina_list_remove_list(eng->pin_its, l);
+ eng->is_full = EINA_FALSE;
+ }
+
+ hit = _new_pin_item(eng, pin->title, pin->type, pin->icon, pin->svcid,
+ act->action, act->actor, act->args, pin->pinid);
+ if (!hit)
+ return -1;
+
+ eng->pin_its = eina_list_append(eng->pin_its, hit);
+ cnt = eina_list_count(eng->pin_its);
+
+ if (engine_bar_item_get_pin_count() != cnt)
+ return hit->ctnt_id;
+
+ _update_pin_list(eng);
+
+ if (eng->update_cb)
+ eng->update_cb(eng->update_cb_data, true);
+
+ return hit->ctnt_id;
+}
+
+static int _bus_add_ctnt(struct bus *bus, enum bus_op op, void *opdata,
+ struct bus_data_action *act, void *data)
+{
+ switch (op) {
+ case BUS_OP_ADD_LABEL:
+ return _bus_add_label(opdata, data);
+ case BUS_OP_ADD_ALBUM:
+ return _bus_add_album(opdata, act, data);
+ case BUS_OP_ADD_CONTENT:
+ return _bus_add_content(opdata, act, data);
+ case BUS_OP_ADD_PIN:
+ return _bus_add_pin(opdata, act, data);
+ default:
+ _ERR("Operation not supported");
+ break;
+ }
+
+ return -1;
+}
+
+static int _bus_del_ctnt(struct bus *bus, const char *svcid, int ctnt_id,
+ void *data)
+{
+ struct engine_bar_item *hit;
+ struct engine *eng;
+ Eina_List *l;
+
+ if (!data || !svcid || ctnt_id < 0) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ eng = data;
+ EINA_LIST_FOREACH(eng->hbar_its, l, hit) {
+ if (strcmp(hit->svcid, svcid))
+ continue;
+ return _del_dbar_item(hit, ctnt_id);
+ }
+
+ return -1;
+}
+
+static int _bus_del_ctnt_all(struct bus *bus, const char *svcid, bool reload,
+ void *data)
+{
+ struct engine_bar_item *hit;
+ struct engine *eng;
+ Eina_List *l;
+
+ if (!data || !svcid) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ eng = data;
+
+ if (reload) {
+ _del_pin_item(eng, EINA_TRUE);
+ if (eng->update_cb)
+ eng->update_cb(eng->update_cb_data, true);
+ return 0;
+ }
+
+ EINA_LIST_FOREACH(eng->hbar_its, l, hit) {
+ if (strcmp(hit->svcid, svcid))
+ continue;
+ return _del_dbar_item_all(hit);
+ }
+
+ return -1;
+}
+
+struct engine *engine_init(void)
+{
+ struct engine *eng;
+ struct bus *bus;
+ int r;
+ struct bus_cbs cbs = {
+ .ready = _bus_ready,
+ .add_ctnt = _bus_add_ctnt,
+ .del_ctnt = _bus_del_ctnt,
+ .del_all = _bus_del_ctnt_all,
+ .end = _bus_end
+ };
+
+ eng = calloc(1, sizeof(*eng));
+ if (!eng) {
+ _ERR("calloc failed");
+ return NULL;
+ }
+
+
+ r = _load_user_config(eng);
+ if (r != 0) {
+ free(eng);
+ return NULL;
+ }
+
+ r = _load_item_config(eng);
+ if (r != 0) {
+ free(eng);
+ return NULL;
+ }
+
+ bus = bus_init(&cbs, eng);
+ if (!bus) {
+ _unload_config(eng);
+ free(eng);
+ return NULL;
+ }
+
+ eng->bus = bus;
+
+ return eng;
+}
+
+void engine_fini(struct engine *eng)
+{
+ struct client_bus *cbus;
+
+ if (!eng) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ _unload_config(eng);
+ bus_fini(eng->bus);
+ EINA_LIST_FREE(eng->client_buslist, cbus)
+ bus_client_fini(cbus);
+
+ free(eng);
+}
+
+int engine_get_user_info(struct engine *eng, const char **name,
+ const char **thumb_bg, const char **thumb)
+{
+ if (!eng) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ if (name)
+ *name = eng->user.name;
+ if (thumb_bg)
+ *thumb_bg = eng->user.thumb_bg;
+ if (thumb)
+ *thumb = eng->user.thumb;
+
+ return 0;
+}
+
+const Eina_List *engine_get_bar_items(struct engine *eng)
+{
+ if (!eng) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ return eng->hbar_its;
+}
+
+const char *engine_bar_item_get_name(struct engine_bar_item *it)
+{
+ if (!it)
+ return NULL;
+
+ return it->name;
+}
+
+const char *engine_bar_item_get_icon(struct engine_bar_item *it)
+{
+ if (!it)
+ return NULL;
+
+ return it->icon;
+}
+
+const char *engine_bar_item_get_icon_focus(struct engine_bar_item *it)
+{
+ if (!it)
+ return NULL;
+
+ return it->icon_focus;
+}
+
+const char *engine_bar_item_get_svcid(struct engine_bar_item *it)
+{
+ if (!it)
+ return NULL;
+
+ return it->svcid;
+}
+
+const char *engine_bar_item_get_bus_name(struct engine_bar_item *it)
+{
+ if (!it)
+ return NULL;
+
+ return it->bus_name;
+}
+
+const char *engine_bar_item_get_object_path(struct engine_bar_item *it)
+{
+ if (!it)
+ return NULL;
+
+ return it->object_path;
+}
+
+const char *engine_bar_item_get_noctnt_title(struct engine_bar_item *it)
+{
+ if (!it)
+ return NULL;
+
+ return it->noctnt_title;
+}
+
+const char *engine_bar_item_get_noctnt_desc(struct engine_bar_item *it)
+{
+ if (!it)
+ return NULL;
+
+ return it->noctnt_desc;
+}
+
+int engine_bar_item_get_color(struct engine_bar_item *it,
+ int *r, int *g, int *b)
+{
+ if (!it || !r || !g || !b)
+ return -1;
+
+ *r = it->r;
+ *g = it->g;
+ *b = it->b;
+
+ return 0;
+}
+
+int engine_bar_item_get_content_column(struct engine_bar_item *it,
+ int *content_column)
+{
+ if (!it || !content_column)
+ return -1;
+
+ *content_column = it->content_column;
+
+ return 0;
+}
+
+int engine_bar_item_launch(struct engine_bar_item *it)
+{
+ int r;
+ bundle *args;
+
+ if (!it)
+ return -1;
+
+ if (!it->app) {
+ _ERR("Application name is not found");
+ return -1;
+ }
+
+ if (it->args)
+ args = bundle_decode((const bundle_raw*)it->args,
+ strlen(it->args));
+ else
+ args = NULL;
+
+ r = aul_launch_app(it->app, args);
+ if (args)
+ bundle_free(args);
+ if (r < 0) {
+ _ERR("Open app failed");
+ if (args)
+ bundle_free(args);
+ return -1;
+ }
+
+ return 0;
+}
+
+void engine_bar_item_set_update_cb(struct engine_bar_item *it,
+ void (*update_cb)(struct engine_bar_item *it, void *data),
+ void *data)
+{
+ if (!it)
+ return;
+
+ it->update_cb = update_cb;
+ it->update_cb_data = data;
+}
+
+void engine_bar_item_set_pin_update_cb(struct engine *eng,
+ void (*update_cb)(void *data, bool focus),
+ void *data)
+{
+ if (!eng)
+ return;
+
+ eng->update_cb = update_cb;
+ eng->update_cb_data = data;
+}
+
+void engine_ubar_item_set_visible(struct engine_ubar_item *it, bool visible)
+{
+ if (!it) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ it->visible = visible;
+}
+
+int engine_ubar_item_get_info(struct engine_ubar_item *it, const char **name,
+ const char **thumb_bg, const char **thumb, int *age,
+ bool *visible)
+{
+ if (!it) {
+ _ERR("invalid argument");
+ return -1;
+ }
+
+ if (name)
+ *name = it->name;
+ if (thumb_bg)
+ *thumb_bg = it->thumb_bg;
+ if (thumb)
+ *thumb = it->thumb;
+ if (age)
+ *age = it->age;
+ if (visible)
+ *visible = it->visible;
+
+ return 0;
+}
+
+const Eina_List *engine_get_ubar_items(struct engine *eng)
+{
+ if (!eng) {
+ _ERR("invalid argument");
+ return NULL;
+ }
+
+ return eng->ubar_its;
+}
+
+const Eina_List *engine_get_dbar_items(struct engine_bar_item *it)
+{
+ if (!it) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ return it->dbar_its;
+}
+
+const Eina_List *engine_dbar_item_get_contents(struct engine_dbar_item *it)
+{
+ if (!it) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ return it->ctnts;
+}
+
+const char *engine_dbar_item_get_name(struct engine_dbar_item *it)
+{
+ if (!it) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ return it->name;
+}
+
+enum engine_dbar_item_style engine_dbar_item_get_style(
+ struct engine_dbar_item *it)
+{
+ if (!it) {
+ _ERR("Invalid argument");
+ return ENGINE_DBAR_ITEM_STYLE_CONTENT;
+ }
+
+ return it->style;
+}
+
+int engine_dbar_item_get_color(struct engine_dbar_item *it,
+ int *r, int *g, int *b)
+{
+ if (!it || !r || !g || !b) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ return engine_bar_item_get_color(it->hit, r, g, b);
+}
+
+static inline int _launch_app(struct engine_dbar_item *it)
+{
+ int r;
+ bundle *args;
+ struct engine_dbar_item_content *ctnt;
+
+ if (!it)
+ return -1;
+
+ if (it->args)
+ args = bundle_decode((const bundle_raw*)it->args,
+ strlen(it->args));
+ else
+ args = NULL;
+
+ r = aul_launch_app(it->actor, args);
+ if (args)
+ bundle_free(args);
+ if (r < 0) {
+ _ERR("launch app failed");
+ return -1;
+ }
+
+ ctnt = eina_list_data_get(it->ctnts);
+ if (!ctnt) {
+ _ERR("get ctnt failed");
+ return 0;
+ }
+
+ return 0;
+}
+
+int engine_dbar_item_launch(struct engine_dbar_item *it)
+{
+ if (!it)
+ return -1;
+
+ switch (it->action) {
+ case BUS_DATA_ACTION_LAUNCH_NONE:
+ _ERR("Non-launchable item");
+ break;
+ case BUS_DATA_ACTION_LAUNCH_APP:
+ return _launch_app(it);
+ case BUS_DATA_ACTION_LAUNCH_SERVICE:
+ _ERR("Service launching is not supported yet");
+ break;
+ default:
+ _ERR("Invalid action type");
+ break;
+ }
+
+ return 0;
+}
+
+enum engine_dbar_content_type engine_dbar_item_get_content_type(
+ struct engine_dbar_item_content *ctnt)
+{
+ if (!ctnt) {
+ _ERR("Invalid argument");
+ return ENGINE_DBAR_CONTENT_TYPE_IMAGE;
+ }
+
+ return ctnt->type;
+}
+
+const char *engine_dbar_item_get_content_subtitle(
+ struct engine_dbar_item_content *ctnt)
+{
+ if (!ctnt) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ return ctnt->subtitle;
+}
+
+const char *engine_dbar_item_get_content_description(
+ struct engine_dbar_item_content *ctnt)
+{
+ if (!ctnt) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ return ctnt->description;
+}
+
+const char *engine_dbar_item_get_content_detail(
+ struct engine_dbar_item_content *ctnt)
+{
+ if (!ctnt) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ return ctnt->detail;
+}
+
+const char *engine_dbar_item_get_content_thumbnail(
+ struct engine_dbar_item_content *ctnt)
+{
+ if (!ctnt) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ return ctnt->thumbnail;
+}
+
+const char *engine_dbar_item_get_content_icon(
+ struct engine_dbar_item_content *ctnt)
+{
+ if (!ctnt) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ return ctnt->icon;
+}
+
+const char *engine_bar_item_get_in(struct engine_bar_item *it)
+{
+ if (!it)
+ return NULL;
+
+ return it->in;
+}
+
+const char *engine_dbar_item_get_in(struct engine_dbar_item *it)
+{
+ if (!it)
+ return NULL;
+
+ return engine_bar_item_get_in(it->hit);
+}
+
+Eina_Bool engine_bar_item_get_is_pinned(struct engine_bar_item *it)
+{
+ if (!it)
+ return EINA_FALSE;
+
+ return it->is_pinned;
+}
+
+int engine_bar_item_del_pin(struct engine *eng, struct engine_bar_item *it)
+{
+ Eina_List *l;
+ struct engine_bar_item *hit;
+ int r, cnt;
+
+ if (!it || !eng)
+ return -1;
+
+ r = app_content_pin_unset(NULL, it->type, it->pinid);
+ if (r < 0) {
+ _ERR("failed to unset pin item");
+ return -1;
+ }
+
+ cnt = app_content_pin_get_count();
+ if (cnt != 0)
+ return 0;
+
+ EINA_LIST_FOREACH(eng->hbar_its, l, hit) {
+ if (!hit->pinid)
+ continue;
+
+ if (!strcmp(hit->pinid, it->pinid)) {
+ eng->hbar_its = eina_list_remove_list(eng->hbar_its, l);
+ _unload_pin_item(hit);
+ break;
+ }
+ }
+
+ return 0;
+}
+
+int engine_bar_item_get_pin_count(void)
+{
+ int r;
+
+ r = app_content_pin_get_count();
+ if (r < 0) {
+ _ERR("failed to get pin count");
+ return 0;
+ }
+
+ return r;
+}
+
+int engine_bar_item_swap_pin(struct engine *eng, struct engine_bar_item *it1,
+ struct engine_bar_item *it2)
+{
+ int r;
+
+ if (!eng || !it1 || !it2) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ if (!it1->pinid || !it2->pinid) {
+ _ERR("No pin item");
+ return -1;
+ }
+
+ r = app_content_pin_swap_position(it1->type, it1->pinid,
+ it2->type, it2->pinid);
+ if (r < 0) {
+ _ERR("failed to swap pin item");
+ return -1;
+ }
+
+ _del_pin_item(eng, EINA_FALSE);
+ _update_pin_list(eng);
+
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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 <utilX.h>
+#include <ctype.h>
+
+#include "i18n.h"
+#include "bar.h"
+#include "engine.h"
+#include "defs.h"
+#include "dbg.h"
+
+enum _hbar_state {
+ HBAR_STATE_HIDE,
+ HBAR_STATE_HBAR,
+ HBAR_STATE_UBAR,
+ HBAR_STATE_DBAR
+};
+
+struct _hbar_item;
+
+struct _hbar_data {
+ Evas_Object *ly;
+ Evas_Object *scr;
+ Evas_Object *bx;
+ Eina_List *list;
+ struct _hbar_item *cur;
+ enum _hbar_state state;
+ struct bar_info *ubar;
+};
+
+struct _hbar_item {
+ Evas_Object *eo;
+ struct engine_bar_item *it;
+ struct _hbar_data *bar;
+ Eina_Bool dirty;
+ struct bar_info *dbar;
+};
+
+static int _is_next_object(Evas_Object *target, Evas_Object *from)
+{
+ Evas_Coord y1, y2;
+
+ if (!target || !from) {
+ _ERR("Invalide argument");
+ return -1;
+ }
+
+ evas_object_geometry_get(target, NULL, &y1, NULL, NULL);
+ evas_object_geometry_get(from, NULL, &y2, NULL, NULL);
+
+ return y2 < y1;
+}
+
+static int _get_effect_direction(Evas_Object *target, Evas_Object *from)
+{
+ Evas_Coord x1, y1, x2, y2;
+
+ evas_object_geometry_get(target, &x1, &y1, NULL, NULL);
+ evas_object_geometry_get(from, &x2, &y2, NULL, NULL);
+
+ if (y2 == y1) {
+ if (x1 > x2)
+ return BAR_DIR_RIGHT;
+ else
+ return BAR_DIR_LEFT;
+ } else if (y2 < y1) {
+ return BAR_DIR_DOWN;
+ } else {
+ return BAR_DIR_UP;
+ }
+}
+
+static void _set_effect(Evas_Object *target, Evas_Object *from, int dir)
+{
+ const char *t_sig, *f_sig;
+
+ switch (dir) {
+ case BAR_DIR_RIGHT:
+ t_sig = SIG_FOCUS_FROM_LEFT;
+ f_sig = SIG_UNFOCUS_TO_RIGHT;
+ break;
+ case BAR_DIR_LEFT:
+ t_sig = SIG_FOCUS_FROM_RIGHT;
+ f_sig = SIG_UNFOCUS_TO_LEFT;
+ break;
+ case BAR_DIR_UP:
+ t_sig = SIG_FOCUS_FROM_DOWN;
+ f_sig = SIG_UNFOCUS_TO_UP;
+ break;
+ case BAR_DIR_DOWN:
+ t_sig = SIG_FOCUS_FROM_UP;
+ f_sig = SIG_UNFOCUS_TO_DOWN;
+ break;
+ default:
+ return;
+ }
+
+ elm_object_signal_emit(target, t_sig, SRC_PROG);
+ elm_object_signal_emit(from, f_sig, SRC_PROG);
+}
+
+static inline Evas_Object *_get_bar_object(struct bar_info *bar)
+{
+ if (!bar)
+ return NULL;
+
+ return bar->ops->get_object(bar);
+}
+
+static inline Evas_Object *_get_item_object(struct bar_info *bar)
+{
+ if (!bar)
+ return NULL;
+
+ return bar->ops->get_item(bar);
+}
+
+static void _update_child_bar(struct _hbar_data *, struct _hbar_item *);
+
+static void _focused(void *data, Evas_Object *obj, void *ei)
+{
+ struct _hbar_item *foc;
+ struct _hbar_item *cur;
+ struct _hbar_data *bar;
+ Evas_Object *eo;
+ int next;
+
+ if (!data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ foc = data;
+ bar = foc->bar;
+
+ if (!bar) {
+ _ERR("bar is NULL");
+ return;
+ }
+
+ cur = bar->cur;
+
+ switch (bar->state) {
+ case HBAR_STATE_DBAR:
+ if (!cur) {
+ elm_object_signal_emit(foc->eo,
+ SIG_INITIAL_FOCUS, SRC_PROG);
+ } else {
+ elm_object_signal_emit(foc->eo, SIG_FOCUS, SRC_PROG);
+ if (cur != foc) {
+ elm_object_signal_emit(cur->eo,
+ SIG_HIDE, SRC_PROG);
+ }
+
+ eo = _get_item_object(cur->dbar);
+ if (eo) {
+ elm_object_signal_emit(eo,
+ SIG_UNFOCUS_TO_HBAR, SRC_PROG);
+ }
+ }
+ break;
+ case HBAR_STATE_HBAR:
+ if (!cur) {
+ elm_object_signal_emit(foc->eo,
+ SIG_INITIAL_FOCUS, SRC_PROG);
+ } else if (cur == foc) {
+ elm_object_signal_emit(foc->eo,
+ SIG_FOCUS, SRC_PROG);
+ } else {
+ next = _is_next_object(foc->eo, cur->eo);
+ if (next < 0)
+ break;
+
+ elm_object_signal_emit(foc->eo,
+ next ? SIG_FOCUS_FROM_UP :
+ SIG_FOCUS_FROM_DOWN,
+ SRC_PROG);
+ elm_object_signal_emit(cur->eo,
+ next ? SIG_UNFOCUS_TO_DOWN :
+ SIG_UNFOCUS_TO_UP,
+ SRC_PROG);
+ }
+ break;
+ case HBAR_STATE_UBAR:
+ elm_object_signal_emit(foc->eo, SIG_FOCUS_FROM_UP, SRC_PROG);
+
+ eo = _get_item_object(bar->ubar);
+ if (eo) {
+ elm_object_signal_emit(eo,
+ SIG_UNFOCUS, SRC_PROG);
+ }
+
+ bar->ubar->ops->hide(bar->ubar);
+
+ elm_object_signal_emit(bar->ly, SIG_SHOW_DBAR, SRC_PROG);
+ elm_object_signal_emit(bar->ly, SIG_HIDE_UBAR, SRC_PROG);
+ break;
+ case HBAR_STATE_HIDE:
+ elm_object_signal_emit(foc->eo, SIG_INITIAL_FOCUS, SRC_PROG);
+ break;
+ }
+
+ bar->cur = foc;
+ bar->state = HBAR_STATE_HBAR;
+
+ _update_child_bar(bar, foc);
+}
+
+static Eina_Bool _ubar_focused(void *data, Evas_Object *foc)
+{
+ struct _hbar_data *bar;
+ struct bar_info *ubar;
+ struct bar_info *dbar;
+ Evas_Object *eo;
+ Evas_Object *cur;
+
+ if (!data || !foc) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ bar = data;
+
+ if (!bar) {
+ _ERR("bar is NULL");
+ return EINA_FALSE;
+ }
+
+ if (!bar->cur) {
+ _ERR("current item is NULL");
+ return EINA_FALSE;
+ }
+
+ ubar = bar->ubar;
+ dbar = bar->cur->dbar;
+
+ cur = _get_item_object(ubar);
+ if (!cur)
+ return EINA_FALSE;
+
+ switch (bar->state) {
+ case HBAR_STATE_DBAR:
+ eo = _get_item_object(dbar);
+ if (eo) {
+ elm_object_signal_emit(eo,
+ SIG_UNFOCUS_TO_HBAR, SRC_PROG);
+ }
+ /* fallthrough */
+ case HBAR_STATE_HBAR:
+ elm_object_signal_emit(bar->cur->eo, SIG_FOCUS, SRC_PROG);
+ elm_object_signal_emit(bar->cur->eo,
+ SIG_UNFOCUS_TO_UP, SRC_PROG);
+
+ elm_object_signal_emit(bar->ly, SIG_SHOW_UBAR, SRC_PROG);
+ elm_object_signal_emit(bar->ly, SIG_HIDE_DBAR, SRC_PROG);
+
+ dbar->ops->hide(dbar);
+ break;
+ case HBAR_STATE_UBAR:
+ elm_object_signal_emit(foc, SIG_FOCUS, SRC_PROG);
+ if (cur != foc)
+ elm_object_signal_emit(cur, SIG_UNFOCUS, SRC_PROG);
+ break;
+ default:
+ break;
+ }
+
+ bar->state = HBAR_STATE_UBAR;
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool _dbar_focused(void *data, Evas_Object *foc)
+{
+ struct _hbar_data *bar;
+ struct bar_info *dbar;
+ Evas_Object *cur;
+ int dir;
+ Eina_Bool r;
+
+ if (!data || !foc) {
+ _ERR("Invalide argument");
+ return EINA_FALSE;
+ }
+
+ r = EINA_FALSE;
+ bar = data;
+
+ if (!bar) {
+ _ERR("bar is NULL");
+ return EINA_FALSE;
+ }
+
+ dbar = bar->cur->dbar;
+
+ cur = _get_item_object(dbar);
+ if (!cur)
+ return EINA_FALSE;
+
+ switch (bar->state) {
+ case HBAR_STATE_HBAR:
+ case HBAR_STATE_HIDE:
+ elm_object_signal_emit(foc, SIG_INITIAL_FOCUS, SRC_PROG);
+ elm_object_signal_emit(bar->cur->eo,
+ SIG_UNFOCUS_TO_DBAR, SRC_PROG);
+ break;
+ case HBAR_STATE_DBAR:
+ if (cur == foc) {
+ elm_object_signal_emit(foc,
+ SIG_INITIAL_FOCUS, SRC_PROG);
+ } else {
+ dir = _get_effect_direction(foc, cur);
+ _set_effect(foc, cur, dir);
+ }
+ r = EINA_TRUE;
+ break;
+ case HBAR_STATE_UBAR:
+ return EINA_TRUE;
+ default:
+ break;
+ }
+
+ bar->state = HBAR_STATE_DBAR;
+
+ return r;
+}
+
+static void _mouse_over(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ struct _hbar_item *item;
+
+ if (!data) {
+ _ERR("Invalide argument");
+ return;
+ }
+
+ item = data;
+
+ if (elm_object_focus_get(item->eo))
+ return;
+
+ elm_object_focus_set(item->eo, EINA_TRUE);
+}
+
+static void _clicked(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ struct _hbar_item *item;
+ Evas_Event_Mouse_Up *ev;
+ Evas_Coord x, y, w, h;
+
+ if (!data || !ei)
+ return;
+
+ ev = ei;
+
+ evas_object_geometry_get(obj, &x, &y, &w, &h);
+
+ if (ev->canvas.x < x || ev->canvas.x > x + w ||
+ ev->canvas.y < y || ev->canvas.y > y + h)
+ return;
+
+ item = data;
+ engine_bar_item_launch(item->it);
+}
+
+static int _launch_app(struct bar_info *info)
+{
+ struct _hbar_data *bar;
+ struct _hbar_item *item;
+
+ if (!info)
+ return EINA_FALSE;
+
+ bar = info->data;
+ item = bar->cur;
+
+ if (!item) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ return engine_bar_item_launch(item->it);
+}
+
+static Eina_Bool _move(struct bar_info *info)
+{
+ struct _hbar_data *bar;
+ struct _hbar_item *item;
+ Eina_List *l;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ bar = info->data;
+ item = bar->cur;
+
+ if (!item) {
+ EINA_LIST_FOREACH(bar->list, l, item) {
+ if (elm_object_focus_allow_get(item->eo))
+ break;
+ }
+
+ if (!item)
+ return EINA_FALSE;
+ }
+
+ elm_object_focus_set(item->eo, EINA_TRUE);
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool _is_move(struct bar_info *info, int dir)
+{
+ struct _hbar_data *bar;
+
+ if (!info) {
+ _ERR("Inavlid argument");
+ return EINA_FALSE;
+ }
+
+ bar = info->data;
+
+ switch (dir) {
+ case BAR_DIR_UP:
+ if (eina_list_data_get(bar->list) == bar->cur)
+ return EINA_TRUE;
+ default:
+ return EINA_FALSE;
+ }
+
+ return EINA_FALSE;
+}
+
+static enum bar_event _move_right(struct bar_info *info)
+{
+ struct _hbar_item *item;
+ struct _hbar_data *bar;
+ Eina_Bool r;
+
+ if (!info || !info->data)
+ return BAR_EVENT_ERROR;
+
+ bar = info->data;
+ item = bar->cur;
+
+ if (!item)
+ return BAR_EVENT_ERROR;
+
+ switch (bar->state) {
+ case HBAR_STATE_HBAR:
+ r = item->dbar->ops->move(item->dbar);
+ break;
+ case HBAR_STATE_DBAR:
+ r = item->dbar->ops->is_move(item->dbar, BAR_DIR_RIGHT);
+ break;
+ default:
+ return BAR_EVENT_ERROR;
+ }
+
+ return r ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+}
+
+static enum bar_event _move_left(struct bar_info *info)
+{
+ struct _hbar_item *item;
+ struct _hbar_data *bar;
+ Eina_Bool r;
+
+ if (!info || !info->data)
+ return BAR_EVENT_ERROR;
+
+ bar = info->data;
+ item = bar->cur;
+
+ if (!item)
+ return BAR_EVENT_ERROR;
+
+ switch (bar->state) {
+ case HBAR_STATE_DBAR:
+ if (!item->dbar->ops->is_move(item->dbar, BAR_DIR_LEFT))
+ return BAR_EVENT_PASS;
+
+ r = _move(info);
+ break;
+ case HBAR_STATE_HBAR:
+ return BAR_EVENT_MOVE;
+ case HBAR_STATE_UBAR:
+ if (!bar->ubar->ops->is_move(bar->ubar, BAR_DIR_LEFT))
+ return BAR_EVENT_PASS;
+
+ return BAR_EVENT_MOVE;
+ default:
+ return BAR_EVENT_ERROR;
+ }
+
+ return r ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+}
+
+static enum bar_event _move_up(struct bar_info *info)
+{
+ struct _hbar_data *bar;
+ Eina_Bool r;
+
+ if (!info || !info->data)
+ return BAR_EVENT_ERROR;
+
+ bar = info->data;
+
+ switch (bar->state) {
+ case HBAR_STATE_HBAR:
+ if (!_is_move(info, BAR_DIR_UP))
+ return BAR_EVENT_PASS;
+
+ r = bar->ubar->ops->move(bar->ubar);
+ break;
+ default:
+ r = EINA_FALSE;
+ break;
+ }
+
+ return r ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+}
+
+static enum bar_event _move_down(struct bar_info *info)
+{
+ struct _hbar_data *bar;
+ Eina_Bool r;
+
+ if (!info || !info->data)
+ return BAR_EVENT_ERROR;
+
+ bar = info->data;
+
+ switch (bar->state) {
+ case HBAR_STATE_UBAR:
+ if (!bar->ubar->ops->is_move(bar->ubar, BAR_DIR_DOWN))
+ return BAR_EVENT_PASS;
+
+ bar->cur = eina_list_data_get(bar->list);
+
+ r = _move(info);
+ elm_object_signal_emit(bar->ly, SIG_SHOW_DBAR, SRC_PROG);
+ break;
+ default:
+ r = EINA_FALSE;
+ break;
+ }
+
+ return r ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+}
+
+static enum bar_event _back(struct bar_info *info)
+{
+ struct _hbar_item *item;
+ struct _hbar_data *bar;
+ Eina_Bool r;
+
+ if (!info || !info->data)
+ return BAR_EVENT_ERROR;
+
+ bar = info->data;
+ item = bar->cur;
+
+ if (!item)
+ return BAR_EVENT_ERROR;
+
+ switch (bar->state) {
+ case HBAR_STATE_HBAR:
+ return BAR_EVENT_BACK;
+ case HBAR_STATE_DBAR:
+ r = _move(info);
+ break;
+ case HBAR_STATE_UBAR:
+ default:
+ return BAR_EVENT_ERROR;
+ }
+
+ return r ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+}
+
+static enum bar_event _enter(struct bar_info *info)
+{
+ struct _hbar_data *bar;
+ struct _hbar_item *item;
+ Eina_Bool r;
+
+ if (!info || !info->data)
+ return BAR_EVENT_ERROR;
+
+ bar = info->data;
+ item = bar->cur;
+
+ if (!item)
+ return BAR_EVENT_ERROR;
+
+ switch (bar->state) {
+ case HBAR_STATE_HBAR:
+ r = _launch_app(info);
+ break;
+ case HBAR_STATE_UBAR:
+ case HBAR_STATE_DBAR:
+ default:
+ return BAR_EVENT_ERROR;
+ }
+
+ return r ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+}
+
+static enum bar_event _key_event(struct bar_info *info, void *ei)
+{
+ Ecore_Event_Key *ev;
+ enum bar_event r;
+
+ if (!info || !ei)
+ return BAR_EVENT_ERROR;
+
+ ev = ei;
+
+ if (!strcmp(ev->keyname, KEY_BACK))
+ r = _back(info);
+ else if (!strcmp(ev->keyname, KEY_ENTER))
+ r = _enter(info);
+ else if (!strcmp(ev->keyname, KEY_RIGHT))
+ r = _move_right(info);
+ else if (!strcmp(ev->keyname, KEY_LEFT))
+ r = _move_left(info);
+ else if (!strcmp(ev->keyname, KEY_UP))
+ r = _move_up(info);
+ else if (!strcmp(ev->keyname, KEY_DOWN))
+ r = _move_down(info);
+ else
+ r = BAR_EVENT_PASS;
+
+ return r;
+}
+
+static enum bar_event _bar_event(struct bar_info *info,
+ void *ei, enum bar_event ev)
+{
+ struct _hbar_data *bar;
+ enum bar_event r;
+
+ if (!info || !ei)
+ return BAR_EVENT_ERROR;
+
+ bar = info->data;
+
+ switch (ev) {
+ case BAR_EVENT_DONE:
+ case BAR_EVENT_ERROR:
+ return ev;
+ case BAR_EVENT_PASS:
+ r = _key_event(info, ei);
+ break;
+ case BAR_EVENT_MOVE:
+ if (bar->state == HBAR_STATE_UBAR) {
+ bar->cur = eina_list_data_get(bar->list);
+
+ _move(info);
+ elm_object_signal_emit(bar->ly,
+ SIG_SHOW_DBAR, SRC_PROG);
+ } else if (bar->state == HBAR_STATE_DBAR) {
+ _move(info);
+ }
+ r = BAR_EVENT_DONE;
+ break;
+ default:
+ r = BAR_EVENT_PASS;
+ break;
+ }
+
+ return r;
+}
+
+static enum bar_event _key_up(struct bar_info *info, void *ei)
+{
+ struct _hbar_data *bar;
+ enum bar_event r;
+
+ if (!info || !ei)
+ return BAR_EVENT_ERROR;
+ bar = info->data;
+
+ switch (bar->state) {
+ case HBAR_STATE_UBAR:
+ r = bar->ubar->ops->key_up(bar->ubar, ei);
+ break;
+ default:
+ return BAR_EVENT_DONE;
+ }
+
+ return _bar_event(info, ei, r);
+}
+
+static enum bar_event _key_down(struct bar_info *info, void *ei)
+{
+ struct _hbar_data *bar;
+ struct _hbar_item *item;
+ enum bar_event r;
+
+ if (!info || !ei)
+ return BAR_EVENT_ERROR;
+
+ bar = info->data;
+ item = bar->cur;
+
+ if (!item)
+ return BAR_EVENT_ERROR;
+
+ switch (bar->state) {
+ case HBAR_STATE_HBAR:
+ r = BAR_EVENT_PASS;
+ break;
+ case HBAR_STATE_UBAR:
+ r = bar->ubar->ops->key_down(bar->ubar, ei);
+ break;
+ case HBAR_STATE_DBAR:
+ r = item->dbar->ops->key_down(item->dbar, ei);
+ break;
+ default:
+ return BAR_EVENT_ERROR;
+ }
+
+ return _bar_event(info, ei, r);
+}
+
+static inline Evas_Object *_add_hbar_item_bg(Evas_Object *base,
+ struct engine_bar_item *it)
+{
+ Evas_Object *bg;
+ int r, g, b;
+
+ if (!base || !it)
+ return NULL;
+
+ bg = evas_object_rectangle_add(evas_object_evas_get(base));
+ if (!bg) {
+ _ERR("bg add failed");
+ return NULL;
+ }
+
+ r = 128;
+ g = 128;
+ b = 128;
+
+ engine_bar_item_get_color(it, &r, &g, &b);
+ evas_object_color_set(bg, r, g, b, 255);
+
+ return bg;
+}
+
+static inline Evas_Object *_add_icon(Evas_Object *base, const char *file)
+{
+ Evas_Object *ic;
+
+ if (!base || !file)
+ return NULL;
+
+ ic = elm_icon_add(base);
+ if (!ic) {
+ _ERR("icon add failed");
+ return NULL;
+ }
+
+ elm_image_file_set(ic, file, NULL);
+
+ return ic;
+}
+
+static int _add_ubar(struct _hbar_data *bar, Evas_Object *base)
+{
+ struct bar_info *ubar;
+ int r;
+
+ if (!bar || !base) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ ubar = calloc(1, sizeof(*ubar));
+ if (!ubar) {
+ _ERR("calloc failed");
+ return -1;
+ }
+
+ ubar->cb.func = _ubar_focused;
+ ubar->cb.data = bar;
+
+ bar->ubar = ubar;
+
+ r = init_user_bar(ubar);
+ if (r < 0) {
+ free(ubar);
+ return -1;
+ }
+
+ r = bar->ubar->ops->add_bar(bar->ubar, bar->ly);
+ if (r < 0) {
+ free(ubar);
+ return -1;
+ }
+
+ return 0;
+}
+
+static int _add_bar(struct bar_info *info, Evas_Object *base)
+{
+ Evas_Object *scr, *bx;
+ struct _hbar_data *bar;
+ int r;
+
+
+ if (!base || !info || !info->data) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ bar = info->data;
+
+ scr = elm_scroller_add(base);
+ if (!scr) {
+ _ERR("scroller add failed");
+ return -1;
+ }
+ elm_scroller_policy_set(scr, ELM_SCROLLER_POLICY_OFF,
+ ELM_SCROLLER_POLICY_OFF);
+
+ bx = elm_box_add(scr);
+ if (!bx) {
+ _ERR("box add failed");
+ evas_object_del(scr);
+ return -1;
+ }
+ evas_object_show(bx);
+ elm_object_content_set(scr, bx);
+
+ elm_object_part_content_set(base, PART_HOMEBAR, scr);
+
+ bar->ly = base;
+ bar->scr = scr;
+ bar->bx = bx;
+
+ r = _add_ubar(bar, base);
+ if (r < 0) {
+ evas_object_del(scr);
+ return -1;
+ }
+
+ return 0;
+}
+
+static void _lbl_start_slide(void *data, Evas_Object *obj, void *ei)
+{
+ elm_label_ellipsis_set(data, EINA_FALSE);
+ elm_label_slide_mode_set(data, ELM_LABEL_SLIDE_MODE_AUTO);
+ elm_label_slide_go(data);
+}
+
+static void _lbl_stop_slide(void *data, Evas_Object *obj, void *ei)
+{
+ elm_label_ellipsis_set(data, EINA_TRUE);
+ elm_label_slide_mode_set(data, ELM_LABEL_SLIDE_MODE_NONE);
+ elm_label_slide_go(data);
+}
+
+static Evas_Object *_add_label(Evas_Object *ly, const char *name)
+{
+ Evas_Object *lbl;
+ const char *s;
+
+ if (!ly || !name) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ lbl = elm_label_add(ly);
+ if (!lbl) {
+ _ERR("failed to add label");
+ return NULL;
+ }
+ elm_object_style_set(lbl, STYLE_LABEL_SLIDE_CENTER);
+ s = edje_object_data_get(elm_layout_edje_get(ly),
+ DATA_TITLE_WIDTH);
+ if (s)
+ elm_label_wrap_width_set(lbl, atoi(s));
+ else
+ _ERR("No title width exist");
+
+ elm_object_text_set(lbl, name);
+ elm_label_slide_speed_set(lbl, LABEL_SLIDE_SPEED);
+ evas_object_smart_callback_add(ly, "focused", _lbl_start_slide, lbl);
+ evas_object_smart_callback_add(ly, "unfocused", _lbl_stop_slide, lbl);
+
+ return lbl;
+}
+
+static Evas_Object *_new_hbar_item(Evas_Object *p,
+ struct _hbar_item *item, struct engine_bar_item *it)
+{
+ Evas_Object *ly, *eo, *lbl;
+
+ if (!p || !it || !item) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ ly = elm_layout_add(p);
+ if (!ly) {
+ _ERR("layout add failed");
+ return NULL;
+ }
+
+ elm_layout_file_set(ly, EDJEFILE, GRP_HOMEBAR_ITEM);
+ eo = _add_hbar_item_bg(ly, it);
+ if (!eo)
+ goto err;
+ elm_object_part_content_set(ly, PART_BG, eo);
+
+ eo = _add_hbar_item_bg(ly, it);
+ if (!eo)
+ goto err;
+ elm_object_part_content_set(ly, PART_BG2, eo);
+
+ eo = _add_icon(ly, engine_bar_item_get_icon(it));
+ if (!eo)
+ goto err;
+ elm_object_part_content_set(ly, PART_ICON, eo);
+
+ eo = _add_icon(ly, engine_bar_item_get_icon_focus(it));
+ if (!eo)
+ goto err;
+ elm_object_part_content_set(ly, PART_ICON_FOCUS, eo);
+
+ lbl = _add_label(ly, engine_bar_item_get_name(it));
+ if (!lbl)
+ goto err;
+ elm_object_part_content_set(ly, PART_NAME, lbl);
+
+ evas_object_show(ly);
+ elm_object_focus_allow_set(ly, EINA_TRUE);
+
+ evas_object_event_callback_add(ly,
+ EVAS_CALLBACK_MOUSE_MOVE, _mouse_over, item);
+ evas_object_event_callback_add(ly,
+ EVAS_CALLBACK_MOUSE_UP, _clicked, item);
+ evas_object_smart_callback_add(ly, "focused", _focused, item);
+
+ return ly;
+err:
+ evas_object_del(ly);
+ return NULL;
+}
+
+static int _init_child_bar(struct _hbar_item *item)
+{
+ struct bar_info *dbar;
+ int r;
+
+ dbar = calloc(1, sizeof(*dbar));
+ if (!dbar)
+ goto err;
+
+ dbar->cb.func = _dbar_focused;
+ dbar->cb.data = item->bar;
+
+ r = init_dynamic_bar(dbar);
+ if (r < 0)
+ goto dbar_err;
+
+ item->dbar = dbar;
+
+ return 0;
+
+dbar_err:
+ free(dbar);
+ dbar = NULL;
+err:
+ return -1;
+}
+
+static struct _hbar_item *_pack_item(struct _hbar_data *bar,
+ struct engine_bar_item *it)
+{
+ Evas_Object *base;
+ struct _hbar_item *item;
+ int r;
+
+ if (!bar || !it)
+ return NULL;
+
+ item = calloc(1, sizeof(*item));
+ if (!item) {
+ _ERR("calloc failed");
+ return NULL;
+ }
+
+ base = _new_hbar_item(bar->bx, item, it);
+ if (!base) {
+ free(item);
+ return NULL;
+ }
+
+ elm_box_pack_end(bar->bx, base);
+
+ item->eo = base;
+ item->bar = bar;
+ item->it = it;
+
+ r = _init_child_bar(item);
+ if (r < 0)
+ goto err;
+
+ r = item->dbar->ops->add_bar(item->dbar, bar->ly);
+ if (r < 0)
+ goto err2;
+
+ item->dirty = EINA_TRUE;
+
+ return item;
+
+err2:
+ item->dbar->ops->release(item->dbar);
+err:
+ evas_object_del(base);
+ free(item);
+
+ return NULL;
+}
+
+static void _update_child_bar(struct _hbar_data *bar,
+ struct _hbar_item *item)
+{
+ struct _hbar_item *_item;
+ Eina_List *l;
+ Evas_Object *dbar;
+ Evas_Object *_dbar;
+
+ if (!bar || !item) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ if (item->dirty) {
+ item->dbar->ops->update(item->dbar, item->it, NULL);
+ item->dirty = EINA_FALSE;
+ }
+
+ dbar = _get_bar_object(item->dbar);
+
+ if (bar->cur != item)
+ return;
+
+ elm_object_part_content_unset(bar->ly, PART_DYNAMICBAR);
+
+ EINA_LIST_FOREACH(bar->list, l, _item) {
+ if (_item == item) {
+ _item->dbar->ops->show(_item->dbar);
+ continue;
+ }
+
+ _dbar = _get_bar_object(_item->dbar);
+
+ _item->dbar->ops->hide(_item->dbar);
+ evas_object_stack_below(_dbar, bar->ly);
+ }
+
+ elm_object_part_content_set(bar->ly, PART_DYNAMICBAR, dbar);
+ elm_object_signal_emit(dbar, SIG_SHOW, SRC_PROG);
+}
+
+static void _updated(struct engine_bar_item *it, void *data)
+{
+ struct _hbar_item *item;
+
+ if (!it || !data) {
+ _ERR("invalid argument");
+ return;
+ }
+
+ item = data;
+
+ item->dirty = EINA_TRUE;
+ item->bar->state = HBAR_STATE_HBAR;
+ _update_child_bar(item->bar, item);
+
+ if (item->bar->cur == item)
+ elm_object_focus_set(item->eo, EINA_TRUE);
+}
+
+static int _update(struct bar_info *info, void *eng, void *data)
+{
+ struct _hbar_data *bar;
+ const Eina_List *list;
+ Eina_List *l;
+ struct engine_bar_item *it;
+ struct _hbar_item *item;
+ int cnt, r;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ bar = info->data;
+
+ EINA_LIST_FREE(bar->list, item) {
+ engine_bar_item_set_update_cb(item->it, NULL, NULL);
+ evas_object_del(item->eo);
+ if (item->dbar)
+ item->dbar->ops->release(item->dbar);
+ free(item);
+ }
+ bar->cur = NULL;
+ bar->list = NULL;
+
+ cnt = 0;
+ list = engine_get_bar_items(eng);
+ if (!list)
+ return cnt;
+
+ EINA_LIST_FOREACH((Eina_List *)list, l, it) {
+ r = strcmp(engine_bar_item_get_in(it), "homebar");
+ if (r != 0)
+ continue;
+ item = _pack_item(bar, it);
+ if (!item)
+ continue;
+
+ bar->list = eina_list_append(bar->list, item);
+ engine_bar_item_set_update_cb(item->it, _updated, item);
+ cnt++;
+ }
+
+ r = bar->ubar->ops->update(bar->ubar, eng, NULL);
+ if (r < 0)
+ return -1;
+
+ return cnt;
+}
+
+static void _show(struct bar_info *info)
+{
+ struct _hbar_data *bar;
+ struct _hbar_item *item;
+ Eina_List *l;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ bar = info->data;
+
+ EINA_LIST_FOREACH(bar->list, l, item)
+ elm_object_focus_allow_set(item->eo, EINA_TRUE);
+
+ item = bar->cur;
+ if (!item) {
+ item = eina_list_data_get(bar->list);
+ bar->cur = item;
+ }
+
+ bar->state = HBAR_STATE_HBAR;
+ elm_object_focus_set(item->eo, EINA_TRUE);
+}
+
+static void _hide(struct bar_info *info)
+{
+ struct _hbar_data *bar;
+ struct _hbar_item *item;
+ Eina_List *l;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ bar = info->data;
+
+ item = bar->cur;
+ if (item)
+ elm_object_focus_set(item->eo, EINA_FALSE);
+
+ EINA_LIST_FOREACH(bar->list, l, item) {
+ elm_object_signal_emit(item->eo, SIG_HIDE, SRC_PROG);
+ elm_object_focus_allow_set(item->eo, EINA_FALSE);
+ }
+
+ bar->state = HBAR_STATE_HIDE;
+}
+
+static void _release(struct bar_info *info)
+{
+ struct _hbar_data *bar;
+ struct _hbar_item *item;
+
+ if (!info) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ bar = info->data;
+
+ _hide(info);
+
+ if (bar) {
+ EINA_LIST_FREE(bar->list, item) {
+ engine_bar_item_set_update_cb(item->it, NULL, NULL);
+ evas_object_del(item->eo);
+ if (item->dbar)
+ item->dbar->ops->release(item->dbar);
+ free(item);
+ }
+ if (bar->ubar)
+ bar->ubar->ops->release(bar->ubar);
+ evas_object_del(bar->scr);
+ free(bar);
+ bar = NULL;
+ }
+
+ free(info);
+ info = NULL;
+}
+
+static struct bar_ops hbar_ops = {
+ .add_bar = _add_bar,
+ .update = _update,
+ .show = _show,
+ .hide = _hide,
+ .is_move = _is_move,
+ .move = _move,
+ .key_down = _key_down,
+ .key_up = _key_up,
+ .release = _release,
+};
+
+int init_home_bar(struct bar_info *info)
+{
+ struct _hbar_data *bar;
+
+ if (!info)
+ return -1;
+
+ bar = calloc(1, sizeof(*bar));
+ if (!bar) {
+ _ERR("calloc failed");
+ return -1;
+ }
+
+ info->data = bar;
+ info->ops = &hbar_ops;
+
+ bar->state = HBAR_STATE_HBAR;
+
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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 <Ecore_X.h>
+#include <utilX.h>
+
+#include "bar.h"
+#include "engine.h"
+#include "defs.h"
+#include "dbg.h"
+
+enum _hscr_state {
+ HOMESCREEN_STATE_HIDE,
+ HOMESCREEN_STATE_HBAR,
+ HOMESCREEN_STATE_CBAR
+};
+
+struct homescreen {
+ Evas_Object *base;
+ Evas_Object *win;
+
+ struct engine *eng;
+ enum _hscr_state state;
+ Eina_Bool focus_lock;
+
+ struct bar_info *hbar;
+ struct bar_info *cbar;
+};
+
+static void _outside_clicked(void *data, Evas_Object *obj,
+ const char *emission, const char *source)
+{
+ elm_win_lower(data);
+}
+
+static Evas_Object *_base_init(Evas_Object *win)
+{
+ Evas_Object *base;
+
+ if (!win)
+ return NULL;
+
+ base = elm_layout_add(win);
+ if (!base) {
+ _ERR("layout add failed");
+ return NULL;
+ }
+ elm_layout_file_set(base, EDJEFILE, GRP_MAIN);
+ evas_object_size_hint_weight_set(base,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, base);
+
+ elm_object_signal_callback_add(base, SIG_OUTSIDE_CLICKED, SRC_EDJE,
+ _outside_clicked, win);
+
+ evas_object_show(base);
+
+ return base;
+}
+
+static int _add_hbar(struct homescreen *hscr)
+{
+ struct bar_info *hbar;
+ int r;
+
+ if (!hscr) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ if (!hscr->base) {
+ _ERR("there is no base");
+ return -1;
+ }
+
+ hbar = calloc(1, sizeof(*hbar));
+ if (!hbar) {
+ _ERR("calloc failed");
+ return -1;
+ }
+
+ r = init_home_bar(hbar);
+ if (r < 0) {
+ free(hbar);
+ return -1;
+ }
+
+ hscr->hbar = hbar;
+
+ hbar->ops->add_bar(hbar, hscr->base);
+ hbar->ops->update(hbar, hscr->eng, NULL);
+
+ return 0;
+}
+
+static Eina_Bool _show_bar(struct homescreen *hscr)
+{
+ if (!hscr) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ if (hscr->state != HOMESCREEN_STATE_HIDE)
+ return EINA_FALSE;
+
+ hscr->focus_lock = EINA_TRUE;
+ elm_object_signal_emit(hscr->base, SIG_SHOW_HOMEBAR, SRC_PROG);
+
+ if (hscr->hbar)
+ hscr->state = HOMESCREEN_STATE_HBAR;
+ else if (hscr->cbar)
+ hscr->state = HOMESCREEN_STATE_CBAR;
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool _hide_bar(struct homescreen *hscr)
+{
+ if (!hscr) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ switch (hscr->state) {
+ case HOMESCREEN_STATE_HBAR:
+ case HOMESCREEN_STATE_CBAR:
+ hscr->focus_lock = EINA_TRUE;
+ elm_object_signal_emit(hscr->base, SIG_HIDE_HOMEBAR, SRC_PROG);
+ hscr->state = HOMESCREEN_STATE_HIDE;
+ return EINA_TRUE;
+ default:
+ break;
+ }
+
+ return EINA_FALSE;
+}
+
+static int _add_cbar(struct homescreen *hscr)
+{
+ struct bar_info *cbar;
+ int r;
+
+ if (!hscr) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ if (!hscr->base) {
+ _ERR("there is no base");
+ return -1;
+ }
+
+ cbar = calloc(1, sizeof(*cbar));
+ if (!cbar)
+ return -1;
+
+ r = init_custom_bar(cbar);
+ if (r < 0) {
+ free(cbar);
+ return -1;
+ }
+
+ hscr->cbar = cbar;
+ r = cbar->ops->add_bar(cbar, hscr->base);
+ if (r < 0) {
+ free(cbar);
+ return -1;
+ }
+ cbar->ops->update(cbar, hscr->eng, NULL);
+
+ return 0;
+}
+
+static Eina_Bool _move_hbar(struct homescreen *hscr)
+{
+ int r;
+
+ if (!hscr) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ if (hscr->cbar) {
+ hscr->cbar->ops->release(hscr->cbar);
+ hscr->cbar = NULL;
+ }
+
+ r = _add_hbar(hscr);
+ if (r < 0) {
+ _ERR("hbar add failed");
+ return EINA_FALSE;
+ }
+ elm_object_signal_emit(hscr->base, SIG_HIDE_HOMEBAR, SRC_PROG);
+ elm_object_signal_emit(hscr->base, SIG_SHOW_HOMEBAR, SRC_PROG);
+
+ hscr->state = HOMESCREEN_STATE_HBAR;
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool _move_cbar(struct homescreen *hscr)
+{
+ int r;
+
+ if (!hscr) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ if (hscr->hbar) {
+ hscr->hbar->ops->release(hscr->hbar);
+ hscr->hbar = NULL;
+ }
+
+ r = _add_cbar(hscr);
+ if (r < 0) {
+ _ERR("cbar add failed");
+ return EINA_FALSE;
+ }
+ elm_object_signal_emit(hscr->base, SIG_HIDE_HOMEBAR, SRC_PROG);
+ elm_object_signal_emit(hscr->base, SIG_SHOW_HOMEBAR, SRC_PROG);
+
+ hscr->state = HOMESCREEN_STATE_CBAR;
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool _bar_event(struct homescreen *hscr, enum bar_event ev)
+{
+ Eina_Bool r;
+
+ switch (ev) {
+ case BAR_EVENT_MOVE:
+ if (hscr->state == HOMESCREEN_STATE_HBAR)
+ r = _move_cbar(hscr);
+ else if (hscr->state == HOMESCREEN_STATE_CBAR)
+ r = _move_hbar(hscr);
+ else
+ r = ECORE_CALLBACK_PASS_ON;
+ break;
+ case BAR_EVENT_BACK:
+ r = _hide_bar(hscr);
+ break;
+ case BAR_EVENT_DONE:
+ r = ECORE_CALLBACK_CANCEL;
+ break;
+ case BAR_EVENT_PASS:
+ case BAR_EVENT_ERROR:
+ default:
+ r = ECORE_CALLBACK_PASS_ON;
+ break;
+ }
+
+ return r;
+}
+
+static Eina_Bool _key_up(void *data, int type, void *ei)
+{
+ struct homescreen *hscr;
+ Eina_Bool r;
+ enum bar_event ev;
+
+ if (!data || !ei)
+ return ECORE_CALLBACK_PASS_ON;
+
+ hscr = data;
+
+ switch (hscr->state) {
+ case HOMESCREEN_STATE_HBAR:
+ if (!hscr->hbar)
+ return ECORE_CALLBACK_CANCEL;
+
+ ev = hscr->hbar->ops->key_up(hscr->hbar, ei);
+ break;
+ case HOMESCREEN_STATE_CBAR:
+ if (!hscr->cbar)
+ return ECORE_CALLBACK_CANCEL;
+
+ ev = hscr->cbar->ops->key_up(hscr->cbar, ei);
+ break;
+ default:
+ return ECORE_CALLBACK_PASS_ON;
+ }
+
+ r = _bar_event(hscr, ev);
+
+ return r;
+}
+
+static Eina_Bool _key_down(void *data, int type, void *ei)
+{
+ struct homescreen *hscr;
+ Eina_Bool r;
+ enum bar_event ev;
+
+ if (!data || !ei)
+ return ECORE_CALLBACK_PASS_ON;
+
+ hscr = data;
+
+ switch (hscr->state) {
+ case HOMESCREEN_STATE_HBAR:
+ if (!hscr->hbar)
+ return ECORE_CALLBACK_CANCEL;
+
+ ev = hscr->hbar->ops->key_down(hscr->hbar, ei);
+ break;
+ case HOMESCREEN_STATE_CBAR:
+ if (!hscr->cbar)
+ return ECORE_CALLBACK_CANCEL;
+
+ ev = hscr->cbar->ops->key_down(hscr->cbar, ei);
+ break;
+ default:
+ return ECORE_CALLBACK_PASS_ON;
+ }
+
+ r = _bar_event(hscr, ev);
+
+ return r;
+}
+
+static void _hbar_show_done(void *data, Evas_Object *eo,
+ const char *emission, const char *source)
+{
+ struct homescreen *hscr;
+
+ if (!data)
+ return;
+
+ hscr = data;
+
+ switch (hscr->state) {
+ case HOMESCREEN_STATE_HBAR:
+ if (hscr->hbar)
+ hscr->hbar->ops->show(hscr->hbar);
+ break;
+ case HOMESCREEN_STATE_CBAR:
+ if (hscr->cbar)
+ hscr->cbar->ops->show(hscr->cbar);
+ break;
+ default:
+ break;
+ }
+}
+
+static void _hbar_hide_done(void *data, Evas_Object *eo,
+ const char *emission, const char *source)
+{
+ struct homescreen *hscr;
+
+ if (!data)
+ return;
+
+ hscr = data;
+
+ if (hscr->hbar)
+ hscr->hbar->ops->hide(hscr->hbar);
+ else if (hscr->cbar)
+ hscr->cbar->ops->hide(hscr->cbar);
+
+ elm_win_lower(hscr->win);
+}
+
+struct homescreen *homescreen_init(struct engine *eng)
+{
+ struct homescreen *hscr;
+
+ if (!eng) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ hscr = calloc(1, sizeof(*hscr));
+ if (!hscr) {
+ _ERR("calloc failed");
+ return NULL;
+ }
+
+ ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
+ _key_down, hscr);
+ ecore_event_handler_add(ECORE_EVENT_KEY_UP,
+ _key_up, hscr);
+
+ hscr->eng = eng;
+
+ return hscr;
+}
+
+static void _change_state_clicked(void *data, Evas_Object *obj,
+ const char *emission, const char *source)
+{
+ struct homescreen *hscr;
+
+ if (!data)
+ return;
+
+ hscr = data;
+
+ switch (hscr->state) {
+ case HOMESCREEN_STATE_HBAR:
+ _move_cbar(hscr);
+ break;
+ case HOMESCREEN_STATE_CBAR:
+ _move_hbar(hscr);
+ break;
+ default:
+ break;
+ }
+}
+
+int homescreen_load(struct homescreen *hscr, Evas_Object *win)
+{
+ Evas_Object *base;
+ int r;
+
+ if (!hscr || !win) {
+ _ERR("invalid argument");
+ return -1;
+ }
+
+ base = _base_init(win);
+ if (!base)
+ return -1;
+
+ hscr->win = win;
+ hscr->base = base;
+
+ r = _add_hbar(hscr);
+ if (r != 0) {
+ evas_object_del(hscr->base);
+ return -1;
+ }
+
+ hscr->state = HOMESCREEN_STATE_HIDE;
+
+ elm_object_signal_callback_add(hscr->base,
+ SIG_SHOW_HOMEBAR_DONE, SRC_PROG,
+ _hbar_show_done, hscr);
+ elm_object_signal_callback_add(hscr->base,
+ SIG_HIDE_HOMEBAR_DONE, SRC_PROG,
+ _hbar_hide_done, hscr);
+ elm_object_signal_callback_add(hscr->base,
+ SIG_ARROW_CLICKED, SRC_EDJE,
+ _change_state_clicked, hscr);
+ return 0;
+}
+
+void homescreen_fini(struct homescreen *hscr)
+{
+ if (!hscr) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ if (hscr->hbar)
+ hscr->hbar->ops->release(hscr->hbar);
+ if (hscr->cbar)
+ hscr->cbar->ops->release(hscr->cbar);
+
+ evas_object_del(hscr->base);
+ free(hscr);
+}
+
+void homescreen_show(struct homescreen *hscr)
+{
+ if (!hscr) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ _show_bar(hscr);
+}
+
+void homescreen_hide(struct homescreen *hscr)
+{
+ if (!hscr) {
+ _ERR("Invalid argument");
+ return;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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 <Elementary.h>
+
+#include "homescreen.h"
+#include "engine.h"
+#include "dbg.h"
+
+struct _appdata {
+ const char *name;
+ Evas_Object *win;
+
+ struct homescreen *hscr;
+ struct engine *eng;
+ int initted;
+};
+
+/**
+ * Creates transparent window as BASIC type.
+ *
+ * @param name The name of package
+ * @return window object or NULL otherwise
+ */
+static Evas_Object *_add_win(const char *name)
+{
+ Evas_Object *win;
+
+ win = elm_win_add(NULL, name, ELM_WIN_BASIC);
+ if (!win) {
+ _ERR("failed to create window");
+ return NULL;
+ }
+
+ elm_win_alpha_set(win, EINA_TRUE);
+ evas_object_show(win);
+
+ return win;
+}
+
+/**
+ * Invoked as soon as application is launched according to applcation lifecycle.
+ *
+ * This function creates window object and overlay the theme file.
+ * And also doing following things.
+ * 1. Initializes engine for communicating with several content-providers.
+ * 2. Initializes homescreen UI.
+ * 3. Loads homescreen data.
+ *
+ * @param user_data The function specific data which holds _appdata pointer
+ * @return true If the window and layout object is created successfully;
+ * false otherwise
+ */
+static bool _create(void *user_data)
+{
+ struct _appdata *ad;
+ struct homescreen *hscr;
+ struct engine *eng;
+ Evas_Object *win;
+ int r;
+
+ if (!user_data) {
+ _ERR("Invalid argument");
+ return false;
+ }
+
+ ad = user_data;
+
+ elm_theme_overlay_add(NULL, THEMEFILE);
+ elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK);
+
+ eng = engine_init();
+ if (!eng) {
+ _ERR("failed to initialize engine");
+ return false;
+ }
+
+ hscr = homescreen_init(eng);
+ if (!hscr) {
+ _ERR("failed to initialize homescreen");
+ engine_fini(eng);
+ return false;
+ }
+
+ win = _add_win(ad->name);
+ if (!win) {
+ _ERR("failed to create window");
+ homescreen_fini(hscr);
+ engine_fini(eng);
+ return false;
+ }
+
+ r = homescreen_load(hscr, win);
+ if (r != 0) {
+ _ERR("failed to load homescreen");
+ homescreen_fini(hscr);
+ engine_fini(eng);
+ evas_object_del(win);
+ return false;
+ }
+
+ ad->win = win;
+ ad->hscr = hscr;
+ ad->eng = eng;
+
+ return true;
+}
+
+/**
+ * Invoked before application is terminated according to application lifecycle.
+ *
+ * All Resources will be released.
+ *
+ * @param user_data The function specific data which holds _appdata pointer
+ */
+static void _terminate(void *user_data)
+{
+ struct _appdata *ad;
+
+ if (!user_data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ ad = user_data;
+
+ homescreen_fini(ad->hscr);
+ engine_fini(ad->eng);
+
+ if (ad->win)
+ evas_object_del(ad->win);
+}
+
+/**
+ * Invoked when window of application becomes invisible.
+ *
+ * Hides this applciation.
+ *
+ * @param user_data The function specific data which holds _appdata pointer
+ */
+static void _pause(void *user_data)
+{
+ struct _appdata *ad;
+
+ if (!user_data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ ad = user_data;
+
+ homescreen_hide(ad->hscr);
+}
+
+/**
+ * Invoked when window of application becomes visible.
+ *
+ * Shows this application.
+ *
+ * @param user_data The function specific data which holds _appdata pointer
+ */
+static void _resume(void *user_data)
+{
+ struct _appdata *ad;
+
+ if (!user_data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ ad = user_data;
+
+ homescreen_show(ad->hscr);
+}
+
+/**
+ * Invoked when application should re-lauched according to application
+ * lifecycle.
+ *
+ * If this function is called at first, set the iconified state of window.
+ * After then, it activates window and shows this application.
+ *
+ * @param service The provided arguments for launching
+ * @param user_data The function specific data which holds _appdata pointer
+ */
+static void _service(service_h service, void *user_data)
+{
+ struct _appdata *ad;
+
+ if (!user_data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ ad = user_data;
+
+ if (!ad->initted) {
+ elm_win_iconified_set(ad->win, EINA_TRUE);
+ ad->initted = 1;
+ } else {
+ elm_win_activate(ad->win);
+ homescreen_show(ad->hscr);
+ }
+}
+
+/**
+ * Invoked when language setting changed according to application events.
+ *
+ * There is no action in this applciation.
+ */
+static void _lang_changed(void *user_data)
+{
+}
+
+/**
+ * Invoked when system region setting changed according to application events.
+ *
+ * There is no action in this application.
+ */
+static void _region_fmt_changed(void *user_data)
+{
+}
+
+/**
+ * Main function
+ *
+ * This function calls to register the state transition callbacks and system
+ * event callbacks at main loop.
+ *
+ * @param args The argument count
+ * @param argv The argument vector
+ */
+int main(int argc, char **argv)
+{
+ struct _appdata ad;
+ app_event_callback_s cbs = {
+ .create = _create,
+ .terminate = _terminate,
+ .pause = _pause,
+ .resume = _resume,
+ .service = _service,
+ .low_memory = NULL,
+ .low_battery = NULL,
+ .device_orientation = NULL,
+ .language_changed = _lang_changed,
+ .region_format_changed = _region_fmt_changed,
+ };
+
+ memset(&ad, 0x00, sizeof(ad));
+ ad.name = PACKAGE;
+
+ app_efl_main(&argc, &argv, &cbs, &ad);
+
+ return 0;
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 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 <utilX.h>
+#include <ctype.h>
+
+#include "i18n.h"
+#include "bar.h"
+#include "engine.h"
+#include "defs.h"
+#include "dbg.h"
+
+#define BTN_MAX 2
+#define KEY_LONG_DUR 1.0
+#define BANNER_DUR 3.0
+#define CTXPOPUP_BTN_WIDTH 254
+#define UBAR_ITEM_PADDING_X 45
+#define UBAR_POPUP_PADDING_X 30
+#define BUF_MAX 128
+
+#define TITLE_DELETE_POPUP "Delete User"
+#define MESSAGE_DELETE_POPUP "Are you sure you want to delete user?<br>(All histories will be deleted)"
+#define MESSAGE_DELETE_BANNER "is deleted"
+
+#define TITLE_EDIT_POPUP "Edit User"
+#define MESSAGE_EDIT_BANNER "Editing is completed"
+
+#define MESSAGE_KIDS "It is not available to use some content for over age 17~4, in Kids mode."
+
+#define ASSERT(exp) if (!(exp)) { _ERR(#exp); abort(); }
+
+enum _ubar_state {
+ UBAR_STATE_HIDE,
+ UBAR_STATE_USER,
+ UBAR_STATE_ITEM,
+ UBAR_STATE_USER_CTXPOPUP,
+ UBAR_STATE_ITEM_CTXPOPUP,
+ UBAR_STATE_USER_POPUP,
+ UBAR_STATE_ITEM_POPUP
+};
+
+struct _ubar_item;
+
+struct _ubar_data {
+ struct _ubar_item *user;
+ Evas_Object *ly;
+ Evas_Object *scr;
+ Evas_Object *bx;
+ Eina_List *list;
+ Evas_Object *base;
+ Ecore_Timer *key_timer;
+ struct engine *eng;
+ struct _ubar_item *cur;
+ struct bar_cb focus_cb;
+ enum _ubar_state state;
+ Eina_List *popup_list;
+ Evas_Object *popup_scr;
+ Evas_Object *popup_box;
+};
+
+struct _ubar_item {
+ Evas_Object *eo;
+ Evas_Object *ic_bg;
+ Evas_Object *ic;
+ Evas_Object *ctxpopup;
+ Evas_Object *btn[BTN_MAX];
+ Evas_Object *popup;
+ struct engine_ubar_item *it;
+ struct _ubar_data *bar;
+};
+
+struct _btn_info {
+ const char *part;
+ const char *text;
+ void (*click_cb)(void *, Evas *, Evas_Object *, void *);
+};
+
+static void _focused(void *data, Evas_Object *obj, void *ei)
+{
+ struct _ubar_data *bar;
+ struct _ubar_item *foc;
+
+ if (!data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ foc = data;
+ bar = foc->bar;
+
+ bar->focus_cb.func(bar->focus_cb.data, foc->eo);
+
+ switch (bar->state) {
+ case UBAR_STATE_HIDE:
+ elm_object_signal_emit(bar->user->eo,
+ SIG_FOCUS_FROM_DOWN, SRC_PROG);
+ bar->state = UBAR_STATE_USER;
+ break;
+ case UBAR_STATE_USER:
+ elm_object_signal_emit(bar->user->eo, SIG_HIGHLIGHT, SRC_PROG);
+ bar->state = UBAR_STATE_ITEM;
+ break;
+ case UBAR_STATE_ITEM:
+ if (foc == bar->user) {
+ elm_object_signal_emit(bar->user->eo,
+ SIG_FOCUS_FROM_RIGHT, SRC_PROG);
+ bar->state = UBAR_STATE_USER;
+ }
+ break;
+ default:
+ break;
+ }
+
+ bar->cur = foc;
+}
+
+static void _mouse_over(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ if (!obj) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ if (elm_object_focus_get(obj))
+ return;
+
+ elm_object_focus_set(obj, EINA_TRUE);
+}
+
+static int _add_user(struct _ubar_data *bar, Evas_Object *base)
+{
+ struct _ubar_item *item;
+ Evas_Object *ly, *ic_bg, *ic;
+
+ if (!bar || !base) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ item = calloc(1, sizeof(*item));
+ if (!item) {
+ _ERR("calloc failed");
+ return -1;
+ }
+
+ ly = elm_layout_add(base);
+ if (!ly) {
+ _ERR("layout add failed");
+ free(item);
+ return -1;
+ }
+ elm_layout_file_set(ly, EDJEFILE, GRP_USER);
+
+ ic_bg = elm_icon_add(ly);
+ if (!ic_bg) {
+ _ERR("image add failed");
+ evas_object_del(ly);
+ free(item);
+ return -1;
+ }
+ elm_object_part_content_set(ly, PART_USER_THUMB_BG, ic_bg);
+
+ ic = elm_icon_add(ly);
+ if (!ic) {
+ _ERR("image add failed");
+ evas_object_del(ly);
+ free(item);
+ return -1;
+ }
+ elm_object_part_content_set(ly, PART_USER_THUMB, ic);
+
+ elm_object_part_content_set(base, PART_USER, ly);
+ elm_object_focus_allow_set(ly, EINA_TRUE);
+
+ evas_object_event_callback_add(ly,
+ EVAS_CALLBACK_MOUSE_MOVE, _mouse_over, NULL);
+ evas_object_smart_callback_add(ly, "focused", _focused, item);
+
+ item->eo = ly;
+ item->ic_bg = ic_bg;
+ item->ic = ic;
+ item->bar = bar;
+
+ bar->user = item;
+
+ return 0;
+}
+
+static int _add_items(struct _ubar_data *bar, Evas_Object *base)
+{
+ Evas_Object *ly, *scr, *bx;
+
+ if (!bar || !base) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ ly = elm_layout_add(base);
+ if (!ly) {
+ _ERR("layout add failed");
+ return -1;
+ }
+ elm_layout_file_set(ly, EDJEFILE, GRP_UBAR);
+
+ scr = elm_scroller_add(ly);
+ if (!scr) {
+ _ERR("scroller add failed");
+ evas_object_del(ly);
+ return -1;
+ }
+ elm_scroller_policy_set(scr, ELM_SCROLLER_POLICY_OFF,
+ ELM_SCROLLER_POLICY_OFF);
+
+ bx = elm_box_add(scr);
+ if (!bx) {
+ _ERR("box add failed");
+ evas_object_del(ly);
+ return -1;
+ }
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ elm_box_horizontal_set(bx, EINA_TRUE);
+ elm_box_padding_set(bx,
+ elm_config_scale_get() * UBAR_ITEM_PADDING_X, 0);
+
+ elm_object_part_content_set(ly, PART_UBAR_CONTENT, scr);
+
+ evas_object_show(bx);
+ elm_object_content_set(scr, bx);
+
+ elm_object_part_content_set(base, PART_UBAR, ly);
+
+ bar->ly = ly;
+ bar->scr = scr;
+ bar->bx = bx;
+ bar->base = base;
+
+ return 0;
+}
+
+static int _add_bar(struct bar_info *info, Evas_Object *base)
+{
+ struct _ubar_data *bar;
+ int r;
+
+ if (!info || !info->data || !base) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ bar = info->data;
+
+ r = _add_user(bar, base);
+ if (r < 0)
+ return -1;
+
+ r = _add_items(bar, base);
+ if (r < 0)
+ return -1;
+
+ return 0;
+}
+
+static int _update_user(struct _ubar_data *bar, struct engine_ubar_item *it)
+{
+ struct _ubar_item *item;
+ const char *thumb_bg;
+ const char *thumb;
+ const char *name;
+
+ if (!bar || !it) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ item = bar->user;
+
+ name = NULL;
+ thumb_bg = NULL;
+ thumb = NULL;
+
+ engine_ubar_item_get_info(it, &name, &thumb_bg, &thumb, NULL, NULL);
+ elm_image_file_set(item->ic_bg,
+ thumb_bg ? thumb_bg : DEF_USER_THUMB_BG, NULL);
+ elm_image_file_set(item->ic,
+ thumb ? thumb : DEF_USER_THUMB, NULL);
+ elm_object_part_text_set(item->eo,
+ PART_USER_NAME, name ? name : DEF_USER_NAME);
+ engine_ubar_item_set_visible(it, true);
+
+ return 0;
+}
+
+static struct _ubar_item *_pack_item(struct _ubar_data *bar,
+ struct engine_ubar_item *it)
+{
+ Evas_Object *ly, *ic_bg, *ic;
+ struct _ubar_item *item;
+ const char *name;
+ const char *thumb_bg;
+ const char *thumb;
+
+ if (!bar || !it)
+ return NULL;
+
+ item = calloc(1, sizeof(*item));
+ if (!item) {
+ _ERR("calloc failed");
+ return NULL;
+ }
+
+ ly = elm_layout_add(bar->bx);
+ if (!ly) {
+ _ERR("layout add failed");
+ free(item);
+ return NULL;
+ }
+ elm_layout_file_set(ly, EDJEFILE, GRP_UBAR_ITEM);
+
+ ic_bg = elm_icon_add(ly);
+ if (!ic_bg)
+ goto err;
+ elm_object_part_content_set(ly, PART_USER_THUMB_BG, ic_bg);
+
+ ic = elm_icon_add(ly);
+ if (!ic)
+ goto err;
+ elm_object_part_content_set(ly, PART_USER_THUMB, ic);
+
+ evas_object_show(ly);
+ elm_object_focus_allow_set(ly, EINA_TRUE);
+
+ item->eo = ly;
+ item->ic_bg = ic_bg;
+ item->ic = ic;
+ item->bar = bar;
+ item->it = it;
+
+ name = NULL;
+ thumb_bg = NULL;
+ thumb = NULL;
+ engine_ubar_item_get_info(item->it, &name, &thumb_bg, &thumb, NULL, NULL);
+ elm_object_part_text_set(item->eo,
+ PART_USER_NAME, name ? name : DEF_USER_NAME);
+ elm_image_file_set(item->ic_bg,
+ thumb_bg ? thumb_bg : DEF_UBAR_ITEM_THUMB_BG, NULL);
+ elm_image_file_set(item->ic,
+ thumb ? thumb : DEF_UBAR_ITEM_THUMB, NULL);
+
+ evas_object_event_callback_add(ly,
+ EVAS_CALLBACK_MOUSE_MOVE, _mouse_over, NULL);
+ evas_object_smart_callback_add(ly, "focused", _focused, item);
+
+ elm_box_pack_end(bar->bx, ly);
+ engine_ubar_item_set_visible(item->it, true);
+
+ return item;
+err:
+ _ERR("image add failed");
+ evas_object_del(ly);
+ free(item);
+ return NULL;
+}
+
+static int _update_items(struct _ubar_data *bar, void *eng)
+{
+ const Eina_List *list;
+ Eina_List *l;
+ struct engine_ubar_item *it;
+ struct _ubar_item *item;
+ int i;
+
+ if (!bar || !eng) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ EINA_LIST_FREE(bar->list, item)
+ free(item);
+
+ bar->cur = NULL;
+ bar->list = NULL;
+
+ list = engine_get_ubar_items(eng);
+ if (!list)
+ return -1;
+
+ /* TODO: After deciding the muti-user rule, this part should be fixed */
+ i = 0;
+ EINA_LIST_FOREACH((Eina_List *)list, l, it) {
+ if (i > 3)
+ break;
+
+ if (i == 0) {
+ _update_user(bar, it);
+ i++;
+ continue;
+ }
+
+ item = _pack_item(bar, it);
+ if (!item)
+ continue;
+
+ bar->list = eina_list_append(bar->list, item);
+ i++;
+ }
+
+ return 0;
+}
+
+static int _update(struct bar_info *info, void *eng, void *data)
+{
+ struct _ubar_data *bar;
+ int r;
+
+ if (!info || !info->data || !eng) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ bar = info->data;
+
+ r = _update_items(bar, eng);
+ if (r < 0)
+ return -1;
+
+ bar->eng = eng;
+
+ return 0;
+}
+
+static Evas_Object *_get_item(struct bar_info *info)
+{
+ struct _ubar_data *bar;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ bar = info->data;
+
+ if (!bar->cur)
+ bar->cur = bar->user;
+
+ return bar->cur->eo;
+}
+
+static Eina_Bool _move_user(struct bar_info *info)
+{
+ struct _ubar_data *bar;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ bar = info->data;
+
+ elm_object_focus_set(bar->user->eo, EINA_TRUE);
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool _move_item(struct bar_info *info)
+{
+ struct _ubar_data *bar;
+ struct _ubar_item *item;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ bar = info->data;
+
+ item = eina_list_data_get(bar->list);
+ if (!item)
+ return EINA_FALSE;
+
+ elm_object_focus_set(item->eo, EINA_TRUE);
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool _is_move(struct bar_info *info, int dir)
+{
+ struct _ubar_data *bar;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ bar = info->data;
+
+ switch (dir) {
+ case BAR_DIR_LEFT:
+ case BAR_DIR_DOWN:
+ if (bar->state != UBAR_STATE_USER)
+ return EINA_FALSE;
+
+ if (bar->cur == bar->user)
+ return EINA_TRUE;
+
+ break;
+ default:
+ return EINA_FALSE;
+ }
+
+ return EINA_FALSE;
+}
+
+static enum bar_event _move_right(struct bar_info *info)
+{
+ struct _ubar_data *bar;
+ Eina_Bool r;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return BAR_EVENT_ERROR;
+ }
+
+ bar = info->data;
+
+ if (bar->state == UBAR_STATE_USER)
+ r = _move_item(info);
+ else
+ r = EINA_FALSE;
+
+ return r ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+}
+
+static enum bar_event _move_left(struct bar_info *info)
+{
+ struct _ubar_data *bar;
+ Eina_Bool r;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argumnet");
+ return BAR_EVENT_ERROR;
+ }
+
+ bar = info->data;
+
+ if (bar->state != UBAR_STATE_USER &&
+ bar->state != UBAR_STATE_ITEM)
+ return BAR_EVENT_ERROR;
+
+ if (eina_list_data_get(bar->list) == bar->cur)
+ r = _move_user(info);
+ else
+ r = EINA_FALSE;
+
+ return r ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+}
+
+static void _destroy_ctxpopup(struct _ubar_item *item)
+{
+ int i;
+
+ ASSERT(item);
+
+ evas_object_del(item->ctxpopup);
+ item->ctxpopup = NULL;
+ for (i = 0; i < BTN_MAX; i++) {
+ memset(item->btn, 0x00, sizeof(item->btn));
+ item->btn[i] = NULL;
+ }
+}
+
+static void _destroy_popup(struct _ubar_item *item)
+{
+ ASSERT(item);
+
+ evas_object_del(item->popup);
+ item->popup = NULL;
+
+ switch (item->bar->state) {
+ case UBAR_STATE_USER_POPUP:
+ item->bar->state = UBAR_STATE_USER;
+ break;
+ case UBAR_STATE_ITEM_POPUP:
+ item->bar->state = UBAR_STATE_ITEM;
+ break;
+ default:
+ break;
+ }
+}
+
+static enum bar_event _back(struct bar_info *info)
+{
+ struct _ubar_data *bar;
+ enum bar_event r;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return BAR_EVENT_ERROR;
+ }
+
+ bar = info->data;
+
+ switch (bar->state) {
+ case UBAR_STATE_USER:
+ r = BAR_EVENT_MOVE;
+ break;
+ case UBAR_STATE_ITEM:
+ r = _move_user(info) ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+ break;
+ case UBAR_STATE_USER_CTXPOPUP:
+ _destroy_ctxpopup(bar->user);
+ bar->state = UBAR_STATE_USER;
+ r = BAR_EVENT_DONE;
+ break;
+ case UBAR_STATE_ITEM_CTXPOPUP:
+ _destroy_ctxpopup(bar->cur);
+ bar->state = UBAR_STATE_ITEM;
+ r = BAR_EVENT_DONE;
+ break;
+ case UBAR_STATE_USER_POPUP:
+ _destroy_popup(bar->user);
+ r = BAR_EVENT_DONE;
+ break;
+ case UBAR_STATE_ITEM_POPUP:
+ _destroy_popup(bar->cur);
+ r = BAR_EVENT_DONE;
+ break;
+ default:
+ return BAR_EVENT_ERROR;
+ }
+
+ return r;
+}
+
+static Eina_Bool _add_btn(Evas_Object *p, struct _ubar_item *item,
+ struct _btn_info *btn_info)
+{
+ Evas_Object *btn, *firstbtn;
+ int i;
+
+ if (!p || !item) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ firstbtn = NULL;
+ for (i = 0; i < BTN_MAX; i++) {
+ btn = elm_button_add(p);
+ if (!btn) {
+ _ERR("failed to create button");
+ memset(item->btn, 0x00, sizeof(item->btn));
+ return EINA_FALSE;
+ }
+ elm_object_part_content_set(p, btn_info[i].part, btn);
+ elm_object_text_set(btn, btn_info[i].text);
+ evas_object_show(btn);
+ item->btn[i] = btn;
+
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_DOWN,
+ btn_info[i].click_cb, item);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_MOVE,
+ _mouse_over, NULL);
+
+ if (i == 0)
+ firstbtn = btn;
+ }
+
+ if (firstbtn)
+ elm_object_focus_set(firstbtn, EINA_TRUE);
+
+ return EINA_TRUE;
+}
+
+static void _popup_cancel_clicked(void *data, Evas *e, Evas_Object *obj,
+ void *ei)
+{
+ _destroy_popup(data);
+}
+
+static Evas_Object *_add_popup(Evas_Object *base, const char *title,
+ const char *style)
+{
+ Evas_Object *popup, *win;
+
+ if (!base || !title) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ win = elm_object_parent_widget_get(base);
+ if (!win) {
+ _ERR("failed to get win eo");
+ return NULL;
+ }
+
+ popup = elm_popup_add(win);
+ if (!popup) {
+ _ERR("failed to create popup");
+ return NULL;
+ }
+ if (style)
+ elm_object_style_set(popup, style);
+ elm_object_part_text_set(popup, PART_POPUP_TEXT, title);
+ elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER);
+ elm_object_focus_allow_set(popup, EINA_FALSE);
+
+ return popup;
+}
+
+static void _add_banner(struct _ubar_item *item)
+{
+ Evas_Object *banner, *win;
+
+ if (!item) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ win = elm_object_parent_widget_get(item->bar->base);
+ if (!win) {
+ _ERR("failed to get win eo");
+ return;
+ }
+
+ banner = elm_popup_add(win);
+ if (!banner) {
+ _ERR("failed to create popup");
+ return;
+ }
+
+ elm_object_style_set(banner, STYLE_POPUP_BOTTOM_1LINE);
+ elm_popup_orient_set(banner, ELM_POPUP_ORIENT_BOTTOM);
+ elm_object_text_set(banner, MESSAGE_DELETE_BANNER);
+ elm_popup_timeout_set(banner, BANNER_DUR);
+ elm_object_focus_allow_set(banner, EINA_FALSE);
+ evas_object_show(banner);
+}
+
+static void _popup_delete_clicked(void *data, Evas *e, Evas_Object *obj,
+ void *ei)
+{
+ _destroy_popup(data);
+ _add_banner(data);
+}
+
+static Eina_Bool _add_arrow(struct _ubar_item *item, Evas_Object *p,
+ const char *group, const char *part)
+{
+ Evas_Object *ly;
+
+ if (!item || !p || !part || !group) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ ly = elm_layout_add(p);
+ if (!ly) {
+ _ERR("failed to create icon");
+ evas_object_del(p);
+ return EINA_FALSE;
+ }
+ elm_layout_file_set(ly, EDJEFILE, group);
+ elm_object_part_content_set(p, part, ly);
+ evas_object_show(ly);
+
+ evas_object_event_callback_add(ly, EVAS_CALLBACK_MOUSE_MOVE,
+ _mouse_over, item);
+
+ return EINA_TRUE;
+}
+
+static void _lbl_start_slide(void *data, Evas_Object *obj, void *ei)
+{
+ elm_label_ellipsis_set(data, EINA_FALSE);
+ elm_label_slide_mode_set(data, ELM_LABEL_SLIDE_MODE_AUTO);
+ elm_label_slide_go(data);
+}
+
+static void _lbl_stop_slide(void *data, Evas_Object *obj, void *ei)
+{
+ elm_label_ellipsis_set(data, EINA_TRUE);
+ elm_label_slide_mode_set(data, ELM_LABEL_SLIDE_MODE_NONE);
+ elm_label_slide_go(data);
+}
+
+static Evas_Object *_add_label(Evas_Object *ly, const char *name)
+{
+ Evas_Object *lbl;
+ const char *s;
+
+ if (!ly || !name) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ lbl = elm_label_add(ly);
+ if (!lbl) {
+ _ERR("failed to add label");
+ return NULL;
+ }
+ elm_object_style_set(lbl, STYLE_LABEL_SLIDE_CENTER_22);
+ s = edje_object_data_get(elm_layout_edje_get(ly),
+ DATA_TITLE_WIDTH);
+ if (s)
+ elm_label_wrap_width_set(lbl, atoi(s));
+ else
+ _ERR("No title width exist");
+
+ elm_object_text_set(lbl, name);
+ elm_label_slide_speed_set(lbl, LABEL_SLIDE_SPEED);
+ evas_object_smart_callback_add(ly, "focused", _lbl_start_slide, lbl);
+ evas_object_smart_callback_add(ly, "unfocused", _lbl_stop_slide, lbl);
+
+ return lbl;
+}
+
+static void _popup_user_unfocused(void *data, Evas_Object *obj, void *ei)
+{
+ elm_object_signal_emit(obj, SIG_UNFOCUS, SRC_PROG);
+}
+
+static void _popup_user_focused(void *data, Evas_Object *obj, void *ei)
+{
+ elm_object_signal_emit(obj, SIG_FOCUS, SRC_PROG);
+}
+
+static struct _ubar_item *_pack_users(struct _ubar_data *bar,
+ struct engine_ubar_item *it, Evas_Object *p)
+{
+ Evas_Object *ly, *ic, *ic_bg, *lbl;
+ const char *name, *thumb_bg, *thumb;
+ bool visible;
+ int age;
+ struct _ubar_item *item;
+ char buf[BUF_MAX];
+
+ if (!it || !bar) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ engine_ubar_item_get_info(it, &name, &thumb_bg, &thumb, &age, &visible);
+ if (visible)
+ return NULL;
+
+ item = calloc(1, sizeof(*item));
+ if (!item) {
+ _ERR("calloc failed");
+ return NULL;
+ }
+
+ ly = elm_layout_add(p);
+ if (!ly) {
+ _ERR("failed to create layout");
+ evas_object_del(p);
+ return NULL;
+ }
+ elm_layout_file_set(ly, EDJEFILE, GRP_UBAR_POPUP_ITEM);
+
+ ic = elm_icon_add(ly);
+ if (!ic) {
+ _ERR("failed to create icon");
+ evas_object_del(p);
+ return NULL;
+ }
+ elm_object_part_content_set(ly, PART_USER_THUMB, ic);
+
+ ic_bg = elm_icon_add(ly);
+ if (!ic_bg) {
+ _ERR("failed to create icon");
+ evas_object_del(p);
+ return NULL;
+ }
+ elm_object_focus_allow_set(ly, EINA_TRUE);
+ elm_object_part_content_set(ly, PART_USER_THUMB_BG, ic_bg);
+ evas_object_show(ly);
+
+ if (age > 0) {
+ snprintf(buf, sizeof(buf), "%d", age);
+ elm_object_part_text_set(ly, PART_USER_AGE, buf);
+ elm_object_signal_emit(ly, SIG_SHOW_AGE, SRC_PROG);
+ }
+
+ lbl = _add_label(ly, name);
+ if (!lbl) {
+ _ERR("failed to create name");
+ evas_object_del(p);
+ return NULL;
+ }
+ elm_object_part_content_set(ly, PART_USER_NAME_POPUP, lbl);
+ elm_image_file_set(ic_bg, thumb_bg ? thumb_bg : DEF_UBAR_ITEM_THUMB_BG,
+ NULL);
+ elm_image_file_set(ic, thumb ? thumb : DEF_UBAR_ITEM_THUMB_BG, NULL);
+ elm_box_pack_end(p, ly);
+
+ evas_object_smart_callback_add(ly, "focused", _popup_user_focused, bar);
+ evas_object_smart_callback_add(ly, "unfocused", _popup_user_unfocused,
+ NULL);
+ item->eo = ly;
+ item->it = it;
+ item->bar = bar;
+
+ return item;
+}
+
+static Eina_Bool _load_users(struct _ubar_data *bar, Evas_Object *p)
+{
+ Evas_Object *scr, *box;
+ const Eina_List *list;
+ Eina_List *l;
+ struct engine_ubar_item *it;
+ struct _ubar_item *item;
+
+ if (!bar || !p) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ scr = elm_scroller_add(p);
+ if (!scr) {
+ _ERR("failed to create scroll");
+ evas_object_del(p);
+ return EINA_FALSE;
+ }
+ elm_scroller_policy_set(scr, ELM_SCROLLER_POLICY_OFF,
+ ELM_SCROLLER_POLICY_OFF);
+
+ box = elm_box_add(scr);
+ if (!box) {
+ _ERR("failed to create box");
+ evas_object_del(p);
+ return EINA_FALSE;
+ }
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ elm_box_horizontal_set(box, EINA_TRUE);
+ elm_box_padding_set(box,
+ elm_config_scale_get() * UBAR_POPUP_PADDING_X, 0);
+
+ elm_object_part_content_set(p, PART_POPUP_USER, scr);
+ evas_object_show(box);
+ elm_object_content_set(scr, box);
+
+ bar->popup_scr = scr;
+ bar->popup_box = box;
+
+ bar->popup_list = NULL;
+ list = engine_get_ubar_items(bar->eng);
+ if (!list) {
+ _ERR("failed to get user list");
+ evas_object_del(p);
+ return EINA_FALSE;
+ }
+
+ EINA_LIST_FOREACH((Eina_List *)list, l, it) {
+ item = _pack_users(bar, it, box);
+ if (!item)
+ continue;
+
+ bar->popup_list = eina_list_append(bar->popup_list, item);
+ }
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool _add_popup_items(struct _ubar_item *item, Evas_Object *popup)
+{
+ Evas_Object *ly, *entry;
+
+ if (!item || !popup) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ ly = elm_layout_add(popup);
+ if (!ly) {
+ _ERR("failed to create layout");
+ return EINA_FALSE;
+ }
+ elm_layout_file_set(ly, EDJEFILE, GRP_UBAR_POPUP);
+ evas_object_show(ly);
+ elm_object_content_set(popup, ly);
+
+ if (!_add_arrow(item, ly, GRP_UBAR_LEFT_ARROW, PART_LEFT_ARROW)) {
+ _ERR("failed to create left arrow");
+ evas_object_del(ly);
+ return EINA_FALSE;
+ }
+
+ if (!_add_arrow(item, ly, GRP_UBAR_RIGHT_ARROW, PART_RIGHT_ARROW)) {
+ _ERR("failed to create right arrow");
+ evas_object_del(ly);
+ return EINA_FALSE;
+ }
+
+ if (!_load_users(item->bar, ly)) {
+ _ERR("failed to create users");
+ evas_object_del(ly);
+ return EINA_FALSE;
+ }
+
+ entry = elm_entry_add(ly);
+ if (!entry) {
+ _ERR("failed to create entry");
+ evas_object_del(ly);
+ return EINA_FALSE;
+ }
+ elm_entry_single_line_set(entry, EINA_TRUE);
+ elm_entry_input_panel_language_set(entry,
+ ELM_INPUT_PANEL_LANG_ALPHABET);
+ evas_object_size_hint_weight_set(entry,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(entry,
+ EVAS_HINT_FILL, EVAS_HINT_FILL);
+ /* FIXME: After fixing about IME, focusing should be handled */
+ elm_object_focus_allow_set(entry, EINA_FALSE);
+ elm_entry_cursor_end_set(entry);
+ elm_object_part_content_set(ly, PART_POPUP_ENTRY, entry);
+ evas_object_show(entry);
+
+ elm_object_part_text_set(ly, PART_KIDS, MESSAGE_KIDS);
+
+ return EINA_TRUE;
+}
+
+static void _popup_add_clicked(void *data, Evas *e, Evas_Object *obj,
+ void *ei)
+{
+ struct _ubar_item *item;
+
+ item = data;
+ evas_object_del(item->popup);
+}
+
+static Eina_Bool _load_edit_popup(struct _ubar_item *item)
+{
+ struct _ubar_data *bar;
+ Evas_Object *popup;
+ struct _ubar_item *cur;
+ struct _btn_info btn_info[] = {
+ {
+ "button1",
+ "Add",
+ _popup_add_clicked
+ },
+ {
+ "button2",
+ "Cancel",
+ _popup_cancel_clicked
+ }
+ };
+
+ if (!item) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+ bar = item->bar;
+
+ popup = _add_popup(bar->base, TITLE_EDIT_POPUP, STYLE_POPUP_USER);
+ if (!popup) {
+ _ERR("failed to create popup");
+ return EINA_FALSE;
+ }
+
+ if (!_add_btn(popup, item, btn_info)) {
+ _ERR("failed to create popup button");
+ evas_object_del(popup);
+ return EINA_FALSE;
+ }
+
+ if (!_add_popup_items(item, popup)) {
+ _ERR("failed to create popup user");
+ evas_object_del(popup);
+ return EINA_FALSE;
+ }
+ evas_object_show(popup);
+ item->popup = popup;
+
+ if (bar->popup_list) {
+ cur = eina_list_data_get(bar->popup_list);
+ if (cur)
+ elm_object_focus_set(cur->eo, EINA_TRUE);
+ }
+
+ switch (bar->state) {
+ case UBAR_STATE_USER_CTXPOPUP:
+ _destroy_ctxpopup(bar->user);
+ bar->state = UBAR_STATE_USER_POPUP;
+ break;
+ case UBAR_STATE_ITEM_CTXPOPUP:
+ _destroy_ctxpopup(bar->cur);
+ bar->state = UBAR_STATE_ITEM_POPUP;
+ break;
+ default:
+ evas_object_del(popup);
+ return EINA_FALSE;
+ }
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool _load_delete_popup(struct _ubar_item *item)
+{
+ struct _ubar_data *bar;
+ Evas_Object *popup;
+ struct _btn_info btn_info[] = {
+ {
+ "button1",
+ "Delete",
+ _popup_delete_clicked
+ },
+ {
+ "button2",
+ "Cancel",
+ _popup_cancel_clicked
+ }
+ };
+
+ if (!item) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+ bar = item->bar;
+
+ popup = _add_popup(bar->base, TITLE_DELETE_POPUP,
+ STYLE_POPUP_1LINE_2BUTTON);
+ if (!popup) {
+ _ERR("failed to create popup");
+ return EINA_FALSE;
+ }
+ elm_object_text_set(popup, MESSAGE_DELETE_POPUP);
+
+ if (!_add_btn(popup, item, btn_info)) {
+ _ERR("failed to create popup button");
+ evas_object_del(popup);
+ return EINA_FALSE;
+ }
+
+ item->popup = popup;
+
+ switch (bar->state) {
+ case UBAR_STATE_USER_CTXPOPUP:
+ _destroy_ctxpopup(bar->user);
+ bar->state = UBAR_STATE_USER_POPUP;
+ break;
+ case UBAR_STATE_ITEM_CTXPOPUP:
+ _destroy_ctxpopup(item->bar->cur);
+ bar->state = UBAR_STATE_ITEM_POPUP;
+ break;
+ default:
+ evas_object_del(popup);
+ return EINA_FALSE;
+ }
+
+ return EINA_TRUE;
+}
+
+static void _ctxpopup_edit_clicked(void *data, Evas *e, Evas_Object *obj,
+ void *ei)
+{
+ _load_edit_popup(data);
+}
+
+static void _ctxpopup_delete_clicked(void *data, Evas *e, Evas_Object *obj,
+ void *ei)
+{
+ _load_delete_popup(data);
+}
+
+static Eina_Bool _add_popup_btn(struct _ubar_item *item, Evas_Object *base)
+{
+ Evas_Object *btn, *firstbtn;
+ int i;
+ struct _btn_info btn_info[] = {
+ {
+ NULL,
+ "Edit",
+ _ctxpopup_edit_clicked
+ },
+ {
+ NULL,
+ "Delete",
+ _ctxpopup_delete_clicked
+ }
+ };
+
+ if (!item || !base) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ firstbtn = NULL;
+ for (i = 0; i < sizeof(btn_info) / sizeof(*btn_info); i++) {
+ btn = elm_button_add(base);
+ if (!btn) {
+ _ERR("failed to add button");
+ memset(item->btn, 0x00, sizeof(item->btn));
+ return EINA_FALSE;
+ }
+
+ elm_object_style_set(btn, STYLE_BTN_HOVERTEXT);
+ elm_object_text_set(btn, btn_info[i].text);
+ evas_object_show(btn);
+ elm_box_pack_end(base, btn);
+ item->btn[i] = btn;
+
+ if (i == 0)
+ firstbtn = btn;
+
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_DOWN,
+ btn_info[i].click_cb, item);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_MOVE,
+ _mouse_over, NULL);
+ }
+
+ if (firstbtn)
+ elm_object_focus_set(firstbtn, EINA_TRUE);
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool _create_popup(struct _ubar_item *item)
+{
+ Evas_Object *ctxpopup, *box, *win;
+ Evas_Coord x, w;
+
+ if (!item) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ win = elm_object_parent_widget_get(item->bar->base);
+ if (!win) {
+ _ERR("failed to get win");
+ return EINA_FALSE;
+ }
+
+ ctxpopup = elm_ctxpopup_add(win);
+ if (!ctxpopup) {
+ _ERR("failed to create ctxpopup");
+ return EINA_FALSE;
+ }
+ elm_object_style_set(ctxpopup, STYLE_CTXPOPUP_HOVER);
+ elm_ctxpopup_direction_priority_set(ctxpopup, 0, 0, 0, 0);
+ evas_object_geometry_get(item->ic, &x, NULL, &w, NULL);
+ evas_object_move(ctxpopup,
+ (x - CTXPOPUP_BTN_WIDTH / 2 + w / 2) *
+ elm_config_scale_get(),
+ POSITION_CTXPOPUP_Y * elm_config_scale_get());
+
+ box = elm_box_add(ctxpopup);
+ if (!box) {
+ _ERR("failed to create popup box");
+ evas_object_del(ctxpopup);
+ return EINA_FALSE;
+ }
+ elm_object_content_set(ctxpopup, box);
+ evas_object_show(box);
+ evas_object_show(ctxpopup);
+
+ if (!_add_popup_btn(item, box)) {
+ _ERR("failed to create popup button");
+ evas_object_del(ctxpopup);
+ return EINA_FALSE;
+ }
+
+ elm_object_signal_emit(item->eo, SIG_HLIGHT_FROM_POPOVER, SRC_PROG);
+ item->ctxpopup = ctxpopup;
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool _long_key_cb(void *data)
+{
+ struct _ubar_data *bar;
+
+ if (!data) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ bar = data;
+
+ switch (bar->state) {
+ case UBAR_STATE_USER:
+ _create_popup(bar->user);
+ bar->state = UBAR_STATE_USER_CTXPOPUP;
+ break;
+ case UBAR_STATE_ITEM:
+ _create_popup(bar->cur);
+ bar->state = UBAR_STATE_ITEM_CTXPOPUP;
+ break;
+ default:
+ break;
+ }
+
+ return EINA_TRUE;
+}
+
+static enum bar_event _enter(struct bar_info *info)
+{
+ struct _ubar_data *bar;
+ Eina_Bool r;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return BAR_EVENT_ERROR;
+ }
+
+ bar = info->data;
+
+ r = EINA_FALSE;
+ switch (bar->state) {
+ case UBAR_STATE_USER:
+ case UBAR_STATE_ITEM:
+ if (!bar->key_timer)
+ bar->key_timer = ecore_timer_add(KEY_LONG_DUR,
+ _long_key_cb, bar);
+ r = EINA_TRUE;
+ break;
+ case UBAR_STATE_USER_CTXPOPUP:
+ if (!bar->user->ctxpopup)
+ break;
+
+ if (elm_object_focus_get(bar->user->btn[0]))
+ r = _load_edit_popup(bar->user);
+ else
+ r = _load_delete_popup(bar->user);
+ break;
+ case UBAR_STATE_ITEM_CTXPOPUP:
+ if (!bar->cur->ctxpopup)
+ break;
+
+ if (elm_object_focus_get(bar->cur->btn[0]))
+ r = _load_edit_popup(bar->cur);
+ else
+ r = _load_delete_popup(bar->cur);
+ break;
+ case UBAR_STATE_USER_POPUP:
+ if (!bar->user->popup)
+ break;
+
+ _destroy_popup(bar->user);
+ r = EINA_TRUE;
+ break;
+ case UBAR_STATE_ITEM_POPUP:
+ if (!bar->cur->popup)
+ break;
+
+ _destroy_popup(bar->cur);
+ r = EINA_TRUE;
+ break;
+ default:
+ return BAR_EVENT_ERROR;
+ }
+
+ return r ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+}
+
+static enum bar_event _key_up(struct bar_info *info, void *ei)
+{
+ struct _ubar_data *bar;
+ Ecore_Event_Key *ev;
+
+ if (!info || !ei)
+ return BAR_EVENT_ERROR;
+
+ ev = ei;
+ bar = info->data;
+
+ if (!strcmp(ev->keyname, KEY_ENTER)) {
+ if (!bar->key_timer)
+ return BAR_EVENT_DONE;
+
+ ecore_timer_del(bar->key_timer);
+ bar->key_timer = NULL;
+ }
+
+ return BAR_EVENT_DONE;
+}
+
+static enum bar_event _key_down(struct bar_info *info, void *ei)
+{
+ Ecore_Event_Key *ev;
+ enum bar_event r;
+
+ if (!info || !ei)
+ return BAR_EVENT_ERROR;
+
+ ev = ei;
+
+ if (!strcmp(ev->keyname, KEY_BACK))
+ r = _back(info);
+ else if (!strcmp(ev->keyname, KEY_RIGHT))
+ r = _move_right(info);
+ else if (!strcmp(ev->keyname, KEY_LEFT))
+ r = _move_left(info);
+ else if (!strcmp(ev->keyname, KEY_ENTER))
+ r = _enter(info);
+ else
+ r = BAR_EVENT_PASS;
+
+ return r;
+}
+
+static void _hide(struct bar_info *info)
+{
+ struct _ubar_data *bar;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ bar = info->data;
+
+ elm_object_signal_emit(bar->user->eo, SIG_UNFOCUS_TO_DOWN, SRC_PROG);
+
+ bar->state = UBAR_STATE_HIDE;
+}
+
+static void _hide_bar(struct _ubar_data *bar)
+{
+ struct _ubar_item *item;
+ Eina_List *l;
+
+ if (!bar) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ elm_object_signal_emit(bar->user->eo, SIG_HIDE, SRC_PROG);
+
+ EINA_LIST_FOREACH(bar->list, l, item)
+ elm_object_signal_emit(item->eo, SIG_HIDE, SRC_PROG);
+
+ elm_object_signal_emit(bar->ly, SIG_HIDE, SRC_PROG);
+}
+
+static void _release(struct bar_info *info)
+{
+ struct _ubar_data *bar;
+ struct _ubar_item *item;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ bar = info->data;
+
+ _hide_bar(bar);
+
+ if (bar) {
+ EINA_LIST_FREE(bar->list, item) {
+ evas_object_del(item->eo);
+ free(item);
+ }
+ evas_object_del(bar->user->eo);
+ free(bar->user);
+ evas_object_del(bar->ly);
+ free(bar);
+ bar = NULL;
+ }
+
+ free(info);
+ info = NULL;
+}
+
+static struct bar_ops ubar_ops = {
+ .add_bar = _add_bar,
+ .update = _update,
+ .get_item = _get_item,
+ .hide = _hide,
+ .is_move = _is_move,
+ .move = _move_user,
+ .key_down = _key_down,
+ .key_up = _key_up,
+ .release = _release,
+};
+
+int init_user_bar(struct bar_info *info)
+{
+ struct _ubar_data *bar;
+
+ if (!info)
+ return -1;
+
+ bar = calloc(1, sizeof(*bar));
+ if (!bar) {
+ _ERR("calloc failed");
+ return -1;
+ }
+
+ info->data = bar;
+ info->ops = &ubar_ops;
+
+ if (!info->cb.func) {
+ _ERR("invalid callback function");
+ free(bar);
+ return -1;
+ }
+
+ bar->focus_cb = info->cb;
+
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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 <utilX.h>
+#include <ctype.h>
+
+#include "i18n.h"
+#include "bar.h"
+#include "engine.h"
+#include "defs.h"
+#include "dbg.h"
+
+#define XBAR_W 647
+#define XBAR_H 31
+#define BTN_MAX 3
+#define TITLE_MAX 128
+#define MESSAGE_MAX 256
+#define POPUP_DUR 3.0
+
+#define TITLE_DELETE "Clear"
+#define TITLE_BANNER "All items are deleted"
+#define TITLE_NOTIFICATION "Notification"
+#define TITLE_HISTORY "History"
+#define MESSAGE_DELETE "Are you sure you want to clear your"
+#define MESSAGE_BANNER "is deleted"
+#define MESSAGE_NOTIFICATION "notification"
+#define MESSAGE_HISTORY "history"
+
+enum _xbar_state {
+ XBAR_STATE_HIDE,
+ XBAR_STATE_XBAR,
+ XBAR_STATE_POPUP
+};
+
+struct _xbar_data {
+ Evas_Object *base;
+ Evas_Object *ly;
+ Evas_Object *bg;
+ Evas_Object *popup;
+ Evas_Object *btn[BTN_MAX];
+
+ struct bar_cb focus_cb;
+ struct engine *eng;
+ struct engine_dbar_item *it;
+ struct bar_info *xbar;
+
+ enum _xbar_state state;
+};
+
+struct _btn_info {
+ const char *part;
+ const char *text;
+ void (*click_cb)(void *, Evas *, Evas_Object *, void *e);
+};
+
+static void _release(struct bar_info *info)
+{
+ struct _xbar_data *bar;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ bar = info->data;
+
+ if (bar) {
+ evas_object_del(bar->ly);
+ free(bar);
+ bar = NULL;
+ }
+
+ free(info);
+ info = NULL;
+}
+
+static void _mouse_over(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ struct _xbar_data *bar;
+
+ if (!data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ bar = data;
+
+ if (elm_object_focus_get(bar->ly))
+ return;
+
+ elm_object_focus_set(bar->ly, EINA_TRUE);
+}
+
+static Eina_Bool _add_popup(struct bar_info *info);
+
+static void _clicked(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ struct _xbar_data *bar;
+
+ if (!data || !ei)
+ return;
+
+ bar = data;
+
+ if (bar->state == XBAR_STATE_POPUP) {
+ _ERR("popup already created");
+ return;
+ }
+
+ if (!elm_object_focus_get(bar->ly)) {
+ _ERR("eo isn't focused");
+ return;
+ }
+
+ _add_popup(bar->xbar);
+}
+
+static void _focused(void *data, Evas_Object *obj, void *ei)
+{
+ struct _xbar_data *bar;
+
+ if (!data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ bar = data;
+ bar->focus_cb.func(bar->focus_cb.data, bar->ly);
+ bar->state = XBAR_STATE_XBAR;
+}
+
+static void _free_popup(struct _xbar_data *bar)
+{
+ if (!bar) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ if (!bar->popup)
+ return;
+
+ evas_object_del(bar->popup);
+ bar->popup = NULL;
+ bar->state = XBAR_STATE_XBAR;
+}
+
+static enum engine_dbar_content_type _get_ctnt_type(struct engine_dbar_item *it)
+{
+ struct engine_dbar_item_content *ctnt;
+ const Eina_List *ctnts;
+
+ if (!it) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ ctnts = engine_dbar_item_get_contents(it);
+ if (!ctnts)
+ return -1;
+
+ ctnt = eina_list_data_get(ctnts);
+ if (!ctnt)
+ return -1;
+
+ return engine_dbar_item_get_content_type(ctnt);
+}
+
+static void _add_banner(struct _xbar_data *bar, char *message)
+{
+ Evas_Object *banner, *win;
+
+ if (!bar || !message) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ win = elm_object_top_widget_get(bar->base);
+ if (!win) {
+ _ERR("failed to get win eo");
+ return;
+ }
+
+ banner = elm_popup_add(win);
+ if (!banner) {
+ _ERR("failed to create popup");
+ return;
+ }
+
+ elm_object_style_set(banner, STYLE_POPUP_BOTTOM_1LINE);
+ elm_popup_orient_set(banner, ELM_POPUP_ORIENT_BOTTOM);
+ elm_object_text_set(banner, message);
+ elm_popup_timeout_set(banner, POPUP_DUR);
+ elm_object_focus_allow_set(banner, EINA_FALSE);
+ evas_object_show(banner);
+}
+
+static void _del_item(struct _xbar_data *bar)
+{
+ enum engine_dbar_content_type type;
+ char message[MESSAGE_MAX];
+
+ if (!bar) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ type = _get_ctnt_type(bar->it);
+ if (type < 0) {
+ _ERR("failed to get ctnt type");
+ return;
+ }
+
+ snprintf(message, sizeof(message), "'%s' %s",
+ engine_dbar_item_get_name(bar->it),
+ MESSAGE_BANNER);
+
+ _free_popup(bar);
+ _add_banner(bar, message);
+}
+
+static void _del_all_item(struct _xbar_data *bar)
+{
+ enum engine_dbar_content_type type;
+
+ if (!bar) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ type = _get_ctnt_type(bar->it);
+ if (type < 0) {
+ _ERR("failed to get ctnt type");
+ return;
+ }
+
+ _free_popup(bar);
+ _add_banner(bar, TITLE_BANNER);
+}
+
+static void _del_clicked(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ _del_item(data);
+}
+
+static void _del_all_clicked(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ _del_all_item(data);
+}
+
+static void _cancel_clicked(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ struct _xbar_data *bar;
+
+ if (!data) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ bar = data;
+
+ _free_popup(bar);
+ elm_object_signal_emit(bar->ly, SIG_CANCEL_CLICKED, SRC_PROG);
+}
+
+static void _btn_mouse_over(void *data, Evas *e, Evas_Object *obj, void *ei)
+{
+ elm_object_focus_set(obj, EINA_TRUE);
+}
+
+static int _add_btn(struct _xbar_data *bar, Evas_Object *popup)
+{
+ Evas_Object *btn;
+ struct _btn_info btn_info[] = {
+ {
+ "button1",
+ "Delete",
+ _del_clicked
+ },
+ {
+ "button2",
+ "Delete All",
+ _del_all_clicked
+ },
+ {
+ "button3",
+ "Cancel",
+ _cancel_clicked
+ }
+ };
+ int i;
+
+ if (!bar || !popup) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ for (i = 0; i < sizeof(btn_info) / sizeof(*btn_info); i++) {
+ btn = elm_button_add(popup);
+ if (!btn) {
+ _ERR("failed to create button");
+ memset(bar->btn, 0x00, sizeof(bar->btn));
+ return -1;
+ }
+ elm_object_part_content_set(popup, btn_info[i].part, btn);
+ elm_object_text_set(btn, btn_info[i].text);
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_show(btn);
+ bar->btn[i] = btn;
+
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_DOWN,
+ btn_info[i].click_cb, bar);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_MOVE,
+ _btn_mouse_over, bar);
+
+ if (i == 0)
+ elm_object_focus_set(btn, EINA_TRUE);
+ }
+
+ return 0;
+}
+
+static Evas_Object *_load_popup(Evas_Object *base,
+ enum engine_dbar_content_type type)
+{
+ Evas_Object *popup;
+ char title[TITLE_MAX];
+ char message[MESSAGE_MAX];
+
+ if (!base || type < 0) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ popup = elm_popup_add(base);
+ if (!popup) {
+ _ERR("failed to create popup");
+ return NULL;
+ }
+ elm_object_style_set(popup, STYLE_POPUP_1LINE_2BUTTON);
+ elm_object_part_text_set(popup, PART_POPUP_TEXT, TITLE_DELETE);
+ elm_object_focus_allow_set(popup, EINA_FALSE);
+ evas_object_show(popup);
+
+ switch (type) {
+ case ENGINE_DBAR_CONTENT_TYPE_NOTIFICATION_NOTI:
+ snprintf(title, sizeof(title), "%s %s",
+ TITLE_DELETE, TITLE_NOTIFICATION);
+ snprintf(message, sizeof(message), "%s %s?",
+ MESSAGE_DELETE, MESSAGE_NOTIFICATION);
+ break;
+ case ENGINE_DBAR_CONTENT_TYPE_HISTORY:
+ snprintf(title, sizeof(title), "%s %s",
+ TITLE_DELETE, TITLE_HISTORY);
+ snprintf(message, sizeof(message), "%s %s?",
+ MESSAGE_DELETE, MESSAGE_HISTORY);
+ break;
+ default:
+ _ERR("Invalid Type");
+ evas_object_del(popup);
+ return NULL;
+ }
+
+ elm_object_text_set(popup, message);
+ elm_object_part_text_set(popup, PART_POPUP_TEXT, title);
+
+ return popup;
+}
+
+static Eina_Bool _add_popup(struct bar_info *info)
+{
+ struct _xbar_data *bar;
+ Evas_Object *popup, *win;
+ enum engine_dbar_content_type type;
+ int r;
+
+ if (!info) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ bar = info->data;
+ if (bar->popup) {
+ _ERR("Already popup created");
+ evas_object_del(bar->popup);
+ bar->popup = NULL;
+ return EINA_FALSE;
+ }
+
+ win = elm_object_top_widget_get(bar->base);
+ if (!win) {
+ _ERR("failed to get win eo");
+ return EINA_FALSE;
+ }
+
+ type = _get_ctnt_type(bar->it);
+ if (type < 0) {
+ _ERR("failed to get ctnt type");
+ return EINA_FALSE;
+ }
+
+ popup = _load_popup(win, type);
+ if (!popup) {
+ _ERR("failed to add popup");
+ return EINA_FALSE;
+ }
+
+ r = _add_btn(bar, popup);
+ if (r < 0) {
+ _ERR("failed to add btn");
+ evas_object_del(popup);
+ return EINA_FALSE;
+ }
+
+ bar->popup = popup;
+ bar->state = XBAR_STATE_POPUP;
+
+ return EINA_TRUE;
+}
+
+static enum bar_event _enter(struct bar_info *info)
+{
+ struct _xbar_data *bar;
+ Eina_Bool r;
+
+ if (!info) {
+ _ERR("Invalid argument");
+ return BAR_EVENT_ERROR;
+ }
+
+ bar = info->data;
+ r = EINA_FALSE;
+
+ switch (bar->state) {
+ case XBAR_STATE_XBAR:
+ r = _add_popup(info);
+ break;
+ case XBAR_STATE_POPUP:
+ if (!bar->popup)
+ return BAR_EVENT_ERROR;
+
+ if (elm_object_focus_get(bar->btn[0])) {
+ _del_item(bar);
+ r = EINA_TRUE;
+ } else if (elm_object_focus_get(bar->btn[1])) {
+ _del_all_item(bar);
+ r = EINA_TRUE;
+ } else if (elm_object_focus_get(bar->btn[2])) {
+ _free_popup(bar);
+ return BAR_EVENT_MOVE;
+ }
+ break;
+ default:
+ return BAR_EVENT_ERROR;
+ }
+
+ return r ? BAR_EVENT_DONE : BAR_EVENT_PASS;
+}
+
+static Eina_Bool _is_move(struct bar_info *info, int dir)
+{
+ if (!info) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ return EINA_TRUE;
+}
+
+static enum bar_event _back(struct bar_info *info)
+{
+ struct _xbar_data *bar;
+
+ if (!info) {
+ _ERR("Invalid argument");
+ return BAR_EVENT_ERROR;
+ }
+
+ bar = info->data;
+
+ switch (bar->state) {
+ case XBAR_STATE_XBAR:
+ return BAR_EVENT_MOVE;
+ case XBAR_STATE_POPUP:
+ if (!bar->popup)
+ break;
+
+ _free_popup(bar);
+ return BAR_EVENT_MOVE;
+ default:
+ break;
+ }
+
+ return BAR_EVENT_ERROR;
+}
+
+static enum bar_event _key_down(struct bar_info *info, void *ei)
+{
+ struct _xbar_data *bar;
+ Ecore_Event_Key *ev;
+ enum bar_event r;
+
+ if (!info || !ei)
+ return BAR_EVENT_ERROR;
+
+ ev = ei;
+ bar = info->data;
+
+ if (!strcmp(ev->keyname, KEY_ENTER)) {
+ r = _enter(info);
+ } else if (!strcmp(ev->keyname, KEY_RIGHT)) {
+ r = BAR_EVENT_PASS;
+ } else if (!strcmp(ev->keyname, KEY_LEFT)) {
+ if (bar->state == XBAR_STATE_XBAR)
+ r = BAR_EVENT_MOVE;
+ else
+ r = BAR_EVENT_PASS;
+ } else if (!strcmp(ev->keyname, KEY_BACK)) {
+ r = _back(info);
+ } else
+ r = BAR_EVENT_DONE;
+
+ return r;
+}
+
+static inline Evas_Object *_add_item_bg(Evas_Object *base,
+ struct engine_dbar_item *it)
+{
+ Evas_Object *bg;
+ int r, g, b;
+
+ if (!base || !it) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ bg = evas_object_rectangle_add(evas_object_evas_get(base));
+ if (!bg) {
+ _ERR("bg add failed");
+ return NULL;
+ }
+
+ r = ITEM_DEFAULT_BG_R;
+ g = ITEM_DEFAULT_BG_G;
+ b = ITEM_DEFAULT_BG_B;
+
+ engine_dbar_item_get_color(it, &r, &g, &b);
+ evas_object_color_set(bg, r, g, b, 255);
+
+ return bg;
+}
+
+static Eina_Bool _move(struct bar_info *info)
+{
+ struct _xbar_data *bar;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return EINA_FALSE;
+ }
+
+ bar = info->data;
+
+ elm_object_focus_allow_set(bar->ly, EINA_TRUE);
+ elm_object_focus_set(bar->ly, EINA_TRUE);
+
+ return EINA_TRUE;
+}
+
+static Evas_Object *_get_object(struct bar_info *info)
+{
+ struct _xbar_data *bar;
+
+ if (!info || !info->data) {
+ _ERR("Invalid argument");
+ return NULL;
+ }
+
+ bar = info->data;
+
+ return bar->ly;
+}
+
+static int _update(struct bar_info *info, void *eng, void *data)
+{
+ struct _xbar_data *bar;
+ Evas_Object *bg1, *bg2, *eo;
+ Evas_Coord x, y;
+
+ if (!info || !info->data || !eng || !data) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ bar = info->data;
+ eo = data;
+
+ if (!bar->bg) {
+ bg1 = _add_item_bg(bar->ly, eng);
+ if (!bg1) {
+ _ERR("bg add failed");
+ return -1;
+ }
+ elm_object_part_content_set(bar->ly, PART_BG, bg1);
+
+ bg2 = _add_item_bg(bar->ly, eng);
+ if (!bg2) {
+ _ERR("bg add failed");
+ evas_object_del(bg1);
+ return -1;
+ }
+ elm_object_part_content_set(bar->ly, PART_BG2, bg2);
+ evas_object_color_set(bg2, 0, 0, 0, 216);
+ bar->bg = bg1;
+ }
+
+ elm_object_focus_allow_set(bar->ly, EINA_TRUE);
+ evas_object_show(bar->ly);
+
+ evas_object_geometry_get(eo, &x, &y, NULL, NULL);
+ evas_object_move(bar->ly, (x + XBAR_W) * elm_config_scale_get(),
+ (y + XBAR_H) * elm_config_scale_get());
+
+ bar->it = eng;
+ bar->state = XBAR_STATE_XBAR;
+
+ return 0;
+}
+
+static int _add_bar(struct bar_info *info, Evas_Object *base)
+{
+ Evas_Object *ly;
+ struct _xbar_data *bar;
+
+ if (!base || !info || !info->data) {
+ _ERR("Invalid argument");
+ return -1;
+ }
+
+ bar = info->data;
+
+ ly = elm_layout_add(base);
+ if (!ly) {
+ _ERR("layout add failed");
+ return -1;
+ }
+ elm_layout_file_set(ly, EDJEFILE, GRP_CBAR_X);
+
+ evas_object_smart_callback_add(ly, "focused", _focused, bar);
+ evas_object_event_callback_add(ly, EVAS_CALLBACK_MOUSE_UP,
+ _clicked, bar);
+ evas_object_event_callback_add(ly, EVAS_CALLBACK_MOUSE_MOVE,
+ _mouse_over, bar);
+
+ bar->base = base;
+ bar->ly = ly;
+ bar->xbar = info;
+
+ return 0;
+}
+
+static void _hide(struct bar_info *info)
+{
+ struct _xbar_data *bar;
+
+ if (!info) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ bar = info->data;
+
+ elm_object_signal_emit(bar->ly, SIG_HIDE, SRC_PROG);
+ elm_object_signal_emit(bar->ly, SIG_HIDE_TO_HBAR, SRC_PROG);
+ elm_object_focus_set(bar->ly, EINA_FALSE);
+ elm_object_focus_allow_set(bar->ly, EINA_FALSE);
+
+ bar->state = XBAR_STATE_HIDE;
+}
+
+static void _show(struct bar_info *info)
+{
+ struct _xbar_data *bar;
+
+ if (!info) {
+ _ERR("Invalid argument");
+ return;
+ }
+
+ bar = info->data;
+
+ elm_object_focus_allow_set(bar->ly, EINA_TRUE);
+ elm_object_focus_set(bar->ly, EINA_TRUE);
+}
+
+static struct bar_ops xbar_ops = {
+ .add_bar = _add_bar,
+ .update = _update,
+ .get_object = _get_object,
+ .is_move = _is_move,
+ .move = _move,
+ .show = _show,
+ .hide = _hide,
+ .key_down = _key_down,
+ .release = _release,
+};
+
+int init_delete_bar(struct bar_info *info)
+{
+ struct _xbar_data *bar;
+
+ if (!info)
+ return -1;
+
+ bar = calloc(1, sizeof(*bar));
+ if (!bar) {
+ _ERR("calloc failed");
+ return -1;
+ }
+
+ info->data = bar;
+ info->ops = &xbar_ops;
+
+ if (!info->cb.func) {
+ _ERR("invalid callback function");
+ free(bar);
+ return -1;
+ }
+
+ bar->focus_cb = info->cb;
+ bar->state = XBAR_STATE_HIDE;
+
+ return 0;
+}