pub struct EventCx<'a> {
pub window_state: &'a mut WindowState,
}Expand description
A bundle of helper methods to be used by View::event handlers
Fields§
§window_state: &'a mut WindowStateImplementations§
Source§impl EventCx<'_>
impl EventCx<'_>
pub fn update_active(&mut self, id: ViewId)
pub fn is_active(&self, id: ViewId) -> bool
Sourcepub fn should_send(&mut self, id: ViewId, event: &Event) -> bool
pub fn should_send(&mut self, id: ViewId, event: &Event) -> bool
Used to determine if you should send an event to another view. This is basically a check for pointer events to see if the pointer is inside a child view and to make sure the current view isn’t hidden or disabled. Usually this is used if you want to propagate an event to a child view
Note: This function expects event coordinates to be in absolute (window) coordinates, as used by the stacking context event dispatch. The layout_rect and clip_rect are also in absolute coordinates, so they can be compared directly.
Auto Trait Implementations§
impl<'a> Freeze for EventCx<'a>
impl<'a> !RefUnwindSafe for EventCx<'a>
impl<'a> !Send for EventCx<'a>
impl<'a> !Sync for EventCx<'a>
impl<'a> Unpin for EventCx<'a>
impl<'a> !UnwindSafe for EventCx<'a>
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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