Add BuildPickingRay to devel api
[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) 2020 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  * @SINCE_1_0.0
41  */
42 class DALI_CORE_API PropertyCondition : public BaseHandle
43 {
44 public:
45   /**
46    * @brief Constructor for condition clause.
47    * @SINCE_1_0.0
48    */
49   PropertyCondition();
50
51   /**
52    * @brief Destructor.
53    * @SINCE_1_0.0
54    */
55   ~PropertyCondition();
56
57   /**
58    * @brief This copy constructor is required for (smart) pointer semantics.
59    *
60    * @SINCE_1_0.0
61    * @param[in] handle A reference to the copied handle
62    */
63   PropertyCondition(const PropertyCondition& handle);
64
65   /**
66    * @brief This assignment operator is required for (smart) pointer semantics.
67    *
68    * @SINCE_1_0.0
69    * @param[in] rhs A reference to the copied handle
70    * @return A reference to this
71    */
72   PropertyCondition& operator=(const PropertyCondition& rhs);
73
74   /**
75    * @brief Move constructor.
76    *
77    * @SINCE_1_9.22
78    * @param[in] rhs A reference to the moved handle
79    */
80   PropertyCondition(PropertyCondition&& rhs);
81
82   /**
83    * @brief Move assignment operator.
84    *
85    * @SINCE_1_9.22
86    * @param[in] rhs A reference to the moved handle
87    * @return A reference to this handle
88    */
89   PropertyCondition& operator=(PropertyCondition&& rhs);
90
91 public:
92   /**
93    * @brief Retrieves the arguments that this condition uses.
94    *
95    * @SINCE_1_0.0
96    * @return The arguments used for this condition
97    */
98   std::size_t GetArgumentCount() const;
99
100   /**
101    * @brief Retrieves the arguments that this condition uses.
102    *
103    * @SINCE_1_0.0
104    * @param[in] index The condition index to get the argument
105    * @return The arguments used for this condition
106    * @note The container will only be valid as long PropertyCondition is valid.
107    */
108   float GetArgument(std::size_t index) const;
109 };
110
111 /**
112  * @brief LessThanCondition compares whether property is less than arg.
113  *
114  * property type:
115  * bool (false = 0.0f, true = 1.0f)
116  * float (float)
117  * vector2 (the 2D length)
118  * vector3 (the 3D length)
119  * vector4 (the 4D length)
120  * @SINCE_1_0.0
121  * @param[in] arg The argument for the condition
122  * @return A property condition function object
123  */
124 DALI_CORE_API PropertyCondition LessThanCondition(float arg);
125
126 /**
127  * @brief GreaterThanCondition compares whether property is greater than arg.
128  *
129  * property type:
130  * bool (false = 0.0f, true = 1.0f)
131  * float (float)
132  * vector2 (the 2D length)
133  * vector3 (the 3D length)
134  * vector4 (the 4D length)
135  * @SINCE_1_0.0
136  * @param[in] arg The argument for the condition
137  * @return A property condition function object
138  */
139 DALI_CORE_API PropertyCondition GreaterThanCondition(float arg);
140
141 /**
142  * @brief InsideCondition compares whether property is greater than arg0 and less than arg1.
143  *
144  * property type:
145  * bool (false = 0.0f, true = 1.0f)
146  * float (float)
147  * vector2 (the 2D length)
148  * vector3 (the 3D length)
149  * vector4 (the 4D length)
150  * @SINCE_1_0.0
151  * @param[in] arg0 The first argument for the condition
152  * @param[in] arg1 The second argument for the condition
153  * @return A property condition function object
154  */
155 DALI_CORE_API PropertyCondition InsideCondition(float arg0, float arg1);
156
157 /**
158  * @brief OutsideCondition compares whether property is less than arg0 or greater than arg1.
159  *
160  * property type:
161  * bool (false = 0.0f, true = 1.0f)
162  * float (float)
163  * vector2 (the 2D length)
164  * vector3 (the 3D length)
165  * vector4 (the 4D length)
166  * @SINCE_1_0.0
167  * @param[in] arg0 The first argument for the condition
168  * @param[in] arg1 The second argument for the condition
169  * @return A property condition function object
170  */
171 DALI_CORE_API PropertyCondition OutsideCondition(float arg0, float arg1);
172
173 /**
174  * @brief Detects when a property changes by stepAmount from initialValue, in both positive and negative directions. This will continue checking for multiples of stepAmount.
175  *
176  * property type:
177  * float (float)
178  * vector2 (the 2D length)
179  * vector3 (the 3D length)
180  * vector4 (the 4D length)
181  * @SINCE_1_0.0
182  * @param[in] stepAmount The step size required to trigger condition
183  * @param[in] initialValue The initial value to step from
184  * @return A property condition function object
185  */
186 DALI_CORE_API PropertyCondition StepCondition(float stepAmount, float initialValue = 0.0f);
187
188 /**
189  * @brief Receives notifications as a property goes above/below the inputted values. Values must be ordered and can be either ascending or descending.
190  *
191  * property type:
192  * float (float)
193  * vector2 (the 2D length)
194  * vector3 (the 3D length)
195  * vector4 (the 4D length)
196  * @SINCE_1_0.0
197  * @param[in] steps List of values to receive notifications for as a property crosses them
198  * @return A property condition function object
199  */
200 DALI_CORE_API PropertyCondition VariableStepCondition(const Dali::Vector<float>& steps);
201
202 /**
203  * @}
204  */
205 } // namespace Dali
206
207 #endif // DALI_PROPERTY_CONDITIONS_H