Enum i_slint_core::platform::WindowEvent
source · #[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: SharedString,
},
KeyReleased {
text: SharedString,
},
ScaleFactorChanged {
scale_factor: f32,
},
Resized {
size: LogicalSize,
},
}Expand description
A event that describes user input or windowing system events.
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
PointerPressed
A pointer was pressed.
PointerReleased
A pointer was released.
PointerMoved
Fields
position: LogicalPositionThe position of the pointer has changed.
PointerScrolled
Fields
position: LogicalPositionThe wheel button of a mouse was rotated to initiate scrolling.
PointerExited
The pointer exited the window.
KeyPressed
Fields
text: SharedStringA key was pressed.
KeyReleased
Fields
text: SharedStringA key was pressed.
ScaleFactorChanged
Fields
The window’s scale factor has changed. This can happen for example when the display’s resolution changes, the user selects a new scale factor in the system settings, or the window is moved to a different screen. Platform implementations should dispatch this event also right after the initial window creation, to set the initial scale factor the windowing system provided for the window.
Resized
Fields
size: LogicalSizeThe new logical size of the window
The window was resized.
The backend must send this event to ensure that the width and height property of the root Window
element are properly set.
Implementations§
source§impl WindowEvent
impl WindowEvent
sourcepub fn position(&self) -> Option<LogicalPosition>
pub fn position(&self) -> Option<LogicalPosition>
The position of the cursor for this event, if any
Trait Implementations§
source§impl Clone for WindowEvent
impl Clone for WindowEvent
source§fn clone(&self) -> WindowEvent
fn clone(&self) -> WindowEvent
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for WindowEvent
impl Debug for WindowEvent
source§impl PartialEq<WindowEvent> for WindowEvent
impl PartialEq<WindowEvent> for WindowEvent
source§fn eq(&self, other: &WindowEvent) -> bool
fn eq(&self, other: &WindowEvent) -> bool
self and other values to be equal, and is used
by ==.