From: Daekwang Ryu Date: Thu, 23 Mar 2023 08:41:59 +0000 (+0900) Subject: [NUI] Introduce WindowLayoutType enum and SetLayout Method X-Git-Tag: submit/tizen/20230405.121926~1^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e64d75a4d65f4f61b34e7f0b1d6ae4b872cc85a;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Introduce WindowLayoutType enum and SetLayout Method The new `SetLayout` method allows users to easily snap windows to specific positions and sizes. This feature is allowing users to quickly arrange their windows in a convenient and efficient manner. --- diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs b/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs index 32933b3b4..d7b9acf3c 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs @@ -301,6 +301,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_Set_Minimum_Size")] public static extern void SetMimimumSize(global::System.Runtime.InteropServices.HandleRef window, global::System.Runtime.InteropServices.HandleRef size); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_SetLayout")] + public static extern void SetLayout(global::System.Runtime.InteropServices.HandleRef window, uint numCols, uint numRows, uint column, uint row, uint colSpan, uint rowSpan); + [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/Common/NUIConstants.cs b/src/Tizen.NUI/src/public/Common/NUIConstants.cs index ba073f7bc..0ece9f70b 100755 --- a/src/Tizen.NUI/src/public/Common/NUIConstants.cs +++ b/src/Tizen.NUI/src/public/Common/NUIConstants.cs @@ -786,6 +786,70 @@ namespace Tizen.NUI Desktop } + /// + /// An enum of window layout types. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public enum WindowLayoutType + { + /// + /// Window is placed on the left half of the screen + /// + LeftHalf, + /// + /// Window is placed on the right half of the screen + /// + RightHalf, + /// + /// Window is placed on the top half of the screen + /// + TopHalf, + /// + /// Window is placed on the bottom half of the screen + /// + BottomHalf, + /// + /// Window is placed on the upper-left quarter of the screen + /// + UpperLeftQuarter, + /// + /// Window is placed on the upper-right quarter of the screen + /// + UpperRightQuarter, + /// + /// Window is placed on the lower-left quarter of the screen + /// + LowerLeftQuarter, + /// + /// Window is placed on the lower-right quarter of the screen + /// + LowerRightQuarter, + /// + /// Window is placed on the left third of the screen horizontally + /// + LeftThird, + /// + /// Window is placed on the center third of the screen horizontally + /// + CenterThird, + /// + /// Window is placed on the right third of the screen horizontally + /// + RightThird, + /// + /// Window is placed on the top third of the screen vertically + /// + TopThird, + /// + /// Window is placed on the middle third of the screen vertically + /// + MiddleThird, + /// + /// Window is placed on the bottom third of the screen vertically + /// + BottomThird, + } + /// 3 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names")] public enum DisposeTypes diff --git a/src/Tizen.NUI/src/public/Window/Window.cs b/src/Tizen.NUI/src/public/Window/Window.cs index 0d1fea910..8e7f44f1b 100755 --- a/src/Tizen.NUI/src/public/Window/Window.cs +++ b/src/Tizen.NUI/src/public/Window/Window.cs @@ -1752,6 +1752,83 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Sets the layout of the window. + /// + /// The number of columns in the layout. + /// The number of rows in the layout. + /// The column number of the window within the layout. + /// The row number of the window within the layout. + /// The number of columns the window should span within the layout. + /// The number of rows the window should span within the layout. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetLayout(uint numCols, uint numRows, uint column, uint row, uint colSpan, uint rowSpan) + { + Interop.Window.SetLayout(SwigCPtr, numCols, numRows, column, row, colSpan, rowSpan); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + /// + /// Sets the layout of the window. + /// + /// The type of layout to set for the window. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetLayout(WindowLayoutType layoutType) + { + switch (layoutType) + { + case WindowLayoutType.LeftHalf: + Interop.Window.SetLayout(SwigCPtr, 2, 1, 0, 0, 1, 1); + break; + case WindowLayoutType.RightHalf: + Interop.Window.SetLayout(SwigCPtr, 2, 1, 1, 0, 1, 1); + break; + + case WindowLayoutType.TopHalf: + Interop.Window.SetLayout(SwigCPtr, 1, 2, 0, 0, 1, 1); + break; + case WindowLayoutType.BottomHalf: + Interop.Window.SetLayout(SwigCPtr, 1, 2, 0, 1, 1, 1); + break; + + case WindowLayoutType.UpperLeftQuarter: + Interop.Window.SetLayout(SwigCPtr, 2, 2, 0, 0, 1, 1); + break; + case WindowLayoutType.UpperRightQuarter: + Interop.Window.SetLayout(SwigCPtr, 2, 2, 1, 0, 1, 1); + break; + case WindowLayoutType.LowerLeftQuarter: + Interop.Window.SetLayout(SwigCPtr, 2, 2, 0, 1, 1, 1); + break; + case WindowLayoutType.LowerRightQuarter: + Interop.Window.SetLayout(SwigCPtr, 2, 2, 1, 1, 1, 1); + break; + + case WindowLayoutType.LeftThird: + Interop.Window.SetLayout(SwigCPtr, 3, 1, 0, 0, 1, 1); + break; + case WindowLayoutType.CenterThird: + Interop.Window.SetLayout(SwigCPtr, 3, 1, 1, 0, 1, 1); + break; + case WindowLayoutType.RightThird: + Interop.Window.SetLayout(SwigCPtr, 3, 1, 2, 0, 1, 1); + break; + + case WindowLayoutType.TopThird: + Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 0, 1, 1); + break; + case WindowLayoutType.MiddleThird: + Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 1, 1, 1); + break; + case WindowLayoutType.BottomThird: + Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 2, 1, 1); + break; + } + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + /// /// Query whether window is rotating or not. /// @@ -1844,7 +1921,7 @@ namespace Tizen.NUI { return; } - + this.DisconnectNativeSignals(); if (type == DisposeTypes.Explicit)