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