| OLD | NEW |
| 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 "chrome/browser/cocoa/bookmark_menu.h" |
| 6 #import "third_party/GTM/AppKit/GTMTheme.h" | 7 #import "third_party/GTM/AppKit/GTMTheme.h" |
| 7 | 8 |
| 8 @implementation BookmarkButtonCell | 9 @implementation BookmarkButtonCell |
| 9 | 10 |
| 10 - (id)initTextCell:(NSString *)string { | 11 - (id)initTextCell:(NSString *)string { |
| 11 if ((self = [super initTextCell:string])) { | 12 if ((self = [super initTextCell:string])) { |
| 12 [self setButtonType:NSMomentaryPushInButton]; | 13 [self setButtonType:NSMomentaryPushInButton]; |
| 13 [self setBezelStyle:NSShadowlessSquareBezelStyle]; | 14 [self setBezelStyle:NSShadowlessSquareBezelStyle]; |
| 14 [self setShowsBorderOnlyWhileMouseInside:YES]; | 15 [self setShowsBorderOnlyWhileMouseInside:YES]; |
| 15 [self setControlSize:NSSmallControlSize]; | 16 [self setControlSize:NSSmallControlSize]; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 46 [self setImagePosition:NSImageOnly]; | 47 [self setImagePosition:NSImageOnly]; |
| 47 } else { | 48 } else { |
| 48 [self setImagePosition:NSImageLeft]; | 49 [self setImagePosition:NSImageLeft]; |
| 49 } | 50 } |
| 50 } | 51 } |
| 51 [self setTitle:title]; | 52 [self setTitle:title]; |
| 52 } | 53 } |
| 53 | 54 |
| 54 // We share the context menu among all bookmark buttons. To allow us | 55 // We share the context menu among all bookmark buttons. To allow us |
| 55 // to disambiguate when needed (e.g. "open bookmark"), we set the | 56 // to disambiguate when needed (e.g. "open bookmark"), we set the |
| 56 // menu's delegate to be us. We (the cell) have the bookmark encoded | 57 // menu's associated node to be our represented object. |
| 57 // in our represented object. | |
| 58 // Convention needed in -[BookmarkBarController openBookmarkIn***] calls. | |
| 59 - (NSMenu*)menu { | 58 - (NSMenu*)menu { |
| 60 NSMenu* menu = [super menu]; | 59 BookmarkMenu* menu = (BookmarkMenu*)[super menu]; |
| 61 [menu setDelegate:self]; | 60 [menu setRepresentedObject:[self representedObject]]; |
| 62 return menu; | 61 return menu; |
| 63 } | 62 } |
| 64 | 63 |
| 65 @end | 64 @end |
| OLD | NEW |