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
impl KeyEventRoute
Sourcepub fn new(applier: &mut MemoryApplier, root: Option<NodeId>) -> Self
pub fn new(applier: &mut MemoryApplier, root: Option<NodeId>) -> Self
Captures the ancestor route for the currently focused component.
Sourcepub fn contains_focus(applier: &mut MemoryApplier, root: Option<NodeId>) -> bool
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.
Sourcepub fn focus_is_current(&self) -> bool
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.
Sourcepub fn dispatch_preview(
&self,
applier: &mut MemoryApplier,
event: &KeyEvent,
) -> bool
pub fn dispatch_preview( &self, applier: &mut MemoryApplier, event: &KeyEvent, ) -> bool
Offers the event to ancestors before the focused component.
Sourcepub fn dispatch_bubble(
&self,
applier: &mut MemoryApplier,
event: &KeyEvent,
) -> bool
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§
impl Freeze for KeyEventRoute
impl RefUnwindSafe for KeyEventRoute
impl Send for KeyEventRoute
impl Sync for KeyEventRoute
impl Unpin for KeyEventRoute
impl UnsafeUnpin for KeyEventRoute
impl UnwindSafe for KeyEventRoute
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more