Enum Event

Source
pub enum Event {
    MousePress {
        button: MouseButton,
        position: PhysicalPoint,
        modifiers: Modifiers,
        handled: bool,
    },
    MouseRelease {
        button: MouseButton,
        position: PhysicalPoint,
        modifiers: Modifiers,
        handled: bool,
    },
    MouseMotion {
        button: Option<MouseButton>,
        delta: (f32, f32),
        position: PhysicalPoint,
        modifiers: Modifiers,
        handled: bool,
    },
    MouseWheel {
        delta: (f32, f32),
        position: PhysicalPoint,
        modifiers: Modifiers,
        handled: bool,
    },
    PinchGesture {
        delta: f32,
        position: PhysicalPoint,
        modifiers: Modifiers,
        handled: bool,
    },
    RotationGesture {
        delta: Radians,
        position: PhysicalPoint,
        modifiers: Modifiers,
        handled: bool,
    },
    MouseEnter,
    MouseLeave,
    KeyPress {
        kind: Key,
        modifiers: Modifiers,
        handled: bool,
    },
    KeyRelease {
        kind: Key,
        modifiers: Modifiers,
        handled: bool,
    },
    ModifiersChange {
        modifiers: Modifiers,
    },
    Text(String),
}
Expand description

An input event (from mouse, keyboard or similar).

Variants§

§

MousePress

Fired when a button is pressed or the screen is touched.

Fields

§button: MouseButton

Type of button

§position: PhysicalPoint

The screen position in physical pixels.

§modifiers: Modifiers

The state of modifiers.

§handled: bool

Whether or not this event already have been handled.

§

MouseRelease

Fired when a button is released or the screen is stopped being touched.

Fields

§button: MouseButton

Type of button

§position: PhysicalPoint

The screen position in physical pixels.

§modifiers: Modifiers

The state of modifiers.

§handled: bool

Whether or not this event already have been handled.

§

MouseMotion

Fired continuously when the mouse or a finger on the screen is moved.

Fields

§button: Option<MouseButton>

Type of button if a button is pressed.

§delta: (f32, f32)

The relative movement of the mouse/finger since last Event::MouseMotion event in logical pixels.

§position: PhysicalPoint

The screen position in physical pixels.

§modifiers: Modifiers

The state of modifiers.

§handled: bool

Whether or not this event already have been handled.

§

MouseWheel

Fired continuously when the mouse wheel or equivalent is applied.

Fields

§delta: (f32, f32)

The relative scrolling since the last Event::MouseWheel event.

§position: PhysicalPoint

The screen position in physical pixels.

§modifiers: Modifiers

The state of modifiers.

§handled: bool

Whether or not this event already have been handled.

§

PinchGesture

Fired continuously when a pinch input gesture is recognized, such as on a Mac trackpad

Fields

§delta: f32

The relative pinching since the last Event::PinchGesture event (positive is zoom in).

§position: PhysicalPoint

The screen position in physical pixels.

§modifiers: Modifiers

The state of modifiers.

§handled: bool

Whether or not this event already have been handled.

§

RotationGesture

Fired continuously when a rotation input gesture is recognized, such as on a Mac trackpad

Fields

§delta: Radians

The relative rotation since the last Event::RotationGesture event (positive is counterclockwise).

§position: PhysicalPoint

The screen position in physical pixels.

§modifiers: Modifiers

The state of modifiers.

§handled: bool

Whether or not this event already have been handled.

§

MouseEnter

Fired when the mouse enters the window.

§

MouseLeave

Fired when the mouse leaves the window.

§

KeyPress

Fired when a key is pressed.

Fields

§kind: Key

The type of key.

§modifiers: Modifiers

The state of modifiers.

§handled: bool

Whether or not this event already have been handled.

§

KeyRelease

Fired when a key is released.

Fields

§kind: Key

The type of key.

§modifiers: Modifiers

The state of modifiers.

§handled: bool

Whether or not this event already have been handled.

§

ModifiersChange

Fired when the modifiers change.

Fields

§modifiers: Modifiers

The state of modifiers after the change.

§

Text(String)

Fires when some text has been written.

Trait Implementations§

Source§

impl Clone for Event

Source§

fn clone(&self) -> Event

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Event

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,

Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,