| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/cocoa/wrench_menu_button_cell.h" | 5 #import "chrome/browser/cocoa/wrench_menu_button_cell.h" |
| 6 | 6 |
| 7 #include "base/scoped_nsobject.h" | 7 #include "base/scoped_nsobject.h" |
| 8 | 8 |
| 9 @implementation WrenchMenuButtonCell | 9 @implementation WrenchMenuButtonCell |
| 10 | 10 |
| 11 - (void)drawBezelWithFrame:(NSRect)frame inView:(NSView*)controlView { | 11 - (void)drawBezelWithFrame:(NSRect)frame inView:(NSView*)controlView { |
| 12 [NSGraphicsContext saveGraphicsState]; | 12 [NSGraphicsContext saveGraphicsState]; |
| 13 | 13 |
| 14 // Inset the rect to match the appearance of the layout of interface builder. | 14 // Inset the rect to match the appearance of the layout of interface builder. |
| 15 // The bounding rect of buttons is actually larger than the display rect shown | 15 // The bounding rect of buttons is actually larger than the display rect shown |
| 16 // there. | 16 // there. |
| 17 frame = NSInsetRect(frame, 0.0, 1.0); | 17 frame = NSInsetRect(frame, 0.0, 1.0); |
| 18 | 18 |
| 19 // Stroking the rect gives a weak stroke. Filling and insetting gives a | 19 // Stroking the rect gives a weak stroke. Filling and insetting gives a |
| 20 // strong, un-anti-aliased border. | 20 // strong, un-anti-aliased border. |
| 21 [[NSColor colorWithDeviceWhite:0.663 alpha:1.0] set]; | 21 [[NSColor colorWithDeviceWhite:0.663 alpha:1.0] set]; |
| 22 NSRectFill(frame); | 22 NSRectFill(frame); |
| 23 frame = NSInsetRect(frame, 1.0, 1.0); | 23 frame = NSInsetRect(frame, 1.0, 1.0); |
| 24 | 24 |
| 25 NSColor* start = [NSColor whiteColor]; | 25 NSColor* start = [NSColor whiteColor]; |
| 26 NSColor* end = [NSColor colorWithDeviceWhite:0.922 alpha:1.0]; | 26 NSColor* end = [NSColor colorWithDeviceWhite:0.922 alpha:1.0]; |
| 27 if ([self isHighlighted]) { | 27 if ([self isHighlighted]) { |
| 28 start = [NSColor colorWithDeviceRed:0.396 green:0.641 blue:0.941 alpha:1.0]; | 28 start = [NSColor colorWithDeviceRed:0.396 green:0.641 blue:0.941 alpha:1.0]; |
| 29 end = [NSColor selectedMenuItemColor]; | 29 end = [NSColor colorWithDeviceRed:0.157 green:0.384 blue:0.929 alpha:1.0]; |
| 30 } | 30 } |
| 31 | 31 |
| 32 scoped_nsobject<NSGradient> gradient( | 32 scoped_nsobject<NSGradient> gradient( |
| 33 [[NSGradient alloc] initWithStartingColor:start | 33 [[NSGradient alloc] initWithStartingColor:start |
| 34 endingColor:end]); | 34 endingColor:end]); |
| 35 [gradient drawInRect:frame angle:90.0]; | 35 [gradient drawInRect:frame angle:90.0]; |
| 36 | 36 |
| 37 [NSGraphicsContext restoreGraphicsState]; | 37 [NSGraphicsContext restoreGraphicsState]; |
| 38 } | 38 } |
| 39 | 39 |
| 40 - (NSBackgroundStyle)interiorBackgroundStyle { | 40 - (NSBackgroundStyle)interiorBackgroundStyle { |
| 41 if ([self isHighlighted]) | 41 if ([self isHighlighted]) |
| 42 return NSBackgroundStyleDark; | 42 return NSBackgroundStyleDark; |
| 43 return [super interiorBackgroundStyle]; | 43 return [super interiorBackgroundStyle]; |
| 44 } | 44 } |
| 45 | 45 |
| 46 @end | 46 @end |
| OLD | NEW |