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 | 6 |
7 // Class for buttons that can be drag sources. If the mouse is clicked and moved | 7 // 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 | 8 // more than a given distance, this class will call |-beginDrag:| instead of |
9 // |-performClick:|. Subclasses should override these two methods. | 9 // |-performClick:|. Subclasses should override these two methods. |
10 @interface DraggableButton : NSButton { | 10 @interface DraggableButton : NSButton { |
11 @private | 11 @private |
12 BOOL draggable_; // Is this a draggable type of button? | 12 BOOL draggable_; // Is this a draggable type of button? |
13 } | 13 } |
14 | 14 |
15 // Enable or disable dragability for special buttons like "Other Bookmarks". | 15 // Enable or disable dragability for special buttons like "Other Bookmarks". |
16 @property BOOL draggable; | 16 @property (nonatomic) BOOL draggable; |
17 | 17 |
18 // Called when a drag should start. Subclasses must override this to do any | 18 // Called when a drag should start. Subclasses must override this to do any |
19 // pasteboard manipulation and begin the drag, usually with | 19 // pasteboard manipulation and begin the drag, usually with |
20 // -dragImage:at:offset:event:. Subclasses must call one of the blocking | 20 // -dragImage:at:offset:event:. Subclasses must call one of the blocking |
21 // -drag* methods of NSView when overriding this method. | 21 // -drag* methods of NSView when overriding this method. |
22 - (void)beginDrag:(NSEvent*)dragEvent; | 22 - (void)beginDrag:(NSEvent*)dragEvent; |
23 | 23 |
24 @end // @interface DraggableButton | 24 @end // @interface DraggableButton |
25 | 25 |
26 @interface DraggableButton (Private) | 26 @interface DraggableButton (Private) |
27 | 27 |
28 // Resets the draggable state of the button after dragging is finished. This is | 28 // 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 | 29 // called by DraggableButton when the beginDrag call returns, it should not be |
30 // called by the subclass. | 30 // called by the subclass. |
31 - (void)endDrag; | 31 - (void)endDrag; |
32 | 32 |
33 @end // @interface DraggableButton(Private) | 33 @end // @interface DraggableButton(Private) |
OLD | NEW |