[dali_1.0.42] Merge branch 'tizen'
[platform/core/uifw/dali-core.git] / dali / public-api / object / property-conditions.h
1 #ifndef __DALI_PROPERTY_CONDITIONS_H__
2 #define __DALI_PROPERTY_CONDITIONS_H__
3
4 /*
5  * Copyright (c) 2015 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/common/dali-vector.h>
23 #include <dali/public-api/object/base-handle.h>
24 #include <dali/public-api/object/property.h>
25
26 namespace Dali
27 {
28
29 namespace Internal DALI_INTERNAL
30 {
31 class PropertyCondition;
32 }
33
34 /**
35  * @brief This represents a condition that can be evaluated on a Property::Value.
36  */
37 class DALI_IMPORT_API PropertyCondition : public BaseHandle
38 {
39 public:
40
41   /**
42    * @brief Constructor for condition clause.
43    */
44   PropertyCondition();
45
46   /**
47    * @brief Destructor.
48    */
49   ~PropertyCondition();
50
51   /**
52    * @brief This copy constructor is required for (smart) pointer semantics.
53    *
54    * @param [in] handle A reference to the copied handle
55    */
56   PropertyCondition( const PropertyCondition& handle );
57
58   /**
59    * @brief This assignment operator is required for (smart) pointer semantics.
60    *
61    * @param [in] rhs  A reference to the copied handle
62    * @return A reference to this
63    */
64   PropertyCondition& operator=( const PropertyCondition& rhs );
65
66 public:
67
68   /**
69    * @brief Retrieve the arguments that this condition uses.
70    *
71    * @return The arguments used for this condition
72    */
73   std::size_t GetArgumentCount() const;
74
75   /**
76    * @brief Retrieve the arguments that this condition uses.
77    *
78    * @return The arguments used for this condition
79    * @note The container will only be valid as long PropertyCondition is valid.
80    */
81   float GetArgument( std::size_t index ) const;
82
83 };
84
85 /**
86  * @brief LessThanCondition compares whether property is less than arg.
87  *
88  * property type:
89  * bool (false = 0.0f, true = 1.0f)
90  * float (float)
91  * vector2 (the 2D length)
92  * vector3 (the 3D length)
93  * vector4 (the 4D length)
94  * @param[in] arg The argument for the condition
95  * @return A property condition function object
96  */
97 DALI_IMPORT_API PropertyCondition LessThanCondition( float arg );
98
99 /**
100  * @brief GreaterThanCondition compares whether property is greater than arg.
101  *
102  * property type:
103  * bool (false = 0.0f, true = 1.0f)
104  * float (float)
105  * vector2 (the 2D length)
106  * vector3 (the 3D length)
107  * vector4 (the 4D length)
108  * @param[in] arg The argument for the condition
109  * @return A property condition function object
110  */
111 DALI_IMPORT_API PropertyCondition GreaterThanCondition( float arg );
112
113 /**
114  * @brief InsideCondition compares whether property is greater than arg0 and less than arg1.
115  *
116  * property type:
117  * bool (false = 0.0f, true = 1.0f)
118  * float (float)
119  * vector2 (the 2D length)
120  * vector3 (the 3D length)
121  * vector4 (the 4D length)
122  * @param[in] arg0 The first argument for the condition
123  * @param[in] arg1 The second argument for the condition
124  * @return A property condition function object
125  */
126 DALI_IMPORT_API PropertyCondition InsideCondition( float arg0, float arg1 );
127
128 /**
129  * @brief OutsideCondition compares whether property is less than arg0 or greater than arg1.
130  *
131  * property type:
132  * bool (false = 0.0f, true = 1.0f)
133  * float (float)
134  * vector2 (the 2D length)
135  * vector3 (the 3D length)
136  * vector4 (the 4D length)
137  * @param[in] arg0 The first argument for the condition
138  * @param[in] arg1 The second argument for the condition
139  * @return A property condition function object
140  */
141 DALI_IMPORT_API PropertyCondition OutsideCondition( float arg0, float arg1 );
142
143 /**
144  * @brief Detects when a property changes by stepAmount from initialValue, in both positive and negative directions. This will continue checking for multiples of stepAmount
145  *
146  * property type:
147  * float (float)
148  * vector2 (the 2D length)
149  * vector3 (the 3D length)
150  * vector4 (the 4D length)
151  * @param[in] stepAmount The step size required to trigger condition
152  * @param[in] initialValue The initial value to step from
153  * @return A property condition function object
154  */
155 DALI_IMPORT_API PropertyCondition StepCondition( float stepAmount, float initialValue = 0.0f );
156
157 /**
158  * @brief Receive notifications as a property goes above/below the inputted values. Values must be ordered and can be either ascending or descending
159  *
160  * property type:
161  * float (float)
162  * vector2 (the 2D length)
163  * vector3 (the 3D length)
164  * vector4 (the 4D length)
165  * @param[in] steps List of values to receive notifications for as a property crosses them
166  * @return A property condition function object
167  */
168 DALI_IMPORT_API PropertyCondition VariableStepCondition( const Dali::Vector<float>& steps );
169
170 } // namespace Dali
171
172 #endif // __DALI_PROPERTY_CONDITIONS_H__