pub enum Event {
Show 15 variants
WindowResize,
FocusLost,
Refresh,
Char(char),
CtrlChar(char),
AltChar(char),
Key(Key),
Shift(Key),
Alt(Key),
AltShift(Key),
Ctrl(Key),
CtrlShift(Key),
CtrlAlt(Key),
Mouse {
offset: XY<usize>,
position: XY<usize>,
event: MouseEvent,
},
Unknown(Vec<u8, Global>),
// some variants omitted
}
Expand description
Represents an event as seen by the application.
Variants
WindowResize
Event fired when the window is resized.
FocusLost
Event fired when the view is about to lose focus.
Refresh
Event fired regularly when a auto-refresh is set.
Char(char)
A character was entered (includes numbers, punctuation, …).
CtrlChar(char)
A character was entered with the Ctrl key pressed.
AltChar(char)
A character was entered with the Alt key pressed.
Key(Key)
A non-character key was pressed.
Shift(Key)
A non-character key was pressed with the Shift key pressed.
Alt(Key)
A non-character key was pressed with the Alt key pressed.
AltShift(Key)
A non-character key was pressed with the Shift and Alt keys pressed.
Ctrl(Key)
A non-character key was pressed with the Ctrl key pressed.
CtrlShift(Key)
A non-character key was pressed with the Ctrl and Shift keys pressed.
CtrlAlt(Key)
A non-character key was pressed with the Ctrl and Alt keys pressed.
Mouse
Fields
event: MouseEvent
The mouse event itself.
A mouse event was sent.
Unknown(Vec<u8, Global>)
An unknown event was received.
Implementations
sourceimpl Event
impl Event
sourcepub fn mouse_position(&self) -> Option<XY<usize>>
pub fn mouse_position(&self) -> Option<XY<usize>>
Returns the position of the mouse, if self
is a mouse event.
sourcepub fn mouse_position_mut(&mut self) -> Option<&mut XY<usize>>
pub fn mouse_position_mut(&mut self) -> Option<&mut XY<usize>>
Returns a mutable reference to the position of the mouse/
Returns None
if self
is not a mouse event.
sourcepub fn relativize<V>(&mut self, top_left: V)where
V: Into<XY<usize>>,
pub fn relativize<V>(&mut self, top_left: V)where
V: Into<XY<usize>>,
Update self
with the given offset.
If self
is a mouse event, adds top_left
to its offset.
Otherwise, do nothing.
Trait Implementations
sourceimpl From<Event> for EventTrigger
impl From<Event> for EventTrigger
sourcefn from(event: Event) -> EventTrigger
fn from(event: Event) -> EventTrigger
Converts to this type from the input type.
sourceimpl PartialEq<Event> for Event
impl PartialEq<Event> for Event
impl Eq for Event
impl StructuralEq for Event
impl StructuralPartialEq for Event
Auto Trait Implementations
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more