pub struct HandlerRegistry { /* private fields */ }Expand description
Global handler registry for the render tree
This stores handlers indexed by LayoutNodeId so the EventRouter can dispatch events to the correct handlers.
Implementations§
Source§impl HandlerRegistry
impl HandlerRegistry
Sourcepub fn new() -> HandlerRegistry
pub fn new() -> HandlerRegistry
Create a new empty registry
Sourcepub fn register(&mut self, node_id: LayoutNodeId, handlers: EventHandlers)
pub fn register(&mut self, node_id: LayoutNodeId, handlers: EventHandlers)
Register handlers for a node
Sourcepub fn get(&self, node_id: LayoutNodeId) -> Option<&EventHandlers>
pub fn get(&self, node_id: LayoutNodeId) -> Option<&EventHandlers>
Get handlers for a node
Sourcepub fn dispatch(&self, ctx: &EventContext)
pub fn dispatch(&self, ctx: &EventContext)
Dispatch an event to a node’s handlers
Sourcepub fn has_handler(&self, node_id: LayoutNodeId, event_type: u32) -> bool
pub fn has_handler(&self, node_id: LayoutNodeId, event_type: u32) -> bool
Check if a node has handlers for a specific event type
Sourcepub fn remove(&mut self, node_id: LayoutNodeId)
pub fn remove(&mut self, node_id: LayoutNodeId)
Remove handlers for a node
Sourcepub fn broadcast(&self, event_type: u32, base_ctx: &EventContext)
pub fn broadcast(&self, event_type: u32, base_ctx: &EventContext)
Broadcast an event to ALL nodes that have handlers for the given event type
This is used for keyboard events (TEXT_INPUT, KEY_DOWN) after a tree rebuild, when the router’s focused node ID may be stale. Each handler can check its own internal focus state to determine if it should process the event.
Sourcepub fn nodes_with_handler(&self, event_type: u32) -> Vec<LayoutNodeId>
pub fn nodes_with_handler(&self, event_type: u32) -> Vec<LayoutNodeId>
Get all node IDs that have handlers for a specific event type
Trait Implementations§
Source§impl Default for HandlerRegistry
impl Default for HandlerRegistry
Source§fn default() -> HandlerRegistry
fn default() -> HandlerRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for HandlerRegistry
impl !RefUnwindSafe for HandlerRegistry
impl !Send for HandlerRegistry
impl !Sync for HandlerRegistry
impl Unpin for HandlerRegistry
impl UnsafeUnpin for HandlerRegistry
impl !UnwindSafe for HandlerRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.