Tizen 2.0 Release
[apps/home/ug-memo-efl.git] / extend / extended-edc.h
1 /*
2 *
3 * Copyright 2012  Samsung Electronics Co., Ltd
4 *
5 * Licensed under the Flora License, Version 1.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *    http://floralicense.org/license/
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19 #ifndef __EXTENDED_EDC_H__
20 #define __EXTENDED_EDC_H__
21
22 #define PPART PART:
23 #define PIMAGE IMAGE:
24
25 /***********************************************************************/
26 /* size difinition layer */
27 #define PART_BG(iName)\
28 part {\
29         name: iName;\
30         type: RECT;\
31         mouse_events: 0;\
32         scale: 1;\
33         description {\
34                 state: "default" 0.0;\
35                 color: 0 0 0 0;\
36         } \
37 } \
38
39 #define PART_BG_EX(iName, iMinx, iMiny)\
40 part {\
41         name: iName;\
42         type: RECT;\
43         mouse_events: 0;\
44         scale: 1;\
45         description {\
46                 state: "default" 0.0;\
47                 min: iMinx iMiny;\
48                 color: 0 0 0 0;\
49         } \
50 } \
51
52 #define PART_RECT(iName, iR1x, iR1y, iR1t, iR2x, iR2y, iR2t)\
53 part {\
54         name: iName;\
55         type: RECT;\
56         mouse_events: 0;\
57         scale: 1;\
58         description {\
59                 state: "default" 0.0;\
60                 rel1 { relative: iR1x iR1y; to: iR1t; } \
61                 rel2 { relative: iR2x iR2y; to: iR2t; } \
62                 color: 0 0 0 0;\
63         } \
64 } \
65
66 #define PART_V_PIXEL_RECT(iName, size, iTo, iRy, iAy)\
67 part {\
68         name: iName;\
69         type: RECT;\
70         mouse_events: 0;\
71         scale: 1;\
72         description {\
73                 state: "default" 0.0;\
74                 min: 0 size;\
75                 align: 0.5 iAy;\
76                 fixed: 0 1;\
77                 rel1 { relative: 0.0 iRy; to: iTo; } \
78                 rel2 { relative: 1.0 iRy; to: iTo; } \
79                 color: 0 0 0 0;\
80         } \
81 } \
82
83 #define PART_H_PIXEL_RECT(iName, size, iTo, iRx, iAx)\
84 part {\
85         name: iName;\
86         type: RECT;\
87         mouse_events: 0;\
88         scale: 1;\
89         description {\
90                 state: "default" 0.0;\
91                 min: size 0;\
92                 align: iAx 0.5;\
93                 fixed: 1 0;\
94                 rel1 { relative: iRx 0.0; to: iTo; } \
95                 rel2 { relative: iRx 1.0; to: iTo; } \
96                 color: 0 0 0 0;\
97         } \
98 } \
99
100 #define PART_PIXEL_RECT(iName, iX, iY, iRx, iRy, iTo, iAx, iAy)\
101 part {\
102         name: iName;\
103         type: RECT;\
104         mouse_events: 0;\
105         scale: 1;\
106         description {\
107                 state: "default" 0.0;\
108                 min: iX iY;\
109                 align: iAx iAy;\
110                 fixed: 1 1;\
111                 rel1 { relative: iRx iRy; to: iTo; } \
112                 rel2 { relative: iRx iRy; to: iTo; } \
113                 color: 0 0 0 0;\
114         } \
115 } \
116
117
118 /* vertical divided rect, index range from 0~N-1
119  * iIndex must be immediate integer and expression like (1+2) is not allowed
120  */
121 #define PART_V_DIVID_RECT(iName, iTo, iIndex, iN)\
122 part {\
123         name: iName;\
124         type: RECT;\
125         mouse_events: 0;\
126         scale: 1;\
127         description {\
128                 state: "default" 0.0;\
129                 rel1 { relative: 0.0 (iIndex%iN)/iN; to: iTo; } \
130                 rel2 { relative: 1.0 (iIndex%iN+1)/iN; to: iTo; } \
131                 color: 0 0 0 0;\
132         } \
133 } \
134
135 /* horizontal divided rect, index range from 0~N-1
136  * iIndex must be immediate integer and expression like (1+2) is not allowed
137  */
138 #define PART_H_DIVID_RECT(iName, iTo, iIndex, iN)\
139 part {\
140         name: iName;\
141         type: RECT;\
142         mouse_events: 0;\
143         scale: 1;\
144         description {\
145                 state: "default" 0.0;\
146                 rel1 { relative: (iIndex%iN)/iN 0.0; to: iTo; } \
147                 rel2 { relative: (iIndex%iN+1)/iN 1.0; to: iTo; } \
148                 color: 0 0 0 0;\
149         } \
150 } \
151
152 #define PART_CLIPPER_RECT(iName, iR1x, iR1y, iR1t, iR2x, iR2y, iR2t)\
153 part {\
154         name: iName;\
155         type: RECT;\
156         mouse_events: 0;\
157         scale: 1;\
158         description {\
159                 state: "default" 0.0;\
160                 rel1 { relative: iR1x iR1y; to: iR1t; } \
161                 rel2 { relative: iR2x iR2y; to: iR2t; } \
162                 color: 255 255 255 255;\
163         } \
164 } \
165
166 /***********************************************************************/
167 /* mouse event filter layer */
168 #define PART_EVENT_RECT(iName, iTo)\
169 part {\
170         name: iName;\
171         type: RECT;\
172         mouse_events: 1;\
173         scale: 1;\
174         description {\
175                 state: "default" 0.0;\
176                 rel1 { relative: 0.0 0.0; to: iTo; } \
177                 rel2 { relative: 1.0 1.0; to: iTo; } \
178                 color: 0 0 0 0;\
179         } \
180 } \
181
182 /***********************************************************************/
183 /* content layer */
184 #define PART_COLOR_RECT(iName, iTo, iCr, iCg, iCb, iCa)\
185 part {\
186         name: iName;\
187         type: RECT;\
188         mouse_events: 0;\
189         scale: 1;\
190         description {\
191                 state: "default" 0.0;\
192                 rel1 { relative: 0.0 0.0; to: iTo; } \
193                 rel2 { relative: 1.0 1.0; to: iTo; } \
194                 color: iCr iCg iCb iCa;\
195         } \
196 } \
197
198 #define PART_COLOR_RECT_REL(iName, iR1x, iR1y, iR1t, iR2x, iR2y, iR2t, iCr, iCg, iCb, iCa)\
199 part {\
200         name: iName;\
201         type: RECT;\
202         mouse_events: 0;\
203         scale: 1;\
204         description {\
205                 state: "default" 0.0;\
206                 rel1 { relative: iR1x iR1y; to: iR1t; } \
207                 rel2 { relative: iR2x iR2y; to: iR2t; } \
208                 color: iCr iCg iCb iCa;\
209         } \
210 } \
211
212 #define PART_IMAGE(iName, iTo, iImage)\
213 part {\
214         name: iName;\
215         type: IMAGE;\
216         mouse_events: 0;\
217         scale: 1;\
218         description {\
219                 state: "default" 0.0;\
220                 rel1 { relative: 0.0 0.0; to: iTo; } \
221                 rel2 { relative: 1.0 1.0; to: iTo; } \
222                 image.normal : iImage;\
223         } \
224 } \
225
226 #define PART_IMAGE_REL(iName, iImage, iR1x, iR1y, iR1t, iR2x, iR2y, iR2t)\
227 PART_RECT("_"iName, iR1x, iR1y, iR1t, iR2x, iR2y, iR2t)\
228 PART_IMAGE(iName, "_"iName, iImage)\
229
230 #define PART_BORDER_IMAGE(iName, iTo, iImage, iBl, iBr, iBt, iBb)\
231 part {\
232         name: iName;\
233         type: IMAGE;\
234         mouse_events: 0;\
235         scale: 1;\
236         description {\
237                 state: "default" 0.0;\
238                 rel1 { relative: 0.0 0.0; to: iTo; } \
239                 rel2 { relative: 1.0 1.0; to: iTo; } \
240                 image.normal : iImage;\
241                 image.border : iBl iBr iBt iBb;\
242         } \
243 } \
244
245 #define PART_SWALLOW(iName, iTo)\
246 part {\
247         name: iName;\
248         type: SWALLOW;\
249         mouse_events: 1;\
250         scale: 1;\
251         description {\
252                 state: "default" 0.0;\
253                 rel1 { relative: 0.0 0.0; to: iTo; } \
254                 rel2 { relative: 1.0 1.0; to: iTo; } \
255         } \
256 } \
257
258 #define PART_SWALLOW_REL(iName, iR1x, iR1y, iR1t, iR2x, iR2y, iR2t)\
259 PART_RECT("_"iName, iR1x, iR1y, iR1t, iR2x, iR2y, iR2t)\
260 PART_SWALLOW(iName, "_"iName)\
261
262 #define PART_UNVISIBLE_SWALLOW(iName, iTo)\
263 part {\
264         name: iName;\
265         type: SWALLOW;\
266         mouse_events: 1;\
267         scale: 1;\
268         description {\
269                 state: "default" 0.0;\
270                 visible: 0;\
271                 rel1 { relative: 0.0 0.0; to: iTo; } \
272                 rel2 { relative: 1.0 1.0; to: iTo; } \
273         } \
274 } \
275
276 #define PART_UNVISIBLE_SWALLOW_REL(iName, iR1x, iR1y, iR1t, iR2x, iR2y, iR2t)\
277 PART_RECT("_"iName, iR1x, iR1y, iR1t, iR2x, iR2y, iR2t)\
278 PART_UNVISIBLE_SWALLOW(iName, "_"iName)\
279
280 #define PART_CLIPPED_SWALLOW(iName, iR1x, iR1y, iR1t, iR2x, iR2y, iR2t,\
281                 iAx, iAy, iCliper)\
282 part {\
283         name: iName;\
284         type: SWALLOW;\
285         mouse_events: 0;\
286         scale: 1;\
287         clip_to: iCliper;\
288         description {\
289                 state: "default" 0.0;\
290                 align: iAx iAy;\
291                 fixed: 1 1;\
292                 rel1 { relative: iR1x iR1y; to: iR1t; } \
293                 rel2 { relative: iR2x iR2y; to: iR2t; } \
294         } \
295 } \
296
297 #define PART_TEXT(iName, iTo, iText, iFont, iClass, iSize,\
298                 iAx, iAy, iCr, iCg, iCb, iCa)\
299 part {\
300         name: iName;\
301         type: TEXT;\
302         mouse_events: 0;\
303         scale: 1;\
304         description {\
305                 state: "default" 0.0;\
306                 rel1 { relative: 0.0 0.0; to: iTo; } \
307                 rel2 { relative: 1.0 1.0; to: iTo; } \
308                 color: iCr iCg iCb iCa;\
309                 text {\
310                         text: iText;\
311                         font: iFont;\
312                         text_class: iClass;\
313                         size: iSize;\
314                         align: iAx iAy;\
315                 } \
316         } \
317 } \
318
319 #define PART_TEXT_REL(iName, iR1x, iR1y, iR1t, iR2x, iR2y, iR2t,\
320                 iText, iFont, iClass, iSize, iAx, iAy, iCr, iCg, iCb, iCa)\
321 PART_RECT("_"iName, iR1x, iR1y, iR1t, iR2x, iR2y, iR2t)\
322 PART_TEXT(iName, "_"iName, iText, iFont, iClass, iSize, iAx, iAy, iCr, iCg, iCb, iCa)\
323
324 /***********************************************************************/
325 /* script */
326 /* ugh!!!, iPart, iR1t, iR2t and iV of SCRIPT_SET_IMAGE should not be quoted with "" */
327 #define SCRIPT_CUSTOM_PART(iPart)\
328 custom_state(PPART#iPart, "default", 0.0);\
329 set_state(PPART#iPart, "custom", 0.0)
330
331 /* pay attention, rel paramater can only be float, script will not do evaluation of mathematics expression
332         eg. 10/100 is illegal, 0.1 is correct */
333 #define SCRIPT_SET_REL(iPart, iR1x, iR1y, iR1t, iR2x, iR2y, iR2t)\
334 set_state_val(PPART#iPart, STATE_REL1, iR1x, iR1y);\
335 set_state_val(PPART#iPart, STATE_REL1_TO, PPART#iR1t, PPART#iR1t);\
336 set_state_val(PPART#iPart, STATE_REL2, iR2x, iR2y);\
337 set_state_val(PPART#iPart, STATE_REL2_TO, PPART#iR2t, PPART#iR2t)\
338
339 #define SCRIPT_SET_VISIBLE(iPart, iV)\
340 set_state_val(PPART#iPart, STATE_VISIBLE, iV)
341
342 #define SCRIPT_SET_IMAGE(iPart, iV)\
343 set_state_val(PPART#iPart, STATE_IMAGE, PIMAGE#iV)
344
345 #define SCRIPT_SET_COLOR(iPart, iCr, iCg, iCb, iCa)\
346 set_state_val(PPART#iPart, STATE_COLOR, iCr, iCg, iCb, iCa)
347
348
349 /***********************************************************************/
350 /* program */
351 /* ugh!!! isignal, isource, iPart should not quoted with ""  */
352 #define PROGRAM_SET_VISIBLE(isignal, isource, iPart, iV)\
353 program {\
354         name: #isource#isignal;\
355         source: #isource;\
356         signal: #isignal;\
357         script {\
358                 SCRIPT_SET_VISIBLE(iPart, iV);\
359         } \
360 } \
361
362 #endif                          /* __EXTENDED_EDC_H__ */