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