[NUI] Add new features for window
authorWonsik Jung <sidein@samsung.com>
Thu, 1 Jul 2021 10:38:37 +0000 (19:38 +0900)
committerSangHyeon Jade Lee <dltkdgus1764@gmail.com>
Mon, 5 Jul 2021 09:51:44 +0000 (18:51 +0900)
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/Tizen.NUI/src/internal/Application/Application.cs
src/Tizen.NUI/src/internal/Application/NUICoreBackend.cs
src/Tizen.NUI/src/internal/Interop/Interop.Application.cs
src/Tizen.NUI/src/internal/Interop/Interop.Window.cs
src/Tizen.NUI/src/public/Application/NUIApplication.cs
src/Tizen.NUI/src/public/Common/NUIConstants.cs
src/Tizen.NUI/src/public/Window/Window.cs

index df61a79..11533dd 100755 (executable)
@@ -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;
+        }
+
         /// <summary>
         /// Ensures that the function passed in is called from the main loop when it is idle.
         /// </summary>
@@ -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();
index 4fc4d38..61fa960 100755 (executable)
@@ -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;
 
         /// <summary>
         /// The Dictionary to contain each type of event callback.
@@ -75,6 +77,22 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// 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.
+        /// </summary>
+        [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;
+        }
+
+        /// <summary>
         /// Adds NUIApplication event to Application.
         /// Puts each type of event callback in Dictionary.
         /// </summary>
@@ -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;
index 2cf4f32..02f79d5 100755 (executable)
@@ -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);
         }
     }
 }
index 6762912..be9907c 100755 (executable)
@@ -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);
+
+
         }
     }
 }
index 848511b..75f11ec 100755 (executable)
@@ -158,6 +158,22 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// The constructor with a stylesheet, window mode, window size, position and default window type.
+        /// </summary>
+        /// <param name="styleSheet">The styleSheet URL.</param>
+        /// <param name="windowMode">The windowMode.</param>
+        /// <param name="windowSize">The window size.</param>
+        /// <param name="windowPosition">The window position.</param>
+        /// <param name="type">The default window type.</param>
+        /// <since_tizen> 9 </since_tizen>
+        /// 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();
+        }
+
+        /// <summary>
         /// Occurs whenever the application is resumed.
         /// </summary>
         /// <since_tizen> 4 </since_tizen>
index 9eed615..741e704 100755 (executable)
@@ -755,7 +755,15 @@ namespace Tizen.NUI
         /// <summary>
         /// Used for simple dialog windows.
         /// </summary>
-        Dialog
+        Dialog,
+        /// <summary>
+        /// 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.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        Ime
     }
 
     /// <since_tizen> 3 </since_tizen>
index a37ee09..376782b 100755 (executable)
@@ -280,6 +280,54 @@ namespace Tizen.NUI
             NotSupported,
         }
 
+        /// <summary>
+        /// Enumeration for window resized mode by display server.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public enum ResizeDirection
+        {
+            /// <summary>
+            /// Start resizing window to the top-left edge.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            TopLeft = 1,
+            /// <summary>
+            /// Start resizing window to the top side.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Top = 2,
+            /// <summary>
+            /// Start resizing window to the top-right edge.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            TopRight = 3,
+            /// <summary>
+            /// Start resizing window to the left side.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Left = 4,
+            /// <summary>
+            /// Start resizing window to the right side.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Right = 5,
+            /// <summary>
+            /// Start resizing window to the bottom-left edge.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            BottomLeft = 6,
+            /// <summary>
+            /// Start resizing window to the bottom side.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Bottom = 7,
+            /// <summary>
+            /// Start resizing window to the bottom-right edge.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            BottomRight = 8,
+        }
+
 
         /// <summary>
         /// The stage instance property (read-only).<br />
@@ -1200,6 +1248,24 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// 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.
+        /// </summary>
+        /// <param name="positionSize">The reserved position and size for the orientation.</param>
+        /// <param name="orientation">The orientation.</param>
+        [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();
+        }
+
+        /// <summary>
         /// Get native window ID
         /// </summary>
         /// <returns>native window ID</returns>
@@ -1382,6 +1448,45 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// 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.
+        /// </summary>
+        /// <param name="enable">Enable floating mode or not.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void EnableFloatingMode(bool enable)
+        {
+            Interop.Window.EnableFloatingMode(SwigCPtr, enable);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Requests to display server for the window is moved by display server.
+        /// It can be work with setting window floating mode.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void RequestMoveToServer()
+        {
+            Interop.Window.RequestMoveToServer(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        ///  Requests to display server for the window is resized by display server.
+        /// It can be work with setting window floating mode.
+        /// </summary>
+        /// <param name="direction">It is indicated the window's side or edge for starting point.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void RequestResizeToServer(ResizeDirection direction)
+        {
+            Interop.Window.RequestResizeToServer(SwigCPtr, (int)direction);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
         /// Add FrameUpdateCallback
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]