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