Chromium Code Reviews| Index: ui/base/cocoa/controls/hover_image_menu_button.mm |
| diff --git a/ui/base/cocoa/controls/hover_image_menu_button.mm b/ui/base/cocoa/controls/hover_image_menu_button.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f313b4f00786bd25c9101e38c872399906bc0ab1 |
| --- /dev/null |
| +++ b/ui/base/cocoa/controls/hover_image_menu_button.mm |
| @@ -0,0 +1,46 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#import "ui/base/cocoa/controls/hover_image_menu_button.h" |
| + |
| +#include "base/mac/foundation_util.h" |
| +#import "ui/base/cocoa/controls/hover_image_menu_button_cell.h" |
| + |
| +@implementation HoverImageMenuButton |
| + |
| ++ (Class)cellClass { |
| + return [HoverImageMenuButtonCell class]; |
| +} |
| + |
| +- (id)initWithFrame:(NSRect)frameRect |
| + pullsDown:(BOOL)flag { |
| + if ((self = [super initWithFrame:frameRect |
| + pullsDown:flag])) { |
| + trackingArea_.reset( |
| + [[CrTrackingArea alloc] initWithRect:NSZeroRect |
| + options:NSTrackingInVisibleRect | |
| + NSTrackingMouseEnteredAndExited | |
| + NSTrackingActiveInKeyWindow |
| + owner:self |
| + userInfo:nil]); |
| + [self addTrackingArea:trackingArea_.get()]; |
| + } |
| + return self; |
| +} |
| + |
| +- (HoverImageMenuButtonCell*)hoverImageMenuButtonCell { |
| + return base::mac::ObjCCastStrict<HoverImageMenuButtonCell>([self cell]); |
| +} |
| + |
| +- (void)mouseEntered:(NSEvent*)theEvent { |
| + [[self cell] setHovered:YES]; |
| + [self setNeedsDisplay:YES]; |
|
sail
2013/06/11 00:55:22
Don't need since this is done in cell? Also below.
tapted
2013/06/11 02:32:44
Done. x2
|
| +} |
| + |
| +- (void)mouseExited:(NSEvent*)theEvent { |
| + [[self cell] setHovered:NO]; |
| + [self setNeedsDisplay:YES]; |
| +} |
| + |
| +@end |