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

EventDispatcher

Struct EventDispatcher 

Source
pub struct EventDispatcher { /* private fields */ }
Expand description

Dispatches DOM events with capture/bubble propagation

Implementations§

Source§

impl EventDispatcher

Source

pub fn new() -> Self

Source

pub fn node_tree(&self) -> &NodeTree

Access the node tree

Source

pub fn node_tree_mut(&mut self) -> &mut NodeTree

Access the node tree mutably

Source

pub fn add_event_listener( &mut self, node: NodeId, event_type: EventType, callback_id: usize, use_capture: bool, )

Add an event listener to a node

Source

pub fn remove_event_listener( &mut self, node: NodeId, event_type: EventType, callback_id: usize, use_capture: bool, ) -> bool

Remove an event listener from a node

Source

pub fn listeners_for(&self, node: NodeId) -> &[EventListener]

Get listeners for a node

Source

pub fn clear_listeners(&mut self, node: NodeId)

Clear all listeners for a node

Source

pub fn set_hit_boxes(&mut self, boxes: Vec<HitRect>)

Set the hit-test boxes (rebuilt after layout)

Source

pub fn add_hit_box(&mut self, rect: HitRect)

Add a single hit-test box

Source

pub fn clear_hit_boxes(&mut self)

Clear hit-test boxes

Source

pub fn hit_test(&self, x: i32, y: i32) -> Option<NodeId>

Hit test: find the frontmost (last-drawn) node at pixel coordinates. Returns None if no node at that position.

Source

pub fn take_invoked(&mut self) -> Vec<(usize, EventType)>

Get the list of invoked callbacks (callback_id, event_type) from last dispatch

Source

pub fn dispatch(&mut self, event: &mut Event) -> bool

Dispatch an event through the capture → target → bubble phases. Returns true if the default action should be prevented.

Source

pub fn dispatch_click( &mut self, x: i32, y: i32, button: u8, ) -> Option<(NodeId, bool)>

Convenience: dispatch a mouse click at pixel coordinates. Performs hit-test, then dispatches Click event. Returns (target_node, default_prevented) or None if miss.

Source

pub fn dispatch_mouse_move(&mut self, x: i32, y: i32) -> Option<(NodeId, bool)>

Convenience: dispatch a mouse move event

Source

pub fn dispatch_key( &mut self, target: NodeId, event_type: EventType, key_code: u32, char_code: u32, modifiers: u8, ) -> bool

Convenience: dispatch a keyboard event to a focused node

Trait Implementations§

Source§

impl Default for EventDispatcher

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for EventDispatcher

§

impl RefUnwindSafe for EventDispatcher

§

impl Send for EventDispatcher

§

impl Sync for EventDispatcher

§

impl Unpin for EventDispatcher

§

impl UnwindSafe for EventDispatcher

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> 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, 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.