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