pub struct InteractiveContext { /* private fields */ }Expand description
Interactive state manager for layout nodes
Manages FSMs, custom state, and dirty tracking for layout nodes. This is the core infrastructure for interactive widgets.
Implementations§
Source§impl InteractiveContext
impl InteractiveContext
Sourcepub fn register(&mut self, id: LayoutNodeId, fsm: Option<StateMachine>)
pub fn register(&mut self, id: LayoutNodeId, fsm: Option<StateMachine>)
Register a node with optional FSM
Sourcepub fn register_with_fsm(&mut self, id: LayoutNodeId, fsm: StateMachine)
pub fn register_with_fsm(&mut self, id: LayoutNodeId, fsm: StateMachine)
Register a node with an FSM
Sourcepub fn unregister(&mut self, id: LayoutNodeId)
pub fn unregister(&mut self, id: LayoutNodeId)
Unregister a node
Sourcepub fn is_registered(&self, id: LayoutNodeId) -> bool
pub fn is_registered(&self, id: LayoutNodeId) -> bool
Check if a node is registered
Sourcepub fn get_fsm_state(&self, id: LayoutNodeId) -> Option<u32>
pub fn get_fsm_state(&self, id: LayoutNodeId) -> Option<u32>
Get the FSM state for a node
Sourcepub fn send_event(&mut self, id: LayoutNodeId, event_type: EventId) -> bool
pub fn send_event(&mut self, id: LayoutNodeId, event_type: EventId) -> bool
Send an event to a node’s FSM
Returns true if the FSM transitioned to a new state.
Sourcepub fn dispatch_event(&mut self, id: LayoutNodeId, event: &Event) -> bool
pub fn dispatch_event(&mut self, id: LayoutNodeId, event: &Event) -> bool
Dispatch an Event struct to a node’s FSM
Convenience method that extracts the event_type and calls send_event. Returns true if the FSM transitioned to a new state.
Sourcepub fn set_state<S: NodeState>(&mut self, id: LayoutNodeId, state: S)
pub fn set_state<S: NodeState>(&mut self, id: LayoutNodeId, state: S)
Set custom state for a node
Sourcepub fn get_state<S: 'static>(&self, id: LayoutNodeId) -> Option<&S>
pub fn get_state<S: 'static>(&self, id: LayoutNodeId) -> Option<&S>
Get custom state for a node (immutable)
Sourcepub fn get_state_mut<S: 'static>(&mut self, id: LayoutNodeId) -> Option<&mut S>
pub fn get_state_mut<S: 'static>(&mut self, id: LayoutNodeId) -> Option<&mut S>
Get custom state for a node (mutable)
Sourcepub fn mark_dirty(&mut self, id: LayoutNodeId)
pub fn mark_dirty(&mut self, id: LayoutNodeId)
Mark a node as dirty
Sourcepub fn mark_layout(&mut self)
pub fn mark_layout(&mut self)
Mark the tree as needing full re-layout
Sourcepub fn is_dirty(&self, id: LayoutNodeId) -> bool
pub fn is_dirty(&self, id: LayoutNodeId) -> bool
Check if a node is dirty
Sourcepub fn needs_layout(&self) -> bool
pub fn needs_layout(&self) -> bool
Check if layout is needed
Sourcepub fn take_dirty(&mut self) -> Vec<LayoutNodeId>
pub fn take_dirty(&mut self) -> Vec<LayoutNodeId>
Take all dirty node IDs (clears the set)
Sourcepub fn clear_layout(&mut self)
pub fn clear_layout(&mut self)
Clear the layout flag
Sourcepub fn dirty_tracker(&self) -> &DirtyTracker
pub fn dirty_tracker(&self) -> &DirtyTracker
Get the dirty tracker (immutable)
Sourcepub fn dirty_tracker_mut(&mut self) -> &mut DirtyTracker
pub fn dirty_tracker_mut(&mut self) -> &mut DirtyTracker
Get the dirty tracker (mutable)