blob: 3797f9c157ea3da15ab8a11dc7818e1ce130b44e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// 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/notifications/balloon_view.h"
#import <Cocoa/Cocoa.h>
#include "base/logging.h"
#include "base/scoped_nsobject.h"
#import "third_party/GTM/AppKit/GTMNSBezierPath+RoundRect.h"
namespace {
const int kRoundedCornerSize = 6.5;
} // namespace
@implementation BalloonWindow
- (id)initWithContentRect:(NSRect)contentRect
styleMask:(unsigned int)aStyle
backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag {
self = [super initWithContentRect:contentRect
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO];
if (self) {
[self setLevel:NSStatusWindowLevel];
[self setOpaque:NO];
[self setBackgroundColor:[NSColor clearColor]];
}
return self;
}
@end
@implementation BalloonShelfViewCocoa
- (void)drawRect:(NSRect)rect {
NSBezierPath* path =
[NSBezierPath gtm_bezierPathWithRoundRect:[self bounds]
topLeftCornerRadius:kRoundedCornerSize
topRightCornerRadius:kRoundedCornerSize
bottomLeftCornerRadius:0.0
bottomRightCornerRadius:0.0];
[[NSColor colorWithCalibratedWhite:0.957 alpha:1.0] set];
[path fill];
[[NSColor blackColor] set];
[path stroke];
}
@end
@implementation BalloonContentViewCocoa
- (void)drawRect:(NSRect)rect {
NSBezierPath* path =
[NSBezierPath gtm_bezierPathWithRoundRect:[self bounds]
topLeftCornerRadius:0.0
topRightCornerRadius:0.0
bottomLeftCornerRadius:kRoundedCornerSize
bottomRightCornerRadius:kRoundedCornerSize];
[[NSColor blackColor] set];
[path stroke];
}
@end
|