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>
31 class PropertyNotification;
36 // LessThan ///////////////////////////////////////////////////////////////////
39 * LessThan condition class,
40 * Checks if a Property is "Less Than" the argument:
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.
55 * @return function pointer to the correct condition function, based on
56 * the type of value being examined.
58 static ConditionFunction GetFunction(Property::Type valueType);
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)
68 static bool EvalBoolean( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
76 static bool EvalFloat( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
84 static bool EvalVector2( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
92 static bool EvalVector3( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
100 static bool EvalVector4( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
108 static bool EvalDefault( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
112 // GreaterThan ////////////////////////////////////////////////////////////////
115 * GreaterThan condition class,
116 * Checks if a Property is "Greater Than" the argument:
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.
131 * @returns function pointer to the correct condition function, based on
132 * the type of value being examined.
134 static ConditionFunction GetFunction(Property::Type valueType);
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)
144 static bool EvalBoolean( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
152 static bool EvalFloat( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
160 static bool EvalVector2( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
168 static bool EvalVector3( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
176 static bool EvalVector4( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
184 static bool EvalDefault( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
188 // Inside /////////////////////////////////////////////////////////////////////
191 * Inside condition class,
192 * Checks if a Property is "Inside" the two arguments:
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.
207 * @return function pointer to the correct condition function, based on
208 * the type of value being examined.
210 static ConditionFunction GetFunction(Property::Type valueType);
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)
220 static bool EvalBoolean( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
228 static bool EvalFloat( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
236 static bool EvalVector2( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
244 static bool EvalVector3( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
252 static bool EvalVector4( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
260 static bool EvalDefault( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
264 // Outside ////////////////////////////////////////////////////////////////////
267 * Outside condition class,
268 * Checks if a Property is "Outside" the two arguments:
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.
283 * @return function pointer to the correct condition function, based on
284 * the type of value being examined.
286 static ConditionFunction GetFunction(Property::Type valueType);
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)
296 static bool EvalBoolean( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
304 static bool EvalFloat( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
312 static bool EvalVector2( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
320 static bool EvalVector3( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
328 static bool EvalVector4( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
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)
336 static bool EvalDefault( const Dali::PropertyInput& value, const PropertyNotification::RawArgumentContainer& arg );
340 } // namespace SceneGraph
342 } // namespace Internal
346 #endif // __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_FUNCTIONS_H__