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 #ifndef IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_VIEW_H_ | 4 #ifndef IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_VIEW_H_ |
5 #define IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_VIEW_H_ | 5 #define IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_VIEW_H_ |
6 | 6 |
7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
8 | 8 |
9 #import "ios/chrome/browser/ui/fancy_ui/bidi_container_view.h" | 9 #import "ios/chrome/browser/ui/fancy_ui/bidi_container_view.h" |
10 #import "ios/chrome/browser/ui/infobars/infobar_view_protocol.h" | |
11 | 10 |
12 class InfoBarViewDelegate; | 11 class InfoBarViewDelegate; |
13 @protocol InfoBarViewProtocol; | |
14 | 12 |
15 // UIView representing a single infobar. | 13 // UIView representing a single infobar. |
16 @interface InfoBarView : BidiContainerView<InfoBarViewProtocol> | 14 @interface InfoBarView : BidiContainerView |
| 15 |
17 - (instancetype)initWithFrame:(CGRect)frame | 16 - (instancetype)initWithFrame:(CGRect)frame |
18 delegate:(InfoBarViewDelegate*)delegate; | 17 delegate:(InfoBarViewDelegate*)delegate; |
| 18 |
| 19 // How much of infobar is visible. The infobar is only partly visible during |
| 20 // showing/hiding animation. |
| 21 @property(nonatomic, assign) CGFloat visibleHeight; |
| 22 |
| 23 // Label text with links initialized with |stringAsLink:|. |
| 24 @property(nonatomic, readonly) NSString* markedLabel; |
| 25 |
| 26 // Stops propagating events to delegate. |
| 27 - (void)resetDelegate; |
| 28 |
| 29 // TODO(crbug.com/302582): rename methods from add* to set*. |
| 30 // Adds a dismiss button subview. |
| 31 - (void)addCloseButtonWithTag:(NSInteger)tag |
| 32 target:(id)target |
| 33 action:(SEL)action; |
| 34 |
| 35 // Adds icon subview. |
| 36 - (void)addLeftIcon:(UIImage*)image; |
| 37 |
| 38 // Adds transparent icon of size |imageSize| as placeholder during the time when |
| 39 // the icon is being downloaded. |
| 40 - (void)addPlaceholderTransparentIcon:(CGSize const&)imageSize; |
| 41 |
| 42 // Adds an icon subview with rounded corners and a shadow. |
| 43 - (void)addLeftIconWithRoundedCornersAndShadow:(UIImage*)image; |
| 44 |
| 45 // Creates a new string from |string| that is interpreted as a link by |
| 46 // |addLabel:|. |tag| must not be 0. |
| 47 + (NSString*)stringAsLink:(NSString*)string tag:(NSUInteger)tag; |
| 48 |
| 49 // Adds a message to the infobar that optionaly contains links initialized with |
| 50 // |stringAsLink:|. |
| 51 - (void)addLabel:(NSString*)label; |
| 52 |
| 53 // Adds a message to the infobar that optionaly contains links initialized with |
| 54 // |stringAsLink:|. |action| is called on |target| when a link is clicked. |
| 55 - (void)addLabel:(NSString*)label target:(id)target action:(SEL)action; |
| 56 |
| 57 // Adds two buttons to the infobar. Button1 is the primary action of the infobar |
| 58 // and in Material Design mode is shown with bold colors to reflect this role. |
| 59 - (void)addButton1:(NSString*)title1 |
| 60 tag1:(NSInteger)tag1 |
| 61 button2:(NSString*)title2 |
| 62 tag2:(NSInteger)tag2 |
| 63 target:(id)target |
| 64 action:(SEL)action; |
| 65 |
| 66 // Adds a button to the infobar. |
| 67 - (void)addButton:(NSString*)title |
| 68 tag:(NSInteger)tag |
| 69 target:(id)target |
| 70 action:(SEL)action; |
| 71 |
| 72 // Adds to the infobar a switch and an adjacent label. |
| 73 - (void)addSwitchWithLabel:(NSString*)label |
| 74 isOn:(BOOL)isOn |
| 75 tag:(NSInteger)tag |
| 76 target:(id)target |
| 77 action:(SEL)action; |
| 78 |
19 @end | 79 @end |
20 | 80 |
21 #endif // IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_VIEW_H_ | 81 #endif // IOS_CHROME_BROWSER_UI_INFOBARS_INFOBAR_VIEW_H_ |
OLD | NEW |