⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Event

Struct Event 

Source
pub struct Event {
Show 15 fields pub event_type: EventType, pub target: NodeId, pub current_target: NodeId, pub phase: EventPhase, pub bubbles: bool, pub cancelable: bool, pub default_prevented: bool, pub propagation_stopped: bool, pub immediate_propagation_stopped: bool, pub mouse_x: i32, pub mouse_y: i32, pub button: u8, pub key_code: u32, pub char_code: u32, pub modifiers: u8,
}
Expand description

A DOM event

Fields§

§event_type: EventType

Type of the event

§target: NodeId

Target node (the node the event was dispatched on)

§current_target: NodeId

Current target during propagation

§phase: EventPhase

Current propagation phase

§bubbles: bool

Whether the event bubbles

§cancelable: bool

Whether the event is cancelable

§default_prevented: bool

Whether preventDefault() was called

§propagation_stopped: bool

Whether stopPropagation() was called

§immediate_propagation_stopped: bool

Whether stopImmediatePropagation() was called

§mouse_x: i32

Mouse X position (pixel coordinates)

§mouse_y: i32

Mouse Y position (pixel coordinates)

§button: u8

Mouse button (0=left, 1=middle, 2=right)

§key_code: u32

Keyboard scancode

§char_code: u32

Character value for KeyPress

§modifiers: u8

Modifier keys bitmask (1=shift, 2=ctrl, 4=alt, 8=meta)

Implementations§

Source§

impl Event

Source

pub fn new(event_type: EventType, target: NodeId) -> Self

Create a new event with defaults from its type

Source

pub fn mouse( event_type: EventType, target: NodeId, x: i32, y: i32, button: u8, ) -> Self

Create a mouse event

Source

pub fn keyboard( event_type: EventType, target: NodeId, key_code: u32, char_code: u32, ) -> Self

Create a keyboard event

Source

pub fn prevent_default(&mut self)

Call preventDefault()

Source

pub fn stop_propagation(&mut self)

Call stopPropagation()

Source

pub fn stop_immediate_propagation(&mut self)

Call stopImmediatePropagation()

Source

pub fn shift_key(&self) -> bool

Check if shift key is held

Source

pub fn ctrl_key(&self) -> bool

Check if ctrl key is held

Source

pub fn alt_key(&self) -> bool

Check if alt key is held

Source

pub fn meta_key(&self) -> bool

Check if meta key is held

Trait Implementations§

Source§

impl Clone for Event

Source§

fn clone(&self) -> Event

Returns a duplicate of the value. Read more
1.0.0§

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§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.