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

Side by Side Diff: chrome/browser/cocoa/bookmark_button_cell.mm

Issue 348018: Foo. (Closed)
Patch Set: Created 11 years, 1 month 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
OLDNEW
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 #import "chrome/browser/cocoa/bookmark_button_cell.h" 5 #import "chrome/browser/cocoa/bookmark_button_cell.h"
6 #import "third_party/GTM/AppKit/GTMTheme.h" 6 #import "third_party/GTM/AppKit/GTMTheme.h"
7 7
8 @implementation BookmarkButtonCell 8 @implementation BookmarkButtonCell
9 9
10 - (id)initTextCell:(NSString *)string { 10 - (id)initTextCell:(NSString *)string {
11 if ((self = [super initTextCell:string])) { 11 if ((self = [super initTextCell:string])) {
12 [self setButtonType:NSMomentaryPushInButton]; 12 [self setButtonType:NSMomentaryPushInButton];
13 [self setBezelStyle:NSShadowlessSquareBezelStyle]; 13 [self setBezelStyle:NSShadowlessSquareBezelStyle];
14 [self setShowsBorderOnlyWhileMouseInside:YES]; 14 [self setShowsBorderOnlyWhileMouseInside:YES];
15 [self setControlSize:NSSmallControlSize]; 15 [self setControlSize:NSSmallControlSize];
16 [self setAlignment:NSLeftTextAlignment]; 16 [self setAlignment:NSLeftTextAlignment];
17 [self setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; 17 [self setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
18 [self setWraps:NO]; 18 [self setWraps:NO];
19 // NSLineBreakByTruncatingMiddle seems more common on OSX but let's 19 // NSLineBreakByTruncatingMiddle seems more common on OSX but let's
20 // try to match Windows for a bit to see what happens. 20 // try to match Windows for a bit to see what happens.
21 [self setLineBreakMode:NSLineBreakByTruncatingTail]; 21 [self setLineBreakMode:NSLineBreakByTruncatingTail];
22 22
23 // Theming doesn't work for bookmark buttons yet (text chucked). 23 // Theming doesn't work for bookmark buttons yet (text chucked).
24 [super setShouldTheme:NO]; 24 //[super setShouldTheme:NO];
25 25
26 } 26 }
27 return self; 27 return self;
28 } 28 }
29 29
30 - (NSSize)cellSizeForBounds:(NSRect)aRect { 30 - (NSSize)cellSizeForBounds:(NSRect)aRect {
31 NSSize size = [super cellSizeForBounds:aRect]; 31 NSSize size = [super cellSizeForBounds:aRect];
32 size.width += 2; 32 size.width += 2;
33 size.height += 4; 33 size.height += 4;
34 return size; 34 return size;
35 } 35 }
36 36
37 // We share the context menu among all bookmark buttons. To allow us 37 // We share the context menu among all bookmark buttons. To allow us
38 // to disambiguate when needed (e.g. "open bookmark"), we set the 38 // to disambiguate when needed (e.g. "open bookmark"), we set the
39 // menu's delegate to be us. We (the cell) have the bookmark encoded 39 // menu's delegate to be us. We (the cell) have the bookmark encoded
40 // in our represented object. 40 // in our represented object.
41 // Convention needed in -[BookmarkBarController openBookmarkIn***] calls. 41 // Convention needed in -[BookmarkBarController openBookmarkIn***] calls.
42 - (NSMenu*)menu { 42 - (NSMenu*)menu {
43 NSMenu* menu = [super menu]; 43 NSMenu* menu = [super menu];
44 [menu setDelegate:self]; 44 [menu setDelegate:self];
45 return menu; 45 return menu;
46 } 46 }
47 47
48 @end 48 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/bookmark_bar_controller.mm ('k') | chrome/browser/cocoa/gradient_button_cell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698