FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    KeyboardDevice

    struct · ferroui-base · v0.5.0

    struct KeyboardDevice
    

    Represents the keyboard: turns raw key and text input into routed events on the focused element, and is the source of truth about which element has keyboard focus.

    View source

    Members

    new

    fn new() -> Rc<KeyboardDevice>
    

    Creates a keyboard device.

    Source

    instance

    fn instance() -> Option<Rc<KeyboardDevice>>
    

    The keyboard device registered with the locator (as dyn IKeyboardDevice), if it is a KeyboardDevice.

    Source

    input_manager

    fn input_manager(self: &Self) -> Option<Rc<dyn IInputManager>>
    

    The input manager registered with the locator.

    Source

    focus_manager

    fn focus_manager(self: &Self) -> Option<Rc<dyn IFocusManager>>
    

    The focus manager registered with the locator.

    Source

    property_changed

    fn property_changed(self: &Self, handler: impl Fn(&str) -> () + 'static) -> Subscription
    

    Raised with the name of a property of the device that changed ("FocusedElement"). Dropping the returned guard removes the handler; Subscription::detach keeps it for the life of the device.

    Source

    focused_element

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

    The element that has keyboard focus.

    Source

    set_focused_element

    fn set_focused_element(self: &Self, element: Option<&Ref<InputElement>>, method: NavigationMethod, key_modifiers: KeyModifiers)
    

    Moves keyboard focus to an element (or clears it); the change can be cancelled or redirected by LosingFocus/GettingFocus handlers.

    Source

    set_focused_element_with

    fn set_focused_element_with(self: &Self, element: Option<&Ref<InputElement>>, method: NavigationMethod, key_modifiers: KeyModifiers, is_focus_change_cancellable: bool)
    

    Moves keyboard focus to an element (or clears it).

    is_focus_change_cancellable tells whether LosingFocus and GettingFocus handlers may cancel or redirect the change.

    Source

    Trait implementations

    Availability

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