pub struct EventCtx { /* private fields */ }Expand description
Capabilities granted to a widget while it handles an event.
Widgets do not mutate the runtime directly: they set request flags here, and the runtime applies them after dispatch completes.
Implementations§
Source§impl EventCtx
impl EventCtx
Sourcepub fn is_consumed(&self) -> bool
pub fn is_consumed(&self) -> bool
Returns true if a widget has called Self::consume_event during
this dispatch. Used by parent containers to decide whether to keep
routing the event.
Sourcepub fn consume_event(&mut self)
pub fn consume_event(&mut self)
Mark the current event as handled. Parent containers stop routing once they see this flag, so the same keystroke doesn’t fire two actions (e.g., a default button’s Enter accelerator stopping the focused list from also reacting to the keypress).
Sourcepub fn request_paint(&mut self)
pub fn request_paint(&mut self)
Mark the window dirty so the runtime repaints on the next idle tick.
Sourcepub fn is_focus_requested(&self) -> bool
pub fn is_focus_requested(&self) -> bool
true if a widget called Self::request_focus during this dispatch.
Custom container widgets (outside saudade) read this after forwarding
an event to a child to learn the child wants focus, then call
Self::clear_focus_flags and move focus to it — the same protocol the
built-in Container / Column use internally.
Sourcepub fn is_focus_released(&self) -> bool
pub fn is_focus_released(&self) -> bool
true if a widget called Self::release_focus during this dispatch.
Sourcepub fn clear_focus_flags(&mut self)
pub fn clear_focus_flags(&mut self)
Reset both focus-change flags after a custom container has acted on them.
Sourcepub fn request_focus(&mut self)
pub fn request_focus(&mut self)
The widget asks to become the keyboard-focused widget. Parent containers observe this flag during pointer dispatch and route subsequent keyboard events here.
Sourcepub fn release_focus(&mut self)
pub fn release_focus(&mut self)
The widget asks to drop keyboard focus. Useful when an editor wants the window to stop sending it characters.
Sourcepub fn request_dismiss(&mut self)
pub fn request_dismiss(&mut self)
Content inside a modal dialog calls this to ask the hosting
Modal to close — e.g. from an OK / Close
button’s on_click. The modal runs its on_dismiss handler and
dismisses after the current event finishes dispatching.
Sourcepub fn is_dismiss_requested(&self) -> bool
pub fn is_dismiss_requested(&self) -> bool
true if a widget called Self::request_dismiss during this
dispatch. Read by Modal after forwarding an
event to its content.
Auto Trait Implementations§
impl Freeze for EventCtx
impl RefUnwindSafe for EventCtx
impl Send for EventCtx
impl Sync for EventCtx
impl Unpin for EventCtx
impl UnsafeUnpin for EventCtx
impl UnwindSafe for EventCtx
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.