[NUI] Add ScreenPositionSize (#4759)
authorJoogabYun <40262755+JoogabYun@users.noreply.github.com>
Fri, 18 Nov 2022 06:58:07 +0000 (15:58 +0900)
committerGitHub <noreply@github.com>
Fri, 18 Nov 2022 06:58:07 +0000 (15:58 +0900)
The ScreenPositionSize api gets the screen position and size.

src/Tizen.NUI/src/internal/Interop/Interop.Actor.cs
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs

index 88250b0..34f8d51 100755 (executable)
@@ -147,6 +147,10 @@ namespace Tizen.NUI
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_SetNeedGesturePropagation")]
             public static extern float SetNeedGesturePropagation(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_CalculateScreenExtents")]
+            public static extern global::System.IntPtr CalculateScreenExtents(global::System.Runtime.InteropServices.HandleRef jarg1);
+
 #if NUI_PROPERTY_CHANGE_1
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_InternalRetrievingPropertyVector2")]
             public static extern int InternalRetrievingPropertyVector2(HandleRef actor, int propertyType, HandleRef retrievingVector2);
index 143fa91..db1b8a9 100755 (executable)
@@ -1356,6 +1356,23 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// Retrieves the screen position and size of the view.<br />
+        /// </summary>
+        /// <remarks>
+        /// The float type Rectangle class is not ready yet.
+        /// Therefore, it transmits data in Vector4 class.
+        /// This type should later be changed to the appropriate data type.
+        /// </remarks>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Vector4 ScreenPositionSize
+        {
+            get
+            {
+                return GetCurrentScreenPositionSize();
+            }
+        }
+
+        /// <summary>
         /// Determines whether the pivot point should be used to determine the position of the view.
         /// This is false by default.
         /// </summary>
index d24362b..2e290ed 100755 (executable)
@@ -884,6 +884,13 @@ namespace Tizen.NUI.BaseComponents
 #endif
         }
 
+        internal Vector4 GetCurrentScreenPositionSize()
+        {
+            Vector4 ret = new Vector4(Interop.Actor.CalculateScreenExtents(SwigCPtr), true);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
+            return ret;
+        }
+
         internal void SetInheritPosition(bool inherit)
         {
             Interop.ActorInternal.SetInheritPosition(SwigCPtr, inherit);