You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
827 B
44 lines
827 B
// |
|
// SRKeyEquivalentModifierMaskTransformer.m |
|
// ShortcutRecorder |
|
// |
|
// Copyright 2012 Contributors. All rights reserved. |
|
// |
|
// License: BSD |
|
// |
|
// Contributors: |
|
// Ilya Kulakov |
|
|
|
#import "SRKeyEquivalentModifierMaskTransformer.h" |
|
#import "SRKeyCodeTransformer.h" |
|
#import "SRRecorderControl.h" |
|
|
|
|
|
@implementation SRKeyEquivalentModifierMaskTransformer |
|
|
|
#pragma mark NSValueTransformer |
|
|
|
+ (BOOL)allowsReverseTransformation |
|
{ |
|
return NO; |
|
} |
|
|
|
+ (Class)transformedValueClass |
|
{ |
|
return [NSNumber class]; |
|
} |
|
|
|
- (NSNumber *)transformedValue:(NSDictionary *)aValue |
|
{ |
|
if (![aValue isKindOfClass:[NSDictionary class]]) |
|
return @(0); |
|
|
|
NSNumber *modifierFlags = aValue[SRShortcutModifierFlagsKey]; |
|
|
|
if (![modifierFlags isKindOfClass:[NSNumber class]]) |
|
return @(0); |
|
|
|
return modifierFlags; |
|
} |
|
|
|
@end
|
|
|