| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_CLICKHOLD_BUTTON_CELL_H_ | 5 #ifndef CHROME_BROWSER_COCOA_CLICKHOLD_BUTTON_CELL_H_ |
| 6 #define CHROME_BROWSER_COCOA_CLICKHOLD_BUTTON_CELL_H_ | 6 #define CHROME_BROWSER_COCOA_CLICKHOLD_BUTTON_CELL_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/scoped_nsobject.h" | 10 #include "base/scoped_nsobject.h" |
| 11 #import "chrome/browser/cocoa/gradient_button_cell.h" | 11 #import "chrome/browser/cocoa/gradient_button_cell.h" |
| 12 | 12 |
| 13 // A button cell that implements "click hold" behavior after a specified | 13 // A button cell that implements "click hold" behavior after a specified delay |
| 14 // delay. If -setClickHoldTimeout: is never called, this behaves like a normal | 14 // or after dragging. If click-hold is never enabled (e.g., if |
| 15 // button. | 15 // |-setEnableClickHold:| is never called), this behaves like a normal button. |
| 16 | |
| 17 @interface ClickHoldButtonCell : GradientButtonCell { | 16 @interface ClickHoldButtonCell : GradientButtonCell { |
| 18 @private | 17 @private |
| 19 BOOL enableClickHold_; | 18 BOOL enableClickHold_; |
| 20 NSTimeInterval clickHoldTimeout_; | 19 NSTimeInterval clickHoldTimeout_; |
| 21 id clickHoldTarget_; // Weak. | 20 id clickHoldTarget_; // Weak. |
| 22 SEL clickHoldAction_; | 21 SEL clickHoldAction_; |
| 23 BOOL trackOnlyInRect_; | 22 BOOL trackOnlyInRect_; |
| 24 BOOL activateOnDrag_; | 23 BOOL activateOnDrag_; |
| 25 } | 24 } |
| 26 | 25 |
| 27 // Enable click-hold? | 26 // Enable click-hold? Default: NO. |
| 28 @property(assign, nonatomic) BOOL enableClickHold; | 27 @property(assign, nonatomic) BOOL enableClickHold; |
| 29 | 28 |
| 30 // Timeout is in seconds (at least 0.01, at most 3600). | 29 // Timeout is in seconds (at least 0.01, at most 3600). Default: 0.25 (a guess |
| 30 // at a Cocoa-ish value). |
| 31 @property(assign, nonatomic) NSTimeInterval clickHoldTimeout; | 31 @property(assign, nonatomic) NSTimeInterval clickHoldTimeout; |
| 32 | 32 |
| 33 // Track only in the frame rectangle? | 33 // Track only in the frame rectangle? Default: NO. |
| 34 @property(assign, nonatomic) BOOL trackOnlyInRect; | 34 @property(assign, nonatomic) BOOL trackOnlyInRect; |
| 35 | 35 |
| 36 // Activate (click-hold) immediately on drag? | 36 // Activate (click-hold) immediately on a sufficiently-large drag (if not, |
| 37 // always wait for timeout)? Default: YES. |
| 37 @property(assign, nonatomic) BOOL activateOnDrag; | 38 @property(assign, nonatomic) BOOL activateOnDrag; |
| 38 | 39 |
| 39 // Defines what to do when click-held (as per usual action/target). | 40 // Defines what to do when click-held (as per usual action/target). |
| 40 @property(assign, nonatomic) id clickHoldTarget; | 41 @property(assign, nonatomic) id clickHoldTarget; |
| 41 @property(assign, nonatomic) SEL clickHoldAction; | 42 @property(assign, nonatomic) SEL clickHoldAction; |
| 42 | 43 |
| 43 @end // @interface ClickHoldButtonCell | 44 @end // @interface ClickHoldButtonCell |
| 44 | 45 |
| 45 #endif // CHROME_BROWSER_COCOA_CLICKHOLD_BUTTON_CELL_H_ | 46 #endif // CHROME_BROWSER_COCOA_CLICKHOLD_BUTTON_CELL_H_ |
| OLD | NEW |