pub struct FocusManager { /* private fields */ }Expand description
Central focus coordinator.
Tracks focus state, navigation history, focus traps (for modals),
and focus indicator styling. Emits FocusEvents on focus changes.
Implementations§
Source§impl FocusManager
impl FocusManager
Sourcepub fn graph(&self) -> &FocusGraph
pub fn graph(&self) -> &FocusGraph
Access the underlying focus graph.
Sourcepub fn graph_mut(&mut self) -> &mut FocusGraph
pub fn graph_mut(&mut self) -> &mut FocusGraph
Mutably access the underlying focus graph.
Sourcepub fn is_focused(&self, id: FocusId) -> bool
pub fn is_focused(&self, id: FocusId) -> bool
Check if a widget is focused.
Sourcepub fn focus(&mut self, id: FocusId) -> Option<FocusId>
pub fn focus(&mut self, id: FocusId) -> Option<FocusId>
Set focus to widget, returns previous focus.
Move focus in direction.
Sourcepub fn focus_next(&mut self) -> bool
pub fn focus_next(&mut self) -> bool
Move to next in tab order.
Sourcepub fn focus_prev(&mut self) -> bool
pub fn focus_prev(&mut self) -> bool
Move to previous in tab order.
Sourcepub fn focus_first(&mut self) -> bool
pub fn focus_first(&mut self) -> bool
Focus first focusable widget.
Sourcepub fn focus_last(&mut self) -> bool
pub fn focus_last(&mut self) -> bool
Focus last focusable widget.
Sourcepub fn focus_back(&mut self) -> bool
pub fn focus_back(&mut self) -> bool
Go back to previous focus.
Sourcepub fn clear_history(&mut self)
pub fn clear_history(&mut self)
Clear focus history.
Sourcepub fn is_trapped(&self) -> bool
pub fn is_trapped(&self) -> bool
Check if focus is currently trapped.
Sourcepub fn create_group(&mut self, id: u32, members: Vec<FocusId>)
pub fn create_group(&mut self, id: u32, members: Vec<FocusId>)
Create focus group.
Sourcepub fn add_to_group(&mut self, group_id: u32, widget_id: FocusId)
pub fn add_to_group(&mut self, group_id: u32, widget_id: FocusId)
Add widget to group.
Sourcepub fn remove_from_group(&mut self, group_id: u32, widget_id: FocusId)
pub fn remove_from_group(&mut self, group_id: u32, widget_id: FocusId)
Remove widget from group.
Sourcepub fn focus_event(&self) -> Option<&FocusEvent>
pub fn focus_event(&self) -> Option<&FocusEvent>
Get the last focus event.
Sourcepub fn take_focus_event(&mut self) -> Option<FocusEvent>
pub fn take_focus_event(&mut self) -> Option<FocusEvent>
Take and clear the last focus event.
Sourcepub fn indicator(&self) -> &FocusIndicator
pub fn indicator(&self) -> &FocusIndicator
Get the focus indicator configuration.
Sourcepub fn set_indicator(&mut self, indicator: FocusIndicator)
pub fn set_indicator(&mut self, indicator: FocusIndicator)
Set the focus indicator configuration.
Sourcepub fn focus_change_count(&self) -> u64
pub fn focus_change_count(&self) -> u64
Total number of focus changes since creation (for metrics).