wooooooooooooooooooo aliases!
[framework/uifw/elementary.git] / data / themes / widgets / toggle.edc
1 group { name: "elm/check/base/toggle";
2    alias: "elm/toggle/base/default";
3    images {
4       image: "shelf_inset.png" COMP;
5       image: "bt_basew.png" COMP;
6       image: "bt_bases.png" COMP;
7       image: "bt_hilightw.png" COMP;
8       image: "tog_base_on.png" COMP;
9       image: "tog_base_off.png" COMP;
10       image: "tog_dis_base_on.png" COMP;
11       image: "tog_dis_base_off.png" COMP;
12    }
13    script {
14       public is_rtl;
15    }
16    parts {
17       part { name: "bg";
18          type: RECT;
19          mouse_events: 0;
20          scale: 1;
21          description { state: "default" 0.0;
22             rel1.relative: 1.0 0.0;
23             rel1.offset: -4 3;
24             rel2.offset: -4 -4;
25             align: 1.0 0.5;
26             min: 96 16;
27             max: 96 16;
28             aspect: 4.0 4.0;
29             aspect_preference: VERTICAL;
30             color: 255 255 255 255;
31          }
32       }
33       part { name: "clipper";
34          type: RECT;
35          mouse_events: 0;
36          description { state: "default" 0.0;
37             rel1.to: "bg";
38             rel2.to: "bg";
39             color: 255 255 255 255;
40          }
41       }
42       part { name: "button";
43          type: RECT;
44          scale: 1;
45          clip_to: "clipper";
46          mouse_events: 1;
47          dragable {
48             x: 1 1 0;
49             y: 0 0 0;
50             confine: "bg";
51          }
52          description { state: "default" 0.0;
53             fixed: 1 1;
54             rel1.to: "bg";
55             rel2.to: "bg";
56             min: 16 16;
57             max: 16 16;
58             aspect: 1.0 1.0;
59             aspect_preference: VERTICAL;
60             color: 0 0 0 0;
61          }
62       }
63       part { name: "button_events";
64          type: RECT;
65          dragable {
66             events: "button";
67          }
68          description { state: "default" 0.0;
69             rel1.to_x: "bg";
70             rel1.offset: 0 0;
71             rel1.relative: 0.0 0.0;
72             rel2.to_x: "bg";
73             rel2.offset: -1 -1;
74             rel2.relative: 1.0 1.0;
75             color: 0 0 0 0;
76          }
77       }
78       part { name: "onrect";
79          type: IMAGE;
80          scale: 1;
81          clip_to: "clipper";
82          mouse_events: 0;
83          description { state: "default" 0.0;
84             rel1.to: "button";
85             rel1.relative: -5.0 0.0;
86             rel2.to: "button";
87             rel2.relative: 0.5 1.0;
88             image.normal: "tog_base_on.png";
89          }
90          description { state: "disabled" 0.0;
91             inherit: "default" 0.0;
92             image.normal: "tog_dis_base_on.png";
93          }
94       }
95       part { name: "offrect";
96          type: IMAGE;
97          scale: 1;
98          clip_to: "clipper";
99          mouse_events: 0;
100          description { state: "default" 0.0;
101             rel1.to: "button";
102             rel1.relative: 0.5 0.0;
103             rel2.to: "button";
104             rel2.relative: 6.0 1.0;
105             image.normal: "tog_base_off.png";
106          }
107          description { state: "disabled" 0.0;
108             inherit: "default" 0.0;
109             image.normal: "tog_dis_base_off.png";
110          }
111       }
112       part { name: "elm.offtext";
113          type: TEXT;
114          mouse_events:  0;
115          scale: 1;
116          clip_to: "clipper";
117          description { state: "default" 0.0;
118             fixed: 1 1;
119             rel1.to_x: "button";
120             rel1.relative: 1.0 0.0;
121             rel2.to_x: "offrect";
122             color: 0 0 0 255;
123             text {
124                font:     "Sans,Edje-Vera";
125                size:     10;
126                min:      0 1;
127                align:    0.5 0.5;
128                text:     "OFF";
129             }
130          }
131          description { state: "disabled" 0.0;
132             inherit: "default" 0.0;
133             color: 128 128 128 128;
134          }
135       }
136       part { name: "elm.ontext";
137          type: TEXT;
138          effect: SOFT_SHADOW;
139          mouse_events:  0;
140          scale: 1;
141          clip_to: "clipper";
142          description { state: "default" 0.0;
143             fixed: 1 1;
144             rel1.to_x: "onrect";
145             rel1.offset: 1 1;
146             rel2.to_x: "button";
147             rel2.offset: 0 0;
148             rel2.relative: 0.0 1.0;
149             color: 224 224 224 255;
150             color3: 0 0 0 64;
151             text {
152                font:     "Sans,Edje-Vera";
153                size:     10;
154                min:      0 1;
155                align:    0.5 0.5;
156                text:     "ON";
157             }
158          }
159          description { state: "disabled" 0.0;
160             inherit: "default" 0.0;
161             color: 128 128 128 128;
162             color3: 0 0 0 24;
163          }
164       }
165       part { name: "conf_over";
166          mouse_events:  0;
167          description { state: "default" 0.0;
168             rel1.offset: -1 -1;
169             rel1.to: "bg";
170             rel2.offset: 0 0;
171             rel2.to: "bg";
172             image {
173                normal: "shelf_inset.png";
174                border: 7 7 7 7;
175                middle: 0;
176             }
177             fill.smooth : 0;
178          }
179       }
180       part { name: "button0";
181          mouse_events:  0;
182          clip_to: "clipper";
183          description { state: "default" 0.0;
184             rel1.to: "button2";
185             rel1.offset: -4 -4;
186             rel2.to: "button2";
187             rel2.offset: 3 3;
188             image {
189                normal: "bt_bases.png";
190                border: 11 11 11 11;
191             }
192             image.middle: SOLID;
193             color: 255 255 255 128;
194          }
195       }
196       part { name: "button2";
197          mouse_events:  0;
198          clip_to: "clipper";
199          description { state: "default" 0.0;
200             rel1.to: "button";
201             rel1.offset: -2 -2;
202             rel2.to: "button";
203             rel2.offset: 1 1;
204             image {
205                normal: "bt_basew.png";
206                border: 7 7 7 7;
207             }
208             image.middle: SOLID;
209          }
210       }
211       part { name: "button3";
212          mouse_events:  0;
213          clip_to: "clipper";
214          description { state: "default" 0.0;
215             rel1.to: "button2";
216             rel2.to: "button2";
217             rel2.relative: 1.0 0.5;
218             image {
219                normal: "bt_hilightw.png";
220                border: 4 4 4 0;
221             }
222          }
223       }
224       part { name: "elm.swallow.content";
225          type: SWALLOW;
226          description { state: "default" 0.0;
227             fixed: 1 0;
228             visible: 0;
229             align: 0.0 0.5;
230             rel1.offset: 4 4;
231             rel2.relative: 0.0 1.0;
232             rel2.offset: 3 -5;
233          }
234          description { state: "visible" 0.0;
235             inherit: "default" 0.0;
236             visible: 1;
237             aspect: 1.0 1.0;
238             rel2.offset: 4 -5;
239          }
240          description { state: "disabled" 0.0;
241             inherit: "default" 0.0;
242             color: 128 128 128 128;
243          }
244          description { state: "disabled_visible" 0.0;
245             inherit: "default" 0.0;
246             color: 128 128 128 128;
247             visible: 1;
248             aspect: 1.0 1.0;
249          }
250       }
251       part { name: "elm.text";
252          type: TEXT;
253          mouse_events: 0;
254          scale: 1;
255          description { state: "default" 0.0;
256             visible: 0;
257             rel1.to_x: "elm.swallow.content";
258             rel1.relative: 1.0 0.0;
259             rel1.offset: 0 4;
260             rel2.to_x: "bg";
261             rel2.relative: 0.0 1.0;
262             rel2.offset: -5 -5;
263             color: 0 0 0 255;
264             text {
265                font: "Sans,Edje-Vera";
266                size: 10;
267                min: 0 0;
268                align: 0.0 0.5;
269             }
270          }
271          description { state: "visible" 0.0;
272             inherit: "default" 0.0;
273             visible: 1;
274             text.min: 1 1;
275          }
276          description { state: "disabled" 0.0;
277             inherit: "default" 0.0;
278             color: 128 128 128 128;
279          }
280          description { state: "disabled_visible" 0.0;
281             inherit: "default" 0.0;
282             color: 128 128 128 128;
283             visible: 1;
284             text.min: 1 1;
285          }
286       }
287       part { name: "disabler";
288          type: RECT;
289          description { state: "default" 0.0;
290             color: 0 0 0 0;
291             visible: 0;
292          }
293          description { state: "disabled" 0.0;
294             inherit: "default" 0.0;
295             visible: 1;
296          }
297       }
298    }
299    programs {
300       program { name:   "drag_end";
301          signal: "mouse,up,1";
302          source: "button";
303          script {
304             new Float:dx, Float:dy;
305             get_drag(PART:"button", dx, dy);
306             if (dx > 0.5)
307             {
308                set_drag(PART:"button", 1.0, 0.0);
309             }
310             else
311             {
312                set_drag(PART:"button", 0.0, 0.0);
313             }
314             if (((get_int(is_rtl) == 1) && (dx <= 0.5)) ||
315             (get_int(is_rtl) == 0) && (dx > 0.5)) {
316                emit("elm,action,toggle,on", "");
317             }
318             else {
319                emit("elm,action,toggle,off", "");
320             }
321
322          }
323       }
324       program { name: "toggle_on";
325          signal: "elm,state,toggle,on";
326          source: "elm";
327          script {
328             new Float:drag;
329             if (get_int(is_rtl) == 0) {
330                drag = 100.0;
331             }
332             else {
333                drag = 0.0;
334             }
335             set_drag(PART:"button", drag, 0.0);
336          }
337       }
338       program { name: "toggle_off";
339          signal: "elm,state,toggle,off";
340          source: "elm";
341          script {
342             new Float:drag;
343             if (get_int(is_rtl) == 0) {
344                drag = 0.0;
345             }
346             else {
347                drag = 100.0;
348             }
349             set_drag(PART:"button", drag, 0.0);
350          }
351       }
352       program { name: "text_show";
353          signal: "elm,state,text,visible";
354          source: "elm";
355          action:  STATE_SET "visible" 0.0;
356          target: "elm.text";
357       }
358       program { name: "text_hide";
359          signal: "elm,state,text,hidden";
360          source: "elm";
361          action:  STATE_SET "default" 0.0;
362          target: "elm.text";
363       }
364       program { name: "icon_show";
365          signal: "elm,state,icon,visible";
366          source: "elm";
367          action:  STATE_SET "visible" 0.0;
368          target: "elm.swallow.content";
369       }
370       program { name: "icon_hide";
371          signal: "elm,state,icon,hidden";
372          source: "elm";
373          action:  STATE_SET "default" 0.0;
374          target: "elm.swallow.content";
375       }
376       program { name: "disable";
377          signal: "elm,state,disabled";
378          source: "elm";
379          action: STATE_SET "disabled" 0.0;
380          target: "elm.offtext";
381          target: "elm.ontext";
382          target: "onrect";
383          target: "offrect";
384          target: "disabler";
385          after: "disable_text";
386       }
387       program { name: "disable_text";
388          script {
389             new st[31];
390             new Float:vl;
391             get_state(PART:"elm.text", st, 30, vl);
392             if (!strcmp(st, "visible"))
393             set_state(PART:"elm.text", "disabled_visible", 0.0);
394             else
395             set_state(PART:"elm.text", "disabled", 0.0);
396
397             get_state(PART:"elm.swallow.content", st, 30, vl);
398             if (!strcmp(st, "visible"))
399             set_state(PART:"elm.swallow.content", "disabled_visible", 0.0);
400             else
401             set_state(PART:"elm.swallow.content", "disabled", 0.0);
402          }
403       }
404       program { name: "enable";
405          signal: "elm,state,enabled";
406          source: "elm";
407          action: STATE_SET "default" 0.0;
408          target: "disabler";
409          target: "onrect";
410          target: "offrect";
411          after: "enable_text";
412       }
413       program { name: "enable_text";
414          script {
415             new st[31];
416             new Float:vl;
417             get_state(PART:"elm.text", st, 30, vl);
418             if (!strcmp(st, "disabled_visible"))
419             set_state(PART:"elm.text", "visible", 0.0);
420             else
421             set_state(PART:"elm.text", "default", 0.0);
422
423             get_state(PART:"elm.swallow.content", st, 30, vl);
424             if (!strcmp(st, "visible"))
425             set_state(PART:"elm.swallow.content", "visible", 0.0);
426             else
427             set_state(PART:"elm.swallow.content", "default", 0.0);
428          }
429       }
430       program { name: "to_rtl";
431          signal: "edje,state,rtl";
432          source: "edje";
433          script {
434             set_int(is_rtl, 1);
435          }
436       }
437       program { name: "to_ltr";
438          signal: "edje,state,ltr";
439          source: "edje";
440          script {
441             set_int(is_rtl, 0);
442          }
443       }
444    }
445 }