1 #ifndef __DALI_INTERNAL_OBJECT_H__
2 #define __DALI_INTERNAL_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 #include <dali/public-api/object/base-object.h>
22 #include <dali/public-api/object/handle.h>
23 #include <dali/public-api/object/property.h>
28 class PropertyNotification;
34 class PropertyCondition;
37 * A base class for objects which optionally provide properties.
38 * The concrete derived class is responsible for implementing the property system methods.
39 * Classes may derive from Dali::BaseObject, until any properties are required.
41 class Object : public Dali::BaseObject
45 typedef Dali::Handle::Capability Capability;
48 * @copydoc Dali::Handle::Supports()
50 virtual bool Supports(Capability capability) const = 0;
53 * @copydoc Dali::Handle::GetPropertyCount()
55 virtual unsigned int GetPropertyCount() const = 0;
58 * @copydoc Dali::Handle::GetPropertyName()
60 virtual const std::string& GetPropertyName(Property::Index index) const = 0;
63 * @copydoc Dali::Handle::GetPropertyIndex()
65 virtual Property::Index GetPropertyIndex(const std::string& name) const = 0;
68 * @copydoc Dali::Handle::IsPropertyWritable()
70 virtual bool IsPropertyWritable(Property::Index index) const = 0;
73 * @copydoc Dali::Handle::IsPropertyAnimatable()
75 virtual bool IsPropertyAnimatable(Property::Index index) const = 0;
78 * @copydoc Dali::Handle::GetPropertyType()
80 virtual Property::Type GetPropertyType(Property::Index index) const = 0;
83 * @copydoc Dali::Handle::SetProperty()
85 virtual void SetProperty(Property::Index index, const Property::Value& propertyValue) = 0;
88 * @copydoc Dali::Handle::GetProperty()
90 virtual Property::Value GetProperty(Property::Index index) const = 0;
93 * @copydoc Dali::Handle::RegisterProperty()
95 virtual Property::Index RegisterProperty(std::string name, const Property::Value& propertyValue) = 0;
98 * @copydoc Dali::Handle::RegisterProperty(std::string name, Property::Value propertyValue, Property::AccessMode accessMode)
100 virtual Property::Index RegisterProperty(std::string name, const Property::Value& propertyValue, Property::AccessMode accessMode) = 0;
103 * @copydoc Dali::Handle::AddPropertyNotification()
105 virtual Dali::PropertyNotification AddPropertyNotification(Property::Index index,
107 const Dali::PropertyCondition& condition) = 0;
110 * @copydoc Dali::Handle::RemovePropertyNotification()
112 virtual void RemovePropertyNotification(Dali::PropertyNotification propertyNotification) = 0;
115 * @copydoc Dali::Handle::RemovePropertyNotifications()
117 virtual void RemovePropertyNotifications() = 0;
123 * Default constructor.
130 * A reference counted object may only be deleted by calling Unreference()
139 Object(const Object& rhs);
142 Object& operator=(const Object& rhs);
145 } // namespace Internal
147 // Helpers for public-api forwarding methods
149 inline Internal::Object& GetImplementation(Dali::Handle& object)
151 DALI_ASSERT_ALWAYS( object && "Object handle is empty" );
153 BaseObject& handle = object.GetBaseObject();
155 return static_cast<Internal::Object&>(handle);
158 inline const Internal::Object& GetImplementation(const Dali::Handle& object)
160 DALI_ASSERT_ALWAYS( object && "Object handle is empty" );
162 const BaseObject& handle = object.GetBaseObject();
164 return static_cast<const Internal::Object&>(handle);
169 #endif // __DALI_INTERNAL_OBJECT_H__