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 CHROME_BROWSER_UI_COCOA_CLICKHOLD_BUTTON_CELL_H_
6 #define CHROME_BROWSER_UI_COCOA_CLICKHOLD_BUTTON_CELL_H_
8 #import <Cocoa/Cocoa.h>
10 #import "chrome/browser/ui/cocoa/image_button_cell.h"
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
14 // |-setEnableClickHold:| is never called), this behaves like a normal button.
15 @interface ClickHoldButtonCell
: ImageButtonCell
{
17 BOOL enableClickHold_
;
18 BOOL enableRightClick_
;
19 NSTimeInterval clickHoldTimeout_
;
20 id clickHoldTarget_
; // Weak.
22 id accessibilityShowMenuTarget_
; // Weak.
23 SEL accessibilityShowMenuAction_
;
24 BOOL trackOnlyInRect_
;
28 // Enable click-hold? Default: NO.
29 @
property(assign
, nonatomic
) BOOL enableClickHold
;
31 // Enable right click? Default: NO. Needs to be set for accessibility.
32 @
property(assign
, nonatomic
) BOOL enableRightClick
;
34 // Timeout is in seconds (at least 0.0, at most 5; 0.0 means that the button
35 // will always have its click-hold action activated immediately on press).
36 // Default: 0.25 (a guess at a Cocoa-ish value).
37 @
property(assign
, nonatomic
) NSTimeInterval clickHoldTimeout
;
39 // Track only in the frame rectangle? Default: NO.
40 @
property(assign
, nonatomic
) BOOL trackOnlyInRect
;
42 // Activate (click-hold) immediately on a sufficiently-large drag (if not,
43 // always wait for timeout)? Default: YES.
44 @
property(assign
, nonatomic
) BOOL activateOnDrag
;
46 // Defines what to do when click-held (as per usual action/target).
47 @
property(assign
, nonatomic
) id clickHoldTarget
;
48 @
property(assign
, nonatomic
) SEL clickHoldAction
;
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
;
57 @end
// @interface ClickHoldButtonCell
59 #endif // CHROME_BROWSER_UI_COCOA_CLICKHOLD_BUTTON_CELL_H_