OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 #import "chrome/browser/cocoa/button_with_viewid.h" |
6 | 7 |
7 // Class for buttons that can be drag sources. If the mouse is clicked and moved | 8 // Class for buttons that can be drag sources. If the mouse is clicked and moved |
8 // more than a given distance, this class will call |-beginDrag:| instead of | 9 // more than a given distance, this class will call |-beginDrag:| instead of |
9 // |-performClick:|. Subclasses should override these two methods. | 10 // |-performClick:|. Subclasses should override these two methods. |
10 @interface DraggableButton : NSButton { | 11 @interface DraggableButton : ButtonWithViewID { |
11 @private | 12 @private |
12 BOOL draggable_; // Is this a draggable type of button? | 13 BOOL draggable_; // Is this a draggable type of button? |
13 } | 14 } |
14 | 15 |
15 // Enable or disable dragability for special buttons like "Other Bookmarks". | 16 // Enable or disable dragability for special buttons like "Other Bookmarks". |
16 @property (nonatomic) BOOL draggable; | 17 @property (nonatomic) BOOL draggable; |
17 | 18 |
18 // Called when a drag should start. Subclasses must override this to do any | 19 // Called when a drag should start. Subclasses must override this to do any |
19 // pasteboard manipulation and begin the drag, usually with | 20 // pasteboard manipulation and begin the drag, usually with |
20 // -dragImage:at:offset:event:. Subclasses must call one of the blocking | 21 // -dragImage:at:offset:event:. Subclasses must call one of the blocking |
21 // -drag* methods of NSView when overriding this method. | 22 // -drag* methods of NSView when overriding this method. |
22 - (void)beginDrag:(NSEvent*)dragEvent; | 23 - (void)beginDrag:(NSEvent*)dragEvent; |
23 | 24 |
24 @end // @interface DraggableButton | 25 @end // @interface DraggableButton |
25 | 26 |
26 @interface DraggableButton (Private) | 27 @interface DraggableButton (Private) |
27 | 28 |
28 // Resets the draggable state of the button after dragging is finished. This is | 29 // Resets the draggable state of the button after dragging is finished. This is |
29 // called by DraggableButton when the beginDrag call returns, it should not be | 30 // called by DraggableButton when the beginDrag call returns, it should not be |
30 // called by the subclass. | 31 // called by the subclass. |
31 - (void)endDrag; | 32 - (void)endDrag; |
32 | 33 |
33 @end // @interface DraggableButton(Private) | 34 @end // @interface DraggableButton(Private) |
OLD | NEW |