Home | History | Annotate | Download | only in cocoa
      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 
      8 #import <Cocoa/Cocoa.h>
      9 
     10 #import "chrome/browser/ui/cocoa/image_button_cell.h"
     11 
     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 {
     16  @private
     17   BOOL enableClickHold_;
     18   NSTimeInterval clickHoldTimeout_;
     19   id clickHoldTarget_;                  // Weak.
     20   SEL clickHoldAction_;
     21   BOOL trackOnlyInRect_;
     22   BOOL activateOnDrag_;
     23 }
     24 
     25 // Enable click-hold? Default: NO.
     26 @property(assign, nonatomic) BOOL enableClickHold;
     27 
     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;
     32 
     33 // Track only in the frame rectangle? Default: NO.
     34 @property(assign, nonatomic) BOOL trackOnlyInRect;
     35 
     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;
     39 
     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;
     43 
     44 @end  // @interface ClickHoldButtonCell
     45 
     46 #endif  // CHROME_BROWSER_UI_COCOA_CLICKHOLD_BUTTON_CELL_H_
     47