1 #ifndef __DALI_INTERNAL_OBJECT_H__
2 #define __DALI_INTERNAL_OBJECT_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/object/base-object.h>
23 #include <dali/public-api/object/handle.h>
24 #include <dali/public-api/object/property.h>
29 class PropertyNotification;
35 class PropertyCondition;
38 * A base class for objects which optionally provide properties.
39 * The concrete derived class is responsible for implementing the property system methods.
40 * Classes may derive from Dali::BaseObject, until any properties are required.
42 class Object : public Dali::BaseObject
46 typedef Dali::Handle::Capability Capability;
49 * @copydoc Dali::Handle::Supports()
51 virtual bool Supports(Capability capability) const = 0;
54 * @copydoc Dali::Handle::GetPropertyCount()
56 virtual unsigned int GetPropertyCount() const = 0;
59 * @copydoc Dali::Handle::GetPropertyName()
61 virtual const std::string& GetPropertyName(Property::Index index) const = 0;
64 * @copydoc Dali::Handle::GetPropertyIndex()
66 virtual Property::Index GetPropertyIndex(const std::string& name) const = 0;
69 * @copydoc Dali::Handle::IsPropertyWritable()
71 virtual bool IsPropertyWritable(Property::Index index) const = 0;
74 * @copydoc Dali::Handle::IsPropertyAnimatable()
76 virtual bool IsPropertyAnimatable(Property::Index index) const = 0;
79 * @copydoc Dali::Handle::IsPropertyAConstraintInput()
81 virtual bool IsPropertyAConstraintInput(Property::Index index) const = 0;
84 * @copydoc Dali::Handle::GetPropertyType()
86 virtual Property::Type GetPropertyType(Property::Index index) const = 0;
89 * @copydoc Dali::Handle::SetProperty()
91 virtual void SetProperty(Property::Index index, const Property::Value& propertyValue) = 0;
94 * @copydoc Dali::Handle::GetProperty()
96 virtual Property::Value GetProperty(Property::Index index) const = 0;
99 * @copydoc Dali::Handle::GetPropertyIndices()
101 virtual void GetPropertyIndices( Property::IndexContainer& indices ) const = 0;
104 * @copydoc Dali::Handle::RegisterProperty()
106 virtual Property::Index RegisterProperty(std::string name, const Property::Value& propertyValue) = 0;
109 * @copydoc Dali::Handle::RegisterProperty(std::string name, Property::Value propertyValue, Property::AccessMode accessMode)
111 virtual Property::Index RegisterProperty(std::string name, const Property::Value& propertyValue, Property::AccessMode accessMode) = 0;
114 * @copydoc Dali::Handle::AddPropertyNotification()
116 virtual Dali::PropertyNotification AddPropertyNotification(Property::Index index,
118 const Dali::PropertyCondition& condition) = 0;
121 * @copydoc Dali::Handle::RemovePropertyNotification()
123 virtual void RemovePropertyNotification(Dali::PropertyNotification propertyNotification) = 0;
126 * @copydoc Dali::Handle::RemovePropertyNotifications()
128 virtual void RemovePropertyNotifications() = 0;
134 * Default constructor.
141 * A reference counted object may only be deleted by calling Unreference()
150 Object(const Object& rhs);
153 Object& operator=(const Object& rhs);
156 } // namespace Internal
158 // Helpers for public-api forwarding methods
160 inline Internal::Object& GetImplementation(Dali::Handle& object)
162 DALI_ASSERT_ALWAYS( object && "Object handle is empty" );
164 BaseObject& handle = object.GetBaseObject();
166 return static_cast<Internal::Object&>(handle);
169 inline const Internal::Object& GetImplementation(const Dali::Handle& object)
171 DALI_ASSERT_ALWAYS( object && "Object handle is empty" );
173 const BaseObject& handle = object.GetBaseObject();
175 return static_cast<const Internal::Object&>(handle);
180 #endif // __DALI_INTERNAL_OBJECT_H__