aboutsummaryrefslogtreecommitdiffstats
path: root/Framework
diff options
context:
space:
mode:
authorTomáš Znamenáček2015-03-04 16:15:47 +0100
committerTomáš Znamenáček2015-03-04 16:15:47 +0100
commit67f4a5477ba5c924ba5384cf9e86408f3db2f603 (patch)
treeaadf716ca1f08384def0fc45c13a1df2497835b7 /Framework
parenta1eeb57ad6785fb709e84bfbfb2b06cba76c8eb5 (diff)
downloadMASShortcut-67f4a5477ba5c924ba5384cf9e86408f3db2f603.tar.bz2
Trivial refactoring.
Diffstat (limited to 'Framework')
-rw-r--r--Framework/MASShortcutView.m15
1 files changed, 7 insertions, 8 deletions
diff --git a/Framework/MASShortcutView.m b/Framework/MASShortcutView.m
index 1e1a0d8..4952b4f 100644
--- a/Framework/MASShortcutView.m
+++ b/Framework/MASShortcutView.m
@@ -3,9 +3,8 @@
NSString *const MASShortcutBinding = @"shortcutValue";
-#define HINT_BUTTON_WIDTH 23.0
-#define BUTTON_FONT_SIZE 11.0
-#define SEGMENT_CHROME_WIDTH 6.0
+static const CGFloat MASHintButtonWidth = 23;
+static const CGFloat MASButtonFontSize = 11;
#pragma mark -
@@ -56,7 +55,7 @@ NSString *const MASShortcutBinding = @"shortcutValue";
{
_shortcutCell = [[[self.class shortcutCellClass] alloc] init];
_shortcutCell.buttonType = NSPushOnPushOffButton;
- _shortcutCell.font = [[NSFontManager sharedFontManager] convertFont:_shortcutCell.font toSize:BUTTON_FONT_SIZE];
+ _shortcutCell.font = [[NSFontManager sharedFontManager] convertFont:_shortcutCell.font toSize:MASButtonFontSize];
_shortcutValidator = [MASShortcutValidator sharedValidator];
_enabled = YES;
_showsDeleteButton = YES;
@@ -155,7 +154,7 @@ NSString *const MASShortcutBinding = @"shortcutValue";
_shortcutValue = shortcutValue;
[self resetToolTips];
[self setNeedsDisplay:YES];
- [self propagateValue:shortcutValue forBinding:@"shortcutValue"];
+ [self propagateValue:shortcutValue forBinding:MASShortcutBinding];
if (self.shortcutValueChange) {
self.shortcutValueChange(self);
@@ -252,11 +251,11 @@ NSString *const MASShortcutBinding = @"shortcutValue";
- (void)getShortcutRect:(CGRect *)shortcutRectRef hintRect:(CGRect *)hintRectRef
{
CGRect shortcutRect, hintRect;
- CGFloat hintButtonWidth = HINT_BUTTON_WIDTH;
+ CGFloat hintButtonWidth = MASHintButtonWidth;
switch (self.style) {
case MASShortcutViewStyleTexturedRect: hintButtonWidth += 2.0; break;
case MASShortcutViewStyleRounded: hintButtonWidth += 3.0; break;
- case MASShortcutViewStyleFlat: hintButtonWidth -= 8.0 - (_shortcutCell.font.pointSize - BUTTON_FONT_SIZE); break;
+ case MASShortcutViewStyleFlat: hintButtonWidth -= 8.0 - (_shortcutCell.font.pointSize - MASButtonFontSize); break;
default: break;
}
CGRectDivide(self.bounds, &hintRect, &shortcutRect, hintButtonWidth, CGRectMaxXEdge);
@@ -547,7 +546,7 @@ void *kUserDataHint = &kUserDataHint;
- (NSString *)accessibilityLabel
{
- NSString* title = _shortcutValue.description ? _shortcutValue.description : @"Empty";
+ NSString* title = _shortcutValue.description ?: @"Empty";
title = [title stringByAppendingFormat:@" %@", NSLocalizedString(@"keyboard shortcut", @"VoiceOver title")];
return title;
}