(PropertyNotification) Added conditions to allow checking of a specific vector components
[platform/core/uifw/dali-core.git] / dali / internal / event / common / object-impl.h
1 #ifndef __DALI_INTERNAL_OBJECT_H__
2 #define __DALI_INTERNAL_OBJECT_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
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
10 //
11 //     http://floralicense.org/license/
12 //
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.
18 //
19
20 // INTERNAL INCLUDES
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>
24
25 namespace Dali
26 {
27
28 class PropertyNotification;
29
30 namespace Internal
31 {
32 class Handle;
33
34 class PropertyCondition;
35
36 /**
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.
40  */
41 class Object : public Dali::BaseObject
42 {
43 public:
44
45   typedef Dali::Handle::Capability Capability;
46
47   /**
48    * @copydoc Dali::Handle::Supports()
49    */
50   virtual bool Supports(Capability capability) const = 0;
51
52   /**
53    * @copydoc Dali::Handle::GetPropertyCount()
54    */
55   virtual unsigned int GetPropertyCount() const = 0;
56
57   /**
58    * @copydoc Dali::Handle::GetPropertyName()
59    */
60   virtual const std::string& GetPropertyName(Property::Index index) const = 0;
61
62   /**
63    * @copydoc Dali::Handle::GetPropertyIndex()
64    */
65   virtual Property::Index GetPropertyIndex(const std::string& name) const = 0;
66
67   /**
68    * @copydoc Dali::Handle::IsPropertyWritable()
69    */
70   virtual bool IsPropertyWritable(Property::Index index) const = 0;
71
72   /**
73    * @copydoc Dali::Handle::IsPropertyAnimatable()
74    */
75   virtual bool IsPropertyAnimatable(Property::Index index) const = 0;
76
77   /**
78    * @copydoc Dali::Handle::GetPropertyType()
79    */
80   virtual Property::Type GetPropertyType(Property::Index index) const = 0;
81
82   /**
83    * @copydoc Dali::Handle::SetProperty()
84    */
85   virtual void SetProperty(Property::Index index, const Property::Value& propertyValue) = 0;
86
87   /**
88    * @copydoc Dali::Handle::GetProperty()
89    */
90   virtual Property::Value GetProperty(Property::Index index) const = 0;
91
92   /**
93    * @copydoc Dali::Handle::RegisterProperty()
94    */
95   virtual Property::Index RegisterProperty(std::string name, const Property::Value& propertyValue) = 0;
96
97   /**
98    * @copydoc Dali::Handle::RegisterProperty(std::string name, Property::Value propertyValue, Property::AccessMode accessMode)
99    */
100   virtual Property::Index RegisterProperty(std::string name, const Property::Value& propertyValue, Property::AccessMode accessMode) = 0;
101
102   /**
103    * @copydoc Dali::Handle::AddPropertyNotification()
104    */
105   virtual Dali::PropertyNotification AddPropertyNotification(Property::Index index,
106                                                              int componentIndex,
107                                                              const Dali::PropertyCondition& condition) = 0;
108
109   /**
110    * @copydoc Dali::Handle::RemovePropertyNotification()
111    */
112   virtual void RemovePropertyNotification(Dali::PropertyNotification propertyNotification) = 0;
113
114   /**
115    * @copydoc Dali::Handle::RemovePropertyNotifications()
116    */
117   virtual void RemovePropertyNotifications() = 0;
118
119
120 protected:
121
122   /**
123    * Default constructor.
124    */
125   Object()
126   {
127   }
128
129   /**
130    * A reference counted object may only be deleted by calling Unreference()
131    */
132   virtual ~Object()
133   {
134   }
135
136 private:
137
138   // Not implemented
139   Object(const Object& rhs);
140
141   // Not implemented
142   Object& operator=(const Object& rhs);
143 };
144
145 } // namespace Internal
146
147 // Helpers for public-api forwarding methods
148
149 inline Internal::Object& GetImplementation(Dali::Handle& object)
150 {
151   DALI_ASSERT_ALWAYS( object && "Object handle is empty" );
152
153   BaseObject& handle = object.GetBaseObject();
154
155   return static_cast<Internal::Object&>(handle);
156 }
157
158 inline const Internal::Object& GetImplementation(const Dali::Handle& object)
159 {
160   DALI_ASSERT_ALWAYS( object && "Object handle is empty" );
161
162   const BaseObject& handle = object.GetBaseObject();
163
164   return static_cast<const Internal::Object&>(handle);
165 }
166
167 } // namespace Dali
168
169 #endif // __DALI_INTERNAL_OBJECT_H__
170