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ยง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
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for WindowEvent
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ยง
ยงimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
ยงfn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
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 + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
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)
Convert
&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)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
โs vtable from &mut Trait
โs.