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
///
IVisual TextViewVisual { get; }
///
/// Should be fired when text-hosting visual is changed
///
event EventHandler TextViewVisualChanged;
///
/// Indicates if TextViewVisual is capable of displaying non-commited input on the cursor position
///
bool SupportsPreedit { get; }
///
/// Sets the non-commited 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;
///
/// Returns the text before the cursor. Must return a non-empty string if cursor is not at the beginning of the text entry
///
string TextBeforeCursor { get; }
///
/// Returns the text before the cursor. Must return a non-empty string if cursor is not at the end of the text entry
///
string TextAfterCursor { get; }
}
public struct TextInputMethodSurroundingText
{
public string Text { get; set; }
public int CursorOffset { get; set; }
public int AnchorOffset { get; set; }
}
}