- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / constrained_window / constrained_window_alert.h
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
3 // found in the LICENSE file.
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
8 #import <Cocoa/Cocoa.h>
9
10 #include "base/mac/scoped_nsobject.h"
11
12 // This class implements an alert that has a constrained window look and feel
13 // (close button on top right, WebUI style buttons, etc...).  The alert can be
14 // shown by using the window accessor and calling -[window orderFont:]. Normally
15 // this would be done by ConstrainedWindowSheetController.
16 @interface ConstrainedWindowAlert : NSObject {
17  @private
18   base::scoped_nsobject<NSTextField> informativeTextField_;
19   base::scoped_nsobject<NSTextField> messageTextField_;
20   base::scoped_nsobject<NSButton> linkView_;
21   base::scoped_nsobject<NSView> accessoryView_;
22   base::scoped_nsobject<NSMutableArray> buttons_;
23   base::scoped_nsobject<NSButton> closeButton_;
24   base::scoped_nsobject<NSWindow> window_;
25 }
26
27 @property(nonatomic, copy) NSString* informativeText;
28 @property(nonatomic, copy) NSString* messageText;
29 @property(nonatomic, retain) NSView* accessoryView;
30 @property(nonatomic, readonly) NSArray* buttons;
31 @property(nonatomic, readonly) NSButton* closeButton;
32 @property(nonatomic, readonly) NSWindow* window;
33
34 // Default initializer.
35 - (id)init;
36
37 // Adds a button with the given |title|. Newly added buttons are positioned in
38 // order from right to left.
39 - (void)addButtonWithTitle:(NSString*)title
40              keyEquivalent:(NSString*)keyEquivalent
41                     target:(id)target
42                     action:(SEL)action;
43
44 // Sets the |text|, the |target| and the |action| of a left-aligned link
45 // positioned above the buttons. If |text| is empty, no link is displayed.
46 - (void)setLinkText:(NSString*)text
47              target:(id)target
48              action:(SEL)action;
49
50 // Lays out the controls in the alert. This should be called before the window
51 // is displayed.
52 - (void)layout;
53
54 @end
55
56 @interface ConstrainedWindowAlert (ExposedForTesting)
57 @property(nonatomic, readonly) NSButton* linkView;
58 @end
59
60 #endif  // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_ALERT_H_