OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
Bons
2010/12/10 17:00:46
2010
| |
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 "chrome/browser/ui/cocoa/hyperlink_button_cell.h" | 5 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" |
6 | 6 |
7 @interface HyperlinkButtonCell (Private) | 7 @interface HyperlinkButtonCell (Private) |
8 - (NSDictionary*)linkAttributres; | 8 - (NSDictionary*)linkAttributres; |
9 - (void)customizeButtonCell; | 9 - (void)customizeButtonCell; |
10 @end | 10 @end |
11 | 11 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 // common cell customization code. | 44 // common cell customization code. |
45 - (void)customizeButtonCell { | 45 - (void)customizeButtonCell { |
46 [self setBordered:NO]; | 46 [self setBordered:NO]; |
47 [self setTextColor:[HyperlinkButtonCell defaultTextColor]]; | 47 [self setTextColor:[HyperlinkButtonCell defaultTextColor]]; |
48 | 48 |
49 CGFloat fontSize = [NSFont systemFontSizeForControlSize:[self controlSize]]; | 49 CGFloat fontSize = [NSFont systemFontSizeForControlSize:[self controlSize]]; |
50 NSFont* font = [NSFont controlContentFontOfSize:fontSize]; | 50 NSFont* font = [NSFont controlContentFontOfSize:fontSize]; |
51 [self setFont:font]; | 51 [self setFont:font]; |
52 | 52 |
53 // Do not change button appearance when we are pushed. | 53 // Do not change button appearance when we are pushed. |
54 // TODO(rsesek): Change text color to red? | |
55 [self setHighlightsBy:NSNoCellMask]; | 54 [self setHighlightsBy:NSNoCellMask]; |
56 | 55 |
57 // We need to set this so that we can override |-mouseEntered:| and | 56 // We need to set this so that we can override |-mouseEntered:| and |
58 // |-mouseExited:| to change the cursor style on hover states. | 57 // |-mouseExited:| to change the cursor style on hover states. |
59 [self setShowsBorderOnlyWhileMouseInside:YES]; | 58 [self setShowsBorderOnlyWhileMouseInside:YES]; |
60 } | 59 } |
61 | 60 |
62 - (void)setControlSize:(NSControlSize)size { | 61 - (void)setControlSize:(NSControlSize)size { |
63 [super setControlSize:size]; | 62 [super setControlSize:size]; |
64 [self customizeButtonCell]; // recompute |font|. | 63 [self customizeButtonCell]; // recompute |font|. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 // Setters and getters. | 106 // Setters and getters. |
108 - (NSColor*)textColor { | 107 - (NSColor*)textColor { |
109 return textColor_.get(); | 108 return textColor_.get(); |
110 } | 109 } |
111 | 110 |
112 - (void)setTextColor:(NSColor*)color { | 111 - (void)setTextColor:(NSColor*)color { |
113 textColor_.reset([color retain]); | 112 textColor_.reset([color retain]); |
114 } | 113 } |
115 | 114 |
116 @end | 115 @end |
OLD | NEW |