APPLY_RSA
[apps/home/calculator.git] / edc / edc-macro.edc
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://www.tizenopensource.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 __EDC_MACRO_H__
20 #define __EDC_MACRO_H__
21
22 /* Basic */
23 #define EDC_COLOR(nR, nG, nB, nA)           nR nG nB nA
24 #define EDC_SIZE(nW, nH)                    nW nH
25 #define EDC_COOR(nX, nY)                    nX nY   /* coordinate */
26 #define EDC_IMAGE_BORDER(nL, nR, nT, nB)    nL nR nT nB
27
28 /* Image */
29 #define EDC_IMAGE(sImage)\
30     image.normal: sImage;
31 #define EDC_IMAGE_WITH_BORDER(sImage, imgBorder)\
32     image {normal: sImage; border: imgBorder; border_scale: 1;}
33
34 /* Text */
35 #define EDC_TEXT(sText, nSize, sFont, tClass, crFill) \
36     color: crFill;\
37     text { \
38         text: sText; \
39         size: nSize; \
40         align: 0.5 0.5; \
41         font: sFont; \
42                 text_calss: tClass; \
43     }
44
45 #define EDC_TEXT_SHADOW(sText, nSize, sFont, tClass, crFill, crShadow) \
46     color2: crShadow;\
47     EDC_TEXT(sText, nSize, sFont, tClass, crFill)
48
49
50 /* Relative */
51 #define EDC_REL_TO_XY(fpRelX, fpRelY, coorOffset, sToPartX, sToPartY)\
52     relative: fpRelX fpRelY; offset: coorOffset; to_x: sToPartX; to_y: sToPartY
53
54 #define EDC_REL_TO(fpRelX, fpRelY, coorOffset, sToPart)\
55     relative: fpRelX fpRelY; offset: coorOffset; to: sToPart
56
57 #define EDC_REL_ABSOLUTE(coorOffset, sToPart)\
58     EDC_REL_TO(0.0, 0.0, coorOffset, sToPart)
59
60 #define EDC_REL_RELATIVE(fpRelX, fpRelY, sToPart)\
61     relative: fpRelX fpRelY; to: sToPart
62
63 /* state */
64 #define EDC_STATE_BASE(sName, sizeMin, bFixW, bFixH, fpAlignX, fpAlignY,\
65         relTopLeft, relBottomRight, other)\
66     description {\
67         state: sName 0.0;\
68         min: sizeMin;\
69         fixed: bFixW bFixH;\
70         align: fpAlignX fpAlignY;\
71         rel1 { relTopLeft; }\
72         rel2 { relBottomRight; } \
73         other \
74     }
75
76 /* state - padding top-left */
77 #define EDC_STATE_PADDING_TL(sName, sizeMin, sToPart) \
78     EDC_STATE_BASE(sName, sizeMin, 1, 1, 0.0, 0.0, \
79         EDC_REL_RELATIVE(0.0, 0.0, sToPart), \
80         EDC_REL_RELATIVE(0.0, 0.0, sToPart), visible: 0;)
81
82 /* state - padding bottom-right */
83 #define EDC_STATE_PADDING_BR(sName, sizeMin, sToPart) \
84     EDC_STATE_BASE(sName, sizeMin, 1, 1, 1.0, 1.0, \
85         EDC_REL_RELATIVE(1.0, 1.0, sToPart), \
86         EDC_REL_RELATIVE(1.0, 1.0, sToPart), visible: 0;)
87
88
89 #define EDC_STATE_COMMON(sName, relTopLeft, relBottomRight, other) \
90     EDC_STATE_BASE(sName, EDC_SIZE(0, 0), 0, 0, 0.5, 0.5, relTopLeft, relBottomRight, other)
91
92 #define EDC_STATE_COMMON_RECT(sName, relTopLeft, relBottomRight, crFill) \
93     EDC_STATE_COMMON(sName, relTopLeft, relBottomRight, color: crFill;)
94
95 #define EDC_STATE_COMMON_IMAGE(sName, relTopLeft, relBottomRight, img) \
96     EDC_STATE_COMMON(sName, relTopLeft, relBottomRight, img)
97
98 #define EDC_STATE_COMMON_TEXT(sName, relTopLeft, relBottomRight, txt) \
99     EDC_STATE_COMMON(sName, relTopLeft, relBottomRight, txt)
100
101 /* Background */
102 #define EDC_PART_BG(sName)\
103     part {\
104         name: sName;\
105         type: RECT;\
106         mouse_events: 0;\
107         description {\
108             state: "default" 0.0;\
109             rel1 { relative: 0.0 0.0;}\
110             rel2 { relative: 1.0 1.0;}\
111             color: 0 0 0 0;\
112         }\
113     }
114
115 /* Part */
116 #define EDC_PART_BASE(sName, enumType, bMouse, bRepeat, stateDefault, stateOther...) \
117     part {\
118         name: sName;\
119         type: enumType;\
120         mouse_events: bMouse;\
121         repeat_events: bRepeat;\
122         scale: 1;\
123         stateDefault\
124         ##stateOther\
125     }
126
127 #define EDC_PART_PADDING_TL(sName, sizeMin, sToPart) \
128     EDC_PART_BASE(sName, RECT, 1, 0, \
129         EDC_STATE_PADDING_TL("default", sizeMin, sToPart))
130
131 #define EDC_PART_PADDING_BR(sName, sizeMin, sToPart) \
132     EDC_PART_BASE(sName, RECT, 1, 0, \
133         EDC_STATE_PADDING_BR("default", sizeMin, sToPart))
134
135 /* Part - Rectagnle */
136 #define EDC_PART_RECT_COMMON(sName, relTopLeft, relBottomRight) \
137     EDC_PART_BASE(sName, RECT, 1, 1, \
138         EDC_STATE_COMMON_RECT("default", relTopLeft, relBottomRight, EDC_COLOR(0, 0, 0, 0)))
139
140 #define EDC_PART_RECT_ABSOLUTE(sName, sToPart, coorTopLeft, coorBottomRight) \
141     EDC_PART_RECT_COMMON(sName, \
142         EDC_REL_ABSOLUTE(coorTopLeft, sToPart),\
143         EDC_REL_ABSOLUTE(coorBottomRight, sToPart))
144
145 #define EDC_PART_RECT_RELATIVE(sName, sToPart, fpRel1X, fpRel1Y, fpRel2X, fpRel2Y) \
146     EDC_PART_RECT_COMMON(sName, \
147         EDC_REL_RELATIVE(fpRel1X, fpRel1Y, sToPart), \
148         EDC_REL_RELATIVE(fpRel2X, fpRel2Y, sToPart))
149
150 #define EDC_PART_RECT_PADDING(sName, sToPart, coorTopLeft, coorBottomRight) \
151     EDC_PART_PADDING_TL(sName"_padding_tl", coorTopLeft, sToPart)\
152     EDC_PART_PADDING_BR(sName"_padding_br", coorBottomRight, sToPart)\
153     EDC_PART_RECT_COMMON(sName, \
154         EDC_REL_RELATIVE(1.0, 1.0, sName"_padding_tl"), \
155         EDC_REL_RELATIVE(0.0, 0.0, sName"_padding_br"))
156
157 #define EDC_PART_RECT_COLOR(sName, sToPart, crFill) \
158     EDC_PART_BASE(sName, RECT, 1, 0, \
159         EDC_STATE_COMMON_RECT("default", \
160             EDC_REL_RELATIVE(0.0, 0.0, sToPart), \
161             EDC_REL_RELATIVE(1.0, 1.0, sToPart), crFill))
162
163 /* Part - Image */
164 #define EDC_PART_IMAGE(sName, sToPart, img)\
165     EDC_PART_BASE(sName, IMAGE, 1, 0, \
166         EDC_STATE_COMMON_IMAGE("default", \
167             EDC_REL_RELATIVE(0.0, 0.0, sToPart), \
168             EDC_REL_RELATIVE(1.0, 1.0, sToPart), img))
169
170 /* Part - Text */
171 #define EDC_PART_TEXT(sName, sToPart, enumEffect, txt)\
172     EDC_PART_BASE(sName, TEXT, 1, 1, \
173         effect: enumEffect;\
174         EDC_STATE_COMMON_TEXT("default", \
175             EDC_REL_RELATIVE(0.0, 0.0, sToPart), \
176             EDC_REL_RELATIVE(1.0, 1.0, sToPart), txt))
177
178 /* Two state part */
179 #define EDC_PART_TWO_STATE(sName, enumType, sToPart, sStateName2, state1Do, state2Do)\
180     EDC_PART_BASE(sName, enumType, 1, 1, \
181         EDC_STATE_COMMON("default", \
182             EDC_REL_RELATIVE(0.0, 0.0, sToPart), \
183             EDC_REL_RELATIVE(1.0, 1.0, sToPart), state1Do;)\
184         EDC_STATE_COMMON(sStateName2, \
185             EDC_REL_RELATIVE(0.0, 0.0, sToPart), \
186             EDC_REL_RELATIVE(1.0, 1.0, sToPart), state2Do;))
187
188 #define EDC_PART_BUTTON_IMG(sName, sToPart, imgNormal, imgPressed) \
189     EDC_PART_TWO_STATE(sName, IMAGE, sToPart, "pressed", imgNormal, imgPressed)
190
191 #define EDC_PART_TWO_IMG(sName, sToPart, sState, imgNormal, imgPressed) \
192     EDC_PART_TWO_STATE(sName, IMAGE, sToPart, sState, imgNormal, imgPressed)
193
194 #define EDC_PART_SWALLOW_SHOW_HIDE(sName, sToPart) \
195     EDC_PART_TWO_STATE(sName, SWALLOW, sToPart, "hide", visible: 1;, visible: 0;)
196
197 #define EDC_PART_SWALLOW_HIDE_SHOW(sName, sToPart) \
198     EDC_PART_TWO_STATE(sName, SWALLOW, sToPart, "show", visible: 0;, visible: 1;)
199
200
201 #endif /* __EDC_MACRO_H__ */