Skip to main content

PlatformEvent

Enum PlatformEvent 

Source
pub enum PlatformEvent {
Show 28 variants WindowResized { width: u32, height: u32, }, WindowMoved { x: i32, y: i32, }, WindowCloseRequested, WindowFocused(bool), WindowMaximized(bool), ScaleFactorChanged { scale_factor: f32, }, ThemeChanged(ThemeMode), RedrawRequested, AnimationTick, MouseMove { x: f32, y: f32, }, MouseDown { button: MouseButton, x: f32, y: f32, }, MouseUp { button: MouseButton, x: f32, y: f32, }, DoubleClick { button: MouseButton, x: f32, y: f32, }, Scroll { delta_x: f32, delta_y: f32, is_momentum: bool, }, CursorEntered, CursorLeft, KeyDown { key: KeyCode, modifiers: Modifiers, }, KeyUp { key: KeyCode, modifiers: Modifiers, }, ReceivedCharacter(char), ImePreedit { text: String, cursor: Option<(usize, usize)>, }, ImeCommit(String), ImeDeleteSurrounding { offset: i32, n_chars: u32, }, Touch { touch_id: u64, phase: TouchPhase, x: f32, y: f32, }, Stylus { phase: StylusPhase, pointer_id: u64, tool: PointerKind, x: f32, y: f32, pressure: f32, tilt_x: f32, tilt_y: f32, twist: f32, tangential_pressure: f32, hovering: bool, buttons: u16, }, FileDrop(Vec<PathBuf>), TrayIconClicked, TrayMenuItemClicked(u64), SingleInstanceTriggered(Vec<String>),
}
Expand description

Native platform event emitted to the Strata event loop.

Variants§

§

WindowResized

Fields

§width: u32
§height: u32
§

WindowMoved

Fields

§

WindowCloseRequested

§

WindowFocused(bool)

§

WindowMaximized(bool)

Emitted when the window enters or leaves the maximized state.

§

ScaleFactorChanged

Fields

§scale_factor: f32
§

ThemeChanged(ThemeMode)

§

RedrawRequested

§

AnimationTick

Periodic VSync display frame animation tick for physics and inertial kinetic scrolling.

§

MouseMove

Fields

§

MouseDown

Fields

§

MouseUp

Fields

§

DoubleClick

Fields

§

Scroll

Fields

§delta_x: f32
§delta_y: f32
§is_momentum: bool
§

CursorEntered

§

CursorLeft

§

KeyDown

Fields

§modifiers: Modifiers
§

KeyUp

Fields

§modifiers: Modifiers
§

ReceivedCharacter(char)

§

ImePreedit

Fields

§text: String
§cursor: Option<(usize, usize)>
§

ImeCommit(String)

§

ImeDeleteSurrounding

Fields

§offset: i32
§n_chars: u32
§

Touch

Fields

§touch_id: u64
§

Stylus

Fields

§pointer_id: u64
§pressure: f32

Normalized tip pressure in [0.0, 1.0].

§tilt_x: f32

Pen tilt along the X axis in degrees (-90.0..=90.0).

§tilt_y: f32

Pen tilt along the Y axis in degrees (-90.0..=90.0).

§twist: f32

Clockwise barrel rotation in degrees (0.0..=359.0).

§tangential_pressure: f32

Barrel tangential pressure / airbrush wheel in [-1.0, 1.0].

§hovering: bool

true when the stylus is hovering in proximity without touching the surface.

§buttons: u16

Bitmask of pressed barrel / tip buttons.

§

FileDrop(Vec<PathBuf>)

§

TrayIconClicked

§

TrayMenuItemClicked(u64)

§

SingleInstanceTriggered(Vec<String>)

Trait Implementations§

Source§

impl Clone for PlatformEvent

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PlatformEvent

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for PlatformEvent

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PlatformEvent

Auto Trait Implementations§

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> IntoInitialState<T> for T

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 = !

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

fn try_from(value: U) -> Result<T, !>

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> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,