pub struct FocusManager;Expand description
Moves focus between the focus targets the tree holds, the way
LocalFocusManager does in Jetpack Compose.
ⓘ
let focus = cranpose_ui::local_focus_manager().current();
focus.move_focus(FocusDirection::Next);
focus.clear_focus();Tab and Shift+Tab reach this through the app shell, so an app that puts
Modifier::focusable() on its controls gets keyboard traversal with no
further code.
Implementations§
Source§impl FocusManager
impl FocusManager
Sourcepub fn move_focus(&self, direction: FocusDirection) -> bool
pub fn move_focus(&self, direction: FocusDirection) -> bool
Moves focus one step in direction. Answers whether focus moved.
Sourcepub fn clear_focus(&self) -> bool
pub fn clear_focus(&self) -> bool
Drops focus from whatever holds it, and answers whether one held it.
Compose takes a force flag here for targets that refuse to give focus
up; no target in Cranpose refuses, so this always clears.
Trait Implementations§
Source§impl Clone for FocusManager
impl Clone for FocusManager
Source§fn clone(&self) -> FocusManager
fn clone(&self) -> FocusManager
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for FocusManager
Source§impl Debug for FocusManager
impl Debug for FocusManager
Source§impl Default for FocusManager
impl Default for FocusManager
Source§fn default() -> FocusManager
fn default() -> FocusManager
Returns the “default value” for a type. Read more
impl Eq for FocusManager
Source§impl PartialEq for FocusManager
impl PartialEq for FocusManager
impl StructuralPartialEq for FocusManager
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