1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_FUNCTIONS_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_FUNCTIONS_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 // http://floralicense.org/license/
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.
21 #include <dali/public-api/object/property-value.h>
22 #include <dali/internal/update/common/scene-graph-property-notification.h>
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>
35 class PropertyNotification;
40 // LessThan ///////////////////////////////////////////////////////////////////
43 * LessThan condition class,
44 * Checks if a Property is "Less Than" the argument:
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.
59 * @return function pointer to the correct condition function, based on
60 * the type of value being examined.
62 static ConditionFunction GetFunction(Property::Type valueType);
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)
72 static bool EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
80 static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
88 static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
96 static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
104 static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
112 static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
116 // GreaterThan ////////////////////////////////////////////////////////////////
119 * GreaterThan condition class,
120 * Checks if a Property is "Greater Than" the argument:
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.
135 * @returns function pointer to the correct condition function, based on
136 * the type of value being examined.
138 static ConditionFunction GetFunction(Property::Type valueType);
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)
148 static bool EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
156 static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
164 static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
172 static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
180 static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
188 static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
192 // Inside /////////////////////////////////////////////////////////////////////
195 * Inside condition class,
196 * Checks if a Property is "Inside" the two arguments:
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.
211 * @return function pointer to the correct condition function, based on
212 * the type of value being examined.
214 static ConditionFunction GetFunction(Property::Type valueType);
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)
224 static bool EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
232 static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
240 static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
248 static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
256 static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
264 static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
268 // Outside ////////////////////////////////////////////////////////////////////
271 * Outside condition class,
272 * Checks if a Property is "Outside" the two arguments:
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.
287 * @return function pointer to the correct condition function, based on
288 * the type of value being examined.
290 static ConditionFunction GetFunction(Property::Type valueType);
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)
300 static bool EvalBoolean( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
308 static bool EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
316 static bool EvalVector2( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
324 static bool EvalVector3( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
332 static bool EvalVector4( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
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)
340 static bool EvalDefault( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
344 } // namespace SceneGraph
346 } // namespace Internal
350 #endif // __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_FUNCTIONS_H__