/* * Copyright(c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ using System; using System.ComponentModel; namespace Tizen.NUI { //"Please do not use! this will be deprecated" /// /// Simple class for passing around pairs of small unsigned integers.
/// Use this for integer dimensions and points with limited range such as image /// sizes and pixel coordinates where a pair of floating point numbers is /// inefficient and illogical (i.e.the data is inherently integer).
/// One of these can be passed in a single 32 bit integer register on /// common architectures.
///
/// 3 [Obsolete("Please do not use! This will be deprecated!")] [EditorBrowsable(EditorBrowsableState.Never)] public class Uint16Pair : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; /// swigCMemOwn. /// 3 protected bool swigCMemOwn; internal Uint16Pair(global::System.IntPtr cPtr, bool cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Uint16Pair obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; /// /// A Flat to check if it is already disposed. /// /// 3 protected bool disposed = false; /// /// Dispose. /// /// 3 ~Uint16Pair() { if (!isDisposeQueued) { isDisposeQueued = true; DisposeQueue.Instance.Add(this); } } /// /// Dispose. /// /// 3 public void Dispose() { //Throw excpetion if Dispose() is called in separate thread. if (!Window.IsInstalled()) { throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); } if (isDisposeQueued) { Dispose(DisposeTypes.Implicit); } else { Dispose(DisposeTypes.Explicit); System.GC.SuppressFinalize(this); } } /// /// Dispose. /// /// 3 protected virtual void Dispose(DisposeTypes type) { if (disposed) { return; } if (type == DisposeTypes.Explicit) { //Called by User //Release your own managed resources here. //You should release all of your own disposable objects here. } //Release your own unmanaged resources here. //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) { swigCMemOwn = false; NDalicPINVOKE.delete_Uint16Pair(swigCPtr); } swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } disposed = true; } /// /// Less than comparison operator for storing in collections (not geometrically meaningful). /// /// A reference for comparison. /// A reference for comparison /// True if arg1 less than arg2 /// 3 public static bool operator <(Uint16Pair arg1, Uint16Pair arg2) { return arg1.LessThan(arg2); } /// /// More than comparison operator for storing in collections (not geometrically meaningful). /// /// A reference for comparison. /// A reference for comparison /// True if arg1 > arg2 /// 3 public static bool operator >(Uint16Pair arg1, Uint16Pair arg2) { return arg1.GreaterThan(arg2); } /// /// Default constructor for the(0, 0) tuple. /// /// 3 public Uint16Pair() : this(NDalicPINVOKE.new_Uint16Pair__SWIG_0(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Default constructor for the(0, 0) tuple. /// /// The width or X dimension of the tuple. Make sure it is less than 65536. /// The height or Y dimension of the tuple.Make sure it is less than 65536. /// 3 public Uint16Pair(uint width, uint height) : this(NDalicPINVOKE.new_Uint16Pair__SWIG_1(width, height), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Constructor taking separate x and y (width and height) parameters. /// /// A reference to assign. /// 3 public Uint16Pair(Uint16Pair rhs) : this(NDalicPINVOKE.new_Uint16Pair__SWIG_2(Uint16Pair.getCPtr(rhs)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the width. /// /// The x dimension to be stored in this 2-tuple. /// 3 public void SetWidth(ushort width) { NDalicPINVOKE.Uint16Pair_SetWidth(swigCPtr, width); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Get the width. /// /// /// The x dimension stored in this 2-tuple. /// /// 3 public ushort GetWidth() { ushort ret = NDalicPINVOKE.Uint16Pair_GetWidth(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Sets the height. /// /// The y dimension to be stored in this 2-tuple. /// 3 public void SetHeight(ushort height) { NDalicPINVOKE.Uint16Pair_SetHeight(swigCPtr, height); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Get the height. /// /// /// The y dimension stored in this 2-tuple. /// /// 3 public ushort GetHeight() { ushort ret = NDalicPINVOKE.Uint16Pair_GetHeight(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Sets the x dimension. /// /// The x dimension to be stored in this 2-tuple. /// 3 public void SetX(ushort x) { NDalicPINVOKE.Uint16Pair_SetX(swigCPtr, x); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Get the x dimension. /// /// /// The x dimension stored in this 2-tuple. /// /// 3 public ushort GetX() { ushort ret = NDalicPINVOKE.Uint16Pair_GetX(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Sets the y dimension. /// /// The y dimension to be stored in this 2-tuple. /// 3 public void SetY(ushort y) { NDalicPINVOKE.Uint16Pair_SetY(swigCPtr, y); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Get the y dimension. /// /// /// The y dimension stored in this 2-tuple. /// /// 3 public ushort GetY() { ushort ret = NDalicPINVOKE.Uint16Pair_GetY(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Constructor taking separate x and y (width and height) parameters. /// /// A reference to assign. /// The created object. /// 3 public Uint16Pair Assign(Uint16Pair rhs) { Uint16Pair ret = new Uint16Pair(NDalicPINVOKE.Uint16Pair_Assign(swigCPtr, Uint16Pair.getCPtr(rhs)), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private bool EqualTo(Uint16Pair rhs) { bool ret = NDalicPINVOKE.Uint16Pair_EqualTo(swigCPtr, Uint16Pair.getCPtr(rhs)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private bool NotEqualTo(Uint16Pair rhs) { bool ret = NDalicPINVOKE.Uint16Pair_NotEqualTo(swigCPtr, Uint16Pair.getCPtr(rhs)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private bool LessThan(Uint16Pair rhs) { bool ret = NDalicPINVOKE.Uint16Pair_LessThan(swigCPtr, Uint16Pair.getCPtr(rhs)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } private bool GreaterThan(Uint16Pair rhs) { bool ret = NDalicPINVOKE.Uint16Pair_GreaterThan(swigCPtr, Uint16Pair.getCPtr(rhs)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } } }