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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
Property Changes:
Name: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 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/bookmark_bubble_view.h"
6 #import "third_party/GTM/AppKit/GTMTheme.h"
7
8 namespace {
9 // TODO(jrg): confirm constants with UI dudes
10 const CGFloat kBubbleCornerRadius = 8.0;
11 const CGFloat kBubbleArrowXOffset = 10.0;
12 const CGFloat kBubbleArrowWidth = 15.0;
13 const CGFloat kBubbleArrowHeight = 8.0;
14 const CGFloat kBubbleBorderLineWidth = 1.0;
15 }
16
17 @implementation BookmarkBubbleView
18
19 - (void)drawRect:(NSRect)rect {
20 // Make room for the border to be seen.
21 NSRect bounds = [self bounds];
22 bounds.size.height -= kBubbleArrowHeight;
23 bounds = NSInsetRect(bounds,
24 kBubbleBorderLineWidth/2.0,
25 kBubbleBorderLineWidth/2.0);
26
27 NSBezierPath* bezier = [NSBezierPath bezierPath];
28 rect.size.height -= kBubbleArrowHeight;
29
30 // Start with a rounded rectangle.
31 [bezier appendBezierPathWithRoundedRect:bounds
32 xRadius:kBubbleCornerRadius
33 yRadius:kBubbleCornerRadius];
34
35 // Add the bubble arrow (pointed at the star).
36 NSPoint arrowStart = NSMakePoint(NSMinX(bounds), NSMaxY(bounds));
37 arrowStart.x += kBubbleArrowXOffset;
38 [bezier moveToPoint:NSMakePoint(arrowStart.x, arrowStart.y)];
39 [bezier lineToPoint:NSMakePoint(arrowStart.x + kBubbleArrowWidth/2.0,
40 arrowStart.y + kBubbleArrowHeight)];
41 [bezier lineToPoint:NSMakePoint(arrowStart.x + kBubbleArrowWidth,
42 arrowStart.y)];
43 [bezier closePath];
44
45 // Draw the outline...
46 [[NSColor blackColor] set];
47 [bezier setLineWidth:kBubbleBorderLineWidth];
48 [bezier stroke];
49
50 // Then fill the inside.
51 GTMTheme *theme = [GTMTheme defaultTheme];
52 NSGradient *gradient = [theme gradientForStyle:GTMThemeStyleToolBar
53 state:NO];
54 [gradient drawInBezierPath:bezier angle:0.0];
55 }
56
57 @end
58
OLDNEW
« 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