Skip to main content

RawEvent

Enum RawEvent 

Source
pub enum RawEvent {
    MouseMove {
        x: f32,
        y: f32,
    },
    MouseDown {
        x: f32,
        y: f32,
        button: MouseButton,
    },
    MouseUp {
        x: f32,
        y: f32,
        button: MouseButton,
    },
    Wheel {
        x: f32,
        y: f32,
        delta: f32,
        mods: Modifiers,
    },
    FileDrop {
        paths: Vec<PathBuf>,
        x: f32,
        y: f32,
    },
    KeyDown {
        key: Key,
        mods: Modifiers,
    },
    SystemKeyDown {
        key: Key,
        mods: Modifiers,
    },
    Char {
        c: char,
    },
    Ime {
        text: String,
        composition: bool,
    },
    Resize {
        w: u32,
        h: u32,
    },
    SetCursor {
        x: f32,
        y: f32,
    },
    Close,
}
Expand description

平台原始事件:wndproc 只产出它,不认识 UiTree。

Variants§

§

MouseMove

指针移动(客户区坐标,已按 DPI 换算成逻辑像素)。

Fields

§x: f32

MouseMove 的位置 X(客户区逻辑像素)。

§y: f32

MouseMove 的位置 Y。

§

MouseDown

按下鼠标。

Fields

§x: f32

MouseDown 的位置 X(客户区逻辑像素)。

§y: f32

MouseDown 的位置 Y。

§button: MouseButton

MouseDown 的哪个鼠标键。

§

MouseUp

抬起鼠标。

Fields

§x: f32

MouseUp 的位置 X(客户区逻辑像素)。

§y: f32

MouseUp 的位置 Y。

§button: MouseButton

MouseUp 的哪个鼠标键。

§

Wheel

滚轮;带修饰键,因为 Ctrl+滚轮常用来缩放。

Fields

§x: f32

松手位置的 X(客户区坐标)。

§y: f32

松手位置的 Y。

§delta: f32

Wheel 的滚动量;正数向上。

§mods: Modifiers

Wheel 的当时的修饰键状态。

§

FileDrop

系统文件拖放(WM_DROPFILES)。

Fields

§paths: Vec<PathBuf>

拖入的文件绝对路径;框架只负责路由,不解释内容。

§x: f32

松手位置的 X(客户区坐标)。

§y: f32

松手位置的 Y。

§

KeyDown

按键按下。

Fields

§key: Key

按下的键。

§mods: Modifiers

当时的修饰键状态。

§

SystemKeyDown

Alt+键(WM_SYSKEYDOWN):系统键,不与普通 KeyDown 混用。

Fields

§key: Key

系统级按键(如 Alt 组合),与普通 KeyDown 分开是因为它不该被组件当成文本输入。

§mods: Modifiers

SystemKeyDown 的当时的修饰键状态。

§

Char

字符输入(已过键盘布局/输入法翻译)。

Fields

§c: char

字符。

§

Ime

输入法事件。composition 区分“正在组字“与“已提交“。

Fields

§text: String

组字中间串或最终串。

§composition: bool

true = 预编辑(只画不提交);false = 已提交(应当进入文本输入)。

§

Resize

客户区尺寸变化。

Fields

§w: u32

新的客户区宽度。

§h: u32

新的客户区高度。

§

SetCursor

请求把系统光标设成某个形状(由 UiTree::cursor_at 决定)。

Fields

§x: f32

位置 X。

§y: f32

位置 Y。

§

Close

窗口关闭请求。

Trait Implementations§

Source§

impl Clone for RawEvent

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 RawEvent

Source§

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

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

impl PartialEq for RawEvent

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 RawEvent

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

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.