Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import "chrome/browser/cocoa/wrench_menu_button_cell.h" | |
| 6 | |
| 7 #include "base/scoped_nsobject.h" | |
| 8 | |
| 9 @implementation WrenchMenuButtonCell | |
| 10 | |
| 11 - (void)drawBezelWithFrame:(NSRect)frame inView:(NSView*)controlView { | |
| 12 [NSGraphicsContext saveGraphicsState]; | |
| 13 | |
| 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 | |
| 16 // there. | |
| 17 frame = NSInsetRect(frame, 0, 1); | |
|
pink (ping after 24hrs)
2010/08/04 19:16:36
0.0 and 1.0?
| |
| 18 | |
| 19 // Stroking the rect gives a weak stroke. Filling and insetting gives a | |
| 20 // strong, un-anti-aliased border. | |
|
pink (ping after 24hrs)
2010/08/04 19:16:36
Could you get something similar by insetting by a
| |
| 21 [[NSColor colorWithDeviceWhite:0.663 alpha:1.0] set]; | |
| 22 NSRectFill(frame); | |
| 23 frame = NSInsetRect(frame, 1, 1); | |
|
pink (ping after 24hrs)
2010/08/04 19:16:36
1.0, 1.0?
| |
| 24 | |
| 25 NSColor* start = [NSColor whiteColor]; | |
| 26 NSColor* end = [NSColor colorWithDeviceWhite:0.922 alpha:1.0]; | |
| 27 if ([self isHighlighted]) { | |
| 28 start = [NSColor colorWithDeviceRed:0.396 green:0.641 blue:0.941 alpha:1.0]; | |
| 29 end = [NSColor selectedMenuItemColor]; | |
| 30 } | |
| 31 | |
| 32 scoped_nsobject<NSGradient> gradient( | |
| 33 [[NSGradient alloc] initWithStartingColor:start | |
| 34 endingColor:end]); | |
| 35 [gradient drawInRect:frame angle:90.0]; | |
| 36 | |
| 37 [NSGraphicsContext restoreGraphicsState]; | |
| 38 } | |
| 39 | |
| 40 - (NSBackgroundStyle)interiorBackgroundStyle { | |
| 41 if ([self isHighlighted]) | |
| 42 return NSBackgroundStyleDark; | |
| 43 return [super interiorBackgroundStyle]; | |
| 44 } | |
| 45 | |
| 46 @end | |
| OLD | NEW |