pub trait IFocusManager {
// Required methods
fn get_focused_element(&self) -> Option<Ref<InputElement>>;
fn focus(
&self,
element: Option<&Ref<InputElement>>,
method: NavigationMethod,
key_modifiers: KeyModifiers,
) -> bool;
fn try_move_focus(
&self,
direction: NavigationDirection,
options: Option<&FindNextElementOptions>,
) -> bool;
fn find_first_focusable_element(&self) -> Option<Ref<InputElement>>;
fn find_last_focusable_element(&self) -> Option<Ref<InputElement>>;
fn find_next_element(
&self,
direction: NavigationDirection,
options: Option<&FindNextElementOptions>,
) -> Option<Ref<InputElement>>;
fn as_any(&self) -> &dyn Any;
}Expand description
Manages focus for the application.
Required Methods§
Sourcefn get_focused_element(&self) -> Option<Ref<InputElement>>
fn get_focused_element(&self) -> Option<Ref<InputElement>>
Gets the currently focused element.
Sourcefn 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
Focuses a control.
element is the control to focus; None 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.
Sourcefn try_move_focus(
&self,
direction: NavigationDirection,
options: Option<&FindNextElementOptions>,
) -> bool
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.
direction must be one of next, previous, left, right, up and down.
options help identify the next element to receive focus. Returns
true if focus moved.
Sourcefn find_first_focusable_element(&self) -> Option<Ref<InputElement>>
fn find_first_focusable_element(&self) -> Option<Ref<InputElement>>
Retrieves the first element that can receive focus.
Sourcefn find_last_focusable_element(&self) -> Option<Ref<InputElement>>
fn find_last_focusable_element(&self) -> Option<Ref<InputElement>>
Retrieves the last element that can receive focus.
Sourcefn 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>>
Retrieves the element that should receive focus based on the specified navigation direction.
direction must be one of next, previous, left, right, up and down.
options help identify the next element to receive focus.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".