pub struct FocusManager {
pub focusable_ids: Vec<String>,
/* private fields */
}Expand description
Manages keyboard focus across interactive components.
Fields§
§focusable_ids: Vec<String>Ordered list of focusable component IDs (depth-first traversal order).
Implementations§
Source§impl FocusManager
impl FocusManager
Sourcepub fn rebuild_from_components(&mut self, components: &SurfaceComponentsModel)
pub fn rebuild_from_components(&mut self, components: &SurfaceComponentsModel)
Rebuild the focus list by traversing the component tree depth-first.
Call this whenever the component tree changes (e.g. surface update).
Components that are present in focusable_ids retain their focus if
the focused ID still exists after the rebuild.
Sourcepub fn focus_next(&mut self)
pub fn focus_next(&mut self)
Move focus to the next focusable component (Tab).
Sourcepub fn focus_prev(&mut self)
pub fn focus_prev(&mut self)
Move focus to the previous focusable component (Shift+Tab).
Sourcepub fn is_focused(&self, id: &str) -> bool
pub fn is_focused(&self, id: &str) -> bool
Returns true if the component with the given ID currently has focus.
Sourcepub fn focused_id(&self) -> Option<&str>
pub fn focused_id(&self) -> Option<&str>
Returns the ID of the currently focused component, if any.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FocusManager
impl RefUnwindSafe for FocusManager
impl Send for FocusManager
impl Sync for FocusManager
impl Unpin for FocusManager
impl UnsafeUnpin for FocusManager
impl UnwindSafe for FocusManager
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