Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1718)

Unified Diff: chrome/browser/cocoa/extensions/chevron_menu_button_cell.mm

Issue 3014049: [Mac] Integrate divider into browser-action overflow chevron. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: whitespace. Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/cocoa/extensions/chevron_menu_button_cell.mm
diff --git a/chrome/browser/cocoa/extensions/chevron_menu_button_cell.mm b/chrome/browser/cocoa/extensions/chevron_menu_button_cell.mm
new file mode 100644
index 0000000000000000000000000000000000000000..6a8b8294e86e77ab5ed4251e7e3bbdbbc22b27df
--- /dev/null
+++ b/chrome/browser/cocoa/extensions/chevron_menu_button_cell.mm
@@ -0,0 +1,47 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/cocoa/extensions/chevron_menu_button_cell.h"
+
+namespace {
+
+// Width of the divider.
+const CGFloat kDividerWidth = 1.0;
+
+// Vertical inset from edge of cell to divider start.
+const CGFloat kDividerInset = 3.0;
+
+// Grayscale for the center of the divider.
+const CGFloat kDividerGrayscale = 0.5;
+
+} // namespace
+
+@implementation ChevronMenuButtonCell
+
+- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
+ [super drawWithFrame:cellFrame inView:controlView];
+
+ if ([self isMouseInside])
+ return;
+
+ NSColor* middleColor =
+ [NSColor colorWithCalibratedWhite:kDividerGrayscale alpha:1.0];
+ NSColor* endPointColor = [middleColor colorWithAlphaComponent:0.0];
+
+ // Blend from background to |kDividerGrayscale| and back to
+ // background.
+ scoped_nsobject<NSGradient> borderGradient([[NSGradient alloc]
+ initWithColorsAndLocations:endPointColor, (CGFloat)0.0,
+ middleColor, (CGFloat)0.5,
+ endPointColor, (CGFloat)1.0,
+ nil]);
+
+ NSRect edgeRect, remainder;
+ NSDivideRect(cellFrame, &edgeRect, &remainder, kDividerWidth, NSMaxXEdge);
+ edgeRect = NSInsetRect(edgeRect, 0.0, kDividerInset);
+
+ [borderGradient drawInRect:edgeRect angle:90.0];
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698