pub trait TextInputMethodClient {
Show 29 methods
// Required methods
fn events(&self) -> &TextInputMethodClientEvents;
fn text_view_visual(&self) -> Option<Ref<Visual>>;
fn supports_preedit(&self) -> bool;
fn supports_surrounding_text(&self) -> bool;
fn surrounding_text(&self) -> String;
fn cursor_rectangle(&self) -> Rect;
fn selection(&self) -> TextSelection;
fn set_selection(&self, value: TextSelection);
// Provided methods
fn input_method_owner(&self) -> Option<Ref<InputElement>> { ... }
fn retains_input_method_focus(&self, _focused: &InputElement) -> bool { ... }
fn input_method_connection(&self) -> Option<Rc<TextInputMethodConnection>> { ... }
fn input_method_editing(&self) -> Option<&dyn TextInputMethodEditing> { ... }
fn input_method_state_revision(&self) -> Option<u64> { ... }
fn text_range_geometry(
&self,
_range: TextSelection,
) -> Result<TextInputMethodRangeGeometry, TextInputMethodError> { ... }
fn set_preedit_text(&self, _preedit_text: Option<&str>) { ... }
fn execute_context_menu_action(&self, _action: ContextMenuAction) { ... }
fn set_preedit_text_with_cursor(
&self,
preedit_text: Option<&str>,
_cursor_pos: Option<i32>,
) { ... }
fn text_view_visual_changed(
&self,
handler: Rc<dyn Fn()>,
) -> Rc<dyn IDisposable> { ... }
fn cursor_rectangle_changed(
&self,
handler: Rc<dyn Fn()>,
) -> Rc<dyn IDisposable> { ... }
fn surrounding_text_changed(
&self,
handler: Rc<dyn Fn()>,
) -> Rc<dyn IDisposable> { ... }
fn selection_changed(&self, handler: Rc<dyn Fn()>) -> Rc<dyn IDisposable> { ... }
fn reset_requested(&self, handler: Rc<dyn Fn()>) -> Rc<dyn IDisposable> { ... }
fn input_pane_activation_requested(
&self,
handler: Rc<dyn Fn()>,
) -> Rc<dyn IDisposable> { ... }
fn raise_text_view_visual_changed(&self) { ... }
fn raise_cursor_rectangle_changed(&self) { ... }
fn raise_surrounding_text_changed(&self) { ... }
fn raise_selection_changed(&self) { ... }
fn raise_input_pane_activation_requested(&self) { ... }
fn request_reset(&self) { ... }
}Expand description
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 and provide the
members describing the text; the events and the methods raising them are
provided. Clients are compared by reference.
Required Methods§
Sourcefn events(&self) -> &TextInputMethodClientEvents
fn events(&self) -> &TextInputMethodClientEvents
The events of the client.
Sourcefn text_view_visual(&self) -> Option<Ref<Visual>>
fn text_view_visual(&self) -> Option<Ref<Visual>>
The visual that’s showing the text, or None when the client has
none (a text box without a template).
Sourcefn supports_preedit(&self) -> bool
fn supports_preedit(&self) -> bool
Indicates if the text input method client is capable of displaying non-committed input on the cursor position.
Sourcefn supports_surrounding_text(&self) -> bool
fn supports_surrounding_text(&self) -> bool
Indicates if the text input method client supports sending surrounding text.
Sourcefn surrounding_text(&self) -> String
fn surrounding_text(&self) -> String
Returns the text around the cursor, usually the current paragraph.
Sourcefn cursor_rectangle(&self) -> Rect
fn cursor_rectangle(&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.
Sourcefn selection(&self) -> TextSelection
fn selection(&self) -> TextSelection
Gets the selection that is currently active.
Sourcefn set_selection(&self, value: TextSelection)
fn set_selection(&self, value: TextSelection)
Sets the selection that is currently active.
Provided Methods§
Sourcefn input_method_owner(&self) -> Option<Ref<InputElement>>
fn input_method_owner(&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.
Sourcefn retains_input_method_focus(&self, _focused: &InputElement) -> bool
fn retains_input_method_focus(&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.
Sourcefn input_method_connection(&self) -> Option<Rc<TextInputMethodConnection>>
fn input_method_connection(&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.
Sourcefn input_method_editing(&self) -> Option<&dyn TextInputMethodEditing>
fn input_method_editing(&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.
Sourcefn input_method_state_revision(&self) -> Option<u64>
fn input_method_state_revision(&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.
Sourcefn text_range_geometry(
&self,
_range: TextSelection,
) -> Result<TextInputMethodRangeGeometry, TextInputMethodError>
fn text_range_geometry( &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.
Sourcefn set_preedit_text(&self, _preedit_text: Option<&str>)
fn set_preedit_text(&self, _preedit_text: Option<&str>)
Sets the non-committed input string.
Executes a context menu action.
Sourcefn set_preedit_text_with_cursor(
&self,
preedit_text: Option<&str>,
_cursor_pos: Option<i32>,
)
fn set_preedit_text_with_cursor( &self, preedit_text: Option<&str>, _cursor_pos: Option<i32>, )
Sets the non-committed input string and the cursor offset in that string.
Sourcefn text_view_visual_changed(&self, handler: Rc<dyn Fn()>) -> Rc<dyn IDisposable>
fn text_view_visual_changed(&self, handler: Rc<dyn Fn()>) -> Rc<dyn IDisposable>
Fires when the text view visual has changed. Disposing the returned handle unsubscribes.
Sourcefn cursor_rectangle_changed(&self, handler: Rc<dyn Fn()>) -> Rc<dyn IDisposable>
fn cursor_rectangle_changed(&self, handler: Rc<dyn Fn()>) -> Rc<dyn IDisposable>
Fires when the cursor rectangle has changed. Disposing the returned handle unsubscribes.
Sourcefn surrounding_text_changed(&self, handler: Rc<dyn Fn()>) -> Rc<dyn IDisposable>
fn surrounding_text_changed(&self, handler: Rc<dyn Fn()>) -> Rc<dyn IDisposable>
Fires when the surrounding text has changed. Disposing the returned handle unsubscribes.
Sourcefn selection_changed(&self, handler: Rc<dyn Fn()>) -> Rc<dyn IDisposable>
fn selection_changed(&self, handler: Rc<dyn Fn()>) -> Rc<dyn IDisposable>
Fires when the selection has changed. Disposing the returned handle unsubscribes.
Sourcefn reset_requested(&self, handler: Rc<dyn Fn()>) -> Rc<dyn IDisposable>
fn reset_requested(&self, handler: Rc<dyn Fn()>) -> Rc<dyn IDisposable>
Fires when client wants to reset the input state. Disposing the returned handle unsubscribes.
Sourcefn input_pane_activation_requested(
&self,
handler: Rc<dyn Fn()>,
) -> Rc<dyn IDisposable>
fn input_pane_activation_requested( &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.
Sourcefn raise_text_view_visual_changed(&self)
fn raise_text_view_visual_changed(&self)
Raises the event telling that the text view visual has changed.
Sourcefn raise_cursor_rectangle_changed(&self)
fn raise_cursor_rectangle_changed(&self)
Raises the event telling that the cursor rectangle has changed.
Sourcefn raise_surrounding_text_changed(&self)
fn raise_surrounding_text_changed(&self)
Raises the event telling that the surrounding text has changed.
Sourcefn raise_selection_changed(&self)
fn raise_selection_changed(&self)
Raises the event telling that the selection has changed.
Sourcefn raise_input_pane_activation_requested(&self)
fn raise_input_pane_activation_requested(&self)
Raises the event asking for the input pane to be shown.
Sourcefn request_reset(&self)
fn request_reset(&self)
Asks for the input state to be reset.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".