pub struct ShortcutManager { /* private fields */ }Expand description
Keyboard shortcut manager.
Implementations§
Source§impl ShortcutManager
impl ShortcutManager
Sourcepub fn register(&mut self, binding: KeyBinding) -> u32
pub fn register(&mut self, binding: KeyBinding) -> u32
Register a new shortcut binding. Returns binding ID.
Sourcepub fn unregister(&mut self, id: u32) -> bool
pub fn unregister(&mut self, id: u32) -> bool
Remove a shortcut by ID.
Sourcepub fn process_key(
&self,
modifiers: ModifierMask,
key: KeyCode,
) -> Option<ShortcutAction>
pub fn process_key( &self, modifiers: ModifierMask, key: KeyCode, ) -> Option<ShortcutAction>
Process a key event and return the matching action (if any). Returns the highest-priority matching action.
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enable or disable all shortcut processing.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if shortcuts are enabled.
Sourcepub fn binding_count(&self) -> usize
pub fn binding_count(&self) -> usize
Get the number of registered bindings.
Sourcepub fn bindings_for_action(&self, action: ShortcutAction) -> Vec<&KeyBinding>
pub fn bindings_for_action(&self, action: ShortcutAction) -> Vec<&KeyBinding>
Get all bindings for a given action.
Sourcepub fn set_binding_enabled(&mut self, id: u32, enabled: bool) -> bool
pub fn set_binding_enabled(&mut self, id: u32, enabled: bool) -> bool
Enable or disable a specific binding by ID.