1 #ifndef __DALI_BASE_OBJECT_H__
2 #define __DALI_BASE_OBJECT_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/ref-object.h>
27 #include <dali/public-api/object/base-handle.h>
28 #include <dali/public-api/object/property.h>
29 #include <dali/public-api/signals/functor-delegate.h>
31 namespace Dali DALI_IMPORT_API
37 * A base class for objects.
39 class BaseObject : public Dali::RefObject
44 * Connects a void() functor to a specified signal.
45 * @pre The signal must be available in this object.
46 * @param [in] connectionTracker A connection tracker which can be used to disconnect.
47 * @param [in] signalName Name of the signal to connect to.
48 * @param [in] functor The functor to copy.
49 * @return True if the signal was available.
52 bool ConnectSignal( ConnectionTrackerInterface* connectionTracker, const std::string& signalName, const T& functor )
54 return DoConnectSignal( connectionTracker, signalName, FunctorDelegate::New( functor ) );
58 * @copydoc Dali::BaseHandle::DoAction
60 bool DoAction(const std::string& actionName, const std::vector<Property::Value>& attributes);
63 * @copydoc Dali::BaseHandle::GetTypeName
65 const std::string& GetTypeName() const;
67 public: // Not intended for application developers
70 * @copydoc Dali::BaseHandle::DoConnectSignal
72 bool DoConnectSignal( ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functorDelegate );
77 * Default constructor.
82 * A reference counted object may only be deleted by calling Unreference()
84 virtual ~BaseObject();
87 * Registers the object as created with the Object registry
89 void RegisterObject();
92 * Unregisters the object from Object registry.
94 void UnregisterObject();
99 DALI_INTERNAL BaseObject(const BaseObject& rhs);
102 DALI_INTERNAL BaseObject& operator=(const BaseObject& rhs);
105 // Helpers for public-api forwarding methods
107 inline BaseObject& GetImplementation(Dali::BaseHandle& object)
109 DALI_ASSERT_ALWAYS( object && "BaseObject handle is empty" );
111 return object.GetBaseObject();
114 inline const BaseObject& GetImplementation(const Dali::BaseHandle& object)
116 DALI_ASSERT_ALWAYS( object && "BaseObject handle is empty" );
118 return object.GetBaseObject();
126 #endif // __DALI_BASE_OBJECT_H__