pub struct Keymap { /* private fields */ }Expand description
The bindings of a surface, oldest first.
Implementations§
Source§impl Keymap
impl Keymap
Sourcepub fn new(bindings: Vec<KeyBinding>) -> Keymap
pub fn new(bindings: Vec<KeyBinding>) -> Keymap
A table of bindings, oldest first.
Sourcepub fn gives_way(
&self,
binding: &KeyBinding,
eligible: impl Fn(&KeyBinding) -> bool,
) -> bool
pub fn gives_way( &self, binding: &KeyBinding, eligible: impl Fn(&KeyBinding) -> bool, ) -> bool
Whether binding gives way while the keyboard focus is on a
control its key presses (Return, Space;
crate::input::presses_focused_control). The focus’ own bindings
(KeyBinding::for_focus) take such a key, the others give way to
the control. When a pointer gave the focus
(Keymap::pointer_focus) and an eligible binding of the key takes it over
such a focus (OverFocused::Pointer), only those take
it: the focus’ own give way to them too (a Select trigger’s Space
opening its list). A platform that matches keys itself (GTK’s
shortcuts) passes the bindings eligible in the current window and focus.
Sourcepub fn bindings(&self) -> &[KeyBinding]
pub fn bindings(&self) -> &[KeyBinding]
The bindings, oldest first.
Sourcepub fn find(
&self,
keystroke: Keystroke,
editing: bool,
repeat: bool,
) -> KeyMatch
pub fn find( &self, keystroke: Keystroke, editing: bool, repeat: bool, ) -> KeyMatch
What a key does: the newest binding of keystroke that fires while
editing (a text input or hosted native view has the keyboard
focus) takes it; repeat is an auto-repeat of a held key, which only
fires bindings that ask for it. A binding that passes the key
through gives KeyMatch::Notify, and its held key’s auto-repeats
go on (KeyMatch::None) unless it repeats.
The key is pressed with the app root as the window (Self::find_in).
Sourcepub fn find_in(
&self,
window: NodeId,
keystroke: Keystroke,
editing: bool,
repeat: bool,
) -> KeyMatch
pub fn find_in( &self, window: NodeId, keystroke: Keystroke, editing: bool, repeat: bool, ) -> KeyMatch
Self::find for a key pressed in the window of root node
window: only that window’s bindings and those of no window
(KeyBinding::window) take it.
Sourcepub fn find_at(
&self,
window: NodeId,
keystroke: Keystroke,
editing: bool,
control: bool,
repeat: bool,
) -> KeyMatch
pub fn find_at( &self, window: NodeId, keystroke: Keystroke, editing: bool, control: bool, repeat: bool, ) -> KeyMatch
Self::find_in where the keyboard focus may be on a control
(control: a view that takes presses, not a text input). The keys
that press it (crate::input::presses_focused_control: Return
and Space) are its own: only the bindings of the focus
(KeyBinding::for_focus, a menu button’s Return opening its
menu) take them first; with none, the key goes on and the platform
presses the control. A binding of Return elsewhere (a dialog’s main
action) does not act instead of the control the user moved the
focus to; one that takes them over a pointer’s focus
(OverFocused::Pointer) does when a pointer gave it
(Keymap::pointer_focus).
Sourcepub fn find_with(
&self,
window: NodeId,
keystroke: Keystroke,
focus: KeyFocus,
repeat: bool,
) -> KeyMatch
pub fn find_with( &self, window: NodeId, keystroke: Keystroke, focus: KeyFocus, repeat: bool, ) -> KeyMatch
Self::find_at with where the keyboard focus is as one value. A
focus the newest modal over its window covers (KeyFocus::covered)
has no keys of its own: the bindings of the focus
(KeyBinding::for_focus, a menu button’s Return opening its menu
under a dialog) do not take the key, so the dialog’s do.