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