OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 UI_BASE_COCOA_CONTROLS_HYPERLINK_BUTTON_CELL_H_ | 5 #ifndef UI_BASE_COCOA_CONTROLS_HYPERLINK_BUTTON_CELL_H_ |
6 #define UI_BASE_COCOA_CONTROLS_HYPERLINK_BUTTON_CELL_H_ | 6 #define UI_BASE_COCOA_CONTROLS_HYPERLINK_BUTTON_CELL_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
11 #include "ui/base/ui_export.h" | 11 #include "ui/base/ui_base_export.h" |
12 | 12 |
13 // A HyperlinkButtonCell is used to create an NSButton that looks and acts | 13 // A HyperlinkButtonCell is used to create an NSButton that looks and acts |
14 // like a hyperlink. The default styling is to look like blue, underlined text | 14 // like a hyperlink. The default styling is to look like blue, underlined text |
15 // and to have the pointingHand cursor on mouse over. | 15 // and to have the pointingHand cursor on mouse over. |
16 // | 16 // |
17 // To use in Interface Builder: | 17 // To use in Interface Builder: |
18 // 1. Drag out an NSButton. | 18 // 1. Drag out an NSButton. |
19 // 2. Double click on the button so you have the cell component selected. | 19 // 2. Double click on the button so you have the cell component selected. |
20 // 3. In the Identity panel of the inspector, set the custom class to this. | 20 // 3. In the Identity panel of the inspector, set the custom class to this. |
21 // 4. In the Attributes panel, change the Bezel to Square. | 21 // 4. In the Attributes panel, change the Bezel to Square. |
22 // 5. In the Size panel, set the Height to 16. | 22 // 5. In the Size panel, set the Height to 16. |
23 // | 23 // |
24 // Use this if all of your text is a link. If you need text that contains | 24 // Use this if all of your text is a link. If you need text that contains |
25 // embedded links but also regular text, use HyperlinkTextView. | 25 // embedded links but also regular text, use HyperlinkTextView. |
26 UI_EXPORT | 26 UI_BASE_EXPORT |
27 @interface HyperlinkButtonCell : NSButtonCell { | 27 @interface HyperlinkButtonCell : NSButtonCell { |
28 base::scoped_nsobject<NSColor> textColor_; | 28 base::scoped_nsobject<NSColor> textColor_; |
29 BOOL shouldUnderline_; | 29 BOOL shouldUnderline_; |
30 BOOL underlineOnHover_; | 30 BOOL underlineOnHover_; |
31 BOOL mouseIsInside_; | 31 BOOL mouseIsInside_; |
32 } | 32 } |
33 @property(nonatomic, retain) NSColor* textColor; | 33 @property(nonatomic, retain) NSColor* textColor; |
34 @property(nonatomic, assign) BOOL underlineOnHover; | 34 @property(nonatomic, assign) BOOL underlineOnHover; |
35 @property(nonatomic, assign) BOOL shouldUnderline; | 35 @property(nonatomic, assign) BOOL shouldUnderline; |
36 | 36 |
37 + (NSColor*)defaultTextColor; | 37 + (NSColor*)defaultTextColor; |
38 | 38 |
39 // Helper function to create a button with HyperLinkButtonCell as its cell. | 39 // Helper function to create a button with HyperLinkButtonCell as its cell. |
40 + (NSButton*)buttonWithString:(NSString*)string; | 40 + (NSButton*)buttonWithString:(NSString*)string; |
41 | 41 |
42 @end | 42 @end |
43 | 43 |
44 @interface HyperlinkButtonCell (ExposedForTesting) | 44 @interface HyperlinkButtonCell (ExposedForTesting) |
45 - (NSDictionary*)linkAttributes; | 45 - (NSDictionary*)linkAttributes; |
46 @end | 46 @end |
47 | 47 |
48 #endif // UI_BASE_COCOA_CONTROLS_HYPERLINK_BUTTON_CELL_H_ | 48 #endif // UI_BASE_COCOA_CONTROLS_HYPERLINK_BUTTON_CELL_H_ |
OLD | NEW |