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 @implementation HoverImageMenuButton | |
8 | |
9 + (Class)cellClass { | |
10 return [HoverImageMenuButtonCell class]; | |
11 } | |
12 | |
13 - (id)initWithFrame:(NSRect)frameRect | |
14 pullsDown:(BOOL)flag { | |
15 if ((self = [super initWithFrame:frameRect | |
16 pullsDown:flag])) { | |
17 trackingArea_.reset( | |
18 [[CrTrackingArea alloc] initWithRect:NSZeroRect | |
19 options:NSTrackingInVisibleRect | | |
20 NSTrackingMouseEnteredAndExited | | |
21 NSTrackingActiveInKeyWindow | |
22 owner:self | |
23 userInfo:nil]); | |
24 [self addTrackingArea:trackingArea_.get()]; | |
25 | |
26 // Item 0 is the button label, which is not used. | |
27 [[self menu] addItemWithTitle:[NSString string] | |
tapted
2013/06/03 12:49:18
note: I've removed this from HoverImageMenuButton.
| |
28 action:NULL | |
29 keyEquivalent:[NSString string]]; | |
30 } | |
31 return self; | |
32 } | |
33 | |
34 - (void)mouseEntered:(NSEvent*)theEvent { | |
35 [[self cell] setHovered:YES]; | |
36 [self setNeedsDisplay:YES]; | |
37 } | |
38 | |
39 - (void)mouseExited:(NSEvent*)theEvent { | |
40 [[self cell] setHovered:NO]; | |
41 [self setNeedsDisplay:YES]; | |
42 } | |
43 | |
44 @end | |
OLD | NEW |