[NUI] Implement Rotation.Assign + Call Constraint.Remove at Dispose + Minor cleanup
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 10 Apr 2025 01:40:42 +0000 (10:40 +0900)
committerSangHyeon Jade Lee <dltkdgus1764@gmail.com>
Thu, 17 Apr 2025 07:55:55 +0000 (16:55 +0900)
Prepare to implement NUI Constraint feature.

Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
src/Tizen.NUI/src/internal/Animation/Constraint.cs
src/Tizen.NUI/src/internal/Animation/EqualConstraintWithParentFloat.cs
src/Tizen.NUI/src/internal/Animation/RelativeConstraintWithParentFloat.cs
src/Tizen.NUI/src/internal/Interop/Interop.Rotation.cs
src/Tizen.NUI/src/public/Animation/Animatable.cs
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs
src/Tizen.NUI/src/public/Common/Property.cs
src/Tizen.NUI/src/public/Common/Rotation.cs

index ed6257d6c81c953133117f1401b6c6cc89c1fa21..d6bc437211f1a3f99a51d50e344202bad6b7f067 100755 (executable)
@@ -53,18 +53,18 @@ namespace Tizen.NUI
         internal void Apply()
         {
             Interop.Constraint.Apply(SwigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            NDalicPINVOKE.ThrowExceptionIfExists();
         }
+
         /// <summary>
         /// Remove current constraint.
         /// </summary>
         internal void Remove()
         {
             Interop.Constraint.Remove(SwigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            NDalicPINVOKE.ThrowExceptionIfExists();
         }
 
-
         /// <summary>
         /// Remove action. Determine the target values action after remove current constriant.
         /// Default is RemoveActionType.Bake
@@ -74,7 +74,7 @@ namespace Tizen.NUI
             set => Interop.Constraint.SetRemoveAction(SwigCPtr, (int)value);
             get => (RemoveActionType) Interop.Constraint.GetRemoveAction(SwigCPtr);
         }
-        
+
         /// <summary>
         /// Tag number. It will be useful when you want to seperate constraints
         /// </summary>
@@ -90,16 +90,16 @@ namespace Tizen.NUI
         internal BaseHandle GetTargetObject()
         {
             BaseHandle handle = new BaseHandle(Interop.Constraint.GetTargetObject(SwigCPtr), true);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            NDalicPINVOKE.ThrowExceptionIfExists();
             return handle;
         }
         /// <summary>
         /// Get constrainted target property index
         /// </summary>
-        internal int GetTargetPropert()
+        internal int GetTargetPropertyIndex()
         {
             int index = Interop.Constraint.GetTargetProperty(SwigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            NDalicPINVOKE.ThrowExceptionIfExists();
             return index;
         }
 
@@ -119,6 +119,7 @@ namespace Tizen.NUI
                 //Called by User
                 //Release your own managed resources here.
                 //You should release all of your own disposable objects here.
+                Remove();
             }
             base.Dispose(type);
         }
@@ -128,9 +129,9 @@ namespace Tizen.NUI
         protected override void ReleaseSwigCPtr(HandleRef swigCPtr)
         {
             Interop.Constraint.DeleteConstraint(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            NDalicPINVOKE.ThrowExceptionIfExists();
         }
-        
+
         /// <summary>
         /// Determinate how objects property will be when constraint removed.
         /// Default is Bake.
index c34834471156c1029218ba22b9e86e0a680eff47..e62dd495c36f68508c9f4cc330d4e0e47d5d8ae0 100755 (executable)
@@ -28,7 +28,7 @@ namespace Tizen.NUI
         internal EqualConstraintWithParentFloat(HandleRef handle, int targetIndex, int parentIndex)
          : base(Interop.Constraint.NewEqualConstraintWithParentFloat(handle, targetIndex, parentIndex), true)
         {
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            NDalicPINVOKE.ThrowExceptionIfExists();
         }
     }
 }
index 8dd4ef5d7d63be46c9c697b878792b59f77cb26a..bda6b0287709db26b764ddd55928ee0d49e53e95 100755 (executable)
@@ -18,7 +18,7 @@
 namespace Tizen.NUI
 {
     using global::System.Runtime.InteropServices;
-    
+
     /// <summary>
     /// Specialized Constraint.
     /// Make handle's targetIndex value always equal with handle's parent's parentIndex value
@@ -28,7 +28,7 @@ namespace Tizen.NUI
         internal RelativeConstraintWithParentFloat(HandleRef handle, int targetIndex, int parentIndex, float rate)
          : base(Interop.Constraint.NewRelativeConstraintWithParentFloat(handle, targetIndex, parentIndex, rate), true)
         {
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            NDalicPINVOKE.ThrowExceptionIfExists();
         }
     }
 }
