FocusManager
struct · ferroui-base · v0.5.0
struct FocusManager
Manages focus for the application.
Members
TYPEnewcontent_rootset_content_rootget_focused_elementfocusget_focused_element_in_scopeset_focus_scoperemove_focus_rootget_is_focus_scopeget_focus_managercan_focustry_move_focusfind_first_focusable_elementfind_first_focusable_element_infind_last_focusable_elementfind_last_focusable_element_infind_next_element
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this type.
new
fn new() -> Rc<FocusManager>
Creates a focus manager.
content_root
fn content_root(self: &Self) -> Option<Ref<InputElement>>
The root of the content the focus manager navigates within.
set_content_root
fn set_content_root(self: &Self, value: Option<Ref<InputElement>>)
Sets the root of the content the focus manager navigates within.
get_focused_element
fn get_focused_element(self: &Self) -> Option<Ref<InputElement>>
Gets the currently focused element.
focus
fn focus(self: &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.
get_focused_element_in_scope
fn get_focused_element_in_scope(self: &Self, scope: &StyledElement) -> Option<Ref<InputElement>>
Gets the element that is focused within a focus scope.
set_focus_scope
fn set_focus_scope(self: &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.
remove_focus_root
fn remove_focus_root(self: &Self, scope: &StyledElement)
Clears the focus if scope is the current focus root.
get_is_focus_scope
fn get_is_focus_scope(e: &InputElement) -> bool
Whether an element is a focus scope.
get_focus_manager
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.
can_focus
fn can_focus(e: &InputElement) -> bool
Whether an element can receive focus: it is focusable, effectively enabled and visible.
try_move_focus
fn try_move_focus(self: &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.
find_first_focusable_element
fn find_first_focusable_element(self: &Self) -> Option<crate::Ref<super::InputElement>>
Retrieves the first element that can receive focus within the content root.
find_first_focusable_element_in
fn find_first_focusable_element_in(search_scope: &crate::Ref<super::InputElement>) -> Option<crate::Ref<super::InputElement>>
Retrieves the first element that can receive focus based on the specified scope.
find_last_focusable_element
fn find_last_focusable_element(self: &Self) -> Option<crate::Ref<super::InputElement>>
Retrieves the last element that can receive focus within the content root.
find_last_focusable_element_in
fn find_last_focusable_element_in(search_scope: &crate::Ref<super::InputElement>) -> Option<crate::Ref<super::InputElement>>
Retrieves the last element that can receive focus based on the specified scope.
find_next_element
fn find_next_element(self: &Self, direction: NavigationDirection, options: Option<&FindNextElementOptions>) -> Option<crate::Ref<super::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
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEitherStaticTypeIFocusManager
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.