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_bg.png" COMP; \
49 image: "00_button_radio_dim_bg.png" COMP; \
50 image: "00_button_radio_press_bg.png" COMP; \
51 image: "00_button_radio_focus.png" COMP; \
54 public radio_state = RADIO_STATE_DEFAULT; \
57 part { name: "back_bg"; \
60 description { state: "default" 0.0; \
61 rel2.relative: 0.0 1.0; \
63 min: min_width min_height; \
71 description { state: "default" 0.0; \
72 min: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \
73 max: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \
77 image.normal: "00_button_radio_bg.png"; \
79 description { state: "disabled" 0.0; \
80 inherit: "default" 0.0; \
81 image.normal: "00_button_radio_dim_bg.png"; \
83 description { state: "pressed" 0.0; \
84 inherit: "default" 0.0; \
87 part { name: "radio"; \
88 clip_to: "opacity_clip"; \
91 description { state: "default" 0.0; \
95 image.normal: "00_button_radio_activated.png"; \
98 description { state: "visible" 0.0; \
99 inherit: "default" 0.0; \
101 max: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \
103 description { state: "disabled" 0.0; \
104 inherit: "default" 0.0; \
106 description { state: "disabled_visible" 0.0; \
107 inherit: "visible" 0.0; \
108 image.normal: "00_button_radio_activated_dim.png"; \
110 description { state: "pressed" 0.0; \
111 inherit: "visible" 0.0; \
114 part { name: "opacity_clip"; \
117 description { state: "default" 0.0; \
118 color: 255 255 255 0; \
120 description { state: "visible" 0.0; \
121 inherit: "default" 0.0; \
122 color: 255 255 255 255; \
125 part { name: "pressed_bg"; \
128 description { state: "default" 0.0; \
131 image.normal: "00_button_radio_press_bg.png"; \
134 description { state: "pressed" 0.0; \
135 inherit: "default" 0.0; \
139 part { name: "elm.swallow.content"; \
141 clip_to: "disclip"; \
142 description { state: "default" 0.0; \
156 description { state: "visible" 0.0; \
157 inherit: "default" 0.0; \
161 aspect_preference: VERTICAL; \
163 description { state: "disabled" 0.0; \
164 inherit: "default" 0.0; \
166 description { state: "disabled_visible" 0.0; \
167 inherit: "default" 0.0; \
173 part { name: "elm.text"; \
176 clip_to: "disclip"; \
178 description { state: "default" 0.0; \
184 to_x: "elm.swallow.content"; \
192 style: "radio_label_textblock_style"; \
196 description { state: "visible" 0.0; \
197 inherit: "default" 0.0; \
201 description { state: "disabled" 0.0; \
202 inherit: "default" 0.0; \
204 description { state: "disabled_visible" 0.0; \
205 inherit: "default" 0.0; \
208 style: "radio_label_textblock_style_disable"; \
213 part { name: "over1"; \
215 ignore_flags: ON_HOLD; \
216 description { state: "default" 0.0; \
220 part { name: "over2"; \
223 description { state: "default" 0.0; \
227 part { name: "disclip"; \
230 description { state: "default" 0.0; \
231 color: RADIO_DISCLIP_NORMAL_COLOR_INC; \
233 description { state: "disabled" 0.0; \
234 color: RADIO_DISCLIP_DISABLED_COLOR_INC; \
237 part { name: "disabler"; \
239 description { state: "default" 0.0; \
242 description { state: "disabled" 0.0; \
243 inherit: "default" 0.0; \
250 program { name: "click"; \
251 signal: "mouse,clicked,1"; \
253 action: SIGNAL_EMIT "elm,action,radio,toggle" ""; \
255 program { name: "touch_sound"; \
256 signal: "mouse,clicked,1"; \
258 action: PLAY_SAMPLE "touch_sound" 1.0; \
260 program { name: "bg_normal"; \
261 signal: "mouse,up,1"; \
264 if (get_int(radio_state) == RADIO_STATE_VISIBLE) \
265 set_state(PART:"radio", "visible", 0.0); \
267 set_state(PART:"radio", "default", 0.0); \
268 set_state(PART:"pressed_bg", "default", 0.0); \
271 program { name: "pressed"; \
272 signal: "mouse,down,1"; \
275 if (get_int(radio_state) == RADIO_STATE_VISIBLE) \
276 set_state(PART:"radio", "pressed", 0.0); \
278 set_state(PART:"radio", "default", 0.0); \
279 set_state(PART:"pressed_bg", "pressed", 0.0); \
282 program { name: "mouse,out"; \
283 signal: "mouse,out"; \
286 if (get_int(radio_state) == RADIO_STATE_VISIBLE) \
287 set_state(PART:"radio", "visible", 0.0); \
289 set_state(PART:"radio", "default", 0.0); \
290 set_state(PART:"bg", "default", 0.0); \
293 program { name: "radio_on"; \
294 signal: "elm,state,radio,on"; \
297 set_int(radio_state, RADIO_STATE_VISIBLE); \
298 run_program(PROGRAM:"radio_show_effect"); \
299 run_program(PROGRAM:"radio_draw_effect"); \
302 program { name: "radio_off"; \
303 signal: "elm,state,radio,off"; \
306 set_int(radio_state, RADIO_STATE_DEFAULT); \
307 set_state(PART:"opacity_clip", "default", 0.0); \
308 set_state(PART:"radio", "default", 0.0); \
311 program { name: "radio_show_effect"; \
312 action: STATE_SET "visible" 0.0; \
313 transition: LINEAR 0.233; \
314 target: "opacity_clip"; \
316 program { name: "radio_draw_effect"; \
317 action: STATE_SET "visible" 0.0; \
318 transition: LINEAR 0.267; \
321 program { name: "text_show"; \
322 signal: "elm,state,text,visible"; \
324 action: STATE_SET "visible" 0.0; \
325 target: "elm.text"; \
327 program { name: "text_hide"; \
328 signal: "elm,state,text,hidden"; \
330 action: STATE_SET "default" 0.0; \
331 target: "elm.text"; \
333 program { name: "icon_show"; \
334 signal: "elm,state,icon,visible"; \
336 action: STATE_SET "visible" 0.0; \
337 target: "elm.swallow.content"; \
339 program { name: "icon_hide"; \
340 signal: "elm,state,icon,hidden"; \
342 action: STATE_SET "default" 0.0; \
343 target: "elm.swallow.content"; \
345 program { name: "disable"; \
346 signal: "elm,state,disabled"; \
348 action: STATE_SET "disabled" 0.0; \
351 target: "disabler"; \
352 after: "disable_text"; \
354 program { name: "disable_text"; \
358 get_state(PART:"elm.text", st, 30, vl); \
359 if (!strcmp(st, "visible")) \
360 set_state(PART:"elm.text", "disabled_visible", 0.0); \
362 set_state(PART:"elm.text", "disabled", 0.0); \
363 get_state(PART:"elm.swallow.content", st, 30, vl); \
364 if (!strcmp(st, "visible")) \
365 set_state(PART:"elm.swallow.content", "disabled_visible", 0.0); \
367 set_state(PART:"elm.swallow.content", "disabled", 0.0); \
368 get_state(PART:"radio", st, 30, vl); \
369 if (!strcmp(st, "visible")) \
370 set_state(PART:"radio", "disabled_visible", 0.0); \
372 set_state(PART:"radio", "disabled", 0.0); \
375 program { name: "enable"; \
376 signal: "elm,state,enabled"; \
378 action: STATE_SET "default" 0.0; \
379 target: "disabler"; \
382 after: "enable_text"; \
384 program { name: "enable_text"; \
388 get_state(PART:"elm.text", st, 30, vl); \
389 if (!strcmp(st, "disabled_visible")) \
390 set_state(PART:"elm.text", "visible", 0.0); \
392 set_state(PART:"elm.text", "default", 0.0); \
393 get_state(PART:"elm.swallow.content", st, 30, vl); \
394 if (!strcmp(st, "disabled_visible")) \
395 set_state(PART:"elm.swallow.content", "visible", 0.0); \
397 set_state(PART:"elm.swallow.content", "default", 0.0); \
398 get_state(PART:"radio", st, 30, vl); \
399 if (!strcmp(st, "disabled_visible")) \
401 set_state(PART:"opacity_clip", "visible", 0.0); \
402 set_state(PART:"radio", "visible", 0.0); \
406 set_state(PART:"opacity_clip", "default", 0.0); \
407 set_state(PART:"radio", "default", 0.0); \
414 ///////////////////////////////////////////////////////////////////////////////////////
415 RADIO_STYLE_DEFAULT("default", RADIO_STYLE_DEFAULT_BG_IMAGE_MIN_WIDTH_INC, RADIO_STYLE_DEFAULT_BG_IMAGE_MIN_HEIGHT_INC)
417 ///////////////////////////////////////////////////////////////////////////////////////
418 RADIO_STYLE_DEFAULT("default/extended", RADIO_STYLE_DEFAULT_EXTENDED_BG_IMAGE_MIN_WIDTH_INC, RADIO_STYLE_DEFAULT_EXTENDED_BG_IMAGE_MIN_WIDTH_INC)
420 ///////////////////////////////////////////////////////////////////////////////////////
422 #undef RADIO_STATE_DEFAULT
423 #undef RADIO_STATE_VISIBLE