diff options
Diffstat (limited to 'mobile/widgets_csharp/radio.edc')
-rw-r--r-- | mobile/widgets_csharp/radio.edc | 537 |
1 files changed, 537 insertions, 0 deletions
diff --git a/mobile/widgets_csharp/radio.edc b/mobile/widgets_csharp/radio.edc new file mode 100644 index 00000000..22fe105d --- /dev/null +++ b/mobile/widgets_csharp/radio.edc @@ -0,0 +1,537 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +group { "elm/radio/event/default"; + inherit_only: 1; + parts { + rect { "event"; + mouse; + desc { "default"; + color: 0 0 0 0 ; + rel.to: "base"; + } + desc { "disabled"; + inherit: "default"; + hid; + } + } + } + programs { + program { "clicked"; + signal: "mouse,clicked,1"; + source: "event"; + action: SIGNAL_EMIT "elm,action,click" ""; + after: "on_clicked"; + } + program { "pressed"; + signal: "mouse,down,1*"; + source: "event"; + action: SIGNAL_EMIT "elm,action,press" ""; + after: "on_pressed"; + } + program { "unpressed"; + signal: "mouse,up,1"; + source: "event"; + action: SIGNAL_EMIT "elm,action,unpress" ""; + after: "on_unpressed"; + } + program { "set_radio"; + signal: "elm,state,radio,on"; + source: "elm"; + after: "on_set_radio"; + } + program { "unset_radio"; + signal: "elm,state,radio,off"; + source: "elm"; + after: "on_unset_radio"; + } + program { "disabled"; + signal: "elm,state,disabled"; + source: "elm"; + after: "on_disabled"; + } + program { "enabled"; + signal: "elm,state,enabled"; + source: "elm"; + after: "on_enabled"; + } + program { "enable_event_pass"; + signal: "elm,event,pass,enabled"; + source: "elm"; + script { + set_mouse_events(PART:"event", 0); + } + } + program { "disable_event_pass"; + signal: "elm,event,pass,disabled"; + source: "elm"; + script { + set_mouse_events(PART:"event", 1); + } + } + program { "enable_event_repeat"; + signal: "elm,event,repeat,enabled"; + source: "elm"; + script { + set_repeat_events(PART:"event", 1); + } + } + program { "disable_event_repeat"; + signal: "elm,event,repeat,disabled"; + source: "elm"; + script { + set_repeat_events(PART:"event", 0); + } + } + } +} +group { "elm/radio/base/template"; + parts { + spacer { "base"; + desc { "default"; + } + } + } + inherit: "elm/radio/event/default"; + programs { + program { "on_clicked"; + } + program { "on_pressed"; + } + program { "on_unpressed"; + } + program { "on_disabled"; + } + program { "on_enabled"; + } + program { "on_set_radio"; + } + program { "on_unset_radio"; + } + } +} +group { "elm/radio/base/default"; + images{ + vector: core_radio_stroke.svg; + vector: core_radio_icon.svg; + vector: core_radio_bg_01.svg; + vector: core_radio_bg_02.svg; + vector: core_radio_white_bg.svg; + } + nomouse; + target_group: "vector_group" "clipper_bg_vector" "clipper_icon" "clipper_icon_inner" "clipper_icon_outer" "clipper_icon_stroke"; + parts { + spacer { "base"; + scale; + desc { "default"; + min: RADIO_DEFAULT_SIZE_INC; + } + } + //bg shape + vector { "bg_vector"; + scale; + clip: "clipper_bg_vector"; + desc { "default"; + image.normal: "core_radio_white_bg.svg"; + min: RADIO_DEFAULT_SIZE_INC; + rel1.relative: 0 0.5; + rel2.relative: 0 0.5; + align: 0 0.5; + fixed: 1 1; + } + } + rect { "clipper_bg_vector"; + desc { "default"; + color_class: "radio/default/bg"; + } + desc { "on"; + color_class: "radio/default/bg_border_on"; + } + desc { "off"; + inherit: "default"; + } + desc { "disabled_on"; + color_class: "radio/default/bg_border_on_disabled"; + } + desc { "disabled_off"; + color_class: "radio/default/bg_disabled"; + } + } + vector { "icon"; + scale; + clip: "clipper_icon"; + desc { "default"; + image.normal: "core_radio_icon.svg"; + rel1.to: "bg_vector"; + rel2.to: "bg_vector"; + } + } + rect { "clipper_icon"; + desc { "default"; + color: 250 250 250 0; + } + desc { "on"; + color_class: "radio/default/bg_on" ; + } + desc { "off"; + inherit: "default"; + } + desc { "disabled_off"; + inherit: "default"; + } + desc { "disabled_on"; + color_class: "radio/default/bg_on_disabled" ; + } + } + vector { "icon_inner"; + scale; + clip: "clipper_icon_inner"; + desc { "default"; + image.normal: "core_radio_bg_01.svg"; + rel.to: "bg_vector"; + } + } + rect { "clipper_icon_inner"; + desc { "default"; + rel1.relative: 0.5 0.5; + rel2.relative: 0.5 0.5; + rel.to: "bg_vector"; + } + desc { "on"; + rel.to: "bg_vector"; + color_class: "radio/default/icon"; + } + desc { "off"; + inherit: "default"; + } + desc { "disabled_off"; + inherit: "default"; + } + desc { "disabled_on"; + rel.to: "bg_vector"; + color_class: "radio/default/icon_disabled"; + } + } + vector { "icon_outer"; + scale; + clip: "clipper_icon_outer"; + desc { "default"; + image.normal: "core_radio_bg_02.svg"; + rel1.to: "bg_vector"; + rel2.to: "bg_vector"; + } + } + rect { "clipper_icon_outer"; + desc { "default"; + color: 61 185 204 0; + } + desc { "on"; + color_class: "radio/default/icon"; + } + desc { "off"; + inherit: "default"; + } + desc { "disabled_off"; + inherit: "default"; + } + desc { "disabled_on"; + color_class: "radio/default/icon_disabled"; + } + } + vector { "icon_stroke"; + scale; + clip: "clipper_icon_stroke"; + desc { "default"; + image.normal: "core_radio_stroke.svg"; + rel1.to: "bg_vector"; + rel2.to: "bg_vector"; + } + } + rect { "clipper_icon_stroke"; + desc { "default"; + color_class: "radio/default/stroke"; + } + desc { "on"; + color: 61 185 204 0; + } + desc { "off"; + inherit: "default"; + } + desc { "disabled_off"; + color_class: "radio/default/stroke_disabled"; + } + desc { "disabled_on"; + inherit: "on"; + } + } + spacer { "padding_before_text"; + scale; + desc { "default"; + align: 0.0 0.5; + min: 0 0; + rel1 { + to: "bg_vector"; + relative: 1.0 0.0; + } + rel2 { + to: "bg_vector"; + relative: 1.0 1.0; + } + } + desc { "visible"; + inherit: "default" 0.0; + min: RADIO_PAD_BEFORE_TEXT_INC; + fixed: 1 1; + } + } + textblock { "elm.text"; + scale; + desc { "default"; + hid; + fixed: 0 1; + rel1 { + relative: 1.0 0.5; + to_x: "padding_before_text"; + } + rel2 { + relative: 1.0 0.5; + } + align: 0.0 0.5; + text { + style: "radio_default"; + min: 0 0; + } + } + desc { "visible"; + inherit: "default" 0.0; + vis; + text.min: 0 1; + } + desc { "disabled"; + inherit: "default" 0.0; + vis; + text { + style: "radio_default_dim"; + min: 0 1; + } + } + desc { "pressed"; + inherit: "default" 0.0; + vis; + text { + style: "radio_default_press"; + min: 0 1; + } + } + } + } + inherit: "elm/radio/event/default"; + script { + public radio_state; + public disabled; + public text; + public animate = 0; + } + programs { + program { "on_clicked"; + script { + if (get_int(disabled) == 1) return; + emit("elm,action,radio,toggle", ""); + run_program(PROGRAM:"touch_sound"); + } + } + program { "on_pressed"; + script { + if (get_int(disabled) == 1) return; + if (get_int(text) == 1) { + set_state(PART:"elm.text", "pressed", 0.0); + } + } + } + program { "on_unpressed"; + script { + if (get_int(disabled) == 1) return; + if (get_int(radio_state) == 1) { + run_program(PROGRAM:"toggle_on_without_effect"); + }else { + run_program(PROGRAM:"toggle_off_without_effect"); + } + if (get_int(text) == 1) { + set_state(PART:"elm.text", "visible", 0.0); + } + } + } + program { "on_disabled"; + script { + set_int(disabled, 1); + if (get_int(radio_state) == 1) { + run_program(PROGRAM:"toggle_disabled_on_without_effect"); + }else { + run_program(PROGRAM:"toggle_disabled_off_without_effect"); + } + if (get_int(text) == 1) { + set_state(PART:"elm.text", "disabled", 0.0); + } + } + } + program { "on_enabled"; + script { + set_int(disabled, 0); + if (get_int(radio_state) == 1) { + run_program(PROGRAM:"toggle_on_without_effect"); + } else { + run_program(PROGRAM:"toggle_off_without_effect"); + } + if (get_int(text) == 1) { + set_state(PART:"elm.text", "visible", 0.0); + } + } + } + program { "on_set_radio"; + script { + if (get_int(disabled) == 1) { + if (get_int(animate) == 0) { + run_program(PROGRAM:"toggle_disabled_on_without_effect"); + } else { + run_program(PROGRAM:"toggle_disabled_on_with_effect"); + } + }else { + if (get_int(animate) == 0) { + run_program(PROGRAM:"toggle_on_without_effect"); + emit("elm,radio,state,toggle", "tizen_vg"); + } else { + run_program(PROGRAM:"toggle_on_with_effect"); + emit("elm,radio,action,toggle", "tizen_vg"); + } + } + set_int(animate, 0); + set_int(radio_state, 1); + } + } + program { "on_unset_radio"; + script { + if (get_int(disabled) == 1) { + if (get_int(animate) == 0) { + run_program(PROGRAM:"toggle_disabled_off_without_effect"); + } else { + run_program(PROGRAM:"toggle_disabled_off_with_effect"); + } + }else { + if (get_int(animate) == 0) { + run_program(PROGRAM:"toggle_off_without_effect"); + emit("elm,radio,state,toggle", "tizen_vg"); + } else { + run_program(PROGRAM:"toggle_off_with_effect"); + emit("elm,radio,action,toggle", "tizen_vg"); + } + } + set_int(animate, 0); + set_int(radio_state, 0); + } + } + program { "touch_sound"; + action: RUN_PLUGIN "touch_sound"; + } + program { "activate_animate_radio"; + signal: "elm,activate,radio,on"; + source: "elm"; + script { + set_int(animate, 1); + } + } + program { "deactivate_animate_radio"; + signal: "elm,activate,radio,off"; + source: "elm"; + script { + set_int(animate, 1); + } + } + program { "toggle_on_with_effect"; + action: STATE_SET "on"; + transition: DECELERATE 0.3; + target_groups: "vector_group"; + after: "finished_animation"; + } + program { "toggle_off_with_effect"; + action: STATE_SET "default"; + target_groups: "vector_group"; + transition: DECELERATE 0.3; + after: "finished_animation"; + } + program { "toggle_disabled_on_with_effect"; + action: STATE_SET "disabled_on"; + target_groups: "vector_group"; + transition: DECELERATE 0.3; + after: "finished_animation"; + } + program { "toggle_disabled_off_with_effect"; + action: STATE_SET "disabled_off"; + target_groups: "vector_group"; + transition: DECELERATE 0.3; + after: "finished_animation"; + } + program { "toggle_on_without_effect"; + action: STATE_SET "on"; + target_groups: "vector_group"; + } + program { "toggle_off_without_effect"; + action: STATE_SET "default"; + target_groups: "vector_group"; + } + program { "toggle_disabled_on_without_effect"; + action: STATE_SET "disabled_on"; + target_groups: "vector_group"; + } + program { "toggle_disabled_off_without_effect"; + action: STATE_SET "disabled_off"; + target_groups: "vector_group"; + } + program { "finished_animation"; + action: SIGNAL_EMIT "animation,finished" ""; + } + program { "visible_text"; + signal: "elm,state,text,visible"; + source: "elm"; + script { + set_int(text, 1); + set_state(PART:"padding_before_text", "visible", 0.0); + if (get_int(disabled) == 1) { + set_state(PART:"elm.text", "disabled", 0.0); + }else { + set_state(PART:"elm.text", "visible", 0.0); + } + } + } + program { "hidden_text"; + signal: "elm,state,text,hidden"; + source: "elm"; + script { + set_int(text, 0); + set_state(PART:"padding_before_text", "default", 0.0); + set_state(PART:"elm.text", "default", 0.0); + } + } + } +} |