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
3 // found in the LICENSE file.
5 #import "ui/base/cocoa/controls/hover_image_menu_button.h"
7 #include "base/mac/foundation_util.h"
8 #import "ui/base/cocoa/controls/hover_image_menu_button_cell.h"
10 @implementation HoverImageMenuButton
13 return [HoverImageMenuButtonCell class];
16 - (id)initWithFrame:(NSRect)frameRect
17 pullsDown:(BOOL)flag {
18 if ((self = [super initWithFrame:frameRect
21 [[CrTrackingArea alloc] initWithRect:NSZeroRect
22 options:NSTrackingInVisibleRect |
23 NSTrackingMouseEnteredAndExited |
24 NSTrackingActiveInKeyWindow
27 [self addTrackingArea:trackingArea_.get()];
32 - (HoverImageMenuButtonCell*)hoverImageMenuButtonCell {
33 return base::mac::ObjCCastStrict<HoverImageMenuButtonCell>([self cell]);
36 - (void)mouseEntered:(NSEvent*)theEvent {
37 [[self cell] setHovered:YES];
40 - (void)mouseExited:(NSEvent*)theEvent {
41 [[self cell] setHovered:NO];