[NUI] Refactor dispose pattern to reduce duplication (#1112)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / KeyFrames.cs
1 /*
2  * Copyright(c) 2017 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 using System;
19 using System.ComponentModel;
20
21 namespace Tizen.NUI
22 {
23
24     /// <summary>
25     /// A set of key frames for a property that can be animated using DALi animation.<br />
26     /// This allows the generation of key frame objects from individual Property::Values.<br />
27     /// </summary>
28     /// <since_tizen> 3 </since_tizen>
29     public class KeyFrames : BaseHandle
30     {
31
32         /// <summary>
33         /// Creates an initialized KeyFrames handle.
34         /// </summary>
35         /// <since_tizen> 3 </since_tizen>
36         public KeyFrames() : this(Interop.KeyFrames.KeyFrames_New(), true)
37         {
38             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
39
40         }
41
42         internal KeyFrames(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.KeyFrames.KeyFrames_SWIGUpcast(cPtr), cMemoryOwn)
43         {
44         }
45
46         /// <summary>
47         /// Adds a key frame.
48         /// </summary>
49         /// <param name="progress">A progress value between 0.0 and 1.0.</param>
50         /// <param name="value">A value.</param>
51         /// <since_tizen> 3 </since_tizen>
52         public void Add(float progress, object value)
53         {
54             PropertyValue val = PropertyValue.CreateFromObject(value);
55             Add(progress, val);
56         }
57
58         /// <summary>
59         /// Adds a key frame.
60         /// </summary>
61         /// <param name="progress">A progress value between 0.0 and 1.0.</param>
62         /// <param name="value">A value</param>
63         /// <param name="alpha">The alpha function used to blend to the next keyframe.</param>
64         /// <since_tizen> 3 </since_tizen>
65         public void Add(float progress, object value, AlphaFunction alpha)
66         {
67             PropertyValue val = PropertyValue.CreateFromObject(value);
68             Add(progress, val, alpha);
69         }
70
71         /// <summary>
72         /// Gets the type of the key frame.
73         /// </summary>
74         /// <returns>The key frame property type</returns>
75         /// <since_tizen> 3 </since_tizen>
76         public new PropertyType GetType()
77         {
78             PropertyType ret = (PropertyType)Interop.KeyFrames.KeyFrames_GetType(swigCPtr);
79             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
80             return ret;
81         }
82
83         /// <summary>
84         /// Adds a key frame.
85         /// </summary>
86         /// <param name="progress">A progress value between 0.0 and 1.0.</param>
87         /// <param name="value">A value.</param>
88         /// <since_tizen> 3 </since_tizen>
89         public void Add(float progress, PropertyValue value)
90         {
91             Interop.KeyFrames.KeyFrames_Add__SWIG_0(swigCPtr, progress, PropertyValue.getCPtr(value));
92             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93         }
94
95         /// <summary>
96         /// Adds a key frame.
97         /// </summary>
98         /// <param name="progress">A progress value between 0.0 and 1.0.</param>
99         /// <param name="value">A value.</param>
100         /// <param name="alpha">The alpha function used to blend to the next keyframe.</param>
101         /// <since_tizen> 3 </since_tizen>
102         public void Add(float progress, PropertyValue value, AlphaFunction alpha)
103         {
104             Interop.KeyFrames.KeyFrames_Add__SWIG_1(swigCPtr, progress, PropertyValue.getCPtr(value), AlphaFunction.getCPtr(alpha));
105             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106         }
107
108         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(KeyFrames obj)
109         {
110             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
111         }
112
113         /// This will not be public opened.
114         [EditorBrowsable(EditorBrowsableState.Never)]
115         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
116         {
117             Interop.KeyFrames.delete_KeyFrames(swigCPtr);
118         }
119     }
120 }