pub struct FocusManager { /* private fields */ }Expand description
Manages focus for the application.
Implementations§
Source§impl FocusManager
impl FocusManager
Source§impl FocusManager
impl FocusManager
Sourcepub fn new() -> Rc<FocusManager>
pub fn new() -> Rc<FocusManager>
Creates a focus manager.
Sourcepub fn content_root(&self) -> Option<Ref<InputElement>>
pub fn content_root(&self) -> Option<Ref<InputElement>>
The root of the content the focus manager navigates within.
Sourcepub fn set_content_root(&self, value: Option<Ref<InputElement>>)
pub fn set_content_root(&self, value: Option<Ref<InputElement>>)
Sets the root of the content the focus manager navigates within.
Sourcepub fn get_focused_element(&self) -> Option<Ref<InputElement>>
pub fn get_focused_element(&self) -> Option<Ref<InputElement>>
Gets the currently focused element.
Sourcepub fn focus(
&self,
element: Option<&Ref<InputElement>>,
method: NavigationMethod,
key_modifiers: KeyModifiers,
) -> bool
pub fn focus( &self, element: Option<&Ref<InputElement>>, method: NavigationMethod, key_modifiers: KeyModifiers, ) -> bool
Focuses a control.
element is the control to focus; None restores the focus of the
current focus root or clears the focus. method is the method by
which focus was changed and key_modifiers any key modifiers active
at the time of focus. Returns true if the focus moved to a control.
Sourcepub fn get_focused_element_in_scope(
&self,
scope: &StyledElement,
) -> Option<Ref<InputElement>>
pub fn get_focused_element_in_scope( &self, scope: &StyledElement, ) -> Option<Ref<InputElement>>
Gets the element that is focused within a focus scope.
Sourcepub fn set_focus_scope(&self, scope: &Ref<InputElement>)
pub fn set_focus_scope(&self, scope: &Ref<InputElement>)
Sets the currently focused scope: focus moves to the element that was last focused in the scope, or to the scope itself.
Sourcepub fn remove_focus_root(&self, scope: &StyledElement)
pub fn remove_focus_root(&self, scope: &StyledElement)
Clears the focus if scope is the current focus root.
Sourcepub fn get_is_focus_scope(e: &InputElement) -> bool
pub fn get_is_focus_scope(e: &InputElement) -> bool
Whether an element is a focus scope.
Sourcepub fn get_focus_manager(element: &InputElement) -> Option<Rc<FocusManager>>
pub fn get_focus_manager(element: &InputElement) -> Option<Rc<FocusManager>>
The focus manager responsible for an element: the one of the input root the element is attached to, or the fallback instance.
Sourcepub fn can_focus(e: &InputElement) -> bool
pub fn can_focus(e: &InputElement) -> bool
Whether an element can receive focus: it is focusable, effectively enabled and visible.
Sourcepub fn try_move_focus(
&self,
direction: NavigationDirection,
options: Option<&FindNextElementOptions>,
) -> bool
pub fn try_move_focus( &self, direction: NavigationDirection, options: Option<&FindNextElementOptions>, ) -> bool
Attempts to change focus from the element with focus to the next focusable element in the specified direction.
Panics for directions other than next, previous, up, down, left and right.
Sourcepub fn find_first_focusable_element(&self) -> Option<Ref<InputElement>>
pub fn find_first_focusable_element(&self) -> Option<Ref<InputElement>>
Retrieves the first element that can receive focus within the content root.
Sourcepub fn find_first_focusable_element_in(
search_scope: &Ref<InputElement>,
) -> Option<Ref<InputElement>>
pub fn find_first_focusable_element_in( search_scope: &Ref<InputElement>, ) -> Option<Ref<InputElement>>
Retrieves the first element that can receive focus based on the specified scope.
Sourcepub fn find_last_focusable_element(&self) -> Option<Ref<InputElement>>
pub fn find_last_focusable_element(&self) -> Option<Ref<InputElement>>
Retrieves the last element that can receive focus within the content root.
Sourcepub fn find_last_focusable_element_in(
search_scope: &Ref<InputElement>,
) -> Option<Ref<InputElement>>
pub fn find_last_focusable_element_in( search_scope: &Ref<InputElement>, ) -> Option<Ref<InputElement>>
Retrieves the last element that can receive focus based on the specified scope.
Sourcepub fn find_next_element(
&self,
direction: NavigationDirection,
options: Option<&FindNextElementOptions>,
) -> Option<Ref<InputElement>>
pub fn find_next_element( &self, direction: NavigationDirection, options: Option<&FindNextElementOptions>, ) -> Option<Ref<InputElement>>
Retrieves the element that should receive focus based on the specified navigation direction, without moving focus.
Panics for directions other than next, previous, up, down, left and right.
Trait Implementations§
Source§impl IFocusManager for FocusManager
impl IFocusManager for FocusManager
Source§fn get_focused_element(&self) -> Option<Ref<InputElement>>
fn get_focused_element(&self) -> Option<Ref<InputElement>>
Source§fn focus(
&self,
element: Option<&Ref<InputElement>>,
method: NavigationMethod,
key_modifiers: KeyModifiers,
) -> bool
fn focus( &self, element: Option<&Ref<InputElement>>, method: NavigationMethod, key_modifiers: KeyModifiers, ) -> bool
Source§fn try_move_focus(
&self,
direction: NavigationDirection,
options: Option<&FindNextElementOptions>,
) -> bool
fn try_move_focus( &self, direction: NavigationDirection, options: Option<&FindNextElementOptions>, ) -> bool
Source§fn find_first_focusable_element(&self) -> Option<Ref<InputElement>>
fn find_first_focusable_element(&self) -> Option<Ref<InputElement>>
Source§fn find_last_focusable_element(&self) -> Option<Ref<InputElement>>
fn find_last_focusable_element(&self) -> Option<Ref<InputElement>>
Source§fn find_next_element(
&self,
direction: NavigationDirection,
options: Option<&FindNextElementOptions>,
) -> Option<Ref<InputElement>>
fn find_next_element( &self, direction: NavigationDirection, options: Option<&FindNextElementOptions>, ) -> Option<Ref<InputElement>>
Source§impl StaticType for FocusManager
impl StaticType for FocusManager
Auto Trait Implementations§
impl !Freeze for FocusManager
impl !RefUnwindSafe for FocusManager
impl !Send for FocusManager
impl !Sync for FocusManager
impl !UnwindSafe for FocusManager
impl Unpin for FocusManager
impl UnsafeUnpin 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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more