Revert "[Tizen] Move DevelHandle::GetCurrentProperty to public"
[platform/core/uifw/dali-core.git] / dali / public-api / object / handle.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/public-api/object/handle.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/animation/constraint.h>
23 #include <dali/public-api/object/property-conditions.h>
24 #include <dali/public-api/object/property-notification.h>
25 #include <dali/internal/event/animation/constraint-impl.h>
26 #include <dali/internal/event/common/object-impl.h>
27 #include <dali/internal/event/object/custom-object-internal.h>
28 #include <dali/integration-api/debug.h>
29
30 namespace Dali
31 {
32
33 Handle::Handle( Dali::Internal::Object* handle )
34 : BaseHandle(handle)
35 {
36 }
37
38
39 Handle::Handle()
40 {
41 }
42
43 Handle Handle::New()
44 {
45   return Handle( Internal::CustomObject::New() );
46 }
47
48 Handle::~Handle()
49 {
50 }
51
52 Handle::Handle( const Handle& handle )
53 : BaseHandle( handle )
54 {
55 }
56
57 Handle& Handle::operator=( const Handle& rhs )
58 {
59   if( this != &rhs )
60   {
61     BaseHandle::operator=(rhs);
62   }
63
64   return *this;
65 }
66
67 Handle Handle::DownCast( BaseHandle handle )
68 {
69   return Handle( dynamic_cast<Dali::Internal::Object*>(handle.GetObjectPtr()) );
70 }
71
72
73 bool Handle::Supports( Capability capability ) const
74 {
75   return GetImplementation(*this).Supports( capability );
76 }
77
78 unsigned int Handle::GetPropertyCount() const
79 {
80   return GetImplementation(*this).GetPropertyCount();
81 }
82
83 std::string Handle::GetPropertyName( Property::Index index ) const
84 {
85   return GetImplementation(*this).GetPropertyName( index );
86 }
87
88 Property::Index Handle::GetPropertyIndex( const std::string& name ) const
89 {
90   return GetImplementation(*this).GetPropertyIndex( name );
91 }
92
93 bool Handle::IsPropertyWritable( Property::Index index ) const
94 {
95   return GetImplementation(*this).IsPropertyWritable( index );
96 }
97
98 bool Handle::IsPropertyAnimatable( Property::Index index ) const
99 {
100   return GetImplementation(*this).IsPropertyAnimatable( index );
101 }
102
103 bool Handle::IsPropertyAConstraintInput( Property::Index index ) const
104 {
105   return GetImplementation(*this).IsPropertyAConstraintInput( index );
106 }
107
108 Property::Type Handle::GetPropertyType( Property::Index index ) const
109 {
110   return GetImplementation(*this).GetPropertyType( index );
111 }
112
113 void Handle::SetProperty( Property::Index index, const Property::Value& propertyValue )
114 {
115   GetImplementation(*this).SetProperty( index, propertyValue );
116 }
117
118 Property::Index Handle::RegisterProperty( const std::string& name, const Property::Value& propertyValue )
119 {
120   return GetImplementation(*this).RegisterProperty( name, propertyValue );
121 }
122
123 Property::Index Handle::RegisterProperty( const std::string& name, const Property::Value& propertyValue, Property::AccessMode accessMode )
124 {
125   return GetImplementation(*this).RegisterProperty( name, propertyValue, accessMode );
126 }
127
128 Property::Value Handle::GetProperty( Property::Index index ) const
129 {
130   return GetImplementation(*this).GetProperty( index );
131 }
132
133 void Handle::GetPropertyIndices( Property::IndexContainer& indices ) const
134 {
135   GetImplementation(*this).GetPropertyIndices( indices );
136 }
137
138 Dali::PropertyNotification Handle::AddPropertyNotification( Property::Index index,
139                                                             const PropertyCondition& condition )
140 {
141   return GetImplementation(*this).AddPropertyNotification( index, -1, condition );
142 }
143
144 Dali::PropertyNotification Handle::AddPropertyNotification( Property::Index index,
145                                                             int componentIndex,
146                                                             const PropertyCondition& condition )
147 {
148   return GetImplementation(*this).AddPropertyNotification( index, componentIndex, condition );
149 }
150
151 void Handle::RemovePropertyNotification( Dali::PropertyNotification propertyNotification )
152 {
153   GetImplementation(*this).RemovePropertyNotification( propertyNotification );
154 }
155
156 void Handle::RemovePropertyNotifications()
157 {
158   GetImplementation(*this).RemovePropertyNotifications();
159 }
160
161 void Handle::RemoveConstraints()
162 {
163   GetImplementation(*this).RemoveConstraints();
164 }
165
166 void Handle::RemoveConstraints( unsigned int tag )
167 {
168   GetImplementation(*this).RemoveConstraints( tag );
169 }
170
171 namespace WeightObject
172 {
173
174 const Property::Index WEIGHT = PROPERTY_CUSTOM_START_INDEX;
175
176 Handle New()
177 {
178   Handle handle = Handle::New();
179
180   handle.RegisterProperty( "weight", 0.0f );
181
182   return handle;
183 }
184
185 } // namespace WeightObject
186
187 } // namespace Dali