using System; using Avalonia.VisualTree; namespace Avalonia.Input.TextInput { public interface ITextInputMethodClient { /// /// The cursor rectangle relative to the TextViewVisual /// Rect CursorRectangle { get; } /// /// Should be fired when cursor rectangle is changed inside the TextViewVisual /// event EventHandler? CursorRectangleChanged; /// /// The visual that's showing the text /// Visual TextViewVisual { get; } /// /// Should be fired when text-hosting visual is changed /// event EventHandler? TextViewVisualChanged; /// /// Indicates if TextViewVisual is capable of displaying non-committed input on the cursor position /// bool SupportsPreedit { get; } /// /// Sets the non-committed input string /// void SetPreeditText(string? text); /// /// Indicates if text input client is capable of providing the text around the cursor /// bool SupportsSurroundingText { get; } /// /// Returns the text around the cursor, usually the current paragraph, the cursor position inside that text and selection start position /// TextInputMethodSurroundingText SurroundingText { get; } /// /// Should be fired when surrounding text changed /// event EventHandler? SurroundingTextChanged; void SelectInSurroundingText(int start, int end); } public record struct TextInputMethodSurroundingText { public string Text { get; set; } public int CursorOffset { get; set; } public int AnchorOffset { get; set; } } }