2 * Copyright(c) 2017 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 using System.ComponentModel;
24 //"Please do not use! this will be deprecated"
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 />
33 /// <since_tizen> 3 </since_tizen>
34 [EditorBrowsable(EditorBrowsableState.Never)]
35 public class Uint16Pair : global::System.IDisposable
37 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
38 /// <summary>swigCMemOwn.</summary>
39 /// <since_tizen> 3 </since_tizen>
40 protected bool swigCMemOwn;
42 internal Uint16Pair(global::System.IntPtr cPtr, bool cMemoryOwn)
44 swigCMemOwn = cMemoryOwn;
45 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
48 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Uint16Pair obj)
50 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
53 //A Flag to check who called Dispose(). (By User or DisposeQueue)
54 private bool isDisposeQueued = false;
56 /// A Flat to check if it is already disposed.
58 /// <since_tizen> 3 </since_tizen>
59 protected bool disposed = false;
64 /// <since_tizen> 3 </since_tizen>
69 isDisposeQueued = true;
70 DisposeQueue.Instance.Add(this);
77 /// <since_tizen> 3 </since_tizen>
80 //Throw excpetion if Dispose() is called in separate thread.
81 if (!Window.IsInstalled())
83 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
88 Dispose(DisposeTypes.Implicit);
92 Dispose(DisposeTypes.Explicit);
93 System.GC.SuppressFinalize(this);
100 /// <since_tizen> 3 </since_tizen>
101 protected virtual void Dispose(DisposeTypes type)
108 if (type == DisposeTypes.Explicit)
111 //Release your own managed resources here.
112 //You should release all of your own disposable objects here.
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.
120 if (swigCPtr.Handle != global::System.IntPtr.Zero)
125 NDalicPINVOKE.delete_Uint16Pair(swigCPtr);
127 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
134 /// Less than comparison operator for storing in collections (not geometrically meaningful).
136 /// <param name="arg1">A reference for comparison.</param>
137 /// <param name="arg2">A reference for comparison</param>
138 /// <return>True if arg1 less than arg2</return>
139 /// <since_tizen> 3 </since_tizen>
140 public static bool operator <(Uint16Pair arg1, Uint16Pair arg2)
142 return arg1.LessThan(arg2);
146 /// More than comparison operator for storing in collections (not geometrically meaningful).
148 /// <param name="arg1">A reference for comparison.</param>
149 /// <param name="arg2">A reference for comparison</param>
150 /// <return>True if arg1 > arg2</return>
151 /// <since_tizen> 3 </since_tizen>
152 public static bool operator >(Uint16Pair arg1, Uint16Pair arg2)
154 return arg1.GreaterThan(arg2);
158 /// Default constructor for the(0, 0) tuple.
160 /// <since_tizen> 3 </since_tizen>
161 public Uint16Pair() : this(NDalicPINVOKE.new_Uint16Pair__SWIG_0(), true)
163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167 /// Default constructor for the(0, 0) tuple.
169 /// <param name="width">The width or X dimension of the tuple. Make sure it is less than 65536.</param>
170 /// <param name="height">The height or Y dimension of the tuple.Make sure it is less than 65536.</param>
171 /// <since_tizen> 3 </since_tizen>
172 public Uint16Pair(uint width, uint height) : this(NDalicPINVOKE.new_Uint16Pair__SWIG_1(width, height), true)
174 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
178 /// Constructor taking separate x and y (width and height) parameters.
180 /// <param name="rhs">A reference to assign.</param>
181 /// <since_tizen> 3 </since_tizen>
182 public Uint16Pair(Uint16Pair rhs) : this(NDalicPINVOKE.new_Uint16Pair__SWIG_2(Uint16Pair.getCPtr(rhs)), true)
184 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
190 /// <param name="width">The x dimension to be stored in this 2-tuple.</param>
191 /// <since_tizen> 3 </since_tizen>
192 public void SetWidth(ushort width)
194 NDalicPINVOKE.Uint16Pair_SetWidth(swigCPtr, width);
195 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
202 /// The x dimension stored in this 2-tuple.
204 /// <since_tizen> 3 </since_tizen>
205 public ushort GetWidth()
207 ushort ret = NDalicPINVOKE.Uint16Pair_GetWidth(swigCPtr);
208 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
215 /// <param name="height">The y dimension to be stored in this 2-tuple.</param>
216 /// <since_tizen> 3 </since_tizen>
217 public void SetHeight(ushort height)
219 NDalicPINVOKE.Uint16Pair_SetHeight(swigCPtr, height);
220 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
227 /// The y dimension stored in this 2-tuple.
229 /// <since_tizen> 3 </since_tizen>
230 public ushort GetHeight()
232 ushort ret = NDalicPINVOKE.Uint16Pair_GetHeight(swigCPtr);
233 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
238 /// Sets the x dimension.
240 /// <param name="x">The x dimension to be stored in this 2-tuple.</param>
241 /// <since_tizen> 3 </since_tizen>
242 public void SetX(ushort x)
244 NDalicPINVOKE.Uint16Pair_SetX(swigCPtr, x);
245 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
249 /// Get the x dimension.
252 /// The x dimension stored in this 2-tuple.
254 /// <since_tizen> 3 </since_tizen>
257 ushort ret = NDalicPINVOKE.Uint16Pair_GetX(swigCPtr);
258 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
263 /// Sets the y dimension.
265 /// <param name="y">The y dimension to be stored in this 2-tuple.</param>
266 /// <since_tizen> 3 </since_tizen>
267 public void SetY(ushort y)
269 NDalicPINVOKE.Uint16Pair_SetY(swigCPtr, y);
270 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
274 /// Get the y dimension.
277 /// The y dimension stored in this 2-tuple.
279 /// <since_tizen> 3 </since_tizen>
282 ushort ret = NDalicPINVOKE.Uint16Pair_GetY(swigCPtr);
283 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
288 /// Constructor taking separate x and y (width and height) parameters.
290 /// <param name="rhs">A reference to assign.</param>
291 /// <return>The created object.</return>
292 /// <since_tizen> 3 </since_tizen>
293 public Uint16Pair Assign(Uint16Pair rhs)
295 Uint16Pair ret = new Uint16Pair(NDalicPINVOKE.Uint16Pair_Assign(swigCPtr, Uint16Pair.getCPtr(rhs)), false);
296 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
300 private bool EqualTo(Uint16Pair rhs)
302 bool ret = NDalicPINVOKE.Uint16Pair_EqualTo(swigCPtr, Uint16Pair.getCPtr(rhs));
303 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
307 private bool NotEqualTo(Uint16Pair rhs)
309 bool ret = NDalicPINVOKE.Uint16Pair_NotEqualTo(swigCPtr, Uint16Pair.getCPtr(rhs));
310 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
314 private bool LessThan(Uint16Pair rhs)
316 bool ret = NDalicPINVOKE.Uint16Pair_LessThan(swigCPtr, Uint16Pair.getCPtr(rhs));
317 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
321 private bool GreaterThan(Uint16Pair rhs)
323 bool ret = NDalicPINVOKE.Uint16Pair_GreaterThan(swigCPtr, Uint16Pair.getCPtr(rhs));
324 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();