aboutsummaryrefslogtreecommitdiff
path: root/AppKit
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2010-09-29 23:37:56 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2010-09-29 23:37:56 +0000
commit14d386b499c8495b3725469cc0cd3393e0c613e6 (patch)
treef3268f743690c78c4018fc013dc9a627dea1f6c3 /AppKit
parent6d304bcfdf6e57f560fcb1f7b06802bc2d7f5b8a (diff)
[Author: aharper]
GTMHotKeyTextField on 10.4 again, properties are too new, so write custom accessors. DELTA=47 (29 added, 18 deleted, 0 changed) R=dmaclach
Diffstat (limited to 'AppKit')
-rw-r--r--AppKit/GTMHotKeyTextField.h21
-rw-r--r--AppKit/GTMHotKeyTextField.m26
2 files changed, 29 insertions, 18 deletions
diff --git a/AppKit/GTMHotKeyTextField.h b/AppKit/GTMHotKeyTextField.h
index cd671f0..cdd7830 100644
--- a/AppKit/GTMHotKeyTextField.h
+++ b/AppKit/GTMHotKeyTextField.h
@@ -33,16 +33,6 @@
BOOL doubledModifier_;
}
-// Modifier flags are stored using Cocoa constants (same as NSEvent) you will
-// need to translate them to Carbon modifier flags for use with
-// RegisterEventHotKey()
-@property (readonly) NSUInteger modifiers;
-// Virtual keycode. For double-modifier hotkeys this value is ignored.
-@property (readonly) NSUInteger keyCode;
-//Double-tap modifier keys cannot be used with RegisterEventHotKey(), you must
-// implement your own Carbon event handler.
-@property (readonly) BOOL doubledModifier;
-
+ (id)hotKeyWithKeyCode:(NSUInteger)keyCode
modifiers:(NSUInteger)modifiers
useDoubledModifier:(BOOL)doubledModifier;
@@ -50,6 +40,12 @@
- (id)initWithKeyCode:(NSUInteger)keyCode
modifiers:(NSUInteger)modifiers
useDoubledModifier:(BOOL)doubledModifier;
+
+// Custom accessors (readonly, nonatomic)
+- (NSUInteger)modifiers;
+- (NSUInteger)keyCode;
+- (BOOL)doubledModifier;
+
@end
// Notes:
@@ -111,9 +107,10 @@
GTMHotKeyTextFieldCell *cell_;
}
-@property (retain) GTMHotKeyTextFieldCell *cell;
-
// Get the shared field editor for all hot key fields
+ (GTMHotKeyFieldEditor *)sharedHotKeyFieldEditor;
+// Custom accessors (retain, nonatomic)
+- (GTMHotKeyTextFieldCell *)cell;
+
@end
diff --git a/AppKit/GTMHotKeyTextField.m b/AppKit/GTMHotKeyTextField.m
index 27cd5b9..8c8703d 100644
--- a/AppKit/GTMHotKeyTextField.m
+++ b/AppKit/GTMHotKeyTextField.m
@@ -48,10 +48,6 @@ static CFStringRef kGTM_TISPropertyUnicodeKeyLayoutData = NULL;
@implementation GTMHotKey
-@synthesize modifiers = modifiers_;
-@synthesize keyCode = keyCode_;
-@synthesize doubledModifier = doubledModifier_;
-
+ (id)hotKeyWithKeyCode:(NSUInteger)keyCode
modifiers:(NSUInteger)modifiers
useDoubledModifier:(BOOL)doubledModifier {
@@ -71,6 +67,18 @@ static CFStringRef kGTM_TISPropertyUnicodeKeyLayoutData = NULL;
return self;
}
+- (NSUInteger)modifiers {
+ return modifiers_;
+}
+
+- (NSUInteger)keyCode {
+ return keyCode_;
+}
+
+- (BOOL)doubledModifier {
+ return doubledModifier_;
+}
+
- (BOOL)isEqual:(id)object {
return [object isKindOfClass:[GTMHotKey class]]
&& [object modifiers] == [self modifiers]
@@ -554,8 +562,6 @@ static CFStringRef kGTM_TISPropertyUnicodeKeyLayoutData = NULL;
GTMOBJECT_SINGLETON_BOILERPLATE(GTMHotKeyFieldEditor, sharedHotKeyFieldEditor)
-@synthesize cell = cell_;
-
- (id)init {
if ((self = [super init])) {
[self setFieldEditor:YES]; // We are a field editor
@@ -571,6 +577,14 @@ GTMOBJECT_SINGLETON_BOILERPLATE(GTMHotKeyFieldEditor, sharedHotKeyFieldEditor)
}
// COV_NF_END
+- (GTMHotKeyTextFieldCell *)cell {
+ return cell_;
+}
+
+- (void)setCell:(GTMHotKeyTextFieldCell *)cell {
+ [cell_ autorelease];
+ cell_ = [cell retain];
+}
- (NSArray *)acceptableDragTypes {
// Don't take drags