Glue glue and more glue
[platform/core/uifw/dali-core.git] / dali / internal / event / common / property-buffer-impl.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/event/common/property-buffer-impl.h>  // Dali::Internal::PropertyBuffer
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/object/property-buffer.h>     // Dali::Internal::PropertyBuffer
23 #include <dali/internal/event/common/object-impl-helper.h> // Dali::Internal::ObjectHelper
24 #include <dali/internal/event/common/property-helper.h> // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END
25 #include <dali/internal/event/common/stage-impl.h>
26 #include <dali/internal/update/common/scene-graph-property-buffer.h>
27
28 namespace Dali
29 {
30 namespace Internal
31 {
32
33 namespace
34 {
35
36 /**
37  *            |name    |type             |writable|animatable|constraint-input|enum for index-checking|
38  */
39 DALI_PROPERTY_TABLE_BEGIN
40 DALI_PROPERTY( "size",          UNSIGNED_INTEGER, true, false,  true,   Dali::PropertyBuffer::Property::SIZE )
41 DALI_PROPERTY( "buffer-format", MAP,              false, false, false,  Dali::PropertyBuffer::Property::BUFFER_FORMAT )
42 DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX )
43
44 const ObjectImplHelper<DEFAULT_PROPERTY_COUNT> PROPERTY_BUFFER_IMPL = { DEFAULT_PROPERTY_DETAILS };
45
46 } // unnamed namespace
47
48 PropertyBufferPtr PropertyBuffer::New()
49 {
50   return PropertyBufferPtr( new PropertyBuffer() );
51 }
52
53 void PropertyBuffer::SetSize( std::size_t size )
54 {
55   //TODO: MESH_REWORK
56   DALI_ASSERT_ALWAYS( false && "MESH_REWORK" );
57 }
58
59 std::size_t PropertyBuffer::GetSize() const
60 {
61   //TODO: MESH_REWORK
62   DALI_ASSERT_ALWAYS( false && "MESH_REWORK" );
63
64   return 0;
65 }
66
67 void PropertyBuffer::SetData( void* data )
68 {
69   //TODO: MESH_REWORK
70   DALI_ASSERT_ALWAYS( false && "MESH_REWORK" );
71 }
72
73 Dali::Property::Index PropertyBuffer::GetPropertyIndex( const std::string name, std::size_t index )
74 {
75   //TODO: MESH_REWORK
76   DALI_ASSERT_ALWAYS( false && "MESH_REWORK" );
77   return 0;
78 }
79
80 const SceneGraph::PropertyBuffer* PropertyBuffer::GetPropertyBufferSceneObject() const
81 {
82   return mSceneObject;
83 }
84
85 unsigned int PropertyBuffer::GetDefaultPropertyCount() const
86 {
87   return PROPERTY_BUFFER_IMPL.GetDefaultPropertyCount();
88 }
89
90 void PropertyBuffer::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
91 {
92   PROPERTY_BUFFER_IMPL.GetDefaultPropertyIndices( indices );
93 }
94
95 const char* PropertyBuffer::GetDefaultPropertyName(Property::Index index) const
96 {
97   return PROPERTY_BUFFER_IMPL.GetDefaultPropertyName( index );
98 }
99
100 Property::Index PropertyBuffer::GetDefaultPropertyIndex( const std::string& name ) const
101 {
102   return PROPERTY_BUFFER_IMPL.GetDefaultPropertyIndex( name );
103 }
104
105 bool PropertyBuffer::IsDefaultPropertyWritable( Property::Index index ) const
106 {
107   return PROPERTY_BUFFER_IMPL.IsDefaultPropertyWritable( index );
108 }
109
110 bool PropertyBuffer::IsDefaultPropertyAnimatable( Property::Index index ) const
111 {
112   return PROPERTY_BUFFER_IMPL.IsDefaultPropertyAnimatable( index );
113 }
114
115 bool PropertyBuffer::IsDefaultPropertyAConstraintInput( Property::Index index ) const
116 {
117   return PROPERTY_BUFFER_IMPL.IsDefaultPropertyAConstraintInput( index );
118 }
119
120 Property::Type PropertyBuffer::GetDefaultPropertyType( Property::Index index ) const
121 {
122   return PROPERTY_BUFFER_IMPL.GetDefaultPropertyType( index );
123 }
124
125 void PropertyBuffer::SetDefaultProperty( Property::Index index,
126                                    const Property::Value& propertyValue )
127 {
128   PROPERTY_BUFFER_IMPL.SetDefaultProperty( index, propertyValue );
129 }
130
131 void PropertyBuffer::SetSceneGraphProperty( Property::Index index,
132                                       const CustomProperty& entry,
133                                       const Property::Value& value )
134 {
135   PROPERTY_BUFFER_IMPL.SetSceneGraphProperty( index, entry, value );
136 }
137
138 Property::Value PropertyBuffer::GetDefaultProperty( Property::Index index ) const
139 {
140   return PROPERTY_BUFFER_IMPL.GetDefaultProperty( index );
141 }
142
143 const SceneGraph::PropertyOwner* PropertyBuffer::GetPropertyOwner() const
144 {
145   return PROPERTY_BUFFER_IMPL.GetPropertyOwner();
146 }
147
148 const SceneGraph::PropertyOwner* PropertyBuffer::GetSceneObject() const
149 {
150   return mSceneObject;
151 }
152
153 const SceneGraph::PropertyBase* PropertyBuffer::GetSceneObjectAnimatableProperty( Property::Index index ) const
154 {
155   return PROPERTY_BUFFER_IMPL.GetSceneObjectAnimatableProperty( index );
156 }
157
158 const PropertyInputImpl* PropertyBuffer::GetSceneObjectInputProperty( Property::Index index ) const
159 {
160   return PROPERTY_BUFFER_IMPL.GetSceneObjectInputProperty( index );
161 }
162
163 int PropertyBuffer::GetPropertyComponentIndex( Property::Index index ) const
164 {
165   return PROPERTY_BUFFER_IMPL.GetPropertyComponentIndex( index );
166 }
167
168 bool PropertyBuffer::OnStage() const
169 {
170   return mOnStage;
171 }
172
173 void PropertyBuffer::Connect()
174 {
175   mOnStage = true;
176 }
177
178 void PropertyBuffer::Disconnect()
179 {
180   mOnStage = false;
181 }
182
183 PropertyBuffer::PropertyBuffer()
184 : mSceneObject(NULL),
185   mOnStage( false )
186 {
187 }
188
189 } // namespace Internal
190 } // namespace Dali