Initialize Tizen 2.3
[framework/uifw/elementary.git] / mobile / data / themes / widgets / flipselector.edc
1 #define FLIP_PICKER_MAX_LEN (50)
2 #define FLIP_PICKER_MAX_LEN_STR "50"
3
4 group { name: "elm/flipselector/base/default";
5    images {
6       image: "flip_base.png" COMP;
7       image: "flip_base_shad.png" COMP;
8       image: "flip_shad.png" COMP;
9       image: "arrow_up.png" COMP;
10       image: "arrow_down.png" COMP;
11       image: "flip_t.png" COMP;
12       image: "flip_b.png" COMP;
13    }
14
15    data {
16       item: "max_len" FLIP_PICKER_MAX_LEN_STR;
17    }
18
19    //FIXME: quick successive clicks on, say, up, lead to nastiness
20    script {
21       public cur, prev, next, lock;
22
23       flip_up(str[]) {
24          new tmp[FLIP_PICKER_MAX_LEN];
25          if (get_int(lock) == 1) {
26             replace_str(next, 0, str);
27             return;
28          }
29          fetch_str(cur, 0, tmp, FLIP_PICKER_MAX_LEN);
30
31          set_text(PART:"bottom_b", tmp);
32
33          set_state(PART:"elm.top", "shrink", 0.0);
34          set_text(PART:"elm.top", tmp);
35          set_state(PART:"elm.top", "default", 0.0);
36          set_text(PART:"elm.top", tmp);
37
38          replace_str(prev, 0, tmp);
39
40          set_state(PART:"elm.bottom", "default", 0.0);
41          set_text(PART:"elm.bottom", str);
42          set_state(PART:"elm.bottom", "shrink", 0.0);
43          set_text(PART:"elm.bottom", str);
44
45          set_text(PART:"top_b", str);
46
47          replace_str(cur, 0, str);
48
49          set_state(PART:"bottom_sheet", "shrink", 0.0);
50          set_state(PART:"top_sheet", "default", 0.0);
51
52          set_int(lock, 1);
53          set_state(PART:"shadow", "default", 0.0);
54          anim(0.2, "animator_top_down", 1);
55       }
56
57       flip_dn(str[]) {      
58          new tmp[FLIP_PICKER_MAX_LEN];
59          if (get_int(lock) == 1) {
60             replace_str(next, 0, str);
61             return;
62          }
63
64          fetch_str(cur, 0, tmp, FLIP_PICKER_MAX_LEN);
65
66          set_text(PART:"top_b", tmp);
67
68          set_state(PART:"elm.bottom", "shrink", 0.0);
69          set_text(PART:"elm.bottom", tmp);
70          set_state(PART:"elm.bottom", "default", 0.0);
71          set_text(PART:"elm.bottom", tmp);
72
73          replace_str(prev, 0, tmp);
74
75          set_state(PART:"elm.top", "default", 0.0);
76          set_text(PART:"elm.top", str);
77          set_state(PART:"elm.top", "shrink", 0.0);
78          set_text(PART:"elm.top", str);
79
80          set_text(PART:"bottom_b", str);
81
82          replace_str(cur, 0, str);
83
84          set_state(PART:"bottom_sheet", "default", 0.0);
85          set_state(PART:"top_sheet", "shrink", 0.0);
86
87          set_int(lock, 1);
88          set_state(PART:"shadow", "full", 0.0);
89          anim(0.2, "animator_bottom_up", 1);
90       }
91       
92       public animator_bottom_down(val, Float:pos) {
93          new tmp[FLIP_PICKER_MAX_LEN];
94
95          set_tween_state(PART:"elm.bottom", pos, "shrink", 0.0, "default", 0.0);
96          set_tween_state(PART:"bottom_sheet", pos, "shrink", 0.0, "default",
97          0.0);
98          set_tween_state(PART:"shadow", pos, "half", 0.0, "full",
99          0.0);
100
101          if (pos >= 1.0) {
102             set_state(PART:"shadow", "default", 0.0);
103             set_int(lock, 0);
104
105             fetch_str(next, 0, tmp, FLIP_PICKER_MAX_LEN);
106             if (strncmp(tmp, "", FLIP_PICKER_MAX_LEN) != 0) {
107                replace_str(next, 0, "");
108                flip_up(tmp);
109             }
110          }
111       }
112
113       public animator_top_down(val, Float:pos) {
114          set_tween_state(PART:"elm.top", pos, "default", 0.0, "shrink", 0.0);
115          set_tween_state(PART:"top_sheet", pos, "default", 0.0, "shrink",
116          0.0);
117          set_tween_state(PART:"shadow", pos, "default", 0.0, "half",
118          0.0);
119
120          if (pos >= 1.0)
121          anim(0.2, "animator_bottom_down", val);
122       }
123
124       public animator_bottom_up(val, Float:pos) {
125          set_tween_state(PART:"elm.bottom", pos, "default", 0.0, "shrink", 0.0);
126          set_tween_state(PART:"bottom_sheet", pos, "default", 0.0, "shrink",
127          0.0);
128          set_tween_state(PART:"shadow", pos, "full", 0.0, "half",
129          0.0);
130
131          if (pos >= 1.0)
132          anim(0.2, "animator_top_up", val);
133       }
134
135       public animator_top_up(val, Float:pos) {
136          new tmp[FLIP_PICKER_MAX_LEN];
137
138          set_tween_state(PART:"elm.top", pos, "shrink", 0.0, "default", 0.0);
139          set_tween_state(PART:"top_sheet", pos, "shrink", 0.0, "default",
140          0.0);
141          set_tween_state(PART:"shadow", pos, "half", 0.0, "default",
142          0.0);
143
144          if (pos >= 1.0) {
145             set_state(PART:"shadow", "default", 0.0);
146             set_int(lock, 0);
147
148             fetch_str(next, 0, tmp, FLIP_PICKER_MAX_LEN);
149             if (strncmp(tmp, "", FLIP_PICKER_MAX_LEN) != 0) {
150                replace_str(next, 0, "");
151                flip_dn(tmp);
152             }
153          }
154       }
155
156       public message(Msg_Type:type, id, ...) {
157          /* flip down */
158          if ((type == MSG_STRING) && (id == 1)) {
159             new value[FLIP_PICKER_MAX_LEN];
160             snprintf(value, FLIP_PICKER_MAX_LEN, "%s", getarg(2));
161             flip_up(value);
162          }
163
164          /* flip up */
165          if ((type == MSG_STRING) && (id == 2)) {
166             new value[FLIP_PICKER_MAX_LEN];
167             snprintf(value, FLIP_PICKER_MAX_LEN, "%s", getarg(2));
168             flip_dn(value);
169          }
170       }
171    }
172
173    parts {
174       part { name: "shad";
175          mouse_events: 0;
176          description { state: "default" 0.0;
177             rel1.offset: -4 -4;
178             rel1.to: "base";
179             rel2.offset: 3 3;
180             rel2.to: "base";
181             image {
182                normal: "flip_base_shad.png";
183                border: 8 8 8 8;
184             }
185          }
186       }
187
188       part { name: "base";
189          scale: 1;
190          description { state: "default" 0.0;
191             rel1.offset: 4 4;
192             rel2.offset: -5 -5;
193             min: 24 48;
194             image.normal: "flip_base.png";
195          }
196       }
197
198       part { name: "b";
199          type: RECT;
200          mouse_events: 1;
201          description { state: "default" 0.0;
202             rel1.to: "base";
203             rel1.relative: 0.0 0.5;
204             rel2.to: "base";
205             color: 0 0 0 0;
206          }
207          description { state: "hidden" 0.0;
208             inherit: "default" 0.0;
209             visible: 0;
210          }
211       }
212
213       part { name: "t";
214          type: RECT;
215          mouse_events: 1;
216          description { state: "default" 0.0;
217             rel1.to: "base";
218             rel2.to: "base";
219             rel2.relative: 1.0 0.5;
220             color: 0 0 0 0;
221          }
222          description { state: "hidden" 0.0;
223             inherit: "default" 0.0;
224             visible: 0;
225          }
226       }
227
228       part { name: "bottom_sheet_static";
229          mouse_events: 0;
230          description { state: "default" 0.0;
231             visible: 1;
232             rel1.to: "b";
233             rel2.to: "b";
234             image.normal: "flip_b.png";
235          }
236       }
237
238       part { name: "bottom_b";
239          mouse_events: 0;
240          clip_to: "bottom_clipper";
241          type: TEXT;
242          scale: 1;
243          description { state: "default" 0.0;
244             rel1.to: "base";
245             rel2.to: "base";
246             color: 0 0 0 255;
247             color2: 0 0 0 255;
248             text {
249                font: "Sans:style=Bold,Edje-Vera-Bold";
250                size: 30;
251                min: 1 1;
252                align: 0.5 0.5;
253             }
254          }
255       }
256
257       part { name: "shadow";
258          mouse_events: 0;
259          description { state: "default" 0.0;
260             rel1.to: "b";
261             rel2.to: "b";
262             rel2.relative: 1.0 0.0;
263             image.normal: "flip_shad.png";
264          }
265          description { state: "half" 0.0;
266             inherit: "default" 0.0;
267             rel2.relative: 1.0 0.5;
268          }
269          description { state: "full" 0.0;
270             inherit: "default" 0.0;
271             rel2.relative: 1.0 1.0;
272          }
273       }
274
275       part { name: "bottom_sheet";
276          mouse_events: 0;
277          description { state: "default" 0.0;
278             visible: 1;
279             rel1.to: "b";
280             rel2.to: "b";
281             image.normal: "flip_b.png";
282          }
283          description { state: "shrink" 0.0;
284             inherit: "default" 0.0;
285             visible: 0;
286             rel2.relative: 1.0 0.0;
287          }
288       }
289
290       part { name: "elm.bottom";
291          mouse_events: 0;
292          clip_to: "bottom_clipper";
293          type: TEXT;
294          scale: 1;
295          description { state: "default" 0.0;
296             rel1.to: "base";
297             rel2.to: "base";
298             color: 0 0 0 255;
299             color2: 0 0 0 255;
300             text {
301                font: "Sans:style=Bold,Edje-Vera-Bold";
302                size: 30;
303                min: 1 1;
304                align: 0.5 0.5;
305             }
306          }
307          description { state: "shrink" 0.0;
308             inherit: "default" 0.0;
309             color: 128 128 128 255;
310             visible: 0;
311             rel2.relative: 1.0 0.5; /* FIXME: same visual effect? --> MAP! */
312          }
313       }
314
315       part { name: "top_sheet_static";
316          mouse_events: 0;
317          description { state: "default" 0.0;
318             visible: 1;
319             rel1.to: "t";
320             rel2.to: "t";
321             image.normal: "flip_t.png";
322          }
323       }
324
325       part { name: "top_b";
326          mouse_events: 0;
327          clip_to: "top_clipper";
328          type: TEXT;
329          scale: 1;
330          description { state: "default" 0.0;
331             rel1.to: "base";
332             rel2.to: "base";
333             color: 0 0 0 255;
334             color2: 0 0 0 255;
335             text {
336                font: "Sans:style=Bold,Edje-Vera-Bold";
337                size: 30;
338                min: 1 1;
339                align: 0.5 0.5;
340                source: "elm.top";
341             }
342          }
343       }
344
345       part { name: "top_sheet";
346          mouse_events: 0;
347          description { state: "default" 0.0;
348             visible: 1;
349             rel1.to: "t";
350             rel2.to: "t";
351             image.normal: "flip_t.png";
352          }
353          description { state: "shrink" 0.0;
354             inherit: "default" 0.0;
355             color: 128 128 128 255;
356             visible: 0;
357             rel1.relative: 0.0 1.0;
358          }
359       }
360
361       part { name: "elm.top";
362          mouse_events: 0;
363          clip_to: "top_clipper";
364          type: TEXT;
365          scale: 1;
366          description { state: "default" 0.0;
367             rel1.to: "base";
368             rel2.to: "base";
369             color: 0 0 0 255;
370             color2: 0 0 0 255;
371             text {
372                font: "Sans:style=Bold,Edje-Vera-Bold";
373                size: 30;
374                min: 1 1;
375                align: 0.5 0.5;
376             }
377          }
378          description { state: "shrink" 0.0;
379             inherit: "default" 0.0;
380             visible: 0;
381             rel1.relative: 0.0 0.5;
382          }
383       }
384
385       part { name: "arrow_top";
386          mouse_events: 0;
387          clip_to: "disclip";
388          scale: 1;
389          description { state: "default" 0.0;
390             min: 15 15;
391             max: 15 15;
392             align: 0.5 0.0;
393             rel1.to: "t";
394             rel2.to: "t";
395             image.normal: "arrow_up.png";
396          }
397          description { state: "hidden" 0.0;
398             inherit: "default" 0.0;
399             visible: 0;
400          }
401       }
402       part { name: "arrow_bottom";
403          mouse_events: 0;
404          clip_to: "disclip";
405          scale: 1;
406          description { state: "default" 0.0;
407             min: 15 15;
408             max: 15 15;
409             align: 0.5 1.0;
410             rel1.to: "b";
411             rel2.to: "b";
412             image.normal: "arrow_down.png";
413          }
414          description { state: "hidden" 0.0;
415             inherit: "default" 0.0;
416             visible: 0;
417          }
418       }
419
420       part {
421          type: RECT;
422          mouse_events: 0;
423          name: "top_clipper";
424          clip_to: "disclip";
425          description {
426             state: "default" 0.0;
427             rel1.to: "t";
428             rel2.to: "t";
429             visible: 1;
430          }
431       }
432
433       part {
434          type: RECT;
435          mouse_events: 0;
436          name: "bottom_clipper";
437          clip_to: "disclip";
438          description {
439             state: "default" 0.0;
440             rel1.to: "b";
441             rel2.to: "b";
442             visible: 1;
443          }
444       }
445
446       part {
447          type: RECT;
448          name: "disclip";
449          description {
450             state: "default" 0.0;
451             color: 255 255 255 255;
452          }
453          description {
454             state: "enabled" 0.0;
455             color: 100 100 100 100;
456          }
457       }
458
459       part {
460          type: RECT;
461          name: "event_blocker";
462          description {
463             state: "default" 0.0;
464             color: 0 0 0 0;
465             visible: 0;
466          }
467          description {
468             state: "enabled" 0.0;
469             inherit: "default" 0.0;
470             visible: 1;
471          }
472       }
473
474    }
475
476    programs {
477       program { name: "load";
478          signal: "load";
479          source: "";
480          script {
481             append_str(cur, "");
482             append_str(prev, "");
483             append_str(next, "");
484             set_int(lock, 0);
485          }
486       }
487
488       program { name: "hide_arrows";
489          signal: "elm,state,button,hidden";
490          source: "elm";
491          action: STATE_SET "hidden" 0.0;
492          target: "arrow_top";
493          target: "arrow_bottom";
494          target: "t";
495          target: "b";
496       }
497
498       program { name: "show_arrows";
499          signal: "elm,state,button,visible";
500          source: "elm";
501          action: STATE_SET "default" 0.0;
502          target: "arrow_top";
503          target: "arrow_bottom";
504          target: "t";
505          target: "b";
506       }
507
508       program { name: "up";
509          signal: "mouse,down,1";
510          source: "t";
511          action: SIGNAL_EMIT "elm,action,up,start" "";
512       }
513       program { name: "up,stop";
514          signal: "mouse,up,1";
515          source: "t";
516          action: SIGNAL_EMIT "elm,action,up,stop" "";
517       }
518       program { name: "down";
519          signal: "mouse,down,1";
520          source: "b";
521          action: SIGNAL_EMIT "elm,action,down,start" "";
522       }
523       program { name: "down,stop";
524          signal: "mouse,up,1";
525          source: "b";
526          action: SIGNAL_EMIT "elm,action,down,stop" "";
527       }
528       program { name: "disable";
529          signal: "elm,state,disabled";
530          source: "elm";
531          action: STATE_SET "enabled" 0.0;
532          target: "disclip";
533          target: "event_blocker";
534       }
535        program { name: "enable";
536          signal: "elm,state,enabled";
537          source: "elm";
538          action: STATE_SET "default" 0.0;
539          target: "disclip";
540          target: "event_blocker";
541        }
542    }
543 }