[NUI]Remove some unused APIs.
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Uint16Pair.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     //"Please do not use! this will be deprecated"
25     /// <summary>
26     /// Simple class for passing around pairs of small unsigned integers.<br />
27     /// Use this for integer dimensions and points with limited range such as image
28     /// sizes and pixel coordinates where a pair of floating point numbers is
29     /// inefficient and illogical (i.e.the data is inherently integer).<br />
30     /// One of these can be passed in a single 32 bit integer register on
31     /// common architectures.<br />
32     /// </summary>
33     /// <since_tizen> 3 </since_tizen>
34     internal class Uint16Pair : global::System.IDisposable
35     {
36         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
37         /// <summary>swigCMemOwn.</summary>
38         /// <since_tizen> 3 </since_tizen>
39         protected bool swigCMemOwn;
40
41         internal Uint16Pair(global::System.IntPtr cPtr, bool cMemoryOwn)
42         {
43             swigCMemOwn = cMemoryOwn;
44             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
45         }
46
47         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Uint16Pair obj)
48         {
49             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
50         }
51
52         //A Flag to check who called Dispose(). (By User or DisposeQueue)
53         private bool isDisposeQueued = false;
54         /// <summary>
55         /// A Flat to check if it is already disposed.
56         /// </summary>
57         /// <since_tizen> 3 </since_tizen>
58         protected bool disposed = false;
59
60         /// <summary>
61         /// Dispose.
62         /// </summary>
63         /// <since_tizen> 3 </since_tizen>
64         ~Uint16Pair()
65         {
66             if (!isDisposeQueued)
67             {
68                 isDisposeQueued = true;
69                 DisposeQueue.Instance.Add(this);
70             }
71         }
72
73         /// <summary>
74         /// Dispose.
75         /// </summary>
76         /// <since_tizen> 3 </since_tizen>
77         public void Dispose()
78         {
79             //Throw excpetion if Dispose() is called in separate thread.
80             if (!Window.IsInstalled())
81             {
82                 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
83             }
84
85             if (isDisposeQueued)
86             {
87                 Dispose(DisposeTypes.Implicit);
88             }
89             else
90             {
91                 Dispose(DisposeTypes.Explicit);
92                 System.GC.SuppressFinalize(this);
93             }
94         }
95
96         /// <summary>
97         /// Dispose.
98         /// </summary>
99         /// <since_tizen> 3 </since_tizen>
100         protected virtual void Dispose(DisposeTypes type)
101         {
102             if (disposed)
103             {
104                 return;
105             }
106
107             if (type == DisposeTypes.Explicit)
108             {
109                 //Called by User
110                 //Release your own managed resources here.
111                 //You should release all of your own disposable objects here.
112
113             }
114
115             //Release your own unmanaged resources here.
116             //You should not access any managed member here except static instance.
117             //because the execution order of Finalizes is non-deterministic.
118
119             if (swigCPtr.Handle != global::System.IntPtr.Zero)
120             {
121                 if (swigCMemOwn)
122                 {
123                     swigCMemOwn = false;
124                     NDalicPINVOKE.delete_Uint16Pair(swigCPtr);
125                 }
126                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
127             }
128
129             disposed = true;
130         }
131
132         /// <summary>
133         /// Less than comparison operator for storing in collections (not geometrically meaningful).
134         /// </summary>
135         /// <param name="arg1">A reference for comparison.</param>
136         /// <param name="arg2">A reference for comparison</param>
137         /// <return>True if arg1 less than arg2</return>
138         /// <since_tizen> 3 </since_tizen>
139         public static bool operator <(Uint16Pair arg1, Uint16Pair arg2)
140         {
141             return arg1.LessThan(arg2);
142         }
143
144         /// <summary>
145         /// More than comparison operator for storing in collections (not geometrically meaningful).
146         /// </summary>
147         /// <param name="arg1">A reference for comparison.</param>
148         /// <param name="arg2">A reference for comparison</param>
149         /// <return>True if arg1 > arg2</return>
150         /// <since_tizen> 3 </since_tizen>
151         public static bool operator >(Uint16Pair arg1, Uint16Pair arg2)
152         {
153             return arg1.GreaterThan(arg2);
154         }
155
156         /// <summary>
157         /// Default constructor for the(0, 0) tuple.
158         /// </summary>
159         /// <since_tizen> 3 </since_tizen>
160         public Uint16Pair() : this(NDalicPINVOKE.new_Uint16Pair__SWIG_0(), true)
161         {
162             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
163         }
164
165         /// <summary>
166         /// Default constructor for the(0, 0) tuple.
167         /// </summary>
168         /// <param name="width">The width or X dimension of the tuple. Make sure it is less than 65536.</param>
169         /// <param name="height">The height or Y dimension of the tuple.Make sure it is less than 65536.</param>
170         /// <since_tizen> 3 </since_tizen>
171         public Uint16Pair(uint width, uint height) : this(NDalicPINVOKE.new_Uint16Pair__SWIG_1(width, height), true)
172         {
173             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174         }
175
176         /// <summary>
177         /// Constructor taking separate x and y (width and height) parameters.
178         /// </summary>
179         /// <param name="rhs">A reference to assign.</param>
180         /// <since_tizen> 3 </since_tizen>
181         public Uint16Pair(Uint16Pair rhs) : this(NDalicPINVOKE.new_Uint16Pair__SWIG_2(Uint16Pair.getCPtr(rhs)), true)
182         {
183             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
184         }
185
186         /// <summary>
187         /// Sets the width.
188         /// </summary>
189         /// <param name="width">The x dimension to be stored in this 2-tuple.</param>
190         /// <since_tizen> 3 </since_tizen>
191         public void SetWidth(ushort width)
192         {
193             NDalicPINVOKE.Uint16Pair_SetWidth(swigCPtr, width);
194             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
195         }
196
197         /// <summary>
198         /// Get the width.
199         /// </summary>
200         /// <return>
201         /// The x dimension stored in this 2-tuple.
202         /// </return>
203         /// <since_tizen> 3 </since_tizen>
204         public ushort GetWidth()
205         {
206             ushort ret = NDalicPINVOKE.Uint16Pair_GetWidth(swigCPtr);
207             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
208             return ret;
209         }
210
211         /// <summary>
212         /// Sets the height.
213         /// </summary>
214         /// <param name="height">The y dimension to be stored in this 2-tuple.</param>
215         /// <since_tizen> 3 </since_tizen>
216         public void SetHeight(ushort height)
217         {
218             NDalicPINVOKE.Uint16Pair_SetHeight(swigCPtr, height);
219             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
220         }
221
222         /// <summary>
223         /// Get the height.
224         /// </summary>
225         /// <return>
226         /// The y dimension stored in this 2-tuple.
227         /// </return>
228         /// <since_tizen> 3 </since_tizen>
229         public ushort GetHeight()
230         {
231             ushort ret = NDalicPINVOKE.Uint16Pair_GetHeight(swigCPtr);
232             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
233             return ret;
234         }
235
236         /// <summary>
237         /// Sets the x dimension.
238         /// </summary>
239         /// <param name="x">The x dimension to be stored in this 2-tuple.</param>
240         /// <since_tizen> 3 </since_tizen>
241         public void SetX(ushort x)
242         {
243             NDalicPINVOKE.Uint16Pair_SetX(swigCPtr, x);
244             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
245         }
246
247         /// <summary>
248         /// Get the x dimension.
249         /// </summary>
250         /// <return>
251         /// The x dimension stored in this 2-tuple.
252         /// </return>
253         /// <since_tizen> 3 </since_tizen>
254         public ushort GetX()
255         {
256             ushort ret = NDalicPINVOKE.Uint16Pair_GetX(swigCPtr);
257             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
258             return ret;
259         }
260
261         /// <summary>
262         /// Sets the y dimension.
263         /// </summary>
264         /// <param name="y">The y dimension to be stored in this 2-tuple.</param>
265         /// <since_tizen> 3 </since_tizen>
266         public void SetY(ushort y)
267         {
268             NDalicPINVOKE.Uint16Pair_SetY(swigCPtr, y);
269             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
270         }
271
272         /// <summary>
273         /// Get the y dimension.
274         /// </summary>
275         /// <return>
276         /// The y dimension stored in this 2-tuple.
277         /// </return>
278         /// <since_tizen> 3 </since_tizen>
279         public ushort GetY()
280         {
281             ushort ret = NDalicPINVOKE.Uint16Pair_GetY(swigCPtr);
282             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
283             return ret;
284         }
285
286         /// <summary>
287         /// Constructor taking separate x and y (width and height) parameters.
288         /// </summary>
289         /// <param name="rhs">A reference to assign.</param>
290         /// <return>The created object.</return>
291         /// <since_tizen> 3 </since_tizen>
292         public Uint16Pair Assign(Uint16Pair rhs)
293         {
294             Uint16Pair ret = new Uint16Pair(NDalicPINVOKE.Uint16Pair_Assign(swigCPtr, Uint16Pair.getCPtr(rhs)), false);
295             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
296             return ret;
297         }
298
299         private bool EqualTo(Uint16Pair rhs)
300         {
301             bool ret = NDalicPINVOKE.Uint16Pair_EqualTo(swigCPtr, Uint16Pair.getCPtr(rhs));
302             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
303             return ret;
304         }
305
306         private bool NotEqualTo(Uint16Pair rhs)
307         {
308             bool ret = NDalicPINVOKE.Uint16Pair_NotEqualTo(swigCPtr, Uint16Pair.getCPtr(rhs));
309             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
310             return ret;
311         }
312
313         private bool LessThan(Uint16Pair rhs)
314         {
315             bool ret = NDalicPINVOKE.Uint16Pair_LessThan(swigCPtr, Uint16Pair.getCPtr(rhs));
316             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
317             return ret;
318         }
319
320         private bool GreaterThan(Uint16Pair rhs)
321         {
322             bool ret = NDalicPINVOKE.Uint16Pair_GreaterThan(swigCPtr, Uint16Pair.getCPtr(rhs));
323             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
324             return ret;
325         }
326
327     }
328
329 }