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 bool Handle::IsPropertyWritable( Property::Index index ) const
95 return GetImplementation(*this).IsPropertyWritable( index );
98 bool Handle::IsPropertyAnimatable( Property::Index index ) const
100 return GetImplementation(*this).IsPropertyAnimatable( index );
103 bool Handle::IsPropertyAConstraintInput( Property::Index index ) const
105 return GetImplementation(*this).IsPropertyAConstraintInput( index );
108 Property::Type Handle::GetPropertyType( Property::Index index ) const
110 return GetImplementation(*this).GetPropertyType( index );
113 void Handle::SetProperty( Property::Index index, const Property::Value& propertyValue )
115 GetImplementation(*this).SetProperty( index, propertyValue );
118 Property::Index Handle::RegisterProperty( const std::string& name, const Property::Value& propertyValue )
120 return GetImplementation(*this).RegisterProperty( name, propertyValue );
123 Property::Index Handle::RegisterProperty( const std::string& name, const Property::Value& propertyValue, Property::AccessMode accessMode )
125 return GetImplementation(*this).RegisterProperty( name, propertyValue, accessMode );
128 Property::Value Handle::GetProperty( Property::Index index ) const
130 return GetImplementation(*this).GetProperty( index );
133 void Handle::GetPropertyIndices( Property::IndexContainer& indices ) const
135 GetImplementation(*this).GetPropertyIndices( indices );
138 Dali::PropertyNotification Handle::AddPropertyNotification( Property::Index index,
139 const PropertyCondition& condition )
141 return GetImplementation(*this).AddPropertyNotification( index, -1, condition );
144 Dali::PropertyNotification Handle::AddPropertyNotification( Property::Index index,
146 const PropertyCondition& condition )
148 return GetImplementation(*this).AddPropertyNotification( index, componentIndex, condition );
151 void Handle::RemovePropertyNotification( Dali::PropertyNotification propertyNotification )
153 GetImplementation(*this).RemovePropertyNotification( propertyNotification );
156 void Handle::RemovePropertyNotifications()
158 GetImplementation(*this).RemovePropertyNotifications();
161 void Handle::RemoveConstraints()
163 GetImplementation(*this).RemoveConstraints();
166 void Handle::RemoveConstraints( unsigned int tag )
168 GetImplementation(*this).RemoveConstraints( tag );
171 namespace WeightObject
174 const Property::Index WEIGHT = PROPERTY_CUSTOM_START_INDEX;
178 Handle handle = Handle::New();
180 handle.RegisterProperty( "weight", 0.0f );
185 } // namespace WeightObject