1 #ifndef __DALI_PROPERTY_H__
2 #define __DALI_PROPERTY_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.
26 #include <dali/public-api/common/vector-wrapper.h>
27 #include <dali/public-api/common/dali-common.h>
35 * @brief An object + property pair.
37 struct DALI_IMPORT_API Property
40 * @brief A valid property index is zero or greater.
44 static const int INVALID_INDEX; ///< -1 is not a valid property index
45 static const int INVALID_COMPONENT_INDEX; ///< -1 is not a valid property index
47 typedef std::vector< Index > IndexContainer; ///< A vector of property indices
50 * @brief A value-type representing a property value.
55 * @brief A Map of property values.
60 * @brief An Array of property values.
62 typedef std::vector<Value> Array;
65 * @brief The property types supported.
71 BOOLEAN, ///< A boolean type
72 FLOAT, ///< A float type
73 INTEGER, ///< An integer type
74 UNSIGNED_INTEGER,///< An unsigned integer type
75 VECTOR2, ///< a vector array of size=2 with float precision
76 VECTOR3, ///< a vector array of size=3 with float precision
77 VECTOR4, ///< a vector array of size=4 with float precision
78 MATRIX3, ///< a 3x3 matrix
79 MATRIX, ///< a 4x4 matrix
80 RECTANGLE, ///< an integer array of size=4
81 ROTATION, ///< either a quaternion or an axis angle rotation
82 STRING, ///< A string type
83 ARRAY, ///< an array of Property::Value
84 MAP, ///< a string key to Property:value mapping
85 TYPE_COUNT ///< The number of supported property types
89 * @brief The access mode for custom properties
93 READ_ONLY, ///< if the property is read-only
94 READ_WRITE, ///< If the property is read/writeable
95 ANIMATABLE, ///< If the property can be animated or constrained
96 ACCESS_MODE_COUNT ///< The number of access modes
101 * @brief Create a Property instance.
103 * @param [in] object A valid handle to the target object.
104 * @param [in] propertyIndex The index of a property.
106 Property( Handle& object, Property::Index propertyIndex );
110 * @brief Create a Property instance.
112 * @param [in] object A valid handle to the target object.
113 * @param [in] propertyIndex The index of a property.
114 * @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)
116 Property( Handle& object, Property::Index propertyIndex, int componentIndex );
119 * @brief Create a Property instance.
121 * @note This performs a property index query and is therefore slower than
122 * constructing a Property directly with the index.
123 * @param [in] object A valid handle to the target object.
124 * @param [in] propertyName The property name.
126 Property( Handle& object, const std::string& propertyName );
129 * @brief Create a Property instance.
131 * @note This performs a property index query and is therefore slower than
132 * constructing a Property directly with the index.
133 * @param [in] object A valid handle to the target object.
134 * @param [in] propertyName The property name.
135 * @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)
137 Property( Handle& object, const std::string& propertyName, int componentIndex );
140 * @brief Non-virtual destructor; Property is not intended as a base class.
144 Handle& object; ///< A valid handle to the target object.
146 Index propertyIndex; ///< The index of a property provided by object.
148 int componentIndex; ///< Index of a property sub component, for use with Vector2, Vector3 and Vector4, -1 if using main property
153 #endif // __DALI_PROPERTY_H__