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

Unified Diff: chrome/browser/cocoa/bookmark_bubble_view.mm

Issue 171016: Bookmark STAR bubble (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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
« no previous file with comments | « chrome/browser/cocoa/bookmark_bubble_view.h ('k') | chrome/browser/cocoa/bookmark_bubble_view_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/bookmark_bubble_view.mm
===================================================================
--- chrome/browser/cocoa/bookmark_bubble_view.mm (revision 0)
+++ chrome/browser/cocoa/bookmark_bubble_view.mm (revision 0)
@@ -0,0 +1,58 @@
+// Copyright (c) 2009 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.
+
+#import "chrome/browser/cocoa/bookmark_bubble_view.h"
+#import "third_party/GTM/AppKit/GTMTheme.h"
+
+namespace {
+// TODO(jrg): confirm constants with UI dudes
+const CGFloat kBubbleCornerRadius = 8.0;
+const CGFloat kBubbleArrowXOffset = 10.0;
+const CGFloat kBubbleArrowWidth = 15.0;
+const CGFloat kBubbleArrowHeight = 8.0;
+const CGFloat kBubbleBorderLineWidth = 1.0;
+}
+
+@implementation BookmarkBubbleView
+
+- (void)drawRect:(NSRect)rect {
+ // Make room for the border to be seen.
+ NSRect bounds = [self bounds];
+ bounds.size.height -= kBubbleArrowHeight;
+ bounds = NSInsetRect(bounds,
+ kBubbleBorderLineWidth/2.0,
+ kBubbleBorderLineWidth/2.0);
+
+ NSBezierPath* bezier = [NSBezierPath bezierPath];
+ rect.size.height -= kBubbleArrowHeight;
+
+ // Start with a rounded rectangle.
+ [bezier appendBezierPathWithRoundedRect:bounds
+ xRadius:kBubbleCornerRadius
+ yRadius:kBubbleCornerRadius];
+
+ // Add the bubble arrow (pointed at the star).
+ NSPoint arrowStart = NSMakePoint(NSMinX(bounds), NSMaxY(bounds));
+ arrowStart.x += kBubbleArrowXOffset;
+ [bezier moveToPoint:NSMakePoint(arrowStart.x, arrowStart.y)];
+ [bezier lineToPoint:NSMakePoint(arrowStart.x + kBubbleArrowWidth/2.0,
+ arrowStart.y + kBubbleArrowHeight)];
+ [bezier lineToPoint:NSMakePoint(arrowStart.x + kBubbleArrowWidth,
+ arrowStart.y)];
+ [bezier closePath];
+
+ // Draw the outline...
+ [[NSColor blackColor] set];
+ [bezier setLineWidth:kBubbleBorderLineWidth];
+ [bezier stroke];
+
+ // Then fill the inside.
+ GTMTheme *theme = [GTMTheme defaultTheme];
+ NSGradient *gradient = [theme gradientForStyle:GTMThemeStyleToolBar
+ state:NO];
+ [gradient drawInBezierPath:bezier angle:0.0];
+}
+
+@end
+
Property changes on: chrome/browser/cocoa/bookmark_bubble_view.mm
___________________________________________________________________
Name: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/cocoa/bookmark_bubble_view.h ('k') | chrome/browser/cocoa/bookmark_bubble_view_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698