(PropertyNotifications) Added incremental step notification
[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 // OTHER CONDITITION INCLUDES
25 #include <dali/internal/update/common/property-condition-step-functions.h>
26 #include <dali/internal/update/common/property-condition-variable-step-functions.h>
27
28 namespace Dali
29 {
30
31 namespace Internal
32 {
33
34 class ProxyObject;
35 class PropertyNotification;
36
37 namespace SceneGraph
38 {
39
40 // LessThan ///////////////////////////////////////////////////////////////////
41
42 /**
43  * LessThan condition class,
44  * Checks if a Property is "Less Than" the argument:
45  *
46  * bool       => false (0.0) or true (1.0) is less than arg0.
47  * float      => value is less than arg0.
48  * Vector2    => 2 dimensional length of vector is less than arg0.
49  * Vector3    => 3 dimensional length of vector is less than arg0.
50  * Vector4    => 4 dimensional length of vector is less than arg0.
51  * Default    => return false.
52  */
53 class LessThan
54 {
55
56 public:
57
58   /**
59    * @return function pointer to the correct condition function, based on
60    * the type of value being examined.
61    */
62   static ConditionFunction GetFunction(Property::Type valueType);
63
64 private:
65
66   /**
67    * Checks if bool is LessThan
68    * @param[in] value The value being examined.
69    * @param[in] arg The supplied arguments for the condition.
70    * @return Condition result (true if condition met, false if not)
71    */
72   static bool EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
73
74   /**
75    * Checks if float is LessThan
76    * @param[in] value The value being examined.
77    * @param[in] arg The supplied arguments for the condition.
78    * @return Condition result (true if condition met, false if not)
79    */
80   static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
81
82   /**
83    * Checks if Vector2.Length() is LessThan
84    * @param[in] value The value being examined.
85    * @param[in] arg The supplied arguments for the condition.
86    * @return Condition result (true if condition met, false if not)
87    */
88   static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
89
90   /**
91    * Checks if Vector3.Length() is LessThan
92    * @param[in] value The value being examined.
93    * @param[in] arg The supplied arguments for the condition.
94    * @return Condition result (true if condition met, false if not)
95    */
96   static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
97
98   /**
99    * Checks if Vector4.Length() is LessThan
100    * @param[in] value The value being examined.
101    * @param[in] arg The supplied arguments for the condition.
102    * @return Condition result (true if condition met, false if not)
103    */
104   static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
105
106   /**
107    * Default check for other types
108    * @param[in] value The value being examined.
109    * @param[in] arg The supplied arguments for the condition.
110    * @return Condition result (true if condition met, false if not)
111    */
112   static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
113
114 };
115
116 // GreaterThan ////////////////////////////////////////////////////////////////
117
118 /**
119  * GreaterThan condition class,
120  * Checks if a Property is "Greater Than" the argument:
121  *
122  * bool       => false (0.0) or true (1.0) is greater than arg0.
123  * float      => value is greater than arg0.
124  * Vector2    => 2 dimensional length of vector is greater than arg0.
125  * Vector3    => 3 dimensional length of vector is greater than arg0.
126  * Vector4    => 4 dimensional length of vector is greater than arg0.
127  * Default    => return false.
128  */
129 class GreaterThan
130 {
131
132 public:
133
134   /**
135    * @returns function pointer to the correct condition function, based on
136    * the type of value being examined.
137    */
138   static ConditionFunction GetFunction(Property::Type valueType);
139
140 private:
141
142   /**
143    * Checks if bool is GreaterThan
144    * @param[in] value The value being examined.
145    * @param[in] arg The supplied arguments for the condition.
146    * @return Condition result (true if condition met, false if not)
147    */
148   static bool EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
149
150   /**
151    * Checks if float is GreaterThan
152    * @param[in] value The value being examined.
153    * @param[in] arg The supplied arguments for the condition.
154    * @return Condition result (true if condition met, false if not)
155    */
156   static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
157
158   /**
159    * Checks if Vector2.Length() is GreaterThan
160    * @param[in] value The value being examined.
161    * @param[in] arg The supplied arguments for the condition.
162    * @return Condition result (true if condition met, false if not)
163    */
164   static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
165
166   /**
167    * Checks if Vector3.Length() is GreaterThan
168    * @param[in] value The value being examined.
169    * @param[in] arg The supplied arguments for the condition.
170    * @return Condition result (true if condition met, false if not)
171    */
172   static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
173
174   /**
175    * Checks if Vector4.Length() is GreaterThan
176    * @param[in] value The value being examined.
177    * @param[in] arg The supplied arguments for the condition.
178    * @return Condition result (true if condition met, false if not)
179    */
180   static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
181
182   /**
183    * Default check for other types.
184    * @param[in] value The value being examined.
185    * @param[in] arg The supplied arguments for the condition.
186    * @return Condition result (true if condition met, false if not)
187    */
188   static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
189
190 };
191
192 // Inside /////////////////////////////////////////////////////////////////////
193
194 /**
195  * Inside condition class,
196  * Checks if a Property is "Inside" the two arguments:
197  *
198  * bool       => false (0.0) or true (1.0) is inside arg0.
199  * float      => value is between arg0 and arg1.
200  * Vector2    => 2 dimensional length of vector is between arg0 and arg1.
201  * Vector3    => 3 dimensional length of vector is between arg0 and arg1.
202  * Vector4    => 4 dimensional length of vector is between arg0 and arg1.
203  * Default    => return false.
204  */
205 class Inside
206 {
207
208 public:
209
210   /**
211    * @return function pointer to the correct condition function, based on
212    * the type of value being examined.
213    */
214   static ConditionFunction GetFunction(Property::Type valueType);
215
216 private:
217
218   /**
219    * Checks if bool is Inside
220    * @param[in] value The value being examined.
221    * @param[in] arg The supplied arguments for the condition.
222    * @return Condition result (true if condition met, false if not)
223    */
224   static bool EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
225
226   /**
227    * Checks if float is Inside
228    * @param[in] value The value being examined.
229    * @param[in] arg The supplied arguments for the condition.
230    * @return Condition result (true if condition met, false if not)
231    */
232   static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
233
234   /**
235    * Checks if Vector2.Length() is Inside
236    * @param[in] value The value being examined.
237    * @param[in] arg The supplied arguments for the condition.
238    * @return Condition result (true if condition met, false if not)
239    */
240   static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
241
242   /**
243    * Checks if Vector3.Length() is Inside
244    * @param[in] value The value being examined.
245    * @param[in] arg The supplied arguments for the condition.
246    * @return Condition result (true if condition met, false if not)
247    */
248   static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
249
250   /**
251    * Checks if Vector4.Length() is Inside
252    * @param[in] value The value being examined.
253    * @param[in] arg The supplied arguments for the condition.
254    * @return Condition result (true if condition met, false if not)
255    */
256   static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
257
258   /**
259    * Default check for other types.
260    * @param[in] value The value being examined.
261    * @param[in] arg The supplied arguments for the condition.
262    * @return Condition result (true if condition met, false if not)
263    */
264   static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
265
266 };
267
268 // Outside ////////////////////////////////////////////////////////////////////
269
270 /**
271  * Outside condition class,
272  * Checks if a Property is "Outside" the two arguments:
273  *
274  * bool       => false (0.0) or true (1.0) is outside arg0.
275  * float      => value is outside arg0 and arg1.
276  * Vector2    => 2 dimensional length of vector is outside arg0 and arg1.
277  * Vector3    => 3 dimensional length of vector is outside arg0 and arg1.
278  * Vector4    => 4 dimensional length of vector is outside arg0 and arg1.
279  * Default    => return false.
280  */
281 class Outside
282 {
283
284 public:
285
286   /**
287    * @return function pointer to the correct condition function, based on
288    * the type of value being examined.
289    */
290   static ConditionFunction GetFunction(Property::Type valueType);
291
292 private:
293
294   /**
295    * Checks if bool is Outside
296    * @param[in] value The value being examined.
297    * @param[in] arg The supplied arguments for the condition.
298    * @return Condition result (true if condition met, false if not)
299    */
300   static bool EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
301
302   /**
303    * Checks if float is Outside
304    * @param[in] value The value being examined.
305    * @param[in] arg The supplied arguments for the condition.
306    * @return Condition result (true if condition met, false if not)
307    */
308   static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
309
310   /**
311    * Checks if Vector2.Length() is Outside
312    * @param[in] value The value being examined.
313    * @param[in] arg The supplied arguments for the condition.
314    * @return Condition result (true if condition met, false if not)
315    */
316   static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
317
318   /**
319    * Checks if Vector3.Length() is Outside
320    * @param[in] value The value being examined.
321    * @param[in] arg The supplied arguments for the condition.
322    * @return Condition result (true if condition met, false if not)
323    */
324   static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
325
326   /**
327    * Checks if Vector4.Length() is Outside
328    * @param[in] value The value being examined.
329    * @param[in] arg The supplied arguments for the condition.
330    * @return Condition result (true if condition met, false if not)
331    */
332   static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
333
334   /**
335    * Default check for other types.
336    * @param[in] value The value being examined.
337    * @param[in] arg The supplied arguments for the condition.
338    * @return Condition result (true if condition met, false if not)
339    */
340   static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
341
342 };
343
344 } // namespace SceneGraph
345
346 } // namespace Internal
347
348 } // namespace Dali
349
350 #endif // __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_FUNCTIONS_H__