| OLD | NEW |
| 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/controls/hover_image_menu_button_cell.h" | 5 #import "ui/base/cocoa/controls/hover_image_menu_button_cell.h" |
| 6 | 6 |
| 7 @implementation HoverImageMenuButtonCell | 7 @implementation HoverImageMenuButtonCell |
| 8 | 8 |
| 9 @synthesize hovered = hovered_; | 9 @synthesize hovered = hovered_; |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 if ([self isHovered] && [self hoverImage]) | 45 if ([self isHovered] && [self hoverImage]) |
| 46 return [self hoverImage]; | 46 return [self hoverImage]; |
| 47 | 47 |
| 48 // Note that NSPopUpButtonCell updates the cell image when the [self menuItem] | 48 // Note that NSPopUpButtonCell updates the cell image when the [self menuItem] |
| 49 // changes. | 49 // changes. |
| 50 return [self image]; | 50 return [self image]; |
| 51 } | 51 } |
| 52 | 52 |
| 53 - (void)setDefaultImage:(NSImage*)defaultImage { | 53 - (void)setDefaultImage:(NSImage*)defaultImage { |
| 54 scoped_nsobject<NSMenuItem> buttonMenuItem([[NSMenuItem alloc] init]); | 54 base::scoped_nsobject<NSMenuItem> buttonMenuItem([[NSMenuItem alloc] init]); |
| 55 [buttonMenuItem setImage:defaultImage]; | 55 [buttonMenuItem setImage:defaultImage]; |
| 56 [self setMenuItem:buttonMenuItem]; | 56 [self setMenuItem:buttonMenuItem]; |
| 57 } | 57 } |
| 58 | 58 |
| 59 - (void)drawWithFrame:(NSRect)cellFrame | 59 - (void)drawWithFrame:(NSRect)cellFrame |
| 60 inView:(NSView*)controlView { | 60 inView:(NSView*)controlView { |
| 61 [[self imageToDraw] drawInRect:cellFrame | 61 [[self imageToDraw] drawInRect:cellFrame |
| 62 fromRect:NSZeroRect | 62 fromRect:NSZeroRect |
| 63 operation:NSCompositeSourceOver | 63 operation:NSCompositeSourceOver |
| 64 fraction:1.0 | 64 fraction:1.0 |
| 65 respectFlipped:YES | 65 respectFlipped:YES |
| 66 hints:nil]; | 66 hints:nil]; |
| 67 } | 67 } |
| 68 | 68 |
| 69 @end | 69 @end |
| OLD | NEW |