Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4259)

Unified Diff: chrome/browser/cocoa/draggable_button.h

Issue 180036: Make download items drag sources on OS X. (Closed)
Patch Set: comments Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/download_item_controller.mm ('k') | chrome/browser/cocoa/draggable_button.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/draggable_button.h
diff --git a/chrome/browser/cocoa/draggable_button.h b/chrome/browser/cocoa/draggable_button.h
new file mode 100644
index 0000000000000000000000000000000000000000..ed9a94f5781d4ae49f3f5b5dd4a7812aa5841732
--- /dev/null
+++ b/chrome/browser/cocoa/draggable_button.h
@@ -0,0 +1,30 @@
+// 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?
+ BOOL mayDragStart_; // Set to YES on mouse down, NO on up or drag.
+ BOOL beingDragged_;
+
+ // Initial mouse-down to prevent a hair-trigger drag.
+ NSPoint initialMouseDownLocation_;
+}
+
+// Enable or disable dragability for special buttons like "Other Bookmarks".
+@property BOOL draggable;
+
+// Called when a drag starts. Subclasses must override this.
+- (void)beginDrag:(NSEvent*)dragEvent;
+
+// Subclasses should call this method to notify DraggableButton when a drag is
+// over.
+- (void)endDrag;
+
+@end // @interface DraggableButton
« no previous file with comments | « chrome/browser/cocoa/download_item_controller.mm ('k') | chrome/browser/cocoa/draggable_button.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698