OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ui/base/ui_base_export.h" | 7 #include "ui/base/ui_base_export.h" |
8 | 8 |
9 @class NSColor; | 9 @class NSColor; |
10 | 10 |
11 // HyperlinkTextView is an NSTextView subclass for unselectable, linkable text. | 11 // HyperlinkTextView is an NSTextView subclass for unselectable, linkable text. |
12 // This subclass doesn't show the text caret or IBeamCursor, whereas the base | 12 // This subclass doesn't show the text caret or IBeamCursor, whereas the base |
13 // class NSTextView displays both with full keyboard accessibility enabled. | 13 // class NSTextView displays both with full keyboard accessibility enabled. |
14 UI_BASE_EXPORT | 14 UI_BASE_EXPORT |
15 @interface HyperlinkTextView : NSTextView { | 15 @interface HyperlinkTextView : NSTextView { |
16 @private | 16 @private |
17 BOOL refusesFirstResponder_; | 17 BOOL refusesFirstResponder_; |
18 BOOL drawsBackgroundUsingSuperview_; | 18 BOOL drawsBackgroundUsingSuperview_; |
19 } | 19 } |
20 | 20 |
21 @property(nonatomic, assign) BOOL drawsBackgroundUsingSuperview; | 21 @property(nonatomic, assign) BOOL drawsBackgroundUsingSuperview; |
22 | 22 |
23 // Convenience function that sets the |HyperlinkTextView| contents to the | |
24 // specified |message| with a hypertext style |link| inserted at |linkOffset|. | |
25 // Uses the supplied |font|, |messageColor|, and |linkColor|. | |
26 - (void)setMessageAndLink:(NSString*)message | |
27 withLink:(NSString*)link | |
28 atOffset:(NSUInteger)linkOffset | |
29 font:(NSFont*)font | |
30 messageColor:(NSColor*)messageColor | |
31 linkColor:(NSColor*)linkColor; | |
32 | |
33 // Set the |message| displayed by the HyperlinkTextView, using |font| and | 23 // Set the |message| displayed by the HyperlinkTextView, using |font| and |
34 // |messageColor|. | 24 // |messageColor|. |
35 - (void)setMessage:(NSString*)message | 25 - (void)setMessage:(NSString*)message |
36 withFont:(NSFont*)font | 26 withFont:(NSFont*)font |
37 messageColor:(NSColor*)messageColor; | 27 messageColor:(NSColor*)messageColor; |
38 | 28 |
39 // Marks a |range| within the given message as link, associating it with | 29 // Marks a |range| within the given message as link, associating it with |
40 // a |name| that is passed to the delegate's textView:clickedOnLink:atIndex:. | 30 // a |name| that is passed to the delegate's textView:clickedOnLink:atIndex:. |
41 - (void)addLinkRange:(NSRange)range | 31 - (void)addLinkRange:(NSRange)range |
42 withName:(id)name | 32 withName:(id)name |
43 linkColor:(NSColor*)linkColor; | 33 linkColor:(NSColor*)linkColor; |
44 | 34 |
45 // This is NO (by default) if the view rejects first responder status. | 35 // This is NO (by default) if the view rejects first responder status. |
46 - (void)setRefusesFirstResponder:(BOOL)refusesFirstResponder; | 36 - (void)setRefusesFirstResponder:(BOOL)refusesFirstResponder; |
47 | 37 |
48 @end | 38 @end |
OLD | NEW |