pub struct EventCx<'a, Msg> { /* private fields */ }Expand description
Event handling context.
Implementations§
Source§impl<Msg> EventCx<'_, Msg>
impl<Msg> EventCx<'_, Msg>
Sourcepub fn focused_area(&self) -> Option<Rect>
pub fn focused_area(&self) -> Option<Rect>
The area the focused widget was painted in during the last frame, if a widget has focus. Lets a container place something next to the focused child, e.g. a context menu opened from the keyboard.
Sourcepub fn is_focused(&self) -> bool
pub fn is_focused(&self) -> bool
Whether this widget has keyboard focus.
Sourcepub fn request_focus(&mut self)
pub fn request_focus(&mut self)
Moves keyboard focus to this widget.
Sourcepub fn focus_next(&mut self)
pub fn focus_next(&mut self)
Moves keyboard focus to the next widget in focus order, as Tab does. Forms use it to go to the next field on Enter.
Sourcepub fn forward(&mut self, node: &Node<Msg>, rect: Rect, event: &Event) -> boolwhere
Msg: 'static,
pub fn forward(&mut self, node: &Node<Msg>, rect: Rect, event: &Event) -> boolwhere
Msg: 'static,
Offers event to a child node painted in rect, as if the child had received it: the
child keeps its own memory, and its messages and requests go out with this widget’s. For
widgets that take focus as one control and let a child act, e.g. a settings row passing
Space to its switch. Returns whether the child used the event.
Sourcepub fn capture_keys(&mut self, on: bool)
pub fn capture_keys(&mut self, on: bool)
While on, every key event goes to this widget first (an open dropdown), and a pointer
press on any other widget, including one inside it, first sends it
Event::PointerOutside and then reaches that widget
as usual. A press on this widget itself reaches only this widget.
Sourcepub fn capture_pointer(&mut self)
pub fn capture_pointer(&mut self)
Keeps pointer events flowing to this widget until the button is released.
Sourcepub fn run_action(&mut self, scope: Scope, action: impl Into<String>)
pub fn run_action(&mut self, scope: Scope, action: impl Into<String>)
Runs keymap action action of scope as if its key had been pressed, after this event.
Application actions reach App::action even while a
modal layer is open, since the user asked for them explicitly (e.g. from a command
palette).
Sourcepub fn repeat_pointer(&mut self, interval: Duration)
pub fn repeat_pointer(&mut self, interval: Duration)
While the pointer is captured, delivers a Drag event at the last pointer position to
this widget every interval until the button is released, as if the pointer moved in
place. Terminals send nothing while a button is held still; this lets a widget react
to how long it is held (hold-to-confirm, auto-repeating steppers). Call it together
with EventCx::capture_pointer on the button press.
Sourcepub fn stop_pointer_repeat(&mut self)
pub fn stop_pointer_repeat(&mut self)
Ends the repeat EventCx::repeat_pointer started for this widget before the button is
released, so a widget that needs timed drags only for a while (scrolling while a dragged
item rests against an edge) does not keep waking the loop afterwards. A repeat asked for in
the same event wins. Nothing happens when this widget has no repeat running.
Auto Trait Implementations§
impl<'a, Msg> !RefUnwindSafe for EventCx<'a, Msg>
impl<'a, Msg> !Send for EventCx<'a, Msg>
impl<'a, Msg> !Sync for EventCx<'a, Msg>
impl<'a, Msg> !UnwindSafe for EventCx<'a, Msg>
impl<'a, Msg> Freeze for EventCx<'a, Msg>
impl<'a, Msg> Unpin for EventCx<'a, Msg>
impl<'a, Msg> UnsafeUnpin for EventCx<'a, Msg>where
&'a mut Vec<Msg>: UnsafeUnpin,
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
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