Remove UNSIGNED_INTEGER property type as it does not fully work and causes headache
[platform/core/uifw/dali-core.git] / dali / public-api / object / property.h
1 #ifndef __DALI_PROPERTY_H__
2 #define __DALI_PROPERTY_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <string>
23 #include <utility>
24
25 // INTERNAL INCLUDES
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>
29
30 namespace Dali
31 {
32
33 class Handle;
34
35 /**
36  * @brief An object + property pair.
37  */
38 struct DALI_IMPORT_API Property
39 {
40   /**
41    * @brief A valid property index is zero or greater.
42    */
43   typedef int Index;
44
45   static const int INVALID_INDEX; ///< -1 is not a valid property index
46   static const int INVALID_COMPONENT_INDEX; ///< -1 is not a valid property index
47
48   typedef Dali::Vector< Index > IndexContainer; ///< A vector of property indices
49
50   /**
51    * @brief A value-type representing a property value.
52    */
53   class Value;
54
55   /**
56    * @brief A Map of property values.
57    */
58   class Map;
59
60   /**
61    * @brief An Array of property values.
62    */
63   class Array;
64
65   /**
66    * @brief The property types supported.
67    */
68   enum Type
69   {
70     NONE,            ///< No type
71
72     BOOLEAN,         ///< A boolean type
73     FLOAT,           ///< A float type
74     INTEGER,         ///< An 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   };
86
87   /**
88    * @brief The access mode for custom properties
89    */
90   enum AccessMode
91   {
92     READ_ONLY,          ///< if the property is read-only
93     READ_WRITE,         ///< If the property is read/writeable
94     ANIMATABLE,         ///< If the property can be animated or constrained
95     ACCESS_MODE_COUNT   ///< The number of access modes
96   };
97
98
99   /**
100    * @brief Create a Property instance.
101    *
102    * @param [in] object A valid handle to the target object.
103    * @param [in] propertyIndex The index of a property.
104    */
105   Property( Handle& object, Property::Index propertyIndex );
106
107
108   /**
109    * @brief Create a Property instance.
110    *
111    * @param [in] object A valid handle to the target object.
112    * @param [in] propertyIndex The index of a property.
113    * @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)
114    */
115   Property( Handle& object, Property::Index propertyIndex, int componentIndex );
116
117   /**
118    * @brief Create a Property instance.
119    *
120    * @note This performs a property index query and is therefore slower than
121    * constructing a Property directly with the index.
122    * @param [in] object A valid handle to the target object.
123    * @param [in] propertyName The property name.
124    */
125   Property( Handle& object, const std::string& propertyName );
126
127   /**
128    * @brief Create a Property instance.
129    *
130    * @note This performs a property index query and is therefore slower than
131    * constructing a Property directly with the index.
132    * @param [in] object A valid handle to the target object.
133    * @param [in] propertyName The property name.
134    * @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)
135    */
136   Property( Handle& object, const std::string& propertyName, int componentIndex );
137
138   /**
139    * @brief Non-virtual destructor; Property is not intended as a base class.
140    */
141   ~Property();
142
143   Handle& object; ///< A valid handle to the target object.
144
145   Index propertyIndex; ///< The index of a property provided by object.
146
147   int componentIndex; ///< Index of a property sub component, for use with Vector2, Vector3 and Vector4, -1 if using main property
148 };
149
150 } // namespace Dali
151
152 #endif // __DALI_PROPERTY_H__