From 4a546765d129db604252149e09ecac90f177e4a9 Mon Sep 17 00:00:00 2001 From: "huayong.xu" Date: Thu, 21 Nov 2024 17:15:59 +0800 Subject: [PATCH] [NUI] Add APIs for setting IME position, cursor theme name. --- .../internal/Interop/Interop.WebSettings.cs | 6 ++ .../src/internal/Interop/Interop.WebView.cs | 6 ++ .../src/internal/WebView/WebSettings.cs | 42 ++++++++++ src/Tizen.NUI/src/public/WebView/WebView.cs | 84 +++++++++++++++++++ 4 files changed, 138 insertions(+) diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WebSettings.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WebSettings.cs index b1013763d2c..6599ead1636 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.WebSettings.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.WebSettings.cs @@ -175,6 +175,12 @@ internal static partial class WebSettings [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)] public static extern bool IsTextZoomEnabled(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebSettings_SetImeStyle")] + public static extern void SetImeStyle(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebSettings_GetImeStyle")] + public static extern int GetImeStyle(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebSettings_SetExtraFeature")] public static extern void SetExtraFeature(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, bool jarg3); diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs index faa326dfdaa..9bf1c031095 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs @@ -171,6 +171,12 @@ internal static partial class WebView [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)] public static extern bool StopInspectorServer(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_SetImePositionAndAlignment")] + public static extern void SetImePositionAndAlignment(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_SetCursorThemeName")] + public static extern void SetCursorThemeName(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_ScrollBy")] public static extern void ScrollBy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); diff --git a/src/Tizen.NUI/src/internal/WebView/WebSettings.cs b/src/Tizen.NUI/src/internal/WebView/WebSettings.cs index 96fc1526d63..b9eceb11289 100755 --- a/src/Tizen.NUI/src/internal/WebView/WebSettings.cs +++ b/src/Tizen.NUI/src/internal/WebView/WebSettings.cs @@ -39,6 +39,31 @@ internal WebSettings(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, c { } + /// + /// Enumeration for style of IME. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public enum WebImeStyle + { + /// + /// Full IME style + /// + [EditorBrowsable(EditorBrowsableState.Never)] + Full = 0, + + /// + /// Floating IME style + /// + [EditorBrowsable(EditorBrowsableState.Never)] + Floating, + + /// + /// Dynamic IME style + /// + [EditorBrowsable(EditorBrowsableState.Never)] + Dynamic, + } + /// /// Allows mixed contents or not. /// @@ -506,6 +531,23 @@ public bool TextZoomEnabled } } + /// + /// The style of IME. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public WebImeStyle ImeStyle + { + get + { + return (WebImeStyle)Interop.WebSettings.GetImeStyle(SwigCPtr); + } + set + { + Interop.WebSettings.SetImeStyle(SwigCPtr, (int)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + /// /// Enables the given extra feature. /// diff --git a/src/Tizen.NUI/src/public/WebView/WebView.cs b/src/Tizen.NUI/src/public/WebView/WebView.cs index 3fb6cf84d33..1233d3b07ea 100755 --- a/src/Tizen.NUI/src/public/WebView/WebView.cs +++ b/src/Tizen.NUI/src/public/WebView/WebView.cs @@ -1228,6 +1228,67 @@ public enum WebEngineType LWE = 1, } + /// + /// IME alignment in web page. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public enum ImeAlignment + { + /// + /// Top-left corner. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + TopLeft = 0, + + /// + /// top-center position. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + TopCenter, + + /// + /// Top-right corner. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + TopRight, + + /// + /// Middle-left position. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + MiddleLeft, + + /// + /// Middle-center position. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + MiddleCenter, + + /// + /// Middle-right position. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + MiddleRight, + + /// + /// Bottom-left corner. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + BottomLeft, + + /// + /// Bottom-center position. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + BottomCenter, + + /// + /// Bottom-right corner. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + BottomRight, + } + /// /// Context. /// @@ -2542,6 +2603,29 @@ public bool StopInspectorServer() return result; } + /// + /// Set the style of IME. + /// + /// The position of IME + /// The alignment of IME + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetImePositionAndAlignment(Vector2 position, ImeAlignment alignment) + { + Interop.WebView.SetImePositionAndAlignment(SwigCPtr, Vector2.getCPtr(position), (int)alignment); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Set the theme name of cursor. + /// + /// The theme name of cursor + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetCursorThemeName(string themeName) + { + Interop.WebView.SetCursorThemeName(SwigCPtr, themeName); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + /// /// Scrolls page of web view by deltaX and detlaY. ///