Release 4.0.0-preview1-00301
[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
20 namespace Tizen.NUI
21 {
22
23     /// <summary>
24     /// A set of key frames for a property that can be animated using DALi animation.<br />
25     /// This allows the generation of key frame objects from individual Property::Values.<br />
26     /// </summary>
27     public class KeyFrames : BaseHandle
28     {
29         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
30
31         internal KeyFrames(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.KeyFrames_SWIGUpcast(cPtr), cMemoryOwn)
32         {
33             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
34         }
35
36         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(KeyFrames obj)
37         {
38             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
39         }
40
41         /// <summary>
42         /// Dispose.
43         /// </summary>
44         /// <since_tizen> 3 </since_tizen>
45         protected override void Dispose(DisposeTypes type)
46         {
47             if(disposed)
48             {
49                 return;
50             }
51
52             if(type == DisposeTypes.Explicit)
53             {
54                 //Called by User
55                 //Release your own managed resources here.
56                 //You should release all of your own disposable objects here.
57             }
58
59             //Release your own unmanaged resources here.
60             //You should not access any managed member here except static instance.
61             //because the execution order of Finalizes is non-deterministic.
62
63             if (swigCPtr.Handle != global::System.IntPtr.Zero)
64             {
65                 if (swigCMemOwn)
66                 {
67                     swigCMemOwn = false;
68                     NDalicPINVOKE.delete_KeyFrames(swigCPtr);
69                 }
70                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
71             }
72
73             base.Dispose(type);
74         }
75
76
77
78         /// <summary>
79         /// Adds a key frame.
80         /// </summary>
81         /// <param name="progress">A progress value between 0.0 and 1.0.</param>
82         /// <param name="value">A value.</param>
83         /// <since_tizen> 3 </since_tizen>
84         public void Add(float progress, object value)
85         {
86             PropertyValue val = PropertyValue.CreateFromObject(value);
87             Add(progress, val);
88         }
89
90         /// <summary>
91         /// Adds a key frame.
92         /// </summary>
93         /// <param name="progress">A progress value between 0.0 and 1.0.</param>
94         /// <param name="value">A value</param>
95         /// <param name="alpha">The alpha function used to blend to the next keyframe.</param>
96         /// <since_tizen> 3 </since_tizen>
97         public void Add(float progress, object value, AlphaFunction alpha)
98         {
99             PropertyValue val = PropertyValue.CreateFromObject(value);
100             Add(progress, val, alpha);
101         }
102
103         /// <summary>
104         /// Creates an initialized KeyFrames handle.
105         /// </summary>
106         /// <since_tizen> 3 </since_tizen>
107         public KeyFrames() : this(NDalicPINVOKE.KeyFrames_New(), true)
108         {
109             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
110
111         }
112
113         /// <summary>
114         /// [Obsolete("Please do not use! this will be deprecated")]
115         /// </summary>
116         /// <since_tizen> 3 </since_tizen>
117         [Obsolete("Please do not use! this will be deprecated")]
118         public static KeyFrames DownCast(BaseHandle handle)
119         {
120             KeyFrames ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as KeyFrames;
121             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
122             return ret;
123         }
124
125         /// <summary>
126         /// Gets the type of the key frame.
127         /// </summary>
128         /// <returns>The key frame property type</returns>
129         /// <since_tizen> 3 </since_tizen>
130         public new PropertyType GetType()
131         {
132             PropertyType ret = (PropertyType)NDalicPINVOKE.KeyFrames_GetType(swigCPtr);
133             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
134             return ret;
135         }
136
137         /// <summary>
138         /// Adds a key frame.
139         /// </summary>
140         /// <param name="progress">A progress value between 0.0 and 1.0.</param>
141         /// <param name="value">A value.</param>
142         /// <since_tizen> 3 </since_tizen>
143         public void Add(float progress, PropertyValue value)
144         {
145             NDalicPINVOKE.KeyFrames_Add__SWIG_0(swigCPtr, progress, PropertyValue.getCPtr(value));
146             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
147         }
148
149         /// <summary>
150         /// Adds a key frame.
151         /// </summary>
152         /// <param name="progress">A progress value between 0.0 and 1.0.</param>
153         /// <param name="value">A value.</param>
154         /// <param name="alpha">The alpha function used to blend to the next keyframe.</param>
155         /// <since_tizen> 3 </since_tizen>
156         public void Add(float progress, PropertyValue value, AlphaFunction alpha)
157         {
158             NDalicPINVOKE.KeyFrames_Add__SWIG_1(swigCPtr, progress, PropertyValue.getCPtr(value), AlphaFunction.getCPtr(alpha));
159             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
160         }
161
162     }
163
164 }