Merge branch 'tizen_2.1_smack' into tizen_2.1
[apps/core/preloaded/ug-camera-efl.git] / edc / cam_funcs.edc
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.1 (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 "../include/edc_string.h"
19
20 // background
21 #define BACKGROUND_IMAGE(part_name, x, y, w, h, img) \
22                         part {                          \
23                                 name: part_name;        \
24                                 type: IMAGE;    \
25                                 description {   \
26                                         state: "default" 0.0;\
27                                        rel1 { relative: (x)/MAIN_W (y)/MAIN_H; }                \
28                                        rel2 { relative: (x+w)/MAIN_W (y+h)/MAIN_H; }             \
29                                         image { normal: img; }  \
30                                 }     \
31                         }
32 #define BACKGROUND_IMAGE_WITH_ALPHA(part_name, x, y, w, h, img, alpha) \
33                         part {                          \
34                                 name: part_name;        \
35                                 type: IMAGE;    \
36                                 description {   \
37                                         state: "default" 0.0;\
38                                        rel1 { relative: (x)/MAIN_W (y)/MAIN_H; }                \
39                                        rel2 { relative: (x+w)/MAIN_W (y+h)/MAIN_H; }             \
40                                         image { normal: img; }\
41                                         color: 255 255 255 alpha;       \
42                                 }     \
43                         }
44
45 #define VER_BACKGROUND_IMAGE(part_name, x, y, w, h, img) \
46                         part {                          \
47                                 name: part_name;        \
48                                 type: IMAGE;    \
49                                 description {   \
50                                         state: "default" 0.0;\
51                                        rel1 { relative: (x)/VER_MAIN_W (y)/VER_MAIN_H; }                \
52                                        rel2 { relative: (x+w)/VER_MAIN_W (y+h)/VER_MAIN_H; }             \
53                                         image { normal: img; }  \
54                                 }     \
55                         }
56
57 #define GENERAL_BUTTON(part_name, x, y, w, h, img_dim, img, img_p, img_s) \
58                         part {                          \
59                                 name: part_name;        \
60                                 type: IMAGE;    \
61                                 mouse_events: 1;\
62                                 description {   \
63                                         state: "default" 0.0;\
64                                        rel1 { relative: (x)/MAIN_W (y)/MAIN_H; }                \
65                                        rel2 { relative: (x+w)/MAIN_W (y+h)/MAIN_H; }             \
66                                         image { normal: img; }  \
67                                 }      \
68                                 description { \
69                                         state: "press" 0.0; \
70                                         inherit: "default" 0.0; \
71                                         image { normal: img_p; }\
72                                 }                                       \
73                                 description { \
74                                         state: "selected" 0.0; \
75                                         inherit: "default" 0.0; \
76                                         image { normal: img_s; }\
77                                 }                                       \
78                                 description { \
79                                         state: "dim" 0.0;                                \
80                                         inherit: "default" 0.0;                                     \
81                                         image { normal: img_dim;}                                                         \
82                                 }               \
83                                 description { \
84                                         state: "invisible" 0.0;                          \
85                                         inherit: "default" 0.0;                                     \
86                                         visible: 0;                                               \
87                                 } \
88                         }
89
90 #define VER_GENERAL_BUTTON(part_name, x, y, w, h, img_dim, img, img_p, img_s) \
91                         part {                          \
92                                 name: part_name;        \
93                                 type: IMAGE;    \
94                                 mouse_events: 1;\
95                                 description {   \
96                                         state: "default" 0.0;\
97                                        rel1 { relative: (x)/VER_MAIN_W (y)/VER_MAIN_H; }                \
98                                        rel2 { relative: (x+w)/VER_MAIN_W (y+h)/VER_MAIN_H; }             \
99                                         image { normal: img; }  \
100                                 }      \
101                                 description { \
102                                         state: "press" 0.0; \
103                                         inherit: "default" 0.0; \
104                                         image { normal: img_p; }\
105                                 }                                       \
106                                 description { \
107                                         state: "selected" 0.0; \
108                                         inherit: "default" 0.0; \
109                                         image { normal: img_s; }\
110                                 }                                       \
111                                 description { \
112                                         state: "dim" 0.0;                                \
113                                         inherit: "default" 0.0;                                     \
114                                         image { normal: img_dim;}                                                         \
115                                 }               \
116                                 description { \
117                                         state: "invisible" 0.0;                          \
118                                         inherit: "default" 0.0;                                     \
119                                         visible: 0;                                               \
120                                 } \
121                         }
122
123 #define GENERAL_BUTTON_PROGRAMS(part_name, signal_name, source_name) \
124                         program {       \
125                                 name: "lbutton_down_"part_name; \
126                                 signal: "mouse,down,1"; \
127                                 source: part_name; \
128                                 script {\
129                                         new st[31];\
130                                         new Float:vl;\
131                                         get_state(PART:part_name, st, 30, vl);\
132                                         if (strcmp(st, "dim") != 0) \
133                                                 { \
134                                                         set_state(PART:part_name, "press", 0.0);\
135                                                         emit( HAPTIC_SIG, HAPTIC_SIG_SRC );\
136                                                 } \
137                                         }\
138                         } \
139                         program { \
140                                 name: "lbutton_send_event_"part_name;  \
141                                 signal: "mouse,clicked,1"; \
142                                 source: part_name; \
143                                 script {\
144                                         new st[31];\
145                                         new Float:vl;\
146                                         get_state(PART:part_name, st, 30, vl);\
147                                         if (strcmp(st, "dim") != 0) \
148                                                 emit( signal_name, source_name );\
149                                         }\
150                         } \
151                         program { \
152                                 name: "lbutton_up_"part_name; \
153                                 signal: "mouse,up,1"; \
154                                 source: part_name; \
155                                 script {\
156                                         new st[31];\
157                                         new Float:vl;\
158                                         get_state(PART:part_name, st, 30, vl);\
159                                         if (strcmp(st, "dim") != 0) \
160                                                 set_state(PART:part_name, "default", 0.0);\
161                                         }\
162                         }
163