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