2 * Copyright (c) 2020 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/integration-api/debug.h>
32 Handle::Handle( Dali::Internal::Object* handle )
44 return Handle( Internal::Object::New().Get() );
51 Handle::Handle( const Handle& handle )
52 : BaseHandle( handle )
56 Handle& Handle::operator=( const Handle& rhs )
60 BaseHandle::operator=(rhs);
66 Handle::Handle( Handle&& rhs ) = default;
68 Handle& Handle::operator=( Handle&& rhs ) = default;
70 Handle Handle::DownCast( BaseHandle handle )
72 return Handle( dynamic_cast<Dali::Internal::Object*>(handle.GetObjectPtr()) );
75 bool Handle::Supports( Capability capability ) const
77 return GetImplementation(*this).Supports( capability );
80 uint32_t Handle::GetPropertyCount() const
82 return GetImplementation(*this).GetPropertyCount();
85 std::string Handle::GetPropertyName( Property::Index index ) const
87 return GetImplementation(*this).GetPropertyName( index );
90 Property::Index Handle::GetPropertyIndex( const std::string& name ) const
92 return GetImplementation(*this).GetPropertyIndex( name );
95 bool Handle::IsPropertyWritable( Property::Index index ) const
97 return GetImplementation(*this).IsPropertyWritable( index );
100 bool Handle::IsPropertyAnimatable( Property::Index index ) const
102 return GetImplementation(*this).IsPropertyAnimatable( index );
105 bool Handle::IsPropertyAConstraintInput( Property::Index index ) const
107 return GetImplementation(*this).IsPropertyAConstraintInput( index );
110 Property::Type Handle::GetPropertyType( Property::Index index ) const
112 return GetImplementation(*this).GetPropertyType( index );
115 void Handle::SetProperty( Property::Index index, const Property::Value& propertyValue )
117 GetImplementation(*this).SetProperty( index, propertyValue );
120 Property::Index Handle::RegisterProperty( const std::string& name, const Property::Value& propertyValue )
122 return GetImplementation(*this).RegisterProperty( name, propertyValue );
125 Property::Index Handle::RegisterProperty( const std::string& name, const Property::Value& propertyValue, Property::AccessMode accessMode )
127 return GetImplementation(*this).RegisterProperty( name, propertyValue, accessMode );
130 Property::Value Handle::GetProperty( Property::Index index ) const
132 return GetImplementation(*this).GetProperty( index );
135 Property::Value Handle::GetCurrentProperty( Property::Index index ) const
137 return GetImplementation(*this).GetCurrentProperty( index );
140 void Handle::GetPropertyIndices( Property::IndexContainer& indices ) const
142 GetImplementation(*this).GetPropertyIndices( indices );
145 Dali::PropertyNotification Handle::AddPropertyNotification( Property::Index index,
146 const PropertyCondition& condition )
148 return GetImplementation(*this).AddPropertyNotification( index, -1, condition );
151 Dali::PropertyNotification Handle::AddPropertyNotification( Property::Index index,
153 const PropertyCondition& condition )
155 return GetImplementation(*this).AddPropertyNotification( index, componentIndex, condition );
158 void Handle::RemovePropertyNotification( Dali::PropertyNotification propertyNotification )
160 GetImplementation(*this).RemovePropertyNotification( propertyNotification );
163 void Handle::RemovePropertyNotifications()
165 GetImplementation(*this).RemovePropertyNotifications();
168 void Handle::RemoveConstraints()
170 GetImplementation(*this).RemoveConstraints();
173 void Handle::RemoveConstraints( uint32_t tag )
175 GetImplementation(*this).RemoveConstraints( tag );
178 namespace WeightObject
181 const Property::Index WEIGHT = PROPERTY_CUSTOM_START_INDEX;
185 Handle handle = Handle::New();
187 handle.RegisterProperty( "weight", 0.0f );
192 } // namespace WeightObject