tizen 2.4 release
[framework/uifw/elementary.git] / src / examples / prefs_example_03.edc
1 #define MSG_ID_VEL (1)
2
3 collections {
4    group {
5       name: "prefs_edje";
6       max: 450 450;
7       min: 50 50;
8
9       parts {
10          part {
11             name: "bg";
12             type: RECT;
13             scale: 1;
14             description {
15                state: "default" 0.0;
16                min: 450 450;
17                max: 450 450;
18                color: 255 255 255 0;
19                align: 0.0 0.0;
20             }
21          }
22
23          part {
24             name: "square1";
25             type: RECT;
26             scale: 1;
27             description {
28                state: "default" 0.0;
29                min: 50 50;
30                max: 50 50;
31                color: 0 0 255 255;
32                align: 0.0 0.5;
33             }
34             description {
35                state: "invert" 0.0;
36                inherit: "default" 0.0;
37                color: 0 255 0 255;
38                align: 1 0.5;
39             }
40          }
41
42          part {
43             name: "square2";
44             type: RECT;
45             description {
46                state: "default" 0.0;
47                min: 50 50;
48                max: 50 50;
49                color: 0 255 0 255;
50                align: 0.5 0.0;
51             }
52             description {
53                state: "invert" 0.0;
54                inherit: "default" 0.0;
55                color: 0 0 255 255;
56                align: 0.5 1.0;
57             }
58          }
59       }
60
61       program {
62          name: "animation_start";
63          signal: "start";
64          source: "animation";
65          after: "animation,clear";
66       }
67
68       program {
69          name: "call_animation,state1";
70          script {
71               cancel_anim(anim_id);
72               set_int(anim_id, anim(get_float(global_speed), "animation_1", 0));
73               set_int(anim_n, 1);
74          }
75       }
76
77       program {
78          name: "call_animation,state2";
79          script {
80               cancel_anim(anim_id);
81               set_int(anim_id, anim(get_float(global_speed), "animation_2", 0));
82               set_int(anim_n, 2);
83          }
84       }
85
86       program {
87          name: "animation,stop";
88          signal: "stop";
89          source: "animation";
90          script {
91               cancel_anim(get_int(anim_id));
92          }
93       }
94
95       program {
96          name: "animation,clear";
97          script {
98               cancel_anim(get_int(anim_id));
99               if (get_int(anim_n) == 2)
100                 set_float(anim_pos, (get_float(anim_pos) - 1) * ( -1));
101          }
102          after: "call_animation,state1";
103       }
104
105       script {
106          public global_speed;
107          public anim_id;
108          public anim_pos;
109          public anim_n;
110
111          public message(Msg_Type:type, id, ...) {
112             if ((type == MSG_FLOAT) && (id == MSG_ID_VEL))
113               set_float(global_speed, Float:getarg(2));
114          }
115
116          public animation_1(val, Float:pos) {
117            if (pos >= get_float(anim_pos) && get_int(anim_n) == 1)
118              {
119                 set_tween_state(PART:"square1", pos, "default", 0.0,
120                                 "invert", 0.0);
121                 set_tween_state(PART:"square2", pos, "default", 0.0,
122                                 "invert", 0.0);
123                 set_float(anim_pos, pos);
124              }
125            if (pos >= 1)
126              {
127                 run_program(PROGRAM:"call_animation,state2");
128                 set_float(anim_pos, 0.0);
129              }
130          }
131
132          public animation_2(val, Float:pos) {
133            if (pos >= get_float(anim_pos) && get_int(anim_n) == 2)
134              {
135                 set_tween_state(PART:"square1", pos, "invert", 0.0,
136                                 "default", 0.0);
137                 set_tween_state(PART:"square2", pos, "invert", 0.0,
138                                 "default", 0.0);
139                 set_float(anim_pos, pos);
140              }
141            if (pos >= 1)
142              {
143                 run_program(PROGRAM:"call_animation,state1");
144                 set_float(anim_pos, 0.0);
145              }
146          }
147       }
148 }
149
150 #undef MSG_ID_VEL