X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=plugins%2Fdali-swig%2Fmanual%2Fcsharp%2FSize.cs;h=930557f1942ae3a07cf9f1d5f407dd94e6c87e8c;hp=79f2dff1fe226772c936b1d7a7c3a4ceaad0c4a7;hb=1730389b12a4a189b54c04ce357a7dba026dd7b8;hpb=1820cf3dc1c6b820bf57191cf4b498d9fa197e1b diff --git a/plugins/dali-swig/manual/csharp/Size.cs b/plugins/dali-swig/manual/csharp/Size.cs old mode 100644 new mode 100755 index 79f2dff..930557f --- a/plugins/dali-swig/manual/csharp/Size.cs +++ b/plugins/dali-swig/manual/csharp/Size.cs @@ -1,161 +1,232 @@ +/* + * 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 The Size X. - * @param [in] b The Size Y. - */ - public Size(float a, float b) - : base(a, b) - { - } - /** - * @brief constructor - * - * @since 1.0.0 - */ - public Size() - : base() - { - } - - /** - * @brief constructor - * - * @since 1.0.0 - * @param [in] o The Vector Size X, Y. - */ - public Size(Vector2 o) - : base(o.x, o.y) - { - - } - - /** - * @brief constructor - * - * @since 1.0.0 - * @param [in] o The Size X, Y. - */ - public Size(Size a) - : base(a.width, a.height) - { - } - - ///< name "W", type float (Size W value) - //@since 1.0.0 - public float W - { - get { return width; } - set { width = value; } - } - - ///< name "H", type float (Size W 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 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 add. - * @param [in] r The Size to add - * @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] l The Size to add. - * @param [in] r The Size to add - * @return A reference to this - */ - 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] o The Size object to compare. - * @param [in] r The Size to add - * @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 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); + } + } + +} +