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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/cocoa/bookmark_button_cell.mm
===================================================================
--- chrome/browser/cocoa/bookmark_button_cell.mm (revision 20588)
+++ chrome/browser/cocoa/bookmark_button_cell.mm (working copy)
@@ -3,12 +3,26 @@
// found in the LICENSE file.
#import "chrome/browser/cocoa/bookmark_button_cell.h"
+#import "third_party/GTM/AppKit/GTMTheme.h"
@implementation BookmarkButtonCell
- (id)initTextCell:(NSString *)string {
if ((self = [super initTextCell:string])) {
- [self setBordered:NO];
+ [self setButtonType:NSMomentaryPushInButton];
+ [self setBezelStyle:NSShadowlessSquareBezelStyle];
+ [self setShowsBorderOnlyWhileMouseInside:YES];
+ [self setControlSize:NSSmallControlSize];
+ [self setAlignment:NSLeftTextAlignment];
+ [self setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ [self setWraps:NO];
+ // NSLineBreakByTruncatingMiddle seems more common on OSX but let's
+ // try to match Windows for a bit to see what happens.
+ [self setLineBreakMode:NSLineBreakByTruncatingTail];
+
+ // Theming doesn't work for bookmark buttons yet (text chucked).
+ [super setShouldTheme:NO];
+
}
return self;
}
@@ -20,4 +34,15 @@
return size;
}
+// We share the context menu among all bookmark buttons. To allow us
+// to disambiguate when needed (e.g. "open bookmark"), we set the
+// menu's delegate to be us. We (the cell) have the bookmark encoded
+// in our represented object.
+// Convention needed in -[BookmarkBarController openBookmarkIn***] calls.
+- (NSMenu*)menu {
+ NSMenu* menu = [super menu];
+ [menu setDelegate:self];
+ return menu;
+}
+
@end
« 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