1 #ifndef DALI_INTERNAL_SCENE_GRAPH_GESTURE_PROPERTIES_H
2 #define DALI_INTERNAL_SCENE_GRAPH_GESTURE_PROPERTIES_H
5 * Copyright (c) 2019 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/object/property-types.h>
23 #include <dali/internal/common/buffer-index.h>
24 #include <dali/internal/event/common/property-input-impl.h>
36 * A template for a read only properties used by Gestures.
39 class GestureProperty : public PropertyInputImpl
44 * Create a read-only gesture property.
45 * @param [in] initialValue The initial value of the property.
47 GestureProperty( const T& initialValue )
48 : mValue( initialValue ),
49 mInputChanged( false )
54 * Create a read-only gesture property.
58 mInputChanged( false )
65 ~GestureProperty() override = default;
68 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
70 Dali::Property::Type GetType() const override
72 return Dali::PropertyTypes::Get< T >();
76 * @copydoc Dali::Internal::SceneGraph::PropertyBase::IsClean()
78 virtual bool IsClean() const
80 return !InputChanged();
84 * @copydoc Dali::Internal::PropertyInputImpl::InputInitialized()
86 bool InputInitialized() const override
88 // A constraint cannot use the property until it has been inherited (at least once).
93 * @copydoc Dali::Internal::PropertyInputImpl::InputChanged()
94 * @note A constraint can only receive the inherited property from the previous frame.
96 bool InputChanged() const override
102 * @brief Resets mInputChanged back to false
106 mInputChanged = false;
110 * Set the property value.
111 * @param[in] value The new property value.
113 void Set(const T& value)
116 mInputChanged = true;
120 * Get the property value.
121 * @return The property value.
131 GestureProperty(const GestureProperty& property);
134 GestureProperty& operator=(const GestureProperty& rhs);
138 T mValue; ///< The property value
139 bool mInputChanged:1; ///< Whether the property has been modified
143 * A read only Vector2 property used by Gestures.
145 class GesturePropertyVector2 : public GestureProperty< Vector2 >
150 * Virtual destructor.
152 ~GesturePropertyVector2() override = default;
155 * @copydoc Dali::PropertyInput::GetVector2()
157 const Vector2& GetVector2( BufferIndex bufferIndex ) const override
164 * A read only bool property used by Gestures.
166 class GesturePropertyBool : public GestureProperty< bool >
171 * Virtual destructor.
173 ~GesturePropertyBool() override = default;
176 * @copydoc Dali::PropertyInput::GetBoolean()
178 const bool& GetBoolean( BufferIndex bufferIndex ) const override
184 } // namespace SceneGraph
186 } // namespace Internal
190 #endif // DALI_INTERNAL_SCENE_GRAPH_GESTURE_PROPERTIES_H