pub struct ShortcutManager { /* private fields */ }Expand description
Registry managing active keyboard shortcuts and dispatching incoming key events.
Implementations§
Source§impl ShortcutManager
impl ShortcutManager
Sourcepub fn register(
&mut self,
spec: &str,
action: impl Fn() -> bool + 'static,
) -> bool
pub fn register( &mut self, spec: &str, action: impl Fn() -> bool + 'static, ) -> bool
Registers a shortcut by spec string (e.g. “Ctrl+Shift+I”, “F12”).
Returns true if the shortcut string was parsed and successfully registered.
Sourcepub fn register_trigger(
&mut self,
trigger: ShortcutTrigger,
action: impl Fn() -> bool + 'static,
)
pub fn register_trigger( &mut self, trigger: ShortcutTrigger, action: impl Fn() -> bool + 'static, )
Registers a shortcut with a pre-constructed ShortcutTrigger.
Sourcepub fn dispatch(&self, event: &PlatformEvent) -> bool
pub fn dispatch(&self, event: &PlatformEvent) -> bool
Dispatches an incoming PlatformEvent. If it matches a registered shortcut,
invokes the associated action and returns its repaint status.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ShortcutManager
impl !Send for ShortcutManager
impl !Sync for ShortcutManager
impl !UnwindSafe for ShortcutManager
impl Forget for ShortcutManager
impl Freeze for ShortcutManager
impl Move for ShortcutManager
impl Unpin for ShortcutManager
impl UnsafeUnpin 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