summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave DeLong2010-02-24 15:26:00 -0600
committerDave DeLong2010-02-24 15:26:00 -0600
commit2080059c4803bdb7fc045715533ea4b33f8ee6b1 (patch)
tree30747e73e2f7c9fd7149b65197c8527b1219725b
parent3db4cacf07383d3d30822d180695d78e9d6ad145 (diff)
downloadDDHotKey-2080059c4803bdb7fc045715533ea4b33f8ee6b1.tar.bz2
Updated copyright, added license and comments, added README
-rw-r--r--README49
1 files changed, 49 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..ad95a20
--- /dev/null
+++ b/README
@@ -0,0 +1,49 @@
+DDHotKey
+Copyright (c) 2010, Dave DeLong <http://www.davedelong.com>
+
+**About**
+DDHotKey is an easy-to-use Cocoa wrapper around Carbon's global hotkeys, since no Cocoa equivalent
+exists. The purpose of DDHotKey is to provide as simple an interface as possible to creating and
+removing global hotkeys.
+
+**License**
+The license for this framework is included in every source file, and is repoduced in its entirety
+here:
+
+Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee
+is hereby granted, provided that the above copyright notice and this permission notice appear in all
+copies. The software is provided "as is", without warranty of any kind, including all implied
+warranties of merchantability and fitness. In no event shall the authors or copyright holders be
+liable for any claim, damages, or other liability, whether in an action of contract, tort, or
+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.
+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
+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;
+ OR
+//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 *);
+
+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
+modifier flags. \ No newline at end of file