Skip to main content

TextInputClient

Trait TextInputClient 

Source
pub trait TextInputClient: Sized + 'static {
    // Required methods
    fn current_text_editing_value(
        self: Handle<Self>,
        app: &App,
    ) -> Option<TextEditingValue>;
    fn update_editing_value(
        self: Handle<Self>,
        app: &mut App,
        value: TextEditingValue,
    );
    fn perform_action(
        self: Handle<Self>,
        app: &mut App,
        action: TextInputAction,
    );
    fn connection_closed(self: Handle<Self>, app: &mut App);

    // Provided methods
    fn perform_private_command(self: Handle<Self>, app: &mut App, action: &str) { ... }
    fn update_floating_cursor(
        self: Handle<Self>,
        app: &mut App,
        point: RawFloatingCursorPoint,
    ) { ... }
    fn show_autocorrection_prompt_rect(
        self: Handle<Self>,
        app: &mut App,
        start: i32,
        end: i32,
    ) { ... }
    fn show_toolbar(self: Handle<Self>, app: &mut App) { ... }
    fn insert_text_placeholder(self: Handle<Self>, app: &mut App, size: Size) { ... }
    fn remove_text_placeholder(self: Handle<Self>, app: &mut App) { ... }
    fn perform_selector(self: Handle<Self>, app: &mut App, selector_name: &str) { ... }
    fn as_text_input_client(self: Handle<Self>) -> AnyTextInputClient { ... }
}
Expand description

An interface to receive information from TextInput.

See also:

Required Methods§

Source

fn current_text_editing_value( self: Handle<Self>, app: &App, ) -> Option<TextEditingValue>

The current state of the TextEditingValue held by this client.

Source

fn update_editing_value( self: Handle<Self>, app: &mut App, value: TextEditingValue, )

Requests that this client update its editing state to the given value.

The new value is treated as user input and thus may subject to input formatting.

Source

fn perform_action(self: Handle<Self>, app: &mut App, action: TextInputAction)

Requests that this client perform the given action.

Source

fn connection_closed(self: Handle<Self>, app: &mut App)

Platform notified framework of closed connection.

TextInputClient should cleanup its connection and finalize editing.

Provided Methods§

Source

fn perform_private_command(self: Handle<Self>, app: &mut App, action: &str)

Request from the input method that this client perform the given private command.

Source

fn update_floating_cursor( self: Handle<Self>, app: &mut App, point: RawFloatingCursorPoint, )

Updates the floating cursor position and state.

Source

fn show_autocorrection_prompt_rect( self: Handle<Self>, app: &mut App, start: i32, end: i32, )

Requests that this client display a prompt rectangle for the given text range, to indicate the range of text that will be changed by a pending autocorrection.

Source

fn show_toolbar(self: Handle<Self>, app: &mut App)

Requests that the client show the editing toolbar, for example when the platform changes the selection through a non-flutter method such as scribble.

Source

fn insert_text_placeholder(self: Handle<Self>, app: &mut App, size: Size)

Requests that the client add a text placeholder to reserve visual space in the text.

Source

fn remove_text_placeholder(self: Handle<Self>, app: &mut App)

Requests that the client remove the text placeholder.

Source

fn perform_selector(self: Handle<Self>, app: &mut App, selector_name: &str)

Performs the specified MacOS-specific selector from the NSStandardKeyBindingResponding protocol or user-specified selector from DefaultKeyBinding.Dict.

Source

fn as_text_input_client(self: Handle<Self>) -> AnyTextInputClient

This client as the erased AnyTextInputClient.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§