Merge "[scroller] removed scroller's bounce effect" into tizen_2.2
[platform/core/uifw/efl-theme-tizen.git] / themes / widgets / radio.edc
1 /*
2  * efl-theme-tizen
3  * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4  *
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
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17
18 #define RADIO_STATE_DEFAULT 0 // radio is off
19 #define RADIO_STATE_VISIBLE 1 // radio is on
20
21    styles {
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";
24          tag: "br" "\n";
25          tag: "ps" "ps";
26          tag: "hilight" "+ font=Tizen:style=Bold";
27          tag: "b" "+ font=Tizen:style=Bold";
28          tag: "whitecolor" "+ color=#ffffff";
29          tag: "tab" "\t";
30       }
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";
33          tag: "br" "\n";
34          tag: "ps" "ps";
35          tag: "hilight" "+ font=Tizen:style=Bold";
36          tag: "b" "+ font=Tizen:style=Bold";
37          tag: "whitecolor" "+ color=#ffffff";
38          tag: "tab" "\t";
39       }
40    }
41 ////////////////////////////////////////////////////////////////////////////////////////
42
43 #define RADIO_STYLE_DEFAULT(style_name, min_width, min_height) \
44    group { name: "elm/radio/base/"style_name; \
45       images { \
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; \
52       } \
53       script { \
54          public radio_state = RADIO_STATE_DEFAULT; \
55       } \
56       parts { \
57          part { name: "back_bg"; \
58             type: RECT; \
59             scale: 1; \
60             description { state: "default" 0.0; \
61                rel2.relative: 0.0 1.0; \
62                align: 0 0.5; \
63                min: min_width min_height; \
64                fixed: 1 0; \
65                color: 0 0 0 0; \
66             } \
67          } \
68          part { name: "bg"; \
69             mouse_events: 0; \
70             scale: 1; \
71             description { state: "default" 0.0; \
72                min: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \
73                max: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \
74                fixed: 1 1; \
75                rel1.to: "back_bg"; \
76                rel2.to: "back_bg"; \
77                image.normal: "00_button_radio_bg.png"; \
78             } \
79             description { state: "disabled" 0.0; \
80                inherit: "default" 0.0; \
81                image.normal: "00_button_radio_dim_bg.png"; \
82             } \
83             description { state: "pressed" 0.0; \
84                inherit: "default" 0.0; \
85             } \
86          } \
87          part { name: "radio"; \
88             clip_to: "opacity_clip"; \
89             mouse_events: 0; \
90             scale: 1; \
91             description { state: "default" 0.0; \
92                rel1.to: "bg"; \
93                rel2.to: "bg"; \
94                max: 0 0; \
95                image.normal: "00_button_radio_activated.png"; \
96                visible: 0; \
97             } \
98             description { state: "visible" 0.0; \
99                inherit: "default" 0.0; \
100                visible: 1; \
101                max: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \
102             } \
103             description { state: "disabled" 0.0; \
104                inherit: "default" 0.0; \
105             } \
106             description { state: "disabled_visible" 0.0; \
107                inherit: "visible" 0.0; \
108                image.normal: "00_button_radio_activated_dim.png"; \
109             } \
110             description { state: "pressed" 0.0; \
111                inherit: "visible" 0.0; \
112             } \
113          } \
114          part { name: "opacity_clip"; \
115             type: RECT; \
116             mouse_events: 0; \
117             description { state: "default" 0.0; \
118                color: 255 255 255 0; \
119             } \
120             description { state: "visible" 0.0; \
121                inherit: "default" 0.0; \
122                color: 255 255 255 255; \
123             } \
124          } \
125          part { name: "pressed_bg"; \
126             mouse_events: 0; \
127             scale: 1; \
128             description { state: "default" 0.0; \
129                rel1.to: "bg"; \
130                rel2.to: "bg"; \
131                image.normal: "00_button_radio_press_bg.png"; \
132                visible: 0; \
133             } \
134             description { state: "pressed" 0.0; \
135                inherit: "default" 0.0; \
136                visible: 1; \
137             } \
138          } \
139          part { name: "elm.swallow.content"; \
140             type: SWALLOW; \
141             clip_to: "disclip"; \
142             description { state: "default" 0.0; \
143                fixed: 1 0; \
144                visible: 0; \
145                align: 0.0 0.5; \
146                rel1 { \
147                   to_x: "bg"; \
148                   relative: 1.0 0.0; \
149                   offset: 1 1; \
150                } \
151                rel2 { \
152                   to_x: "bg"; \
153                   offset: 2 -2; \
154                } \
155             } \
156             description { state: "visible" 0.0; \
157                inherit: "default" 0.0; \
158                fixed: 1 1; \
159                visible: 1; \
160                aspect: 1.0 1.0; \
161                aspect_preference: VERTICAL; \
162             } \
163             description { state: "disabled" 0.0; \
164                inherit: "default" 0.0; \
165             } \
166             description { state: "disabled_visible" 0.0; \
167                inherit: "default" 0.0; \
168                fixed: 1 1; \
169                visible: 1; \
170                aspect: 1.0 1.0; \
171             } \
172          } \
173          part { name: "elm.text"; \
174             type: TEXTBLOCK; \
175             mouse_events: 0; \
176             clip_to: "disclip"; \
177             scale: 1; \
178             description { state: "default" 0.0; \
179                visible: 0; \
180                fixed: 0 1; \
181                rel1 { \
182                   relative: 1.0 0.5; \
183                   offset: 1 1; \
184                   to_x: "elm.swallow.content"; \
185                } \
186                rel2 { \
187                   relative: 1.0 0.5; \
188                   offset: -2 -2; \
189                } \
190                align: 0.0 0.5; \
191                text { \
192                   style: "radio_label_textblock_style"; \
193                   min: 0 0; \
194                } \
195             } \
196             description { state: "visible" 0.0; \
197                inherit: "default" 0.0; \
198                visible: 1; \
199                text.min: 1 1; \
200             } \
201             description { state: "disabled" 0.0; \
202                inherit: "default" 0.0; \
203             } \
204             description { state: "disabled_visible" 0.0; \
205                inherit: "default" 0.0; \
206                visible: 1; \
207                text { \
208                   style: "radio_label_textblock_style_disable"; \
209                   min: 0 0; \
210                } \
211             } \
212          } \
213          part { name: "over1"; \
214             type: RECT; \
215             ignore_flags: ON_HOLD; \
216             description { state: "default" 0.0; \
217                color: 0 0 0 0; \
218             } \
219          } \
220          part { name: "over2"; \
221             type: RECT; \
222             repeat_events:1; \
223             description { state: "default" 0.0; \
224                color: 0 0 0 0; \
225             } \
226          } \
227          part { name: "disclip"; \
228             type: RECT; \
229             mouse_events: 0; \
230             description { state: "default" 0.0; \
231                color: RADIO_DISCLIP_NORMAL_COLOR_INC; \
232             } \
233             description { state: "disabled" 0.0; \
234                color: RADIO_DISCLIP_DISABLED_COLOR_INC; \
235             } \
236          } \
237          part { name: "disabler"; \
238             type: RECT; \
239             description { state: "default" 0.0; \
240                visible: 0; \
241             } \
242             description { state: "disabled" 0.0; \
243                inherit: "default" 0.0; \
244                visible: 1; \
245                color: 0 0 0 0; \
246             } \
247          } \
248       } \
249       programs { \
250          program { name: "click"; \
251             signal: "mouse,clicked,1"; \
252             source: "over1"; \
253             action: SIGNAL_EMIT "elm,action,radio,toggle" ""; \
254          } \
255          program { name: "touch_sound"; \
256             signal: "mouse,clicked,1"; \
257             source: "over2"; \
258             action: PLAY_SAMPLE "touch_sound" 1.0; \
259          } \
260          program { name: "bg_normal"; \
261             signal: "mouse,up,1"; \
262             source: "over2"; \
263             script { \
264                if (get_int(radio_state) == RADIO_STATE_VISIBLE) \
265                   set_state(PART:"radio", "visible", 0.0); \
266                else \
267                   set_state(PART:"radio", "default", 0.0); \
268                set_state(PART:"pressed_bg", "default", 0.0); \
269             } \
270          } \
271          program { name: "pressed"; \
272             signal: "mouse,down,1"; \
273             source: "over2"; \
274             script { \
275                if (get_int(radio_state) == RADIO_STATE_VISIBLE) \
276                   set_state(PART:"radio", "pressed", 0.0); \
277                else \
278                   set_state(PART:"radio", "default", 0.0); \
279                set_state(PART:"pressed_bg", "pressed", 0.0); \
280             } \
281          } \
282          program { name: "mouse,out"; \
283             signal: "mouse,out"; \
284             source: "over2"; \
285             script { \
286                if (get_int(radio_state) == RADIO_STATE_VISIBLE) \
287                   set_state(PART:"radio", "visible", 0.0); \
288                else \
289                   set_state(PART:"radio", "default", 0.0); \
290                set_state(PART:"bg", "default", 0.0); \
291             } \
292          } \
293          program { name: "radio_on"; \
294             signal: "elm,state,radio,on"; \
295             source: "elm"; \
296             script { \
297                set_int(radio_state, RADIO_STATE_VISIBLE); \
298                run_program(PROGRAM:"radio_show_effect"); \
299                run_program(PROGRAM:"radio_draw_effect"); \
300             } \
301          } \
302          program { name: "radio_off"; \
303             signal: "elm,state,radio,off"; \
304             source: "elm"; \
305             script { \
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); \
309             } \
310          } \
311          program { name: "radio_show_effect"; \
312             action: STATE_SET "visible" 0.0; \
313             transition: LINEAR 0.233; \
314             target: "opacity_clip"; \
315          } \
316          program { name: "radio_draw_effect"; \
317             action: STATE_SET "visible" 0.0; \
318             transition: LINEAR 0.267; \
319             target: "radio"; \
320          } \
321          program { name: "text_show"; \
322             signal: "elm,state,text,visible"; \
323             source: "elm"; \
324             action: STATE_SET "visible" 0.0; \
325             target: "elm.text"; \
326          } \
327          program { name: "text_hide"; \
328             signal: "elm,state,text,hidden"; \
329             source: "elm"; \
330             action: STATE_SET "default" 0.0; \
331             target: "elm.text"; \
332          } \
333          program { name: "icon_show"; \
334             signal: "elm,state,icon,visible"; \
335             source: "elm"; \
336             action: STATE_SET "visible" 0.0; \
337             target: "elm.swallow.content"; \
338          } \
339          program { name: "icon_hide"; \
340             signal: "elm,state,icon,hidden"; \
341             source: "elm"; \
342             action: STATE_SET "default" 0.0; \
343             target: "elm.swallow.content"; \
344          } \
345          program { name: "disable"; \
346             signal: "elm,state,disabled"; \
347             source: "elm"; \
348             action: STATE_SET "disabled" 0.0; \
349             target: "disclip"; \
350             target: "bg"; \
351             target: "disabler"; \
352             after: "disable_text"; \
353          } \
354          program { name: "disable_text"; \
355             script { \
356                new st[31]; \
357                new Float:vl; \
358                get_state(PART:"elm.text", st, 30, vl); \
359                if (!strcmp(st, "visible")) \
360                  set_state(PART:"elm.text", "disabled_visible", 0.0); \
361                else \
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); \
366                else \
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); \
371                else \
372                  set_state(PART:"radio", "disabled", 0.0); \
373             } \
374          } \
375          program { name: "enable"; \
376             signal: "elm,state,enabled"; \
377             source: "elm"; \
378             action: STATE_SET "default" 0.0; \
379             target: "disabler"; \
380             target: "disclip"; \
381             target: "bg"; \
382             after: "enable_text"; \
383          } \
384          program { name: "enable_text"; \
385             script { \
386                new st[31]; \
387                new Float:vl; \
388                get_state(PART:"elm.text", st, 30, vl); \
389                if (!strcmp(st, "disabled_visible")) \
390                  set_state(PART:"elm.text", "visible", 0.0); \
391                else \
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); \
396                else \
397                  set_state(PART:"elm.swallow.content", "default", 0.0); \
398                get_state(PART:"radio", st, 30, vl); \
399                if (!strcmp(st, "disabled_visible")) \
400                  { \
401                     set_state(PART:"opacity_clip", "visible", 0.0); \
402                     set_state(PART:"radio", "visible", 0.0); \
403                  } \
404                else \
405                  { \
406                     set_state(PART:"opacity_clip", "default", 0.0); \
407                     set_state(PART:"radio", "default", 0.0); \
408                  } \
409             } \
410          } \
411       } \
412    }
413
414 ///////////////////////////////////////////////////////////////////////////////////////
415 RADIO_STYLE_DEFAULT("default", RADIO_STYLE_DEFAULT_BG_IMAGE_MIN_WIDTH_INC, RADIO_STYLE_DEFAULT_BG_IMAGE_MIN_HEIGHT_INC)
416
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)
419
420 ///////////////////////////////////////////////////////////////////////////////////////
421
422 #undef RADIO_STATE_DEFAULT
423 #undef RADIO_STATE_VISIBLE