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 #import "ui/app_list/cocoa/apps_grid_view_item.h" | 5 #import "ui/app_list/cocoa/apps_grid_view_item.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #include "base/memory/scoped_nsobject.h" | 8 #include "base/memory/scoped_nsobject.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "skia/ext/skia_utils_mac.h" | 10 #include "skia/ext/skia_utils_mac.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // This NSButton style always positions the icon at the very top of the | 156 // This NSButton style always positions the icon at the very top of the |
157 // button frame. AppsGridViewItem uses an enclosing view so that it is | 157 // button frame. AppsGridViewItem uses an enclosing view so that it is |
158 // visually correct. | 158 // visually correct. |
159 [prototypeButton setImagePosition:NSImageAbove]; | 159 [prototypeButton setImagePosition:NSImageAbove]; |
160 [prototypeButton setButtonType:NSMomentaryChangeButton]; | 160 [prototypeButton setButtonType:NSMomentaryChangeButton]; |
161 [prototypeButton setBordered:NO]; | 161 [prototypeButton setBordered:NO]; |
162 | 162 |
163 [[prototypeButton cell] | 163 [[prototypeButton cell] |
164 setFont:ui::ResourceBundle::GetSharedInstance().GetFont( | 164 setFont:ui::ResourceBundle::GetSharedInstance().GetFont( |
165 app_list::kItemTextFontStyle).GetNativeFont()]; | 165 app_list::kItemTextFontStyle).GetNativeFont()]; |
| 166 [[prototypeButton cell] setLineBreakMode:NSLineBreakByTruncatingTail]; |
166 | 167 |
167 scoped_nsobject<AppsGridItemBackgroundView> prototypeButtonBackground( | 168 scoped_nsobject<AppsGridItemBackgroundView> prototypeButtonBackground( |
168 [[AppsGridItemBackgroundView alloc] initWithFrame:NSMakeRect( | 169 [[AppsGridItemBackgroundView alloc] initWithFrame:NSMakeRect( |
169 0, 0, tileSize.width, tileSize.height)]); | 170 0, 0, tileSize.width, tileSize.height)]); |
170 [prototypeButtonBackground addSubview:prototypeButton]; | 171 [prototypeButtonBackground addSubview:prototypeButton]; |
171 [self setView:prototypeButtonBackground]; | 172 [self setView:prototypeButtonBackground]; |
172 } | 173 } |
173 return self; | 174 return self; |
174 } | 175 } |
175 | 176 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 - (void)mouseExited:(NSEvent*)theEvent { | 219 - (void)mouseExited:(NSEvent*)theEvent { |
219 [self setSelected:NO]; | 220 [self setSelected:NO]; |
220 } | 221 } |
221 | 222 |
222 - (void)setSelected:(BOOL)flag { | 223 - (void)setSelected:(BOOL)flag { |
223 [[self itemBackgroundView] setSelected:flag]; | 224 [[self itemBackgroundView] setSelected:flag]; |
224 [super setSelected:flag]; | 225 [super setSelected:flag]; |
225 } | 226 } |
226 | 227 |
227 @end | 228 @end |
OLD | NEW |