pub enum Event {
Show 13 variants
WindowClosed {
window_id: usize,
},
WindowCreated {
window_id: usize,
parent_ref_id: Option<usize>,
title: String,
size: Point2,
pos: Option<Point2>,
},
WindowFocused {
window_id: usize,
focused: bool,
},
WindowResized {
window_id: usize,
size: Point2,
},
WindowMoved {
window_id: usize,
pos: Point2,
},
CursorEntered {
window_id: usize,
},
CursorLeft {
window_id: usize,
},
CursorMoved {
window_id: usize,
pos: Point2,
},
MouseWheel {
window_id: usize,
delta: MouseScrollDelta,
},
MouseInput {
window_id: usize,
button: SmolStr,
pressed: bool,
},
RedrawRequested {
window_id: usize,
},
KeyboardInput {
window_id: usize,
key: SmolStr,
pressed: bool,
},
DragAndDrop {
window_id: usize,
event: DragAndDropEvent,
},
}Variants§
WindowClosed
Happen when the window is closed, either by user action (such clicking X button on window) or programmatically.
Fields
WindowCreated
Happen when a new window is created.
Fields
window_id: usizeThe ID of the window that was closed, which can be used to identify the window in the application.
The window ID can be obtained from the [Window] instance using the [Window::id] method.
parent_ref_id: Option<usize>The ID of the parent window, if any. will be None if the window is a top-level window.
This can be achived when creating a new window using the WindowBuilder::with_parent_window method.
WindowFocused
Happen when the window is focused or unfocused.
Fields
WindowResized
Happen when the window is resized.
Fields
WindowMoved
Happen when the window is moved.
Fields
CursorEntered
Happen when the cursor enters the window.
Fields
CursorLeft
Happen when the cursor leaves the window.
Fields
CursorMoved
Happen when the cursor is moved within the window.
Fields
MouseWheel
Happen when the mouse wheel is scrolled.
Fields
window_id: usizeThe ID of the window that was closed, which can be used to identify the window in the application.
The window ID can be obtained from the [Window] instance using the [Window::id] method.
delta: MouseScrollDeltaThe delta of the mouse wheel scroll.
MouseInput
Happen when a mouse button is pressed or released.
Fields
window_id: usizeThe ID of the window that was closed, which can be used to identify the window in the application.
The window ID can be obtained from the [Window] instance using the [Window::id] method.
The button that was pressed or released.
Either “Left”, “Right”, “Middle”, “Back”, or “Forward”.
RedrawRequested
Happen when the window requests a redraw.
Can be manually invoked by calling [Window::request_redraw] method.
Fields
KeyboardInput
Happen when a keyboard key is pressed or released.
Fields
window_id: usizeThe ID of the window that was closed, which can be used to identify the window in the application.
The window ID can be obtained from the [Window] instance using the [Window::id] method.
DragAndDrop
Happen when a drag and drop event occurs in the window.
Fields
window_id: usizeThe ID of the window that was closed, which can be used to identify the window in the application.
The window ID can be obtained from the [Window] instance using the [Window::id] method.
event: DragAndDropEventThe drag and drop event that occurred.
Trait Implementations§
Source§impl Ord for Event
impl Ord for Event
Source§impl PartialOrd for Event
impl PartialOrd for Event
impl Eq for Event
impl StructuralPartialEq for Event
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin 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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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>
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