From: Wonsik Jung Date: Tue, 18 Jan 2022 05:53:46 +0000 (+0900) Subject: [NUI] Add IsWindowRotating() X-Git-Tag: submit/tizen_6.5/20220118.074803~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=71314aa9df5a20ddda561c94e354e8353f4c2566;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Add IsWindowRotating() Add IsWindowRotationg function. It is return with true when window is rotating. --- diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs b/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs index b11bb3a..e2b9124 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs @@ -265,6 +265,10 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_ExcludeInputRegion")] public static extern void ExcludeInputRegion(global::System.Runtime.InteropServices.HandleRef window, global::System.Runtime.InteropServices.HandleRef inputRegion); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_IsWindowRotating")] + [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)] + public static extern bool IsWindowRotating(global::System.Runtime.InteropServices.HandleRef window); } } } diff --git a/src/Tizen.NUI/src/public/Window/Window.cs b/src/Tizen.NUI/src/public/Window/Window.cs index 8457efb..c5ca31c 100644 --- a/src/Tizen.NUI/src/public/Window/Window.cs +++ b/src/Tizen.NUI/src/public/Window/Window.cs @@ -1539,6 +1539,18 @@ namespace Tizen.NUI } /// + /// Query whether window is rotating or not. + /// + /// True if window is rotating, false otherwise. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsWindowRotating() + { + bool ret = Interop.Window.IsWindowRotating(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// /// Add FrameUpdateCallback /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/WindowTest.cs b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/WindowTest.cs index f7f2fbf..7bf0894 100644 --- a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/WindowTest.cs +++ b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/WindowTest.cs @@ -3,6 +3,7 @@ using global::System; using Tizen.NUI; using Tizen.NUI.BaseComponents; using Tizen.System; +using System.Collections.Generic; using NUnit.Framework; namespace Tizen.NUI.Samples @@ -16,6 +17,7 @@ namespace Tizen.NUI.Samples int screenHeight; int addingInput; + Timer tm; void Initialize() { @@ -41,11 +43,32 @@ namespace Tizen.NUI.Samples text.WidthResizePolicy = ResizePolicyType.FillToParent; mainWin.Add(text); + List list = new List(); + + list.Add(Window.WindowOrientation.Landscape); + list.Add(Window.WindowOrientation.LandscapeInverse); + list.Add(Window.WindowOrientation.NoOrientationPreference); + list.Add(Window.WindowOrientation.Portrait); + list.Add(Window.WindowOrientation.PortraitInverse); + + mainWin.SetAvailableOrientations(list); + Animation animation = new Animation(2000); animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(180.0f)), PositionAxis.X), 0, 500); animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(0.0f)), PositionAxis.X), 500, 1000); animation.Looping = true; animation.Play(); + + tm = new Timer(100); + tm.Tick += Tm_Tick; + tm.Start(); + } + + private bool Tm_Tick(object source, Timer.TickEventArgs e) + { + bool rotating = mainWin.IsWindowRotating(); + log.Fatal(tag, $"window is Rotating: {rotating}"); + return true; } private void WinTouchEvent(object sender, Window.TouchEventArgs e)