[SRUK] Initial copy from Tizen 2.2 version
[platform/core/uifw/dali-core.git] / dali / internal / update / common / property-condition-functions.h
1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_FUNCTIONS_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_FUNCTIONS_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //     http://floralicense.org/license/
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19
20 // INTERNAL INCLUDES
21 #include <dali/public-api/object/property-value.h>
22 #include <dali/internal/update/common/scene-graph-property-notification.h>
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29
30 class ProxyObject;
31 class PropertyNotification;
32
33 namespace SceneGraph
34 {
35
36 // LessThan ///////////////////////////////////////////////////////////////////
37
38 /**
39  * LessThan condition class,
40  * Checks if a Property is "Less Than" the argument:
41  *
42  * bool       => false (0.0) or true (1.0) is less than arg0.
43  * float      => value is less than arg0.
44  * Vector2    => 2 dimensional length of vector is less than arg0.
45  * Vector3    => 3 dimensional length of vector is less than arg0.
46  * Vector4    => 4 dimensional length of vector is less than arg0.
47  * Default    => return false.
48  */
49 class LessThan
50 {
51
52 public:
53
54   /**
55    * @return function pointer to the correct condition function, based on
56    * the type of value being examined.
57    */
58   static ConditionFunction GetFunction(Property::Type valueType);
59
60 private:
61
62   /**
63    * Checks if bool is LessThan
64    * @param[in] value The value being examined.
65    * @param[in] arg The supplied arguments for the condition.
66    * @return Condition result (true if condition met, false if not)
67    */
68   static bool EvalBoolean( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
69
70   /**
71    * Checks if float is LessThan
72    * @param[in] value The value being examined.
73    * @param[in] arg The supplied arguments for the condition.
74    * @return Condition result (true if condition met, false if not)
75    */
76   static bool EvalFloat( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
77
78   /**
79    * Checks if Vector2.Length() is LessThan
80    * @param[in] value The value being examined.
81    * @param[in] arg The supplied arguments for the condition.
82    * @return Condition result (true if condition met, false if not)
83    */
84   static bool EvalVector2( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
85
86   /**
87    * Checks if Vector3.Length() is LessThan
88    * @param[in] value The value being examined.
89    * @param[in] arg The supplied arguments for the condition.
90    * @return Condition result (true if condition met, false if not)
91    */
92   static bool EvalVector3( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
93
94   /**
95    * Checks if Vector4.Length() is LessThan
96    * @param[in] value The value being examined.
97    * @param[in] arg The supplied arguments for the condition.
98    * @return Condition result (true if condition met, false if not)
99    */
100   static bool EvalVector4( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
101
102   /**
103    * Default check for other types
104    * @param[in] value The value being examined.
105    * @param[in] arg The supplied arguments for the condition.
106    * @return Condition result (true if condition met, false if not)
107    */
108   static bool EvalDefault( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
109
110 };
111
112 // GreaterThan ////////////////////////////////////////////////////////////////
113
114 /**
115  * GreaterThan condition class,
116  * Checks if a Property is "Greater Than" the argument:
117  *
118  * bool       => false (0.0) or true (1.0) is greater than arg0.
119  * float      => value is grVector2eater than arg0.
120  * Vector2    => 2 dimensional length of vector is greater than arg0.
121  * Vector3    => 3 dimensional length of vector is greater than arg0.
122  * Vector4    => 4 dimensional length of vector is greater than arg0.
123  * Default    => return false.
124  */
125 class GreaterThan
126 {
127
128 public:
129
130   /**
131    * @returns function pointer to the correct condition function, based on
132    * the type of value being examined.
133    */
134   static ConditionFunction GetFunction(Property::Type valueType);
135
136 private:
137
138   /**
139    * Checks if bool is GreaterThan
140    * @param[in] value The value being examined.
141    * @param[in] arg The supplied arguments for the condition.
142    * @return Condition result (true if condition met, false if not)
143    */
144   static bool EvalBoolean( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
145
146   /**
147    * Checks if float is GreaterThan
148    * @param[in] value The value being examined.
149    * @param[in] arg The supplied arguments for the condition.
150    * @return Condition result (true if condition met, false if not)
151    */
152   static bool EvalFloat( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
153
154   /**
155    * Checks if Vector2.Length() is GreaterThan
156    * @param[in] value The value being examined.
157    * @param[in] arg The supplied arguments for the condition.
158    * @return Condition result (true if condition met, false if not)
159    */
160   static bool EvalVector2( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
161
162   /**
163    * Checks if Vector3.Length() is GreaterThan
164    * @param[in] value The value being examined.
165    * @param[in] arg The supplied arguments for the condition.
166    * @return Condition result (true if condition met, false if not)
167    */
168   static bool EvalVector3( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
169
170   /**
171    * Checks if Vector4.Length() is GreaterThan
172    * @param[in] value The value being examined.
173    * @param[in] arg The supplied arguments for the condition.
174    * @return Condition result (true if condition met, false if not)
175    */
176   static bool EvalVector4( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
177
178   /**
179    * Default check for other types.
180    * @param[in] value The value being examined.
181    * @param[in] arg The supplied arguments for the condition.
182    * @return Condition result (true if condition met, false if not)
183    */
184   static bool EvalDefault( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
185
186 };
187
188 // Inside /////////////////////////////////////////////////////////////////////
189
190 /**
191  * Inside condition class,
192  * Checks if a Property is "Inside" the two arguments:
193  *
194  * bool       => false (0.0) or true (1.0) is inside arg0.
195  * float      => value is inside arg0.
196  * Vector2    => 2 dimensional length of vector is inside arg0.
197  * Vector3    => 3 dimensional length of vector is inside arg0.
198  * Vector4    => 4 dimensional length of vector is inside arg0.
199  * Default    => return false.
200  */
201 class Inside
202 {
203
204 public:
205
206   /**
207    * @return function pointer to the correct condition function, based on
208    * the type of value being examined.
209    */
210   static ConditionFunction GetFunction(Property::Type valueType);
211
212 private:
213
214   /**
215    * Checks if bool is Inside
216    * @param[in] value The value being examined.
217    * @param[in] arg The supplied arguments for the condition.
218    * @return Condition result (true if condition met, false if not)
219    */
220   static bool EvalBoolean( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
221
222   /**
223    * Checks if float is Inside
224    * @param[in] value The value being examined.
225    * @param[in] arg The supplied arguments for the condition.
226    * @return Condition result (true if condition met, false if not)
227    */
228   static bool EvalFloat( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
229
230   /**
231    * Checks if Vector2.Length() is Inside
232    * @param[in] value The value being examined.
233    * @param[in] arg The supplied arguments for the condition.
234    * @return Condition result (true if condition met, false if not)
235    */
236   static bool EvalVector2( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
237
238   /**
239    * Checks if Vector3.Length() is Inside
240    * @param[in] value The value being examined.
241    * @param[in] arg The supplied arguments for the condition.
242    * @return Condition result (true if condition met, false if not)
243    */
244   static bool EvalVector3( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
245
246   /**
247    * Checks if Vector4.Length() is Inside
248    * @param[in] value The value being examined.
249    * @param[in] arg The supplied arguments for the condition.
250    * @return Condition result (true if condition met, false if not)
251    */
252   static bool EvalVector4( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
253
254   /**
255    * Default check for other types.
256    * @param[in] value The value being examined.
257    * @param[in] arg The supplied arguments for the condition.
258    * @return Condition result (true if condition met, false if not)
259    */
260   static bool EvalDefault( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
261
262 };
263
264 // Outside ////////////////////////////////////////////////////////////////////
265
266 /**
267  * Outside condition class,
268  * Checks if a Property is "Outside" the two arguments:
269  *
270  * bool       => false (0.0) or true (1.0) is outside arg0.
271  * float      => value is inside arg0.
272  * Vector2    => 2 dimensional length of vector is outside arg0.
273  * Vector3    => 3 dimensional length of vector is outside arg0.
274  * Vector4    => 4 dimensional length of vector is outside arg0.
275  * Default    => return false.
276  */
277 class Outside
278 {
279
280 public:
281
282   /**
283    * @return function pointer to the correct condition function, based on
284    * the type of value being examined.
285    */
286   static ConditionFunction GetFunction(Property::Type valueType);
287
288 private:
289
290   /**
291    * Checks if bool is Outside
292    * @param[in] value The value being examined.
293    * @param[in] arg The supplied arguments for the condition.
294    * @return Condition result (true if condition met, false if not)
295    */
296   static bool EvalBoolean( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
297
298   /**
299    * Checks if float is Outside
300    * @param[in] value The value being examined.
301    * @param[in] arg The supplied arguments for the condition.
302    * @return Condition result (true if condition met, false if not)
303    */
304   static bool EvalFloat( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
305
306   /**
307    * Checks if Vector2.Length() is Outside
308    * @param[in] value The value being examined.
309    * @param[in] arg The supplied arguments for the condition.
310    * @return Condition result (true if condition met, false if not)
311    */
312   static bool EvalVector2( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
313
314   /**
315    * Checks if Vector3.Length() is Outside
316    * @param[in] value The value being examined.
317    * @param[in] arg The supplied arguments for the condition.
318    * @return Condition result (true if condition met, false if not)
319    */
320   static bool EvalVector3( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
321
322   /**
323    * Checks if Vector4.Length() is Outside
324    * @param[in] value The value being examined.
325    * @param[in] arg The supplied arguments for the condition.
326    * @return Condition result (true if condition met, false if not)
327    */
328   static bool EvalVector4( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
329
330   /**
331    * Default check for other types.
332    * @param[in] value The value being examined.
333    * @param[in] arg The supplied arguments for the condition.
334    * @return Condition result (true if condition met, false if not)
335    */
336   static bool EvalDefault( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
337
338 };
339
340 } // namespace SceneGraph
341
342 } // namespace Internal
343
344 } // namespace Dali
345
346 #endif // __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_FUNCTIONS_H__