1 #ifndef DALI_PROPERTY_CONDITIONS_H
2 #define DALI_PROPERTY_CONDITIONS_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
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>
29 * @addtogroup dali_core_object
33 namespace Internal DALI_INTERNAL
35 class PropertyCondition;
39 * @brief This represents a condition that can be evaluated on a Property::Value.
42 class DALI_CORE_API PropertyCondition : public BaseHandle
46 * @brief Constructor for condition clause.
58 * @brief This copy constructor is required for (smart) pointer semantics.
61 * @param[in] handle A reference to the copied handle
63 PropertyCondition(const PropertyCondition& handle);
66 * @brief This assignment operator is required for (smart) pointer semantics.
69 * @param[in] rhs A reference to the copied handle
70 * @return A reference to this
72 PropertyCondition& operator=(const PropertyCondition& rhs);
75 * @brief Move constructor.
78 * @param[in] rhs A reference to the moved handle
80 PropertyCondition(PropertyCondition&& rhs) noexcept;
83 * @brief Move assignment operator.
86 * @param[in] rhs A reference to the moved handle
87 * @return A reference to this handle
89 PropertyCondition& operator=(PropertyCondition&& rhs) noexcept;
93 * @brief Retrieves the arguments that this condition uses.
96 * @return The arguments used for this condition
98 std::size_t GetArgumentCount() const;
101 * @brief Retrieves the arguments that this condition uses.
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.
108 float GetArgument(std::size_t index) const;
112 * @brief LessThanCondition compares whether property is less than arg.
115 * bool (false = 0.0f, true = 1.0f)
117 * vector2 (the 2D length)
118 * vector3 (the 3D length)
119 * vector4 (the 4D length)
121 * @param[in] arg The argument for the condition
122 * @return A property condition function object
124 DALI_CORE_API PropertyCondition LessThanCondition(float arg);
127 * @brief GreaterThanCondition compares whether property is greater than arg.
130 * bool (false = 0.0f, true = 1.0f)
132 * vector2 (the 2D length)
133 * vector3 (the 3D length)
134 * vector4 (the 4D length)
136 * @param[in] arg The argument for the condition
137 * @return A property condition function object
139 DALI_CORE_API PropertyCondition GreaterThanCondition(float arg);
142 * @brief InsideCondition compares whether property is greater than arg0 and less than arg1.
145 * bool (false = 0.0f, true = 1.0f)
147 * vector2 (the 2D length)
148 * vector3 (the 3D length)
149 * vector4 (the 4D length)
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
155 DALI_CORE_API PropertyCondition InsideCondition(float arg0, float arg1);
158 * @brief OutsideCondition compares whether property is less than arg0 or greater than arg1.
161 * bool (false = 0.0f, true = 1.0f)
163 * vector2 (the 2D length)
164 * vector3 (the 3D length)
165 * vector4 (the 4D length)
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
171 DALI_CORE_API PropertyCondition OutsideCondition(float arg0, float arg1);
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.
178 * vector2 (the 2D length)
179 * vector3 (the 3D length)
180 * vector4 (the 4D length)
181 * quaternion (the 3D length of eular angle)
183 * @param[in] stepAmount The step size required to trigger condition
184 * @param[in] initialValue The initial value to step from
185 * @return A property condition function object
187 DALI_CORE_API PropertyCondition StepCondition(float stepAmount, float initialValue = 0.0f);
190 * @brief Receives notifications as a property goes above/below the inputted values. Values must be ordered and can be either ascending or descending.
194 * vector2 (the 2D length)
195 * vector3 (the 3D length)
196 * vector4 (the 4D length)
198 * @param[in] steps List of values to receive notifications for as a property crosses them
199 * @return A property condition function object
201 DALI_CORE_API PropertyCondition VariableStepCondition(const Dali::Vector<float>& steps);
208 #endif // DALI_PROPERTY_CONDITIONS_H