# TextInputMethodClient

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/input/text_input/trait-textinputmethodclient/

**trait** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
trait TextInputMethodClient
```

The text editing side of a text input method: what a text editing
control gives the input method of the platform to work with.

Implementations embed a [`TextInputMethodClientEvents`](/docs/0.5.0/api/ferroui-base/input/text_input/struct-textinputmethodclientevents/) and provide the
members describing the text; the events and the methods raising them are
provided. Clients are compared by reference.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L91)

## Members

- [`events`](#function-events)
- [`input_method_owner`](#function-input_method_owner)
- [`retains_input_method_focus`](#function-retains_input_method_focus)
- [`input_method_connection`](#function-input_method_connection)
- [`input_method_editing`](#function-input_method_editing)
- [`input_method_state_revision`](#function-input_method_state_revision)
- [`text_view_visual`](#function-text_view_visual)
- [`supports_preedit`](#function-supports_preedit)
- [`supports_surrounding_text`](#function-supports_surrounding_text)
- [`input_options`](#function-input_options)
- [`surrounding_text`](#function-surrounding_text)
- [`cursor_rectangle`](#function-cursor_rectangle)
- [`text_range_geometry`](#function-text_range_geometry)
- [`selection`](#function-selection)
- [`set_selection`](#function-set_selection)
- [`set_preedit_text`](#function-set_preedit_text)
- [`execute_context_menu_action`](#function-execute_context_menu_action)
- [`set_preedit_text_with_cursor`](#function-set_preedit_text_with_cursor)
- [`text_view_visual_changed`](#function-text_view_visual_changed)
- [`cursor_rectangle_changed`](#function-cursor_rectangle_changed)
- [`surrounding_text_changed`](#function-surrounding_text_changed)
- [`selection_changed`](#function-selection_changed)
- [`reset_requested`](#function-reset_requested)
- [`input_pane_activation_requested`](#function-input_pane_activation_requested)
- [`raise_text_view_visual_changed`](#function-raise_text_view_visual_changed)
- [`raise_cursor_rectangle_changed`](#function-raise_cursor_rectangle_changed)
- [`raise_surrounding_text_changed`](#function-raise_surrounding_text_changed)
- [`raise_selection_changed`](#function-raise_selection_changed)
- [`raise_input_pane_activation_requested`](#function-raise_input_pane_activation_requested)
- [`request_reset`](#function-request_reset)

<a id="function-events"></a>

### events

```rust
fn events(self: &Self) -> &TextInputMethodClientEvents
```

The events of the client.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L93)

<a id="function-input_method_owner"></a>

### input_method_owner

```rust
fn input_method_owner(self: &Self) -> Option<Ref<InputElement>>
```

The semantic control that receives input and supplies options/geometry.
Existing clients default to the element queried by the input manager.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L97)

<a id="function-retains_input_method_focus"></a>

### retains_input_method_focus

```rust
fn retains_input_method_focus(self: &Self, _focused: &InputElement) -> bool
```

Whether a focus destination belongs to this client's active editing UI.
The client must check actual object identity and current ownership.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L103)

<a id="function-input_method_connection"></a>

### input_method_connection

```rust
fn input_method_connection(self: &Self) -> Option<Rc<TextInputMethodConnection>>
```

The current manager connection; adapters capture it during `set_client`.
The manager connects only a client that implements
`input_method_editing`; for any other client
this is `None`, and the platform backends keep their upstream behaviour.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L111)

<a id="function-input_method_editing"></a>

### input_method_editing

```rust
fn input_method_editing(self: &Self) -> Option<&dyn TextInputMethodEditing>
```

Atomic composition, when implemented by this editing control. Returning
`Some` opts the client in to the exact-edit connection
(`TextInputMethodConnection`): its owner's options are published again when
they change, and a reset gives it a new connection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L119)

<a id="function-input_method_state_revision"></a>

### input_method_state_revision

```rust
fn input_method_state_revision(self: &Self) -> Option<u64>
```

Optional identity of the current editing state, including changes whose
public text/selection notifications are still deferred. A supporting
client advances this revision for changes to its document, selection or
composition state; reading it must describe the current state.

This getter is observational: it may update a private cache used to
produce the revision, but must not initiate edits, input operations or
ownership transitions. The connection defensively rejects observable
reentrancy; it cannot identify an unreported edit made by the getter
itself when the getter returns that edit's new revision.

Input sessions compare both this revision and the public event version.
Existing clients that return `None` continue to use their events alone.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L136)

<a id="function-text_view_visual"></a>

### text_view_visual

```rust
fn text_view_visual(self: &Self) -> Option<Ref<Visual>>
```

The visual that's showing the text, or `None` when the client has
none (a text box without a template).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L142)

<a id="function-supports_preedit"></a>

### supports_preedit

```rust
fn supports_preedit(self: &Self) -> bool
```

Indicates if the text input method client is capable of displaying
non-committed input on the cursor position.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L146)

<a id="function-supports_surrounding_text"></a>

### supports_surrounding_text

```rust
fn supports_surrounding_text(self: &Self) -> bool
```

Indicates if the text input method client supports sending
surrounding text.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L150)

<a id="function-input_options"></a>

### input_options

```rust
fn input_options(self: &Self, _focused_element: &Ref<InputElement>, options: TextInputOptions) -> TextInputOptions
```

Finalizes this client's native input options without overwriting the
focused element's attached values. The default keeps the supplied options.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L154)

<a id="function-surrounding_text"></a>

### surrounding_text

```rust
fn surrounding_text(self: &Self) -> String
```

Returns the text around the cursor, usually the current paragraph.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L159)

<a id="function-cursor_rectangle"></a>

### cursor_rectangle

```rust
fn cursor_rectangle(self: &Self) -> Rect
```

Gets the cursor rectangle relative to the semantic input owner. The
text-view visual is observed for layout changes; it may be a descendant.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L163)

<a id="function-text_range_geometry"></a>

### text_range_geometry

```rust
fn text_range_geometry(self: &Self, _range: TextSelection) -> Result<TextInputMethodRangeGeometry, TextInputMethodError>
```

Queries an ordered range of the visible UTF-16 story, including any
composition preview. The result covers the requested range without
changing selection, scrolling, composition or history. Read-only range
endpoints can lie inside a shaped cluster or a surrogate pair: use the
formatter's cluster bounds and insertion-edge rules for those positions.

`Unsupported` preserves the platform's legacy caret fallback. A client
that implements this capability returns `Unavailable` for hidden or
unformatted text, `InvalidRange` for invalid offsets, and `StateChanged`
for reentrant invalidation; these must never fall back to another caret.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L175)

<a id="function-selection"></a>

### selection

```rust
fn selection(self: &Self) -> TextSelection
```

Gets the selection that is currently active.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L183)

<a id="function-set_selection"></a>

### set_selection

```rust
fn set_selection(self: &Self, value: TextSelection)
```

Sets the selection that is currently active.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L186)

<a id="function-set_preedit_text"></a>

### set_preedit_text

```rust
fn set_preedit_text(self: &Self, _preedit_text: Option<&str>)
```

Sets the non-committed input string.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L189)

<a id="function-execute_context_menu_action"></a>

### execute_context_menu_action

```rust
fn execute_context_menu_action(self: &Self, _action: ContextMenuAction)
```

Executes a context menu action.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L192)

<a id="function-set_preedit_text_with_cursor"></a>

### set_preedit_text_with_cursor

```rust
fn set_preedit_text_with_cursor(self: &Self, preedit_text: Option<&str>, _cursor_pos: Option<i32>)
```

Sets the non-committed input string and the cursor offset in that
string.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L196)

<a id="function-text_view_visual_changed"></a>

### text_view_visual_changed

```rust
fn text_view_visual_changed(self: &Self, handler: Rc<dyn Fn() -> ()>) -> Rc<dyn IDisposable>
```

Fires when the text view visual has changed. Disposing the returned
handle unsubscribes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L202)

<a id="function-cursor_rectangle_changed"></a>

### cursor_rectangle_changed

```rust
fn cursor_rectangle_changed(self: &Self, handler: Rc<dyn Fn() -> ()>) -> Rc<dyn IDisposable>
```

Fires when the cursor rectangle has changed. Disposing the returned
handle unsubscribes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L208)

<a id="function-surrounding_text_changed"></a>

### surrounding_text_changed

```rust
fn surrounding_text_changed(self: &Self, handler: Rc<dyn Fn() -> ()>) -> Rc<dyn IDisposable>
```

Fires when the surrounding text has changed. Disposing the returned
handle unsubscribes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L214)

<a id="function-selection_changed"></a>

### selection_changed

```rust
fn selection_changed(self: &Self, handler: Rc<dyn Fn() -> ()>) -> Rc<dyn IDisposable>
```

Fires when the selection has changed. Disposing the returned handle
unsubscribes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L220)

<a id="function-reset_requested"></a>

### reset_requested

```rust
fn reset_requested(self: &Self, handler: Rc<dyn Fn() -> ()>) -> Rc<dyn IDisposable>
```

Fires when client wants to reset the input state. Disposing the
returned handle unsubscribes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L226)

<a id="function-input_pane_activation_requested"></a>

### input_pane_activation_requested

```rust
fn input_pane_activation_requested(self: &Self, handler: Rc<dyn Fn() -> ()>) -> Rc<dyn IDisposable>
```

Fires when the client requires the input pane (on-screen keyboard)
to be shown. Disposing the returned handle unsubscribes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L232)

<a id="function-raise_text_view_visual_changed"></a>

### raise_text_view_visual_changed

```rust
fn raise_text_view_visual_changed(self: &Self)
```

Raises the event telling that the text view visual has changed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L237)

<a id="function-raise_cursor_rectangle_changed"></a>

### raise_cursor_rectangle_changed

```rust
fn raise_cursor_rectangle_changed(self: &Self)
```

Raises the event telling that the cursor rectangle has changed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L242)

<a id="function-raise_surrounding_text_changed"></a>

### raise_surrounding_text_changed

```rust
fn raise_surrounding_text_changed(self: &Self)
```

Raises the event telling that the surrounding text has changed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L247)

<a id="function-raise_selection_changed"></a>

### raise_selection_changed

```rust
fn raise_selection_changed(self: &Self)
```

Raises the event telling that the selection has changed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L253)

<a id="function-raise_input_pane_activation_requested"></a>

### raise_input_pane_activation_requested

```rust
fn raise_input_pane_activation_requested(self: &Self)
```

Raises the event asking for the input pane to be shown.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L259)

<a id="function-request_reset"></a>

### request_reset

```rust
fn request_reset(self: &Self)
```

Asks for the input state to be reset.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/text_input/text_input_method_client.rs#L264)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
