1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_GESTURE_PROPERTIES_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_GESTURE_PROPERTIES_H__
5 * Copyright (c) 2014 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 virtual ~GestureProperty()
70 * @copydoc Dali::Internal::SceneGraph::PropertyBase::GetType()
72 virtual Dali::Property::Type GetType() const
74 return Dali::PropertyTypes::Get< T >();
78 * @copydoc Dali::Internal::SceneGraph::PropertyBase::IsClean()
80 virtual bool IsClean() const
82 return !InputChanged();
86 * @copydoc Dali::Internal::PropertyInputImpl::InputInitialized()
88 virtual bool InputInitialized() const
90 // A constraint cannot use the property until it has been inherited (at least once).
95 * @copydoc Dali::Internal::PropertyInputImpl::InputChanged()
96 * @note A constraint can only receive the inherited property from the previous frame.
98 virtual bool InputChanged() const
100 return mInputChanged;
104 * @brief Resets mInputChanged back to false
108 mInputChanged = false;
112 * Set the property value.
113 * @param[in] value The new property value.
115 void Set(const T& value)
118 mInputChanged = true;
122 * Get the property value.
123 * @return The property value.
133 GestureProperty(const GestureProperty& property);
136 GestureProperty& operator=(const GestureProperty& rhs);
140 T mValue; ///< The property value
141 bool mInputChanged:1; ///< Whether the property has been modified
145 * A read only Vector2 property used by Gestures.
147 class GesturePropertyVector2 : public GestureProperty< Vector2 >
152 * Virtual destructor.
154 virtual ~GesturePropertyVector2()
159 * @copydoc Dali::PropertyInput::GetVector2()
161 virtual const Vector2& GetVector2( BufferIndex bufferIndex ) const
168 * A read only bool property used by Gestures.
170 class GesturePropertyBool : public GestureProperty< bool >
175 * Virtual destructor.
177 virtual ~GesturePropertyBool()
182 * @copydoc Dali::PropertyInput::GetBoolean()
184 virtual const bool& GetBoolean( BufferIndex bufferIndex ) const
190 } // namespace SceneGraph
192 } // namespace Internal
196 #endif // __DALI_INTERNAL_SCENE_GRAPH_GESTURE_PROPERTIES_H__