3 * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an AS IS BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #define RADIO_STATE_DEFAULT 0 // radio is off
19 #define RADIO_STATE_VISIBLE 1 // radio is on
22 style { name: "radio_label_textblock_style";
23 base: "font=Tizen:style=Regular font_size="RADIO_STYLE_DEFAULT_FONT_SIZE_INC" color="RADIO_DEFAULT_TEXT_NORMAL_COLOR_INC" wrap=char text_class=tizen";
26 tag: "hilight" "+ font=Tizen:style=Bold";
27 tag: "b" "+ font=Tizen:style=Bold";
28 tag: "whitecolor" "+ color=#ffffff";
31 style { name: "radio_label_textblock_style_disable";
32 base: "font=Tizen:style=Regular font_size="RADIO_STYLE_DEFAULT_FONT_SIZE_INC" color="RADIO_DEFAULT_TEXT_NORMAL_COLOR_INC" wrap=char text_class=tizen";
35 tag: "hilight" "+ font=Tizen:style=Bold";
36 tag: "b" "+ font=Tizen:style=Bold";
37 tag: "whitecolor" "+ color=#ffffff";
41 ////////////////////////////////////////////////////////////////////////////////////////
43 #define RADIO_STYLE_DEFAULT(style_name, min_width, min_height) \
44 group { name: "elm/radio/base/"style_name; \
46 image: "00_button_radio_activated_dim.png" COMP; \
47 image: "00_button_radio_activated.png" COMP; \
48 image: "00_button_radio_activated_press.png" COMP; \
49 image: "00_button_radio_bg.png" COMP; \
50 image: "00_button_radio_dim_bg.png" COMP; \
51 image: "00_button_radio_press_bg.png" COMP; \
52 image: "00_button_radio_focus.png" COMP; \
55 public radio_state = RADIO_STATE_DEFAULT; \
58 part { name: "back_bg"; \
61 description { state: "default" 0.0; \
62 rel2.relative: 0.0 1.0; \
64 min: min_width min_height; \
72 description { state: "default" 0.0; \
73 min: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \
74 max: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \
78 image.normal: "00_button_radio_bg.png"; \
80 description { state: "disabled" 0.0; \
81 inherit: "default" 0.0; \
82 image.normal: "00_button_radio_dim_bg.png"; \
84 description { state: "pressed" 0.0; \
85 inherit: "default" 0.0; \
86 image.normal: "00_button_radio_press_bg.png"; \
89 part { name: "radio"; \
90 clip_to: "opacity_clip"; \
93 description { state: "default" 0.0; \
97 image.normal: "00_button_radio_activated.png"; \
100 description { state: "visible" 0.0; \
101 inherit: "default" 0.0; \
103 max: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \
105 description { state: "disabled" 0.0; \
106 inherit: "default" 0.0; \
108 description { state: "disabled_visible" 0.0; \
109 inherit: "visible" 0.0; \
110 image.normal: "00_button_radio_activated_dim.png"; \
112 description { state: "pressed" 0.0; \
113 inherit: "visible" 0.0; \
114 image.normal: "00_button_radio_activated_press.png"; \
117 part { name: "opacity_clip"; \
120 description { state: "default" 0.0; \
121 color: 255 255 255 0; \
123 description { state: "visible" 0.0; \
124 inherit: "default" 0.0; \
125 color: 255 255 255 255; \
128 part { name: "elm.swallow.content"; \
130 clip_to: "disclip"; \
131 description { state: "default" 0.0; \
145 description { state: "visible" 0.0; \
146 inherit: "default" 0.0; \
150 aspect_preference: VERTICAL; \
152 description { state: "disabled" 0.0; \
153 inherit: "default" 0.0; \
155 description { state: "disabled_visible" 0.0; \
156 inherit: "default" 0.0; \
162 part { name: "elm.text"; \
165 clip_to: "disclip"; \
167 description { state: "default" 0.0; \
173 to_x: "elm.swallow.content"; \
181 style: "radio_label_textblock_style"; \
185 description { state: "visible" 0.0; \
186 inherit: "default" 0.0; \
190 description { state: "disabled" 0.0; \
191 inherit: "default" 0.0; \
193 description { state: "disabled_visible" 0.0; \
194 inherit: "default" 0.0; \
197 style: "radio_label_textblock_style_disable"; \
202 part { name: "over1"; \
204 ignore_flags: ON_HOLD; \
205 description { state: "default" 0.0; \
209 part { name: "over2"; \
212 description { state: "default" 0.0; \
216 part { name: "disclip"; \
219 description { state: "default" 0.0; \
220 color: RADIO_DISCLIP_NORMAL_COLOR_INC; \
222 description { state: "disabled" 0.0; \
223 color: RADIO_DISCLIP_DISABLED_COLOR_INC; \
226 part { name: "disabler"; \
228 description { state: "default" 0.0; \
231 description { state: "disabled" 0.0; \
232 inherit: "default" 0.0; \
239 program { name: "click"; \
240 signal: "mouse,clicked,1"; \
242 action: SIGNAL_EMIT "elm,action,radio,toggle" ""; \
244 program { name: "touch_sound"; \
245 signal: "mouse,clicked,1"; \
247 action: PLAY_SAMPLE "touch_sound" 1.0; \
249 program { name: "bg_normal"; \
250 signal: "mouse,up,1"; \
253 if (get_int(radio_state) == RADIO_STATE_VISIBLE) \
254 set_state(PART:"radio", "visible", 0.0); \
256 set_state(PART:"radio", "default", 0.0); \
257 set_state(PART:"bg", "default", 0.0); \
260 program { name: "pressed"; \
261 signal: "mouse,down,1"; \
264 if (get_int(radio_state) == RADIO_STATE_VISIBLE) \
265 set_state(PART:"radio", "pressed", 0.0); \
267 set_state(PART:"radio", "default", 0.0); \
268 set_state(PART:"bg", "pressed", 0.0); \
271 program { name: "mouse,out"; \
272 signal: "mouse,out"; \
275 if (get_int(radio_state) == RADIO_STATE_VISIBLE) \
276 set_state(PART:"radio", "visible", 0.0); \
278 set_state(PART:"radio", "default", 0.0); \
279 set_state(PART:"bg", "default", 0.0); \
282 program { name: "radio_on"; \
283 signal: "elm,state,radio,on"; \
286 set_int(radio_state, RADIO_STATE_VISIBLE); \
287 run_program(PROGRAM:"radio_show_effect"); \
288 run_program(PROGRAM:"radio_draw_effect"); \
291 program { name: "radio_off"; \
292 signal: "elm,state,radio,off"; \
295 set_int(radio_state, RADIO_STATE_DEFAULT); \
296 set_state(PART:"opacity_clip", "default", 0.0); \
297 set_state(PART:"radio", "default", 0.0); \
300 program { name: "radio_show_effect"; \
301 action: STATE_SET "visible" 0.0; \
302 transition: LINEAR 0.233; \
303 target: "opacity_clip"; \
305 program { name: "radio_draw_effect"; \
306 action: STATE_SET "visible" 0.0; \
307 transition: LINEAR 0.267; \
310 program { name: "text_show"; \
311 signal: "elm,state,text,visible"; \
313 action: STATE_SET "visible" 0.0; \
314 target: "elm.text"; \
316 program { name: "text_hide"; \
317 signal: "elm,state,text,hidden"; \
319 action: STATE_SET "default" 0.0; \
320 target: "elm.text"; \
322 program { name: "icon_show"; \
323 signal: "elm,state,icon,visible"; \
325 action: STATE_SET "visible" 0.0; \
326 target: "elm.swallow.content"; \
328 program { name: "icon_hide"; \
329 signal: "elm,state,icon,hidden"; \
331 action: STATE_SET "default" 0.0; \
332 target: "elm.swallow.content"; \
334 program { name: "disable"; \
335 signal: "elm,state,disabled"; \
337 action: STATE_SET "disabled" 0.0; \
340 target: "disabler"; \
341 after: "disable_text"; \
343 program { name: "disable_text"; \
347 get_state(PART:"elm.text", st, 30, vl); \
348 if (!strcmp(st, "visible")) \
349 set_state(PART:"elm.text", "disabled_visible", 0.0); \
351 set_state(PART:"elm.text", "disabled", 0.0); \
352 get_state(PART:"elm.swallow.content", st, 30, vl); \
353 if (!strcmp(st, "visible")) \
354 set_state(PART:"elm.swallow.content", "disabled_visible", 0.0); \
356 set_state(PART:"elm.swallow.content", "disabled", 0.0); \
357 get_state(PART:"radio", st, 30, vl); \
358 if (!strcmp(st, "visible")) \
359 set_state(PART:"radio", "disabled_visible", 0.0); \
361 set_state(PART:"radio", "disabled", 0.0); \
364 program { name: "enable"; \
365 signal: "elm,state,enabled"; \
367 action: STATE_SET "default" 0.0; \
368 target: "disabler"; \
371 after: "enable_text"; \
373 program { name: "enable_text"; \
377 get_state(PART:"elm.text", st, 30, vl); \
378 if (!strcmp(st, "disabled_visible")) \
379 set_state(PART:"elm.text", "visible", 0.0); \
381 set_state(PART:"elm.text", "default", 0.0); \
382 get_state(PART:"elm.swallow.content", st, 30, vl); \
383 if (!strcmp(st, "disabled_visible")) \
384 set_state(PART:"elm.swallow.content", "visible", 0.0); \
386 set_state(PART:"elm.swallow.content", "default", 0.0); \
387 get_state(PART:"radio", st, 30, vl); \
388 if (!strcmp(st, "disabled_visible")) \
390 set_state(PART:"opacity_clip", "visible", 0.0); \
391 set_state(PART:"radio", "visible", 0.0); \
395 set_state(PART:"opacity_clip", "default", 0.0); \
396 set_state(PART:"radio", "default", 0.0); \
403 ///////////////////////////////////////////////////////////////////////////////////////
404 RADIO_STYLE_DEFAULT("default", RADIO_STYLE_DEFAULT_BG_IMAGE_MIN_WIDTH_INC, RADIO_STYLE_DEFAULT_BG_IMAGE_MIN_HEIGHT_INC)
406 ///////////////////////////////////////////////////////////////////////////////////////
407 RADIO_STYLE_DEFAULT("default/extended", RADIO_STYLE_DEFAULT_EXTENDED_BG_IMAGE_MIN_WIDTH_INC, RADIO_STYLE_DEFAULT_EXTENDED_BG_IMAGE_MIN_WIDTH_INC)
409 ///////////////////////////////////////////////////////////////////////////////////////
411 #undef RADIO_STATE_DEFAULT
412 #undef RADIO_STATE_VISIBLE