summaryrefslogtreecommitdiffstats
path: root/macosx/HBToolbarBadgedItem.m
diff options
context:
space:
mode:
authorBradley Sepos <[email protected]>2018-01-24 17:49:37 -0500
committerBradley Sepos <[email protected]>2018-01-25 17:56:43 -0500
commit4430f2b2b9210355ae7772d1d60cc40a8826f723 (patch)
tree26ec18233d2b0419606ba494c89ca2669ccc2207 /macosx/HBToolbarBadgedItem.m
parentd0e38782c740cc88d5a383b3b7f0072de0e8e44a (diff)
MacGUI: Move toolbar item badge and vary type size with scale factor.
10 pt for standard displays, 8 pt for high dpi displays. Alignment considerations.
Diffstat (limited to 'macosx/HBToolbarBadgedItem.m')
-rw-r--r--macosx/HBToolbarBadgedItem.m17
1 files changed, 14 insertions, 3 deletions
diff --git a/macosx/HBToolbarBadgedItem.m b/macosx/HBToolbarBadgedItem.m
index b149dc0aa..35fdf6808 100644
--- a/macosx/HBToolbarBadgedItem.m
+++ b/macosx/HBToolbarBadgedItem.m
@@ -148,7 +148,12 @@
// Work out the area
CGFloat scaleFactor = rep.pixelsWide / rep.size.width;
- CGFloat pointSize = 10 * scaleFactor;
+ CGFloat typeSize = 10;
+ if (scaleFactor > 1)
+ {
+ typeSize = 8;
+ }
+ CGFloat pointSize = typeSize * scaleFactor;
NSFont *font = [NSFont boldSystemFontOfSize:pointSize];
NSDictionary *attr = @{NSParagraphStyleAttributeName : paragraphStyle,
@@ -159,10 +164,16 @@
options:0
attributes:attr];
- NSPoint indent = NSMakePoint(10 * scaleFactor, 2 * scaleFactor);
+ NSPoint indent = NSMakePoint(typeSize * scaleFactor, 2 * scaleFactor);
CGFloat radius = (textBounds.size.height + indent.y) * 0.5f;
- NSRect badgeRect = NSMakeRect(0, 0,
+ CGFloat offset_x = 0;
+ CGFloat offset_y = 0;
+ if (scaleFactor > 1)
+ {
+ offset_y = 2 * scaleFactor;
+ }
+ NSRect badgeRect = NSMakeRect(size.width - textBounds.size.width - indent.x - offset_x, offset_y,
textBounds.size.width + indent.x, textBounds.size.height + indent.y);
badgeRect = NSIntegralRect(badgeRect);