OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/ui/cocoa/hover_button.h" | 5 #import "chrome/browser/ui/cocoa/hover_button.h" |
6 | 6 |
7 #import "chrome/browser/ui/cocoa/tracking_area.h" | |
8 | |
9 @implementation HoverButton | 7 @implementation HoverButton |
10 | 8 |
11 @synthesize hoverState = hoverState_; | 9 @synthesize hoverState = hoverState_; |
12 | 10 |
13 - (id)initWithFrame:(NSRect)frameRect { | 11 - (id)initWithFrame:(NSRect)frameRect { |
14 if ((self = [super initWithFrame:frameRect])) { | 12 if ((self = [super initWithFrame:frameRect])) { |
15 [self setTrackingEnabled:YES]; | 13 [self setTrackingEnabled:YES]; |
16 hoverState_ = kHoverStateNone; | 14 hoverState_ = kHoverStateNone; |
17 [self updateTrackingAreas]; | 15 [self updateTrackingAreas]; |
18 } | 16 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 self.hoverState = NSPointInRect(mouseLoc, [self bounds]) ? | 97 self.hoverState = NSPointInRect(mouseLoc, [self bounds]) ? |
100 kHoverStateMouseOver : kHoverStateNone; | 98 kHoverStateMouseOver : kHoverStateNone; |
101 } | 99 } |
102 | 100 |
103 - (void)setHoverState:(HoverState)state { | 101 - (void)setHoverState:(HoverState)state { |
104 hoverState_ = state; | 102 hoverState_ = state; |
105 [self setNeedsDisplay:YES]; | 103 [self setNeedsDisplay:YES]; |
106 } | 104 } |
107 | 105 |
108 @end | 106 @end |
OLD | NEW |