initial upload for tizen 2.0 beta
[apps/home/gallery.git] / ug / ug-gallery-efl / res / edc / gallery-efl-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 42 42
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 #define CHECK_STYLE_GRID(style_name, image_grid, width, height) \
47    group { name: "elm/check/base/"style_name; \
48       images.image: image_grid COMP; \
49       parts { \
50          part { name: "bg"; \
51             type: RECT; \
52             scale: 1; \
53             description { state: "default" 0.0; \
54                color: 0 0 0 0; \
55             } \
56             description { state: "pressed" 0.0; \
57                inherit: "default" 0.0; \
58             } \
59             description { state: "disabled" 0.0; \
60                inherit: "default" 0.0; \
61                visible: 0; \
62             } \
63          } \
64                 part { name: "icon_bg_img"; \
65                         type: RECT; \
66                         mouse_events: 0; \
67                         scale : 1; \
68                         description { \
69                                 color: 0 0 0 0; \
70                                 rel1 { relative: GAP_SHADOW_L/W GAP_SHADOW_T/H; to: "bg"; } \
71                                 rel2 { relative: (W-GAP_SHADOW_R-1)/W (H+GAP_SHADOW_B-1)/H; to: "bg"; } \
72                         } \
73                 } \
74                 part { name: "icon_bg"; \
75                         type: RECT; \
76                         description { state: "default" 0.0; \
77                                 color: 0 0 0 0; \
78                                 rel1 { relative: GAP_ICON_L/SHADOW_W GAP_ICON_T/SHADOW_H; to: "icon_bg_img"; } \
79                                 rel2 { relative: (SHADOW_W-GAP_ICON_R+2)/SHADOW_W (SHADOW_H-GAP_ICON_B+1)/SHADOW_H; to: "icon_bg_img"; } \
80                         } \
81                 } \
82          part { name: "bg2"; \
83             type: RECT; \
84             mouse_events: 0; \
85             scale: 1; \
86             description { state: "default" 0.0; \
87                rel1.to: "icon_bg"; \
88                rel2.to: "icon_bg"; \
89                align: 0.5 0.5; \
90                min: width height; \
91                max: width height; \
92                color:  0 0 0 0; \
93             } \
94             description { state: "pressed" 0.0; \
95                inherit: "default" 0.0; \
96             } \
97             description { state: "disabled" 0.0; \
98                inherit: "default" 0.0; \
99                visible: 0; \
100             } \
101          } \
102          part { name: "selected_bg"; \
103             type: RECT; \
104             scale: 1; \
105             description { state: "default" 0.0; \
106                rel1.to: "icon_bg"; \
107                rel2.to: "icon_bg"; \
108                color: 0 0 0 0; \
109                visible: 0; \
110             } \
111             description { state: "visible" 0.0; \
112                inherit: "default" 0.0; \
113                color: 0 0 0 153; \
114                visible: 1; \
115             } \
116          } \
117          part { name: "check"; \
118             mouse_events: 0; \
119             scale: 1; \
120             description { state: "default" 0.0; \
121                rel1.to: "bg2"; \
122                rel2.to: "bg2"; \
123                visible: 0; \
124                image.normal: image_grid; \
125             } \
126             description { state: "visible" 0.0; \
127                inherit: "default" 0.0; \
128                visible: 1; \
129             } \
130             description { state: "pressed" 0.0; \
131                inherit: "default" 0.0; \
132                visible: 1; \
133             } \
134             description { state: "disabled_visible" 0.0; \
135                inherit: "default" 0.0; \
136                visible: 1; \
137             } \
138          } \
139          part { name: "elm.swallow.content"; \
140             type: SWALLOW; \
141             description { \
142                state: "default" 0.0; \
143                fixed: 1 0; \
144                visible: 0; \
145                color: 255 255 255 255; \
146                align: 0.0 0.5; \
147                rel1 { \
148                   to_x: "bg2"; \
149                   relative: 1.0 0.0; \
150                   offset: 1 1; \
151                } \
152                rel2 { \
153                   to_x: "bg2"; \
154                   relative: 1.0 1.0; \
155                   offset: 2 -2; \
156                } \
157             } \
158             description { state: "visible" 0.0; \
159                inherit: "default" 0.0; \
160                fixed: 1 1; \
161                visible: 1; \
162                aspect: 1.0 1.0; \
163                aspect_preference: VERTICAL; \
164             } \
165             description { state: "disabled" 0.0; \
166                inherit: "default" 0.0; \
167                color: 128 128 128 128; \
168             } \
169             description { state: "disabled_visible" 0.0; \
170                inherit: "default" 0.0; \
171                color: 128 128 128 128; \
172                fixed: 1 1; \
173                visible: 1; \
174                aspect: 1.0 1.0; \
175             } \
176          } \
177          part { name: "elm.text"; \
178             type: TEXTBLOCK; \
179             mouse_events: 0; \
180             scale: 1; \
181             description { state: "default" 0.0; \
182                visible: 0; \
183                fixed: 0 1; \
184                rel1 { \
185                   relative: 1.0 0.5; \
186                   offset: 1 1; \
187                   to_x: "elm.swallow.content"; \
188                } \
189                rel2 { \
190                   relative: 1.0 0.5; \
191                   offset: -2 -2; \
192                } \
193                color: 255 255 255 255; \
194                align: 0.0 0.5; \
195                text { \
196                   style: "check_label_textblock_style"; \
197                   min: 0 0; \
198                } \
199                color: CHECK_DEFAULT_TEXT_NORMAL_COLOR_INC; \
200             } \
201             description { state: "visible" 0.0; \
202                inherit: "default" 0.0; \
203                visible: 1; \
204                text.min: 1 1; \
205             } \
206             description { state: "disabled" 0.0; \
207                inherit: "default" 0.0; \
208             } \
209             description { state: "disabled_visible" 0.0; \
210                inherit: "default" 0.0; \
211                visible: 1; \
212                text.min: 1 1; \
213                color: CHECK_DEFAULT_TEXT_DISABLED_COLOR_INC; \
214             } \
215          } \
216          part { name: "events"; \
217             type: RECT; \
218             ignore_flags: ON_HOLD; \
219             description { state: "default" 0.0; \
220                color: 0 0 0 0; \
221             } \
222          } \
223          part { name: "disabler"; \
224             type: RECT; \
225             description { state: "default" 0.0; \
226                color: 0 0 0 0; \
227                visible: 0; \
228             } \
229             description { state: "disabled" 0.0; \
230                inherit: "default" 0.0; \
231                visible: 1; \
232             } \
233          } \
234       } \
235       programs { \
236          program { name: "click"; \
237             signal: "mouse,up,1"; \
238             source: "events"; \
239             action: SIGNAL_EMIT "elm,action,check,toggle" ""; \
240             after: "bg_normal"; \
241          } \
242          program { name: "bg_normal"; \
243             script { \
244                set_state(PART:"bg", "default", 0.0); \
245                set_state(PART:"bg2", "default", 0.0); \
246             } \
247          } \
248          program { name: "mouseout"; \
249             signal: "mouse,out"; \
250             source: "events"; \
251             after: "bg_check_normal"; \
252          } \
253          program { name: "bg_check_normal"; \
254             script { \
255                new st[31]; \
256                new Float:vl; \
257                get_state(PART:"check", st, 30, vl); \
258                if (!strcmp(st, "pressed")) \
259                  set_state(PART:"check", "visible", 0.0); \
260                set_state(PART:"bg", "default", 0.0); \
261                set_state(PART:"bg2", "default", 0.0); \
262             } \
263          } \
264          program { name: "pressed"; \
265             signal: "mouse,down,1"; \
266             source: "events"; \
267             script { \
268                new st[31]; \
269                new Float:vl; \
270                get_state(PART:"check", st, 30, vl); \
271                if (!strcmp(st, "visible")) \
272                  set_state(PART:"check", "pressed", 0.0); \
273                set_state(PART:"bg", "pressed", 0.0); \
274                set_state(PART:"bg2", "pressed", 0.0); \
275             } \
276          } \
277          program { name: "check_on"; \
278             signal: "elm,state,check,on"; \
279             source: "elm"; \
280             action: STATE_SET "visible" 0.0; \
281             target: "check"; \
282             target: "selected_bg"; \
283          } \
284          program { name: "check_off"; \
285             signal: "elm,state,check,off"; \
286             source: "elm"; \
287             action: STATE_SET "default" 0.0; \
288             target: "check"; \
289             target: "selected_bg"; \
290          } \
291          program { name: "text_show"; \
292             signal: "elm,state,text,visible"; \
293             source: "elm"; \
294             action: STATE_SET "visible" 0.0; \
295             target: "elm.text"; \
296          } \
297          program { name: "text_hide"; \
298             signal: "elm,state,text,hidden"; \
299             source: "elm"; \
300             action: STATE_SET "default" 0.0; \
301             target: "elm.text"; \
302          } \
303          program { name: "icon_show"; \
304             signal: "elm,state,icon,visible"; \
305             source: "elm"; \
306             action: STATE_SET "visible" 0.0; \
307             target: "elm.swallow.content"; \
308          } \
309          program { name: "icon_hide"; \
310             signal: "elm,state,icon,hidden"; \
311             source: "elm"; \
312             action: STATE_SET "default" 0.0; \
313             target: "elm.swallow.content"; \
314          } \
315          program { name: "disable"; \
316             signal: "elm,state,disabled"; \
317             source: "elm"; \
318             action: STATE_SET "disabled" 0.0; \
319             target: "disabler"; \
320             target: "bg"; \
321             target: "bg2"; \
322             after: "disable_text"; \
323          } \
324          program { name: "disable_text"; \
325             script { \
326                new st[31]; \
327                new Float:vl; \
328                get_state(PART:"elm.text", st, 30, vl); \
329                if (!strcmp(st, "visible")) \
330                  set_state(PART:"elm.text", "disabled_visible", 0.0); \
331                else \
332                  set_state(PART:"elm.text", "disabled", 0.0); \
333                get_state(PART:"elm.swallow.content", st, 30, vl); \
334                if (!strcmp(st, "visible")) \
335                  set_state(PART:"elm.swallow.content", "disabled_visible", 0.0); \
336                else \
337                  set_state(PART:"elm.swallow.content", "disabled", 0.0); \
338                get_state(PART:"check", st, 30, vl); \
339                if (!strcmp(st, "visible")) \
340                  set_state(PART:"check", "disabled_visible", 0.0); \
341             } \
342          } \
343          program { name: "enable"; \
344             signal: "elm,state,enabled"; \
345             source: "elm"; \
346             action: STATE_SET "default" 0.0; \
347             target: "disabler"; \
348             target: "bg"; \
349             target: "bg2"; \
350             after: "enable_text"; \
351          } \
352          program { name: "enable_text"; \
353             script { \
354                new st[31]; \
355                new Float:vl; \
356                get_state(PART:"elm.text", st, 30, vl); \
357                if (!strcmp(st, "disabled_visible")) \
358                  set_state(PART:"elm.text", "visible", 0.0); \
359                else \
360                  set_state(PART:"elm.text", "default", 0.0); \
361                get_state(PART:"elm.swallow.content", st, 30, vl); \
362                if (!strcmp(st, "visible")) \
363                  set_state(PART:"elm.swallow.content", "visible", 0.0); \
364                else \
365                  set_state(PART:"elm.swallow.content", "default", 0.0); \
366                get_state(PART:"check", st, 30, vl); \
367                if (!strcmp(st, "disabled_visible")) \
368                  set_state(PART:"check", "visible", 0.0); \
369             } \
370          } \
371       } \
372    }
373
374 ////////////////////////////////////////////////////////////////////////////////
375         CHECK_STYLE_GRID("gallery_efl/grid", GE_EDC_IMAGE_CHECK_GRID, 64, 64)
376
377
378 #undef CHECK_STATE_DEFAULT
379 #undef CHECK_STATE_VISIBLE
380 #undef CHECK_STATE_DISABLED_VISIBLE
381 #undef CHECK_STATE_DISABLED