/* * 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; } } } }