1/* 2 Copyright (C) 2008,2009 INdT - Instituto Nokia de Tecnologia 3 Copyright (C) 2009,2010 ProFUSION embedded systems 4 Copyright (C) 2009,2010 Samsung Electronics 5 6 This file is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Library General Public 8 License as published by the Free Software Foundation; either 9 version 2 of the License, or (at your option) any later version. 10 11 This file is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Library General Public License for more details. 15 16 You should have received a copy of the GNU Library General Public License 17 along with this library; see the file COPYING.LIB. If not, write to 18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 Boston, MA 02110-1301, USA. 20*/ 21 22 group { 23 name: "webkit/widget/radio"; 24 min: 12 12; 25 26 images { 27 image: "widget/radio/img_radio_bg_enabled.png" COMP; 28 image: "widget/radio/img_radio_bg_disabled.png" COMP; 29 image: "widget/radio/img_radio_on.png" COMP; 30 image: "widget/radio/img_radio_off.png" COMP; 31 image: "widget/radio/img_radio_on_focus.png" COMP; 32 image: "widget/radio/img_radio_off_focus.png" COMP; 33 image: "widget/radio/img_radio_on_hover.png" COMP; 34 image: "widget/radio/img_radio_off_hover.png" COMP; 35 } 36 37 script { 38 public isEnabled; 39 public isPressed; 40 public isChecked; 41 public isFocused; 42 public isHovered; 43 44 public show() { 45 if (get_int(isEnabled) == 1) { 46 set_state(PART:"radio_button", "default", 0.0); 47 set_state(PART:"bg", "enabled", 0.0); 48 if (get_int(isChecked) == 1) { 49 set_state(PART:"radio_button", "enabled_checked", 0.0); 50 if (get_int(isFocused) == 1) 51 set_state(PART:"radio_button", "focus_checked", 0.0); 52 if (get_int(isHovered) == 1 && get_int(isFocused) == 0) 53 set_state(PART:"radio_button", "hovered_checked", 0.0); 54 } 55 else { 56 if (get_int(isFocused) == 1) 57 set_state(PART:"radio_button", "focused", 0.0); 58 if (get_int(isHovered) == 1 && get_int(isFocused) == 0) 59 set_state(PART:"radio_button", "hovered", 0.0); 60 } 61 } 62 else { 63 set_state(PART:"radio_button", "disabled", 0.0); 64 set_state(PART:"bg", "disabled", 0.0); 65 if (get_int(isChecked) == 1) 66 set_state(PART:"radio_button", "disabled_checked", 0.0); 67 } 68 } 69 } 70 71 parts { 72 part { 73 name: "bg"; 74 type: IMAGE; 75 description { 76 state: "default" 0.0; 77 min: 12 12; 78 max: 12 12; 79 image { 80 normal: "widget/radio/img_radio_bg_enabled.png"; 81 } 82 } 83 description { 84 state: "enabled" 0.0; 85 inherit: "default" 0.0; 86 } 87 description { 88 state: "disabled" 0.0; 89 inherit: "default" 0.0; 90 image { 91 normal: "widget/radio/img_radio_bg_disabled.png"; 92 } 93 } 94 } 95 part { 96 name: "radio_button"; 97 type: IMAGE; 98 description { 99 state: "default" 0.0; 100 min: 12 12; 101 max: 12 12; 102 image { 103 normal: "widget/radio/img_radio_off.png"; 104 } 105 } 106 description { 107 state: "enabled_checked" 0.0; 108 inherit: "default" 0.0; 109 image { 110 normal: "widget/radio/img_radio_on.png"; 111 } 112 } 113 description { 114 state: "disabled_checked" 0.0; 115 inherit: "enabled_checked" 0.0; 116 color: 255 255 255 150; 117 } 118 description { 119 state: "disabled" 0.0; 120 inherit: "default" 0.0; 121 color: 255 255 255 150; 122 } 123 description { 124 state: "hovered_checked" 0.0; 125 inherit: "default" 0.0; 126 image { 127 normal: "widget/radio/img_radio_on_hover.png"; 128 } 129 } 130 description { 131 state: "hovered" 0.0; 132 inherit: "default" 0.0; 133 image { 134 normal: "widget/radio/img_radio_off_hover.png"; 135 } 136 } 137 description { 138 state: "focus_checked" 0.0; 139 inherit: "default" 0.0; 140 image { 141 normal: "widget/radio/img_radio_on_focus.png"; 142 } 143 } 144 description { 145 state: "focused" 0.0; 146 inherit: "default" 0.0; 147 image { 148 normal: "widget/radio/img_radio_off_focus.png"; 149 } 150 } 151 } 152 } 153 154 programs { 155 program { 156 name: "enabled"; 157 signal: "enabled"; 158 script { 159 set_int(isEnabled, 1); 160 show(); 161 } 162 } 163 program { 164 name: "pressed"; 165 signal: "pressed"; 166 script { 167 set_int(isPressed, 1); 168 show(); 169 } 170 } 171 program { 172 name: "checked"; 173 signal: "checked"; 174 script { 175 set_int(isChecked, 1); 176 show(); 177 } 178 } 179 program { 180 name: "focused"; 181 signal: "focused"; 182 script { 183 set_int(isFocused, 1); 184 show(); 185 } 186 } 187 program { 188 name: "hovered"; 189 signal: "hovered"; 190 script { 191 set_int(isHovered, 1); 192 show(); 193 } 194 } 195 program { 196 name: "reset"; 197 signal: "reset"; 198 script { 199 set_int(isEnabled, 0); 200 set_int(isPressed, 0); 201 set_int(isChecked, 0); 202 set_int(isFocused, 0); 203 set_int(isHovered, 0); 204 show(); 205 } 206 } 207 } 208 } 209