Skip to main content

ferroui_base/input/
i_keyboard_navigation_handler.rs

1use super::{InputElement, KeyDeviceType, KeyModifiers, NavigationDirection};
2use crate::Ref;
3
4/// Defines the interface for classes that handle keyboard navigation for a
5/// window.
6pub trait IKeyboardNavigationHandler {
7    /// Sets the owner of the keyboard navigation handler.
8    ///
9    /// This method can only be called once, typically by the owner itself
10    /// on creation.
11    fn set_owner(&self, owner: &Ref<InputElement>);
12
13    /// Moves the focus in the specified direction.
14    ///
15    /// `element` is the current element, `key_modifiers` any key modifiers
16    /// active at the time of focus and `device_type` the optional key
17    /// device type that caused the move.
18    fn move_(
19        &self,
20        element: Option<&Ref<InputElement>>,
21        direction: NavigationDirection,
22        key_modifiers: KeyModifiers,
23        device_type: Option<KeyDeviceType>,
24    ) -> bool;
25}