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 3 // found in the LICENSE file. 4 5 #import <Cocoa/Cocoa.h> 6 7 @class NSColor; 8 9 // HyperlinkTextView is an NSTextView subclass for unselectable, linkable text. 10 // This subclass doesn't show the text caret or IBeamCursor, whereas the base 11 // class NSTextView displays both with full keyboard accessibility enabled. 12 @interface HyperlinkTextView : NSTextView 13 14 // Convenience function that sets the |HyperlinkTextView| contents to the 15 // specified |message| with a hypertext style |link| inserted at |linkOffset|. 16 // Uses the supplied |font|, |messageColor|, and |linkColor|. 17 - (void)setMessageAndLink:(NSString*)message 18 withLink:(NSString*)link 19 atOffset:(NSUInteger)linkOffset 20 font:(NSFont*)font 21 messageColor:(NSColor*)messageColor 22 linkColor:(NSColor*)linkColor; 23 24 // Set the |message| displayed by the HyperlinkTextView, using |font| and 25 // |messageColor|. 26 - (void)setMessage:(NSString*)message 27 withFont:(NSFont*)font 28 messageColor:(NSColor*)messageColor; 29 30 // Marks a |range| within the given message as link, associating it with 31 // a |name| that is passed to the delegate's textView:clickedOnLink:atIndex:. 32 - (void)addLinkRange:(NSRange)range 33 withName:(id)name 34 linkColor:(NSColor*)linkColor; 35 @end 36