OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_ALERT_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_ALERT_H_ |
| 7 |
5 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
6 | 9 |
7 #include "base/memory/scoped_nsobject.h" | 10 #include "base/memory/scoped_nsobject.h" |
8 | 11 |
9 @interface CWAlert : NSObject { | 12 // A custom alert suitable for displaying as a constrained window. Specialized |
| 13 // constrained windows should use this class instead of NSAlert. |
| 14 @interface ConstrainedWindowAlert : NSObject { |
| 15 @private |
10 scoped_nsobject<NSTextField> informativeTextField_; | 16 scoped_nsobject<NSTextField> informativeTextField_; |
11 scoped_nsobject<NSTextField> messageTextField_; | 17 scoped_nsobject<NSTextField> messageTextField_; |
12 scoped_nsobject<NSView> accessoryView_; | 18 scoped_nsobject<NSView> accessoryView_; |
13 scoped_nsobject<NSMutableArray> buttons_; | 19 scoped_nsobject<NSMutableArray> buttons_; |
14 scoped_nsobject<NSButton> closeButton_; | 20 scoped_nsobject<NSButton> closeButton_; |
15 scoped_nsobject<NSWindow> window_; | 21 scoped_nsobject<NSWindow> window_; |
16 } | 22 } |
17 | 23 |
18 @property(nonatomic, retain) NSString* informativeText; | 24 @property(nonatomic, retain) NSString* informativeText; |
19 @property(nonatomic, retain) NSString* messageText; | 25 @property(nonatomic, retain) NSString* messageText; |
20 @property(nonatomic, retain) NSView* accessoryView; | 26 @property(nonatomic, retain) NSView* accessoryView; |
21 @property(nonatomic, readonly) NSArray* buttons; | 27 @property(nonatomic, readonly) NSArray* buttons; |
22 @property(nonatomic, readonly) NSButton* closeButton; | 28 @property(nonatomic, readonly) NSButton* closeButton; |
23 @property(nonatomic, readonly) NSWindow* window; | 29 @property(nonatomic, readonly) NSWindow* window; |
24 | 30 |
| 31 // Default initializer. |
25 - (id)init; | 32 - (id)init; |
26 | 33 |
| 34 // Adds a button with the given |title|. Newly added buttons are positioned in |
| 35 // order from right to left. |
27 - (void)addButtonWithTitle:(NSString*)title | 36 - (void)addButtonWithTitle:(NSString*)title |
28 keyEquivalent:(NSString*)keyEquivalent; | 37 keyEquivalent:(NSString*)keyEquivalent |
| 38 target:(id)target |
| 39 action:(SEL)action; |
29 | 40 |
| 41 // Lays out the controls in the alert. This should be called before the window |
| 42 // is displayed. |
30 - (void)layout; | 43 - (void)layout; |
31 | 44 |
32 @end | 45 @end |
| 46 |
| 47 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_ALERT_H
_ |
OLD | NEW |