summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/draggable_button.h
blob: 2e166b7aa84eb71afd955fd6ff691226cee00ee3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import <Cocoa/Cocoa.h>

// Class for buttons that can be drag sources. If the mouse is clicked and moved
// more than a given distance, this class will call |-beginDrag:| instead of
// |-performClick:|. Subclasses should override these two methods.
@interface DraggableButton : NSButton {
 @private
  BOOL draggable_;     // Is this a draggable type of button?
}

// Enable or disable dragability for special buttons like "Other Bookmarks".
@property (nonatomic) BOOL draggable;

// Called when a drag should start. Subclasses must override this to do any
// pasteboard manipulation and begin the drag, usually with
// -dragImage:at:offset:event:.  Subclasses must call one of the blocking
// -drag* methods of NSView when overriding this method.
- (void)beginDrag:(NSEvent*)dragEvent;

@end  // @interface DraggableButton

@interface DraggableButton (Private)

// Resets the draggable state of the button after dragging is finished.  This is
// called by DraggableButton when the beginDrag call returns, it should not be
// called by the subclass.
- (void)endDrag;

@end  // @interface DraggableButton(Private)