*
*/
-namespace Tizen.NUI\r
-{\r
-\r
+namespace Tizen.NUI
+{
+
/// <summary>
/// Position2D is a two dimensional vector.
/// </summary>
- public class Position2D : global::System.IDisposable\r
- {\r
- private global::System.Runtime.InteropServices.HandleRef swigCPtr;\r
- protected bool swigCMemOwn;\r
-\r
- internal Position2D(global::System.IntPtr cPtr, bool cMemoryOwn)\r
- {\r
- swigCMemOwn = cMemoryOwn;\r
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);\r
- }\r
-\r
- internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Position2D obj)\r
- {\r
- return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;\r
- }\r
-\r
- //A Flag to check who called Dispose(). (By User or DisposeQueue)\r
- private bool isDisposeQueued = false;\r
- //A Flat to check if it is already disposed.\r
- protected bool disposed = false;\r
-\r
- ~Position2D()\r
- {\r
- if (!isDisposeQueued)\r
- {\r
- isDisposeQueued = true;\r
- DisposeQueue.Instance.Add(this);\r
- }\r
- }\r
-\r
- public void Dispose()\r
- {\r
- //Throw excpetion if Dispose() is called in separate thread.\r
- if (!Window.IsInstalled())\r
- {\r
- throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");\r
- }\r
-\r
- if (isDisposeQueued)\r
- {\r
- Dispose(DisposeTypes.Implicit);\r
- }\r
- else\r
- {\r
- Dispose(DisposeTypes.Explicit);\r
- System.GC.SuppressFinalize(this);\r
- }\r
- }\r
-\r
- protected virtual void Dispose(DisposeTypes type)\r
- {\r
- if (disposed)\r
- {\r
- return;\r
- }\r
-\r
- if (type == DisposeTypes.Explicit)\r
- {\r
- //Called by User\r
- //Release your own managed resources here.\r
- //You should release all of your own disposable objects here.\r
- }\r
-\r
- //Release your own unmanaged resources here.\r
- //You should not access any managed member here except static instance.\r
- //because the execution order of Finalizes is non-deterministic.\r
-\r
- if (swigCPtr.Handle != global::System.IntPtr.Zero)\r
- {\r
- if (swigCMemOwn)\r
- {\r
- swigCMemOwn = false;\r
- NDalicPINVOKE.delete_Vector2(swigCPtr);\r
- }\r
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);\r
- }\r
- disposed = true;\r
- }\r
-\r
+ public class Position2D : global::System.IDisposable
+ {
+ private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+ protected bool swigCMemOwn;
+
+ internal Position2D(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(Position2D 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.
+ protected bool disposed = false;
+
+ ~Position2D()
+ {
+ if (!isDisposeQueued)
+ {
+ isDisposeQueued = true;
+ DisposeQueue.Instance.Add(this);
+ }
+ }
+
+ 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);
+ }
+ }
+
+ 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_Vector2(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ disposed = true;
+ }
+
/// <summary>
/// Addition operator.
/// </summary>
/// <param name="arg1">Vector to add</param>
/// <param name="arg2">Vector to add</param>
/// <returns>A vector containing the result of the addition</returns>
- public static Position2D operator +(Position2D arg1, Position2D arg2)\r
- {\r
- return arg1.Add(arg2);\r
- }\r
-\r
+ public static Position2D operator +(Position2D arg1, Position2D arg2)
+ {
+ return arg1.Add(arg2);
+ }
+
/// <summary>
/// Subtraction operator.
/// </summary>
/// <param name="arg1">Vector to subtract</param>
/// <param name="arg2">Vector to subtract</param>
/// <returns>A vector containing the result of the subtraction</returns>
- public static Position2D operator -(Position2D arg1, Position2D arg2)\r
- {\r
- return arg1.Subtract(arg2);\r
- }\r
-\r
+ public static Position2D operator -(Position2D arg1, Position2D arg2)
+ {
+ return arg1.Subtract(arg2);
+ }
+
/// <summary>
/// Unary negation operator.
/// </summary>
/// <param name="arg1">Vector to netate</param>
/// <returns>A vector containing the negation</returns>
- public static Position2D operator -(Position2D arg1)\r
- {\r
- return arg1.Subtract();\r
- }\r
-\r
+ public static Position2D operator -(Position2D arg1)
+ {
+ return arg1.Subtract();
+ }
+
/// <summary>
/// Multiplication operator.
/// </summary>
/// <param name="arg1">Vector to multiply</param>
/// <param name="arg2">Vector to multiply</param>
/// <returns>A vector containing the result of the multiplication</returns>
- public static Position2D operator *(Position2D arg1, Position2D arg2)\r
- {\r
- return arg1.Multiply(arg2);\r
- }\r
-\r
+ public static Position2D operator *(Position2D arg1, Position2D arg2)
+ {
+ return arg1.Multiply(arg2);
+ }
+
/// <summary>
/// Multiplication operator.
/// </summary>
/// <param name="arg1">Vector to multiply</param>
/// <param name="arg2">The int value to scale the vector</param>
/// <returns>A vector containing the result of the multiplication</returns>
- public static Position2D operator *(Position2D arg1, int arg2)\r
- {\r
- return arg1.Multiply(arg2);\r
- }\r
-\r
+ public static Position2D operator *(Position2D arg1, int arg2)
+ {
+ return arg1.Multiply(arg2);
+ }
+
/// <summary>
/// Division operator.
/// </summary>
/// <param name="arg1">Vector to divide</param>
/// <param name="arg2">Vector to divide</param>
/// <returns>A vector containing the result of the division</returns>
- public static Position2D operator /(Position2D arg1, Position2D arg2)\r
- {\r
- return arg1.Divide(arg2);\r
- }\r
-\r
+ public static Position2D operator /(Position2D arg1, Position2D arg2)
+ {
+ return arg1.Divide(arg2);
+ }
+
/// <summary>
/// Division operator.
/// </summary>
/// <param name="arg1">Vector to divide</param>
/// <param name="arg2">The int value to scale the vector by</param>
/// <returns>A vector containing the result of the division</returns>
- public static Position2D operator /(Position2D arg1, int arg2)\r
- {\r
- return arg1.Divide(arg2);\r
- }\r
-\r
+ public static Position2D operator /(Position2D arg1, int arg2)
+ {
+ return arg1.Divide(arg2);
+ }
+
/// <summary>
/// Const array subscript operator overload. Should be 0, or 1.
/// </summary>
/// <param name="index">Subscript index</param>
/// <returns>The float at the given index</returns>
- public float this[uint index]\r
- {\r
- get\r
- {\r
- return ValueOfIndex(index);\r
- }\r
- }\r
-\r
- internal static Position2D GetPosition2DFromPtr(global::System.IntPtr cPtr)\r
- {\r
- Position2D ret = new Position2D(cPtr, false);\r
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- return ret;\r
- }\r
-\r
+ public float this[uint index]
+ {
+ get
+ {
+ return ValueOfIndex(index);
+ }
+ }
+
+ internal static Position2D GetPosition2DFromPtr(global::System.IntPtr cPtr)
+ {
+ Position2D ret = new Position2D(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
/// <summary>
/// Constructor
/// </summary>
- public Position2D() : this(NDalicPINVOKE.new_Vector2__SWIG_0(), true)\r
- {\r
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- }\r
-\r
+ public Position2D() : this(NDalicPINVOKE.new_Vector2__SWIG_0(), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
/// <summary>
/// Constructor
/// </summary>
/// <param name="x">x component</param>
/// <param name="y">y component</param>
- public Position2D(int x, int y) : this(NDalicPINVOKE.new_Vector2__SWIG_1((float)x, (float)y), true)\r
- {\r
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- }\r
-\r
+ public Position2D(int x, int y) : this(NDalicPINVOKE.new_Vector2__SWIG_1((float)x, (float)y), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
/// <summary>
/// Constructor
/// </summary>
/// <param name="position">Position to create this vector from</param>
- public Position2D(Position position) : this(NDalicPINVOKE.new_Vector2__SWIG_3(Position.getCPtr(position)), true)\r
- {\r
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- }\r
-\r
- private Position2D Add(Position2D rhs)\r
- {\r
- Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Add(swigCPtr, Position2D.getCPtr(rhs)), true);\r
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- return ret;\r
- }\r
-\r
- private Position2D Subtract(Position2D rhs)\r
- {\r
- Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Subtract__SWIG_0(swigCPtr, Position2D.getCPtr(rhs)), true);\r
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- return ret;\r
- }\r
-\r
-\r
- private Position2D Multiply(Position2D rhs)\r
- {\r
- Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Multiply__SWIG_0(swigCPtr, Position2D.getCPtr(rhs)), true);\r
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- return ret;\r
- }\r
-\r
- private Position2D Multiply(int rhs)\r
- {\r
- Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Multiply__SWIG_1(swigCPtr, (float)rhs), true);\r
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- return ret;\r
- }\r
-\r
-\r
- private Position2D Divide(Position2D rhs)\r
- {\r
- Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Divide__SWIG_0(swigCPtr, Position2D.getCPtr(rhs)), true);\r
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- return ret;\r
- }\r
-\r
- private Position2D Divide(int rhs)\r
- {\r
- Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Divide__SWIG_1(swigCPtr, (float)rhs), true);\r
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- return ret;\r
- }\r
-\r
- private Position2D Subtract()\r
- {\r
- Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Subtract__SWIG_1(swigCPtr), true);\r
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- return ret;\r
- }\r
-\r
+ public Position2D(Position position) : this(NDalicPINVOKE.new_Vector2__SWIG_3(Position.getCPtr(position)), true)
+ {
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ private Position2D Add(Position2D rhs)
+ {
+ Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Add(swigCPtr, Position2D.getCPtr(rhs)), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private Position2D Subtract(Position2D rhs)
+ {
+ Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Subtract__SWIG_0(swigCPtr, Position2D.getCPtr(rhs)), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+
+ private Position2D Multiply(Position2D rhs)
+ {
+ Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Multiply__SWIG_0(swigCPtr, Position2D.getCPtr(rhs)), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private Position2D Multiply(int rhs)
+ {
+ Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Multiply__SWIG_1(swigCPtr, (float)rhs), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+
+ private Position2D Divide(Position2D rhs)
+ {
+ Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Divide__SWIG_0(swigCPtr, Position2D.getCPtr(rhs)), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private Position2D Divide(int rhs)
+ {
+ Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Divide__SWIG_1(swigCPtr, (float)rhs), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private Position2D Subtract()
+ {
+ Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Subtract__SWIG_1(swigCPtr), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
/// <summary>
/// Compare if rhs is equal to.
/// </summary>
/// <param name="rhs">The vector to compare</param>
/// <returns>Returns true if the two vectors are equal, otherwise false</returns>
- public bool EqualTo(Position2D rhs)\r
- {\r
- bool ret = NDalicPINVOKE.Vector2_EqualTo(swigCPtr, Position2D.getCPtr(rhs));\r
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- return ret;\r
- }\r
-\r
+ public bool EqualTo(Position2D rhs)
+ {
+ bool ret = NDalicPINVOKE.Vector2_EqualTo(swigCPtr, Position2D.getCPtr(rhs));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
/// <summary>
/// Compare if rhs is not equal to.
/// </summary>
/// <param name="rhs">The vector to compare</param>
/// <returns>Returns true if the two vectors are not equal, otherwise false</returns>
- public bool NotEqualTo(Position2D rhs)\r
- {\r
- bool ret = NDalicPINVOKE.Vector2_NotEqualTo(swigCPtr, Position2D.getCPtr(rhs));\r
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- return ret;\r
- }\r
-\r
- private int ValueOfIndex(uint index)\r
- {\r
- int ret = (int)NDalicPINVOKE.Vector2_ValueOfIndex__SWIG_0(swigCPtr, index);\r
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- return ret;\r
- }\r
-\r
+ public bool NotEqualTo(Position2D rhs)
+ {
+ bool ret = NDalicPINVOKE.Vector2_NotEqualTo(swigCPtr, Position2D.getCPtr(rhs));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ private int ValueOfIndex(uint index)
+ {
+ int ret = (int)NDalicPINVOKE.Vector2_ValueOfIndex__SWIG_0(swigCPtr, index);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
/// <summary>
/// x component.
/// </summary>
- public int X\r
- {\r
- set\r
- {\r
- NDalicPINVOKE.Vector2_X_set(swigCPtr, (float)value);\r
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- }\r
- get\r
- {\r
- float ret = NDalicPINVOKE.Vector2_X_get(swigCPtr);\r
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- return (int)ret;\r
- }\r
- }\r
-\r
+ public int X
+ {
+ set
+ {
+ NDalicPINVOKE.Vector2_X_set(swigCPtr, (float)value);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ get
+ {
+ float ret = NDalicPINVOKE.Vector2_X_get(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return (int)ret;
+ }
+ }
+
/// <summary>
/// y component.
/// </summary>
- public int Y\r
- {\r
- set\r
- {\r
- NDalicPINVOKE.Vector2_Y_set(swigCPtr, (float)value);\r
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- }\r
- get\r
- {\r
- float ret = NDalicPINVOKE.Vector2_Y_get(swigCPtr);\r
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
- return (int)ret;\r
- }\r
- }\r
-\r
+ public int Y
+ {
+ set
+ {
+ NDalicPINVOKE.Vector2_Y_set(swigCPtr, (float)value);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ get
+ {
+ float ret = NDalicPINVOKE.Vector2_Y_get(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return (int)ret;
+ }
+ }
+
/// <summary>
/// Convert a position2D instance to a vector2 instance.
/// </summary>
- public static implicit operator Vector2(Position2D position2d)\r
- {\r
- return new Vector2((float)position2d.X, (float)position2d.Y);\r
- }\r
-\r
+ public static implicit operator Vector2(Position2D position2d)
+ {
+ return new Vector2((float)position2d.X, (float)position2d.Y);
+ }
+
/// <summary>
/// Convert a vector2 instance to a position2D instance.
/// </summary>
- public static implicit operator Position2D(Vector2 vec)\r
- {\r
- return new Position2D((int)vec.X, (int)vec.Y);\r
- }\r
-\r
+ public static implicit operator Position2D(Vector2 vec)
+ {
+ return new Position2D((int)vec.X, (int)vec.Y);
+ }
+
+ /// <summary>
+ /// Convert a Position2D instance to a Uint16Pair instance.
+ /// </summary>
+ public static implicit operator Uint16Pair(Position2D position2d)
+ {
+ return new Uint16Pair((uint)position2d.X, (uint)position2d.Y);
+ }
+
+ /// <summary>
+ /// Convert a Uint16Pair instance to a Position2D instance.
+ /// </summary>
+ public static implicit operator Position2D(Uint16Pair pair)
+ {
+ return new Position2D((int)pair.GetX(), (int)pair.GetY());
+ }
+
}
}