OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 IOS_CHROME_BROWSER_UI_UTIL_TRANSPARENT_LINK_BUTTON_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_UTIL_TRANSPARENT_LINK_BUTTON_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 class GURL; |
| 11 |
| 12 // Minumum height and width for a link's tappable area. On touch-down events, |
| 13 // the portion of the button directly on top of the link text will be |
| 14 // highlighted with a gray overlay. |
| 15 extern const CGFloat kLinkTapAreaMinimum; |
| 16 |
| 17 // Transparent button that is overlaid on link portions of text. |
| 18 @interface TransparentLinkButton : UIButton |
| 19 |
| 20 // TransparentLinkButtons must be created via |+buttonsForLinkFrames:URL:|. |
| 21 - (instancetype)init NS_UNAVAILABLE; |
| 22 - (instancetype)initWithCoder:(NSCoder*)coder NS_UNAVAILABLE; |
| 23 - (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; |
| 24 |
| 25 // Creates TransparentLinkButtons with |URL| for each NSValue-wrapped CGRect in |
| 26 // |linkFrames| and returns them in an NSArray. The links returned by this |
| 27 // function will be styled such that their touch-down styling will be shared. |
| 28 // Only the first button in the array will be accessible, and |label| will be |
| 29 // set as its accessibility label. This is done to ensure that VoiceOver mode |
| 30 // does not have multiple accessibility elements with the same accessibility |
| 31 // label and the same action. |
| 32 + (NSArray*)buttonsForLinkFrames:(NSArray*)linkFrames |
| 33 URL:(const GURL&)URL |
| 34 accessibilityLabel:(NSString*)label; |
| 35 |
| 36 // The URL passed upon initialization. |
| 37 @property(nonatomic, readonly) GURL URL; |
| 38 |
| 39 // If set to YES, updates the button's background to a semi-opaque color to |
| 40 // verify the button's location over the text. The default is NO. |
| 41 @property(nonatomic, assign, getter=isDebug) BOOL debug; |
| 42 |
| 43 @end |
| 44 |
| 45 #endif // IOS_CHROME_BROWSER_UI_UTIL_TRANSPARENT_LINK_BUTTON_H_ |
OLD | NEW |