0e2ddc3f33ece27a3a782c219206cb68127c10ea
[ITKit.git] / ITHotKey.m
1 //
2 //  ITHotKey.m
3 //
4 //  Created by Quentin Carnicelli on Sat Aug 02 2003.
5 //  Copyright (c) 2003 iThink Software. All rights reserved.
6 //
7
8 #import "ITHotKey.h"
9
10 #import "ITHotKeyCenter.h"
11 #import "ITKeyCombo.h"
12
13 @implementation ITHotKey
14
15 - (id)init
16 {
17         if ( (self = [super init]) )
18         {
19                 [self setKeyCombo: [ITKeyCombo clearKeyCombo]];
20         }
21         
22         return self;
23 }
24
25 - (void)dealloc
26 {
27         [mName release];
28         [mKeyCombo release];
29         
30         [super dealloc];
31 }
32
33 - (NSString*)description
34 {
35         return [NSString stringWithFormat: @"<%@: %@>",
36         NSStringFromClass( [self class] ),
37         [self keyCombo]];
38 }
39
40 #pragma mark -
41
42 - (void)setKeyCombo: (ITKeyCombo*)combo
43 {
44         [combo retain];
45         [mKeyCombo release];
46         mKeyCombo = combo;
47 }
48
49 - (ITKeyCombo*)keyCombo
50 {
51         return mKeyCombo;
52 }
53
54 - (void)setName: (NSString*)name
55 {
56         [name retain];
57         [mName release];
58         mName = name;
59 }
60
61 - (NSString*)name
62 {
63         return mName;
64 }
65
66 - (void)setTarget: (id)target
67 {
68         mTarget = target;
69 }
70
71 - (id)target
72 {
73         return mTarget;
74 }
75
76 - (void)setAction: (SEL)action
77 {
78         mAction = action;
79 }
80
81 - (SEL)action
82 {
83         return mAction;
84 }
85
86 - (void)invoke
87 {
88         [mTarget performSelector: mAction withObject: self];
89 }
90
91 @end