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