/* * Copyright (c) 20014-2015 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. */ //****************************************************************************// // Button //****************************************************************************// #define BUTTON_MIN_WIDTH_INC 50 #define BUTTON_MIN_HEIGHT_INC 78 #define BUTTON_BOTTOM_MIN_WIDTH_INC 118 #define BUTTON_BOTTOM_MIN_HEIGHT_INC 104 #define BUTTON_BG_MIN_HEIGHT_INC 44 #define BUTTON_PADDING_ICON_RIGHT_INC 14 #define BUTTON_PADDING_LEFT_RIGHT_INC 32 #define BUTTON_PADDING_LEFT_ICON_TEXT_INC 56 #define BUTTON_BG_PADDING_LEFT_RIGHT_INC 22 #define BUTTON_PADDING_TOP_HEIGHT_INC 10 #define BUTTON_PADDING_BOTTOM_HEIGHT_INC 14 #define BUTTON_BOTTOM_PADDING_TOP_HEIGHT_INC 22 #define BUTTON_BOTTOM_PADDING_BOTTOM_HEIGHT_INC 28 #define BUTTON_ICON_HEIGHT_INC 80 #define BUTTON_ICON_WIDTH_INC 80 #define BUTTON_ICON_DEFAULT_HEIGHT_INC 60 #define BUTTON_ICON_DEFAULT_WIDTH_INC 60 #define BUTTON_CIRCLE_SIZE_INC 98 98 #define BUTTON_CIRCLE_BASE_SIZE_INC 100 98 #define BUTTON_CIRCLE_EXTENDED_SIZE_INC 100 199 #define BUTTON_CIRCLE_ICON_SIZE_INC 60 60 #define BUTTON_CIRCLE_PADDING_ICON_BOTTOM_INC 13 #define BUTTON_NAVIFRAME_TITLE_BUTTON_SIZE_INC 67 67 #define BUTTON_NAVIFRAME_TITLE_BUTTON_BG_SIZE_INC 67 67 #define BUTTON_NAVIFRAME_TITLE_BUTTON_IMAGE_SIZE_INC 67 67 #define BUTTON_NAVIFRAME_DRAWERS_WIDTH_INC 55 #define BUTTON_NAVIFRAME_DRAWERS_IMAGE_SIZE_INC 55 72 #define BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC 80 80 #define BUTTON_NAVIFRAME_TITLE_LEFT_BUTTON_SIZE_INC 150 70 #define BUTTON_NAVIFRAME_TITLE_LEFT_BUTTON_LEFT_PADDING_WIDTH_INC 32 #define BUTTON_NAVIFRAME_TITLE_LEFT_BUTTON_RIGHT_PADDING_WIDTH_INC 23 #define BUTTON_NAVIFRAME_TITLE_RIGHT_BUTTON_LEFT_PADDING_WIDTH_INC 23 #define BUTTON_NAVIFRAME_TITLE_RIGHT_BUTTON_RIGHT_PADDING_WIDTH_INC 32 #define STYLE_TAGS \ tag: "br" "\n";\ tag: "ps" "ps";\ tag: "tab" "\t";\ tag: "b" "+ font_weight=Bold"; #define STYLE_TAG_MATCH \ tag: "match" "+ color=#3db8cc"; collections { base_scale: 2.4; styles{ style { name: "button_title_right"; base: "color=#ffffffdd align=center font=Tizen:style=Regular font_size=32 text_class=tizen wrap=mixed ellipsis=1.0"; STYLE_TAGS } style { name: "button_title_right_press"; base: "color=#ffffffff align=center font=Tizen:style=Regular font_size=32 text_class=tizen wrap=mixed ellipsis=1.0"; STYLE_TAGS } style { name: "button_title_right_dim"; base: "color=#ffffff92 align=center font=Tizen:style=Regular font_size=32 text_class=tizen wrap=mixed ellipsis=1.0"; STYLE_TAGS } } group { name: "elm/button/base/naviframe/title_left_custom"; script { public mouse_down = 0; public multi_down = 0; public check_disabled = 0; } parts { part { name: "button_bg"; type: RECT; scale: 1; mouse_events: 0; clip_to: "button_bg_clipper"; description { state: "default" 0.0; min: BUTTON_NAVIFRAME_TITLE_LEFT_BUTTON_SIZE_INC; max: BUTTON_NAVIFRAME_TITLE_LEFT_BUTTON_SIZE_INC; fixed: 1 1; color: 0 0 0 0 ; } description { state: "pressed" 0.0; inherit: "default" 0.0; color: 0 0 0 30 ; } } part { name: "button_bg_clipper"; type: RECT; mouse_events: 0; description { state: "default" 0.0; rel1.to: "button_bg"; rel2.to: "button_bg"; color: 255 255 255 255; } description { state: "pressed" 0.0; inherit: "default" 0.0; color: 193 193 193 255; } description { state: "disabled" 0.0; inherit: "default" 0.0; color: 61 185 204 77; } } part { name: "left_padding"; type: SPACER; scale: 1; mouse_events: 0; description { state: "default" 0.0; min: BUTTON_NAVIFRAME_TITLE_LEFT_BUTTON_LEFT_PADDING_WIDTH_INC 0; max: BUTTON_NAVIFRAME_TITLE_LEFT_BUTTON_LEFT_PADDING_WIDTH_INC -1; align: 0.0 0.0; fixed: 1 1; rel1 { to: "button_bg"; relative: 0.0 0.0; } rel2 { to: "button_bg"; relative: 0.0 1.0; } } } part { name: "right_padding"; type: SPACER; scale: 1; mouse_events: 0; description { state: "default" 0.0; min: BUTTON_NAVIFRAME_TITLE_LEFT_BUTTON_RIGHT_PADDING_WIDTH_INC 0; max: BUTTON_NAVIFRAME_TITLE_LEFT_BUTTON_RIGHT_PADDING_WIDTH_INC -1; align: 1.0 0.0; fixed: 1 1; rel1 { to: "button_bg"; relative: 1.0 0.0; } rel2 { to: "button_bg"; relative: 1.0 1.0; } } } part { name: "elm.text"; type: TEXTBLOCK; scale: 1; mouse_events: 0; description { state: "default" 0.0; align: 0.0 0.5; rel1 { to: "left_padding"; relative: 1.0 0.0; } rel2 { to: "right_padding"; relative: 0.0 1.0; } text { style: "button_title_left"; min: 0 1; } } description { state: "pressed" 0.0; inherit: "default" 0.0; text.style: "button_title_left_press"; } description { state: "disabled" 0.0; inherit: "default" 0.0; text.style: "button_title_left_dim"; } } part { name: "over2"; type: RECT; ignore_flags: ON_HOLD; description { state: "default" 0.0; rel1.to: "button_bg"; rel2.to: "button_bg"; color: 0 0 0 0; } } part { name: "over3"; type: RECT; repeat_events: 1; description { state: "default" 0.0; rel1.to: "button_bg"; rel2.to: "button_bg"; color: 0 0 0 0; } } part { name: "disabler"; type: RECT; description { state: "default" 0.0; rel1.to: "button_bg"; rel2.to: "button_bg"; color: 0 0 0 0; visible: 0; } description { state: "disabled" 0.0; inherit: "default" 0.0; visible: 1; } } } programs { program { name: "button_press"; signal: "mouse,down,1*"; source: "over2"; script { if ((get_int(multi_down) == 0) && (get_int(mouse_down) == 0)) { set_int(mouse_down, 1); set_state(PART:"button_bg", "pressed", 0.0); emit("elm,action,press", ""); } } } program { name: "button_unpress"; signal: "mouse,up,1*"; source: "over3"; script { if (get_int(mouse_down) == 1) { set_int(mouse_down, 0); set_state(PART:"button_bg", "default", 0.0); emit("elm,action,unpress", ""); } } } program { name: "button_click"; signal: "mouse,clicked,1"; source: "over2"; script { if (get_int(multi_down) == 0) { run_program(PROGRAM:"play_sound"); emit("elm,action,click", ""); } } } program { name: "play_sound"; action: RUN_PLUGIN "touch_sound"; } program { name: "key_press"; signal: "elm,action,pressed"; source: "elm"; action: STATE_SET "pressed" 0.0; target: "button_bg_clipper"; } program { name: "key_unpress"; signal: "elm,action,unpressed"; source: "elm"; action: STATE_SET "default" 0.0; target: "button_bg_clipper"; } program { name: "enable"; signal: "elm,state,enabled"; source: "elm"; action: STATE_SET "default" 0.0; target: "button_bg_clipper"; target: "elm.text"; target: "disabler"; } program { name: "disable"; signal: "elm,state,disabled"; source: "elm"; action: STATE_SET "disabled" 0.0; target: "button_bg_clipper"; target: "elm.text"; target: "disabler"; } program { name: "multi_down"; signal: "elm,action,multi,down"; source: "elm"; script { set_int(multi_down, 1); } } program { name: "multi_up"; signal: "elm,action,multi,up"; source: "elm"; script { set_int(multi_down, 0); } } } } group { name: "elm/button/base/naviframe/title_right_custom"; inherit: "elm/button/base/naviframe/title_left_custom"; parts { part { name: "left_padding"; type: SPACER; scale: 1; mouse_events: 0; description { state: "default" 0.0; min: BUTTON_NAVIFRAME_TITLE_RIGHT_BUTTON_LEFT_PADDING_WIDTH_INC 0; max: BUTTON_NAVIFRAME_TITLE_RIGHT_BUTTON_LEFT_PADDING_WIDTH_INC -1; align: 0.0 0.0; fixed: 1 1; rel1 { to: "button_bg"; relative: 0.0 0.0; } rel2 { to: "button_bg"; relative: 0.0 1.0; } } } part { name: "right_padding"; type: SPACER; scale: 1; mouse_events: 0; description { state: "default" 0.0; min: BUTTON_NAVIFRAME_TITLE_RIGHT_BUTTON_RIGHT_PADDING_WIDTH_INC 0; max: BUTTON_NAVIFRAME_TITLE_RIGHT_BUTTON_RIGHT_PADDING_WIDTH_INC -1; align: 1.0 0.0; fixed: 1 1; rel1 { to: "button_bg"; relative: 1.0 0.0; } rel2 { to: "button_bg"; relative: 1.0 1.0; } } } part { name: "elm.text"; type: TEXTBLOCK; scale: 1; mouse_events: 0; description { state: "default" 0.0; align: 1.0 0.5; rel1 { to: "left_padding"; relative: 1.0 0.0; } rel2 { to: "right_padding"; relative: 0.0 1.0; } text { style: "button_title_right"; min: 0 1; } } description { state: "pressed" 0.0; inherit: "default" 0.0; text.style: "button_title_right_press"; } description { state: "disabled" 0.0; inherit: "default" 0.0; text.style: "button_title_right_dim"; } } } } group { name: "elm/button/base/naviframe/back_btn/custom"; alias: "elm/button/base/naviframe/end_btn/default"; images { set { name: "core_icon_back"; image { image: "icons/core_icon_back.png" COMP; } } } script { public mouse_down = 0; public multi_down = 0; public check_disabled = 0; } parts { part { name: "button_bg"; type: RECT; scale: 1; mouse_events: 0; clip_to: "button_bg_clipper"; description { state: "default" 0.0; min: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC; max: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC; fixed: 1 1; color: 0 0 0 0; } description { state: "pressed" 0.0; inherit: "default" 0.0; color: 0 0 0 30; } } part { name: "button_bg_clipper"; type: RECT; mouse_events: 0; description { state: "default" 0.0; rel1.to: "button_bg"; rel2.to: "button_bg"; color: 255 255 255 255; } description { state: "pressed" 0.0; inherit: "default" 0.0; color: 193 193 193 255; } } part { name: "button_icon"; type: IMAGE; scale: 1; mouse_events: 0; description { state: "default" 0.0; min: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC; max: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC; fixed: 1 1; color: 255 255 255 255; image.normal: "core_icon_back"; } } part { name: "over2"; type: RECT; ignore_flags: ON_HOLD; description { state: "default" 0.0; rel1.to: "button_bg"; rel2.to: "button_bg"; color: 0 0 0 0; } } part { name: "over3"; type: RECT; repeat_events: 1; description { state: "default" 0.0; rel1.to: "button_bg"; rel2.to: "button_bg"; color: 0 0 0 0; } } part { name: "disabler"; type: RECT; description { state: "default" 0.0; rel1.to: "button_bg"; rel2.to: "button_bg"; color: 0 0 0 0; visible: 0; } description { state: "disabled" 0.0; inherit: "default" 0.0; visible: 1; } } } programs { program { name: "button_press"; signal: "mouse,down,1*"; source: "over2"; script { if ((get_int(multi_down) == 0) && (get_int(mouse_down) == 0)) { set_int(mouse_down, 1); set_state(PART:"button_bg", "pressed", 0.0); emit("elm,action,press", ""); } } } program { name: "button_unpress"; signal: "mouse,up,1*"; source: "over3"; script { if (get_int(mouse_down) == 1) { set_int(mouse_down, 0); set_state(PART:"button_bg", "default", 0.0); emit("elm,action,unpress", ""); } } } program { name: "button_click"; signal: "mouse,clicked,1"; source: "over2"; script { if (get_int(multi_down) == 0) { run_program(PROGRAM:"play_sound"); emit("elm,action,click", ""); } } } program { name: "play_sound"; action: RUN_PLUGIN "touch_sound"; } program { name: "key_press"; signal: "elm,action,pressed"; source: "elm"; action: STATE_SET "pressed" 0.0; target: "button_bg_clipper"; } program { name: "key_unpress"; signal: "elm,action,unpressed"; source: "elm"; action: STATE_SET "default" 0.0; target: "button_bg_clipper"; } program { name: "enable"; signal: "elm,state,enabled"; source: "elm"; action: STATE_SET "default" 0.0; target: "button_bg_clipper"; } program { name: "disable"; signal: "elm,state,disabled"; source: "elm"; action: STATE_SET "disabled" 0.0; target: "button_bg_clipper"; } program { name: "multi_down"; signal: "elm,action,multi,down"; source: "elm"; script { set_int(multi_down, 1); } } program { name: "multi_up"; signal: "elm,action,multi,up"; source: "elm"; script { set_int(multi_down, 0); } } } } }