Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 0ec2bbb66a
Fetching contributors…

Cannot retrieve contributors at this time

75 lines (59 sloc) 1.584 kB
//
// SGHotKey.m
// SGHotKeyCenter
//
// Created by Justin Williams on 7/26/09.
// Copyright 2009 Second Gear. All rights reserved.
//
#import "SGHotKey.h"
#import "SGKeyCombo.h"
@implementation SGHotKey
@synthesize identifier;
@synthesize name;
@synthesize keyCombo;
@synthesize target;
@synthesize action;
@synthesize hotKeyID;
- (void)dealloc {
[identifier release];
[name release];
[keyCombo release];
[super dealloc];
}
- (id)init {
return [self initWithIdentifier:nil keyCombo:nil];
}
- (id)initWithIdentifier:(id)theIdentifier keyCombo:(SGKeyCombo *)theCombo {
if (self = [super init]) {
self.identifier = theIdentifier;
self.keyCombo = theCombo;
}
return self;
}
- (id)initWithIdentifier:(id)theIdentifier keyCombo:(SGKeyCombo *)theCombo target:(id)theTarget action:(SEL)theAction {
if (self = [super init]) {
self.identifier = theIdentifier;
self.keyCombo = theCombo;
self.target = theTarget;
self.action = theAction;
}
return self;
}
- (BOOL)matchesHotKeyID:(EventHotKeyID)theKeyID {
return (hotKeyID.id == theKeyID.id) && (hotKeyID.signature == theKeyID.signature);
}
- (void)invoke {
[self.target performSelector:self.action withObject:self];
}
- (void)setKeyCombo:(SGKeyCombo *)theKeyCombo {
if (theKeyCombo == nil)
theKeyCombo = [SGKeyCombo clearKeyCombo];
keyCombo = [theKeyCombo retain];
}
- (NSString *)description {
return [NSString stringWithFormat: @"<%@: %@, %@>",
NSStringFromClass([self class]),
self.identifier,
self.keyCombo];
}
@end
Jump to Line
Something went wrong with that request. Please try again.