OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 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/ui/cocoa/fullscreen_exit_bubble_view.h" | |
6 | |
7 namespace { | |
8 | |
9 const CGFloat kShadowTop = 20; | |
10 const CGFloat kShadowBottom = 50; | |
11 const CGFloat kShadowLeft = 50; | |
12 const CGFloat kShadowRight = 50; | |
13 const CGFloat kShadowBlurRadius = 290; | |
14 const CGFloat kShadowAlpha = 0.3; | |
15 const CGFloat kBubbleCornerRadius = 8.0; | |
16 | |
17 } | |
18 | |
19 @implementation FullscreenExitBubbleView | |
20 | |
21 - (void)drawRect:(NSRect)rect { | |
22 // Make room for the border to be seen. | |
23 NSRect bounds = [self bounds]; | |
24 bounds.size.width -= kShadowLeft + kShadowRight; | |
25 bounds.size.height -= kShadowTop + kShadowBottom; | |
26 bounds.origin.x += kShadowLeft; | |
27 bounds.origin.y += kShadowBottom; | |
28 NSBezierPath* bezier = [NSBezierPath bezierPath]; | |
29 | |
30 CGFloat radius = kBubbleCornerRadius; | |
31 // Start with a rounded rectangle. | |
32 [bezier appendBezierPathWithRoundedRect:bounds | |
33 xRadius:radius | |
34 yRadius:radius]; | |
35 | |
36 [bezier closePath]; | |
37 [[NSColor whiteColor] set]; | |
38 [NSGraphicsContext saveGraphicsState]; | |
Nico
2011/11/01 07:19:39
Consider using ui/gfx/scoped_ns_graphics_context_s
koz (OOO until 15th September)
2011/11/01 23:52:14
Done.
| |
39 NSShadow* theShadow = [[NSShadow alloc] init]; | |
40 [theShadow setShadowBlurRadius:kShadowBlurRadius]; | |
41 [theShadow setShadowColor:[[NSColor blackColor] | |
42 colorWithAlphaComponent:kShadowAlpha]]; | |
43 [theShadow set]; | |
44 | |
45 [bezier fill]; | |
46 | |
47 [NSGraphicsContext restoreGraphicsState]; | |
48 [theShadow release]; | |
Nico
2011/11/01 07:19:39
Make theShadow a scoped_nsobject instead. Also, ca
koz (OOO until 15th September)
2011/11/01 23:52:14
Done.
| |
49 } | |
50 | |
51 @end | |
OLD | NEW |