diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-11 18:25:39 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-11 18:25:39 +0000 |
commit | aa42765cac1851ce275ceae6dddf7ef00774ee00 (patch) | |
tree | 8ff5d9c745f816d3210ce3b861ce696f120162ef /chrome | |
parent | 8619afad9fbb211b29c2e4b3471046755db7c541 (diff) | |
download | chromium_src-aa42765cac1851ce275ceae6dddf7ef00774ee00.zip chromium_src-aa42765cac1851ce275ceae6dddf7ef00774ee00.tar.gz chromium_src-aa42765cac1851ce275ceae6dddf7ef00774ee00.tar.bz2 |
Use |+selectedMenuItemColor| for the highlighted state. This respects the system tint.
BUG=none
TEST=On 10.5 and 10.6, the Wrench menu buttons have a blue or gray pressed state, depending on Appearance prefs.
Review URL: http://codereview.chromium.org/3152006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55758 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/cocoa/wrench_menu_button_cell.mm | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/chrome/browser/cocoa/wrench_menu_button_cell.mm b/chrome/browser/cocoa/wrench_menu_button_cell.mm index 0b63143..70e0e6f 100644 --- a/chrome/browser/cocoa/wrench_menu_button_cell.mm +++ b/chrome/browser/cocoa/wrench_menu_button_cell.mm @@ -22,18 +22,20 @@ NSRectFill(frame); frame = NSInsetRect(frame, 1.0, 1.0); - NSColor* start = [NSColor whiteColor]; - NSColor* end = [NSColor colorWithDeviceWhite:0.922 alpha:1.0]; - if ([self isHighlighted]) { - start = [NSColor colorWithDeviceRed:0.396 green:0.641 blue:0.941 alpha:1.0]; - end = [NSColor colorWithDeviceRed:0.157 green:0.384 blue:0.929 alpha:1.0]; + // The default state should be a subtle gray gradient. + if (![self isHighlighted]) { + NSColor* end = [NSColor colorWithDeviceWhite:0.922 alpha:1.0]; + scoped_nsobject<NSGradient> gradient( + [[NSGradient alloc] initWithStartingColor:[NSColor whiteColor] + endingColor:end]); + [gradient drawInRect:frame angle:90.0]; + } else { + // |+selectedMenuItemColor| appears to be a gradient, so just filling the + // rect with that color produces the desired effect. + [[NSColor selectedMenuItemColor] set]; + NSRectFill(frame); } - scoped_nsobject<NSGradient> gradient( - [[NSGradient alloc] initWithStartingColor:start - endingColor:end]); - [gradient drawInRect:frame angle:90.0]; - [NSGraphicsContext restoreGraphicsState]; } |