pub struct FocusManager { /* private fields */ }Expand description
Focus manager for keyboard navigation
Implementations§
Source§impl FocusManager
impl FocusManager
Sourcepub fn register_with_position(&mut self, id: WidgetId, x: u16, y: u16)
pub fn register_with_position(&mut self, id: WidgetId, x: u16, y: u16)
Register a widget with position for 2D navigation
Sourcepub fn register_with_bounds(&mut self, id: WidgetId, bounds: Rect)
pub fn register_with_bounds(&mut self, id: WidgetId, bounds: Rect)
Register a widget with bounds for 2D navigation
Sourcepub fn unregister(&mut self, id: WidgetId)
pub fn unregister(&mut self, id: WidgetId)
Unregister a widget
Sourcepub fn is_focused(&self, id: WidgetId) -> bool
pub fn is_focused(&self, id: WidgetId) -> bool
Check if a widget is focused
Sourcepub fn move_focus(&mut self, direction: Direction) -> bool
pub fn move_focus(&mut self, direction: Direction) -> bool
Move focus in a direction (arrow key navigation)
Sourcepub fn trap_focus(&mut self, container_id: WidgetId)
pub fn trap_focus(&mut self, container_id: WidgetId)
Start trapping focus within a container
All widgets registered as trapped will be the only ones focusable. Saves current focus for later restoration.
Sourcepub fn trap_focus_with_initial(
&mut self,
container_id: WidgetId,
initial_focus: WidgetId,
)
pub fn trap_focus_with_initial( &mut self, container_id: WidgetId, initial_focus: WidgetId, )
Start trapping focus with initial focus target
Sourcepub fn add_to_trap(&mut self, id: WidgetId)
pub fn add_to_trap(&mut self, id: WidgetId)
Add a widget to the trapped focus group
Sourcepub fn release_trap(&mut self)
pub fn release_trap(&mut self)
Release focus trap and optionally restore previous focus
Sourcepub fn release_trap_and_restore(&mut self)
pub fn release_trap_and_restore(&mut self)
Release focus trap and restore previous focus
Sourcepub fn is_trapped(&self) -> bool
pub fn is_trapped(&self) -> bool
Check if focus is currently trapped
Sourcepub fn trap_container(&self) -> Option<WidgetId>
pub fn trap_container(&self) -> Option<WidgetId>
Get the trap container ID
Sourcepub fn saved_focus(&self) -> Option<WidgetId>
pub fn saved_focus(&self) -> Option<WidgetId>
Get the saved focus (for manual restoration)
Sourcepub fn push_trap(&mut self, container_id: WidgetId, children: &[WidgetId])
pub fn push_trap(&mut self, container_id: WidgetId, children: &[WidgetId])
Push a new focus trap (supports nesting)
Sourcepub fn trap_depth(&self) -> usize
pub fn trap_depth(&self) -> usize
Get the trap stack depth
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 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().