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

Unified Diff: chrome/browser/cocoa/menu_tracked_button.mm

Issue 3072014: [Mac] Enable click-drag-release behavior in the Wrench menu's custom items. (Closed)
Patch Set: address comments Created 10 years, 5 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
Index: chrome/browser/cocoa/menu_tracked_button.mm
diff --git a/chrome/browser/cocoa/menu_tracked_button.mm b/chrome/browser/cocoa/menu_tracked_button.mm
new file mode 100644
index 0000000000000000000000000000000000000000..654e850243b4d0ac0e91cde08518e6eb66a84fa8
--- /dev/null
+++ b/chrome/browser/cocoa/menu_tracked_button.mm
@@ -0,0 +1,32 @@
+// 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 "chrome/browser/cocoa/menu_tracked_button.h"
+
+@implementation MenuTrackedButton
+
+- (void)mouseEntered:(NSEvent*)theEvent {
+ didEnter_ = YES;
+ [super mouseEntered:theEvent];
+}
+
+- (void)mouseExited:(NSEvent*)theEvent {
+ didEnter_ = NO;
+ tracking_ = NO;
+ [super mouseExited:theEvent];
+}
+
+- (void)mouseDragged:(NSEvent*)theEvent {
+ tracking_ = !didEnter_;
+ [super mouseDragged:theEvent];
+}
+
+- (void)mouseUp:(NSEvent*)theEvent {
+ if (!tracking_) {
+ return [super mouseUp:theEvent];
+ }
+ [self performClick:self];
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698