pub struct FocusManager {
pub chain: Vec<u64>,
pub focused: Option<u64>,
}Expand description
A manager for programmatic focus navigation.
Wraps a &Scheduler and provides methods to move focus.
Can also be used standalone with a focus chain and focused element.
Fields§
§chain: Vec<u64>The ordered list of focusable element IDs.
focused: Option<u64>The currently focused element (if any).
Implementations§
Source§impl FocusManager
impl FocusManager
pub fn new(chain: Vec<u64>, focused: Option<u64>) -> Self
Sourcepub fn move_focus(&mut self, dir: FocusDirection) -> Option<u64>
pub fn move_focus(&mut self, dir: FocusDirection) -> Option<u64>
Move focus in the given direction.
Returns the new focused element ID, or None if no movement is possible.
Sourcepub fn move_focus_spatial(
&mut self,
dir: FocusDirection,
hit_regions: &[HitRegion],
) -> Option<u64>
pub fn move_focus_spatial( &mut self, dir: FocusDirection, hit_regions: &[HitRegion], ) -> Option<u64>
Spatial focus navigation: find the closest focusable element in a given direction using bounding rect geometry.
Sourcepub fn move_tab(&mut self, reverse: bool) -> Option<u64>
pub fn move_tab(&mut self, reverse: bool) -> Option<u64>
Tab forward or backward in the focus chain.
Sourcepub fn set_requester_target(requester: &FocusRequester, id: u64)
pub fn set_requester_target(requester: &FocusRequester, id: u64)
Set target ID on a FocusRequester (called during layout).
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 moreAuto 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