pub enum Event {
MouseMove {
pos: Point,
},
MouseDown {
pos: Point,
button: MouseButton,
modifiers: Modifiers,
},
MouseUp {
pos: Point,
button: MouseButton,
modifiers: Modifiers,
},
KeyDown {
key: Key,
modifiers: Modifiers,
},
KeyUp {
key: Key,
modifiers: Modifiers,
},
FocusGained,
FocusLost,
MouseWheel {
pos: Point,
delta_y: f64,
delta_x: f64,
modifiers: Modifiers,
},
}Expand description
A GUI event delivered to a widget.
Coordinate positions are in the local coordinate space of the widget receiving the event (bottom-left origin, Y-up). The framework translates positions as it descends the widget tree.
Variants§
MouseMove
The cursor moved to pos (may be outside widget bounds — used to
clear hover state).
MouseDown
A mouse button was pressed at pos.
MouseUp
A mouse button was released at pos.
KeyDown
A key was pressed while this widget (or a descendant) had focus.
KeyUp
A key was released.
FocusGained
Sent by the framework when this widget gains keyboard focus.
FocusLost
Sent by the framework when this widget loses keyboard focus.
MouseWheel
Mouse wheel scrolled. delta_y is in logical pixels; positive =
scroll up (content moves up, typical “natural” scroll direction).
delta_x is horizontal wheel / trackpad input in the same units;
positive = content moves right. pos is the cursor location at the
time of the scroll.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnsafeUnpin for Event
impl UnwindSafe for Event
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>, which can then be
downcast into Box<dyn 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>, which 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.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for 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