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

Side by Side Diff: chrome/browser/cocoa/bubble_view.h

Issue 196043: Pretty-up the blocked popup view by sharing code from the status bubble. Bloc... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 3 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 <Cocoa/Cocoa.h>
6
7 #include "base/scoped_nsobject.h"
8
9 // A view class that looks like a "bubble" with rounded corners and displays
10 // text inside. Can be themed with a GTMTheme object. To put flush
11 // against the sides of a window, the corner flags can be adjusted.
12
13 @protocol GTMThemeDelegate;
14
15 // Constants that define where the bubble will have a rounded corner. If
16 // not set, the corner will be square.
17 enum {
18 kRoundedTopLeftCorner = 1,
19 kRoundedTopRightCorner = 1 << 1,
20 kRoundedBottomLeftCorner = 1 << 2,
21 kRoundedBottomRightCorner = 1 << 3,
22 kRoundedAllCorners = kRoundedTopLeftCorner & kRoundedTopRightCorner &
23 kRoundedBottomLeftCorner & kRoundedBottomRightCorner
24 };
25
26 // Constants that affect where the text is positioned within the view. They
27 // are exposed in case anyone needs to use the padding to set the content string
28 // length appropriately based on available space (such as eliding a URL).
29 enum {
30 kBubbleViewTextPositionX = 4,
31 kBubbleViewTextPositionY = 2
32 };
33
34 @interface BubbleView : NSView {
35 @private
36 scoped_nsobject<NSString> content_;
37 unsigned long cornerFlags_;
38 // The window from which we get the theme used to draw. In some cases,
39 // it might not be the window we're in. As a result, this may or may not
40 // directly own us, so it needs to be weak to prevent a cycle.
41 NSWindow* themeProvider_;
42 }
43
44 // Designated initializer. |provider| is the window from which we get the
45 // current theme to draw text and backgrounds. If nil, the current window will
46 // be checked. Defaults to all corners being rounded. The caller needs to
47 // ensure |provider| can't go away as it will not be retained.
48 - (id)initWithFrame:(NSRect)frame themeProvider:(NSWindow*)provider;
49
50 // Sets the string displayed in the bubble. A copy of the string is made.
51 - (void)setContent:(NSString*)content;
52
53 // Sets which corners will be rounded.
54 - (void)setCornerFlags:(unsigned long)flags;
55
56 // The font used to display the content string.
57 - (NSFont*)font;
58
59 @end
60
61 // APIs exposed only for testing.
62 @interface BubbleView(TestingOnly)
63 - (NSString*)content;
64 - (unsigned long)cornerFlags;
65 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698