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