2 * Copyright (c) 2014 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/active-constraint.h>
23 #include <dali/public-api/animation/constraint.h>
24 #include <dali/public-api/object/property-conditions.h>
25 #include <dali/public-api/object/property-notification.h>
26 #include <dali/internal/event/animation/constraint-impl.h>
27 #include <dali/internal/event/common/object-impl.h>
28 #include <dali/internal/event/object/custom-object-internal.h>
29 #include <dali/integration-api/debug.h>
34 Handle::Handle( Dali::Internal::Object* handle )
46 return Handle( Internal::CustomObject::New() );
53 Handle::Handle( const Handle& handle )
54 : BaseHandle( handle )
58 Handle& Handle::operator=( const Handle& rhs )
62 BaseHandle::operator=(rhs);
68 Handle Handle::DownCast( BaseHandle handle )
70 return Handle( dynamic_cast<Dali::Internal::Object*>(handle.GetObjectPtr()) );
74 bool Handle::Supports( Capability capability ) const
76 return GetImplementation(*this).Supports( capability );
79 unsigned int Handle::GetPropertyCount() const
81 return GetImplementation(*this).GetPropertyCount();
84 std::string Handle::GetPropertyName( Property::Index index ) const
86 return GetImplementation(*this).GetPropertyName( index );
89 Property::Index Handle::GetPropertyIndex( const std::string& name ) const
91 return GetImplementation(*this).GetPropertyIndex( name );
94 bool Handle::IsPropertyWritable( Property::Index index ) const
96 return GetImplementation(*this).IsPropertyWritable( index );
99 bool Handle::IsPropertyAnimatable( Property::Index index ) const
101 return GetImplementation(*this).IsPropertyAnimatable( index );
104 bool Handle::IsPropertyAConstraintInput( Property::Index index ) const
106 return GetImplementation(*this).IsPropertyAConstraintInput( index );
109 Property::Type Handle::GetPropertyType( Property::Index index ) const
111 return GetImplementation(*this).GetPropertyType( index );
114 void Handle::SetProperty( Property::Index index, const Property::Value& propertyValue )
116 GetImplementation(*this).SetProperty( index, propertyValue );
119 Property::Index Handle::RegisterProperty( const std::string& name, const Property::Value& propertyValue )
121 return GetImplementation(*this).RegisterProperty( name, propertyValue );
124 Property::Index Handle::RegisterProperty( const std::string& name, const Property::Value& propertyValue, Property::AccessMode accessMode )
126 return GetImplementation(*this).RegisterProperty( name, propertyValue, accessMode );
129 Property::Value Handle::GetProperty( Property::Index index ) const
131 return GetImplementation(*this).GetProperty( index );
134 void Handle::GetPropertyIndices( Property::IndexContainer& indices ) const
136 GetImplementation(*this).GetPropertyIndices( indices );
139 Dali::PropertyNotification Handle::AddPropertyNotification( Property::Index index,
140 const PropertyCondition& condition )
142 return GetImplementation(*this).AddPropertyNotification( index, -1, condition );
145 Dali::PropertyNotification Handle::AddPropertyNotification( Property::Index index,
147 const PropertyCondition& condition )
149 return GetImplementation(*this).AddPropertyNotification( index, componentIndex, condition );
152 void Handle::RemovePropertyNotification( Dali::PropertyNotification propertyNotification )
154 GetImplementation(*this).RemovePropertyNotification( propertyNotification );
157 void Handle::RemovePropertyNotifications()
159 GetImplementation(*this).RemovePropertyNotifications();
162 ActiveConstraint Handle::ApplyConstraint( Constraint constraint )
164 return GetImplementation(*this).ApplyConstraint( GetImplementation( constraint ) );
167 ActiveConstraint Handle::ApplyConstraint( Constraint constraint, Handle weightObject )
169 return GetImplementation(*this).ApplyConstraint( GetImplementation( constraint ), weightObject );
172 void Handle::RemoveConstraint(ActiveConstraint activeConstraint)
174 GetImplementation(*this).RemoveConstraint( activeConstraint );
177 void Handle::RemoveConstraints()
179 GetImplementation(*this).RemoveConstraints();
182 void Handle::RemoveConstraints( unsigned int tag )
184 GetImplementation(*this).RemoveConstraints( tag );
187 namespace WeightObject
190 const Property::Index WEIGHT = PROPERTY_CUSTOM_START_INDEX;
194 Handle handle = Handle::New();
196 handle.RegisterProperty( "weight", 0.0f );
201 } // namespace WeightObject