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/animation/constraint.h>
22 #include <dali/public-api/animation/time-period.h>
23 #include <dali/internal/event/animation/constraint-impl.h>
24 #include <dali/internal/event/animation/constraint-source-impl.h>
29 const AlphaFunction Constraint::DEFAULT_ALPHA_FUNCTION = AlphaFunctions::Linear;
30 const Constraint::RemoveAction Constraint::DEFAULT_REMOVE_ACTION = Constraint::Bake;
32 Constraint::Constraint()
36 Constraint::Constraint(Internal::Constraint* constraint)
37 : BaseHandle(constraint)
41 Constraint::~Constraint()
45 Constraint::Constraint(const Constraint& handle)
50 Constraint& Constraint::operator=(const Constraint& rhs)
52 BaseHandle::operator=(rhs);
56 void Constraint::SetApplyTime( TimePeriod timePeriod )
58 GetImplementation(*this).SetApplyTime( timePeriod );
61 TimePeriod Constraint::GetApplyTime() const
63 return GetImplementation(*this).GetApplyTime();
66 void Constraint::SetAlphaFunction( AlphaFunction func )
68 GetImplementation(*this).SetAlphaFunction( func );
71 AlphaFunction Constraint::GetAlphaFunction()
73 return GetImplementation(*this).GetAlphaFunction();
76 void Constraint::SetRemoveAction(Constraint::RemoveAction action)
78 GetImplementation(*this).SetRemoveAction(action);
81 Constraint::RemoveAction Constraint::GetRemoveAction() const
83 return GetImplementation(*this).GetRemoveAction();
86 void Constraint::SetTag( const unsigned int tag )
88 GetImplementation(*this).SetTag( tag );
91 unsigned int Constraint::GetTag() const
93 return GetImplementation(*this).GetTag();
100 Constraint Constraint::New( Property::Index target,
101 Property::Type targetType,
104 Internal::SourceContainer sources; // empty
106 return Constraint( new Internal::Constraint( target,
112 Constraint Constraint::New( Property::Index target,
113 Property::Type targetType,
114 ConstraintSource source1,
117 Internal::SourceContainer sources;
118 sources.push_back( Internal::Source( source1 ) );
120 return Constraint( new Internal::Constraint( target,
126 Constraint Constraint::New( Property::Index target,
127 Property::Type targetType,
128 ConstraintSource source1,
129 ConstraintSource source2,
132 Internal::SourceContainer sources;
133 sources.push_back( Internal::Source( source1 ) );
134 sources.push_back( Internal::Source( source2 ) );
136 return Constraint( new Internal::Constraint( target,
142 Constraint Constraint::New( Property::Index target,
143 Property::Type targetType,
144 ConstraintSource source1,
145 ConstraintSource source2,
146 ConstraintSource source3,
149 Internal::SourceContainer sources;
150 sources.push_back( Internal::Source( source1 ) );
151 sources.push_back( Internal::Source( source2 ) );
152 sources.push_back( Internal::Source( source3 ) );
154 return Constraint( new Internal::Constraint( target,
160 Constraint Constraint::New( Property::Index target,
161 Property::Type targetType,
162 ConstraintSource source1,
163 ConstraintSource source2,
164 ConstraintSource source3,
165 ConstraintSource source4,
168 Internal::SourceContainer sources;
169 sources.push_back( Internal::Source( source1 ) );
170 sources.push_back( Internal::Source( source2 ) );
171 sources.push_back( Internal::Source( source3 ) );
172 sources.push_back( Internal::Source( source4 ) );
174 return Constraint( new Internal::Constraint( target,
180 Constraint Constraint::New( Property::Index target,
181 Property::Type targetType,
182 ConstraintSource source1,
183 ConstraintSource source2,
184 ConstraintSource source3,
185 ConstraintSource source4,
186 ConstraintSource source5,
189 Internal::SourceContainer sources;
190 sources.push_back( Internal::Source( source1 ) );
191 sources.push_back( Internal::Source( source2 ) );
192 sources.push_back( Internal::Source( source3 ) );
193 sources.push_back( Internal::Source( source4 ) );
194 sources.push_back( Internal::Source( source5 ) );
196 return Constraint( new Internal::Constraint( target,
202 Constraint Constraint::New( Property::Index target,
203 Property::Type targetType,
204 ConstraintSource source1,
205 ConstraintSource source2,
206 ConstraintSource source3,
207 ConstraintSource source4,
208 ConstraintSource source5,
209 ConstraintSource source6,
212 Internal::SourceContainer sources;
213 sources.push_back( Internal::Source( source1 ) );
214 sources.push_back( Internal::Source( source2 ) );
215 sources.push_back( Internal::Source( source3 ) );
216 sources.push_back( Internal::Source( source4 ) );
217 sources.push_back( Internal::Source( source5 ) );
218 sources.push_back( Internal::Source( source6 ) );
220 return Constraint( new Internal::Constraint( target,
226 Constraint Constraint::DownCast( BaseHandle handle )
228 return Constraint( dynamic_cast<Dali::Internal::Constraint*>(handle.GetObjectPtr()) );