FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    FocusManager

    struct · ferroui-base · v0.5.0

    struct FocusManager
    

    Manages focus for the application.

    View source

    Members

    TYPE

    const TYPE: &'static $crate::TypeInfo
    

    The runtime type of this type.

    Source

    new

    fn new() -> Rc<FocusManager>
    

    Creates a focus manager.

    Source

    content_root

    fn content_root(self: &Self) -> Option<Ref<InputElement>>
    

    The root of the content the focus manager navigates within.

    Source

    set_content_root

    fn set_content_root(self: &Self, value: Option<Ref<InputElement>>)
    

    Sets the root of the content the focus manager navigates within.

    Source

    get_focused_element

    fn get_focused_element(self: &Self) -> Option<Ref<InputElement>>
    

    Gets the currently focused element.

    Source

    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.

    Source

    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.

    Source

    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.

    Source

    remove_focus_root

    fn remove_focus_root(self: &Self, scope: &StyledElement)
    

    Clears the focus if scope is the current focus root.

    Source

    get_is_focus_scope

    fn get_is_focus_scope(e: &InputElement) -> bool
    

    Whether an element is a focus scope.

    Source

    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.

    Source

    can_focus

    fn can_focus(e: &InputElement) -> bool
    

    Whether an element can receive focus: it is focusable, effectively enabled and visible.

    Source

    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.

    Source

    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.

    Source

    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.

    Source

    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.

    Source

    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.

    Source

    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.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ErasedDestructor
    • IntoEither
    • StaticType
    • IFocusManager

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.