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_CLICKHOLD_BUTTON_CELL_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_CLICKHOLD_BUTTON_CELL_H_ |
6 #define CHROME_BROWSER_UI_COCOA_CLICKHOLD_BUTTON_CELL_H_ | 6 #define CHROME_BROWSER_UI_COCOA_CLICKHOLD_BUTTON_CELL_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #import "chrome/browser/ui/cocoa/image_button_cell.h" | 10 #import "chrome/browser/ui/cocoa/image_button_cell.h" |
11 | 11 |
12 // A button cell that implements "click hold" behavior after a specified delay | 12 // A button cell that implements "click hold" behavior after a specified delay |
13 // or after dragging. If click-hold is never enabled (e.g., if | 13 // or after dragging. If click-hold is never enabled (e.g., if |
14 // |-setEnableClickHold:| is never called), this behaves like a normal button. | 14 // |-setEnableClickHold:| is never called), this behaves like a normal button. |
15 @interface ClickHoldButtonCell : ImageButtonCell { | 15 @interface ClickHoldButtonCell : ImageButtonCell { |
16 @private | 16 @private |
17 BOOL enableClickHold_; | 17 BOOL enableClickHold_; |
18 BOOL enableRightClick_; | 18 BOOL enableRightClick_; |
19 NSTimeInterval clickHoldTimeout_; | 19 NSTimeInterval clickHoldTimeout_; |
20 id clickHoldTarget_; // Weak. | 20 id clickHoldTarget_; // Weak. |
21 SEL clickHoldAction_; | 21 SEL clickHoldAction_; |
| 22 id accessibilityShowMenuTarget_; // Weak. |
| 23 SEL accessibilityShowMenuAction_; |
22 BOOL trackOnlyInRect_; | 24 BOOL trackOnlyInRect_; |
23 BOOL activateOnDrag_; | 25 BOOL activateOnDrag_; |
24 } | 26 } |
25 | 27 |
26 // Enable click-hold? Default: NO. | 28 // Enable click-hold? Default: NO. |
27 @property(assign, nonatomic) BOOL enableClickHold; | 29 @property(assign, nonatomic) BOOL enableClickHold; |
28 | 30 |
29 // Enable right click? Default: NO. Needs to be set for accessibility. | 31 // Enable right click? Default: NO. Needs to be set for accessibility. |
30 @property(assign, nonatomic) BOOL enableRightClick; | 32 @property(assign, nonatomic) BOOL enableRightClick; |
31 | 33 |
32 // Timeout is in seconds (at least 0.0, at most 5; 0.0 means that the button | 34 // Timeout is in seconds (at least 0.0, at most 5; 0.0 means that the button |
33 // will always have its click-hold action activated immediately on press). | 35 // will always have its click-hold action activated immediately on press). |
34 // Default: 0.25 (a guess at a Cocoa-ish value). | 36 // Default: 0.25 (a guess at a Cocoa-ish value). |
35 @property(assign, nonatomic) NSTimeInterval clickHoldTimeout; | 37 @property(assign, nonatomic) NSTimeInterval clickHoldTimeout; |
36 | 38 |
37 // Track only in the frame rectangle? Default: NO. | 39 // Track only in the frame rectangle? Default: NO. |
38 @property(assign, nonatomic) BOOL trackOnlyInRect; | 40 @property(assign, nonatomic) BOOL trackOnlyInRect; |
39 | 41 |
40 // Activate (click-hold) immediately on a sufficiently-large drag (if not, | 42 // Activate (click-hold) immediately on a sufficiently-large drag (if not, |
41 // always wait for timeout)? Default: YES. | 43 // always wait for timeout)? Default: YES. |
42 @property(assign, nonatomic) BOOL activateOnDrag; | 44 @property(assign, nonatomic) BOOL activateOnDrag; |
43 | 45 |
44 // Defines what to do when click-held (as per usual action/target). | 46 // Defines what to do when click-held (as per usual action/target). |
45 @property(assign, nonatomic) id clickHoldTarget; | 47 @property(assign, nonatomic) id clickHoldTarget; |
46 @property(assign, nonatomic) SEL clickHoldAction; | 48 @property(assign, nonatomic) SEL clickHoldAction; |
47 | 49 |
| 50 // Defines what to do when the Show Menu accessibility action is performed. |
| 51 // (clickHoldAction should be independent from accessibilityShowMenuAction |
| 52 // since different operations, e.g. releasing vs. not releasing a mouse button, |
| 53 // may need to be performed for each occasion.) |
| 54 @property(assign, nonatomic) id accessibilityShowMenuTarget; |
| 55 @property(assign, nonatomic) SEL accessibilityShowMenuAction; |
| 56 |
48 @end // @interface ClickHoldButtonCell | 57 @end // @interface ClickHoldButtonCell |
49 | 58 |
50 #endif // CHROME_BROWSER_UI_COCOA_CLICKHOLD_BUTTON_CELL_H_ | 59 #endif // CHROME_BROWSER_UI_COCOA_CLICKHOLD_BUTTON_CELL_H_ |
OLD | NEW |