index 6940622f00c336687dfdd4e6e370e9cc2f6db09b..f821c6219752670d632e58b5c4e5093a8a5826f2 100755 (executable)
@@ -36,6 +36,9 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_Rotation_4")]
             public static extern global::System.IntPtr NewRotation4(global::System.Runtime.InteropServices.HandleRef vector4);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Rotation_Assign")]
+            public static extern global::System.IntPtr RotationAssign(global::System.Runtime.InteropServices.HandleRef destination, global::System.Runtime.InteropServices.HandleRef source);
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_Rotation")]
             public static extern void DeleteRotation(global::System.Runtime.InteropServices.HandleRef rotation);
 
index 8d515dbd420bc1719f20388c6df294f712735c39..fce9a54af5089f7e58dd3fdbb7c7253706d2e95f 100755 (executable)
@@ -125,11 +125,7 @@ namespace Tizen.NUI
         public int GetPropertyIndex(string name)
         {
             // Convert property string to be lowercase
-            StringBuilder sb = new StringBuilder(name);
-            sb[0] = (char)(sb[0] | 0x20);
-            string str = sb.ToString();
-
-            int ret = Interop.Handle.GetPropertyIndex(SwigCPtr, str);
+            int ret = Interop.Handle.GetPropertyIndex(SwigCPtr, LowerFirstLetter(name));
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
index c109da805c7a9c151650c9e2d350788f719e9660..b2cead4fb503f4afae69601a762cf0a954b60a30 100755 (executable)
@@ -4629,7 +4629,6 @@ namespace Tizen.NUI.BaseComponents
             }
             else
             {
-                widthConstraint?.Remove();
                 widthConstraint?.Dispose();
                 widthConstraint = null;
 
@@ -4710,7 +4709,6 @@ namespace Tizen.NUI.BaseComponents
             }
             else
             {
-                heightConstraint?.Remove();
                 heightConstraint?.Dispose();
                 heightConstraint = null;
 
index 7a8af456610197e6dcdb9753fdc297ea24de9faf..d9c5c221f40a167bd73fb0194802a1494185b8c8 100755 (executable)
@@ -1430,12 +1430,10 @@ namespace Tizen.NUI.BaseComponents
                 }
                 if (widthConstraint != null)
                 {
-                    widthConstraint.Remove();
                     widthConstraint.Dispose();
                 }
                 if (heightConstraint != null)
                 {
-                    heightConstraint.Remove();
                     heightConstraint.Dispose();
                 }
 
index 437f06313ea45bba39e1bc7faf2cb80c45630f81..ad318c137a96ec367306e5fa387bfefe4ffd49cd 100755 (executable)
@@ -62,36 +62,6 @@ namespace Tizen.NUI
             }
         }
 
-        internal static int InvalidIndex
-        {
-            get
-            {
-                int ret = Interop.Property.InvalidIndexGet();
-                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                return ret;
-            }
-        }
-
-        internal static int InvalidKey
-        {
-            get
-            {
-                int ret = Interop.Property.InvalidKeyGet();
-                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                return ret;
-            }
-        }
-
-        internal static int InvalidComponentIndex
-        {
-            get
-            {
-                int ret = Interop.Property.InvalidComponentIndexGet();
-                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                return ret;
-            }
-        }
-
         internal Animatable Object
         {
             set
@@ -107,6 +77,10 @@ namespace Tizen.NUI
             }
         }
 
+        internal const int InvalidIndex = -1; // Should be match with Interop.Property.InvalidIndexGet()
+        internal const int InvalidKey = -1; // Should be match with Interop.Property.InvalidKeyGet()
+        internal const int InvalidComponentIndex = -1; // Should be match with Interop.Property.InvalidComponentIndexGet()
+
         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
         {
             Interop.Property.DeleteProperty(swigCPtr);
index 559d3b4fe8cac72f689490bf314e5cda714339e7..0ea53229c56cf876fc216b0363c07fc98a06e700 100755 (executable)
@@ -462,6 +462,18 @@ namespace Tizen.NUI
         {
         }
 
+        /// <summary>
+        /// Assign.
+        /// </summary>
+        /// <param name="rhs">A reference to the copied handle.</param>
+        /// <returns>A reference to this.</returns>
+        internal Rotation Assign(Rotation rhs)
+        {
+            Rotation ret = new Rotation(Interop.Rotation.RotationAssign(SwigCPtr, Rotation.getCPtr(rhs)), false);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
         /// This will not be public opened.
         [EditorBrowsable(EditorBrowsableState.Never)]
         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)