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 internal class Uint16Pair : global::System.IDisposable
36 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
37 /// <summary>swigCMemOwn.</summary>
38 /// <since_tizen> 3 </since_tizen>
39 protected bool swigCMemOwn;
41 internal Uint16Pair(global::System.IntPtr cPtr, bool cMemoryOwn)
43 swigCMemOwn = cMemoryOwn;
44 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
47 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Uint16Pair obj)
49 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
52 //A Flag to check who called Dispose(). (By User or DisposeQueue)
53 private bool isDisposeQueued = false;
55 /// A Flat to check if it is already disposed.
57 /// <since_tizen> 3 </since_tizen>
58 protected bool disposed = false;
63 /// <since_tizen> 3 </since_tizen>
68 isDisposeQueued = true;
69 DisposeQueue.Instance.Add(this);
76 /// <since_tizen> 3 </since_tizen>
79 //Throw excpetion if Dispose() is called in separate thread.
80 if (!Window.IsInstalled())
82 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
87 Dispose(DisposeTypes.Implicit);
91 Dispose(DisposeTypes.Explicit);
92 System.GC.SuppressFinalize(this);
99 /// <since_tizen> 3 </since_tizen>
100 protected virtual void Dispose(DisposeTypes type)
107 if (type == DisposeTypes.Explicit)
110 //Release your own managed resources here.
111 //You should release all of your own disposable objects here.
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.
119 if (swigCPtr.Handle != global::System.IntPtr.Zero)
124 NDalicPINVOKE.delete_Uint16Pair(swigCPtr);
126 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
133 /// Less than comparison operator for storing in collections (not geometrically meaningful).
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)
141 return arg1.LessThan(arg2);
145 /// More than comparison operator for storing in collections (not geometrically meaningful).
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)
153 return arg1.GreaterThan(arg2);
157 /// Default constructor for the(0, 0) tuple.
159 /// <since_tizen> 3 </since_tizen>
160 public Uint16Pair() : this(NDalicPINVOKE.new_Uint16Pair__SWIG_0(), true)
162 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166 /// Default constructor for the(0, 0) tuple.
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)
173 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177 /// Constructor taking separate x and y (width and height) parameters.
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)
183 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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)
193 NDalicPINVOKE.Uint16Pair_SetWidth(swigCPtr, width);
194 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
201 /// The x dimension stored in this 2-tuple.
203 /// <since_tizen> 3 </since_tizen>
204 public ushort GetWidth()
206 ushort ret = NDalicPINVOKE.Uint16Pair_GetWidth(swigCPtr);
207 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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)
218 NDalicPINVOKE.Uint16Pair_SetHeight(swigCPtr, height);
219 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
226 /// The y dimension stored in this 2-tuple.
228 /// <since_tizen> 3 </since_tizen>
229 public ushort GetHeight()
231 ushort ret = NDalicPINVOKE.Uint16Pair_GetHeight(swigCPtr);
232 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
237 /// Sets the x dimension.
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)
243 NDalicPINVOKE.Uint16Pair_SetX(swigCPtr, x);
244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
248 /// Get the x dimension.
251 /// The x dimension stored in this 2-tuple.
253 /// <since_tizen> 3 </since_tizen>
256 ushort ret = NDalicPINVOKE.Uint16Pair_GetX(swigCPtr);
257 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
262 /// Sets the y dimension.
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)
268 NDalicPINVOKE.Uint16Pair_SetY(swigCPtr, y);
269 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
273 /// Get the y dimension.
276 /// The y dimension stored in this 2-tuple.
278 /// <since_tizen> 3 </since_tizen>
281 ushort ret = NDalicPINVOKE.Uint16Pair_GetY(swigCPtr);
282 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
287 /// Constructor taking separate x and y (width and height) parameters.
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)
294 Uint16Pair ret = new Uint16Pair(NDalicPINVOKE.Uint16Pair_Assign(swigCPtr, Uint16Pair.getCPtr(rhs)), false);
295 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
299 private bool EqualTo(Uint16Pair rhs)
301 bool ret = NDalicPINVOKE.Uint16Pair_EqualTo(swigCPtr, Uint16Pair.getCPtr(rhs));
302 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
306 private bool NotEqualTo(Uint16Pair rhs)
308 bool ret = NDalicPINVOKE.Uint16Pair_NotEqualTo(swigCPtr, Uint16Pair.getCPtr(rhs));
309 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
313 private bool LessThan(Uint16Pair rhs)
315 bool ret = NDalicPINVOKE.Uint16Pair_LessThan(swigCPtr, Uint16Pair.getCPtr(rhs));
316 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
320 private bool GreaterThan(Uint16Pair rhs)
322 bool ret = NDalicPINVOKE.Uint16Pair_GreaterThan(swigCPtr, Uint16Pair.getCPtr(rhs));
323 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();