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