Roll src/third_party/WebKit 4526c29:30f3df0 (svn 190187:190189)
[chromium-blink-merge.git] / ui / base / cocoa / hover_button.h
blob7a0e156660cd0d62dbc17f439b89af72f9c61631
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
3 // found in the LICENSE file.
5 #ifndef UI_BASE_COCOA_HOVER_BUTTON_
6 #define UI_BASE_COCOA_HOVER_BUTTON_
8 #import <Cocoa/Cocoa.h>
10 #import "ui/base/cocoa/tracking_area.h"
11 #import "ui/base/ui_base_export.h"
13 // A button that changes when you hover over it and click it.
14 UI_BASE_EXPORT
15 @interface HoverButton : NSButton {
16 @protected
17 // Enumeration of the hover states that the close button can be in at any one
18 // time. The button cannot be in more than one hover state at a time.
19 enum HoverState {
20 kHoverStateNone = 0,
21 kHoverStateMouseOver = 1,
22 kHoverStateMouseDown = 2
25 HoverState hoverState_;
27 @private
28 // Tracking area for button mouseover states. Nil if not enabled.
29 ui::ScopedCrTrackingArea trackingArea_;
32 @property(nonatomic) HoverState hoverState;
34 // Enables or disables the tracking for the button.
35 - (void)setTrackingEnabled:(BOOL)enabled;
37 // Checks to see whether the mouse is in the button's bounds and update
38 // the image in case it gets out of sync. This occurs to the close button
39 // when you close a tab so the tab to the left of it takes its place, and
40 // drag the button without moving the mouse before you press the button down.
41 - (void)checkImageState;
43 @end
45 #endif // UI_BASE_COCOA_HOVER_BUTTON_