| OLD | NEW |
| 1 // Copyright (c) 2009 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 #import "chrome/browser/cocoa/draggable_button.h" |
| 8 |
| 7 @protocol BookmarkButtonDelegate; | 9 @protocol BookmarkButtonDelegate; |
| 8 | 10 |
| 9 // Class for bookmark bar buttons that can be drag sources. | 11 // Class for bookmark bar buttons that can be drag sources. |
| 10 @interface BookmarkButton : NSButton { | 12 @interface BookmarkButton : DraggableButton { |
| 11 @private | 13 @private |
| 12 BOOL draggable_; // Is this a draggable type of button? | |
| 13 BOOL mayDragStart_; // Set to YES on mouse down, NO on up or drag. | |
| 14 BOOL beingDragged_; | |
| 15 id<BookmarkButtonDelegate> delegate_; | 14 id<BookmarkButtonDelegate> delegate_; |
| 16 | |
| 17 // Initial mouse-down to prevent a hair-trigger drag. | |
| 18 NSPoint initialMouseDownLocation_; | |
| 19 } | 15 } |
| 20 | 16 |
| 21 // Enable or disable dragability for special buttons like "Other Bookmarks". | |
| 22 @property BOOL draggable; | |
| 23 | |
| 24 @property(assign, nonatomic) id<BookmarkButtonDelegate> delegate; | 17 @property(assign, nonatomic) id<BookmarkButtonDelegate> delegate; |
| 25 | 18 |
| 26 @end // @interface BookmarkButton | 19 @end // @interface BookmarkButton |
| 27 | 20 |
| 28 // Protocol for a |BookmarkButton|'s delegate, which is responsible for doing | 21 // Protocol for a |BookmarkButton|'s delegate, which is responsible for doing |
| 29 // things which require information about the bookmark represented by this | 22 // things which require information about the bookmark represented by this |
| 30 // button. | 23 // button. |
| 31 @protocol BookmarkButtonDelegate | 24 @protocol BookmarkButtonDelegate |
| 32 | 25 |
| 33 // Fill the given pasteboard with appropriate data when the given button is | 26 // Fill the given pasteboard with appropriate data when the given button is |
| 34 // dragged. Since the delegate has no way of providing pasteboard data later, | 27 // dragged. Since the delegate has no way of providing pasteboard data later, |
| 35 // all data must actually be put into the pasteboard and not merely promised. | 28 // all data must actually be put into the pasteboard and not merely promised. |
| 36 - (void)fillPasteboard:(NSPasteboard*)pboard | 29 - (void)fillPasteboard:(NSPasteboard*)pboard |
| 37 forDragOfButton:(BookmarkButton*)button; | 30 forDragOfButton:(BookmarkButton*)button; |
| 38 | 31 |
| 39 @end // @protocol BookmarkButtonDelegate | 32 @end // @protocol BookmarkButtonDelegate |
| OLD | NEW |