Adding HotKeys to ITKit... This is the new HotKey code by Quentin of
[ITKit.git] / ITHotKey.m
diff --git a/ITHotKey.m b/ITHotKey.m
new file mode 100755 (executable)
index 0000000..bf411f9
--- /dev/null
@@ -0,0 +1,91 @@
+//
+//  ITHotKey.m
+//
+//  Created by Quentin Carnicelli on Sat Aug 02 2003.
+//  Copyright (c) 2003 iThink Software. All rights reserved.
+//
+
+#import "ITHotKey.h"
+
+#import "ITHotKeyCenter.h"
+#import "ITKeyCombo.h"
+
+@implementation ITHotKey
+
+- (id)init
+{
+       self = [super init];
+       
+       if( self )
+       {
+               [self setKeyCombo: [ITKeyCombo clearKeyCombo]];
+       }
+       
+       return self;
+}
+
+- (void)dealloc
+{
+       [mName release];
+       [mKeyCombo release];
+       
+       [super dealloc];
+}
+
+- (NSString*)description
+{
+       return [NSString stringWithFormat: @"<%@: %@>", NSStringFromClass( [self class] ), [self keyCombo]];
+}
+
+#pragma mark -
+
+- (void)setKeyCombo: (ITKeyCombo*)combo
+{
+       [combo retain];
+       [mKeyCombo release];
+       mKeyCombo = combo;
+}
+
+- (ITKeyCombo*)keyCombo
+{
+       return mKeyCombo;
+}
+
+- (void)setName: (NSString*)name
+{
+       [name retain];
+       [mName release];
+       mName = name;
+}
+
+- (NSString*)name
+{
+       return mName;
+}
+
+- (void)setTarget: (id)target
+{
+       mTarget = target;
+}
+
+- (id)target
+{
+       return mTarget;
+}
+
+- (void)setAction: (SEL)action
+{
+       mAction = action;
+}
+
+- (SEL)action
+{
+       return mAction;
+}
+
+- (void)invoke
+{
+       [mTarget performSelector: mAction withObject: self];
+}
+
+@end