apply FSL(Flora Software License)
[apps/home/gallery.git] / res / white_theme / edc / gl-check.edc
1 /*
2   * Copyright 2012  Samsung Electronics Co., Ltd
3   *
4   * Licensed under the Flora License, Version 1.0 (the "License");
5   * you may not use this file except in compliance with the License.
6   * You may obtain a copy of the License at
7   *
8   *     http://www.tizenopensource.org/license
9   *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16
17 #define CHECK_STYLE_DEFAULT_BG_NORMAL_MIN_MAX_INC 60 60
18
19 #define CHECK_DEFAULT_TEXT_NORMAL_COLOR_INC        255 255 255 255
20 #define CHECK_DEFAULT_TEXT_PRESSED_COLOR_INC      255 255 255 255
21 #define CHECK_DEFAULT_TEXT_DISABLED_COLOR_INC          136 136 136 136
22
23 ////////////////////////////////////////////////////////////////////////////////////////
24 //
25 // check default textblock style
26 //
27 ///////////////////////////////////////////////////////////////////////////////////////
28         styles {
29                 style { name: "check_label_textblock_style";
30                         base: "font=SLP:style=Roman text_class=slp_roman font_size=32 color=#ffffff wrap=char";
31                         tag: "br" "\n";
32                         tag: "ps" "ps";
33                         tag: "hilight" "+ font=SLP:style=Bold text_class=slp_bold";
34                         tag: "b" "+ font=SLP:style=Bold text_class=slp_bold";
35                         tag: "whitecolor" "+ color=#ffffff";
36                         tag: "tab" "\t";
37                 }
38         }
39
40 #define CHECK_STATE_DEFAULT 0
41 #define CHECK_STATE_VISIBLE 1
42 #define CHECK_STATE_DISABLED_VISIBLE 2
43 #define CHECK_STATE_DISABLED 3
44
45
46 ////////////////////////////////////////////////////////////////////////////////
47 #define CHECK_STYLE_GRID(style_name, image_grid, width, height) \
48    group { name: "elm/check/base/"style_name; \
49       images.image: image_grid COMP; \
50       parts { \
51          part { name: "bg"; \
52             type: RECT; \
53             scale: 1; \
54             description { state: "default" 0.0; \
55                color: 0 0 0 0; \
56             } \
57             description { state: "pressed" 0.0; \
58                inherit: "default" 0.0; \
59             } \
60             description { state: "disabled" 0.0; \
61                inherit: "default" 0.0; \
62                visible: 0; \
63             } \
64          } \
65                 part { name: "icon_bg_img"; \
66                         type: RECT; \
67                         mouse_events: 0; \
68                         scale : 1; \
69                         description { \
70                                 color: 0 0 0 0; \
71                                 rel1 { relative: GAP_SHADOW_L/W GAP_SHADOW_T/H; to: "bg"; } \
72                                 rel2 { relative: (W-GAP_SHADOW_R-1)/W (H+GAP_SHADOW_B-1)/H; to: "bg"; } \
73                         } \
74                 } \
75                 part { name: "icon_bg"; \
76                         type: RECT; \
77                         description { state: "default" 0.0; \
78                                 color: 0 0 0 0; \
79                                 rel1 { relative: GAP_ICON_L/SHADOW_W GAP_ICON_T/SHADOW_H; to: "icon_bg_img"; } \
80                                 rel2 { relative: (SHADOW_W-GAP_ICON_R+2)/SHADOW_W (SHADOW_H-GAP_ICON_B+1)/SHADOW_H; to: "icon_bg_img"; } \
81                         } \
82                 } \
83          part { name: "bg2"; \
84             type: RECT; \
85             mouse_events: 0; \
86             scale: 1; \
87             description { state: "default" 0.0; \
88                rel1.to: "icon_bg"; \
89                rel2.to: "icon_bg"; \
90                align: 0.5 0.5; \
91                min: width height; \
92                max: width height; \
93                color:  0 0 0 0; \
94             } \
95             description { state: "pressed" 0.0; \
96                inherit: "default" 0.0; \
97             } \
98             description { state: "disabled" 0.0; \
99                inherit: "default" 0.0; \
100                visible: 0; \
101             } \
102          } \
103          part { name: "selected_bg"; \
104             type: RECT; \
105             scale: 1; \
106             description { state: "default" 0.0; \
107                rel1.to: "icon_bg"; \
108                rel2.to: "icon_bg"; \
109                color: 0 0 0 0; \
110                visible: 0; \
111             } \
112             description { state: "visible" 0.0; \
113                inherit: "default" 0.0; \
114                color: 0 0 0 153; \
115                visible: 1; \
116             } \
117          } \
118          part { name: "check"; \
119             mouse_events: 0; \
120             scale: 1; \
121             description { state: "default" 0.0; \
122                rel1.to: "bg2"; \
123                rel2.to: "bg2"; \
124                visible: 0; \
125                image.normal: image_grid; \
126             } \
127             description { state: "visible" 0.0; \
128                inherit: "default" 0.0; \
129                visible: 1; \
130             } \
131             description { state: "pressed" 0.0; \
132                inherit: "default" 0.0; \
133                visible: 1; \
134             } \
135             description { state: "disabled_visible" 0.0; \
136                inherit: "default" 0.0; \
137                visible: 1; \
138             } \
139          } \
140          part { name: "elm.swallow.content"; \
141             type: SWALLOW; \
142             description { \
143                state: "default" 0.0; \
144                fixed: 1 0; \
145                visible: 0; \
146                color: 255 255 255 255; \
147                align: 0.0 0.5; \
148                rel1 { \
149                   to_x: "bg2"; \
150                   relative: 1.0 0.0; \
151                   offset: 1 1; \
152                } \
153                rel2 { \
154                   to_x: "bg2"; \
155                   relative: 1.0 1.0; \
156                   offset: 2 -2; \
157                } \
158             } \
159             description { state: "visible" 0.0; \
160                inherit: "default" 0.0; \
161                fixed: 1 1; \
162                visible: 1; \
163                aspect: 1.0 1.0; \
164                aspect_preference: VERTICAL; \
165             } \
166             description { state: "disabled" 0.0; \
167                inherit: "default" 0.0; \
168                color: 128 128 128 128; \
169             } \
170             description { state: "disabled_visible" 0.0; \
171                inherit: "default" 0.0; \
172                color: 128 128 128 128; \
173                fixed: 1 1; \
174                visible: 1; \
175                aspect: 1.0 1.0; \
176             } \
177          } \
178          part { name: "elm.text"; \
179             type: TEXTBLOCK; \
180             mouse_events: 0; \
181             scale: 1; \
182             description { state: "default" 0.0; \
183                visible: 0; \
184                fixed: 0 1; \
185                rel1 { \
186                   relative: 1.0 0.5; \
187                   offset: 1 1; \
188                   to_x: "elm.swallow.content"; \
189                } \
190                rel2 { \
191                   relative: 1.0 0.5; \
192                   offset: -2 -2; \
193                } \
194                color: 255 255 255 255; \
195                align: 0.0 0.5; \
196                text { \
197                   style: "check_label_textblock_style"; \
198                   min: 0 0; \
199                } \
200                color: CHECK_DEFAULT_TEXT_NORMAL_COLOR_INC; \
201             } \
202             description { state: "visible" 0.0; \
203                inherit: "default" 0.0; \
204                visible: 1; \
205                text.min: 1 1; \
206             } \
207             description { state: "disabled" 0.0; \
208                inherit: "default" 0.0; \
209             } \
210             description { state: "disabled_visible" 0.0; \
211                inherit: "default" 0.0; \
212                visible: 1; \
213                text.min: 1 1; \
214                color: CHECK_DEFAULT_TEXT_DISABLED_COLOR_INC; \
215             } \
216          } \
217          part { name: "events"; \
218             type: RECT; \
219             ignore_flags: ON_HOLD; \
220             description { state: "default" 0.0; \
221                color: 0 0 0 0; \
222             } \
223          } \
224          part { name: "disabler"; \
225             type: RECT; \
226             description { state: "default" 0.0; \
227                color: 0 0 0 0; \
228                visible: 0; \
229             } \
230             description { state: "disabled" 0.0; \
231                inherit: "default" 0.0; \
232                visible: 1; \
233             } \
234          } \
235       } \
236       programs { \
237          program { name: "click"; \
238             signal: "mouse,up,1"; \
239             source: "events"; \
240             action: SIGNAL_EMIT "elm,action,check,toggle" ""; \
241             after: "bg_normal"; \
242          } \
243          program { name: "bg_normal"; \
244             script { \
245                set_state(PART:"bg", "default", 0.0); \
246                set_state(PART:"bg2", "default", 0.0); \
247             } \
248          } \
249          program { name: "mouseout"; \
250             signal: "mouse,out"; \
251             source: "events"; \
252             after: "bg_check_normal"; \
253          } \
254          program { name: "bg_check_normal"; \
255             script { \
256                new st[31]; \
257                new Float:vl; \
258                get_state(PART:"check", st, 30, vl); \
259                if (!strcmp(st, "pressed")) \
260                  set_state(PART:"check", "visible", 0.0); \
261                set_state(PART:"bg", "default", 0.0); \
262                set_state(PART:"bg2", "default", 0.0); \
263             } \
264          } \
265          program { name: "pressed"; \
266             signal: "mouse,down,1"; \
267             source: "events"; \
268             script { \
269                new st[31]; \
270                new Float:vl; \
271                get_state(PART:"check", st, 30, vl); \
272                if (!strcmp(st, "visible")) \
273                  set_state(PART:"check", "pressed", 0.0); \
274                set_state(PART:"bg", "pressed", 0.0); \
275                set_state(PART:"bg2", "pressed", 0.0); \
276             } \
277          } \
278          program { name: "check_on"; \
279             signal: "elm,state,check,on"; \
280             source: "elm"; \
281             action: STATE_SET "visible" 0.0; \
282             target: "check"; \
283             target: "selected_bg"; \
284          } \
285          program { name: "check_off"; \
286             signal: "elm,state,check,off"; \
287             source: "elm"; \
288             action: STATE_SET "default" 0.0; \
289             target: "check"; \
290             target: "selected_bg"; \
291          } \
292          program { name: "text_show"; \
293             signal: "elm,state,text,visible"; \
294             source: "elm"; \
295             action: STATE_SET "visible" 0.0; \
296             target: "elm.text"; \
297          } \
298          program { name: "text_hide"; \
299             signal: "elm,state,text,hidden"; \
300             source: "elm"; \
301             action: STATE_SET "default" 0.0; \
302             target: "elm.text"; \
303          } \
304          program { name: "icon_show"; \
305             signal: "elm,state,icon,visible"; \
306             source: "elm"; \
307             action: STATE_SET "visible" 0.0; \
308             target: "elm.swallow.content"; \
309          } \
310          program { name: "icon_hide"; \
311             signal: "elm,state,icon,hidden"; \
312             source: "elm"; \
313             action: STATE_SET "default" 0.0; \
314             target: "elm.swallow.content"; \
315          } \
316          program { name: "disable"; \
317             signal: "elm,state,disabled"; \
318             source: "elm"; \
319             action: STATE_SET "disabled" 0.0; \
320             target: "disabler"; \
321             target: "bg"; \
322             target: "bg2"; \
323             after: "disable_text"; \
324          } \
325          program { name: "disable_text"; \
326             script { \
327                new st[31]; \
328                new Float:vl; \
329                get_state(PART:"elm.text", st, 30, vl); \
330                if (!strcmp(st, "visible")) \
331                  set_state(PART:"elm.text", "disabled_visible", 0.0); \
332                else \
333                  set_state(PART:"elm.text", "disabled", 0.0); \
334                get_state(PART:"elm.swallow.content", st, 30, vl); \
335                if (!strcmp(st, "visible")) \
336                  set_state(PART:"elm.swallow.content", "disabled_visible", 0.0); \
337                else \
338                  set_state(PART:"elm.swallow.content", "disabled", 0.0); \
339                get_state(PART:"check", st, 30, vl); \
340                if (!strcmp(st, "visible")) \
341                  set_state(PART:"check", "disabled_visible", 0.0); \
342             } \
343          } \
344          program { name: "enable"; \
345             signal: "elm,state,enabled"; \
346             source: "elm"; \
347             action: STATE_SET "default" 0.0; \
348             target: "disabler"; \
349             target: "bg"; \
350             target: "bg2"; \
351             after: "enable_text"; \
352          } \
353          program { name: "enable_text"; \
354             script { \
355                new st[31]; \
356                new Float:vl; \
357                get_state(PART:"elm.text", st, 30, vl); \
358                if (!strcmp(st, "disabled_visible")) \
359                  set_state(PART:"elm.text", "visible", 0.0); \
360                else \
361                  set_state(PART:"elm.text", "default", 0.0); \
362                get_state(PART:"elm.swallow.content", st, 30, vl); \
363                if (!strcmp(st, "visible")) \
364                  set_state(PART:"elm.swallow.content", "visible", 0.0); \
365                else \
366                  set_state(PART:"elm.swallow.content", "default", 0.0); \
367                get_state(PART:"check", st, 30, vl); \
368                if (!strcmp(st, "disabled_visible")) \
369                  set_state(PART:"check", "visible", 0.0); \
370             } \
371          } \
372       } \
373    }
374
375 ////////////////////////////////////////////////////////////////////////////////
376         CHECK_STYLE_GRID("gallery/grid", GALLERY_EDC_IMAGE_CHECK_GRID, 64, 64)
377
378 ////////////////////////////////////////////////////////////////////////////////
379    group { name: "elm/check/base/gallery/album/grid";
380       parts {
381          part { name: "bg";
382             type: RECT;
383             scale: 1;
384             description { state: "default" 0.0;
385                color: 0 0 0 0;
386             }
387             description { state: "pressed" 0.0;
388                inherit: "default" 0.0;
389             }
390             description { state: "disabled" 0.0;
391                inherit: "default" 0.0;
392                visible: 0;
393             }
394          }
395          part { name: "bg2";
396             type: RECT;
397             mouse_events: 0;
398             scale: 1;
399             description { state: "default" 0.0;
400                rel1.to: "bg";
401                rel2.to: "bg";
402                align: 0.5 0.5;
403                min: 40 40;
404                max: 40 40;
405                color:  0 0 0 0;
406             }
407             description { state: "pressed" 0.0;
408                inherit: "default" 0.0;
409             }
410             description { state: "disabled" 0.0;
411                inherit: "default" 0.0;
412                visible: 0;
413             }
414          }
415          part { name: "selected_bg";
416             type: RECT;
417             scale: 1;
418             description { state: "default" 0.0;
419                rel1.to: "bg";
420                rel2.to: "bg";
421                color: 0 0 0 0;
422                visible: 0;
423             }
424             description { state: "visible" 0.0;
425                inherit: "default" 0.0;
426                color: 0 0 0 153;
427                visible: 1;
428             }
429          }
430          part { name: "check";
431             type: RECT;
432             mouse_events: 0;
433             scale: 1;
434             description { state: "default" 0.0;
435                rel1.to: "bg2";
436                rel2.to: "bg2";
437                color: 0 0 0 0;
438                visible: 0;
439             }
440             description { state: "visible" 0.0;
441                inherit: "default" 0.0;
442             }
443             description { state: "pressed" 0.0;
444                inherit: "default" 0.0;
445             }
446             description { state: "disabled_visible" 0.0;
447                inherit: "default" 0.0;
448             }
449          }
450          part { name: "elm.swallow.content";
451             type: SWALLOW;
452             description {
453                state: "default" 0.0;
454                fixed: 1 0;
455                visible: 0;
456                color: 255 255 255 255;
457                align: 0.0 0.5;
458                rel1 {
459                   to_x: "bg2";
460                   relative: 1.0 0.0;
461                   offset: 1 1;
462                }
463                rel2 {
464                   to_x: "bg2";
465                   relative: 1.0 1.0;
466                   offset: 2 -2;
467                }
468             }
469             description { state: "visible" 0.0;
470                inherit: "default" 0.0;
471                fixed: 1 1;
472                visible: 1;
473                aspect: 1.0 1.0;
474                aspect_preference: VERTICAL;
475             }
476             description { state: "disabled" 0.0;
477                inherit: "default" 0.0;
478                color: 128 128 128 128;
479             }
480             description { state: "disabled_visible" 0.0;
481                inherit: "default" 0.0;
482                color: 128 128 128 128;
483                fixed: 1 1;
484                visible: 1;
485                aspect: 1.0 1.0;
486             }
487          }
488          part { name: "elm.text";
489             type: TEXTBLOCK;
490             mouse_events: 0;
491             scale: 1;
492             description { state: "default" 0.0;
493                visible: 0;
494                fixed: 0 1;
495                rel1 {
496                   relative: 1.0 0.5;
497                   offset: 1 1;
498                   to_x: "elm.swallow.content";
499                }
500                rel2 {
501                   relative: 1.0 0.5;
502                   offset: -2 -2;
503                }
504                color: 255 255 255 255;
505                align: 0.0 0.5;
506                text {
507                   style: "check_label_textblock_style";
508                   min: 0 0;
509                }
510                color: CHECK_DEFAULT_TEXT_NORMAL_COLOR_INC;
511             }
512             description { state: "visible" 0.0;
513                inherit: "default" 0.0;
514                visible: 1;
515                text.min: 1 1;
516             }
517             description { state: "disabled" 0.0;
518                inherit: "default" 0.0;
519             }
520             description { state: "disabled_visible" 0.0;
521                inherit: "default" 0.0;
522                visible: 1;
523                text.min: 1 1;
524                color: CHECK_DEFAULT_TEXT_DISABLED_COLOR_INC;
525             }
526          }
527          part { name: "events";
528             type: RECT;
529             ignore_flags: ON_HOLD;
530             description { state: "default" 0.0;
531                color: 0 0 0 0;
532             }
533          }
534          part { name: "disabler";
535             type: RECT;
536             description { state: "default" 0.0;
537                color: 0 0 0 0;
538                visible: 0;
539             }
540             description { state: "disabled" 0.0;
541                inherit: "default" 0.0;
542                visible: 1;
543             }
544          }
545       }
546       programs {
547          program { name: "click";
548             signal: "mouse,up,1";
549             source: "events";
550             action: SIGNAL_EMIT "elm,action,check,toggle" "";
551             after: "bg_normal";
552          }
553          program { name: "bg_normal";
554             script {
555                set_state(PART:"bg", "default", 0.0);
556                set_state(PART:"bg2", "default", 0.0);
557             }
558          }
559          program { name: "mouseout";
560             signal: "mouse,out";
561             source: "events";
562             after: "bg_check_normal";
563          }
564          program { name: "bg_check_normal";
565             script {
566                new st[31];
567                new Float:vl;
568                get_state(PART:"check", st, 30, vl);
569                if (!strcmp(st, "pressed"))
570                  set_state(PART:"check", "visible", 0.0);
571                set_state(PART:"bg", "default", 0.0);
572                set_state(PART:"bg2", "default", 0.0);
573             }
574          }
575          program { name: "pressed";
576             signal: "mouse,down,1";
577             source: "events";
578             script {
579                new st[31];
580                new Float:vl;
581                get_state(PART:"check", st, 30, vl);
582                if (!strcmp(st, "visible"))
583                  set_state(PART:"check", "pressed", 0.0);
584                set_state(PART:"bg", "pressed", 0.0);
585                set_state(PART:"bg2", "pressed", 0.0);
586             }
587          }
588          program { name: "check_on";
589             signal: "elm,state,check,on";
590             source: "elm";
591             action: STATE_SET "visible" 0.0;
592             target: "check";
593             target: "selected_bg";
594          }
595          program { name: "check_off";
596             signal: "elm,state,check,off";
597             source: "elm";
598             action: STATE_SET "default" 0.0;
599             target: "check";
600             target: "selected_bg";
601          }
602          program { name: "text_show";
603             signal: "elm,state,text,visible";
604             source: "elm";
605             action: STATE_SET "visible" 0.0;
606             target: "elm.text";
607          }
608          program { name: "text_hide";
609             signal: "elm,state,text,hidden";
610             source: "elm";
611             action: STATE_SET "default" 0.0;
612             target: "elm.text";
613          }
614          program { name: "icon_show";
615             signal: "elm,state,icon,visible";
616             source: "elm";
617             action: STATE_SET "visible" 0.0;
618             target: "elm.swallow.content";
619          }
620          program { name: "icon_hide";
621             signal: "elm,state,icon,hidden";
622             source: "elm";
623             action: STATE_SET "default" 0.0;
624             target: "elm.swallow.content";
625          }
626          program { name: "disable";
627             signal: "elm,state,disabled";
628             source: "elm";
629             action: STATE_SET "disabled" 0.0;
630             target: "disabler";
631             target: "bg";
632             target: "bg2";
633             after: "disable_text";
634          }
635          program { name: "disable_text";
636             script {
637                new st[31];
638                new Float:vl;
639                get_state(PART:"elm.text", st, 30, vl);
640                if (!strcmp(st, "visible"))
641                  set_state(PART:"elm.text", "disabled_visible", 0.0);
642                else
643                  set_state(PART:"elm.text", "disabled", 0.0);
644                get_state(PART:"elm.swallow.content", st, 30, vl);
645                if (!strcmp(st, "visible"))
646                  set_state(PART:"elm.swallow.content", "disabled_visible", 0.0);
647                else
648                  set_state(PART:"elm.swallow.content", "disabled", 0.0);
649                get_state(PART:"check", st, 30, vl);
650                if (!strcmp(st, "visible"))
651                  set_state(PART:"check", "disabled_visible", 0.0);
652             }
653          }
654          program { name: "enable";
655             signal: "elm,state,enabled";
656             source: "elm";
657             action: STATE_SET "default" 0.0;
658             target: "disabler";
659             target: "bg";
660             target: "bg2";
661             after: "enable_text";
662          }
663          program { name: "enable_text";
664             script {
665                new st[31];
666                new Float:vl;
667                get_state(PART:"elm.text", st, 30, vl);
668                if (!strcmp(st, "disabled_visible"))
669                  set_state(PART:"elm.text", "visible", 0.0);
670                else
671                  set_state(PART:"elm.text", "default", 0.0);
672                get_state(PART:"elm.swallow.content", st, 30, vl);
673                if (!strcmp(st, "visible"))
674                  set_state(PART:"elm.swallow.content", "visible", 0.0);
675                else
676                  set_state(PART:"elm.swallow.content", "default", 0.0);
677                get_state(PART:"check", st, 30, vl);
678                if (!strcmp(st, "disabled_visible"))
679                  set_state(PART:"check", "visible", 0.0);
680             }
681          }
682       }
683    }
684
685 #undef CHECK_STATE_DEFAULT
686 #undef CHECK_STATE_VISIBLE
687 #undef CHECK_STATE_DISABLED_VISIBLE
688 #undef CHECK_STATE_DISABLED