7fab1b54b3602c7ac0be0d2aa0e70a74f68d068b
[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
19
20 #define RADIO_STATE_DEFAULT 0
21 #define RADIO_STATE_VISIBLE 1
22 #define RADIO_STATE_DISABLED_VISIBLE 2
23 #define RADIO_STATE_DISABLED 3
24
25    styles {
26       style { name: "radio_label_textblock_style";
27          base: "font=Tizen:style=Medium font_size="RADIO_STYLE_DEFAULT_FONT_SIZE_INC" color=#ffffff wrap=char text_class=tizen";
28          tag: "br" "\n";
29          tag: "ps" "ps";
30          tag: "hilight" "+ font=Tizen:style=Bold";
31          tag: "b" "+ font=Tizen:style=Bold";
32          tag: "whitecolor" "+ color=#ffffff";
33          tag: "tab" "\t";
34       }
35    }
36 ////////////////////////////////////////////////////////////////////////////////////////
37
38 #define RADIO_STYLE_DEFAULT(style_name, min_width, min_height) \
39    group { name: "elm/radio/base/"style_name; \
40       images { \
41          image: "00_button_radio_dim.png" COMP; \
42          image: "00_button_radio_Activated.png" COMP; \
43          image: "00_button_radio_bg.png" COMP; \
44          image: "00_button_radio_dim_bg.png" COMP; \
45       } \
46       parts { \
47          part { name: "back_bg"; \
48             type: RECT; \
49             scale: 1; \
50             description { state: "default" 0.0; \
51                rel2.relative: 0.0 1.0; \
52                align: 0 0.5; \
53                min: min_width min_height; \
54                fixed: 1 0; \
55                color: 0 0 0 0; \
56             } \
57          } \
58          part { name: "bg"; \
59             mouse_events: 0; \
60             scale: 1; \
61             description { state: "default" 0.0; \
62                min: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \
63                max: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \
64                fixed: 1 1; \
65                rel1.to: "back_bg"; \
66                rel2.to: "back_bg"; \
67                image.normal: "00_button_radio_bg.png"; \
68             } \
69             description { state: "disabled" 0.0; \
70                inherit: "default" 0.0; \
71                image.normal: "00_button_radio_dim_bg.png"; \
72             } \
73          } \
74          part { name: "radio"; \
75             clip_to: "opacity_clip"; \
76             mouse_events: 0; \
77             scale: 1; \
78             description { state: "default" 0.0; \
79                rel1.to: "bg"; \
80                rel2.to: "bg"; \
81                max: 0 0; \
82                image.normal: "00_button_radio_Activated.png"; \
83                visible: 0; \
84             } \
85             description { state: "visible" 0.0; \
86                inherit: "default" 0.0; \
87                visible: 1; \
88                max: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \
89             } \
90             description { state: "disabled" 0.0; \
91                inherit: "default" 0.0; \
92             } \
93             description { state: "disabled_visible" 0.0; \
94                inherit: "visible" 0.0; \
95                image.normal: "00_button_radio_dim.png"; \
96             } \
97          } \
98          part { name: "opacity_clip"; \
99             type: RECT; \
100             mouse_events: 0; \
101             description { state: "default" 0.0; \
102                color: 255 255 255 0; \
103             } \
104             description { state: "visible" 0.0; \
105                inherit: "default" 0.0; \
106                color: 255 255 255 255; \
107             } \
108          } \
109          part { name: "elm.swallow.content"; \
110             type: SWALLOW; \
111             clip_to: "disclip"; \
112             description { state: "default" 0.0; \
113                fixed: 1 0; \
114                visible: 0; \
115                align: 0.0 0.5; \
116                rel1 { \
117                   to_x: "bg"; \
118                   relative: 1.0 0.0; \
119                   offset: 1 1; \
120                } \
121                rel2 { \
122                   to_x: "bg"; \
123                   offset: 2 -2; \
124                } \
125             } \
126             description { state: "visible" 0.0; \
127                inherit: "default" 0.0; \
128                fixed: 1 1; \
129                visible: 1; \
130                aspect: 1.0 1.0; \
131                aspect_preference: VERTICAL; \
132             } \
133             description { state: "disabled" 0.0; \
134                inherit: "default" 0.0; \
135             } \
136             description { state: "disabled_visible" 0.0; \
137                inherit: "default" 0.0; \
138                fixed: 1 1; \
139                visible: 1; \
140                aspect: 1.0 1.0; \
141             } \
142          } \
143          part { name: "elm.text"; \
144             type: TEXTBLOCK; \
145             mouse_events: 0; \
146             clip_to: "disclip"; \
147             scale: 1; \
148             description { state: "default" 0.0; \
149                visible: 0; \
150                fixed: 0 1; \
151                rel1 { \
152                   relative: 1.0 0.5; \
153                   offset: 1 1; \
154                   to_x: "elm.swallow.content"; \
155                } \
156                rel2 { \
157                   relative: 1.0 0.5; \
158                   offset: -2 -2; \
159                } \
160                align: 0.0 0.5; \
161                text { \
162                   style: "radio_label_textblock_style"; \
163                   min: 0 0; \
164                } \
165                color: RADIO_DEFAULT_TEXT_NORMAL_COLOR_INC; \
166             } \
167             description { state: "visible" 0.0; \
168                inherit: "default" 0.0; \
169                visible: 1; \
170                text.min: 1 1; \
171             } \
172             description { state: "disabled" 0.0; \
173                inherit: "default" 0.0; \
174             } \
175             description { state: "disabled_visible" 0.0; \
176                inherit: "default" 0.0; \
177                visible: 1; \
178                text.min: 1 1; \
179                color: RADIO_DEFAULT_TEXT_DISABLED_COLOR_INC; \
180             } \
181          } \
182          part { name: "over1"; \
183             type: RECT; \
184             ignore_flags: ON_HOLD; \
185             description { state: "default" 0.0; \
186                color: 0 0 0 0; \
187             } \
188          } \
189          part { name: "over2"; \
190             type: RECT; \
191             repeat_events:1; \
192             description { state: "default" 0.0; \
193                color: 0 0 0 0; \
194             } \
195          } \
196          part { name: "disclip"; \
197             type: RECT; \
198             mouse_events: 0; \
199             description { state: "default" 0.0; \
200                color: RADIO_DISCLIP_NORMAL_COLOR_INC; \
201             } \
202             description { state: "disabled" 0.0; \
203                color: RADIO_DISCLIP_DISABLED_COLOR_INC; \
204             } \
205          } \
206          part { name: "disabler"; \
207             type: RECT; \
208             description { state: "default" 0.0; \
209                visible: 0; \
210             } \
211             description { state: "disabled" 0.0; \
212                inherit: "default" 0.0; \
213                visible: 1; \
214                color: 0 0 0 0; \
215             } \
216          } \
217       } \
218       programs { \
219          program { name: "click"; \
220             signal: "mouse,clicked,1"; \
221             source: "over1"; \
222             action: SIGNAL_EMIT "elm,action,radio,toggle" ""; \
223          } \
224          program { name: "touch_sound"; \
225             signal: "mouse,clicked,1"; \
226             source: "over2"; \
227             action: PLAY_SAMPLE "touch_sound" 1.0; \
228          } \
229          program { name: "bg_normal"; \
230             signal: "mouse,up,1"; \
231             source: "over2"; \
232             action: STATE_SET "default" 0.0; \
233             target: "bg"; \
234          } \
235          program { name: "pressed"; \
236             signal: "mouse,down,1"; \
237             source: "over2"; \
238             action: STATE_SET "pressed" 0.0; \
239             target: "bg"; \
240          } \
241          program { name: "radio_on"; \
242             signal: "elm,state,radio,on"; \
243             source: "elm"; \
244             script { \
245                run_program(PROGRAM:"radio_show_effect"); \
246                run_program(PROGRAM:"radio_draw_effect"); \
247             } \
248          } \
249          program { name: "radio_off"; \
250             signal: "elm,state,radio,off"; \
251             source: "elm"; \
252             script { \
253                set_state(PART:"opacity_clip", "default", 0.0); \
254                set_state(PART:"radio", "default", 0.0); \
255             } \
256          } \
257          program { name: "radio_show_effect"; \
258             action: STATE_SET "visible" 0.0; \
259             transition: LINEAR 0.233; \
260             target: "opacity_clip"; \
261          } \
262          program { name: "radio_draw_effect"; \
263             action: STATE_SET "visible" 0.0; \
264             transition: LINEAR 0.267; \
265             target: "radio"; \
266          } \
267          program { name: "text_show"; \
268             signal: "elm,state,text,visible"; \
269             source: "elm"; \
270             action: STATE_SET "visible" 0.0; \
271             target: "elm.text"; \
272          } \
273          program { name: "text_hide"; \
274             signal: "elm,state,text,hidden"; \
275             source: "elm"; \
276             action: STATE_SET "default" 0.0; \
277             target: "elm.text"; \
278          } \
279          program { name: "icon_show"; \
280             signal: "elm,state,icon,visible"; \
281             source: "elm"; \
282             action: STATE_SET "visible" 0.0; \
283             target: "elm.swallow.content"; \
284          } \
285          program { name: "icon_hide"; \
286             signal: "elm,state,icon,hidden"; \
287             source: "elm"; \
288             action: STATE_SET "default" 0.0; \
289             target: "elm.swallow.content"; \
290          } \
291          program { name: "disable"; \
292             signal: "elm,state,disabled"; \
293             source: "elm"; \
294             action: STATE_SET "disabled" 0.0; \
295             target: "disclip"; \
296             target: "bg"; \
297             target: "disabler"; \
298             after: "disable_text"; \
299          } \
300          program { name: "disable_text"; \
301             script { \
302                new st[31]; \
303                new Float:vl; \
304                get_state(PART:"elm.text", st, 30, vl); \
305                if (!strcmp(st, "visible")) \
306                  set_state(PART:"elm.text", "disabled_visible", 0.0); \
307                else \
308                  set_state(PART:"elm.text", "disabled", 0.0); \
309                get_state(PART:"elm.swallow.content", st, 30, vl); \
310                if (!strcmp(st, "visible")) \
311                  set_state(PART:"elm.swallow.content", "disabled_visible", 0.0); \
312                else \
313                  set_state(PART:"elm.swallow.content", "disabled", 0.0); \
314                get_state(PART:"radio", st, 30, vl); \
315                if (!strcmp(st, "visible")) \
316                  set_state(PART:"radio", "disabled_visible", 0.0); \
317                else \
318                  set_state(PART:"radio", "disabled", 0.0); \
319             } \
320          } \
321          program { name: "enable"; \
322             signal: "elm,state,enabled"; \
323             source: "elm"; \
324             action: STATE_SET "default" 0.0; \
325             target: "disabler"; \
326             target: "disclip"; \
327             target: "bg"; \
328             after: "enable_text"; \
329          } \
330          program { name: "enable_text"; \
331             script { \
332                new st[31]; \
333                new Float:vl; \
334                get_state(PART:"elm.text", st, 30, vl); \
335                if (!strcmp(st, "disabled_visible")) \
336                  set_state(PART:"elm.text", "visible", 0.0); \
337                else \
338                  set_state(PART:"elm.text", "default", 0.0); \
339                get_state(PART:"elm.swallow.content", st, 30, vl); \
340                if (!strcmp(st, "disabled_visible")) \
341                  set_state(PART:"elm.swallow.content", "visible", 0.0); \
342                else \
343                  set_state(PART:"elm.swallow.content", "default", 0.0); \
344                get_state(PART:"radio", st, 30, vl); \
345                if (!strcmp(st, "disabled_visible")) \
346                  { \
347                     set_state(PART:"opacity_clip", "visible", 0.0); \
348                     set_state(PART:"radio", "visible", 0.0); \
349                  } \
350                else \
351                  { \
352                     set_state(PART:"opacity_clip", "default", 0.0); \
353                     set_state(PART:"radio", "default", 0.0); \
354                  } \
355             } \
356          } \
357       } \
358    }
359
360 ///////////////////////////////////////////////////////////////////////////////////////
361 RADIO_STYLE_DEFAULT("default", RADIO_STYLE_DEFAULT_BG_IMAGE_MIN_WIDTH_INC, RADIO_STYLE_DEFAULT_BG_IMAGE_MIN_HEIGHT_INC)
362
363 ///////////////////////////////////////////////////////////////////////////////////////
364 RADIO_STYLE_DEFAULT("default/extended", RADIO_STYLE_DEFAULT_EXTENDED_BG_IMAGE_MIN_WIDTH_INC, RADIO_STYLE_DEFAULT_EXTENDED_BG_IMAGE_MIN_WIDTH_INC)
365
366 ///////////////////////////////////////////////////////////////////////////////////////
367
368 #undef RADIO_STATE_DEFAULT
369 #undef RADIO_STATE_VISIBLE
370 #undef RADIO_STATE_DISABLED_VISIBLE
371 #undef RADIO_STATE_DISABLED