Size, Position, Color high level class added
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / manual / csharp / Size.cs
old mode 100644 (file)
new mode 100755 (executable)
index f89172a..930557f
-namespace Dali
-{
-  using System;
+/*
+ * 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.
+ *
+ */
+
+namespace Dali {
+
+public class Size : global::System.IDisposable {
+  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal Size(global::System.IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+  }
 
-  public class Size
-  {
-    private float width;
-    private float height;
-
-    /**
-     * @brief constructor
-     *
-     * @since 1.0.0
-     * @param [in] a Width value .
-     * @param [in] b Height value.
-     */
-    public Size(float a, float b)
-    {
-      width = a;
-      height = b;
-    }
-    /**
-     * @brief default constructor
-     *
-     * @since 1.0.0
-     */
-    public Size()
-    {
-      width = 0.0f;
-      height = 0.0f;
-    }
+  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Size obj) {
+    return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+  }
 
-    /**
-     * @brief constructor with base class object
-     *
-     * @since 1.0.0
-     * @param [in] o The Vector2 with Width, Height values.
-     */
-    public Size(Vector2 o)
-    {
-      width = o.x;
-      height = o.y;
-    }
+  ~Size() {
+    DisposeQueue.Instance.Add(this);
+  }
 
-    /**
-     * @brief Copy constructor
-     *
-     * @since 1.0.0
-     * @param [in] o The Size having Width & Y.
-     */
-    public Size(Size a)
-    {
-      width = a.width;
-      height = a.height;
+  public virtual void Dispose() {
+    if (!Stage.IsInstalled()) {
+      DisposeQueue.Instance.Add(this);
+      return;
     }
 
-    ///< name "W", type float (Size Width value)
-    //@since 1.0.0
-    public float W
-    {
-      get { return width; }
-      set { width = value; }
+    lock(this) {
+      if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+        if (swigCMemOwn) {
+          swigCMemOwn = false;
+          NDalicPINVOKE.delete_Vector3(swigCPtr);
+        }
+        swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+      }
+      global::System.GC.SuppressFinalize(this);
     }
+  }
 
-    ///< name "H", type float (Size Height value)
-    //@since 1.0.0
-    public float H
-    {
-      get { return height; }
-      set { height = value; }
-    }
 
-    /**
-     * @brief operator+
-     *
-     * @since 1.0.0
-     * @param [in] l The Size to add.
-     * @param [in] r The Size to add
-     * @return A reference to this
-     */
-    public static Size operator +(Size l, Size r)
-    {
-      return new Size(l.W + r.W, l.H + r.H);
-    }
+  public static Size operator+(Size arg1, Size arg2) {
+    return arg1.Add(arg2);
+  }
 
-    /**
-     * @brief operator-
-     *
-     * @since 1.0.0
-     * @param [in] l The Size to substract.
-     * @param [in] r The Size to substract
-     * @return A reference to this
-     */
-    public static Size operator -(Size l, Size r)
-    {
-      return new Size(l.W - r.W, l.H - r.H);
-    }
+  public static Size operator-(Size arg1, Size arg2) {
+    return arg1.Subtract(arg2);
+  }
 
-    /**
-     * @brief operator*
-     *
-     * @since 1.0.0
-     * @param [in] a The Size to multiply
-     * @param [in] b The constant to multiply of type double.
-     * @return A reference to this
-     */
-    public static Size operator *(Size a, double b)
-    {
-      return new Size((float)(a.W * b), (float)(a.H * b));
-    }
+  public static Size operator-(Size arg1) {
+    return arg1.Subtract();
+  }
 
-    /**
-     * @brief operator/
-     *
-     * @since 1.0.0
-     * @param [in] a The Size to divide.
-     * @param [in] b The Size to divide
-     * @return float of the size division
-     */
-    public static float operator /(Size a, Size b)
-    {
-      return (float)System.Math.Sqrt((a.W / b.W) * (a.H / b.H));
-    }
+  public static Size operator*(Size arg1, Size arg2) {
+    return arg1.Multiply(arg2);
+  }
 
-    /**
-     * @brief Operator ==
-     *
-     * @since 1.0.0
-     * @param [in] a The Size object to compare.
-     * @param [in] b The Size object to compare.
-     * @return bool, whether Size are equal or not
-     */
-    public static bool operator == (Size a, Size b)
-    {
-      return a.W == b.W && a.H == b.H ;
-    }
+  public static Size operator*(Size arg1, float arg2) {
+    return arg1.Multiply(arg2);
+  }
+
+  public static Size operator/(Size arg1, Size arg2) {
+    return arg1.Divide(arg2);
+  }
+
+  public static Size operator/(Size arg1, float arg2) {
+    return arg1.Divide(arg2);
+  }
 
-    /**
-     * @brief Operator !=
-     *
-     * @since 1.0.0
-     * @param [in] a The Size object to compare.
-     * @param [in] b The Size object to compare.
-     * @return bool, whether Size are equal or not
-     */
-    public static bool operator != (Size a, Size b)
+  public float this[uint index]
+  {
+    get
     {
-      return a.W != b.W || a.H != b.H;
+      return ValueOfIndex(index);
     }
+  }
 
-    /**
-     * @brief GetHashCode
-     *
-     * @since 1.0.0
-     * @return int, hascode of Size
-     */
-    public override int GetHashCode()
-    {
-      return (int)(W + H);
+  public static Size GetSizeFromPtr(global::System.IntPtr cPtr) {
+    Size ret = new Size(cPtr, false);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+       return ret;
+  }
+
+
+  public Size() : this(NDalicPINVOKE.new_Vector3__SWIG_0(), true) {
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+  }
+
+  public Size(float x, float y, float z) : this(NDalicPINVOKE.new_Vector3__SWIG_1(x, y, z), true) {
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+  }
+
+  public Size(Size2D size2d) : this(NDalicPINVOKE.new_Vector3__SWIG_3(Size2D.getCPtr(size2d)), true) {
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+  }
+
+
+  public static Size Zero {
+    get {
+      global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ZERO_get();
+      Size ret = (cPtr == global::System.IntPtr.Zero) ? null : new Size(cPtr, false);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
+  }
 
-    /**
-     * @brief Clone
-     *
-     * @since 1.0.0
-     * @return returns a copy of Size object
-     */
-    public Size Clone()
-    {
-      Size copy = new Size(W, H);
-      return copy;
+  private Size Add(Size rhs) {
+    Size ret = new Size(NDalicPINVOKE.Vector3_Add(swigCPtr, Size.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Size Subtract(Size rhs) {
+    Size ret = new Size(NDalicPINVOKE.Vector3_Subtract__SWIG_0(swigCPtr, Size.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Size Multiply(Size rhs) {
+    Size ret = new Size(NDalicPINVOKE.Vector3_Multiply__SWIG_0(swigCPtr, Size.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Size Multiply(float rhs) {
+    Size ret = new Size(NDalicPINVOKE.Vector3_Multiply__SWIG_1(swigCPtr, rhs), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Size Divide(Size rhs) {
+    Size ret = new Size(NDalicPINVOKE.Vector3_Divide__SWIG_0(swigCPtr, Size.getCPtr(rhs)), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Size Divide(float rhs) {
+    Size ret = new Size(NDalicPINVOKE.Vector3_Divide__SWIG_1(swigCPtr, rhs), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private Size Subtract() {
+    Size ret = new Size(NDalicPINVOKE.Vector3_Subtract__SWIG_1(swigCPtr), true);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  private float ValueOfIndex(uint index) {
+    float ret = NDalicPINVOKE.Vector3_ValueOfIndex__SWIG_0(swigCPtr, index);
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public bool EqualTo(Size rhs) {
+    bool ret = NDalicPINVOKE.Vector3_EqualTo(swigCPtr, Size.getCPtr(rhs));
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public bool NotEqualTo(Size rhs) {
+    bool ret = NDalicPINVOKE.Vector3_NotEqualTo(swigCPtr, Size.getCPtr(rhs));
+    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+
+  public float Width {
+    set {
+      NDalicPINVOKE.Vector3_Width_set(swigCPtr, value);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+    get {
+      float ret = NDalicPINVOKE.Vector3_Width_get(swigCPtr);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
+  }
 
-    // User-defined conversion from Position to Vector3
-    public static implicit operator Vector2(Size size)
-    {
-      return new Vector2(size.width, size.height);
+  public float Height {
+    set {
+      NDalicPINVOKE.Vector3_Height_set(swigCPtr, value);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+    get {
+      float ret = NDalicPINVOKE.Vector3_Height_get(swigCPtr);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
+  }
 
-    public static implicit operator Size(Vector2 vec)
-    {
-      return new Size(vec.x, vec.y);
+  public float Depth {
+    set {
+      NDalicPINVOKE.Vector3_Depth_set(swigCPtr, value);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+    }
+    get {
+      float ret = NDalicPINVOKE.Vector3_Depth_get(swigCPtr);
+      if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
     }
   }
+
+
+  public static implicit operator Vector3(Size size)
+  {
+    return new Vector3(size.Width, size.Height, size.Depth);
+  }
+
+  public static implicit operator Size(Vector3 vec)
+  {
+    return new Size(vec.Width, vec.Height, vec.Depth);
+  }
+
 }
+
+}
+