tizen 2.4 release
[framework/uifw/elementary.git] / data / objects / test_focus_style.edc
1 //  c1 - c4
2 //  |base|
3 //  |    |
4 //  c3 - c2
5 #define OUTER_BASE_PARTS(w, h)               \
6    part { name: "base"; type: SPACER;        \
7       description {                          \
8          state: "default" 0.0; } }           \
9    part { name: "c1"; type: SPACER;          \
10       description { state: "default" 0.0;    \
11          rel1.to: "base";                    \
12          rel2.to: "base";                    \
13          rel2.relative: 0 0;                 \
14          align: 1 1;                         \
15          min: w h;                           \
16          max: w h; } }                       \
17    part { name: "c3"; type: SPACER;          \
18       description { state: "default" 0.0;    \
19          rel1.to: "base";                    \
20          rel2.to: "base";                    \
21          rel1.relative: 0 1;                 \
22          rel2.relative: 0 1;                 \
23          align: 1 0;                         \
24          min: w h;                           \
25          max: w h; } }                       \
26    part { name: "c4"; type: SPACER;          \
27       description { state: "default" 0.0;    \
28          rel1.to: "base";                    \
29          rel2.to: "base";                    \
30          rel1.relative: 1 0;                 \
31          rel2.relative: 1 0;                 \
32          min: w h;                           \
33          max: w h; } }                       \
34    part { name: "c2"; type: SPACER;          \
35       mouse_events: 0;                       \
36       description { state: "default" 0.0;    \
37          rel1.to: "base";                    \
38          rel1.relative: 1 1;                 \
39          rel2.to: "base";                    \
40          rel2.relative: 1 1;                 \
41          align: 0 0;                         \
42          min: w h;                           \
43          max: w h; } }
44
45 collections {
46    group { name: "elm/focus_highlight/top/glow";
47       images {
48          image: "border6.png" COMP;
49       }
50       data.item: "animate" "on";
51
52       script {
53          public src_x, src_y, src_w, src_h;
54          public diffx, diffy, diffw, diffh;
55          public anim_highlight(val, Float:pos) {
56             new x, y, w, h, dx, dy, dw, dh;
57
58             dx = round(float_mul(float(get_int(diffx)), pos));
59             x = get_int(src_x) + dx;
60             dy = round(float_mul(float(get_int(diffy)), pos));
61             y = get_int(src_y) + dy;
62             dw = round(float_mul(float(get_int(diffw)), pos));
63             w = get_int(src_w) + dw;
64             dh = round(float_mul(float(get_int(diffh)), pos));
65             h = get_int(src_h) + dh;
66
67             update_offset(x, y, w, h);
68
69             if(pos >= 1.0) {
70                emit("elm,action,focus,anim,end", "");
71                set_state(PART:"highlight", "default", 0.0);
72             }
73          }
74          public update_offset(x, y, w, h) {
75             set_state_val(PART:"base", STATE_REL1_OFFSET, x, y);
76             set_state_val(PART:"base", STATE_REL2_OFFSET, x + w, y + h);
77          }
78          public message(Msg_Type:type, id, ...) {
79             if((type == MSG_INT_SET) && (id == 1)) {
80                new x1, y1, w1, h1, x2, y2, w2, h2;
81
82                x1 = getarg(2);
83                y1 = getarg(3);
84                w1 = getarg(4);
85                h1 = getarg(5);
86                x2 = getarg(6);
87                y2 = getarg(7);
88                w2 = getarg(8);
89                h2 = getarg(9);
90
91                set_int(src_x, x1);
92                set_int(src_y, y1);
93                set_int(src_w, w1);
94                set_int(src_h, h1);
95                set_int(diffx, x2 - x1);
96                set_int(diffy, y2 - y1);
97                set_int(diffw, w2 - w1);
98                set_int(diffh, h2 - h1);
99
100                custom_state(PART:"base", "default", 0.0);
101                set_state_val(PART:"base", STATE_REL1, 0.0, 0.0);
102                set_state_val(PART:"base", STATE_REL2, 0.0, 0.0);
103                update_offset(x1, y1, w1, h1);
104                set_state(PART:"base", "custom", 0.0);
105                anim(0.2, "anim_highlight", 0);
106             }
107          }
108       } //script ends
109       parts {
110          OUTER_BASE_PARTS(12, 12);
111          part { name: "highlight"; type: IMAGE;
112             mouse_events: 0;
113             description { state: "default" 0.0;
114                image.normal: "border6.png";
115                image.border: 20 20 20 20;
116                rel1.to: "c1";
117                rel2.to: "c2";
118             }
119             description { state: "visible" 0.0;
120                inherit: "default" 0.0;
121               }
122             description { state: "invisible" 0.0;
123                inherit: "default" 0.0;
124                visible: 0;
125             }
126          }
127       } //parts ends
128       programs {
129          program { name: "show";
130             signal: "elm,action,focus,show";
131             source: "elm";
132             action: ACTION_STOP;
133             target: "hide";
134             target: "hide_start";
135             target: "hide_end";
136             after: "show_start";
137          }
138          program { name: "show_start";
139             action: STATE_SET "visible" 0.0;
140             transition: SIN 0.2;
141             target: "highlight";
142             after: "show_end";
143          }
144          program { name: "show_end";
145             action: SIGNAL_EMIT "elm,action,focus,show,end" "";
146          }
147          program { name: "hide";
148             signal: "elm,action,focus,hide";
149             source: "elm";
150             action: ACTION_STOP;
151             target: "show";
152             target: "show_start";
153             target: "show_end";
154             after: "hide_start";
155          }
156          program { name: "hide_start";
157             action: STATE_SET "invisible" 0.0;
158             transition: SIN 0.2;
159             target: "highlight";
160             after: "hide_end";
161          }
162          program { name: "hide_end";
163             action: SIGNAL_EMIT "elm,action,focus,hide,end" "";
164          }
165       } //programs ends
166    } //group ends
167
168    group { name: "elm/focus_highlight/top/glow_effect";
169       inherit: "elm/focus_highlight/top/glow";
170       images {
171          image: "border.png" COMP;
172          image: "border2.png" COMP;
173          image: "border3.png" COMP;
174          image: "border4.png" COMP;
175          image: "border5.png" COMP;
176          image: "border6.png" COMP;
177       }
178       data.item: "animate" "on";
179
180       script {
181          public src_x, src_y, src_w, src_h;
182          public diffx, diffy, diffw, diffh;
183          public anim_highlight(val, Float:pos) {
184             new x, y, w, h, dx, dy, dw, dh, Float:p;
185             p = 1.0 - ((1.0 - pos) * (1.0 - pos) * (1.0 - pos));
186
187             dx = round(float_mul(float(get_int(diffx)), p));
188             x = get_int(src_x) + dx;
189             dy = round(float_mul(float(get_int(diffy)), p));
190             y = get_int(src_y) + dy;
191             dw = round(float_mul(float(get_int(diffw)), p));
192             w = get_int(src_w) + dw;
193             dh = round(float_mul(float(get_int(diffh)), p));
194             h = get_int(src_h) + dh;
195
196             update_offset(x, y, w, h);
197
198             if(pos >= 1.0) {
199                emit("elm,action,focus,anim,end", "");
200                set_state(PART:"highlight", "default", 0.0);
201                emit("dim", "");
202             }
203          }
204          public update_offset(x, y, w, h) {
205             set_state_val(PART:"base", STATE_REL1_OFFSET, x, y);
206             set_state_val(PART:"base", STATE_REL2_OFFSET, x + w, y + h);
207          }
208          public message(Msg_Type:type, id, ...) {
209             if((type == MSG_INT_SET) && (id == 1)) {
210                new x1, y1, w1, h1, x2, y2, w2, h2;
211
212                x1 = getarg(2);
213                y1 = getarg(3);
214                w1 = getarg(4);
215                h1 = getarg(5);
216                x2 = getarg(6);
217                y2 = getarg(7);
218                w2 = getarg(8);
219                h2 = getarg(9);
220
221                set_int(src_x, x1);
222                set_int(src_y, y1);
223                set_int(src_w, w1);
224                set_int(src_h, h1);
225                set_int(diffx, x2 - x1);
226                set_int(diffy, y2 - y1);
227                set_int(diffw, w2 - w1);
228                set_int(diffh, h2 - h1);
229
230                custom_state(PART:"base", "default", 0.0);
231                set_state_val(PART:"base", STATE_REL1, 0.0, 0.0);
232                set_state_val(PART:"base", STATE_REL2, 0.0, 0.0);
233                update_offset(x1, y1, w1, h1);
234                set_state(PART:"base", "custom", 0.0);
235                anim(0.2, "anim_highlight", 0);
236             }
237          }
238       } //script ends
239       parts {
240          part { name: "highlight"; type: IMAGE;
241             mouse_events: 0;
242             description { state: "default" 0.0;
243                image.normal: "border6.png";
244                image.border: 16 16 16 16;
245                rel1.to: "c1";
246                rel2.to: "c2";
247                visible: 1;
248             }
249             description { state: "visible" 0.0;
250                inherit: "default" 0.0;
251             }
252             description { state: "visible" 0.1;
253                inherit: "visible" 0.0;
254                image.normal: "border2.png";
255                image.border: 18 18 18 18;
256             }
257             description { state: "visible" 0.2;
258                inherit: "visible" 0.0;
259                image.normal: "border3.png";
260                image.border: 19 19 19 19;
261             }
262             description { state: "visible" 0.3;
263                inherit: "visible" 0.0;
264                image.normal: "border4.png";
265                image.border: 20 20 20 20;
266             }
267             description { state: "visible" 0.4;
268                inherit: "visible" 0.0;
269                image.normal: "border5.png";
270                image.border: 21 21 21 21;
271             }
272             description { state: "visible" 0.5;
273                inherit: "visible" 0.0;
274                image.normal: "border6.png";
275                image.border: 25 25 25 25;
276             }
277             description { state: "invisible" 0.0;
278                inherit: "default" 0.0;
279                visible: 0;
280             }
281          }
282       }//parts ends
283       programs {
284          program { name: "show";
285             signal: "elm,action,focus,show";
286             source: "elm";
287             action: ACTION_STOP;
288             target: "hide";
289             target: "hide_start";
290             target: "hide_end";
291             after: "show_start";
292          }
293          program { name: "show_start";
294             action: SIGNAL_EMIT "dim" "";
295             after: "show_end";
296          }
297          program { name: "dim_start";
298             signal: "dim";
299             in: 2 0.4;
300             source: "";
301             action: STATE_SET "visible" 0.4;
302             transition: SINUSOIDAL 0.2;
303             target: "highlight";
304             after: "dim1";
305          }
306          program { name: "dim1";
307             action: STATE_SET "visible" 0.3;
308             transition: SINUSOIDAL 0.2;
309             target: "highlight";
310             after: "dim2";
311          }
312          program { name: "dim2";
313             action: STATE_SET "visible" 0.2;
314             transition: SINUSOIDAL 0.2;
315             target: "highlight";
316             after: "dim3";
317          }
318          program { name: "dim3";
319             action: STATE_SET "visible" 0.1;
320             transition: SINUSOIDAL 0.2;
321             target: "highlight";
322             after: "dim_end";
323          }
324          program { name: "dim_end";
325             action: SIGNAL_EMIT "glow" "";
326          }
327          program { name: "glow_start";
328             signal: "glow";
329             source: "";
330             in: 1 0.4;
331             action: STATE_SET "visible" 0.0;
332             transition: SINUSOIDAL 0.2;
333             target: "highlight";
334             after: "glow1";
335          }
336          program { name: "glow1";
337             action: STATE_SET "visible" 0.1;
338             transition: SINUSOIDAL 0.2;
339             target: "highlight";
340             after: "glow2";
341          }
342          program { name: "glow2";
343             action: STATE_SET "visible" 0.2;
344             transition: SINUSOIDAL 0.2;
345             target: "highlight";
346             after: "glow3";
347          }
348          program { name: "glow3";
349             action: STATE_SET "visible" 0.3;
350             transition: SINUSOIDAL 0.2;
351             target: "highlight";
352             after: "glow4";
353          }
354          program { name: "glow4";
355             action: STATE_SET "visible" 0.4;
356             transition: SINUSOIDAL 0.2;
357             target: "highlight";
358             after: "glow5";
359          }
360          program { name: "glow5";
361             action: STATE_SET "visible" 0.5;
362             transition: SINUSOIDAL 0.2;
363             target: "highlight";
364             after: "glow1";
365          }
366          program { name: "show_end";
367             action: SIGNAL_EMIT "elm,action,focus,show,end" "";
368          }
369          program { name: "hide";
370             signal: "elm,action,focus,hide";
371             source: "elm";
372             action: ACTION_STOP;
373             target: "show";
374             target: "show_start";
375             target: "show_end";
376             after: "hide_start";
377          }
378          program { name: "hide_start";
379             action: STATE_SET "invisible" 0.0;
380             transition: LIN 0.2;
381             target: "highlight";
382             after: "hide_end";
383          }
384          program { name: "hide_end";
385             action: SIGNAL_EMIT "elm,action,focus,hide,end" "";
386          }
387       } //programs ends
388    } //group ends
389
390    group { name: "elm/layout/focus/example";
391       data.item: "focus_part" "focus_area";
392       parts {
393          part { name: "bg"; type: RECT;
394             scale: 1;
395             description { state: "default" 0.0;
396                color: 255 255 0 255;
397                min: 150 40;
398                max: 150 40;
399             }
400          }
401          part { name: "elm.text"; type: TEXT;
402             scale: 1;
403             description { state: "default" 0.0;
404                rel1.to: "bg";
405                rel2.to: "bg";
406                text.text: "layout";
407                text.size: 9;
408                color: 0 0 0 255;
409             }
410          }
411          part { name: "focus_area"; type: RECT;
412             scale: 1;
413             description { state: "default" 0.0;
414                rel1.to: "bg";
415                rel2.to: "bg";
416                rel2.relative: 0 0;
417                align: 0 0;
418                min: 60 30;
419                max: 60 30;
420                fixed: 1 1;
421                color: 125 125 125 125;
422             }
423          }
424          part { name: "elm.text1"; type: TEXT;
425             scale: 1;
426             description { state: "default" 0.0;
427                rel1.to: "focus_area";
428                rel2.to: "focus_area";
429                text.text: "focus_part";
430                text.size: 9;
431                color: 255 0 255 255;
432             }
433          }
434       }
435    } //group ends
436
437 #include "../../data/themes/macros.edc"
438 #include "../../data/themes/fonts.edc"
439 #include "../../data/themes/colorclasses.edc"
440
441 // to customize check default style
442 #include "../../data/themes/edc/elm/check.edc"
443    group { name: "elm/check/base/focus_text";
444       data.item: "focus_part" "elm.text";
445       inherit: "elm/check/base/default";
446    }
447
448 // to customize button default style
449 #include "../../data/themes/edc/elm/button.edc"
450    group { name: "elm/button/base/focus_icon";
451       data.item: "focus_part" "elm.swallow.content";
452       inherit: "elm/button/base/default";
453    }
454 }