Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / animations / FUiAnim_VisualElementEnvironment.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 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  * @file        FUiAnim_VisualElementEnvironment.cpp
20  * @brief       This file contains implementation of _VisualElementEnvironment class
21  *
22  * This file contains implementation _VisualElementEnvironment class.
23  */
24 #include <typeinfo>
25 #include <FBaseSysLog.h>
26 #include <FBaseString.h>
27
28
29 #include "FUiAnim_VisualElementCoordinateSystem.h"
30 #include "FUiAnim_VisualElementImpl.h"
31 #include "FUiAnim_VisualElementEnvironment.h"
32
33
34 using namespace Tizen::Base;
35
36
37 namespace Tizen { namespace Ui { namespace Animations
38 {
39
40
41
42
43 const wchar_t* VePropBounds                                                             = L"bounds";
44 const wchar_t* VePropContentBounds                                                      = L"contentBounds";
45 const wchar_t* VePropContentOpacity                                             = L"contentOpacity";
46 const wchar_t* VePropRenderOperation                                            = L"renderOperation";
47 const wchar_t* VePropOpacity                                                            = L"opacity";
48 const wchar_t* VePropShowState                                                          = L"showState";
49 const wchar_t* VePropAnchor                                                             = L"anchor";
50 const wchar_t* VePropAnchorZ                                                            = L"anchorZ";
51 const wchar_t* VePropTransform                                                          = L"transform";
52 const wchar_t* VePropChildrenTransform                                          = L"childrenTransform";
53 const wchar_t* VePropZPosition                                                          = L"zPosition";
54 const wchar_t* VePropZOrderGroup                                                        = L"zOrderGroup";
55 const wchar_t* VePropClipToParent                                                       = L"clipToParent";
56 const wchar_t* VePropClipChildren                                                       = L"clipChildren";
57 const wchar_t* VePropSurfaceOpaque                                                      = L"surfaceOpaque";
58 const wchar_t* VePropName                                                                       = L"name";
59 const wchar_t* VePropPropertyPropagationEnabled                         = L"propertyPropagation";
60 const wchar_t* VePropImplicitAnimationEnabled                           = L"implicitAnimation";
61
62 #if defined(SUPPORT_CUSTOMIZING_ATTACH_DETACH_ANIMATION)
63 const wchar_t* VePropActionDetach                                                       = L"detach";
64 const wchar_t* VePropActionAttach                                                       = L"attach";
65 #endif
66 const wchar_t* VeSubPropBounds                                                          = L"bounds.";
67 const wchar_t* VeSubPropBoundsPosition                                          = L"bounds.position";
68 const wchar_t* VeSubPropBoundsSize                                                      = L"bounds.size";
69
70 const wchar_t* VeSubPropTransform                                                       = L"transform.";
71 const wchar_t* VeSubPropTransformRotationX                                      = L"transform.rotation.x";
72 const wchar_t* VeSubPropTransformRotationY                                      = L"transform.rotation.y";
73 const wchar_t* VeSubPropTransformRotationZ                                      = L"transform.rotation.z";
74 const wchar_t* VeSubPropTransformScaleX                                         = L"transform.scale.x";
75 const wchar_t* VeSubPropTransformScaleY                                         = L"transform.scale.y";
76 const wchar_t* VeSubPropTransformScaleZ                                         = L"transform.scale.z";
77 const wchar_t* VeSubPropTransformTranslationX                           = L"transform.translation.x";
78 const wchar_t* VeSubPropTransformTranslationY                           = L"transform.translation.y";
79 const wchar_t* VeSubPropTransformTranslationZ                           = L"transform.translation.z";
80 const wchar_t* VeSubPropTransformRotationAnchorX                        = L"transform.rotation.anchor.x";
81 const wchar_t* VeSubPropTransformRotationAnchorY                        = L"transform.rotation.anchor.y";
82 const wchar_t* VeSubPropTransformRotationAnchorZ                        = L"transform.rotation.anchor.z";
83 const wchar_t* VeSubPropTransformScaleAnchorX                           = L"transform.scale.anchor.x";
84 const wchar_t* VeSubPropTransformScaleAnchorY                           = L"transform.scale.anchor.y";
85 const wchar_t* VeSubPropTransformScaleAnchorZ                           = L"transform.scale.anchor.z";
86
87 const wchar_t* VeSubPropTransformRotationXY                                     = L"transform.rotation.xy";
88 const wchar_t* VeSubPropTransformScaleXY                                        = L"transform.scale.xy";
89 const wchar_t* VeSubPropTransformTranslationXY                          = L"transform.translation.xy";
90 const wchar_t* VeSubPropTransformRotationAnchorXY                       = L"transform.rotation.anchor.xy";
91 const wchar_t* VeSubPropTransformScaleAnchorXY                          = L"transform.scale.anchor.xy";
92
93
94 const wchar_t* VeSubPropChildrenTransform                                       = L"childrenTransform.";
95 const wchar_t* VeSubPropChildrenTransformRotationX                      = L"childrenTransform.rotation.x";
96 const wchar_t* VeSubPropChildrenTransformRotationY                      = L"childrenTransform.rotation.y";
97 const wchar_t* VeSubPropChildrenTransformRotationZ                      = L"childrenTransform.rotation.z";
98 const wchar_t* VeSubPropChildrenTransformScaleX                         = L"childrenTransform.scale.x";
99 const wchar_t* VeSubPropChildrenTransformScaleY                         = L"childrenTransform.scale.y";
100 const wchar_t* VeSubPropChildrenTransformScaleZ                         = L"childrenTransform.scale.z";
101 const wchar_t* VeSubPropChildrenTransformTranslationX           = L"childrenTransform.translation.x";
102 const wchar_t* VeSubPropChildrenTransformTranslationY           = L"childrenTransform.translation.y";
103 const wchar_t* VeSubPropChildrenTransformTranslationZ           = L"childrenTransform.translation.z";
104 const wchar_t* VeSubPropChildrenTransformRotationAnchorX        = L"childrenTransform.rotation.anchor.x";
105 const wchar_t* VeSubPropChildrenTransformRotationAnchorY        = L"childrenTransform.rotation.anchor.y";
106 const wchar_t* VeSubPropChildrenTransformRotationAnchorZ        = L"childrenTransform.rotation.anchor.z";
107 const wchar_t* VeSubPropChildrenTransformScaleAnchorX           = L"childrenTransform.scale.anchor.x";
108 const wchar_t* VeSubPropChildrenTransformScaleAnchorY           = L"childrenTransform.scale.anchor.y";
109 const wchar_t* VeSubPropChildrenTransformScaleAnchorZ           = L"childrenTransform.scale.anchor.z";
110
111 const wchar_t* VeSubPropChildrenTransformRotationXY                     = L"childrenTransform.rotation.xy";
112 const wchar_t* VeSubPropChildrenTransformScaleXY                        = L"childrenTransform.scale.xy";
113 const wchar_t* VeSubPropChildrenTransformTranslationXY          = L"childrenTransform.translation.xy";
114 const wchar_t* VeSubPropChildrenTransformRotationAnchorXY       = L"childrenTransform.rotation.anchor.xy";
115 const wchar_t* VeSubPropChildrenTransformScaleAnchorXY          = L"childrenTransform.scale.anchor.xy";
116
117 const wchar_t* VePrivPropShowOpacity                                            = L"__showOpacity";
118
119 String* pVePropBounds                                                           = null;
120 String* pVePropContentBounds                                            = null;
121 String* pVePropContentOpacity                                           = null;
122 String* pVePropRenderOperation                                          = null;
123 String* pVePropOpacity                                                          = null;
124 String* pVePropShowState                                                        = null;
125 String* pVePropAnchor                                                           = null;
126 String* pVePropAnchorZ                                                          = null;
127 String* pVePropTransform                                                        = null;
128 String* pVePropChildrenTransform                                        = null;
129 String* pVePropZPosition                                                        = null;
130 String* pVePropZOrderGroup                                                      = null;
131 String* pVePropClipToParent                                             = null;
132 String* pVePropClipChildren                                             = null;
133 String* pVePropSurfaceOpaque                                            = null;
134 String* pVePropName                                                             = null;
135 String* pVePropPropertyPropagationEnabled                       = null;
136 String* pVePropImplicitAnimationEnabled                         = null;
137
138 #if defined(SUPPORT_CUSTOMIZING_ATTACH_DETACH_ANIMATION)
139 String* pVePropActionDetach                                                     = null;
140 String* pVePropActionAttach                                                     = null;
141 #endif
142 String* pVeSubPropBounds                                                        = null;
143 String* pVeSubPropBoundsPosition                                        = null;
144 String* pVeSubPropBoundsSize                                            = null;
145
146 String* pVeSubPropTransform                                                     = null;
147 String* pVeSubPropTransformRotationX                            = null;
148 String* pVeSubPropTransformRotationY                            = null;
149 String* pVeSubPropTransformRotationZ                            = null;
150 String* pVeSubPropTransformScaleX                                       = null;
151 String* pVeSubPropTransformScaleY                                       = null;
152 String* pVeSubPropTransformScaleZ                                       = null;
153 String* pVeSubPropTransformTranslationX                         = null;
154 String* pVeSubPropTransformTranslationY                         = null;
155 String* pVeSubPropTransformTranslationZ                         = null;
156 String* pVeSubPropTransformRotationAnchorX                      = null;
157 String* pVeSubPropTransformRotationAnchorY                      = null;
158 String* pVeSubPropTransformRotationAnchorZ                      = null;
159 String* pVeSubPropTransformScaleAnchorX                         = null;
160 String* pVeSubPropTransformScaleAnchorY                         = null;
161 String* pVeSubPropTransformScaleAnchorZ                         = null;
162
163 String* pVeSubPropTransformRotationXY                           = null;
164 String* pVeSubPropTransformScaleXY                                      = null;
165 String* pVeSubPropTransformTranslationXY                        = null;
166 String* pVeSubPropTransformRotationAnchorXY                     = null;
167 String* pVeSubPropTransformScaleAnchorXY                        = null;
168
169
170 String* pVeSubPropChildrenTransform                                     = null;
171 String* pVeSubPropChildrenTransformRotationX            = null;
172 String* pVeSubPropChildrenTransformRotationY            = null;
173 String* pVeSubPropChildrenTransformRotationZ            = null;
174 String* pVeSubPropChildrenTransformScaleX                       = null;
175 String* pVeSubPropChildrenTransformScaleY                       = null;
176 String* pVeSubPropChildrenTransformScaleZ                       = null;
177 String* pVeSubPropChildrenTransformTranslationX         = null;
178 String* pVeSubPropChildrenTransformTranslationY         = null;
179 String* pVeSubPropChildrenTransformTranslationZ         = null;
180 String* pVeSubPropChildrenTransformRotationAnchorX      = null;
181 String* pVeSubPropChildrenTransformRotationAnchorY      = null;
182 String* pVeSubPropChildrenTransformRotationAnchorZ      = null;
183 String* pVeSubPropChildrenTransformScaleAnchorX         = null;
184 String* pVeSubPropChildrenTransformScaleAnchorY         = null;
185 String* pVeSubPropChildrenTransformScaleAnchorZ         = null;
186
187 String* pVeSubPropChildrenTransformRotationXY           = null;
188 String* pVeSubPropChildrenTransformScaleXY                      = null;
189 String* pVeSubPropChildrenTransformTranslationXY        = null;
190 String* pVeSubPropChildrenTransformRotationAnchorXY     = null;
191 String* pVeSubPropChildrenTransformScaleAnchorXY        = null;
192
193 String* pVePrivPropShowOpacity                                          = null;
194
195 _VisualElementEnvironment* _VisualElementEnvironment::__pInstance= NULL;
196
197 _VisualElementEnvironment::_VisualElementEnvironment(void)
198 {
199
200 }
201 void
202 _VisualElementEnvironment::Initialize(void)
203 {
204         if(!_VisualElementEnvironment::__pInstance)
205         {
206                 static _VisualElementEnvironment instance;
207                 _VisualElementEnvironment::__pInstance = &instance;
208                 _VisualElementEnvironment::__pInstance->InitializeEnvironment();
209         }
210 }
211
212 void
213 _VisualElementEnvironment::InitializeEnvironment(void)
214 {
215         pVePropBounds                                                           = new (std::nothrow) String(VePropBounds);
216         pVePropContentBounds                                            = new (std::nothrow) String(VePropContentBounds);
217         pVePropContentOpacity                                           = new (std::nothrow) String(VePropContentOpacity);
218         pVePropRenderOperation                                          = new (std::nothrow) String(VePropRenderOperation);
219         pVePropOpacity                                                          = new (std::nothrow) String(VePropOpacity);
220         pVePropShowState                                                        = new (std::nothrow) String(VePropShowState);
221         pVePropAnchor                                                           = new (std::nothrow) String(VePropAnchor);
222         pVePropAnchorZ                                                          = new (std::nothrow) String(VePropAnchorZ);
223         pVePropTransform                                                        = new (std::nothrow) String(VePropTransform);
224         pVePropChildrenTransform                                        = new (std::nothrow) String(VePropChildrenTransform);
225         pVePropZPosition                                                        = new (std::nothrow) String(VePropZPosition);
226         pVePropZOrderGroup                                                      = new (std::nothrow) String(VePropZOrderGroup);
227         pVePropClipToParent                                             = new (std::nothrow) String(VePropClipToParent);
228         pVePropClipChildren                                             = new (std::nothrow) String(VePropClipChildren);
229         pVePropSurfaceOpaque                                            = new (std::nothrow) String(VePropSurfaceOpaque);
230         pVePropName                                                             = new (std::nothrow) String(VePropName);
231         pVePropPropertyPropagationEnabled                       = new (std::nothrow) String(VePropPropertyPropagationEnabled);
232         pVePropImplicitAnimationEnabled                         = new (std::nothrow) String(VePropImplicitAnimationEnabled);
233 #if defined(SUPPORT_CUSTOMIZING_ATTACH_DETACH_ANIMATION)
234         pVePropActionDetach                                                     = new (std::nothrow) String(VePropActionDetach);
235         pVePropActionAttach                                                     = new (std::nothrow) String(VePropActionAttach);
236 #endif
237         pVeSubPropBounds                                                        = new (std::nothrow) String(VeSubPropBounds);
238         pVeSubPropBoundsPosition                                        = new (std::nothrow) String(VeSubPropBoundsPosition);
239         pVeSubPropBoundsSize                                            = new (std::nothrow) String(VeSubPropBoundsSize);
240
241         pVeSubPropTransform                                                     = new (std::nothrow) String(VeSubPropTransform);
242         pVeSubPropTransformRotationX                            = new (std::nothrow) String(VeSubPropTransformRotationX);
243         pVeSubPropTransformRotationY                            = new (std::nothrow) String(VeSubPropTransformRotationY);
244         pVeSubPropTransformRotationZ                            = new (std::nothrow) String(VeSubPropTransformRotationZ);
245         pVeSubPropTransformScaleX                                       = new (std::nothrow) String(VeSubPropTransformScaleX);
246         pVeSubPropTransformScaleY                                       = new (std::nothrow) String(VeSubPropTransformScaleY);
247         pVeSubPropTransformScaleZ                                       = new (std::nothrow) String(VeSubPropTransformScaleZ);
248         pVeSubPropTransformTranslationX                         = new (std::nothrow) String(VeSubPropTransformTranslationX);
249         pVeSubPropTransformTranslationY                         = new (std::nothrow) String(VeSubPropTransformTranslationY);
250         pVeSubPropTransformTranslationZ                         = new (std::nothrow) String(VeSubPropTransformTranslationZ);
251         pVeSubPropTransformRotationAnchorX                      = new (std::nothrow) String(VeSubPropTransformRotationAnchorX);
252         pVeSubPropTransformRotationAnchorY                      = new (std::nothrow) String(VeSubPropTransformRotationAnchorY);
253         pVeSubPropTransformRotationAnchorZ                      = new (std::nothrow) String(VeSubPropTransformRotationAnchorZ);
254         pVeSubPropTransformScaleAnchorX                         = new (std::nothrow) String(VeSubPropTransformScaleAnchorX);
255         pVeSubPropTransformScaleAnchorY                         = new (std::nothrow) String(VeSubPropTransformScaleAnchorY);
256         pVeSubPropTransformScaleAnchorZ                         = new (std::nothrow) String(VeSubPropTransformScaleAnchorZ);
257
258         pVeSubPropTransformRotationXY                           = new (std::nothrow) String(VeSubPropTransformRotationXY);
259         pVeSubPropTransformScaleXY                                      = new (std::nothrow) String(VeSubPropTransformScaleXY);
260         pVeSubPropTransformTranslationXY                        = new (std::nothrow) String(VeSubPropTransformTranslationXY);
261         pVeSubPropTransformRotationAnchorXY                     = new (std::nothrow) String(VeSubPropTransformRotationAnchorXY);
262         pVeSubPropTransformScaleAnchorXY                        = new (std::nothrow) String(VeSubPropTransformScaleAnchorXY);
263
264
265         pVeSubPropChildrenTransform                                     = new (std::nothrow) String(VeSubPropChildrenTransform);
266         pVeSubPropChildrenTransformRotationX            = new (std::nothrow) String(VeSubPropChildrenTransformRotationX);
267         pVeSubPropChildrenTransformRotationY            = new (std::nothrow) String(VeSubPropChildrenTransformRotationY);
268         pVeSubPropChildrenTransformRotationZ            = new (std::nothrow) String(VeSubPropChildrenTransformRotationZ);
269         pVeSubPropChildrenTransformScaleX                       = new (std::nothrow) String(VeSubPropChildrenTransformScaleX);
270         pVeSubPropChildrenTransformScaleY                       = new (std::nothrow) String(VeSubPropChildrenTransformScaleY);
271         pVeSubPropChildrenTransformScaleZ                       = new (std::nothrow) String(VeSubPropChildrenTransformScaleZ);
272         pVeSubPropChildrenTransformTranslationX         = new (std::nothrow) String(VeSubPropChildrenTransformTranslationX);
273         pVeSubPropChildrenTransformTranslationY         = new (std::nothrow) String(VeSubPropChildrenTransformTranslationY);
274         pVeSubPropChildrenTransformTranslationZ         = new (std::nothrow) String(VeSubPropChildrenTransformTranslationZ);
275         pVeSubPropChildrenTransformRotationAnchorX      = new (std::nothrow) String(VeSubPropChildrenTransformRotationAnchorX);
276         pVeSubPropChildrenTransformRotationAnchorY      = new (std::nothrow) String(VeSubPropChildrenTransformRotationAnchorY);
277         pVeSubPropChildrenTransformRotationAnchorZ      = new (std::nothrow) String(VeSubPropChildrenTransformRotationAnchorZ);
278         pVeSubPropChildrenTransformScaleAnchorX         = new (std::nothrow) String(VeSubPropChildrenTransformScaleAnchorX);
279         pVeSubPropChildrenTransformScaleAnchorY         = new (std::nothrow) String(VeSubPropChildrenTransformScaleAnchorY);
280         pVeSubPropChildrenTransformScaleAnchorZ         = new (std::nothrow) String(VeSubPropChildrenTransformScaleAnchorZ);
281
282         pVeSubPropChildrenTransformRotationXY           = new (std::nothrow) String(VeSubPropChildrenTransformRotationXY);
283         pVeSubPropChildrenTransformScaleXY                      = new (std::nothrow) String(VeSubPropChildrenTransformScaleXY);
284         pVeSubPropChildrenTransformTranslationXY        = new (std::nothrow) String(VeSubPropChildrenTransformTranslationXY);
285         pVeSubPropChildrenTransformRotationAnchorXY     = new (std::nothrow) String(VeSubPropChildrenTransformRotationAnchorXY);
286         pVeSubPropChildrenTransformScaleAnchorXY        = new (std::nothrow) String(VeSubPropChildrenTransformScaleAnchorXY);
287
288         pVePrivPropShowOpacity                                          = new (std::nothrow) String(VePrivPropShowOpacity);
289
290
291         _VisualElementCoordinateSystem::Initialize();
292 }
293
294
295
296
297 _VisualElementEnvironment::~_VisualElementEnvironment(void)
298 {
299         delete pVePropBounds;
300         delete pVePropContentBounds;
301         delete pVePropContentOpacity;
302         delete pVePropRenderOperation;
303         delete pVePropOpacity;
304         delete pVePropShowState;
305         delete pVePropAnchor;
306         delete pVePropAnchorZ;
307         delete pVePropTransform;
308         delete pVePropChildrenTransform;
309         delete pVePropZPosition;
310         delete pVePropZOrderGroup;
311         delete pVePropClipToParent;
312         delete pVePropClipChildren;
313         delete pVePropSurfaceOpaque;
314         delete pVePropName;
315         delete pVePropPropertyPropagationEnabled;
316         delete pVePropImplicitAnimationEnabled;
317
318 #if defined(SUPPORT_CUSTOMIZING_ATTACH_DETACH_ANIMATION)
319         delete pVePropActionDetach;
320         delete pVePropActionAttach;
321 #endif
322
323         delete pVeSubPropBounds;
324         delete pVeSubPropBoundsPosition;
325         delete pVeSubPropBoundsSize;
326
327         delete pVeSubPropTransform;
328         delete pVeSubPropTransformRotationX;
329         delete pVeSubPropTransformRotationY;
330         delete pVeSubPropTransformRotationZ;
331         delete pVeSubPropTransformScaleX;
332         delete pVeSubPropTransformScaleY;
333         delete pVeSubPropTransformScaleZ;
334         delete pVeSubPropTransformTranslationX;
335         delete pVeSubPropTransformTranslationY;
336         delete pVeSubPropTransformTranslationZ;
337         delete pVeSubPropTransformRotationAnchorX;
338         delete pVeSubPropTransformRotationAnchorY;
339         delete pVeSubPropTransformRotationAnchorZ;
340         delete pVeSubPropTransformScaleAnchorX;
341         delete pVeSubPropTransformScaleAnchorY;
342         delete pVeSubPropTransformScaleAnchorZ;
343
344         delete pVeSubPropTransformRotationXY;
345         delete pVeSubPropTransformScaleXY;
346         delete pVeSubPropTransformTranslationXY;
347         delete pVeSubPropTransformRotationAnchorXY;
348         delete pVeSubPropTransformScaleAnchorXY;
349
350         delete pVeSubPropChildrenTransform;
351         delete pVeSubPropChildrenTransformRotationX;
352         delete pVeSubPropChildrenTransformRotationY;
353         delete pVeSubPropChildrenTransformRotationZ;
354         delete pVeSubPropChildrenTransformScaleX;
355         delete pVeSubPropChildrenTransformScaleY;
356         delete pVeSubPropChildrenTransformScaleZ;
357         delete pVeSubPropChildrenTransformTranslationX;
358         delete pVeSubPropChildrenTransformTranslationY;
359         delete pVeSubPropChildrenTransformTranslationZ;
360         delete pVeSubPropChildrenTransformRotationAnchorX;
361         delete pVeSubPropChildrenTransformRotationAnchorY;
362         delete pVeSubPropChildrenTransformRotationAnchorZ;
363         delete pVeSubPropChildrenTransformScaleAnchorX;
364         delete pVeSubPropChildrenTransformScaleAnchorY;
365         delete pVeSubPropChildrenTransformScaleAnchorZ;
366
367         delete pVeSubPropChildrenTransformRotationXY;
368         delete pVeSubPropChildrenTransformScaleXY;
369         delete pVeSubPropChildrenTransformTranslationXY;
370         delete pVeSubPropChildrenTransformRotationAnchorXY;
371         delete pVeSubPropChildrenTransformScaleAnchorXY;
372
373         delete pVePrivPropShowOpacity;
374 }
375
376 }}} //namespace Tizen { namespace Ui { namespace Animations