1 #ifndef __DALI_PROPERTY_H__
2 #define __DALI_PROPERTY_H__
5 * Copyright (c) 2015 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.
26 #include <dali/public-api/common/vector-wrapper.h>
27 #include <dali/public-api/common/dali-common.h>
28 #include <dali/public-api/common/dali-vector.h>
33 * @addtogroup dali_core_object
40 * @brief An object + property pair.
42 struct DALI_IMPORT_API Property
45 * @brief A valid property index is zero or greater.
49 static const int INVALID_INDEX; ///< -1 is not a valid property index
50 static const int INVALID_COMPONENT_INDEX; ///< -1 is not a valid property index
52 typedef Dali::Vector< Index > IndexContainer; ///< A vector of property indices
55 * @brief A value-type representing a property value.
60 * @brief A Map of property values.
65 * @brief An Array of property values.
70 * @brief The property types supported.
76 BOOLEAN, ///< A boolean type
77 FLOAT, ///< A float type
78 INTEGER, ///< An integer type
79 VECTOR2, ///< a vector array of size=2 with float precision
80 VECTOR3, ///< a vector array of size=3 with float precision
81 VECTOR4, ///< a vector array of size=4 with float precision
82 MATRIX3, ///< a 3x3 matrix
83 MATRIX, ///< a 4x4 matrix
84 RECTANGLE, ///< an integer array of size=4
85 ROTATION, ///< either a quaternion or an axis angle rotation
86 STRING, ///< A string type
87 ARRAY, ///< an array of Property::Value
88 MAP ///< a string key to Property:value mapping
92 * @brief The access mode for custom properties
96 READ_ONLY, ///< if the property is read-only
97 READ_WRITE, ///< If the property is read/writeable
98 ANIMATABLE, ///< If the property can be animated or constrained
99 ACCESS_MODE_COUNT ///< The number of access modes
104 * @brief Create a Property instance.
106 * @param [in] object A valid handle to the target object.
107 * @param [in] propertyIndex The index of a property.
109 Property( Handle& object, Property::Index propertyIndex );
113 * @brief Create a Property instance.
115 * @param [in] object A valid handle to the target object.
116 * @param [in] propertyIndex The index of a property.
117 * @param [in] componentIndex Index to a sub component of a property, for use with Vector2, Vector3 and Vector4. -1 for main property (default is -1)
119 Property( Handle& object, Property::Index propertyIndex, int componentIndex );
122 * @brief Create a Property instance.
124 * @note This performs a property index query and is therefore slower than
125 * constructing a Property directly with the index.
126 * @param [in] object A valid handle to the target object.
127 * @param [in] propertyName The property name.
129 Property( Handle& object, const std::string& propertyName );
132 * @brief Create a Property instance.
134 * @note This performs a property index query and is therefore slower than
135 * constructing a Property directly with the index.
136 * @param [in] object A valid handle to the target object.
137 * @param [in] propertyName The property name.
138 * @param [in] componentIndex Index to a sub component of a property, for use with Vector2, Vector3 and Vector4. -1 for main property (default is -1)
140 Property( Handle& object, const std::string& propertyName, int componentIndex );
143 * @brief Non-virtual destructor; Property is not intended as a base class.
147 Handle& object; ///< A valid handle to the target object.
149 Index propertyIndex; ///< The index of a property provided by object.
151 int componentIndex; ///< Index of a property sub component, for use with Vector2, Vector3 and Vector4, -1 if using main property
159 #endif // __DALI_PROPERTY_H__