(Properties) Added ability to add non-animatable event-thread only properties via...
[platform/core/uifw/dali-core.git] / dali / public-api / object / type-info.h
1 #ifndef __DALI_TYPE_INFO_H__
2 #define __DALI_TYPE_INFO_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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  * @addtogroup CAPI_DALI_FRAMEWORK
22  * @{
23  */
24
25 // INTERNAL INCLUDES
26 #include <dali/public-api/object/base-handle.h>
27
28 namespace Dali DALI_IMPORT_API
29 {
30
31 class ConnectionTrackerInterface;
32 class FunctorDelegate;
33
34 namespace Internal DALI_INTERNAL
35 {
36   class TypeInfo;
37 };
38
39 /**
40  * TypeInfo class for instantiation of registered types and introspection of
41  * their actions and signals.
42  * See TypeRegistry for methods of type registration and TypeInfo retrieval.
43  */
44 class TypeInfo : public BaseHandle
45 {
46 public:
47   typedef BaseHandle (*CreateFunction)();
48   typedef bool (*ActionFunction)(BaseObject*, const std::string&, const std::vector<Property::Value>&);
49
50   /**
51    * Connects a callback function with the object's signals.
52    * @param[in] object The object providing the signal.
53    * @param[in] tracker Used to disconnect the signal.
54    * @param[in] signalName The signal to connect to.
55    * @param[in] functor A newly allocated FunctorDelegate.
56    * @return True if the signal was connected.
57    * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
58    */
59   typedef bool (*SignalConnectorFunctionV2)(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
60
61   /**
62    * Callback to set an event-thread only property @see PropertyRegistration
63    * @param[in] object The object whose property should be set.
64    * @param[in] index The index of the property being set.
65    * @param[in] value The new value of the property for the object specified.
66    */
67   typedef void (*SetPropertyFunction)( BaseObject* object, Property::Index index, const Property::Value& value );
68
69   /**
70    * Callback to get the value of an event-thread only property @see PropertyRegistration
71    * @param[in] object The object whose property value is required.
72    * @param[in] index The index of the property required.
73    * @return The current value of the property for the object specified.
74    */
75   typedef Property::Value (*GetPropertyFunction)( BaseObject* object, Property::Index index );
76
77   typedef std::vector<std::string> NameContainer;
78
79   /**
80    * Allows the creation of an empty TypeInfo handle.
81    */
82   TypeInfo();
83
84   /**
85    * destructor.
86    */
87   virtual ~TypeInfo();
88
89   /**
90    * @copydoc Dali::BaseHandle::operator=
91    */
92   using BaseHandle::operator=;
93
94   /**
95    * Retrieve the type name for this type
96    * @return string name
97    */
98   const std::string& GetName();
99
100   /**
101    * Retrieve the base type name for this type
102    * @return string of base name
103    */
104   const std::string& GetBaseName();
105
106   /**
107    * Create an object from this type
108    * @return the BaseHandle for the newly created object
109    */
110   BaseHandle CreateInstance();
111
112   /**
113    * Retrieve the creator function for this type
114    * @return the creator function
115    */
116   CreateFunction GetCreator();
117
118   /**
119    * Retrieve the actions for this type
120    * @return Container of action names
121    */
122   NameContainer GetActions();
123
124   /**
125    * Retrieve the signals for this type
126    * @return Container of signal names
127    */
128   NameContainer GetSignals();
129
130   // Properties
131
132   /**
133    * Retrieve all the property indices for this type
134    * @param[out] indices Container of property indices
135    * @note The container will be cleared
136    */
137   void GetPropertyIndices( Property::IndexContainer& indices ) const;
138
139   /**
140    * Given a property index, retrieve the property name associated with it.
141    * @param[in] index The property index.
142    * @return The name of the property at the given index.
143    */
144   const std::string& GetPropertyName( Property::Index index ) const;
145
146 public: // Not intended for application developers
147   /**
148    * This constructor is used by Dali Get() method
149    * @param [in] typeInfo A pointer to a Dali resource
150    */
151   explicit DALI_INTERNAL TypeInfo(Internal::TypeInfo* typeInfo);
152
153 };
154
155 } // namespace Dali
156
157 /**
158  * @}
159  */
160 #endif // __DALI_TYPE_INFO_H__