Skip to content

Commit

Permalink
[NUI] Add APIs for setting IME position, cursor theme name.
Browse files Browse the repository at this point in the history
  • Loading branch information
huayongxu committed Nov 26, 2024
1 parent 91d133d commit cd6bad0
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Tizen.NUI/src/internal/Interop/Interop.WebSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 6 additions & 0 deletions src/Tizen.NUI/src/internal/Interop/Interop.WebView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
42 changes: 42 additions & 0 deletions src/Tizen.NUI/src/internal/WebView/WebSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,31 @@ internal WebSettings(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, c
{
}

/// <summary>
/// Enumeration for style of IME.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public enum WebImeStyle
{
/// <summary>
/// Full IME style
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
Full = 0,

/// <summary>
/// Floating IME style
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
Floating,

/// <summary>
/// Dynamic IME style
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
Dynamic,
}

/// <summary>
/// Allows mixed contents or not.
/// </summary>
Expand Down Expand Up @@ -506,6 +531,23 @@ public bool TextZoomEnabled
}
}

/// <summary>
/// The style of IME.
/// </summary>
[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();
}
}

/// <summary>
/// Enables the given extra feature.
/// </summary>
Expand Down
84 changes: 84 additions & 0 deletions src/Tizen.NUI/src/public/WebView/WebView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,67 @@ public enum WebEngineType
LWE = 1,
}

/// <summary>
/// IME alignment in web page.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public enum ImeAlignment
{
/// <summary>
/// Top-left corner.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
TopLeft = 0,

/// <summary>
/// top-center position.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
TopCenter,

/// <summary>
/// Top-right corner.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
TopRight,

/// <summary>
/// Middle-left position.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
MiddleLeft,

/// <summary>
/// Middle-center position.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
MiddleCenter,

/// <summary>
/// Middle-right position.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
MiddleRight,

/// <summary>
/// Bottom-left corner.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
BottomLeft,

/// <summary>
/// Bottom-center position.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
BottomCenter,

/// <summary>
/// Bottom-right corner.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
BottomRight,
}

/// <summary>
/// Context.
/// </summary>
Expand Down Expand Up @@ -2542,6 +2603,29 @@ public bool StopInspectorServer()
return result;
}

/// <summary>
/// Set the style of IME.
/// </summary>
/// <param name="position">The position of IME</param>
/// <param name="alignment">The alignment of IME</param>
[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();
}

/// <summary>
/// Set the theme name of cursor.
/// </summary>
/// <param name="themeName">The theme name of cursor</param>
[EditorBrowsable(EditorBrowsableState.Never)]
public void SetCursorThemeName(string themeName)
{
Interop.WebView.SetCursorThemeName(SwigCPtr, themeName);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}

/// <summary>
/// Scrolls page of web view by deltaX and detlaY.
/// </summary>
Expand Down

0 comments on commit cd6bad0

Please sign in to comment.