OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #import "base/cocoa_protocols_mac.h" | 7 #import "base/cocoa_protocols_mac.h" |
8 #include "base/scoped_nsobject.h" | 8 #include "base/scoped_nsobject.h" |
9 | 9 |
10 @class AnimatableView; | 10 @class AnimatableView; |
11 @class HoverCloseButton; | 11 @class HoverCloseButton; |
(...skipping 26 matching lines...) Expand all Loading... |
38 // Text fields don't work as well with embedded links as text views, but | 38 // Text fields don't work as well with embedded links as text views, but |
39 // text views cannot conveniently be created in IB. The xib file contains | 39 // text views cannot conveniently be created in IB. The xib file contains |
40 // a text field |labelPlaceholder_| that's replaced by this text view |label_| | 40 // a text field |labelPlaceholder_| that's replaced by this text view |label_| |
41 // in -awakeFromNib. | 41 // in -awakeFromNib. |
42 scoped_nsobject<NSTextView> label_; | 42 scoped_nsobject<NSTextView> label_; |
43 }; | 43 }; |
44 | 44 |
45 // Initializes a new InfoBarController. | 45 // Initializes a new InfoBarController. |
46 - (id)initWithDelegate:(InfoBarDelegate*)delegate; | 46 - (id)initWithDelegate:(InfoBarDelegate*)delegate; |
47 | 47 |
48 // Called when someone clicks on the ok or cancel buttons. Subclasses | 48 // Called when someone clicks on the OK or Cancel buttons. Subclasses |
49 // must override if they do not hide the buttons. | 49 // must override if they do not hide the buttons. |
50 - (void)ok:(id)sender; | 50 - (void)ok:(id)sender; |
51 - (void)cancel:(id)sender; | 51 - (void)cancel:(id)sender; |
52 | 52 |
53 // Called when someone clicks on the close button. Dismisses the | 53 // Called when someone clicks on the close button. Dismisses the |
54 // infobar without taking any action. | 54 // infobar without taking any action. |
55 - (IBAction)dismiss:(id)sender; | 55 - (IBAction)dismiss:(id)sender; |
56 | 56 |
57 // Returns a pointer to this controller's view, cast as an AnimatableView. | 57 // Returns a pointer to this controller's view, cast as an AnimatableView. |
58 - (AnimatableView*)animatableView; | 58 - (AnimatableView*)animatableView; |
59 | 59 |
60 // Open or animate open the infobar. | 60 // Open or animate open the infobar. |
61 - (void)open; | 61 - (void)open; |
62 - (void)animateOpen; | 62 - (void)animateOpen; |
63 | 63 |
64 // Close or animate close the infobar. | 64 // Close or animate close the infobar. |
65 - (void)close; | 65 - (void)close; |
66 - (void)animateClosed; | 66 - (void)animateClosed; |
67 | 67 |
68 // Subclasses can override this method to add additional controls to | 68 // Subclasses can override this method to add additional controls to |
69 // the infobar view. This method is called by awakeFromNib. The | 69 // the infobar view. This method is called by awakeFromNib. The |
70 // default implementation does nothing. | 70 // default implementation does nothing. |
71 - (void)addAdditionalControls; | 71 - (void)addAdditionalControls; |
72 | 72 |
73 // Sets the info bar message to the specified |message|. | 73 // Sets the info bar message to the specified |message|. |
74 - (void)setLabelToMessage:(NSString*)message; | 74 - (void)setLabelToMessage:(NSString*)message; |
75 | 75 |
| 76 // Removes the OK and Cancel buttons and resizes the textfield to use the |
| 77 // space. |
| 78 - (void)removeButtons; |
| 79 |
76 @property(nonatomic, assign) id<InfoBarContainer> containerController; | 80 @property(nonatomic, assign) id<InfoBarContainer> containerController; |
77 @property(nonatomic, readonly) InfoBarDelegate* delegate; | 81 @property(nonatomic, readonly) InfoBarDelegate* delegate; |
78 | 82 |
79 @end | 83 @end |
80 | 84 |
81 ///////////////////////////////////////////////////////////////////////// | 85 ///////////////////////////////////////////////////////////////////////// |
82 // InfoBarController subclasses, one for each InfoBarDelegate | 86 // InfoBarController subclasses, one for each InfoBarDelegate |
83 // subclass. Each of these subclasses overrides addAdditionalControls to | 87 // subclass. Each of these subclasses overrides addAdditionalControls to |
84 // configure its view as necessary. | 88 // configure its view as necessary. |
85 | 89 |
86 @interface AlertInfoBarController : InfoBarController | 90 @interface AlertInfoBarController : InfoBarController |
87 @end | 91 @end |
88 | 92 |
89 | 93 |
90 @interface LinkInfoBarController : InfoBarController | 94 @interface LinkInfoBarController : InfoBarController |
91 // Called when there is a click on the link in the infobar. | 95 // Called when there is a click on the link in the infobar. |
92 - (void)linkClicked; | 96 - (void)linkClicked; |
93 @end | 97 @end |
94 | 98 |
95 | 99 |
96 @interface ConfirmInfoBarController : InfoBarController | 100 @interface ConfirmInfoBarController : InfoBarController |
97 // Called when the ok and cancel buttons are clicked. | 101 // Called when the OK and Cancel buttons are clicked. |
98 - (IBAction)ok:(id)sender; | 102 - (IBAction)ok:(id)sender; |
99 - (IBAction)cancel:(id)sender; | 103 - (IBAction)cancel:(id)sender; |
100 // Called when there is a click on the link in the infobar. | 104 // Called when there is a click on the link in the infobar. |
101 - (void)linkClicked; | 105 - (void)linkClicked; |
102 @end | 106 @end |
OLD | NEW |