2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/public-api/object/handle.h>
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>
33 Handle::Handle( Dali::Internal::Object* handle )
45 return Handle( Internal::CustomObject::New() );
52 Handle::Handle( const Handle& handle )
53 : BaseHandle( handle )
57 Handle& Handle::operator=( const Handle& rhs )
61 BaseHandle::operator=(rhs);
67 Handle Handle::DownCast( BaseHandle handle )
69 return Handle( dynamic_cast<Dali::Internal::Object*>(handle.GetObjectPtr()) );
73 bool Handle::Supports( Capability capability ) const
75 return GetImplementation(*this).Supports( capability );
78 unsigned int Handle::GetPropertyCount() const
80 return GetImplementation(*this).GetPropertyCount();
83 std::string Handle::GetPropertyName( Property::Index index ) const
85 return GetImplementation(*this).GetPropertyName( index );
88 Property::Index Handle::GetPropertyIndex( const std::string& name ) const
90 return GetImplementation(*this).GetPropertyIndex( name );
93 Property::Index Handle::GetPropertyIndex( Property::Index key ) const
95 return GetImplementation(*this).GetPropertyIndex( key );
98 Property::Index Handle::GetPropertyIndex( Property::Key key ) const
100 return GetImplementation(*this).GetPropertyIndex( key );
103 bool Handle::IsPropertyWritable( Property::Index index ) const
105 return GetImplementation(*this).IsPropertyWritable( index );
108 bool Handle::IsPropertyAnimatable( Property::Index index ) const
110 return GetImplementation(*this).IsPropertyAnimatable( index );
113 bool Handle::IsPropertyAConstraintInput( Property::Index index ) const
115 return GetImplementation(*this).IsPropertyAConstraintInput( index );
118 Property::Type Handle::GetPropertyType( Property::Index index ) const
120 return GetImplementation(*this).GetPropertyType( index );
123 void Handle::SetProperty( Property::Index index, const Property::Value& propertyValue )
125 GetImplementation(*this).SetProperty( index, propertyValue );
128 Property::Index Handle::RegisterProperty( const std::string& name, const Property::Value& propertyValue )
130 return GetImplementation(*this).RegisterProperty( name, propertyValue );
133 Property::Index Handle::RegisterProperty( Property::Index key, const std::string& name, const Property::Value& propertyValue )
135 return GetImplementation(*this).RegisterProperty( name, key, propertyValue );
138 Property::Index Handle::RegisterProperty( const std::string& name, const Property::Value& propertyValue, Property::AccessMode accessMode )
140 return GetImplementation(*this).RegisterProperty( name, propertyValue, accessMode );
143 Property::Value Handle::GetProperty( Property::Index index ) const
145 return GetImplementation(*this).GetProperty( index );
148 void Handle::GetPropertyIndices( Property::IndexContainer& indices ) const
150 GetImplementation(*this).GetPropertyIndices( indices );
153 Dali::PropertyNotification Handle::AddPropertyNotification( Property::Index index,
154 const PropertyCondition& condition )
156 return GetImplementation(*this).AddPropertyNotification( index, -1, condition );
159 Dali::PropertyNotification Handle::AddPropertyNotification( Property::Index index,
161 const PropertyCondition& condition )
163 return GetImplementation(*this).AddPropertyNotification( index, componentIndex, condition );
166 void Handle::RemovePropertyNotification( Dali::PropertyNotification propertyNotification )
168 GetImplementation(*this).RemovePropertyNotification( propertyNotification );
171 void Handle::RemovePropertyNotifications()
173 GetImplementation(*this).RemovePropertyNotifications();
176 void Handle::RemoveConstraints()
178 GetImplementation(*this).RemoveConstraints();
181 void Handle::RemoveConstraints( unsigned int tag )
183 GetImplementation(*this).RemoveConstraints( tag );
186 namespace WeightObject
189 const Property::Index WEIGHT = PROPERTY_CUSTOM_START_INDEX;
193 Handle handle = Handle::New();
195 handle.RegisterProperty( "weight", 0.0f );
200 } // namespace WeightObject