summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/menu_button.h
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-03 20:42:24 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-03 20:42:24 +0000
commit1c977ab1081a4891419e40d6e4b1615c6e2583fb (patch)
treec82a78a053227719ae46739ef67f807ad095db4a /chrome/browser/cocoa/menu_button.h
parent588ac782287d7cbe82b71b825f268b8e0f026174 (diff)
downloadchromium_src-1c977ab1081a4891419e40d6e4b1615c6e2583fb.zip
chromium_src-1c977ab1081a4891419e40d6e4b1615c6e2583fb.tar.gz
chromium_src-1c977ab1081a4891419e40d6e4b1615c6e2583fb.tar.bz2
(Mac) Make the Page/Wrench buttons place their menu in the right place.
Also makes the buttons drag-able -- you can drag or click and wait to open their menu. Lucky for me, I wrote reusable code. To do (not now): The "off-the-end" button on the bookmark bar needs the same fix. Bug (not to be fixed now): The menu doesn't do the right thing when the window is moved off the left edge to the screen -- it doesn't open to the right in the correct fashion. Nor does it do the proper thing when you move the window off the bottom edge of the screen -- it doesn't open upwards entirely correctly. <shrug> BUG=18572 TEST=Click on the Page and Wrench menu buttons and observe. Also test \ dragging to open. Review URL: http://codereview.chromium.org/174556 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25362 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/menu_button.h')
-rw-r--r--chrome/browser/cocoa/menu_button.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/menu_button.h b/chrome/browser/cocoa/menu_button.h
new file mode 100644
index 0000000..92b0569
--- /dev/null
+++ b/chrome/browser/cocoa/menu_button.h
@@ -0,0 +1,24 @@
+// Copyright (c) 2009 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_BUTTON_H_
+#define CHROME_BROWSER_COCOA_MENU_BUTTON_H_
+
+#import <Cocoa/Cocoa.h>
+
+// This a button which displays a user-provided menu "attached" below it upon
+// being clicked or dragged (or clicked and held). It expects a
+// |ClickHoldButtonCell| as cell.
+@interface MenuButton : NSButton {
+ @private
+ IBOutlet NSMenu* menu_;
+ BOOL openAtRight_;
+}
+
+// The menu to display.
+@property(assign, nonatomic) NSMenu* menu;
+
+@end // @interface MenuButton
+
+#endif // CHROME_BROWSER_COCOA_MENU_BUTTON_H_