diff options
| author | Dave DeLong | 2010-03-19 14:26:02 -0600 |
|---|---|---|
| committer | Dave DeLong | 2010-03-19 14:26:02 -0600 |
| commit | 4cc970c6913da06b4b455c58fada2d8cfe386478 (patch) | |
| tree | 1c5e9dcf0700d917013804c3ebd8de9dd2eed51b | |
| parent | bf967a173a923b0203bbcc799b7574f78c4f9aef (diff) | |
| download | DDHotKey-4cc970c6913da06b4b455c58fada2d8cfe386478.tar.bz2 | |
README formatting
| -rw-r--r-- | README.markdown | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/README.markdown b/README.markdown index 0a052fb..791d982 100644 --- a/README.markdown +++ b/README.markdown @@ -1,7 +1,7 @@ DDHotKey Copyright (c) 2010, Dave DeLong <http://www.davedelong.com> -**About** +##About DDHotKey is an easy-to-use Cocoa class for registering an application to respond to system key events, or "hotkeys". @@ -9,7 +9,7 @@ A global hotkey is a key combination that always executes a specific action, reg which app is frontmost. For example, the Mac OS X default hotkey of "command-space" shows the Spotlight search bar, even if Finder is not the frontmost application. -**License** +##License The license for this framework is included in every source file, and is repoduced in its entirety here: @@ -21,32 +21,32 @@ liable for any claim, damages, or other liability, whether in an action of contr otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. -**How to use** -First, your application will need to link against Carbon.framework. +##How to use +First, your application will need to link against `Carbon.framework`. -When you wish to create a hotkey, you'll need to do so via a DDHotKeyCenter object. You may -alloc/init and release a DDHotKeyCenter object at anytime; it is merely an accessor to a static -NSSet, which holds the hotkeys in global memory. +When you wish to create a hotkey, you'll need to do so via a `DDHotKeyCenter` object. You may +alloc/init and release a `DDHotKeyCenter` object at anytime; it is merely an accessor to a static +`NSSet`, which holds the hotkeys in global memory. You can register a hotkey in one of two ways: via a target/action mechanism, or with a block. The target/action mechanism can take a single extra "object" parameter, which it will pass into the -action when the hotkey is fired. In addition, an NSEvent object is passed, which contains +action when the hotkey is fired. In addition, an `NSEvent` object is passed, which contains information regarding the hotkey event (such as the location, the keyCode, the modifierFlags, etc). Hotkey actions must have one of two method signatures (the actual selector is irrelevant): -//a method with a single NSEvent parameter -- (void) hotkeyAction:(NSEvent*)hotKeyEvent; +`//a method with a single NSEvent parameter` +`- (void) hotkeyAction:(NSEvent*)hotKeyEvent;` OR -//a method with an NSEvent parameter and an object parameter -- (void) hotkeyAction:(NSEvent*)hotKeyEvent withObject:(id)anObject; +`//a method with an NSEvent parameter and an object parameter` +`- (void) hotkeyAction:(NSEvent*)hotKeyEvent withObject:(id)anObject;` The other way to register a hotkey is with a block callback. The block must have the following signature: -void (^)(NSEvent *); +`void (^)(NSEvent *);` -DDHotKeyCenter.h contains a typedef statement to typedef this signature as a "DDHotKeyTask", for +`DDHotKeyCenter.h` contains a typedef statement to typedef this signature as a `DDHotKeyTask`, for convenience. Finally, you can unregister a hotkey based on its target, its target and action, or its keycode and |
