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