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 [Obsolete("Please do not use! This will be deprecated!")]
35 [EditorBrowsable(EditorBrowsableState.Never)]
36 public class Uint16Pair : global::System.IDisposable
38 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
39 /// <summary>swigCMemOwn.</summary>
40 /// <since_tizen> 3 </since_tizen>
41 protected bool swigCMemOwn;
43 internal Uint16Pair(global::System.IntPtr cPtr, bool cMemoryOwn)
45 swigCMemOwn = cMemoryOwn;
46 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
49 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Uint16Pair obj)
51 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
54 //A Flag to check who called Dispose(). (By User or DisposeQueue)
55 private bool isDisposeQueued = false;
57 /// A Flat to check if it is already disposed.
59 /// <since_tizen> 3 </since_tizen>
60 protected bool disposed = false;
65 /// <since_tizen> 3 </since_tizen>
70 isDisposeQueued = true;
71 DisposeQueue.Instance.Add(this);
78 /// <since_tizen> 3 </since_tizen>
81 //Throw excpetion if Dispose() is called in separate thread.
82 if (!Window.IsInstalled())
84 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
89 Dispose(DisposeTypes.Implicit);
93 Dispose(DisposeTypes.Explicit);
94 System.GC.SuppressFinalize(this);
101 /// <since_tizen> 3 </since_tizen>
102 protected virtual void Dispose(DisposeTypes type)
109 if (type == DisposeTypes.Explicit)
112 //Release your own managed resources here.
113 //You should release all of your own disposable objects here.
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.
121 if (swigCPtr.Handle != global::System.IntPtr.Zero)
126 NDalicPINVOKE.delete_Uint16Pair(swigCPtr);
128 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
135 /// Less than comparison operator for storing in collections (not geometrically meaningful).
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)
143 return arg1.LessThan(arg2);
147 /// More than comparison operator for storing in collections (not geometrically meaningful).
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)
155 return arg1.GreaterThan(arg2);
159 /// Default constructor for the(0, 0) tuple.
161 /// <since_tizen> 3 </since_tizen>
162 public Uint16Pair() : this(NDalicPINVOKE.new_Uint16Pair__SWIG_0(), true)
164 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168 /// Default constructor for the(0, 0) tuple.
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)
175 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179 /// Constructor taking separate x and y (width and height) parameters.
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)
185 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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)
195 NDalicPINVOKE.Uint16Pair_SetWidth(swigCPtr, width);
196 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203 /// The x dimension stored in this 2-tuple.
205 /// <since_tizen> 3 </since_tizen>
206 public ushort GetWidth()
208 ushort ret = NDalicPINVOKE.Uint16Pair_GetWidth(swigCPtr);
209 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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)
220 NDalicPINVOKE.Uint16Pair_SetHeight(swigCPtr, height);
221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228 /// The y dimension stored in this 2-tuple.
230 /// <since_tizen> 3 </since_tizen>
231 public ushort GetHeight()
233 ushort ret = NDalicPINVOKE.Uint16Pair_GetHeight(swigCPtr);
234 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
239 /// Sets the x dimension.
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)
245 NDalicPINVOKE.Uint16Pair_SetX(swigCPtr, x);
246 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
250 /// Get the x dimension.
253 /// The x dimension stored in this 2-tuple.
255 /// <since_tizen> 3 </since_tizen>
258 ushort ret = NDalicPINVOKE.Uint16Pair_GetX(swigCPtr);
259 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
264 /// Sets the y dimension.
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)
270 NDalicPINVOKE.Uint16Pair_SetY(swigCPtr, y);
271 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
275 /// Get the y dimension.
278 /// The y dimension stored in this 2-tuple.
280 /// <since_tizen> 3 </since_tizen>
283 ushort ret = NDalicPINVOKE.Uint16Pair_GetY(swigCPtr);
284 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
289 /// Constructor taking separate x and y (width and height) parameters.
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)
296 Uint16Pair ret = new Uint16Pair(NDalicPINVOKE.Uint16Pair_Assign(swigCPtr, Uint16Pair.getCPtr(rhs)), false);
297 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
301 private bool EqualTo(Uint16Pair rhs)
303 bool ret = NDalicPINVOKE.Uint16Pair_EqualTo(swigCPtr, Uint16Pair.getCPtr(rhs));
304 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
308 private bool NotEqualTo(Uint16Pair rhs)
310 bool ret = NDalicPINVOKE.Uint16Pair_NotEqualTo(swigCPtr, Uint16Pair.getCPtr(rhs));
311 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
315 private bool LessThan(Uint16Pair rhs)
317 bool ret = NDalicPINVOKE.Uint16Pair_LessThan(swigCPtr, Uint16Pair.getCPtr(rhs));
318 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
322 private bool GreaterThan(Uint16Pair rhs)
324 bool ret = NDalicPINVOKE.Uint16Pair_GreaterThan(swigCPtr, Uint16Pair.getCPtr(rhs));
325 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();