From: Eunki, Hong Date: Thu, 10 Apr 2025 01:40:42 +0000 (+0900) Subject: [NUI] Implement Rotation.Assign + Call Constraint.Remove at Dispose + Minor cleanup X-Git-Tag: submit/tizen/20250417.075952~1^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2c1fc29a5706f66a836cecaa3cfa11f78f9ce200;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Implement Rotation.Assign + Call Constraint.Remove at Dispose + Minor cleanup Prepare to implement NUI Constraint feature. Signed-off-by: Eunki, Hong --- diff --git a/src/Tizen.NUI/src/internal/Animation/Constraint.cs b/src/Tizen.NUI/src/internal/Animation/Constraint.cs index ed6257d6c..d6bc43721 100755 --- a/src/Tizen.NUI/src/internal/Animation/Constraint.cs +++ b/src/Tizen.NUI/src/internal/Animation/Constraint.cs @@ -53,18 +53,18 @@ namespace Tizen.NUI internal void Apply() { Interop.Constraint.Apply(SwigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + NDalicPINVOKE.ThrowExceptionIfExists(); } + /// /// Remove current constraint. /// internal void Remove() { Interop.Constraint.Remove(SwigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + NDalicPINVOKE.ThrowExceptionIfExists(); } - /// /// 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); } - + /// /// Tag number. It will be useful when you want to seperate constraints /// @@ -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; } /// /// Get constrainted target property index /// - 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(); } - + /// /// Determinate how objects property will be when constraint removed. /// Default is Bake. diff --git a/src/Tizen.NUI/src/internal/Animation/EqualConstraintWithParentFloat.cs b/src/Tizen.NUI/src/internal/Animation/EqualConstraintWithParentFloat.cs index c34834471..e62dd495c 100755 --- a/src/Tizen.NUI/src/internal/Animation/EqualConstraintWithParentFloat.cs +++ b/src/Tizen.NUI/src/internal/Animation/EqualConstraintWithParentFloat.cs @@ -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(); } } } diff --git a/src/Tizen.NUI/src/internal/Animation/RelativeConstraintWithParentFloat.cs b/src/Tizen.NUI/src/internal/Animation/RelativeConstraintWithParentFloat.cs index 8dd4ef5d7..bda6b0287 100755 --- a/src/Tizen.NUI/src/internal/Animation/RelativeConstraintWithParentFloat.cs +++ b/src/Tizen.NUI/src/internal/Animation/RelativeConstraintWithParentFloat.cs @@ -18,7 +18,7 @@ namespace Tizen.NUI { using global::System.Runtime.InteropServices; - + /// /// 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(); } } } diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.Rotation.cs b/src/Tizen.NUI/src/internal/Interop/Interop.Rotation.cs index 6940622f0..f821c6219 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.Rotation.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.Rotation.cs @@ -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); diff --git a/src/Tizen.NUI/src/public/Animation/Animatable.cs b/src/Tizen.NUI/src/public/Animation/Animatable.cs index 8d515dbd4..fce9a54af 100755 --- a/src/Tizen.NUI/src/public/Animation/Animatable.cs +++ b/src/Tizen.NUI/src/public/Animation/Animatable.cs @@ -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; } diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index c109da805..b2cead4fb 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -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; diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs index 7a8af4566..d9c5c221f 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs @@ -1430,12 +1430,10 @@ namespace Tizen.NUI.BaseComponents } if (widthConstraint != null) { - widthConstraint.Remove(); widthConstraint.Dispose(); } if (heightConstraint != null) { - heightConstraint.Remove(); heightConstraint.Dispose(); } diff --git a/src/Tizen.NUI/src/public/Common/Property.cs b/src/Tizen.NUI/src/public/Common/Property.cs index 437f06313..ad318c137 100755 --- a/src/Tizen.NUI/src/public/Common/Property.cs +++ b/src/Tizen.NUI/src/public/Common/Property.cs @@ -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); diff --git a/src/Tizen.NUI/src/public/Common/Rotation.cs b/src/Tizen.NUI/src/public/Common/Rotation.cs index 559d3b4fe..0ea53229c 100755 --- a/src/Tizen.NUI/src/public/Common/Rotation.cs +++ b/src/Tizen.NUI/src/public/Common/Rotation.cs @@ -462,6 +462,18 @@ namespace Tizen.NUI { } + /// + /// Assign. + /// + /// A reference to the copied handle. + /// A reference to this. + 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)