[NUI] Add IsWindowRotating()
authorWonsik Jung <sidein@samsung.com>
Mon, 25 Apr 2022 10:52:17 +0000 (19:52 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 26 Apr 2022 04:41:13 +0000 (13:41 +0900)
Add IsWindowRotationg function.
It is return with true when window is rotating.

src/Tizen.NUI/src/internal/Interop/Interop.Window.cs
src/Tizen.NUI/src/public/Window/Window.cs
test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/WindowTest.cs

index e6713b7..80c599a 100755 (executable)
@@ -286,6 +286,10 @@ namespace Tizen.NUI
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_IsMinimized")]
             public static extern bool IsMinimized(global::System.Runtime.InteropServices.HandleRef window);
+
+            [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);
         }
     }
 }
index 4ef9685..86f380a 100644 (file)
@@ -1704,6 +1704,18 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// Query whether window is rotating or not.
+        /// </summary>
+        /// <returns>True if window is rotating, false otherwise.</returns>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool IsWindowRotating()
+        {
+            bool ret = Interop.Window.IsWindowRotating(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        /// <summary>
         /// Add FrameUpdateCallback
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
index 9ff6f99..83078fc 100644 (file)
@@ -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;
 
         private const string KEY_NUM_1 = "1";
         private const string KEY_NUM_2 = "2";
@@ -47,11 +49,32 @@ namespace Tizen.NUI.Samples
             text.WidthResizePolicy = ResizePolicyType.FillToParent;
             mainWin.Add(text);
 
+            List<Window.WindowOrientation> list = new List<Window.WindowOrientation>();
+
+            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)