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 #include <dali/public-api/object/base-handle.h>
23 namespace Dali DALI_IMPORT_API
26 class ConnectionTrackerInterface;
27 class FunctorDelegate;
29 namespace Internal DALI_INTERNAL
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.
39 class TypeInfo : public BaseHandle
42 typedef BaseHandle (*CreateFunction)();
43 typedef bool (*ActionFunction)(BaseObject*, const std::string&, const std::vector<Property::Value>&);
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.
54 typedef bool (*SignalConnectorFunctionV2)(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
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.
62 typedef void (*SetPropertyFunction)( BaseObject* object, Property::Index index, const Property::Value& value );
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.
70 typedef Property::Value (*GetPropertyFunction)( BaseObject* object, Property::Index index );
72 typedef std::vector<std::string> NameContainer;
75 * Allows the creation of an empty TypeInfo handle.
85 * @copydoc Dali::BaseHandle::operator=
87 using BaseHandle::operator=;
90 * Retrieve the type name for this type
93 const std::string& GetName();
96 * Retrieve the base type name for this type
97 * @return string of base name
99 const std::string& GetBaseName();
102 * Create an object from this type
103 * @return the BaseHandle for the newly created object
105 BaseHandle CreateInstance();
108 * Retrieve the creator function for this type
109 * @return the creator function
111 CreateFunction GetCreator();
114 * Retrieve the actions for this type
115 * @return Container of action names
117 NameContainer GetActions();
120 * Retrieve the signals for this type
121 * @return Container of signal names
123 NameContainer GetSignals();
128 * Retrieve all the property indices for this type
129 * @param[out] indices Container of property indices
130 * @note The container will be cleared
132 void GetPropertyIndices( Property::IndexContainer& indices ) const;
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.
139 const std::string& GetPropertyName( Property::Index index ) const;
141 public: // Not intended for application developers
144 * This constructor is used by Dali Get() method
145 * @param [in] typeInfo A pointer to a Dali resource
147 explicit DALI_INTERNAL TypeInfo(Internal::TypeInfo* typeInfo);
153 #endif // __DALI_TYPE_INFO_H__