Enum slint::platform::WindowEvent
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: 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
text: SharedString
A key was pressed.
KeyReleased
Fields
text: SharedString
A 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: LogicalSize
The 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ยง
ยง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
1.0.0 ยท sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreยงimpl Debug for WindowEvent
impl Debug for WindowEvent
ยงimpl PartialEq<WindowEvent> for WindowEvent
impl PartialEq<WindowEvent> for WindowEvent
ยงfn eq(&self, other: &WindowEvent) -> bool
fn eq(&self, other: &WindowEvent) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for WindowEvent
Auto Trait Implementationsยง
impl RefUnwindSafe for WindowEvent
impl Send for WindowEvent
impl !Sync for WindowEvent
impl Unpin for WindowEvent
impl UnwindSafe for WindowEvent
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
ยงimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
ยงfn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
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
.ยง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
.ยง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.ยง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.