Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: ui/base/cocoa/menu_controller.mm

Issue 312233003: Add fade eliding for Views Labels; related cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refine alignment check; minor additional cleanup. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/tabs/tab.cc ('k') | ui/gfx/canvas.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base/cocoa/menu_controller.h" 5 #import "ui/base/cocoa/menu_controller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "ui/base/accelerators/accelerator.h" 9 #include "ui/base/accelerators/accelerator.h"
10 #include "ui/base/accelerators/platform_accelerator_cocoa.h" 10 #include "ui/base/accelerators/platform_accelerator_cocoa.h"
(...skipping 11 matching lines...) Expand all
22 22
23 @implementation MenuController 23 @implementation MenuController
24 24
25 @synthesize model = model_; 25 @synthesize model = model_;
26 @synthesize useWithPopUpButtonCell = useWithPopUpButtonCell_; 26 @synthesize useWithPopUpButtonCell = useWithPopUpButtonCell_;
27 27
28 + (base::string16)elideMenuTitle:(const base::string16&)title 28 + (base::string16)elideMenuTitle:(const base::string16&)title
29 toWidth:(int)width { 29 toWidth:(int)width {
30 NSFont* nsfont = [NSFont menuBarFontOfSize:0]; // 0 means "default" 30 NSFont* nsfont = [NSFont menuBarFontOfSize:0]; // 0 means "default"
31 return gfx::ElideText(title, gfx::FontList(gfx::Font(nsfont)), width, 31 return gfx::ElideText(title, gfx::FontList(gfx::Font(nsfont)), width,
32 gfx::ELIDE_AT_END); 32 gfx::ELIDE_TAIL);
33 } 33 }
34 34
35 - (id)init { 35 - (id)init {
36 self = [super init]; 36 self = [super init];
37 return self; 37 return self;
38 } 38 }
39 39
40 - (id)initWithModel:(ui::MenuModel*)model 40 - (id)initWithModel:(ui::MenuModel*)model
41 useWithPopUpButtonCell:(BOOL)useWithCell { 41 useWithPopUpButtonCell:(BOOL)useWithCell {
42 if ((self = [super init])) { 42 if ((self = [super init])) {
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 236 }
237 237
238 - (void)menuDidClose:(NSMenu*)menu { 238 - (void)menuDidClose:(NSMenu*)menu {
239 if (isMenuOpen_) { 239 if (isMenuOpen_) {
240 model_->MenuClosed(); 240 model_->MenuClosed();
241 isMenuOpen_ = NO; 241 isMenuOpen_ = NO;
242 } 242 }
243 } 243 }
244 244
245 @end 245 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab.cc ('k') | ui/gfx/canvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698