Making DALi public API typesafe using guaranteed types; uint8_t, uint32_t
[platform/core/uifw/dali-core.git] / dali / public-api / animation / animation.cpp
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/public-api/animation/animation.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/animation/alpha-function.h>
23 #include <dali/public-api/animation/time-period.h>
24 #include <dali/internal/event/actors/actor-impl.h>
25 #include <dali/internal/event/animation/animation-impl.h>
26 #include <dali/internal/event/animation/path-impl.h>
27
28 namespace Dali
29 {
30
31 Animation::Animation()
32 {
33 }
34
35 Animation::Animation(Internal::Animation* animation)
36 : BaseHandle(animation)
37 {
38 }
39
40 Animation Animation::New(float durationSeconds)
41 {
42   Internal::AnimationPtr internal = Dali::Internal::Animation::New(durationSeconds);
43
44   return Animation(internal.Get());
45 }
46
47 Animation Animation::DownCast( BaseHandle handle )
48 {
49   return Animation( dynamic_cast<Dali::Internal::Animation*>(handle.GetObjectPtr()) );
50 }
51
52 Animation::~Animation()
53 {
54 }
55
56 Animation::Animation(const Animation& handle)
57 : BaseHandle(handle)
58 {
59 }
60
61 Animation& Animation::operator=(const Animation& rhs)
62 {
63   BaseHandle::operator=(rhs);
64   return *this;
65 }
66
67 void Animation::SetDuration(float durationSeconds)
68 {
69   GetImplementation(*this).SetDuration(durationSeconds);
70 }
71
72 float Animation::GetDuration() const
73 {
74   return GetImplementation(*this).GetDuration();
75 }
76
77 void Animation::SetLooping(bool looping)
78 {
79   GetImplementation(*this).SetLooping(looping);
80 }
81
82 void Animation::SetLoopCount(int32_t count)
83 {
84   GetImplementation(*this).SetLoopCount(count);
85 }
86
87 int32_t Animation::GetLoopCount()
88 {
89   return GetImplementation(*this).GetLoopCount();
90 }
91
92 int32_t Animation::GetCurrentLoop()
93 {
94   return GetImplementation(*this).GetCurrentLoop();
95 }
96
97 bool Animation::IsLooping() const
98 {
99   return GetImplementation(*this).IsLooping();
100 }
101
102 void Animation::SetEndAction(Dali::Animation::EndAction endAction)
103 {
104   GetImplementation(*this).SetEndAction(endAction);
105 }
106
107 Dali::Animation::EndAction Animation::GetEndAction() const
108 {
109   return GetImplementation(*this).GetEndAction();
110 }
111
112 void Animation::SetDisconnectAction( Animation::EndAction disconnectAction )
113 {
114   GetImplementation(*this).SetDisconnectAction( disconnectAction );
115 }
116
117 Animation::EndAction Animation::GetDisconnectAction() const
118 {
119   return GetImplementation(*this).GetDisconnectAction();
120 }
121
122 void Animation::SetDefaultAlphaFunction(AlphaFunction alpha)
123 {
124   GetImplementation(*this).SetDefaultAlphaFunction(alpha);
125 }
126
127 AlphaFunction Animation::GetDefaultAlphaFunction() const
128 {
129   return GetImplementation(*this).GetDefaultAlphaFunction();
130 }
131
132 void Animation::Play()
133 {
134   GetImplementation(*this).Play();
135 }
136
137 void Animation::PlayFrom(float progress)
138 {
139   GetImplementation(*this).PlayFrom(progress);
140 }
141
142 void Animation::PlayAfter( float delaySeconds )
143 {
144   GetImplementation( *this ).PlayAfter( delaySeconds );
145 }
146
147 void Animation::Pause()
148 {
149   GetImplementation(*this).Pause();
150 }
151
152 Dali::Animation::State Animation::GetState() const
153 {
154   return GetImplementation(*this).GetState();
155 }
156
157 void Animation::Stop()
158 {
159   GetImplementation(*this).Stop();
160 }
161
162 void Animation::Clear()
163 {
164   GetImplementation(*this).Clear();
165 }
166
167 void Animation::SetLoopingMode( LoopingMode loopingMode )
168 {
169   GetImplementation( *this ).SetLoopingMode( loopingMode );
170 }
171
172 Animation::LoopingMode Animation::GetLoopingMode() const
173 {
174   return GetImplementation( *this ).GetLoopingMode();
175 }
176
177 Animation::AnimationSignalType& Animation::FinishedSignal()
178 {
179   return GetImplementation(*this).FinishedSignal();
180 }
181
182 void Animation::AnimateBy(Property target, Property::Value relativeValue)
183 {
184   GetImplementation(*this).AnimateBy(target, relativeValue);
185 }
186
187 void Animation::AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha)
188 {
189   GetImplementation(*this).AnimateBy(target, relativeValue, alpha);
190 }
191
192 void Animation::AnimateBy(Property target, Property::Value relativeValue, TimePeriod period)
193 {
194   GetImplementation(*this).AnimateBy(target, relativeValue, period);
195 }
196
197 void Animation::AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha, TimePeriod period)
198 {
199   GetImplementation(*this).AnimateBy(target, relativeValue, alpha, period);
200 }
201
202 void Animation::AnimateTo(Property target, Property::Value destinationValue)
203 {
204   GetImplementation(*this).AnimateTo(target, destinationValue);
205 }
206
207 void Animation::AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha)
208 {
209   GetImplementation(*this).AnimateTo(target, destinationValue, alpha);
210 }
211
212 void Animation::AnimateTo(Property target, Property::Value destinationValue, TimePeriod period)
213 {
214   GetImplementation(*this).AnimateTo(target, destinationValue, period);
215 }
216
217 void Animation::AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period)
218 {
219   GetImplementation(*this).AnimateTo(target, destinationValue, alpha, period);
220 }
221
222 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames )
223 {
224   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames) );
225 }
226
227 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, Interpolation interpolation)
228 {
229   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), interpolation );
230 }
231
232 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period)
233 {
234   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period);
235 }
236
237 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period, Interpolation interpolation)
238 {
239   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period, interpolation );
240 }
241
242 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha)
243 {
244   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha);
245 }
246
247 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, Interpolation interpolation)
248 {
249   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, interpolation);
250 }
251
252
253 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period)
254 {
255   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period);
256 }
257
258 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation)
259 {
260   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period, interpolation);
261 }
262
263
264 // Actor specific animations
265
266 void Animation::Animate( Actor actor, Path path, const Vector3& forward )
267 {
268   GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward );
269 }
270
271 void Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha )
272 {
273   GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, alpha );
274 }
275
276 void Animation::Animate( Actor actor, Path path, const Vector3& forward, TimePeriod period )
277 {
278   GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, period);
279 }
280
281 void Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha, TimePeriod period)
282 {
283   GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, alpha, period );
284 }
285
286 void Animation::Show(Actor actor, float delaySeconds)
287 {
288   GetImplementation(*this).Show(GetImplementation(actor), delaySeconds);
289 }
290
291 void Animation::Hide(Actor actor, float delaySeconds)
292 {
293   GetImplementation(*this).Hide(GetImplementation(actor), delaySeconds);
294 }
295
296 void Animation::SetCurrentProgress( float progress )
297 {
298   return GetImplementation(*this).SetCurrentProgress( progress );
299 }
300
301 float Animation::GetCurrentProgress()
302 {
303   return GetImplementation(*this).GetCurrentProgress();
304 }
305
306 void Animation::SetSpeedFactor( float factor )
307 {
308   GetImplementation(*this).SetSpeedFactor( factor );
309 }
310
311 float Animation::GetSpeedFactor() const
312 {
313   return GetImplementation(*this).GetSpeedFactor();
314 }
315
316 void Animation::SetPlayRange( const Vector2& range )
317 {
318   GetImplementation(*this).SetPlayRange(range);
319 }
320
321 Vector2 Animation::GetPlayRange() const
322 {
323   return GetImplementation(*this).GetPlayRange();
324 }
325
326 } // namespace Dali