Skip to main content

InteractiveContext

Struct InteractiveContext 

Source
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

Source

pub fn new() -> Self

Create a new interactive context

Source

pub fn register(&mut self, id: LayoutNodeId, fsm: Option<StateMachine>)

Register a node with optional FSM

Source

pub fn register_with_fsm(&mut self, id: LayoutNodeId, fsm: StateMachine)

Register a node with an FSM

Source

pub fn unregister(&mut self, id: LayoutNodeId)

Unregister a node

Source

pub fn is_registered(&self, id: LayoutNodeId) -> bool

Check if a node is registered

Source

pub fn get_fsm_state(&self, id: LayoutNodeId) -> Option<u32>

Get the FSM state for a node

Source

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.

Source

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.

Source

pub fn set_state<S: NodeState>(&mut self, id: LayoutNodeId, state: S)

Set custom state for a node

Source

pub fn get_state<S: 'static>(&self, id: LayoutNodeId) -> Option<&S>

Get custom state for a node (immutable)

Source

pub fn get_state_mut<S: 'static>(&mut self, id: LayoutNodeId) -> Option<&mut S>

Get custom state for a node (mutable)

Source

pub fn mark_dirty(&mut self, id: LayoutNodeId)

Mark a node as dirty

Source

pub fn mark_layout(&mut self)

Mark the tree as needing full re-layout

Source

pub fn is_dirty(&self, id: LayoutNodeId) -> bool

Check if a node is dirty

Source

pub fn has_dirty(&self) -> bool

Check if any nodes are dirty

Source

pub fn needs_layout(&self) -> bool

Check if layout is needed

Source

pub fn take_dirty(&mut self) -> Vec<LayoutNodeId>

Take all dirty node IDs (clears the set)

Source

pub fn clear_layout(&mut self)

Clear the layout flag

Source

pub fn clear_all(&mut self)

Clear all dirty flags

Source

pub fn dirty_tracker(&self) -> &DirtyTracker

Get the dirty tracker (immutable)

Source

pub fn dirty_tracker_mut(&mut self) -> &mut DirtyTracker

Get the dirty tracker (mutable)

Trait Implementations§

Source§

impl Default for InteractiveContext

Source§

fn default() -> Self

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

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> NodeState for T
where T: Send + 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Get self as Any for downcasting
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Get self as mutable Any for downcasting
Source§

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

Source§

type Error = Infallible

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

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

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more