From 1c977ab1081a4891419e40d6e4b1615c6e2583fb Mon Sep 17 00:00:00 2001 From: "viettrungluu@chromium.org" Date: Thu, 3 Sep 2009 20:42:24 +0000 Subject: (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. 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 --- chrome/browser/cocoa/menu_button.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 chrome/browser/cocoa/menu_button.h (limited to 'chrome/browser/cocoa/menu_button.h') 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 + +// 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_ -- cgit v1.1