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

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

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.h
diff --git a/chrome/browser/cocoa/menu_tracked_button.h b/chrome/browser/cocoa/menu_tracked_button.h
new file mode 100644
index 0000000000000000000000000000000000000000..df42255fd9b94c828ed900f267feb30732c281ce
--- /dev/null
+++ b/chrome/browser/cocoa/menu_tracked_button.h
@@ -0,0 +1,28 @@
+// 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.
+
+#ifndef CHROME_BROWSER_COCOA_MENU_TRACKED_BUTTON_H_
+#define CHROME_BROWSER_COCOA_MENU_TRACKED_BUTTON_H_
+#pragma once
+
+#import <Cocoa/Cocoa.h>
+
+// A MenuTrackedButton is meant to be used whenever a button is placed inside
+// the custom view of an NSMenuItem. If the user opens the menu in a non-sticky
+// fashion (i.e. clicks, holds, and drags) and then releases the mouse over
+// a MenuTrackedButton, it will |-performClick:| itself.
+@interface MenuTrackedButton : NSButton {
+ @private
+ // If the button received a |-mouseEntered:| event. This short-circuits the
+ // custom drag tracking logic.
+ BOOL didEnter_;
+
+ // Whether or not the user is in a click-drag-release event sequence. If so
+ // and this receives a |-mouseUp:|, then this will click itself.
+ BOOL tracking_;
+}
+
+@end
+
+#endif // CHROME_BROWSER_COCOA_MENU_TRACKED_BUTTON_H_

Powered by Google App Engine
This is Rietveld 408576698