Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Uint16Pair.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16
17 using System;
18
19 namespace Tizen.NUI
20 {
21
22     [Obsolete("Please do not use! this will be deprecated")]
23     public class Uint16Pair : global::System.IDisposable
24     {
25         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
26         protected bool swigCMemOwn;
27
28         internal Uint16Pair(global::System.IntPtr cPtr, bool cMemoryOwn)
29         {
30             swigCMemOwn = cMemoryOwn;
31             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
32         }
33
34         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Uint16Pair obj)
35         {
36             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
37         }
38
39         //A Flag to check who called Dispose(). (By User or DisposeQueue)
40         private bool isDisposeQueued = false;
41         //A Flat to check if it is already disposed.
42         protected bool disposed = false;
43
44
45         ~Uint16Pair()
46         {
47             if (!isDisposeQueued)
48             {
49                 isDisposeQueued = true;
50                 DisposeQueue.Instance.Add(this);
51             }
52         }
53
54         public void Dispose()
55         {
56             //Throw excpetion if Dispose() is called in separate thread.
57             if (!Window.IsInstalled())
58             {
59                 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
60             }
61
62             if (isDisposeQueued)
63             {
64                 Dispose(DisposeTypes.Implicit);
65             }
66             else
67             {
68                 Dispose(DisposeTypes.Explicit);
69                 System.GC.SuppressFinalize(this);
70             }
71         }
72
73         protected virtual void Dispose(DisposeTypes type)
74         {
75             if (disposed)
76             {
77                 return;
78             }
79
80             if (type == DisposeTypes.Explicit)
81             {
82                 //Called by User
83                 //Release your own managed resources here.
84                 //You should release all of your own disposable objects here.
85
86             }
87
88             //Release your own unmanaged resources here.
89             //You should not access any managed member here except static instance.
90             //because the execution order of Finalizes is non-deterministic.
91
92             if (swigCPtr.Handle != global::System.IntPtr.Zero)
93             {
94                 if (swigCMemOwn)
95                 {
96                     swigCMemOwn = false;
97                     NDalicPINVOKE.delete_Uint16Pair(swigCPtr);
98                 }
99                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
100             }
101
102             disposed = true;
103         }
104
105
106         public static bool operator <(Uint16Pair arg1, Uint16Pair arg2)
107         {
108             return arg1.LessThan(arg2);
109         }
110
111         public static bool operator >(Uint16Pair arg1, Uint16Pair arg2)
112         {
113             return arg1.GreaterThan(arg2);
114         }
115
116         public Uint16Pair() : this(NDalicPINVOKE.new_Uint16Pair__SWIG_0(), true)
117         {
118             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119         }
120
121         public Uint16Pair(uint width, uint height) : this(NDalicPINVOKE.new_Uint16Pair__SWIG_1(width, height), true)
122         {
123             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124         }
125
126         public Uint16Pair(Uint16Pair rhs) : this(NDalicPINVOKE.new_Uint16Pair__SWIG_2(Uint16Pair.getCPtr(rhs)), true)
127         {
128             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
129         }
130
131         public void SetWidth(ushort width)
132         {
133             NDalicPINVOKE.Uint16Pair_SetWidth(swigCPtr, width);
134             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
135         }
136
137         public ushort GetWidth()
138         {
139             ushort ret = NDalicPINVOKE.Uint16Pair_GetWidth(swigCPtr);
140             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
141             return ret;
142         }
143
144         public void SetHeight(ushort height)
145         {
146             NDalicPINVOKE.Uint16Pair_SetHeight(swigCPtr, height);
147             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
148         }
149
150         public ushort GetHeight()
151         {
152             ushort ret = NDalicPINVOKE.Uint16Pair_GetHeight(swigCPtr);
153             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154             return ret;
155         }
156
157         public void SetX(ushort x)
158         {
159             NDalicPINVOKE.Uint16Pair_SetX(swigCPtr, x);
160             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161         }
162
163         public ushort GetX()
164         {
165             ushort ret = NDalicPINVOKE.Uint16Pair_GetX(swigCPtr);
166             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167             return ret;
168         }
169
170         public void SetY(ushort y)
171         {
172             NDalicPINVOKE.Uint16Pair_SetY(swigCPtr, y);
173             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174         }
175
176         public ushort GetY()
177         {
178             ushort ret = NDalicPINVOKE.Uint16Pair_GetY(swigCPtr);
179             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180             return ret;
181         }
182
183         public Uint16Pair Assign(Uint16Pair rhs)
184         {
185             Uint16Pair ret = new Uint16Pair(NDalicPINVOKE.Uint16Pair_Assign(swigCPtr, Uint16Pair.getCPtr(rhs)), false);
186             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
187             return ret;
188         }
189
190         private bool EqualTo(Uint16Pair rhs)
191         {
192             bool ret = NDalicPINVOKE.Uint16Pair_EqualTo(swigCPtr, Uint16Pair.getCPtr(rhs));
193             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
194             return ret;
195         }
196
197         private bool NotEqualTo(Uint16Pair rhs)
198         {
199             bool ret = NDalicPINVOKE.Uint16Pair_NotEqualTo(swigCPtr, Uint16Pair.getCPtr(rhs));
200             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
201             return ret;
202         }
203
204         private bool LessThan(Uint16Pair rhs)
205         {
206             bool ret = NDalicPINVOKE.Uint16Pair_LessThan(swigCPtr, Uint16Pair.getCPtr(rhs));
207             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
208             return ret;
209         }
210
211         private bool GreaterThan(Uint16Pair rhs)
212         {
213             bool ret = NDalicPINVOKE.Uint16Pair_GreaterThan(swigCPtr, Uint16Pair.getCPtr(rhs));
214             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
215             return ret;
216         }
217
218     }
219
220 }