Enum slint::platform::WindowEvent
#[non_exhaustive]
pub enum WindowEvent {
PointerPressed {
position: LogicalPosition,
button: PointerEventButton,
},
PointerReleased {
position: LogicalPosition,
button: PointerEventButton,
},
PointerMoved {
position: LogicalPosition,
},
PointerScrolled {
position: LogicalPosition,
delta_x: f32,
delta_y: f32,
},
PointerExited,
KeyPressed {
text: char,
},
KeyReleased {
text: char,
},
}
Expand description
A event that describes user input.
Slint backends typically receive events from the windowing system, translate them to this
enum and deliver to the scene of items via slint::Window::dispatch_event()
.
The pointer variants describe events originating from an input device such as a mouse or a contact point on a touch-enabled surface.
All position fields are in logical window coordinates.
Variants (Non-exhaustive)ยง
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
PointerPressed
A pointer was pressed.
PointerReleased
A pointer was released.
PointerMoved
Fields
ยง
position: LogicalPosition
The position of the pointer has changed.
PointerScrolled
Fields
ยง
position: LogicalPosition
The wheel button of a mouse was rotated to initiate scrolling.
PointerExited
The pointer exited the window.
KeyPressed
Fields
A key was pressed.
KeyReleased
Fields
A key was pressed.
Implementationsยง
ยงimpl WindowEvent
impl WindowEvent
pub fn position(&self) -> Option<LogicalPosition>
pub fn position(&self) -> Option<LogicalPosition>
The position of the cursor for this event, if any
Trait Implementationsยง
ยงimpl Clone for WindowEvent
impl Clone for WindowEvent
ยงfn clone(&self) -> WindowEvent
fn clone(&self) -> WindowEvent
Returns a copy of the value. Read more
1.0.0 ยท sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more