forked from cocoabits/MASShortcut
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMASShortcutMonitor.h
More file actions
31 lines (24 loc) · 913 Bytes
/
MASShortcutMonitor.h
File metadata and controls
31 lines (24 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef _MASSHORTCUTMONITOR_H
#define _MASSHORTCUTMONITOR_H
#import "./MASShortcut.h"
#import <Cocoa/Cocoa.h>
/**
Executes action when a shortcut is pressed.
There can only be one instance of this class, otherwise things
will probably not work. (There’s a Carbon event handler inside
and there can only be one Carbon event handler of a given type.)
*/
@interface MASShortcutMonitor : NSObject
- (instancetype) init __unavailable;
+ (instancetype) sharedMonitor;
/**
Register a shortcut along with an action.
Attempting to insert an already registered shortcut probably won’t work.
It may burn your house or cut your fingers. You have been warned.
*/
- (BOOL) registerShortcut: (MASShortcut*) shortcut withAction: (dispatch_block_t) action;
- (BOOL) isShortcutRegistered: (MASShortcut*) shortcut;
- (void) unregisterShortcut: (MASShortcut*) shortcut;
- (void) unregisterAllShortcuts;
@end
#endif