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

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

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

Powered by Google App Engine
This is Rietveld 408576698