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