[NUI] TCSACR-226 code change (#1032)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Radian.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 namespace Tizen.NUI
19 {
20     /// <summary>
21     /// An angle in radians.
22     /// </summary>
23     /// <since_tizen> 3 </since_tizen>
24     public class Radian : Disposable
25     {
26         /// <summary>
27         /// swigCMemOwn
28         /// </summary>
29         /// <since_tizen> 3 </since_tizen>
30         protected bool swigCMemOwn;
31
32         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
33
34         /// <summary>
35         /// The default constructor, initializes to 0.
36         /// </summary>
37         /// <since_tizen> 3 </since_tizen>
38         public Radian() : this(Interop.Radian.new_Radian__SWIG_0(), true)
39         {
40             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
41         }
42
43         /// <summary>
44         /// Creates an angle in radians.
45         /// </summary>
46         /// <param name="value">The initial value in radians.</param>
47         /// <since_tizen> 3 </since_tizen>
48         public Radian(float value) : this(Interop.Radian.new_Radian__SWIG_1(value), true)
49         {
50             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
51         }
52
53         /// <summary>
54         /// Creates an angle in radians from an angle in degrees.
55         /// </summary>
56         /// <param name="degree">The initial value in degrees.</param>
57         /// <since_tizen> 3 </since_tizen>
58         public Radian(Degree degree) : this(Interop.Radian.new_Radian__SWIG_2(Degree.getCPtr(degree)), true)
59         {
60             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
61         }
62
63         internal Radian(global::System.IntPtr cPtr, bool cMemoryOwn)
64         {
65             swigCMemOwn = cMemoryOwn;
66             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
67         }
68
69         /// <summary>
70         /// The value in radians.
71         /// </summary>
72         /// <since_tizen> 3 </since_tizen>
73         public float Value
74         {
75             set
76             {
77                 Interop.Radian.Radian_radian_set(swigCPtr, value);
78                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79             }
80             get
81             {
82                 float ret = Interop.Radian.Radian_radian_get(swigCPtr);
83                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
84                 return ret;
85             }
86         }
87
88         /// <summary>
89         /// Conversion to float.
90         /// </summary>
91         /// <returns>The float value of this radian.</returns>
92         /// <since_tizen> 3 </since_tizen>
93         public float ConvertToFloat()
94         {
95             float ret = Interop.Radian.Radian_ConvertToFloat(swigCPtr);
96             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
97             return ret;
98         }
99
100         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Radian obj)
101         {
102             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
103         }
104
105         /// <summary>
106         /// Dispose.
107         /// </summary>
108         /// <since_tizen> 3 </since_tizen>
109         protected override void Dispose(DisposeTypes type)
110         {
111             if (disposed)
112             {
113                 return;
114             }
115
116             //Release your own unmanaged resources here.
117             //You should not access any managed member here except static instance.
118             //because the execution order of Finalizes is non-deterministic.
119
120             if (swigCPtr.Handle != global::System.IntPtr.Zero)
121             {
122                 if (swigCMemOwn)
123                 {
124                     swigCMemOwn = false;
125                     Interop.Radian.delete_Radian(swigCPtr);
126                 }
127                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
128             }
129             base.Dispose(type);
130         }
131     }
132 }