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 NSTimeInterval clickHoldTimeout_
;
19 id clickHoldTarget_
; // Weak.
21 BOOL trackOnlyInRect_
;
25 // Enable click-hold? Default: NO.
26 @
property(assign
, nonatomic
) BOOL enableClickHold
;
28 // Timeout is in seconds (at least 0.0, at most 5; 0.0 means that the button
29 // will always have its click-hold action activated immediately on press).
30 // Default: 0.25 (a guess at a Cocoa-ish value).
31 @
property(assign
, nonatomic
) NSTimeInterval clickHoldTimeout
;
33 // Track only in the frame rectangle? Default: NO.
34 @
property(assign
, nonatomic
) BOOL trackOnlyInRect
;
36 // Activate (click-hold) immediately on a sufficiently-large drag (if not,
37 // always wait for timeout)? Default: YES.
38 @
property(assign
, nonatomic
) BOOL activateOnDrag
;
40 // Defines what to do when click-held (as per usual action/target).
41 @
property(assign
, nonatomic
) id clickHoldTarget
;
42 @
property(assign
, nonatomic
) SEL clickHoldAction
;
44 @end
// @interface ClickHoldButtonCell
46 #endif // CHROME_BROWSER_UI_COCOA_CLICKHOLD_BUTTON_CELL_H_