[focus] Focus image will be shown out side of object.
[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=Medium 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    }
32 ////////////////////////////////////////////////////////////////////////////////////////
33
34 #define RADIO_STYLE_DEFAULT(style_name, min_width, min_height) \
35    group { name: "elm/radio/base/"style_name; \
36       images { \
37          image: "00_button_radio_activated_dim.png" COMP; \
38          image: "00_button_radio_activated.png" COMP; \
39          image: "00_button_radio_bg.png" COMP; \
40          image: "00_button_radio_dim_bg.png" COMP; \
41          image: "00_button_radio_press_bg.png" COMP; \
42          image: "00_button_radio_focus.png" COMP; \
43       } \
44       script { \
45          public radio_state = RADIO_STATE_DEFAULT; \
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_activated_dim.png"; \
101             } \
102             description { state: "pressed" 0.0; \
103                inherit: "visible" 0.0; \
104             } \
105          } \
106          part { name: "opacity_clip"; \
107             type: RECT; \
108             mouse_events: 0; \
109             description { state: "default" 0.0; \
110                color: 255 255 255 0; \
111             } \
112             description { state: "visible" 0.0; \
113                inherit: "default" 0.0; \
114                color: 255 255 255 255; \
115             } \
116          } \
117          part { name: "elm.swallow.content"; \
118             type: SWALLOW; \
119             clip_to: "disclip"; \
120             description { state: "default" 0.0; \
121                fixed: 1 0; \
122                visible: 0; \
123                align: 0.0 0.5; \
124                rel1 { \
125                   to_x: "bg"; \
126                   relative: 1.0 0.0; \
127                   offset: 1 1; \
128                } \
129                rel2 { \
130                   to_x: "bg"; \
131                   offset: 2 -2; \
132                } \
133             } \
134             description { state: "visible" 0.0; \
135                inherit: "default" 0.0; \
136                fixed: 1 1; \
137                visible: 1; \
138                aspect: 1.0 1.0; \
139                aspect_preference: VERTICAL; \
140             } \
141             description { state: "disabled" 0.0; \
142                inherit: "default" 0.0; \
143             } \
144             description { state: "disabled_visible" 0.0; \
145                inherit: "default" 0.0; \
146                fixed: 1 1; \
147                visible: 1; \
148                aspect: 1.0 1.0; \
149             } \
150          } \
151          part { name: "elm.text"; \
152             type: TEXTBLOCK; \
153             mouse_events: 0; \
154             clip_to: "disclip"; \
155             scale: 1; \
156             description { state: "default" 0.0; \
157                visible: 0; \
158                fixed: 0 1; \
159                rel1 { \
160                   relative: 1.0 0.5; \
161                   offset: 1 1; \
162                   to_x: "elm.swallow.content"; \
163                } \
164                rel2 { \
165                   relative: 1.0 0.5; \
166                   offset: -2 -2; \
167                } \
168                align: 0.0 0.5; \
169                text { \
170                   style: "radio_label_textblock_style"; \
171                   min: 0 0; \
172                } \
173             } \
174             description { state: "visible" 0.0; \
175                inherit: "default" 0.0; \
176                visible: 1; \
177                text.min: 1 1; \
178             } \
179             description { state: "disabled" 0.0; \
180                inherit: "default" 0.0; \
181             } \
182             description { state: "disabled_visible" 0.0; \
183                inherit: "default" 0.0; \
184                visible: 1; \
185                text.min: 1 1; \
186                color: RADIO_DEFAULT_TEXT_DISABLED_COLOR_INC; \
187             } \
188          } \
189          part { name: "over1"; \
190             type: RECT; \
191             ignore_flags: ON_HOLD; \
192             description { state: "default" 0.0; \
193                color: 0 0 0 0; \
194             } \
195          } \
196          part { name: "over2"; \
197             type: RECT; \
198             repeat_events:1; \
199             description { state: "default" 0.0; \
200                color: 0 0 0 0; \
201             } \
202          } \
203          part { name: "disclip"; \
204             type: RECT; \
205             mouse_events: 0; \
206             description { state: "default" 0.0; \
207                color: RADIO_DISCLIP_NORMAL_COLOR_INC; \
208             } \
209             description { state: "disabled" 0.0; \
210                color: RADIO_DISCLIP_DISABLED_COLOR_INC; \
211             } \
212          } \
213          part { name: "disabler"; \
214             type: RECT; \
215             description { state: "default" 0.0; \
216                visible: 0; \
217             } \
218             description { state: "disabled" 0.0; \
219                inherit: "default" 0.0; \
220                visible: 1; \
221                color: 0 0 0 0; \
222             } \
223          } \
224       } \
225       programs { \
226          program { name: "click"; \
227             signal: "mouse,clicked,1"; \
228             source: "over1"; \
229             action: SIGNAL_EMIT "elm,action,radio,toggle" ""; \
230          } \
231          program { name: "touch_sound"; \
232             signal: "mouse,clicked,1"; \
233             source: "over2"; \
234             action: PLAY_SAMPLE "touch_sound" 1.0; \
235          } \
236          program { name: "bg_normal"; \
237             signal: "mouse,up,1"; \
238             source: "over2"; \
239             script { \
240                if (get_int(radio_state) == RADIO_STATE_VISIBLE) \
241                   set_state(PART:"radio", "visible", 0.0); \
242                else \
243                   set_state(PART:"radio", "default", 0.0); \
244                set_state(PART:"bg", "default", 0.0); \
245             } \
246          } \
247          program { name: "pressed"; \
248             signal: "mouse,down,1"; \
249             source: "over2"; \
250             script { \
251                if (get_int(radio_state) == RADIO_STATE_VISIBLE) \
252                   set_state(PART:"radio", "pressed", 0.0); \
253                else \
254                   set_state(PART:"radio", "default", 0.0); \
255                set_state(PART:"bg", "pressed", 0.0); \
256             } \
257          } \
258          program { name: "mouse,out"; \
259             signal: "mouse,out"; \
260             source: "over2"; \
261             script { \
262                if (get_int(radio_state) == RADIO_STATE_VISIBLE) \
263                   set_state(PART:"radio", "visible", 0.0); \
264                else \
265                   set_state(PART:"radio", "default", 0.0); \
266                set_state(PART:"bg", "default", 0.0); \
267             } \
268          } \
269          program { name: "radio_on"; \
270             signal: "elm,state,radio,on"; \
271             source: "elm"; \
272             script { \
273                set_int(radio_state, RADIO_STATE_VISIBLE); \
274                run_program(PROGRAM:"radio_show_effect"); \
275                run_program(PROGRAM:"radio_draw_effect"); \
276             } \
277          } \
278          program { name: "radio_off"; \
279             signal: "elm,state,radio,off"; \
280             source: "elm"; \
281             script { \
282                set_int(radio_state, RADIO_STATE_DEFAULT); \
283                set_state(PART:"opacity_clip", "default", 0.0); \
284                set_state(PART:"radio", "default", 0.0); \
285             } \
286          } \
287          program { name: "radio_show_effect"; \
288             action: STATE_SET "visible" 0.0; \
289             transition: LINEAR 0.233; \
290             target: "opacity_clip"; \
291          } \
292          program { name: "radio_draw_effect"; \
293             action: STATE_SET "visible" 0.0; \
294             transition: LINEAR 0.267; \
295             target: "radio"; \
296          } \
297          program { name: "text_show"; \
298             signal: "elm,state,text,visible"; \
299             source: "elm"; \
300             action: STATE_SET "visible" 0.0; \
301             target: "elm.text"; \
302          } \
303          program { name: "text_hide"; \
304             signal: "elm,state,text,hidden"; \
305             source: "elm"; \
306             action: STATE_SET "default" 0.0; \
307             target: "elm.text"; \
308          } \
309          program { name: "icon_show"; \
310             signal: "elm,state,icon,visible"; \
311             source: "elm"; \
312             action: STATE_SET "visible" 0.0; \
313             target: "elm.swallow.content"; \
314          } \
315          program { name: "icon_hide"; \
316             signal: "elm,state,icon,hidden"; \
317             source: "elm"; \
318             action: STATE_SET "default" 0.0; \
319             target: "elm.swallow.content"; \
320          } \
321          program { name: "disable"; \
322             signal: "elm,state,disabled"; \
323             source: "elm"; \
324             action: STATE_SET "disabled" 0.0; \
325             target: "disclip"; \
326             target: "bg"; \
327             target: "disabler"; \
328             after: "disable_text"; \
329          } \
330          program { name: "disable_text"; \
331             script { \
332                new st[31]; \
333                new Float:vl; \
334                get_state(PART:"elm.text", st, 30, vl); \
335                if (!strcmp(st, "visible")) \
336                  set_state(PART:"elm.text", "disabled_visible", 0.0); \
337                else \
338                  set_state(PART:"elm.text", "disabled", 0.0); \
339                get_state(PART:"elm.swallow.content", st, 30, vl); \
340                if (!strcmp(st, "visible")) \
341                  set_state(PART:"elm.swallow.content", "disabled_visible", 0.0); \
342                else \
343                  set_state(PART:"elm.swallow.content", "disabled", 0.0); \
344                get_state(PART:"radio", st, 30, vl); \
345                if (!strcmp(st, "visible")) \
346                  set_state(PART:"radio", "disabled_visible", 0.0); \
347                else \
348                  set_state(PART:"radio", "disabled", 0.0); \
349             } \
350          } \
351          program { name: "enable"; \
352             signal: "elm,state,enabled"; \
353             source: "elm"; \
354             action: STATE_SET "default" 0.0; \
355             target: "disabler"; \
356             target: "disclip"; \
357             target: "bg"; \
358             after: "enable_text"; \
359          } \
360          program { name: "enable_text"; \
361             script { \
362                new st[31]; \
363                new Float:vl; \
364                get_state(PART:"elm.text", st, 30, vl); \
365                if (!strcmp(st, "disabled_visible")) \
366                  set_state(PART:"elm.text", "visible", 0.0); \
367                else \
368                  set_state(PART:"elm.text", "default", 0.0); \
369                get_state(PART:"elm.swallow.content", st, 30, vl); \
370                if (!strcmp(st, "disabled_visible")) \
371                  set_state(PART:"elm.swallow.content", "visible", 0.0); \
372                else \
373                  set_state(PART:"elm.swallow.content", "default", 0.0); \
374                get_state(PART:"radio", st, 30, vl); \
375                if (!strcmp(st, "disabled_visible")) \
376                  { \
377                     set_state(PART:"opacity_clip", "visible", 0.0); \
378                     set_state(PART:"radio", "visible", 0.0); \
379                  } \
380                else \
381                  { \
382                     set_state(PART:"opacity_clip", "default", 0.0); \
383                     set_state(PART:"radio", "default", 0.0); \
384                  } \
385             } \
386          } \
387       } \
388    }
389
390 ///////////////////////////////////////////////////////////////////////////////////////
391 RADIO_STYLE_DEFAULT("default", RADIO_STYLE_DEFAULT_BG_IMAGE_MIN_WIDTH_INC, RADIO_STYLE_DEFAULT_BG_IMAGE_MIN_HEIGHT_INC)
392
393 ///////////////////////////////////////////////////////////////////////////////////////
394 RADIO_STYLE_DEFAULT("default/extended", RADIO_STYLE_DEFAULT_EXTENDED_BG_IMAGE_MIN_WIDTH_INC, RADIO_STYLE_DEFAULT_EXTENDED_BG_IMAGE_MIN_WIDTH_INC)
395
396 ///////////////////////////////////////////////////////////////////////////////////////
397
398 #undef RADIO_STATE_DEFAULT
399 #undef RADIO_STATE_VISIBLE