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 #include "base/memory/scoped_nsobject.h" | 6 #include "base/mac/scoped_nsobject.h" |
7 | 7 |
8 // A HyperlinkButtonCell is used to create an NSButton that looks and acts | 8 // A HyperlinkButtonCell is used to create an NSButton that looks and acts |
9 // like a hyperlink. The default styling is to look like blue, underlined text | 9 // like a hyperlink. The default styling is to look like blue, underlined text |
10 // and to have the pointingHand cursor on mouse over. | 10 // and to have the pointingHand cursor on mouse over. |
11 // | 11 // |
12 // To use in Interface Builder: | 12 // To use in Interface Builder: |
13 // 1. Drag out an NSButton. | 13 // 1. Drag out an NSButton. |
14 // 2. Double click on the button so you have the cell component selected. | 14 // 2. Double click on the button so you have the cell component selected. |
15 // 3. In the Identity panel of the inspector, set the custom class to this. | 15 // 3. In the Identity panel of the inspector, set the custom class to this. |
16 // 4. In the Attributes panel, change the Bezel to Square. | 16 // 4. In the Attributes panel, change the Bezel to Square. |
17 // 5. In the Size panel, set the Height to 16. | 17 // 5. In the Size panel, set the Height to 16. |
18 @interface HyperlinkButtonCell : NSButtonCell { | 18 @interface HyperlinkButtonCell : NSButtonCell { |
19 scoped_nsobject<NSColor> textColor_; | 19 base::scoped_nsobject<NSColor> textColor_; |
20 BOOL shouldUnderline_; | 20 BOOL shouldUnderline_; |
21 BOOL underlineOnHover_; | 21 BOOL underlineOnHover_; |
22 BOOL mouseIsInside_; | 22 BOOL mouseIsInside_; |
23 } | 23 } |
24 @property(nonatomic, retain) NSColor* textColor; | 24 @property(nonatomic, retain) NSColor* textColor; |
25 @property(nonatomic, assign) BOOL underlineOnHover; | 25 @property(nonatomic, assign) BOOL underlineOnHover; |
26 @property(nonatomic, assign) BOOL shouldUnderline; | 26 @property(nonatomic, assign) BOOL shouldUnderline; |
27 | 27 |
28 + (NSColor*)defaultTextColor; | 28 + (NSColor*)defaultTextColor; |
29 | 29 |
30 // Helper function to create a button with HyperLinkButtonCell as its cell. | 30 // Helper function to create a button with HyperLinkButtonCell as its cell. |
31 + (NSButton*)buttonWithString:(NSString*)string; | 31 + (NSButton*)buttonWithString:(NSString*)string; |
32 | 32 |
33 @end | 33 @end |
34 | 34 |
35 @interface HyperlinkButtonCell (ExposedForTesting) | 35 @interface HyperlinkButtonCell (ExposedForTesting) |
36 - (NSDictionary*)linkAttributes; | 36 - (NSDictionary*)linkAttributes; |
37 @end | 37 @end |
OLD | NEW |