{
/// <summary>
- /// A two dimensional size
+ /// A two-dimensional size.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public class Size2D : global::System.IDisposable
{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+ /// <summary>
+ /// swigCMemOwn
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
protected bool swigCMemOwn;
internal Size2D(global::System.IntPtr cPtr, bool cMemoryOwn)
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;
+ /// <summary>
+ /// A Flat to check if it is already disposed.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ protected bool disposed = false;
+
+ /// <summary>
+ /// Dispose.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
~Size2D()
{
- DisposeQueue.Instance.Add(this);
+ if(!isDisposeQueued)
+ {
+ isDisposeQueued = true;
+ DisposeQueue.Instance.Add(this);
+ }
}
/// <summary>
- /// Dispose
+ /// Dispose.
/// </summary>
- public virtual void Dispose()
+ /// <since_tizen> 3 </since_tizen>
+ public void Dispose()
{
+ //Throw excpetion if Dispose() is called in separate thread.
if (!Window.IsInstalled())
{
- DisposeQueue.Instance.Add(this);
+ 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);
+ }
+ }
+
+ /// <summary>
+ /// Dispose.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ protected virtual void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
return;
}
- lock (this)
+ 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 (swigCPtr.Handle != global::System.IntPtr.Zero)
+ if (swigCMemOwn)
{
- if (swigCMemOwn)
- {
- swigCMemOwn = false;
- NDalicPINVOKE.delete_Vector2(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_Vector2(swigCPtr);
}
- global::System.GC.SuppressFinalize(this);
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
+ disposed = true;
}
/// <summary>
- /// Addition operator for A+B
+ /// The addition operator for A+B.
/// </summary>
- /// <param name="arg1">Size, A</param>
- /// <param name="arg2">Size to assign, B</param>
- /// <returns>A Size containing the result of the addition</returns>
+ /// <param name="arg1">Size A.</param>
+ /// <param name="arg2">Size to assign B.</param>
+ /// <returns>A size containing the result of the addition.</returns>
+ /// <since_tizen> 3 </since_tizen>
public static Size2D operator +(Size2D arg1, Size2D arg2)
{
return arg1.Add(arg2);
}
/// <summary>
- /// Subtraction operator for A-B
+ /// The subtraction operator for A-B.
/// </summary>
- /// <param name="arg1">Size, A</param>
- /// <param name="arg2">Size to subtract, B</param>
- /// <returns>A Size containing the result of the subtraction</returns>
+ /// <param name="arg1">Size A.</param>
+ /// <param name="arg2">Size to subtract B.</param>
+ /// <returns>A size containing the result of the subtraction.</returns>
+ /// <since_tizen> 3 </since_tizen>
public static Size2D operator -(Size2D arg1, Size2D arg2)
{
return arg1.Subtract(arg2);
}
/// <summary>
- /// Unary negation operator.
+ /// The unary negation operator.
/// </summary>
- /// <param name="arg1">Size for unary negation</param>
- /// <returns>A Size containg the negation</returns>
+ /// <param name="arg1">Size for unary negation.</param>
+ /// <returns>A size containing the negation.</returns>
+ /// <since_tizen> 3 </since_tizen>
public static Size2D operator -(Size2D arg1)
{
return arg1.Subtract();
}
/// <summary>
- /// Multiplication operator.
+ /// The multiplication operator.
/// </summary>
- /// <param name="arg1">Size for multiplication</param>
- /// <param name="arg2">The Size to multipl</param>
- /// <returns>A Size containing the result of the multiplication</returns>
+ /// <param name="arg1">Size for multiplication.</param>
+ /// <param name="arg2">Size to multiply.</param>
+ /// <returns>A size containing the result of the multiplication.</returns>
+ /// <since_tizen> 3 </since_tizen>
public static Size2D operator *(Size2D arg1, Size2D arg2)
{
return arg1.Multiply(arg2);
}
/// <summary>
- /// Multiplication operator.
+ /// The multiplication operator.
/// </summary>
/// <param name="arg1">Size for multiplication</param>
- /// <param name="arg2">The int value to scale the Size</param>
- /// <returns>A Size containing the result of the scaling</returns>
+ /// <param name="arg2">The integer value to scale the size.</param>
+ /// <returns>A size containing the result of the scaling.</returns>
+ /// <since_tizen> 3 </since_tizen>
public static Size2D operator *(Size2D arg1, int arg2)
{
return arg1.Multiply(arg2);
}
/// <summary>
- /// Division operator.
+ /// The division operator.
/// </summary>
- /// <param name="arg1">Size for division</param>
- /// <param name="arg2">The Size to divide</param>
- /// <returns>A Size containing the result of the division></returns>
+ /// <param name="arg1">Size for division.</param>
+ /// <param name="arg2">Size to divide.</param>
+ /// <returns>A size containing the result of the division.</returns>
+ /// <since_tizen> 3 </since_tizen>
public static Size2D operator /(Size2D arg1, Size2D arg2)
{
return arg1.Divide(arg2);
}
/// <summary>
- /// Division operator.
+ /// The division operator.
/// </summary>
- /// <param name="arg1">Size for division</param>
- /// <param name="arg2">The int value to scale the Size by</param>
- /// <returns>A Size containing the result of the scaling</returns>
+ /// <param name="arg1">Size for division.</param>
+ /// <param name="arg2">The integer value to scale the size by.</param>
+ /// <returns>A size containing the result of the scaling.</returns>
+ /// <since_tizen> 3 </since_tizen>
public static Size2D operator /(Size2D arg1, int arg2)
{
return arg1.Divide(arg2);
}
/// <summary>
- /// Array subscript operator.
+ /// The array subscript operator.
/// </summary>
- /// <param name="index">Subscript index</param>
- /// <returns>The float at the given index</returns>
+ /// <param name="index">The subscript index.</param>
+ /// <returns>The float at the given index.</returns>
+ /// <since_tizen> 3 </since_tizen>
public float this[uint index]
{
get
}
/// <summary>
- /// Get Size from pointer.
+ /// Gets the size from the pointer.
/// </summary>
- /// <param name="cPtr">Pointer of the Size</param>
+ /// <param name="cPtr">The pointer of the size.</param>
/// <returns>Size</returns>
internal static Size2D GetSize2DFromPtr(global::System.IntPtr cPtr)
{
}
/// <summary>
- /// Constructor.
+ /// The constructor.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public Size2D() : this(NDalicPINVOKE.new_Vector2__SWIG_0(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
- /// Constructor.
+ /// The constructor.
/// </summary>
- /// <param name="x">x (or width) component</param>
- /// <param name="y">y (or height) component</param>
+ /// <param name="x">The x (or width) component.</param>
+ /// <param name="y">The y (or height) component.</param>
+ /// <since_tizen> 3 </since_tizen>
public Size2D(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="size">Size with x (width), y (height), and z (depth)</param>
- public Size2D(Size size) : this(NDalicPINVOKE.new_Vector2__SWIG_3(Size.getCPtr(size)), true)
- {
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
-
private Size2D Add(Size2D rhs)
{
Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Add(swigCPtr, Size2D.getCPtr(rhs)), true);
}
/// <summary>
- /// Check equality.<br>
- /// Utilizes appropriate machine epsilon values.<br>
+ /// Checks equality.<br />
+ /// Utilizes appropriate machine epsilon values.<br />
/// </summary>
- /// <param name="rhs">The Size to test against</param>
- /// <returns>True if the Sizes are equal</returns>
+ /// <param name="rhs">The size to test against.</param>
+ /// <returns>True if the sizes are equal.</returns>
+ /// <since_tizen> 3 </since_tizen>
public bool EqualTo(Size2D rhs)
{
bool ret = NDalicPINVOKE.Vector2_EqualTo(swigCPtr, Size2D.getCPtr(rhs));
}
/// <summary>
- /// Check inequality.<br>
- /// Utilizes appropriate machine epsilon values.<br>
+ /// Checks inequality.<br />
+ /// Utilizes appropriate machine epsilon values.<br />
/// </summary>
- /// <param name="rhs">The Size to test against</param>
- /// <returns>True if the Sizes are not equal</returns>
+ /// <param name="rhs">The size to test against.</param>
+ /// <returns>True if the sizes are not equal.</returns>
+ /// <since_tizen> 3 </since_tizen>
public bool NotEqualTo(Size2D rhs)
{
bool ret = NDalicPINVOKE.Vector2_NotEqualTo(swigCPtr, Size2D.getCPtr(rhs));
}
/// <summary>
- /// Property for width component of Size
+ /// The property for the width component of a size.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public int Width
{
set
}
/// <summary>
- /// Property for height component of Size
+ /// The property for the height component of a size.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public int Height
{
set
}
/// <summary>
- /// Type cast operator, Size2D to Vector2.
+ /// The type cast operator, Size2D to Vector2.
/// </summary>
- /// <param name="size">Object of Size2D type</param>
+ /// <param name="size">An object of the Size2D type.</param>
+ /// <returns>return a Vector2 instance</returns>
+ /// <since_tizen> 3 </since_tizen>
public static implicit operator Vector2(Size2D size)
{
return new Vector2((float)size.Width, (float)size.Height);
}
/// <summary>
- /// Type cast operator, Vector2 to Size2D type.
+ /// The type cast operator, Vector2 to Size2D type.
/// </summary>
- /// <param name="vec">Object of Vector2 type</param>
- public static implicit operator Size2D(Vector2 vec)
+ /// <param name="vector2">An object of the Vector2 type.</param>
+ /// <returns>return a Size2D instance</returns>
+ /// <since_tizen> 3 </since_tizen>
+ public static implicit operator Size2D(Vector2 vector2)
{
- return new Size2D((int)vec.X, (int)vec.Y);
+ return new Size2D((int)vector2.X, (int)vector2.Y);
}
-
}
}
-