| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_COCOA_HOVER_BUTTON_ |
| 6 #define CHROME_BROWSER_UI_COCOA_HOVER_BUTTON_ |
| 7 |
| 5 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 6 | 9 |
| 7 #include "base/memory/scoped_nsobject.h" | 10 #include "base/memory/scoped_nsobject.h" |
| 8 #include "chrome/browser/ui/cocoa/tracking_area.h" | 11 #import "ui/base/cocoa/tracking_area.h" |
| 9 | |
| 10 | 12 |
| 11 // A button that changes when you hover over it and click it. | 13 // A button that changes when you hover over it and click it. |
| 12 @interface HoverButton : NSButton { | 14 @interface HoverButton : NSButton { |
| 13 @protected | 15 @protected |
| 14 // Enumeration of the hover states that the close button can be in at any one | 16 // Enumeration of the hover states that the close button can be in at any one |
| 15 // time. The button cannot be in more than one hover state at a time. | 17 // time. The button cannot be in more than one hover state at a time. |
| 16 enum HoverState { | 18 enum HoverState { |
| 17 kHoverStateNone = 0, | 19 kHoverStateNone = 0, |
| 18 kHoverStateMouseOver = 1, | 20 kHoverStateMouseOver = 1, |
| 19 kHoverStateMouseDown = 2 | 21 kHoverStateMouseDown = 2 |
| 20 }; | 22 }; |
| 21 | 23 |
| 22 HoverState hoverState_; | 24 HoverState hoverState_; |
| 23 | 25 |
| 24 @private | 26 @private |
| 25 // Tracking area for button mouseover states. | 27 // Tracking area for button mouseover states. |
| 26 ScopedCrTrackingArea trackingArea_; | 28 ui::ScopedCrTrackingArea trackingArea_; |
| 27 } | 29 } |
| 28 | 30 |
| 29 @property(nonatomic) HoverState hoverState; | 31 @property(nonatomic) HoverState hoverState; |
| 30 | 32 |
| 31 // Enables or disables the tracking for the button. | 33 // Enables or disables the tracking for the button. |
| 32 - (void)setTrackingEnabled:(BOOL)enabled; | 34 - (void)setTrackingEnabled:(BOOL)enabled; |
| 33 | 35 |
| 34 // Checks to see whether the mouse is in the button's bounds and update | 36 // Checks to see whether the mouse is in the button's bounds and update |
| 35 // the image in case it gets out of sync. This occurs to the close button | 37 // the image in case it gets out of sync. This occurs to the close button |
| 36 // when you close a tab so the tab to the left of it takes its place, and | 38 // when you close a tab so the tab to the left of it takes its place, and |
| 37 // drag the button without moving the mouse before you press the button down. | 39 // drag the button without moving the mouse before you press the button down. |
| 38 - (void)checkImageState; | 40 - (void)checkImageState; |
| 41 |
| 39 @end | 42 @end |
| 43 |
| 44 #endif // CHROME_BROWSER_UI_COCOA_HOVER_BUTTON_ |
| OLD | NEW |