diff options
Diffstat (limited to 'ug_radio.edc')
-rw-r--r-- | ug_radio.edc | 566 |
1 files changed, 566 insertions, 0 deletions
diff --git a/ug_radio.edc b/ug_radio.edc new file mode 100644 index 0000000..d1da3a7 --- /dev/null +++ b/ug_radio.edc @@ -0,0 +1,566 @@ +/* +* Copyright (c) 2000-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. +* +*/ + + + +#define RADIO_HIDE 0 +#define RADIO_SHOW 1 +#define RADIO_STATE_DEFAULT 0 // radio is off +#define RADIO_STATE_VISIBLE 1 // radio is on + +#define RADIO_STYLE_DEFAULT_BG_IMAGE_MIN_WIDTH_INC 63 +#define RADIO_STYLE_DEFAULT_BG_IMAGE_MIN_HEIGHT_INC 63 +#define RADIO_STYLE_DEFAULT_EXTENDED_BG_IMAGE_MIN_WIDTH_INC 76 +#define RADIO_STYLE_DEFAULT_EXTENDED_BG_IMAGE_MIN_WIDTH_INC 76 +#define RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC 63 63 +#define RADIO_STYLE_DEFAULT_FONT_SIZE_INC 36 +#define RADIO_STYLE_DEFAULT_PADDING_BEFORE_TEXT_INC 16 0 +#define RADIO_DISCLIP_NORMAL_COLOR_INC 255 255 255 255 +#define RADIO_DISCLIP_DISABLED_COLOR_INC 255 255 255 128 + +#define RADIO_STYLE_DEFAULT(style_name, min_width, min_height) \ + group { name: "elm/radio/base/"style_name; \ + images { \ + image: "00_button_radio_activate.png" COMP; \ + image: "00_button_radio_activate_ef.png" COMP; \ + image: "00_button_radio_bg.png" COMP; \ + image: "00_button_radio_bg_ef.png" COMP; \ + image: "00_button_radio_bg_line.png" COMP; \ + image: "00_button_radio_focus.png" COMP; \ + } \ + script { \ + public radio_state = RADIO_STATE_DEFAULT; \ + public radio_visible = RADIO_HIDE; \ + } \ + parts { \ + part { name: "back_bg"; \ + type: RECT; \ + scale: 1; \ + description { state: "default" 0.0; \ + rel2.relative: 0.0 1.0; \ + align: 0 0.5; \ + min: min_width min_height; \ + fixed: 1 0; \ + color: 0 0 0 0; \ + } \ + } \ + part { name: "bg"; \ + mouse_events: 0; \ + scale: 1; \ + description { state: "default" 0.0; \ + min: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \ + max: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \ + fixed: 1 1; \ + rel1.to: "back_bg"; \ + rel2.to: "back_bg"; \ + image.normal: "00_button_radio_bg.png"; \ + color_class: "W014L1"; \ + } \ + description { state: "disabled" 0.0; \ + inherit: "default" 0.0; \ + color_class: "W014L1D"; \ + } \ + description { state: "pressed" 0.0; \ + inherit: "default" 0.0; \ + color_class: "W014L1P"; \ + } \ + } \ + part { name: "bg_effect"; \ + mouse_events: 0; \ + scale: 1; \ + description { state: "default" 0.0; \ + min: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \ + max: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \ + fixed: 1 1; \ + rel1.to: "back_bg"; \ + rel2.to: "back_bg"; \ + image.normal: "00_button_radio_bg_ef.png"; \ + } \ + description { state: "disabled" 0.0; \ + inherit: "default" 0.0; \ + visible: 0; \ + } \ + } \ + part { name: "bg_line"; \ + mouse_events: 0; \ + scale: 1; \ + description { state: "default" 0.0; \ + min: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \ + max: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \ + fixed: 1 1; \ + rel1.to: "back_bg"; \ + rel2.to: "back_bg"; \ + image.normal: "00_button_radio_bg_line.png"; \ + color_class: "W014L2"; \ + } \ + description { state: "disabled" 0.0; \ + inherit: "default" 0.0; \ + color_class: "W014L2D"; \ + } \ + description { state: "pressed" 0.0; \ + inherit: "default" 0.0; \ + color_class: "W014L2P"; \ + } \ + } \ + part { name: "radio"; \ + clip_to: "opacity_clip"; \ + mouse_events: 0; \ + scale: 1; \ + description { state: "default" 0.0; \ + rel1.to: "bg"; \ + rel2.to: "bg"; \ + max: 0 0; \ + image.normal: "00_button_radio_activate.png"; \ + visible: 0; \ + } \ + description { state: "visible" 0.0; \ + inherit: "default" 0.0; \ + visible: 1; \ + max: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \ + color_class: "W014L3"; \ + } \ + description { state: "disabled" 0.0; \ + inherit: "default" 0.0; \ + color_class: "W014L3D"; \ + } \ + description { state: "disabled_visible" 0.0; \ + inherit: "visible" 0.0; \ + color_class: "W014L3D"; \ + } \ + description { state: "pressed" 0.0; \ + inherit: "visible" 0.0; \ + color_class: "W014L3P"; \ + } \ + } \ + part { name: "radio_effect"; \ + clip_to: "opacity_clip"; \ + mouse_events: 0; \ + scale: 1; \ + description { state: "default" 0.0; \ + rel1.to: "bg"; \ + rel2.to: "bg"; \ + max: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \ + visible: 0; \ + image.normal: "00_button_radio_activate_ef.png"; \ + } \ + description { state: "visible" 0.0; \ + inherit: "default" 0.0; \ + visible: 1; \ + } \ + } \ + part { name: "opacity_clip"; \ + type: RECT; \ + mouse_events: 0; \ + description { state: "default" 0.0; \ + rel1.to: "bg"; \ + rel2.to: "bg"; \ + color: 255 255 255 0; \ + } \ + description { state: "visible" 0.0; \ + inherit: "default" 0.0; \ + color: 255 255 255 255; \ + } \ + } \ + part { name: "focus_image"; \ + scale: 1; \ + description { state: "default" 0.0; \ + rel1.to: "radio"; \ + rel2.to: "radio"; \ + image.normal: "00_button_radio_focus.png" ;\ + visible: 0; \ + color_class: "W161"; \ + } \ + description { state: "focused_on" 0.0; \ + inherit: "default" 0.0; \ + visible: 1; \ + } \ + } \ + part { name: "elm.swallow.content"; \ + type: SWALLOW; \ + clip_to: "disclip"; \ + description { state: "default" 0.0; \ + fixed: 1 0; \ + visible: 0; \ + align: 0.0 0.5; \ + rel1 { \ + to_x: "bg"; \ + relative: 1.0 0.0; \ + } \ + rel2 { \ + to_x: "bg"; \ + } \ + } \ + description { state: "visible" 0.0; \ + inherit: "default" 0.0; \ + fixed: 1 1; \ + visible: 1; \ + aspect: 1.0 1.0; \ + aspect_preference: VERTICAL; \ + } \ + description { state: "disabled" 0.0; \ + inherit: "default" 0.0; \ + } \ + description { state: "disabled_visible" 0.0; \ + inherit: "default" 0.0; \ + fixed: 1 1; \ + visible: 1; \ + aspect: 1.0 1.0; \ + } \ + } \ + part { name: "padding_before_text"; \ + type: SPACER; \ + scale: 1; \ + description { state: "default" 0.0; \ + align: 0.0 0.5; \ + min: 0 0; \ + fixed: 1 1; \ + rel1 { \ + to_x: "elm.swallow.content"; \ + relative: 1.0 0.0; \ + } \ + rel2 { \ + to_x: "elm.swallow.content"; \ + relative: 1.0 1.0; \ + } \ + } \ + description { state: "visible" 0.0; \ + inherit: "default" 0.0; \ + min: RADIO_STYLE_DEFAULT_PADDING_BEFORE_TEXT_INC; \ + max: RADIO_STYLE_DEFAULT_PADDING_BEFORE_TEXT_INC; \ + fixed: 1 1; \ + } \ + } \ + part { name: "elm.text"; \ + type: TEXTBLOCK; \ + mouse_events: 0; \ + clip_to: "disclip"; \ + scale: 1; \ + description { state: "default" 0.0; \ + visible: 0; \ + fixed: 1 1; \ + rel1 { \ + relative: 1.0 0.0; \ + to_x: "padding_before_text"; \ + } \ + rel2 { \ + relative: 1.0 1.0; \ + offset: 0 0; \ + } \ + text { \ + style: "radio_label_textblock_style"; \ + align: 0.0 0.5; \ + min: 0 0; \ + } \ + } \ + description { state: "visible" 0.0; \ + inherit: "default" 0.0; \ + visible: 1; \ + text.min: 0 0; \ + } \ + description { state: "disabled" 0.0; \ + inherit: "default" 0.0; \ + } \ + description { state: "disabled_visible" 0.0; \ + inherit: "default" 0.0; \ + visible: 1; \ + text { \ + style: "radio_label_textblock_style_disable"; \ + align: 0.0 0.5; \ + min: 0 0; \ + } \ + } \ + } \ + part { name: "over1"; \ + type: RECT; \ + ignore_flags: ON_HOLD; \ + description { state: "default" 0.0; \ + color: 0 0 0 0; \ + } \ + } \ + part { name: "over2"; \ + type: RECT; \ + repeat_events:1; \ + description { state: "default" 0.0; \ + color: 0 0 0 0; \ + } \ + } \ + part { name: "disclip"; \ + type: RECT; \ + mouse_events: 0; \ + description { state: "default" 0.0; \ + color: RADIO_DISCLIP_NORMAL_COLOR_INC; \ + } \ + description { state: "disabled" 0.0; \ + color: RADIO_DISCLIP_DISABLED_COLOR_INC; \ + } \ + } \ + part { name: "disabler"; \ + type: RECT; \ + description { state: "default" 0.0; \ + visible: 0; \ + } \ + description { state: "disabled" 0.0; \ + inherit: "default" 0.0; \ + visible: 1; \ + color: 0 0 0 0; \ + } \ + } \ + } \ + programs { \ + program { name: "show"; \ + signal: "show"; \ + script { \ + set_int(radio_visible, RADIO_SHOW); \ + } \ + } \ + program { name: "hide"; \ + signal: "hide"; \ + script { \ + set_int(radio_visible, RADIO_HIDE); \ + } \ + } \ + program { name: "click"; \ + signal: "mouse,clicked,1"; \ + source: "over1"; \ + action: SIGNAL_EMIT "elm,action,radio,toggle" ""; \ + } \ + program { name: "bg_normal"; \ + signal: "mouse,up,1"; \ + source: "over2"; \ + script { \ + if (get_int(radio_state) == RADIO_STATE_VISIBLE) \ + set_state(PART:"radio", "visible", 0.0); \ + else \ + set_state(PART:"radio", "default", 0.0); \ + set_state(PART:"bg", "default", 0.0); \ + set_state(PART:"bg_line", "default", 0.0); \ + } \ + } \ + program { name: "pressed"; \ + signal: "mouse,down,1"; \ + source: "over2"; \ + script { \ + if (get_int(radio_state) == RADIO_STATE_VISIBLE) \ + set_state(PART:"radio", "pressed", 0.0); \ + else \ + set_state(PART:"radio", "default", 0.0); \ + set_state(PART:"bg", "pressed", 0.0); \ + set_state(PART:"bg_line", "pressed", 0.0); \ + } \ + } \ + program { name: "mouse,out"; \ + signal: "mouse,out"; \ + source: "over2"; \ + script { \ + if (get_int(radio_state) == RADIO_STATE_VISIBLE) { \ + set_state(PART:"radio", "visible", 0.0); \ + set_state(PART:"radio_effect", "visible", 0.0); \ + } \ + else \ + set_state(PART:"radio", "default", 0.0); \ + set_state(PART:"bg", "default", 0.0); \ + set_state(PART:"bg_line", "default", 0.0); \ + } \ + } \ + program { name: "radio_on"; \ + signal: "elm,state,radio,on"; \ + source: "elm"; \ + script { \ + set_int(radio_state, RADIO_STATE_VISIBLE); \ + if (get_int(radio_visible) == RADIO_SHOW) \ + { \ + run_program(PROGRAM:"radio_show_effect"); \ + run_program(PROGRAM:"radio_draw_effect"); \ + } \ + else \ + { \ + set_state(PART:"radio", "visible", 0.0); \ + set_state(PART:"opacity_clip", "visible", 0.0); \ + set_state(PART:"radio_effect", "visible", 0.0); \ + } \ + } \ + } \ + program { name: "radio_off"; \ + signal: "elm,state,radio,off"; \ + source: "elm"; \ + script { \ + if (get_int(radio_state) == RADIO_STATE_VISIBLE) \ + { \ + set_int(radio_state, RADIO_STATE_DEFAULT); \ + set_state(PART:"radio", "default", 0.0); \ + set_state(PART:"radio_effect", "default", 0.0); \ + set_state(PART:"opacity_clip", "default", 0.0); \ + } \ + } \ + } \ + program { name: "radio_show_effect"; \ + action: STATE_SET "visible" 0.0; \ + transition: LINEAR 0.233; \ + target: "opacity_clip"; \ + } \ + program { name: "radio_draw_effect"; \ + action: STATE_SET "visible" 0.0; \ + transition: LINEAR 0.267; \ + target: "radio"; \ + target: "radio_effect"; \ + after: "radio_on_signal"; \ + } \ + program { name: "radio_on_signal"; \ + action: SIGNAL_EMIT "elm,action,show,finished" "elm"; \ + } \ + program { name: "key_press"; \ + signal: "elm,action,pressed"; \ + source: "elm"; \ + script { \ + if (get_int(radio_state) == RADIO_STATE_VISIBLE) \ + set_state(PART:"radio", "pressed", 0.0); \ + else \ + set_state(PART:"radio", "default", 0.0); \ + set_state(PART:"bg", "pressed", 0.0); \ + set_state(PART:"bg_line", "pressed", 0.0); \ + } \ + } \ + program { name: "key_unpress"; \ + signal: "elm,action,unpressed"; \ + source: "elm"; \ + script { \ + if (get_int(radio_state) == RADIO_STATE_VISIBLE) \ + set_state(PART:"radio", "visible", 0.0); \ + else \ + set_state(PART:"radio", "default", 0.0); \ + set_state(PART:"bg", "default", 0.0); \ + set_state(PART:"bg_line", "default", 0.0); \ + } \ + } \ + program { name: "text_show"; \ + signal: "elm,state,text,visible"; \ + source: "elm"; \ + action: STATE_SET "visible" 0.0; \ + target: "padding_before_text"; \ + target: "elm.text"; \ + } \ + program { name: "text_hide"; \ + signal: "elm,state,text,hidden"; \ + source: "elm"; \ + action: STATE_SET "default" 0.0; \ + target: "padding_before_text"; \ + target: "elm.text"; \ + } \ + program { name: "icon_show"; \ + signal: "elm,state,icon,visible"; \ + source: "elm"; \ + action: STATE_SET "visible" 0.0; \ + target: "elm.swallow.content"; \ + } \ + program { name: "icon_hide"; \ + signal: "elm,state,icon,hidden"; \ + source: "elm"; \ + action: STATE_SET "default" 0.0; \ + target: "elm.swallow.content"; \ + } \ + program { name: "action_focus"; \ + signal: "elm,action,focus_highlight,show"; \ + source: "elm"; \ + action: STATE_SET "focused_on" 0.0; \ + target: "focus_image"; \ + } \ + program { name: "action_unfocus"; \ + signal: "elm,action,focus_highlight,hide"; \ + source: "elm"; \ + action: STATE_SET "default" 0.0; \ + target: "focus_image"; \ + } \ + program { name: "disable"; \ + signal: "elm,state,disabled"; \ + source: "elm"; \ + action: STATE_SET "disabled" 0.0; \ + target: "disclip"; \ + target: "bg"; \ + target: "bg_effect"; \ + target: "bg_line"; \ + target: "disabler"; \ + after: "disable_text"; \ + } \ + program { name: "disable_text"; \ + script { \ + new st[31]; \ + new Float:vl; \ + get_state(PART:"elm.text", st, 30, vl); \ + if (!strcmp(st, "visible")) \ + set_state(PART:"elm.text", "disabled_visible", 0.0); \ + else \ + set_state(PART:"elm.text", "disabled", 0.0); \ + get_state(PART:"elm.swallow.content", st, 30, vl); \ + if (!strcmp(st, "visible")) \ + set_state(PART:"elm.swallow.content", "disabled_visible", 0.0); \ + else \ + set_state(PART:"elm.swallow.content", "disabled", 0.0); \ + get_state(PART:"radio", st, 30, vl); \ + if (!strcmp(st, "visible")) { \ + set_state(PART:"radio", "disabled_visible", 0.0); \ + set_state(PART:"radio_effect", "default", 0.0); \ + } \ + else \ + set_state(PART:"radio", "disabled", 0.0); \ + } \ + } \ + program { name: "enable"; \ + signal: "elm,state,enabled"; \ + source: "elm"; \ + action: STATE_SET "default" 0.0; \ + target: "disabler"; \ + target: "disclip"; \ + target: "bg"; \ + target: "bg_effect"; \ + target: "bg_line"; \ + after: "enable_text"; \ + } \ + program { name: "enable_text"; \ + script { \ + new st[31]; \ + new Float:vl; \ + get_state(PART:"elm.text", st, 30, vl); \ + if (!strcmp(st, "disabled_visible")) \ + set_state(PART:"elm.text", "visible", 0.0); \ + else \ + set_state(PART:"elm.text", "default", 0.0); \ + get_state(PART:"elm.swallow.content", st, 30, vl); \ + if (!strcmp(st, "disabled_visible")) \ + set_state(PART:"elm.swallow.content", "visible", 0.0); \ + else \ + set_state(PART:"elm.swallow.content", "default", 0.0); \ + get_state(PART:"radio", st, 30, vl); \ + if (!strcmp(st, "disabled_visible")) \ + { \ + set_state(PART:"opacity_clip", "visible", 0.0); \ + set_state(PART:"radio", "visible", 0.0); \ + set_state(PART:"radio_effect", "visible", 0.0); \ + } \ + else \ + { \ + set_state(PART:"opacity_clip", "default", 0.0); \ + set_state(PART:"radio", "default", 0.0); \ + } \ + } \ + } \ + } \ + } + + +/////////////////////////////////////////////////////////////////////////////////////// +RADIO_STYLE_DEFAULT("silent", RADIO_STYLE_DEFAULT_BG_IMAGE_MIN_WIDTH_INC, RADIO_STYLE_DEFAULT_BG_IMAGE_MIN_HEIGHT_INC) + |