Fix style issues

This commit is contained in:
Cheng Zhao 2016-04-07 13:58:51 +09:00
parent e0ee60f290
commit 548febfa4c

View file

@ -78,18 +78,18 @@ const CGFloat kVerticalTitleMargin = 2;
BOOL highlightContent = highlight | [self isDarkMode]; BOOL highlightContent = highlight | [self isDarkMode];
CGFloat thickness = [[statusItem_ statusBar] thickness]; CGFloat thickness = [[statusItem_ statusBar] thickness];
// Draw the system bar background // Draw the system bar background.
[statusItem_ drawStatusBarBackgroundInRect:self.bounds withHighlight:highlight]; [statusItem_ drawStatusBarBackgroundInRect:self.bounds withHighlight:highlight];
// Determine which image to use // Determine which image to use.
NSImage * image = image_.get(); NSImage* image = image_.get();
if (inMouseEventSequence_ && alternateImage_) { if (inMouseEventSequence_ && alternateImage_) {
image = alternateImage_.get(); image = alternateImage_.get();
} }
// Apply the higlight color if the image is a template image. When this moves // Apply the higlight color if the image is a template image. When this moves
// to using the new [NSStatusItem button] API, this should work automagically. // to using the new [NSStatusItem button] API, this should work automagically.
if ([image isTemplate] == YES) { if ([image isTemplate] == YES) {
NSImage * imageWithColor = [image copy] autorelease]; NSImage* imageWithColor = [[image copy] autorelease];
[imageWithColor lockFocus]; [imageWithColor lockFocus];
[[self colorWithHighlight: highlightContent] set]; [[self colorWithHighlight: highlightContent] set];
CGRect imageBounds = CGRectMake(0,0, image.size.width, image.size.height); CGRect imageBounds = CGRectMake(0,0, image.size.width, image.size.height);
@ -162,17 +162,16 @@ const CGFloat kVerticalTitleMargin = 2;
return [attributes size].width; return [attributes size].width;
} }
- (NSColor*)colorWithHighlight:(BOOL)highlight - (NSColor*)colorWithHighlight:(BOOL)highlight {
{
return highlight ? return highlight ?
[NSColor whiteColor] : [NSColor whiteColor] :
[NSColor colorWithRed:0.265625 green:0.25390625 blue:0.234375 alpha:1.0]; [NSColor colorWithRed:0.265625 green:0.25390625 blue:0.234375 alpha:1.0];
} }
- (NSDictionary*)titleAttributesWithHighlight:(BOOL)highlight { - (NSDictionary*)titleAttributesWithHighlight:(BOOL)highlight {
return @{ return @{
NSFontAttributeName: [NSFont menuBarFontOfSize:0], NSFontAttributeName:[NSFont menuBarFontOfSize:0],
NSForegroundColorAttributeName: [self colorWithHighlight: highlight] NSForegroundColorAttributeName:[self colorWithHighlight: highlight]
}; };
} }