pub struct ShortcutManager { /* private fields */ }Expand description
Manager for keyboard shortcuts.
Implementations§
Source§impl ShortcutManager
impl ShortcutManager
Sourcepub fn register(
&mut self,
shortcut: Shortcut,
handler: ShortcutHandler,
) -> ShortcutId
pub fn register( &mut self, shortcut: Shortcut, handler: ShortcutHandler, ) -> ShortcutId
Register a shortcut.
Sourcepub fn register_with_options(
&mut self,
shortcut: Shortcut,
handler: ShortcutHandler,
context: ShortcutContext,
priority: ShortcutPriority,
description: &str,
) -> ShortcutId
pub fn register_with_options( &mut self, shortcut: Shortcut, handler: ShortcutHandler, context: ShortcutContext, priority: ShortcutPriority, description: &str, ) -> ShortcutId
Register a shortcut with full options.
Sourcepub fn unregister(&mut self, id: ShortcutId) -> bool
pub fn unregister(&mut self, id: ShortcutId) -> bool
Unregister a shortcut.
Sourcepub fn set_enabled(&mut self, id: ShortcutId, enabled: bool)
pub fn set_enabled(&mut self, id: ShortcutId, enabled: bool)
Enable or disable a shortcut.
Sourcepub fn is_enabled(&self, id: ShortcutId) -> bool
pub fn is_enabled(&self, id: ShortcutId) -> bool
Check if a shortcut is enabled.
Sourcepub fn set_modifiers(&mut self, modifiers: Modifiers)
pub fn set_modifiers(&mut self, modifiers: Modifiers)
Set the current modifier state.
Sourcepub fn push_context(&mut self, context: ShortcutContext)
pub fn push_context(&mut self, context: ShortcutContext)
Push an active context.
Sourcepub fn pop_context(&mut self) -> Option<ShortcutContext>
pub fn pop_context(&mut self) -> Option<ShortcutContext>
Pop the most recent context.
Sourcepub fn set_focused_widget(&mut self, widget_id: Option<WidgetId>)
pub fn set_focused_widget(&mut self, widget_id: Option<WidgetId>)
Set the focused widget context.
Sourcepub fn handle_key(&mut self, key: Key) -> bool
pub fn handle_key(&mut self, key: Key) -> bool
Handle a key press and trigger matching shortcuts. Returns true if a shortcut was triggered.
Sourcepub fn shortcuts(&self) -> impl Iterator<Item = (&Shortcut, &str)>
pub fn shortcuts(&self) -> impl Iterator<Item = (&Shortcut, &str)>
Get all registered shortcuts.
Sourcepub fn binding_count(&self) -> usize
pub fn binding_count(&self) -> usize
Get binding count.
Sourcepub fn find_conflicts(&self) -> Vec<(Shortcut, Vec<ShortcutId>)>
pub fn find_conflicts(&self) -> Vec<(Shortcut, Vec<ShortcutId>)>
Check for shortcut conflicts (same shortcut, same context).
Sourcepub fn description(&self, id: ShortcutId) -> Option<&str>
pub fn description(&self, id: ShortcutId) -> Option<&str>
Get the description for a shortcut binding.
Trait Implementations§
Source§impl Debug for ShortcutManager
impl Debug for ShortcutManager
Auto Trait Implementations§
impl Freeze for ShortcutManager
impl !RefUnwindSafe for ShortcutManager
impl Send for ShortcutManager
impl !Sync for ShortcutManager
impl Unpin for ShortcutManager
impl !UnwindSafe for ShortcutManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().