aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Shpakovski2014-11-24 17:33:12 +0300
committerVadim Shpakovski2014-11-24 17:33:12 +0300
commita3a459b4e4e47bf18dccd5dc7f315389346e3d6c (patch)
tree3f0afbac356d0441f51b287b5e240e2a52940146
parent72904d4dde773c9d31ef7e1927db8484b261c35d (diff)
parent443e2db73d3268b7dbac7bb1e80bf2f716c86fd3 (diff)
downloadMASShortcut-a3a459b4e4e47bf18dccd5dc7f315389346e3d6c.tar.bz2
Merge pull request #52 from starkos/flat-button-stylemaintenance-1.x
Flat button style
-rw-r--r--MASShortcutView.h3
-rw-r--r--MASShortcutView.m11
2 files changed, 13 insertions, 1 deletions
diff --git a/MASShortcutView.h b/MASShortcutView.h
index d6a4313..c8a46bb 100644
--- a/MASShortcutView.h
+++ b/MASShortcutView.h
@@ -5,7 +5,8 @@
typedef enum {
MASShortcutViewAppearanceDefault = 0, // Height = 19 px
MASShortcutViewAppearanceTexturedRect, // Height = 25 px
- MASShortcutViewAppearanceRounded // Height = 43 px
+ MASShortcutViewAppearanceRounded, // Height = 43 px
+ MASShortcutViewAppearanceFlat
} MASShortcutViewAppearance;
@interface MASShortcutView : NSView
diff --git a/MASShortcutView.m b/MASShortcutView.m
index b2d2531..dd75729 100644
--- a/MASShortcutView.m
+++ b/MASShortcutView.m
@@ -107,6 +107,12 @@
_shortcutCell.bezelStyle = NSRoundedBezelStyle;
break;
}
+ case MASShortcutViewAppearanceFlat: {
+ self.wantsLayer = YES;
+ _shortcutCell.backgroundColor = [NSColor clearColor];
+ _shortcutCell.bordered = NO;
+ break;
+ }
}
}
@@ -176,6 +182,10 @@
[_shortcutCell drawWithFrame:CGRectOffset(frame, 0.0, 1.0) inView:self];
break;
}
+ case MASShortcutViewAppearanceFlat: {
+ [_shortcutCell drawWithFrame:frame inView:self];
+ break;
+ }
}
}
@@ -227,6 +237,7 @@
switch (self.appearance) {
case MASShortcutViewAppearanceTexturedRect: hintButtonWidth += 2.0; break;
case MASShortcutViewAppearanceRounded: hintButtonWidth += 3.0; break;
+ case MASShortcutViewAppearanceFlat: hintButtonWidth -= 8.0 - (_shortcutCell.font.pointSize - BUTTON_FONT_SIZE); break;
default: break;
}
CGRectDivide(self.bounds, &hintRect, &shortcutRect, hintButtonWidth, CGRectMaxXEdge);