From f8d6893df1d7f99fe2715b5484cedbbffe9e6484 Mon Sep 17 00:00:00 2001 From: Wonsik Jung Date: Thu, 1 Jul 2021 19:38:37 +0900 Subject: [PATCH] [NUI] Add new features for window 1. Supports IME window and application. It is only for internal IME window and application. These new APIs should be not public. 2. Supports floating window mode. 3. Supports window resized/moved by display server. --- .../src/internal/Application/Application.cs | 20 ++++ .../src/internal/Application/NUICoreBackend.cs | 31 +++++- .../src/internal/Interop/Interop.Application.cs | 3 + .../src/internal/Interop/Interop.Window.cs | 13 +++ .../src/public/Application/NUIApplication.cs | 16 ++++ src/Tizen.NUI/src/public/Common/NUIConstants.cs | 10 +- src/Tizen.NUI/src/public/Window/Window.cs | 105 +++++++++++++++++++++ 7 files changed, 194 insertions(+), 4 deletions(-) diff --git a/src/Tizen.NUI/src/internal/Application/Application.cs b/src/Tizen.NUI/src/internal/Application/Application.cs index df61a79..11533dd 100755 --- a/src/Tizen.NUI/src/internal/Application/Application.cs +++ b/src/Tizen.NUI/src/internal/Application/Application.cs @@ -1090,6 +1090,19 @@ namespace Tizen.NUI return instance; } + public static Application NewApplication(string stylesheet, NUIApplication.WindowMode windowMode, Rectangle positionSize, WindowType type) + { + if (instance) + { + return instance; + } + Application ret = New(1, stylesheet, windowMode, positionSize, type); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + instance = ret; + return instance; + } + /// /// Ensures that the function passed in is called from the main loop when it is idle. /// @@ -1193,6 +1206,13 @@ namespace Tizen.NUI return ret; } + public static Application New(int argc, string stylesheet, NUIApplication.WindowMode windowMode, Rectangle positionSize, WindowType type) + { + Application ret = new Application(Interop.Application.New(argc, stylesheet, (int)windowMode, Rectangle.getCPtr(positionSize), (int)type), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + public Application() : this(Interop.Application.NewApplication(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); diff --git a/src/Tizen.NUI/src/internal/Application/NUICoreBackend.cs b/src/Tizen.NUI/src/internal/Application/NUICoreBackend.cs index 4fc4d38..61fa960 100755 --- a/src/Tizen.NUI/src/internal/Application/NUICoreBackend.cs +++ b/src/Tizen.NUI/src/internal/Application/NUICoreBackend.cs @@ -16,6 +16,7 @@ */ using System; +using System.ComponentModel; using System.Collections.Generic; using Tizen.Applications.CoreBackend; using Tizen.Applications; @@ -31,6 +32,7 @@ namespace Tizen.NUI private string stylesheet = ""; private NUIApplication.WindowMode windowMode = NUIApplication.WindowMode.Opaque; private Rectangle windowRectangle = null; + private WindowType defaultWindowType = WindowType.Normal; /// /// The Dictionary to contain each type of event callback. @@ -75,6 +77,22 @@ namespace Tizen.NUI } /// + /// The constructor with stylesheet, window mode, window size, window position and default window type. + /// This will be hidden as inhouse API. Because it is only for internal IME window. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public NUICoreBackend(string stylesheet, NUIApplication.WindowMode windowMode, Size2D windowSize, Position2D windowPosition, WindowType type) + { + this.stylesheet = stylesheet; + this.windowMode = windowMode; + if (windowSize != null && windowPosition != null) + { + this.windowRectangle = new Rectangle(windowPosition.X, windowPosition.Y, windowSize.Width, windowSize.Height); + } + this.defaultWindowType = type; + } + + /// /// Adds NUIApplication event to Application. /// Puts each type of event callback in Dictionary. /// @@ -147,13 +165,20 @@ namespace Tizen.NUI args[0] = this.GetType().Assembly.FullName.Replace(" ", ""); } - if (windowRectangle != null) + if(defaultWindowType != WindowType.Normal) { - application = Application.NewApplication(args, stylesheet, windowMode, windowRectangle); + application = Application.NewApplication(stylesheet, windowMode, windowRectangle, defaultWindowType); } else { - application = Application.NewApplication(args, stylesheet, windowMode); + if (windowRectangle != null) + { + application = Application.NewApplication(args, stylesheet, windowMode, windowRectangle); + } + else + { + application = Application.NewApplication(args, stylesheet, windowMode); + } } application.BatteryLow += OnBatteryLow; diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.Application.cs b/src/Tizen.NUI/src/internal/Interop/Interop.Application.cs index 2cf4f32..02f79d5 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.Application.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.Application.cs @@ -87,6 +87,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_New__SWIG_4")] public static extern global::System.IntPtr New(int jarg1, string jarg3, int jarg4, global::System.Runtime.InteropServices.HandleRef jarg5); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Application_New__SWIG_5")] + public static extern global::System.IntPtr New(int jarg1, string jarg3, int jarg4, global::System.Runtime.InteropServices.HandleRef jarg5, int jarg6); } } } diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs b/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs index 6762912..be9907c 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.Window.cs @@ -234,6 +234,19 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_GetNativeId")] public static extern int GetNativeId(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_SetPositionSizeWithOrientation")] + public static extern void SetPositionSizeWithOrientation(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_EnableFloatingMode")] + public static extern void EnableFloatingMode(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_RequestMoveToServer")] + public static extern void RequestMoveToServer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_RequestResizeToServer")] + public static extern void RequestResizeToServer(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + } } } diff --git a/src/Tizen.NUI/src/public/Application/NUIApplication.cs b/src/Tizen.NUI/src/public/Application/NUIApplication.cs index 848511b..75f11ec 100755 --- a/src/Tizen.NUI/src/public/Application/NUIApplication.cs +++ b/src/Tizen.NUI/src/public/Application/NUIApplication.cs @@ -158,6 +158,22 @@ namespace Tizen.NUI } /// + /// The constructor with a stylesheet, window mode, window size, position and default window type. + /// + /// The styleSheet URL. + /// The windowMode. + /// The window size. + /// The window position. + /// The default window type. + /// 9 + /// This should be hidden. Because the major purpose is to support IME window as keyboard application. + [EditorBrowsable(EditorBrowsableState.Never)] + public NUIApplication(string styleSheet, WindowMode windowMode, Size2D windowSize, Position2D windowPosition, WindowType type) : base(new NUICoreBackend(styleSheet, windowMode, windowSize, windowPosition, type)) + { + ExternalThemeManager.Initialize(); + } + + /// /// Occurs whenever the application is resumed. /// /// 4 diff --git a/src/Tizen.NUI/src/public/Common/NUIConstants.cs b/src/Tizen.NUI/src/public/Common/NUIConstants.cs index 9eed615..741e704 100755 --- a/src/Tizen.NUI/src/public/Common/NUIConstants.cs +++ b/src/Tizen.NUI/src/public/Common/NUIConstants.cs @@ -755,7 +755,15 @@ namespace Tizen.NUI /// /// Used for simple dialog windows. /// - Dialog + Dialog, + /// + /// Used for IME window that is used for keyboard window. + /// It should be set in Application's New input param when application is created. + /// In addition, it is only for internal keyboard application. + /// This should be hidden. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + Ime } /// 3 diff --git a/src/Tizen.NUI/src/public/Window/Window.cs b/src/Tizen.NUI/src/public/Window/Window.cs index a37ee09..376782b 100755 --- a/src/Tizen.NUI/src/public/Window/Window.cs +++ b/src/Tizen.NUI/src/public/Window/Window.cs @@ -280,6 +280,54 @@ namespace Tizen.NUI NotSupported, } + /// + /// Enumeration for window resized mode by display server. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public enum ResizeDirection + { + /// + /// Start resizing window to the top-left edge. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + TopLeft = 1, + /// + /// Start resizing window to the top side. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + Top = 2, + /// + /// Start resizing window to the top-right edge. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + TopRight = 3, + /// + /// Start resizing window to the left side. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + Left = 4, + /// + /// Start resizing window to the right side. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + Right = 5, + /// + /// Start resizing window to the bottom-left edge. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + BottomLeft = 6, + /// + /// Start resizing window to the bottom side. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + Bottom = 7, + /// + /// Start resizing window to the bottom-right edge. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + BottomRight = 8, + } + /// /// The stage instance property (read-only).
@@ -1200,6 +1248,24 @@ namespace Tizen.NUI } /// + /// Sets window position and size for specific orientation. + /// This api reserves the position and size per orientation to display server. + /// When the device is rotated, the window is moved/resized with the reserved position/size by display server. + /// Currently, it only works when the window's type is WindowType::Ime. + /// It means this function is only for IME window of internal keyboard application. + /// It is only for internal keyboard application. + /// This should be hidden. + /// + /// The reserved position and size for the orientation. + /// The orientation. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetPositionSizeWithOrientation(Rectangle positionSize, Window.WindowOrientation orientation) + { + Interop.Window.SetPositionSizeWithOrientation(SwigCPtr, Rectangle.getCPtr(positionSize), (int)orientation); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// /// Get native window ID /// /// native window ID @@ -1382,6 +1448,45 @@ namespace Tizen.NUI } /// + /// Enables the floating mode of window. + /// The floating mode is to support window is moved or resized by display server. + /// For example, if the video-player window sets the floating mode, + /// then display server changes its geometry and handles it like a popup. + /// The way of handling floating mode window is decided by display server. + /// A special display server(as a Tizen display server) supports this mode. + /// + /// Enable floating mode or not. + [EditorBrowsable(EditorBrowsableState.Never)] + public void EnableFloatingMode(bool enable) + { + Interop.Window.EnableFloatingMode(SwigCPtr, enable); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Requests to display server for the window is moved by display server. + /// It can be work with setting window floating mode. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public void RequestMoveToServer() + { + Interop.Window.RequestMoveToServer(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Requests to display server for the window is resized by display server. + /// It can be work with setting window floating mode. + /// + /// It is indicated the window's side or edge for starting point. + [EditorBrowsable(EditorBrowsableState.Never)] + public void RequestResizeToServer(ResizeDirection direction) + { + Interop.Window.RequestResizeToServer(SwigCPtr, (int)direction); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// /// Add FrameUpdateCallback /// [EditorBrowsable(EditorBrowsableState.Never)] -- 2.7.4