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