[ACR-564] deprecate unused API
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / AnimationView.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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 using System;
18
19 namespace ElmSharp
20 {
21     /// <summary>
22     /// Enumeration for the AnimationView state
23     /// </summary>
24     /// <since_tizen> preview </since_tizen>
25     [Obsolete("This has been deprecated in API12")]
26     public enum AnimationViewState
27     {
28         /// <summary>
29         /// Animation is not ready to play.
30         /// </summary>
31         NotReady,
32
33         /// <summary>
34         /// Animation is on playing.
35         /// </summary>
36         Play,
37
38         /// <summary>
39         /// Animation is on reverse playing.
40         /// </summary>
41         ReversedPlay,
42
43         /// <summary>
44         /// Animation has been paused.
45         /// </summary>
46         Pause,
47
48         /// <summary>
49         /// AnimationView successfully loaded a file then readied for playing. Otherwise after finished animation or stopped forcely by request.
50         /// </summary>
51         Stop
52     }
53
54     /// <summary>
55     /// The AnimationView is designed to show and play animation of vector graphics based content.
56     /// Currently ElmSharp AnimationView is supporting only json format (known for Lottie file as well).
57     /// </summary>
58     /// <since_tizen> preview </since_tizen>
59     [Obsolete("This has been deprecated in API12")]
60     public class AnimationView : EvasObject
61     {
62         private SmartEvent _started;
63         private SmartEvent _repeated;
64         private SmartEvent _finished;
65         private SmartEvent _paused;
66         private SmartEvent _resumed;
67         private SmartEvent _stopped;
68         private SmartEvent _updated;
69
70         /// <summary>
71         /// Creates and initializes a new instance of the AnimationView class.
72         /// </summary>
73         /// <param name="parent">The parent is a given container, which will be attached by AnimationView as a child. It's <see cref="EvasObject"/> type.</param>
74         /// <since_tizen> preview </since_tizen>
75         [Obsolete("This has been deprecated in API12")]
76         public AnimationView(EvasObject parent) : base(parent)
77         {
78             _started = new SmartEvent(this, this.Handle, "play,start");
79             _repeated = new SmartEvent(this, this.Handle, "play,repeat");
80             _finished = new SmartEvent(this, this.Handle, "play,done");
81             _paused = new SmartEvent(this, this.Handle, "play,pause");
82             _resumed = new SmartEvent(this, this.Handle, "play,resume");
83             _stopped = new SmartEvent(this, this.Handle, "play,stop");
84             _updated = new SmartEvent(this, this.Handle, "play,update");
85
86             _started.On += (sender, e) =>
87             {
88                 Started?.Invoke(this, EventArgs.Empty);
89             };
90
91             _repeated.On += (sender, e) =>
92             {
93                 Repeated?.Invoke(this, EventArgs.Empty);
94             };
95
96             _finished.On += (sender, e) =>
97             {
98                 Finished?.Invoke(this, EventArgs.Empty);
99             };
100
101             _paused.On += (sender, e) =>
102             {
103                 Paused?.Invoke(this, EventArgs.Empty);
104             };
105
106             _resumed.On += (sender, e) =>
107             {
108                 Resumed?.Invoke(this, EventArgs.Empty);
109             };
110
111             _stopped.On += (sender, e) =>
112             {
113                 Stopped?.Invoke(this, EventArgs.Empty);
114             };
115
116             _updated.On += (sender, e) =>
117             {
118                 Updated?.Invoke(this, EventArgs.Empty);
119             };
120         }
121
122         /// <summary>
123         /// It occurs when the animation is just started.
124         /// </summary>
125         /// <since_tizen> preview </since_tizen>
126         [Obsolete("This has been deprecated in API12")]
127         public event EventHandler Started;
128
129         /// <summary>
130         /// It occurs when the animation is just repeated.
131         /// </summary>
132         /// <since_tizen> preview </since_tizen>
133         [Obsolete("This has been deprecated in API12")]
134         public event EventHandler Repeated;
135
136         /// <summary>
137         /// It occurs when the animation is just finished.
138         /// </summary>
139         /// <since_tizen> preview </since_tizen>
140         [Obsolete("This has been deprecated in API12")]
141         public event EventHandler Finished;
142
143         /// <summary>
144         /// It occurs when the animation is just paused.
145         /// </summary>
146         /// <since_tizen> preview </since_tizen>
147         [Obsolete("This has been deprecated in API12")]
148         public event EventHandler Paused;
149
150         /// <summary>
151         /// It occurs when the animation is just resumed.
152         /// </summary>
153         /// <since_tizen> preview </since_tizen>
154         [Obsolete("This has been deprecated in API12")]
155         public event EventHandler Resumed;
156
157         /// <summary>
158         /// It occurs when the animation is just stopped.
159         /// </summary>
160         /// <since_tizen> preview </since_tizen>
161         [Obsolete("This has been deprecated in API12")]
162         public event EventHandler Stopped;
163
164         /// <summary>
165         /// It occurs when the animation is updated to the next frame.
166         /// </summary>
167         /// <since_tizen> preview </since_tizen>
168         [Obsolete("This has been deprecated in API12")]
169         public event EventHandler Updated;
170
171         /// <summary>
172         /// Sets or gets whether to play animation automatically.
173         /// <remarks>
174         /// If AutoPlay is true, animation will be started when it's readied.
175         /// The condition of AutoPlay is when AnimationView opened file successfully, yet to play it plus when the object is visible.
176         /// If AnimationView is disabled, invisible, it turns to pause state then resume animation when it's visible again.
177         /// This AutoPlay will be only affected to the next animation source. So must be called before SetAnimation()
178         /// </remarks>
179         /// </summary>
180         /// <since_tizen> preview </since_tizen>
181         [Obsolete("This has been deprecated in API12")]
182         public bool AutoPlay
183         {
184             get
185             {
186                 return Interop.Elementary.elm_animation_view_auto_play_get(Handle);
187             }
188             set
189             {
190                 Interop.Elementary.elm_animation_view_auto_play_set(Handle, value);
191             }
192         }
193
194         /// <summary>
195         /// Sets or gets whether to turn on/off animation looping.
196         /// <remarks>
197         /// If AutoRepeat is true, it repeats animation when animation frame is reached to end.
198         /// This AutoRepeat mode is valid to both Play and ReversePlay cases.
199         /// </remarks>
200         /// </summary>
201         /// <since_tizen> preview </since_tizen>
202         [Obsolete("This has been deprecated in API12")]
203         public bool AutoRepeat
204         {
205             get
206             {
207                 return Interop.Elementary.elm_animation_view_auto_repeat_get(Handle);
208             }
209             set
210             {
211                 Interop.Elementary.elm_animation_view_auto_repeat_set(Handle, value);
212             }
213         }
214
215         /// <summary>
216         /// Sets or gets the animation speed.
217         /// <remarks>
218         /// Control animation speed by multiplying Speed value.
219         /// If you want to play animation double-time faster, you can give Speed 2.
220         /// If you want to play animation double-time slower, you can give Speed 0.5.
221         /// Speed must be greater than zero.
222         /// </remarks>
223         /// </summary>
224         /// <since_tizen> preview </since_tizen>
225         [Obsolete("This has been deprecated in API12")]
226         public double Speed
227         {
228             get
229             {
230                 return Interop.Elementary.elm_animation_view_speed_get(Handle);
231             }
232             set
233             {
234                 Interop.Elementary.elm_animation_view_speed_set(Handle, value);
235             }
236         }
237
238         /// <summary>
239         /// Get the duration of animation in seconds.
240         /// </summary>
241         /// <remarks>
242         /// Returns total duration time of current animation in the seconds.
243         /// If current animation source isn't animatable, it returns zero.
244         /// </remarks>
245         /// <since_tizen> preview </since_tizen>
246         [Obsolete("This has been deprecated in API12")]
247         public double DurationTime
248         {
249             get
250             {
251                 return Interop.Elementary.elm_animation_view_duration_time_get(Handle);
252             }
253         }
254
255         /// <summary>
256         /// Sets or gets current progress position of animation view.
257         /// <remarks>
258         /// When you required to jump on a certain progress instantly,
259         /// you can change current position by using this property
260         /// The range of progress is 0 ~ 1.
261         /// </remarks>
262         /// </summary>
263         /// <since_tizen> preview </since_tizen>
264         [Obsolete("This has been deprecated in API12")]
265         public double Progress
266         {
267             get
268             {
269                 return Interop.Elementary.elm_animation_view_progress_get(Handle);
270             }
271             set
272             {
273                 Interop.Elementary.elm_animation_view_progress_set(Handle, value);
274             }
275         }
276
277         /// <summary>
278         /// Sets or gets current frame position of animation view.
279         /// <remarks>
280         /// The range of frame is from 0 to FrameCount - 1
281         /// </remarks>
282         /// </summary>
283         /// <since_tizen> preview </since_tizen>
284         [Obsolete("This has been deprecated in API12")]
285         public int Frame
286         {
287             get
288             {
289                 return Interop.Elementary.elm_animation_view_frame_get(Handle);
290             }
291             set
292             {
293                 Interop.Elementary.elm_animation_view_frame_set(Handle, value);
294             }
295         }
296
297         /// <summary>
298         /// Get the default view size that specified from vector resource.
299         /// </summary>
300         /// <since_tizen> preview </since_tizen>
301         [Obsolete("This has been deprecated in API12")]
302         public Size DefaultSize
303         {
304             get
305             {
306                 Interop.Elementary.elm_animation_view_default_size_get(Handle, out int w, out int h);
307                 return new Size(w, h);
308             }
309         }
310
311         /// <summary>
312         /// Get current animation view state.
313         /// </summary>
314         /// <since_tizen> preview </since_tizen>
315         [Obsolete("This has been deprecated in API12")]
316         public AnimationViewState State
317         {
318             get
319             {
320                 return (AnimationViewState)Interop.Elementary.elm_animation_view_state_get(Handle);
321             }
322         }
323
324         /// <summary>
325         /// Get the status whether current animation is on playing forward or backward.
326         /// </summary>
327         /// <remarks>
328         /// If AnimationView is not on playing, it will return False.
329         /// </remarks>
330         /// <since_tizen> preview </since_tizen>
331         [Obsolete("This has been deprecated in API12")]
332         public bool IsReversedPlaying
333         {
334             get
335             {
336                 return Interop.Elementary.elm_animation_view_is_playing_back(Handle);
337             }
338         }
339
340         /// <summary>
341         /// Get the index of end frame of the AnimationView, if it's animated.
342         /// </summary>
343         /// <remarks>
344         /// Frame number starts with 0.
345         /// </remarks>
346         /// <since_tizen> preview </since_tizen>
347         [Obsolete("This has been deprecated in API12")]
348         public int FrameCount
349         {
350             get
351             {
352                 return Interop.Elementary.elm_animation_view_frame_count_get(Handle);
353             }
354         }
355
356         /// <summary>
357         /// Sets or Gets the start progress of the play
358         /// </summary>
359         /// <remarks>
360         /// Default value is 0.
361         /// </remarks>
362         /// <since_tizen> preview </since_tizen>
363         [Obsolete("This has been deprecated in API12")]
364         public double MinProgress
365         {
366             get
367             {
368                 return Interop.Elementary.elm_animation_view_min_progress_get(Handle);
369             }
370             set
371             {
372                 Interop.Elementary.elm_animation_view_min_progress_set(Handle, value);
373             }
374         }
375
376         /// <summary>
377         /// Sets or Gets the last progress of the play
378         /// </summary>
379         /// <remarks>
380         /// Default value is 1.
381         /// </remarks>
382         /// <since_tizen> preview </since_tizen>
383         [Obsolete("This has been deprecated in API12")]
384         public double MaxProgress
385         {
386             get
387             {
388                 return Interop.Elementary.elm_animation_view_max_progress_get(Handle);
389             }
390             set
391             {
392                 Interop.Elementary.elm_animation_view_max_progress_set(Handle, value);
393             }
394         }
395
396         /// <summary>
397         /// Sets or Gets the start frame of the play
398         /// </summary>
399         /// <remarks>
400         /// Default value is 0.
401         /// </remarks>
402         /// <since_tizen> preview </since_tizen>
403         [Obsolete("This has been deprecated in API12")]
404         public int MinFrame
405         {
406             get
407             {
408                 return Interop.Elementary.elm_animation_view_min_frame_get(Handle);
409             }
410             set
411             {
412                 Interop.Elementary.elm_animation_view_min_frame_set(Handle, value);
413             }
414         }
415
416         /// <summary>
417         /// Sets or Gets the last frame of the play
418         /// </summary>
419         /// <remarks>
420         /// Default value is FrameCount -1.
421         /// </remarks>
422         /// <since_tizen> preview </since_tizen>
423         [Obsolete("This has been deprecated in API12")]
424         public int MaxFrame
425         {
426             get
427             {
428                 return Interop.Elementary.elm_animation_view_max_frame_get(Handle);
429             }
430             set
431             {
432                 Interop.Elementary.elm_animation_view_max_frame_set(Handle, value);
433             }
434         }
435
436         /// <summary>
437         /// Sets the animation source file.
438         /// </summary>
439         /// <param name="file">The animation file path.</param>
440         /// <since_tizen> preview </since_tizen>
441         [Obsolete("This has been deprecated in API12")]
442         public void SetAnimation(string file)
443         {
444             Interop.Elementary.elm_animation_view_file_set(Handle, file, null);
445         }
446
447         /// <summary>
448         /// Play animation one time instantly when it's available.
449         /// <remarks>
450         /// If current keyframe is on a certain position by playing reverse, this will play forward from there.
451         /// Play request will be ignored if animation source is not set yet or animation is paused state or it's already on playing.
452         /// </remarks>
453         /// </summary>
454         /// <since_tizen> preview </since_tizen>
455         [Obsolete("This has been deprecated in API12")]
456         public void Play()
457         {
458             Interop.Elementary.elm_animation_view_play(Handle);
459         }
460
461         /// <summary>
462         /// Play animation one time instantly when it's available.
463         /// <remarks>
464         /// If current keyframe is on a certain position by playing reverse and isReverse is ture, this will play forward from there.
465         /// And if current keyframe is on a certain position by playing and isReverse is false, this will play backward from there.
466         /// Play request will be ignored if animation source is not set yet or animation is paused state or it's already on playing.
467         /// </remarks>
468         /// </summary>
469         /// <param name="isReverse">Whether the animation play or reverse play.</param>
470         /// <since_tizen> preview </since_tizen>
471         [Obsolete("This has been deprecated in API12")]
472         public void Play(bool isReverse)
473         {
474             if (!isReverse)
475             {
476                 Interop.Elementary.elm_animation_view_play(Handle);
477             }
478             else
479             {
480                 Interop.Elementary.elm_animation_view_play_back(Handle);
481             }
482         }
483
484         /// <summary>
485         /// Pause current animation instantly.
486         /// <remarks>
487         /// Once animation is paused, animation view must get resume to play continue again.
488         /// Animation must be on playing or playing back status.
489         /// </remarks>
490         /// </summary>
491         /// <since_tizen> preview </since_tizen>
492         [Obsolete("This has been deprecated in API12")]
493         public void Pause()
494         {
495             Interop.Elementary.elm_animation_view_pause(Handle);
496         }
497
498         /// <summary>
499         /// Resume paused animation to continue animation.
500         /// </summary>
501         /// <remarks>
502         /// This resume must be called on animation paused status.
503         /// </remarks>
504         /// <since_tizen> preview </since_tizen>
505         [Obsolete("This has been deprecated in API12")]
506         public void Resume()
507         {
508             Interop.Elementary.elm_animation_view_resume(Handle);
509         }
510
511         /// <summary>
512         /// Stop playing animation.
513         /// <remarks>
514         /// Stop animation instatly regardless of it's status and reset to
515         /// show first frame of animation.Even though current animation is paused,
516         /// the animation status will be stopped.
517         /// </remarks>
518         /// </summary>
519         /// <since_tizen> preview </since_tizen>
520         [Obsolete("This has been deprecated in API12")]
521         public void Stop()
522         {
523             Interop.Elementary.elm_animation_view_stop(Handle);
524         }
525
526         /// <summary>
527         /// Creates a AnimationView handle.
528         /// </summary>
529         /// <param name="parent">Parent EvasObject.</param>
530         /// <returns>Handle IntPtr.</returns>
531         /// <since_tizen> preview </since_tizen>
532         [Obsolete("This has been deprecated in API12")]
533         protected override IntPtr CreateHandle(EvasObject parent)
534         {
535             return Interop.Elementary.elm_animation_view_add(parent.Handle);
536         }
537     }
538 }