Files
textmate/Frameworks/Preferences/src/PreferencesPane.mm
Allan Odgaard 9894969e67 Initial commit
2012-08-09 16:25:56 +02:00

45 lines
1.3 KiB
Plaintext

#import "PreferencesPane.h"
@interface PreferencesPane ()
@property (nonatomic, readwrite) NSString* toolbarItemLabel;
@property (nonatomic, readwrite) NSImage* toolbarItemImage;
@end
@implementation PreferencesPane
@synthesize toolbarItemLabel = label, toolbarItemImage = image, defaultsProperties;
- (NSString*)identifier { return label; }
- (id)initWithNibName:(NSString*)aNibName label:(NSString*)aLabel image:(NSImage*)anImage
{
if(self = [super initWithNibName:aNibName bundle:[NSBundle bundleForClass:[self class]]])
{
self.toolbarItemLabel = aLabel;
self.toolbarItemImage = anImage;
}
return self;
}
- (void)setValue:(id)newValue forUndefinedKey:(NSString*)aKey
{
if(NSString* key = [defaultsProperties objectForKey:aKey])
return [[NSUserDefaults standardUserDefaults] setObject:newValue forKey:key];
[super setValue:newValue forUndefinedKey:aKey];
}
- (id)valueForUndefinedKey:(NSString*)aKey
{
if(NSString* key = [defaultsProperties objectForKey:aKey])
return [[NSUserDefaults standardUserDefaults] objectForKey:key];
return [super valueForUndefinedKey:aKey];
}
- (IBAction)help:(id)sender
{
NSString* anchor = [sender isKindOfClass:[NSButton class]] ? [sender alternateTitle] : nil;
if(anchor)
[[NSHelpManager sharedHelpManager] openHelpAnchor:anchor inBook:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleHelpBookName"]];
}
@end