Skip to content

Commit

Permalink
Merge pull request ViennaRSS#13 from barijaona/nivekkagicom
Browse files Browse the repository at this point in the history
Sync with MiMo42's version
  • Loading branch information
barijaona authored Dec 26, 2018
2 parents 1956c2c + ec57857 commit b98bee8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
21 changes: 15 additions & 6 deletions MMTabBarView/MMTabBarView/MMTabBarButtonCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -1063,17 +1063,26 @@ - (void)_drawIconWithFrame:(NSRect)frame inView:(NSView *)controlView {
[icon drawInRect:iconRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil];
}

inline static bool useShadow(NSView* const inView) {
if (@available(macOS 10.14, *)) {
return ![[inView.effectiveAppearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]] isEqualToString:NSAppearanceNameDarkAqua];
}
return true;
}

- (void)_drawTitleWithFrame:(NSRect)frame inView:(NSView *)controlView {

NSRect rect = [self titleRectForBounds:frame];

[NSGraphicsContext saveGraphicsState];

NSShadow *shadow = [[NSShadow alloc] init];
[shadow setShadowColor:[NSColor.whiteColor colorWithAlphaComponent:0.4]];
[shadow setShadowBlurRadius:1.0];
[shadow setShadowOffset:NSMakeSize(0.0, -1.0)];
[shadow set];

if (useShadow(controlView)) {
NSShadow *shadow = [[NSShadow alloc] init];
[shadow setShadowColor:[NSColor.whiteColor colorWithAlphaComponent:0.4]];
[shadow setShadowBlurRadius:1.0];
[shadow setShadowOffset:NSMakeSize(0.0, -1.0)];
[shadow set];
}

// draw title
[self.attributedStringValue drawInRect:rect];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ -(void)drawBezelOfOverflowButton:(MMOverflowPopUpButton *)overflowButton ofTabBa

-(void)drawBezelOfTabCell:(MMTabBarButtonCell *)cell withFrame:(NSRect)frame inView:(NSView *)controlView {

if (@available(macos 10.14, *)) {
return;
}
if (cell.controlView.frame.size.height < 2)
return;

Expand All @@ -376,9 +379,6 @@ -(void)drawBezelOfTabCell:(MMTabBarButtonCell *)cell withFrame:(NSRect)frame inV
NSRect cellFrame = frame;

cellFrame = NSInsetRect(cellFrame, -5.0, 0);

if (cell.controlView.frame.size.height < 2)
return;

NSImage *left = nil;
NSImage *center = nil;
Expand Down

0 comments on commit b98bee8

Please sign in to comment.