OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #import "ui/base/cocoa/controls/hover_image_menu_button.h" | |
6 | |
7 #include "base/mac/foundation_util.h" | |
8 #import "ui/base/cocoa/controls/hover_image_menu_button_cell.h" | |
9 | |
10 @implementation HoverImageMenuButton | |
11 | |
12 + (Class)cellClass { | |
13 return [HoverImageMenuButtonCell class]; | |
14 } | |
15 | |
16 - (id)initWithFrame:(NSRect)frameRect | |
17 pullsDown:(BOOL)flag { | |
18 if ((self = [super initWithFrame:frameRect | |
19 pullsDown:flag])) { | |
20 trackingArea_.reset( | |
21 [[CrTrackingArea alloc] initWithRect:NSZeroRect | |
22 options:NSTrackingInVisibleRect | | |
23 NSTrackingMouseEnteredAndExited | | |
24 NSTrackingActiveInKeyWindow | |
25 owner:self | |
26 userInfo:nil]); | |
27 [self addTrackingArea:trackingArea_.get()]; | |
28 } | |
29 return self; | |
30 } | |
31 | |
32 - (HoverImageMenuButtonCell*)hoverImageMenuButtonCell { | |
33 return base::mac::ObjCCastStrict<HoverImageMenuButtonCell>([self cell]); | |
34 } | |
35 | |
36 - (void)mouseEntered:(NSEvent*)theEvent { | |
37 [[self cell] setHovered:YES]; | |
38 [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
| |
39 } | |
40 | |
41 - (void)mouseExited:(NSEvent*)theEvent { | |
42 [[self cell] setHovered:NO]; | |
43 [self setNeedsDisplay:YES]; | |
44 } | |
45 | |
46 @end | |
OLD | NEW |