OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 IOS_CHROME_BROWSER_UI_UTIL_LABEL_LINK_CONTROLLER_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_UTIL_LABEL_LINK_CONTROLLER_H_ |
6 #define IOS_CHROME_BROWSER_UI_UTIL_LABEL_LINK_CONTROLLER_H_ | 6 #define IOS_CHROME_BROWSER_UI_UTIL_LABEL_LINK_CONTROLLER_H_ |
7 | 7 |
8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
9 #include "ios/chrome/browser/procedural_block_types.h" | 9 #include "ios/chrome/browser/procedural_block_types.h" |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 @interface LabelLinkController : NSObject | 28 @interface LabelLinkController : NSObject |
29 | 29 |
30 // If |showTapAreas| is true in a debug build, the tappable regions of the label | 30 // If |showTapAreas| is true in a debug build, the tappable regions of the label |
31 // will have colored rectangles around them, with different colors for each URL, | 31 // will have colored rectangles around them, with different colors for each URL, |
32 // and a darker outline around the exact text that the tappable region is for. | 32 // and a darker outline around the exact text that the tappable region is for. |
33 // In non-debug builds, setting this property has no effect. | 33 // In non-debug builds, setting this property has no effect. |
34 @property(nonatomic, assign) BOOL showTapAreas; | 34 @property(nonatomic, assign) BOOL showTapAreas; |
35 | 35 |
36 // Sets the link color for any defined links, updating the controlled label's | 36 // Sets the link color for any defined links, updating the controlled label's |
37 // attributed text accordingly. | 37 // attributed text accordingly. |
38 @property(nonatomic, assign) UIColor* linkColor; | 38 @property(nonatomic, copy) UIColor* linkColor; |
39 | 39 |
40 // Sets the link underline style for any defined links, updating the controlled | 40 // Sets the link underline style for any defined links, updating the controlled |
41 // label's attributed text accordingly. | 41 // label's attributed text accordingly. |
42 @property(nonatomic, assign) NSUnderlineStyle linkUnderlineStyle; | 42 @property(nonatomic, assign) NSUnderlineStyle linkUnderlineStyle; |
43 | 43 |
44 // Sets the link font for any defined links, updating the controlled label's | 44 // Sets the link font for any defined links, updating the controlled label's |
45 // attributed text accordingly. | 45 // attributed text accordingly. |
46 @property(nonatomic, retain) UIFont* linkFont; | 46 @property(nonatomic, strong) UIFont* linkFont; |
47 | 47 |
48 // Creates a new controller for |label|, keeping a strong reference. |action| is | 48 // Creates a new controller for |label|, keeping a strong reference. |action| is |
49 // the block called for any tapped link. | 49 // the block called for any tapped link. |
50 - (instancetype)initWithLabel:(UILabel*)label | 50 - (instancetype)initWithLabel:(UILabel*)label |
51 action:(ProceduralBlockWithURL)action; | 51 action:(ProceduralBlockWithURL)action; |
52 | 52 |
53 // Adds a link to the controlled label at |range| in the label's text, which | 53 // Adds a link to the controlled label at |range| in the label's text, which |
54 // will call the receiver's action block when tapped, passing in |url|. | 54 // will call the receiver's action block when tapped, passing in |url|. |
55 - (void)addLinkWithRange:(NSRange)range url:(GURL)url; | 55 - (void)addLinkWithRange:(NSRange)range url:(GURL)url; |
56 | 56 |
(...skipping 10 matching lines...) Expand all Loading... |
67 // Returns the tap rects generated by the controller that are associated with | 67 // Returns the tap rects generated by the controller that are associated with |
68 // |url|. | 68 // |url|. |
69 - (NSArray*)tapRectsForURL:(GURL)url; | 69 - (NSArray*)tapRectsForURL:(GURL)url; |
70 // Simulates a tap in the controlled label at |point|. No touch events are | 70 // Simulates a tap in the controlled label at |point|. No touch events are |
71 // generated, but |action| should be invoked if |point| is inside a tap rect. | 71 // generated, but |action| should be invoked if |point| is inside a tap rect. |
72 - (void)tapLabelAtPoint:(CGPoint)point; | 72 - (void)tapLabelAtPoint:(CGPoint)point; |
73 | 73 |
74 @end | 74 @end |
75 | 75 |
76 #endif // IOS_CHROME_BROWSER_UI_UTIL_LABEL_LINK_CONTROLLER_H_ | 76 #endif // IOS_CHROME_BROWSER_UI_UTIL_LABEL_LINK_CONTROLLER_H_ |
OLD | NEW |