OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "base/logging.h" | 5 #include "base/logging.h" |
6 #import "chrome/browser/cocoa/bookmark_button_cell.h" | 6 #import "chrome/browser/cocoa/bookmark_button_cell.h" |
7 #import "chrome/browser/cocoa/bookmark_menu.h" | 7 #import "chrome/browser/cocoa/bookmark_menu.h" |
8 | 8 |
9 @implementation BookmarkButtonCell | 9 @implementation BookmarkButtonCell |
10 | 10 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // TODO(jrg): consider placing in GTM. | 91 // TODO(jrg): consider placing in GTM. |
92 - (void)setTextColor:(NSColor*)color { | 92 - (void)setTextColor:(NSColor*)color { |
93 | 93 |
94 // We can't properly set the cell's text color without a control. | 94 // We can't properly set the cell's text color without a control. |
95 // In theory we could just save the next for later and wait until | 95 // In theory we could just save the next for later and wait until |
96 // the cell is moved to a control, but there is no obvious way to | 96 // the cell is moved to a control, but there is no obvious way to |
97 // accomplish that (e.g. no "cellDidMoveToControl" notification.) | 97 // accomplish that (e.g. no "cellDidMoveToControl" notification.) |
98 DCHECK([self controlView]); | 98 DCHECK([self controlView]); |
99 | 99 |
100 scoped_nsobject<NSMutableParagraphStyle> style([NSMutableParagraphStyle new]); | 100 scoped_nsobject<NSMutableParagraphStyle> style([NSMutableParagraphStyle new]); |
101 [style setAlignment:NSCenterTextAlignment]; | 101 [style setAlignment:NSLeftTextAlignment]; |
102 NSDictionary* dict = [NSDictionary | 102 NSDictionary* dict = [NSDictionary |
103 dictionaryWithObjectsAndKeys:color, | 103 dictionaryWithObjectsAndKeys:color, |
104 NSForegroundColorAttributeName, | 104 NSForegroundColorAttributeName, |
105 [self font], NSFontAttributeName, | 105 [self font], NSFontAttributeName, |
106 style.get(), NSParagraphStyleAttributeName, | 106 style.get(), NSParagraphStyleAttributeName, |
107 nil]; | 107 nil]; |
108 scoped_nsobject<NSAttributedString> ats([[NSAttributedString alloc] | 108 scoped_nsobject<NSAttributedString> ats([[NSAttributedString alloc] |
109 initWithString:[self title] | 109 initWithString:[self title] |
110 attributes:dict]); | 110 attributes:dict]); |
111 NSButton* button = static_cast<NSButton*>([self controlView]); | 111 NSButton* button = static_cast<NSButton*>([self controlView]); |
(...skipping 11 matching lines...) Expand all Loading... |
123 [[self controlView] mouseEntered:event]; | 123 [[self controlView] mouseEntered:event]; |
124 } | 124 } |
125 | 125 |
126 // See comment above mouseEntered:, above. | 126 // See comment above mouseEntered:, above. |
127 - (void)mouseExited:(NSEvent*)event { | 127 - (void)mouseExited:(NSEvent*)event { |
128 [super mouseExited:event]; | 128 [super mouseExited:event]; |
129 [[self controlView] mouseExited:event]; | 129 [[self controlView] mouseExited:event]; |
130 } | 130 } |
131 | 131 |
132 @end | 132 @end |
OLD | NEW |