1 #ifndef DALI_INTERNAL_SCENE_GRAPH_GESTURE_PROPERTIES_H
2 #define DALI_INTERNAL_SCENE_GRAPH_GESTURE_PROPERTIES_H
5 * Copyright (c) 2023 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/internal/common/buffer-index.h>
23 #include <dali/internal/event/common/property-input-impl.h>
24 #include <dali/public-api/object/property-types.h>
33 * A template for a read only properties used by Gestures.
36 class GestureProperty : public PropertyInputImpl
40 * Create a read-only gesture property.
41 * @param [in] initialValue The initial value of the property.
43 GestureProperty(const T& initialValue)
44 : mValue(initialValue),
50 * Create a read-only gesture property.
61 ~GestureProperty() override = default;
64 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
66 Dali::Property::Type GetType() const override
68 return Dali::PropertyTypes::Get<T>();
72 * @copydoc Dali::Internal::SceneGraph::PropertyBase::IsClean()
74 virtual bool IsClean() const
76 return !InputChanged();
80 * @copydoc Dali::Internal::PropertyInputImpl::InputInitialized()
82 bool InputInitialized() const override
84 // A constraint cannot use the property until it has been inherited (at least once).
89 * @copydoc Dali::Internal::PropertyInputImpl::InputChanged()
90 * @note A constraint can only receive the inherited property from the previous frame.
92 bool InputChanged() const override
98 * @brief Resets mInputChanged back to false
102 mInputChanged = false;
106 * Set the property value.
107 * @param[in] value The new property value.
109 void Set(const T& value)
112 mInputChanged = true;
116 * Get the property value.
117 * @return The property value.
126 GestureProperty(const GestureProperty& property);
129 GestureProperty& operator=(const GestureProperty& rhs);
132 T mValue; ///< The property value
133 bool mInputChanged : 1; ///< Whether the property has been modified
137 * A read only Vector2 property used by Gestures.
139 class GesturePropertyVector2 : public GestureProperty<Vector2>
143 * Virtual destructor.
145 ~GesturePropertyVector2() override = default;
148 * @copydoc Dali::PropertyInput::GetVector2()
150 const Vector2& GetVector2(BufferIndex bufferIndex) const override
156 * @copydoc Dali::Internal::PropertyInputImpl::GetValueAddress()
158 const void* GetValueAddress(BufferIndex bufferIndex) const override
164 * @copydoc Dali::Internal::PropertyInputImpl::GetValueSize()
166 size_t GetValueSize() const override
168 return sizeof(Vector2);
173 * A read only bool property used by Gestures.
175 class GesturePropertyBool : public GestureProperty<bool>
179 * Virtual destructor.
181 ~GesturePropertyBool() override = default;
184 * @copydoc Dali::PropertyInput::GetBoolean()
186 const bool& GetBoolean(BufferIndex bufferIndex) const override
192 * @copydoc Dali::Internal::PropertyInputImpl::GetValueAddress()
194 const void* GetValueAddress(BufferIndex bufferIndex) const override
200 * @copydoc Dali::Internal::PropertyInputImpl::GetValueSize()
202 size_t GetValueSize() const override
208 } // namespace SceneGraph
210 } // namespace Internal
214 #endif // DALI_INTERNAL_SCENE_GRAPH_GESTURE_PROPERTIES_H