Skip to main content

ferroui_base/input/
i_custom_keyboard_navigation.rs

1use super::{InputElement, NavigationDirection};
2use crate::Ref;
3
4/// Designates a control as handling its own keyboard navigation.
5///
6/// An input element that implements it returns itself from the
7/// `as_custom_keyboard_navigation` virtual member of `InputElement`.
8pub trait ICustomKeyboardNavigation {
9    /// Gets the next element in the specified navigation direction.
10    ///
11    /// `element` is the element being navigated from. Returns a tuple
12    /// consisting of:
13    /// - a boolean indicating whether the request was handled. If false is
14    ///   returned then custom navigation will be bypassed for the request.
15    /// - if handled is true: the next element in the navigation direction,
16    ///   or `None` if default navigation should continue outside the
17    ///   element.
18    fn get_next(&self, element: &Ref<InputElement>, direction: NavigationDirection) -> (bool, Option<Ref<InputElement>>);
19}