Merge "Renamed directory groups -> widgets."
[profile/ivi/efl-theme-tizen.git] / themes / widgets / radio.edc
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *  Licensed under the Apache License, Version 2.0 (the "License");
5  *  you may not use this file except in compliance with the License.
6  *  You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *  Unless required by applicable law or agreed to in writing, software
11  *  distributed under the License is distributed on an "AS IS" BASIS,
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *  See the License for the specific language governing permissions and
14  *  limitations under the License.
15  *
16  */
17
18 #define RADIO_STATE_DEFAULT 0
19 #define RADIO_STATE_VISIBLE 1
20 #define RADIO_STATE_DISABLED_VISIBLE 2
21 #define RADIO_STATE_DISABLED 3
22
23    styles {
24       style { name: "radio_label_textblock_style";
25          base: "font=SLP:style=Medium font_size="RADIO_STYLE_DEFAULT_FONT_SIZE_INC" color=#ffffff wrap=char";
26          tag: "br" "\n";
27          tag: "ps" "ps";
28          tag: "hilight" "+ font=SLP:style=Bold";
29          tag: "b" "+ font=SLP:style=Bold";
30          tag: "whitecolor" "+ color=#ffffff";
31          tag: "tab" "\t";
32       }
33    }
34 ////////////////////////////////////////////////////////////////////////////////////////
35
36 #define RADIO_STYLE_DEFAULT(style_name, min_width, min_height) \
37    group { name: "elm/radio/base/"style_name; \
38       images { \
39          image: "00_button_radio_normal1.png" COMP; \
40          image: "00_button_radio_normal2.png" COMP; \
41       } \
42       parts { \
43          part { name: "back_bg"; \
44             type: RECT; \
45             mouse_events: 1; \
46             scale: 1; \
47             description { state: "default" 0.0; \
48                rel2.relative: 0.0 1.0; \
49                align: 0 0.5; \
50                min: min_width min_height; \
51                fixed: 1 0; \
52                visible: 1; \
53                color: 0 0 0 0; \
54             } \
55          } \
56          part { name: "bg"; \
57             mouse_events: 1; \
58             scale: 1; \
59             type: RECT; \
60             description { state: "default" 0.0; \
61                rel1{ to: "back_bg"; } \
62                rel2{ to: "back_bg"; } \
63                fixed: 1 1; \
64                align: 0.5 0.5; \
65                min: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \
66                max: RADIO_STYLE_DEFAULT_BG_MIN_MAX_INC; \
67                color: 0 0 0 0; \
68             } \
69          } \
70          part { name: "radio"; \
71             mouse_events: 0; \
72             scale: 1; \
73             description { state: "default" 0.0; \
74                rel1 { \
75                   to: "bg"; \
76                   offset: 0 0; \
77                } \
78                rel2 { \
79                   to: "bg"; \
80                   offset: 0 0; \
81                } \
82                visible: 1; \
83                color: 255 255 255 255; \
84                image.normal: "00_button_radio_normal2.png"; \
85             } \
86             description { state: "visible" 0.0; \
87                inherit: "default" 0.0; \
88                image.normal: "00_button_radio_normal1.png"; \
89                color: 255 255 255 255; \
90             } \
91             description { state: "disabled" 0.0; \
92                inherit: "default" 0.0; \
93                color: 255 255 255 128; \
94             } \
95             description { state: "disabled_visible" 0.0; \
96                inherit: "visible" 0.0; \
97                color: 255 255 255 128; \
98             } \
99          } \
100          part { name: "elm.swallow.content"; \
101             type: SWALLOW; \
102             description { state: "default" 0.0; \
103                fixed: 1 0; \
104                visible: 0; \
105                color: 255 255 255 255; \
106                align: 0.0 0.5; \
107                rel1.to_x: "bg"; \
108                rel1.relative: 1.0 0.0; \
109                rel1.offset: 1 1; \
110                rel2.to_x: "bg"; \
111                rel2.relative: 1.0 1.0; \
112                rel2.offset: 2 -2; \
113             } \
114             description { state: "visible" 0.0; \
115                inherit: "default" 0.0; \
116                fixed: 1 1; \
117                visible: 1; \
118                aspect: 1.0 1.0; \
119                aspect_preference: VERTICAL; \
120             } \
121             description { state: "disabled" 0.0; \
122                inherit: "default" 0.0; \
123                color: 128 128 128 128; \
124             } \
125             description { state: "disabled_visible" 0.0; \
126                inherit: "default" 0.0; \
127                color: 128 128 128 128; \
128                fixed: 1 1; \
129                visible: 1; \
130                aspect: 1.0 1.0; \
131             } \
132          } \
133          part { name: "elm.text"; \
134             type: TEXTBLOCK; \
135             mouse_events: 0; \
136             scale: 1; \
137             description { state: "default" 0.0; \
138                visible: 0; \
139                fixed: 0 1; \
140                rel1 { relative: 1.0 0.5; offset: 1 1; to_x: "elm.swallow.content"; } \
141                rel2 { relative: 1.0 0.5; offset: -2 -2; } \
142                color: 255 255 255 255; \
143                align: 0.0 0.5; \
144                text { \
145                   style: "radio_label_textblock_style"; \
146                   min: 0 0; \
147                } \
148                color: RADIO_DEFAULT_TEXT_NORMAL_COLOR_INC; \
149             } \
150             description { state: "visible" 0.0; \
151                inherit: "default" 0.0; \
152                visible: 1; \
153                text.min: 1 1; \
154             } \
155             description { state: "disabled" 0.0; \
156                inherit: "default" 0.0; \
157             } \
158             description { state: "disabled_visible" 0.0; \
159                inherit: "default" 0.0; \
160                visible: 1; \
161                text.min: 1 1; \
162                color: RADIO_DEFAULT_TEXT_DISABLED_COLOR_INC; \
163             } \
164          } \
165          part { name: "over1"; \
166             type: RECT; \
167             ignore_flags: ON_HOLD; \
168             description { state: "default" 0.0; \
169                color: 0 0 0 0; \
170             } \
171          } \
172          part { name: "over2"; \
173             type: RECT; \
174             repeat_events:1; \
175             description { state: "default" 0.0; \
176                color: 0 0 0 0; \
177             } \
178          } \
179          part { name: "disabler"; \
180             type: RECT; \
181             description { state: "default" 0.0; \
182                color: 0 0 0 0; \
183                visible: 0; \
184             } \
185             description { state: "disabled" 0.0; \
186                inherit: "default" 0.0; \
187                visible: 1; \
188                color: 0 0 0 0; \
189             } \
190          } \
191       } \
192       programs { \
193          program { name: "click"; \
194             signal: "mouse,clicked,1"; \
195             source: "over1"; \
196             action: SIGNAL_EMIT "elm,action,radio,toggle" ""; \
197          } \
198          program { name: "radio_on"; \
199             signal: "elm,state,radio,on"; \
200             source: "elm"; \
201             script { \
202                set_state(PART:"radio", "visible", 0.0); \
203             } \
204          } \
205          program { name: "radio_off"; \
206             signal: "elm,state,radio,off"; \
207             source: "elm"; \
208             script { \
209                set_state(PART:"radio", "default", 0.0); \
210             } \
211          } \
212          program { name: "text_show"; \
213             signal: "elm,state,text,visible"; \
214             source: "elm"; \
215             action:  STATE_SET "visible" 0.0; \
216             target: "elm.text"; \
217          } \
218          program { name: "text_hide"; \
219             signal: "elm,state,text,hidden"; \
220             source: "elm"; \
221             action:  STATE_SET "default" 0.0; \
222             target: "elm.text"; \
223          } \
224          program { name: "icon_show"; \
225             signal: "elm,state,icon,visible"; \
226             source: "elm"; \
227             action:  STATE_SET "visible" 0.0; \
228             target: "elm.swallow.content"; \
229          } \
230          program { name: "icon_hide"; \
231             signal: "elm,state,icon,hidden"; \
232             source: "elm"; \
233             action:  STATE_SET "default" 0.0; \
234             target: "elm.swallow.content"; \
235          } \
236          program { name: "disable"; \
237             signal: "elm,state,disabled"; \
238             source: "elm"; \
239             action: STATE_SET "disabled" 0.0; \
240             target: "disabler"; \
241             after: "disable_text"; \
242          } \
243          program { name: "disable_text"; \
244             script { \
245                new st[31]; \
246                new Float:vl; \
247                get_state(PART:"elm.text", st, 30, vl); \
248                if (!strcmp(st, "visible")) \
249                set_state(PART:"elm.text", "disabled_visible", 0.0); \
250                else \
251                set_state(PART:"elm.text", "disabled", 0.0); \
252                get_state(PART:"elm.swallow.content", st, 30, vl); \
253                if (!strcmp(st, "visible")) \
254                   set_state(PART:"elm.swallow.content", "disabled_visible", 0.0); \
255                else \
256                   set_state(PART:"elm.swallow.content", "disabled", 0.0); \
257                get_state(PART:"radio", st, 30, vl); \
258                if (!strcmp(st, "visible")) \
259                { \
260                   set_state(PART:"radio", "disabled_visible", 0.0); \
261                 } \
262                else \
263                { \
264                   set_state(PART:"radio", "disabled", 0.0); \
265                } \
266             } \
267          } \
268          program { name: "enable"; \
269             signal: "elm,state,enabled"; \
270             source: "elm"; \
271             action: STATE_SET "default" 0.0; \
272             target: "disabler"; \
273             after: "enable_text"; \
274          } \
275          program { name: "enable_text"; \
276             script { \
277                new st[31]; \
278                new Float:vl; \
279                get_state(PART:"elm.text", st, 30, vl); \
280                if (!strcmp(st, "disabled_visible")) \
281                   set_state(PART:"elm.text", "visible", 0.0); \
282                else \
283                   set_state(PART:"elm.text", "default", 0.0); \
284                get_state(PART:"elm.swallow.content", st, 30, vl); \
285                if (!strcmp(st, "disabled_visible")) \
286                   set_state(PART:"elm.swallow.content", "visible", 0.0); \
287                else \
288                   set_state(PART:"elm.swallow.content", "default", 0.0); \
289                get_state(PART:"radio", st, 30, vl); \
290                if (!strcmp(st, "disabled_visible")) \
291                { \
292                   set_state(PART:"radio", "visible", 0.0); \
293                } \
294                else \
295                { \
296                   set_state(PART:"radio", "default", 0.0); \
297                } \
298             } \
299          } \
300       } \
301    }
302
303 ///////////////////////////////////////////////////////////////////////////////////////
304 RADIO_STYLE_DEFAULT("default", RADIO_STYLE_DEFAULT_BG_IMAGE_MIN_WIDTH_INC, RADIO_STYLE_DEFAULT_BG_IMAGE_MIN_HEIGHT_INC)
305
306 ///////////////////////////////////////////////////////////////////////////////////////
307 RADIO_STYLE_DEFAULT("default/extended", RADIO_STYLE_DEFAULT_EXTENDED_BG_IMAGE_MIN_WIDTH_INC, RADIO_STYLE_DEFAULT_EXTENDED_BG_IMAGE_MIN_WIDTH_INC)
308
309 ///////////////////////////////////////////////////////////////////////////////////////
310
311 #undef RADIO_STATE_DEFAULT
312 #undef RADIO_STATE_VISIBLE
313 #undef RADIO_STATE_DISABLED_VISIBLE
314 #undef RADIO_STATE_DISABLED