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