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/constrainable.h>
22 #include <dali/public-api/object/property-index.h>
23 #include <dali/public-api/animation/constraint.h>
24 #include <dali/public-api/animation/active-constraint.h>
25 #include <dali/internal/event/common/proxy-object.h>
26 #include <dali/internal/event/animation/constraint-impl.h>
27 #include <dali/internal/event/object/custom-object-internal.h>
32 Constrainable Constrainable::New()
34 return Constrainable( Internal::CustomObject::New() );
37 Constrainable::Constrainable(Dali::Internal::Object* handle)
42 Constrainable::Constrainable()
46 Constrainable Constrainable::DownCast( BaseHandle handle )
48 return Constrainable( dynamic_cast<Dali::Internal::ProxyObject*>(handle.GetObjectPtr()) );
51 Constrainable::~Constrainable()
55 Constrainable::Constrainable(const Constrainable& handle)
60 Constrainable& Constrainable::operator=(const Constrainable& rhs)
62 BaseHandle::operator=(rhs);
66 Constrainable& Constrainable::operator=(BaseHandle::NullType* rhs)
68 DALI_ASSERT_ALWAYS( (rhs == NULL) && "Can only assign NULL pointer to handle");
73 ActiveConstraint Constrainable::ApplyConstraint( Constraint constraint )
75 return GetImplementation(*this).ApplyConstraint( GetImplementation( constraint ) );
78 ActiveConstraint Constrainable::ApplyConstraint( Constraint constraint, Constrainable weightObject )
80 return GetImplementation(*this).ApplyConstraint( GetImplementation( constraint ), weightObject );
83 void Constrainable::RemoveConstraint(ActiveConstraint activeConstraint)
85 GetImplementation(*this).RemoveConstraint( activeConstraint );
88 void Constrainable::RemoveConstraints()
90 GetImplementation(*this).RemoveConstraints();
93 void Constrainable::RemoveConstraints( unsigned int tag )
95 GetImplementation(*this).RemoveConstraints( tag );
98 namespace WeightObject
101 const Property::Index WEIGHT = PROPERTY_CUSTOM_START_INDEX;
105 Constrainable handle = Constrainable::New();
107 handle.RegisterProperty( "weight", 0.0f );
112 } // namespace WeightObject