Implement OnConnect and other missing functionality.
[platform/core/uifw/dali-core.git] / dali / internal / event / common / property-buffer-impl.h
1 #ifndef DALI_INTERNAL_PROPERTY_BUFFER_H
2 #define DALI_INTERNAL_PROPERTY_BUFFER_H
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
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
21 // INTERNAL INCLUDES
22 #include <dali/public-api/common/dali-common.h> // DALI_ASSERT_ALWAYS
23 #include <dali/public-api/common/intrusive-ptr.h> // Dali::IntrusivePtr
24 #include <dali/public-api/object/property-buffer.h> // Dali::PropertyBuffer
25 #include <dali/internal/event/common/connectable.h> // Dali::Internal::Connectable
26 #include <dali/internal/event/common/object-connector.h> // Dali::Internal::ObjectConnector
27 #include <dali/internal/event/common/object-impl.h> // Dali::Internal::Object
28
29 namespace Dali
30 {
31 namespace Internal
32 {
33 namespace SceneGraph
34 {
35 class PropertyBuffer;
36 }
37
38 class PropertyBuffer;
39 typedef IntrusivePtr<PropertyBuffer> PropertyBufferPtr;
40
41 /**
42  * PropertyBuffer is an object that contains an array of structures of values that
43  * can be accessed as properties.
44  */
45 class PropertyBuffer : public Object, public Connectable
46 {
47 public:
48
49   /**
50    * @copydoc PropertBuffer::New()
51    */
52   static PropertyBufferPtr New();
53
54   /**
55    * @copydoc PropertBuffer::SetSize()
56    */
57   void SetSize( std::size_t size );
58
59   /**
60    * @copydoc PropertBuffer::GetSize()
61    */
62   std::size_t GetSize() const;
63
64   /**
65    * @copydoc PropertBuffer::SetData()
66    */
67   void SetData( void* data );
68
69   /**
70    * @copydoc PropertBuffer::GetPropertyIndex()
71    */
72   Dali::Property::Index GetPropertyIndex( const std::string name, std::size_t index );
73
74 public: // Default property extensions from Object
75
76   /**
77    * @copydoc Dali::Internal::Object::GetDefaultPropertyCount()
78    */
79   virtual unsigned int GetDefaultPropertyCount() const;
80
81   /**
82    * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices()
83    */
84   virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
85
86   /**
87    * @copydoc Dali::Internal::Object::GetDefaultPropertyName()
88    */
89   virtual const char* GetDefaultPropertyName(Property::Index index) const;
90
91   /**
92    * @copydoc Dali::Internal::Object::GetDefaultPropertyIndex()
93    */
94   virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
95
96   /**
97    * @copydoc Dali::Internal::Object::IsDefaultPropertyWritable()
98    */
99   virtual bool IsDefaultPropertyWritable(Property::Index index) const;
100
101   /**
102    * @copydoc Dali::Internal::Object::IsDefaultPropertyAnimatable()
103    */
104   virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
105
106   /**
107    * @copydoc Dali::Internal::Object::IsDefaultPropertyAConstraintInput()
108    */
109   virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
110
111   /**
112    * @copydoc Dali::Internal::Object::GetDefaultPropertyType()
113    */
114   virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
115
116   /**
117    * @copydoc Dali::Internal::Object::SetDefaultProperty()
118    */
119   virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
120
121   /**
122    * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
123    */
124   virtual void SetSceneGraphProperty( Property::Index index, const CustomProperty& entry, const Property::Value& value );
125
126   /**
127    * @copydoc Dali::Internal::Object::GetDefaultProperty()
128    */
129   virtual Property::Value GetDefaultProperty( Property::Index index ) const;
130
131   /**
132    * @copydoc Dali::Internal::Object::GetPropertyOwner()
133    */
134   virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
135
136   /**
137    * @copydoc Dali::Internal::Object::GetSceneObject()
138    */
139   virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
140
141   /**
142    * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
143    */
144   virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
145
146   /**
147    * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
148    */
149   virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
150
151   /**
152    * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
153    */
154   virtual int GetPropertyComponentIndex( Property::Index index ) const;
155
156 public: // Functions from Connectable
157   /**
158    * @copydoc Dali::Internal::Connectable::OnStage()
159    */
160   virtual bool OnStage() const;
161
162   /**
163    * @copydoc Dali::Internal::Connectable::Connect()
164    */
165   virtual void Connect();
166
167   /**
168    * @copydoc Dali::Internal::Connectable::Disconnect()
169    */
170   virtual void Disconnect();
171
172 private: // implementation
173   PropertyBuffer();
174
175 private: // unimplemented methods
176   PropertyBuffer( const PropertyBuffer& );
177   PropertyBuffer& operator=( const PropertyBuffer& );
178
179 private: // data
180   SceneGraph::PropertyBuffer* mSceneObject;
181   bool mOnStage;
182 };
183
184 } // namespace Internal
185
186 // Helpers for public-api forwarding methods
187 inline Internal::PropertyBuffer& GetImplementation(Dali::PropertyBuffer& handle)
188 {
189   DALI_ASSERT_ALWAYS(handle && "PropertyBuffer handle is empty");
190
191   BaseObject& object = handle.GetBaseObject();
192
193   return static_cast<Internal::PropertyBuffer&>(object);
194 }
195
196 inline const Internal::PropertyBuffer& GetImplementation(const Dali::PropertyBuffer& handle)
197 {
198   DALI_ASSERT_ALWAYS(handle && "PropertyBuffer handle is empty");
199
200   const BaseObject& object = handle.GetBaseObject();
201
202   return static_cast<const Internal::PropertyBuffer&>(object);
203 }
204
205 } // namespace Dali
206
207 #endif // DALI_INTERNAL_PROPERTY_BUFFER_H