// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace Microsoft.Maui.Platform.Linux.Services;
///
/// Interface for Input Method Editor (IME) services.
/// Provides support for complex text input methods like CJK languages.
///
public interface IInputMethodService
{
///
/// Gets whether IME is currently active.
///
bool IsActive { get; }
///
/// Gets the current pre-edit (composition) text.
///
string PreEditText { get; }
///
/// Gets the cursor position within the pre-edit text.
///
int PreEditCursorPosition { get; }
///
/// Initializes the IME service for the given window.
///
/// The native window handle.
void Initialize(nint windowHandle);
///
/// Sets focus to the specified input context.
///
/// The input context to focus.
void SetFocus(IInputContext? context);
///
/// Sets the cursor location for candidate window positioning.
///
/// X coordinate in screen space.
/// Y coordinate in screen space.
/// Width of the cursor area.
/// Height of the cursor area.
void SetCursorLocation(int x, int y, int width, int height);
///
/// Processes a key event through the IME.
///
/// The key code.
/// Key modifiers.
/// True for key press, false for key release.
/// True if the IME handled the event.
bool ProcessKeyEvent(uint keyCode, KeyModifiers modifiers, bool isKeyDown);
///
/// Resets the IME state, canceling any composition.
///
void Reset();
///
/// Shuts down the IME service.
///
void Shutdown();
///
/// Event raised when text is committed from IME.
///
event EventHandler? TextCommitted;
///
/// Event raised when pre-edit (composition) text changes.
///
event EventHandler? PreEditChanged;
///
/// Event raised when pre-edit is completed or cancelled.
///
event EventHandler? PreEditEnded;
}