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 07934ff..930557f
+/*
+ * 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 {
 
-using System;
-
-public class Size : Vector2
-       {
-
-  /**
-   * @brief constructor
-   *
-   * @since 1.0.0
-   * @param [in] a Width value .
-   * @param [in] b Height value.
-   */
-          public Size(float a, float b)
-              : base(a, b)
-           {
-           }
-  /**
-   * @brief default constructor
-   *
-   * @since 1.0.0
-   */
-          public Size()
-              : base()
-           {
-           }   
-
-  /**
-   * @brief constructor with base class object
-   *
-   * @since 1.0.0
-   * @param [in] o The Vector2 with Width, Height values.
-   */
-          public Size(Vector2 o)
-               : base(o.x, o.y)
-          {
-                 
-          }
-
-  /**
-   * @brief Copy constructor
-   *
-   * @since 1.0.0
-   * @param [in] o The Size having Width & Y.
-   */
-          public Size(Size a)
-              : base(a.width, a.height)
-           {
-           }
-
-  ///< name "W", type float (Size Width value)
-  //@since 1.0.0
-           public float W
-           {
-               get { return width; }
-               set { width = value; }
-           }
-
-  ///< 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);
-           }
-
-  /**
-   * @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);
-           }
-
-  /**
-   * @brief operator*
-   *
-   * @since 1.0.0
-   * @param [in] a The Size to multiply
-   * @param [in] b The Size to multiply
-   * @return A reference to this
-   */ 
-           public static Size operator *(Size a, double b)
-           {
-               return new Size((int)(a.W * b), (int)(a.H * b));
-           }
-
-  /**
-   * @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));
-           }
-
-  /**
-   * @brief Equals
-   *
-   * @since 1.0.0
-   * @param [in] obj The Size object to compare.
-   * @return bool, whether object equal or not
-   */
-           public override bool Equals(object obj)
-           {
-               Size that = obj as Size;
-               if (that == null)
-               {
-                   return false;
-               }
-               return this.W == that.W && this.H == that.H;
-           }
-
-  /**
-   * @brief GetHashCode
-   *
-   * @since 1.0.0
-   * @return int, hascode of Size
-   */
-           public override int GetHashCode()
-           {
-               return (int)(W + H);
-           }
-
-  /**
-   * @brief Clone
-   *
-   * @since 1.0.0
-   * @return returns a copy of Size object
-   */
-           public Size Clone()
-           {
-               Size copy = new Size(W, H);
-               return copy;
-           }
-       }
+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);
+  }
+
+  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;
+  }
+
+  ~Size() {
+    DisposeQueue.Instance.Add(this);
+  }
+
+  public virtual void Dispose() {
+    if (!Stage.IsInstalled()) {
+      DisposeQueue.Instance.Add(this);
+      return;
+    }
+
+    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);
+    }
+  }
+
+
+  public static Size operator+(Size arg1, Size arg2) {
+    return arg1.Add(arg2);
+  }
+
+  public static Size operator-(Size arg1, Size arg2) {
+    return arg1.Subtract(arg2);
+  }
+
+  public static Size operator-(Size arg1) {
+    return arg1.Subtract();
+  }
+
+  public static Size operator*(Size arg1, Size arg2) {
+    return arg1.Multiply(arg2);
+  }
+
+  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);
+  }
+
+  public float this[uint index]
+  {
+    get
+    {
+      return ValueOfIndex(index);
+    }
+  }
+
+  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;
+    }
+  }
+
+  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;
+    }
+  }
+
+  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 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);
+  }
+
 }
+
+}
+