merge with master
[apps/core/preloaded/ug-camera-efl.git] / edc / style_button_camera.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://floralicense.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
18 #include "style_tizen_hd_inc.edc"
19
20 #define BUTTON_STATE_ENABLED 0
21 #define BUTTON_STATE_DISABLED 1
22
23
24 collections {
25
26 //////////////////////////////////////////////////////////////////////////////////////
27    group { name: "elm/button/base/camera/default";
28       images {
29          image: "00_button_01_normal.png" COMP;
30          image: "00_button_01_normal_press.png" COMP;
31          image: "00_button_01_normal_dim.png" COMP;
32          image: "00_button_01_normal_Focus.png" COMP;
33       }
34
35       parts {
36          part { name: "button_image";
37             scale: 1;
38             description { state: "default" 0.0;
39                image {
40                   normal: "00_button_01_normal.png";
41                   border: BUTTON_TEXT_STYLE1_BG_BORDER_INC;
42                   border_scale: 1;
43                }
44             }
45             description { state: "clicked" 0.0;
46                inherit: "default" 0.0;
47                image.normal: "00_button_01_normal_press.png";
48             }
49             description { state: "disabled" 0.0;
50                inherit: "default" 0.0;
51                image.normal: "00_button_01_normal_dim.png";
52             }
53             description { state: "focused" 0.0;
54                inherit: "default" 0.0;
55                image.normal: "00_button_01_normal_Focus.png";
56             }
57          }
58          part { name: "padding_left_top";
59             type: RECT;
60             scale: 1;
61             mouse_events: 0;
62             description { state: "default" 0.0;
63                align: 0.0 0.0;
64                rel2.relative: 0.0 0.0;
65                min: BUTTON_TEXT_STYLE1_PADDING_MIN_INC;
66                fixed: 1 1;
67                visible: 0;
68             }
69          }
70          part { name: "bg";
71             type: RECT;
72             scale: 1;
73             mouse_events: 0;
74             description { state: "default" 0.0;
75                min: BUTTON_TEXT_STYLE1_BG_MIN_INC;
76                visible: 0;
77             }
78             description { state: "visible" 0.0;
79                inherit: "default" 0.0;
80                min: BUTTON_TEXT_STYLE1_VISIBLE_BG_MIN_INC;
81             }
82             description { state: "icononly" 0.0;
83                inherit: "default" 0.0;
84                min: BUTTON_TEXT_STYLE1_ICONONLY_BG_MIN_INC;
85             }
86          }
87          part { name: "padding_right_bottom";
88             type: RECT;
89             scale: 1;
90             mouse_events: 0;
91             description { state: "default" 0.0;
92                align: 1.0 1.0;
93                rel1.relative: 1.0 1.0;
94                min: BUTTON_TEXT_STYLE1_PADDING_MIN_INC;
95                fixed: 1 1;
96                visible: 0;
97             }
98          }
99          part { name: "icon_rect";
100             type: RECT;
101             scale: 1;
102             mouse_events: 0;
103             description { state: "default" 0.0;
104                visible: 0;
105                min: 0 0;
106                fixed: 1 0;
107                rel1 {
108                   relative: 1.0 1.0;
109                   to: "padding_left_top";
110                }
111                rel2 {
112                   relative: 1.0 0.0;
113                   to_x: "padding_left_top";
114                   to_y: "padding_right_bottom";
115                }
116                align: 0.0 0.5;
117             }
118             description { state: "visible" 0.0;
119                visible: 0;
120                min: BUTTON_TEXT_STYLE1_VISIBLE_ICON_RECT_MIN_MAX_INC;
121                max: BUTTON_TEXT_STYLE1_VISIBLE_ICON_RECT_MIN_MAX_INC;
122                fixed: 1 0;
123                rel1 {
124                   relative: 1.0 1.0;
125                   to: "padding_left_top";
126                }
127                rel2 {
128                   relative: 1.0 0.0;
129                   to_x: "padding_left_top";
130                   to_y: "padding_right_bottom";
131                }
132                align: 0.0 0.5;
133             }
134             description { state: "icononly" 0.0;
135                inherit: "default" 0.0;
136             }
137          }
138          part { name: "padding_after_icon";
139             type: RECT;
140             scale: 1;
141             mouse_events: 0;
142             description { state: "default" 0.0; //when only icon or no icon is there
143                align: 0.0 0.0;
144                rel1 {
145                   relative: 1.0 0.0;
146                   to: "icon_rect";
147                }
148                rel2.to: "icon_rect";
149                fixed: 1 0;
150                min: 0 0;
151                visible: 0;
152             }
153             description { state: "visible" 0.0;
154                visible: 0;
155                align: 0.0 0.0;
156                rel1 {
157                   relative: 1.0 0.0;
158                   to: "icon_rect";
159                }
160                rel2.to: "icon_rect";
161                fixed: 1 0;
162                min: BUTTON_TEXT_STYLE1_VISIBLE_PADDING_ICON_TEXT_MIN_INC;
163             }
164             description { state: "icononly" 0.0;
165                inherit: "default" 0.0;
166             }
167          }
168          part { name: "padding_before_text";
169             type: RECT;
170             scale: 1;
171             mouse_events: 0;
172             description { state: "default" 0.0; //when only icon or no icon is there
173                align: 1.0 0.5;
174                rel1 {
175                   relative: 0.0 1.0;
176                   to_x: "elm.text";
177                   to_y: "padding_left_top";
178                }
179                rel2 {
180                   relative: 0.0 0.0;
181                   to_x: "elm.text";
182                   to_y: "padding_right_bottom";
183                }
184                fixed: 1 0;
185                min: BUTTON_TEXT_STYLE1_VISIBLE_PADDING_ICON_TEXT_MIN_INC;
186                visible: 0;
187             }
188          }
189          part { name: "elm.swallow.content";
190             type: SWALLOW;
191             scale: 1;
192             clip_to: "clipper";
193             description { state: "default" 0.0;
194                visible: 0;
195                align: 0.0 0.5;
196                rel1 {
197                   relative: 1.0 1.0;
198                   to: "padding_left_top";
199                }
200                rel2 {
201                   relative: 1.0 0.0;
202                   to_x: "padding_left_top";
203                   to_y: "padding_right_bottom";
204                }
205                fixed: 1 0;
206             }
207             description { state: "visible" 0.0;
208                fixed: 1 0;
209                min: BUTTON_TEXT_STYLE1_VISIBLE_ICON_MIN_MAX_INC;
210                max: BUTTON_TEXT_STYLE1_VISIBLE_ICON_MIN_MAX_INC;
211                align: 1.0 0.5;
212                rel1 {
213                   relative: 0.0 1.0;
214                   to_x: "padding_before_text";
215                   to_y: "padding_left_top";
216                }
217                rel2 {
218                   relative: 0.0 0.0;
219                   to_x: "padding_before_text";
220                   to_y: "padding_right_bottom";
221                }
222             }
223             description { state: "icononly" 0.0;
224                min: BUTTON_TEXT_STYLE1_ICONONLY_ICON_MIN_MAX_INC;
225                max: BUTTON_TEXT_STYLE1_ICONONLY_ICON_MIN_MAX_INC;
226             }
227          }
228          part { name: "elm.text";
229             type: TEXT;
230             mouse_events: 0;
231             scale: 1;
232             clip_to: "clipper";
233             description { state: "default" 0.0;
234                visible: 0;
235                rel1 {
236                   relative: 1.0 1.0;
237                   to_x: "padding_after_icon";
238                   to_y: "padding_left_top";
239                }
240                rel2 {
241                   relative: 0.0 0.0;
242                   to: "padding_right_bottom";
243                }
244                /*color: BUTTON_TEXT_STYLE1_NORMAL_COLOR_INC;*/
245                text {
246                   font: FONT_NAME;
247                   size:     30;
248                   align:    0.5 0.5;
249                }
250             }
251             description { state: "visible" 0.0;
252                inherit: "default" 0.0;
253                visible: 1;
254             }
255             description { state: "clicked" 0.0;
256                inherit: "default" 0.0;
257                visible: 1;
258                color: BUTTON_TEXT_STYLE1_PRESSED_COLOR_INC;
259             }
260             description { state: "disabled" 0.0;
261                inherit: "default" 0.0;
262                color: 0 0 0 128;
263             }
264             description { state: "disabled_visible" 0.0;
265                inherit: "default" 0.0;
266                color: BUTTON_TEXT_STYLE1_DISABLED_COLOR_INC;
267                visible: 1;
268             }
269             description { state: "focused" 0.0;
270                inherit: "default" 0.0;
271                visible: 1;
272                color: BUTTON_TEXT_STYLE1_FOCUSED_COLOR_INC;
273             }
274          }
275          part { name: "over2";
276             type: RECT;
277             repeat_events: 1;
278             ignore_flags: ON_HOLD;
279             description { state: "default" 0.0;
280                color: 0 0 0 0;
281             }
282          }
283          part { name: "over3";
284             type: RECT;
285             repeat_events: 1;
286             description { state: "default" 0.0;
287                color: 0 0 0 0;
288             }
289          }
290          part { name: "clipper";
291             type: RECT;
292             description { state: "default" 0.0;
293                color: 255 255 255 255;
294             }
295          }
296          part { name: "disabler";
297             type: RECT;
298             description { state: "default" 0.0;
299                color: 0 0 0 0;
300                visible: 0;
301             }
302             description { state: "disabled" 0.0;
303                inherit: "default" 0.0;
304                visible: 1;
305             }
306          }
307       }
308
309       programs {
310         script {
311                 public button_state = BUTTON_STATE_ENABLED;
312         }
313          program { name: "button_click";
314             signal: "mouse,down,1";
315             source: "over2";
316             action: SIGNAL_EMIT "elm,action,press" "";
317             after: "button_click_anim";
318          }
319          program { name: "button_click_anim";
320             action: STATE_SET "clicked" 0.0;
321             target: "button_image";
322             after: "text_clicked";
323          }
324          program { name: "text_clicked";
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", "clicked", 0.0);
331             }
332          }
333          program { name: "button_unpress";
334             action: SIGNAL_EMIT "elm,action,unpress" "";
335          }
336          program { name: "button_mouseout_clicked";
337             signal: "mouse,up,1";
338             source: "over3";
339             script {
340                new st[31];
341                new Float:vl;
342                get_state(PART:"elm.swallow.content", st, 30, vl);
343                if (strcmp(st, "icononly"))
344                  {
345                     emit("elm,action,default,text,set", "");
346                     set_state(PART:"elm.text", "visible", 0.0);
347                  }
348                if (get_int(button_state) != BUTTON_STATE_DISABLED)
349                  set_state(PART:"button_image", "default", 0.0);
350             }
351             after: button_unpress;
352          }
353
354          program { name: "button_unclick3";
355             action: SIGNAL_EMIT "elm,action,click" "";
356          }
357          program { name: "text_show";
358             signal: "elm,state,text,visible";
359             source: "elm";
360             script {
361                new st[31];
362                new Float:vl;
363                get_state(PART:"elm.swallow.content", st, 30, vl);
364                if (!strcmp(st, "icononly"))
365                  {
366                     set_state(PART:"elm.swallow.content", "visible", 0.0);
367                     set_state(PART:"icon_rect", "visible", 0.0);
368                     set_state(PART:"padding_after_icon", "visible", 0.0);
369                     set_state(PART:"bg", "visible", 0.0);
370                  }
371                if (get_int(button_state) != BUTTON_STATE_DISABLED)
372                  set_state(PART:"elm.text", "visible", 0.0);
373                else
374                  set_state(PART:"elm.text", "disabled_visible", 0.0);
375             }
376          }
377          program { name: "text_hide";
378             signal: "elm,state,text,hidden";
379             source: "elm";
380             script {
381                new st[31];
382                new Float:vl;
383                get_state(PART:"elm.swallow.content", st, 30, vl);
384                if (!strcmp(st, "visible"))
385                  {
386                     set_state(PART:"elm.swallow.content", "icononly", 0.0);
387                     set_state(PART:"icon_rect", "icononly", 0.0);
388                     set_state(PART:"padding_after_icon", "icononly", 0.0);
389                     set_state(PART:"bg", "icononly", 0.0);
390                  }
391                set_state(PART:"elm.text", "default", 0.0);
392             }
393          }
394          program { name: "icon_show";
395             signal: "elm,state,icon,visible";
396             source: "elm";
397             script {
398                new st[31];
399                new Float:vl;
400                get_state(PART:"elm.text", st, 30, vl);
401                if (!strcmp(st, "visible"))
402                  {
403                     set_state(PART:"elm.swallow.content", "visible", 0.0);
404                     set_state(PART:"icon_rect", "visible", 0.0);
405                     set_state(PART:"padding_after_icon", "visible", 0.0);
406                     set_state(PART:"bg", "visible", 0.0);
407                  }
408                else
409                  {
410                     set_state(PART:"elm.swallow.content", "icononly", 0.0);
411                     set_state(PART:"icon_rect", "icononly", 0.0);
412                     set_state(PART:"padding_after_icon", "icononly", 0.0);
413                     set_state(PART:"bg", "icononly", 0.0);
414                  }
415             }
416          }
417
418          program { name: "icon_hide";
419             signal: "elm,state,icon,hidden";
420             source: "elm";
421             action: STATE_SET "default" 0.0;
422             target: "elm.swallow.content";
423             target: "padding_after_icon";
424             target: "icon_rect";
425             target: "bg";
426          }
427          program { name: "disable";
428             signal: "elm,state,disabled";
429             source: "elm";
430             action: STATE_SET "disabled" 0.0;
431             target: "button_image";
432             target: "disabler";
433             after: "disable_text";
434          }
435          program { name: "disable_text";
436             script {
437                new st[31];
438                new Float:vl;
439                get_state(PART:"elm.text", st, 30, vl);
440                if (!strcmp(st, "visible"))
441                  set_state(PART:"elm.text", "disabled_visible", 0.0);
442                else
443                  set_state(PART:"elm.text", "disabled", 0.0);
444                set_int(button_state, BUTTON_STATE_DISABLED);
445             }
446          }
447          program { name: "enable";
448             signal: "elm,state,enabled";
449             source: "elm";
450             action: STATE_SET "default" 0.0;
451             target: "button_image";
452             target: "disabler";
453             after: "enable_text";
454          }
455          program { name: "enable_text";
456             script {
457                new st[31];
458                new Float:vl;
459                get_state(PART:"elm.text", st, 30, vl);
460                if (!strcmp(st, "disabled_visible"))
461                  set_state(PART:"elm.text", "visible", 0.0);
462                else
463                  set_state(PART:"elm.text", "default", 0.0);
464                set_int(button_state, BUTTON_STATE_ENABLED);
465             }
466          }
467          program { name: "focused";
468             //signal: "elm,action,focus";
469             //source: "elm";
470             action: STATE_SET "focused" 0.0;
471             target: "button_image";
472             target: "elm.text";
473          }
474          program { name: "unfocused";
475             //signal: "elm,action,unfocus";
476             //source: "elm";
477             action: STATE_SET "default" 0.0;
478             target: "button_image";
479             after: "unfocus_text";
480          }
481          program { name: "unfocus_text";
482             action: STATE_SET "visible" 0.0;
483             target: "elm.text";
484          }
485       }
486
487    }
488
489 }
490 //end files