Merge remote-tracking branch 'origin/tizen' into new_text
[platform/core/uifw/dali-core.git] / dali / internal / update / common / property-condition-step-functions.h
1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_STEP_FUNCTIONS_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_STEP_FUNCTIONS_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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
21 // INTERNAL INCLUDES
22 #include <dali/public-api/object/property-value.h>
23 #include <dali/internal/update/common/scene-graph-property-notification.h>
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30
31 class Object;
32 class PropertyNotification;
33
34 namespace SceneGraph
35 {
36
37 /**
38  * Step condition class,
39  * Checks if a Property has stepped a certain amount from the reference point
40  *
41  * float      => value has stepped arg1 amount from arg0.
42  * Vector2    => 2 dimensional length of vector has stepped arg1 amount from arg0.
43  * Vector3    => 3 dimensional length of vector has stepped arg1 amount from arg0.
44  * Vector4    => 4 dimensional length of vector has stepped arg1 amount from arg0.
45  * Default    => return false.
46  */
47 class Step
48 {
49
50 public:
51
52   /**
53    * @return function pointer to the correct condition function, based on
54    * the type of value being examined.
55    */
56   static ConditionFunction GetFunction( Property::Type valueType );
57
58 private:
59
60   static bool Evaluate( const float propertyValue, PropertyNotification::RawArgumentContainer& arg );
61
62   /**
63    * Checks if float is Outside
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 EvalFloat( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
69
70   /**
71    * Checks if integer is Outside
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 EvalInteger( const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg );
77
78   /**
79    * Checks if Vector2.Length() is Outside
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, PropertyNotification::RawArgumentContainer& arg );
85
86   /**
87    * Checks if Vector3.Length() is Outside
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, PropertyNotification::RawArgumentContainer& arg );
93
94   /**
95    * Checks if Vector4.Length() is Outside
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, 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, PropertyNotification::RawArgumentContainer& arg );
109
110 };
111
112 } // namespace SceneGraph
113
114 } // namespace Internal
115
116 } // namespace Dali
117
118 #endif // __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_CONDITION_STEP_FUNCTIONS_H__