Skip to main content

KeyEventRoute

Struct KeyEventRoute 

Source
pub struct KeyEventRoute { /* private fields */ }
Expand description

The focused component’s keyboard route within a receiving surface or modal.

Platform shells create one route per hardware event, dispatch preview, run their existing focused-control/editor handling, then dispatch unconsumed events in the bubble phase. The route follows live parent links and stops at root; a focused node belonging to another window is excluded.

Implementations§

Source§

impl KeyEventRoute

Source

pub fn new(applier: &mut MemoryApplier, root: Option<NodeId>) -> Self

Captures the ancestor route for the currently focused component.

Source

pub fn contains_focus(applier: &mut MemoryApplier, root: Option<NodeId>) -> bool

Whether the focused component belongs to the receiving surface or modal.

Platform clipboard and IME entry points use this before accessing a focused editor. This check does not create a keyboard handler route.

Source

pub fn focus_is_current(&self) -> bool

Whether focused-control dispatch still belongs to this event’s target.

A preview callback can move or clear focus. The event must not then edit the newly focused field or activate a control on another surface.

Source

pub fn dispatch_preview( &self, applier: &mut MemoryApplier, event: &KeyEvent, ) -> bool

Offers the event to ancestors before the focused component.

Source

pub fn dispatch_bubble( &self, applier: &mut MemoryApplier, event: &KeyEvent, ) -> bool

Offers an unconsumed event from the focused component to its ancestors.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.