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 @class NSColor; | 7 @class NSColor; |
8 | 8 |
9 // HyperlinkTextView is an NSTextView subclass for unselectable, linkable text. | 9 // HyperlinkTextView is an NSTextView subclass for unselectable, linkable text. |
10 // This subclass doesn't show the text caret or IBeamCursor, whereas the base | 10 // This subclass doesn't show the text caret or IBeamCursor, whereas the base |
11 // class NSTextView displays both with full keyboard accessibility enabled. | 11 // class NSTextView displays both with full keyboard accessibility enabled. |
12 @interface HyperlinkTextView : NSTextView { | 12 @interface HyperlinkTextView : NSTextView { |
13 @private | 13 @private |
14 BOOL acceptsFirstResponder_; | 14 BOOL refusesFirstResponder_; |
15 BOOL drawsBackgroundUsingSuperview_; | 15 BOOL drawsBackgroundUsingSuperview_; |
16 } | 16 } |
17 | 17 |
18 @property(nonatomic, assign) BOOL drawsBackgroundUsingSuperview; | 18 @property(nonatomic, assign) BOOL drawsBackgroundUsingSuperview; |
19 | 19 |
20 // Convenience function that sets the |HyperlinkTextView| contents to the | 20 // Convenience function that sets the |HyperlinkTextView| contents to the |
21 // specified |message| with a hypertext style |link| inserted at |linkOffset|. | 21 // specified |message| with a hypertext style |link| inserted at |linkOffset|. |
22 // Uses the supplied |font|, |messageColor|, and |linkColor|. | 22 // Uses the supplied |font|, |messageColor|, and |linkColor|. |
23 - (void)setMessageAndLink:(NSString*)message | 23 - (void)setMessageAndLink:(NSString*)message |
24 withLink:(NSString*)link | 24 withLink:(NSString*)link |
25 atOffset:(NSUInteger)linkOffset | 25 atOffset:(NSUInteger)linkOffset |
26 font:(NSFont*)font | 26 font:(NSFont*)font |
27 messageColor:(NSColor*)messageColor | 27 messageColor:(NSColor*)messageColor |
28 linkColor:(NSColor*)linkColor; | 28 linkColor:(NSColor*)linkColor; |
29 | 29 |
30 // Set the |message| displayed by the HyperlinkTextView, using |font| and | 30 // Set the |message| displayed by the HyperlinkTextView, using |font| and |
31 // |messageColor|. | 31 // |messageColor|. |
32 - (void)setMessage:(NSString*)message | 32 - (void)setMessage:(NSString*)message |
33 withFont:(NSFont*)font | 33 withFont:(NSFont*)font |
34 messageColor:(NSColor*)messageColor; | 34 messageColor:(NSColor*)messageColor; |
35 | 35 |
36 // Marks a |range| within the given message as link, associating it with | 36 // Marks a |range| within the given message as link, associating it with |
37 // a |name| that is passed to the delegate's textView:clickedOnLink:atIndex:. | 37 // a |name| that is passed to the delegate's textView:clickedOnLink:atIndex:. |
38 - (void)addLinkRange:(NSRange)range | 38 - (void)addLinkRange:(NSRange)range |
39 withName:(id)name | 39 withName:(id)name |
40 linkColor:(NSColor*)linkColor; | 40 linkColor:(NSColor*)linkColor; |
41 | 41 |
42 // This is YES (by default) if the view accepts first responder status. | 42 // This is NO (by default) if the view rejects first responder status. |
43 - (void)setAcceptsFirstResponder:(BOOL)acceptsFirstResponder; | 43 - (void)setRefusesFirstResponder:(BOOL)acceptsFirstResponder; |
noms (inactive)
2014/08/15 03:44:35
nit: update the parameter name too
groby-ooo-7-16
2014/08/15 04:39:13
Done, and thanks for catching it!
| |
44 | 44 |
45 @end | 45 @end |
OLD | NEW |