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