1 #ifndef __DALI_TYPE_INFO_H__
2 #define __DALI_TYPE_INFO_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 // http://floralicense.org/license/
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.
21 * @addtogroup CAPI_DALI_FRAMEWORK
26 #include <dali/public-api/object/base-handle.h>
28 namespace Dali DALI_IMPORT_API
31 class ConnectionTrackerInterface;
32 class FunctorDelegate;
34 namespace Internal DALI_INTERNAL
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.
44 class TypeInfo : public BaseHandle
47 typedef BaseHandle (*CreateFunction)();
48 typedef bool (*ActionFunction)(BaseObject*, const std::string&, const std::vector<Property::Value>&);
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.
59 typedef bool (*SignalConnectorFunctionV2)(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
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.
67 typedef void (*SetPropertyFunction)( BaseObject* object, Property::Index index, const Property::Value& value );
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.
75 typedef Property::Value (*GetPropertyFunction)( BaseObject* object, Property::Index index );
77 typedef std::vector<std::string> NameContainer;
80 * Allows the creation of an empty TypeInfo handle.
90 * @copydoc Dali::BaseHandle::operator=
92 using BaseHandle::operator=;
95 * Retrieve the type name for this type
98 const std::string& GetName();
101 * Retrieve the base type name for this type
102 * @return string of base name
104 const std::string& GetBaseName();
107 * Create an object from this type
108 * @return the BaseHandle for the newly created object
110 BaseHandle CreateInstance();
113 * Retrieve the creator function for this type
114 * @return the creator function
116 CreateFunction GetCreator();
119 * Retrieve the actions for this type
120 * @return Container of action names
122 NameContainer GetActions();
125 * Retrieve the signals for this type
126 * @return Container of signal names
128 NameContainer GetSignals();
133 * Retrieve all the property indices for this type
134 * @param[out] indices Container of property indices
135 * @note The container will be cleared
137 void GetPropertyIndices( Property::IndexContainer& indices ) const;
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.
144 const std::string& GetPropertyName( Property::Index index ) const;
146 public: // Not intended for application developers
148 * This constructor is used by Dali Get() method
149 * @param [in] typeInfo A pointer to a Dali resource
151 explicit DALI_INTERNAL TypeInfo(Internal::TypeInfo* typeInfo);
160 #endif // __DALI_TYPE_INFO_H__