| 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 #ifndef CHROME_BROWSER_COCOA_MENU_TRACKED_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_COCOA_MENU_TRACKED_BUTTON_H_ |
| 6 #define CHROME_BROWSER_COCOA_MENU_TRACKED_BUTTON_H_ | 6 #define CHROME_BROWSER_COCOA_MENU_TRACKED_BUTTON_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
| 10 | 10 |
| 11 // A MenuTrackedButton is meant to be used whenever a button is placed inside | 11 // A MenuTrackedButton is meant to be used whenever a button is placed inside |
| 12 // the custom view of an NSMenuItem. If the user opens the menu in a non-sticky | 12 // the custom view of an NSMenuItem. If the user opens the menu in a non-sticky |
| 13 // fashion (i.e. clicks, holds, and drags) and then releases the mouse over | 13 // fashion (i.e. clicks, holds, and drags) and then releases the mouse over |
| 14 // a MenuTrackedButton, it will |-performClick:| itself. | 14 // a MenuTrackedButton, it will |-performClick:| itself. |
| 15 @interface MenuTrackedButton : NSButton { | 15 @interface MenuTrackedButton : NSButton { |
| 16 @private | 16 @private |
| 17 // If the button received a |-mouseEntered:| event. This short-circuits the | 17 // If the button received a |-mouseEntered:| event. This short-circuits the |
| 18 // custom drag tracking logic. | 18 // custom drag tracking logic. |
| 19 BOOL didEnter_; | 19 BOOL didEnter_; |
| 20 | 20 |
| 21 // Whether or not the user is in a click-drag-release event sequence. If so | 21 // Whether or not the user is in a click-drag-release event sequence. If so |
| 22 // and this receives a |-mouseUp:|, then this will click itself. | 22 // and this receives a |-mouseUp:|, then this will click itself. |
| 23 BOOL tracking_; | 23 BOOL tracking_; |
| 24 } | 24 } |
| 25 | 25 |
| 26 @property (nonatomic, readonly, getter=isTracking) BOOL tracking; |
| 27 |
| 26 @end | 28 @end |
| 27 | 29 |
| 28 #endif // CHROME_BROWSER_COCOA_MENU_TRACKED_BUTTON_H_ | 30 #endif // CHROME_BROWSER_COCOA_MENU_TRACKED_BUTTON_H_ |
| OLD | NEW |