Trait druid::text::ImeHandlerRef

source ·
pub trait ImeHandlerRef {
    // Required methods
    fn is_alive(&self) -> bool;
    fn acquire(&self, mutable: bool) -> Option<Box<dyn InputHandler + 'static>>;
    fn release(&self) -> bool;
}
Expand description

A trait for input handlers registered by widgets.

A widget registers itself as accepting text input by calling LifeCycleCtx::register_text_input while handling the LifeCycle::WidgetAdded event.

The widget does not explicitly deregister afterwards; rather anytime the widget tree changes, druid will call is_alive on each registered ImeHandlerRef, and deregister those that return false.

Required Methods§

source

fn is_alive(&self) -> bool

Returns true if this handler is still active.

source

fn acquire(&self, mutable: bool) -> Option<Box<dyn InputHandler + 'static>>

Mark the session as locked, and return a handle.

The lock can be read-write or read-only, indicated by the mutable flag.

if is_alive is true, this should always return Some(_).

source

fn release(&self) -> bool

Mark the session as released.

Implementors§