[NUI] remove "_" and refactoring naming to pascal case.
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / PaddingType.cs
index b0e3019..6f3fcb9 100755 (executable)
-/** 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.
-*
-*/
+/*
+ * Copyright(c) 2019 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 Tizen.NUI
 {
-
-    public class PaddingType : global::System.IDisposable
+    using System;
+    using System.ComponentModel;
+
+    /// <summary>
+    /// The gesture state.
+    /// </summary>
+    /// <since_tizen> 3 </since_tizen>
+    public class PaddingType : Disposable
     {
-        private global::System.Runtime.InteropServices.HandleRef swigCPtr;
-        protected bool swigCMemOwn;
 
-        internal PaddingType(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(PaddingType obj)
+        /// <summary>
+        /// Creates an uninitialized PaddingType.
+        /// </summary>
+        /// <since_tizen> 3 </since_tizen>
+        public PaddingType() : this(Interop.PaddingType.NewPaddingType(), true)
         {
-            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;
-
-
-        ~PaddingType()
-        {
-            if (!isDisposeQueued)
-            {
-                isDisposeQueued = true;
-                DisposeQueue.Instance.Add(this);
-            }
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        public void Dispose()
+        /// <summary>
+        /// PaddingType Constructor.
+        /// </summary>
+        /// <param name="start">Start padding or X coordinate</param>
+        /// <param name="end">End padding or Y coordinate</param>
+        /// <param name="top">Top padding or Height</param>
+        /// <param name="bottom">Bottom padding or Width</param>
+        /// <since_tizen> 3 </since_tizen>
+        public PaddingType(float start, float end, float top, float bottom) : this(Interop.PaddingType.NewPaddingType(start, end, top, bottom), true)
         {
-            //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);
-            }
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        protected virtual void Dispose(DisposeTypes type)
+        internal PaddingType(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
         {
-            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_PaddingType(swigCPtr);
-                }
-                swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
-            }
-
-            disposed = true;
         }
 
-        public static bool operator ==(PaddingType a, PaddingType b)
+        /// <summary>
+        /// The Start value.
+        /// </summary>
+        /// <since_tizen> 4 </since_tizen>
+        public float Start
         {
-            // If both are null, or both are same instance, return true.
-            if (System.Object.ReferenceEquals(a, b))
+            set
             {
-                return true;
+                start = value;
             }
-
-            // If one is null, but not both, return false.
-            if (((object)a == null) || ((object)b == null))
+            get
             {
-                return false;
+                return start;
             }
-
-            // Return true if the fields match:
-            return (System.Math.Abs(a.Left - b.Left) < NDalic.GetRangedEpsilon(a.Left, b.Left)) &&
-                   (System.Math.Abs(a.Right - b.Right) < NDalic.GetRangedEpsilon(a.Right, b.Right)) &&
-                   (System.Math.Abs(a.Bottom - b.Bottom) < NDalic.GetRangedEpsilon(a.Bottom, b.Bottom)) &&
-                   (System.Math.Abs(a.Top - b.Top) < NDalic.GetRangedEpsilon(a.Top, b.Top));
         }
 
-        public static bool operator !=(PaddingType a, PaddingType b)
-        {
-            return !(a == b);
-        }
-
-        ///< The Left value
-        public float Left
+        /// <summary>
+        /// The End value.
+        /// </summary>
+        /// <since_tizen> 4 </since_tizen>
+        public float End
         {
             set
             {
-                left = value;
+                end = value;
             }
             get
             {
-                return left;
+                return end;
             }
         }
 
-        ///< The Right value
-        public float Right
+        /// <summary>
+        /// The Top value.
+        /// </summary>
+        /// <since_tizen> 3 </since_tizen>
+        public float Top
         {
             set
             {
-                right = value;
+                top = value;
             }
             get
             {
-                return right;
+                return top;
             }
         }
 
-        ///< The Bottom value
+        /// <summary>
+        /// The Bottom value.
+        /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float Bottom
         {
             set
@@ -164,106 +117,76 @@ namespace Tizen.NUI
             }
         }
 
-        ///< The Top value
-        public float Top
-        {
-            set
-            {
-                top = value;
-            }
-            get
-            {
-                return top;
-            }
-        }
-
-
-        public PaddingType() : this(NDalicPINVOKE.new_PaddingType__SWIG_0(), true)
-        {
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
-        public PaddingType(float x, float y, float width, float height) : this(NDalicPINVOKE.new_PaddingType__SWIG_1(x, y, width, height), true)
-        {
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
-        public void Set(float newX, float newY, float newWidth, float newHeight)
-        {
-            NDalicPINVOKE.PaddingType_Set(swigCPtr, newX, newY, newWidth, newHeight);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
-        private float x
+        private float left
         {
             set
             {
-                NDalicPINVOKE.PaddingType_x_set(swigCPtr, value);
+                Interop.PaddingType.LeftSet(swigCPtr, value);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             }
             get
             {
-                float ret = NDalicPINVOKE.PaddingType_x_get(swigCPtr);
+                float ret = Interop.PaddingType.LeftGet(swigCPtr);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
                 return ret;
             }
         }
 
-        private float left
+        private float start
         {
             set
             {
-                NDalicPINVOKE.PaddingType_left_set(swigCPtr, value);
+                Interop.PaddingType.StartSet(swigCPtr, value);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             }
             get
             {
-                float ret = NDalicPINVOKE.PaddingType_left_get(swigCPtr);
+                float ret = Interop.PaddingType.StartGet(swigCPtr);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
                 return ret;
             }
         }
 
-        private float y
+        private float right
         {
             set
             {
-                NDalicPINVOKE.PaddingType_y_set(swigCPtr, value);
+                Interop.PaddingType.RightSet(swigCPtr, value);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             }
             get
             {
-                float ret = NDalicPINVOKE.PaddingType_y_get(swigCPtr);
+                float ret = Interop.PaddingType.RightGet(swigCPtr);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
                 return ret;
             }
         }
 
-        private float right
+        private float end
         {
             set
             {
-                NDalicPINVOKE.PaddingType_right_set(swigCPtr, value);
+                Interop.PaddingType.EndSet(swigCPtr, value);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             }
             get
             {
-                float ret = NDalicPINVOKE.PaddingType_right_get(swigCPtr);
+                float ret = Interop.PaddingType.EndGet(swigCPtr);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
                 return ret;
             }
         }
 
-        private float width
+        private float top
         {
             set
             {
-                NDalicPINVOKE.PaddingType_width_set(swigCPtr, value);
+                Interop.PaddingType.TopSet(swigCPtr, value);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             }
             get
             {
-                float ret = NDalicPINVOKE.PaddingType_width_get(swigCPtr);
+                float ret = Interop.PaddingType.TopGet(swigCPtr);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
                 return ret;
             }
@@ -273,47 +196,116 @@ namespace Tizen.NUI
         {
             set
             {
-                NDalicPINVOKE.PaddingType_bottom_set(swigCPtr, value);
+                Interop.PaddingType.BottomSet(swigCPtr, value);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             }
             get
             {
-                float ret = NDalicPINVOKE.PaddingType_bottom_get(swigCPtr);
+                float ret = Interop.PaddingType.BottomGet(swigCPtr);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
                 return ret;
             }
         }
 
-        private float height
+        /// <summary>
+        /// Equality operator.
+        /// </summary>
+        /// <param name="a">First operand</param>
+        /// <param name="b">Second operand</param>
+        /// <returns>True if the values are identical</returns>
+        /// <since_tizen> 3 </since_tizen>
+        public static bool operator ==(PaddingType a, PaddingType b)
         {
-            set
+            // If both are null, or both are same instance, return true.
+            if (System.Object.ReferenceEquals(a, b))
             {
-                NDalicPINVOKE.PaddingType_height_set(swigCPtr, value);
-                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                return true;
             }
-            get
+
+            // If one is null, but not both, return false.
+            if (((object)a == null) || ((object)b == null))
             {
-                float ret = NDalicPINVOKE.PaddingType_height_get(swigCPtr);
-                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                return ret;
+                return false;
             }
+
+            // Return true if the fields match:
+            return (System.Math.Abs(a.Start - b.Start) < NDalic.GetRangedEpsilon(a.Start, b.Start)) &&
+                   (System.Math.Abs(a.End - b.End) < NDalic.GetRangedEpsilon(a.End, b.End)) &&
+                   (System.Math.Abs(a.Bottom - b.Bottom) < NDalic.GetRangedEpsilon(a.Bottom, b.Bottom)) &&
+                   (System.Math.Abs(a.Top - b.Top) < NDalic.GetRangedEpsilon(a.Top, b.Top));
         }
 
-        private float top
+        /// <summary>
+        /// Inequality operator.
+        /// </summary>
+        /// <param name="a">First operand</param>
+        /// <param name="b">Second operand</param>
+        /// <returns>True if the values are not identical</returns>
+        /// <since_tizen> 3 </since_tizen>
+        public static bool operator !=(PaddingType a, PaddingType b)
         {
-            set
+            return !(a == b);
+        }
+
+        /// <summary>
+        /// Equals
+        /// </summary>
+        /// <param name="o">The object should be compared.</param>
+        /// <returns>True if equal.</returns>
+        /// <since_tizen> 4 </since_tizen>
+        public override bool Equals(object o)
+        {
+            if (o == null)
             {
-                NDalicPINVOKE.PaddingType_top_set(swigCPtr, value);
-                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                return false;
             }
-            get
+            if (!(o is PaddingType))
             {
-                float ret = NDalicPINVOKE.PaddingType_top_get(swigCPtr);
-                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                return ret;
+                return false;
             }
+            PaddingType p = (PaddingType)o;
+
+            // Return true if the fields match:
+            return (System.Math.Abs(Start - p.Start) < NDalic.GetRangedEpsilon(Start, p.Start)) &&
+                   (System.Math.Abs(End - p.End) < NDalic.GetRangedEpsilon(End, p.End)) &&
+                   (System.Math.Abs(Bottom - p.Bottom) < NDalic.GetRangedEpsilon(Bottom, p.Bottom)) &&
+                   (System.Math.Abs(Top - p.Top) < NDalic.GetRangedEpsilon(Top, p.Top));
         }
 
-    }
+        /// <summary>
+        /// Gets the the hash code of this baseHandle.
+        /// </summary>
+        /// <returns>The Hash Code.</returns>
+        /// <since_tizen> 4 </since_tizen>
+        public override int GetHashCode()
+        {
+            return base.GetHashCode();
+        }
+
+        /// <summary>
+        /// Assignment from individual values.
+        /// </summary>
+        /// <param name="newStart">Start padding or X coordinate</param>
+        /// <param name="newEnd">End padding or Y coordinate</param>
+        /// <param name="newTop">Top padding or Height</param>
+        /// <param name="newBottom">Bottom padding or Width</param>
+        /// <since_tizen> 3 </since_tizen>
+        public void Set(float newStart, float newEnd, float newTop, float newBottom)
+        {
+            Interop.PaddingType.Set(swigCPtr, newStart, newEnd, newTop, newBottom);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
 
+        internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PaddingType obj)
+        {
+            return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+        }
+
+        /// This will not be public opened.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
+        {
+            Interop.PaddingType.DeletePaddingType(swigCPtr);
+        }
+    }
 }