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

Side by Side Diff: chrome/browser/cocoa/wrench_menu_controller.h

Issue 3183013: [Mac] Don't close the Wrench menu after using the zoom buttons if the menu was opened sticky. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: nits Created 10 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_COCOA_WRENCH_MENU_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_COCOA_WRENCH_MENU_CONTROLLER_H_
6 #define CHROME_BROWSER_COCOA_WRENCH_MENU_CONTROLLER_H_ 6 #define CHROME_BROWSER_COCOA_WRENCH_MENU_CONTROLLER_H_
7 #pragma once 7 #pragma once
8 8
9 #import <Cocoa/Cocoa.h> 9 #import <Cocoa/Cocoa.h>
10 10
11 #import "base/cocoa_protocols_mac.h" 11 #import "base/cocoa_protocols_mac.h"
12 #include "base/scoped_ptr.h"
12 #import "chrome/browser/cocoa/menu_controller.h" 13 #import "chrome/browser/cocoa/menu_controller.h"
13 14
14 @class MenuTrackedRootView; 15 @class MenuTrackedRootView;
15 @class ToolbarController; 16 @class ToolbarController;
16 class WrenchMenuModel; 17 class WrenchMenuModel;
17 18
19 namespace WrenchMenuControllerInternal {
20 class ZoomLevelObserver;
21 } // namespace WrenchMenuControllerInternal
22
18 // The Wrench menu has a creative layout, with buttons in menu items. There is 23 // The Wrench menu has a creative layout, with buttons in menu items. There is
19 // a cross-platform model for this special menu, but on the Mac it's easier to 24 // a cross-platform model for this special menu, but on the Mac it's easier to
20 // get spacing and alignment precisely right using a NIB. To do that, we 25 // get spacing and alignment precisely right using a NIB. To do that, we
21 // subclass the generic MenuController implementation and special-case the two 26 // subclass the generic MenuController implementation and special-case the two
22 // items that require specific layout and load them from the NIB. 27 // items that require specific layout and load them from the NIB.
23 // 28 //
24 // This object is instantiated in Toolbar.xib and is configured by the 29 // This object is instantiated in Toolbar.xib and is configured by the
25 // ToolbarController. 30 // ToolbarController.
26 @interface WrenchMenuController : MenuController<NSMenuDelegate> { 31 @interface WrenchMenuController : MenuController<NSMenuDelegate> {
27 IBOutlet MenuTrackedRootView* editItem_; 32 IBOutlet MenuTrackedRootView* editItem_;
28 IBOutlet NSButton* editCut_; 33 IBOutlet NSButton* editCut_;
29 IBOutlet NSButton* editCopy_; 34 IBOutlet NSButton* editCopy_;
30 IBOutlet NSButton* editPaste_; 35 IBOutlet NSButton* editPaste_;
31 36
32 IBOutlet MenuTrackedRootView* zoomItem_; 37 IBOutlet MenuTrackedRootView* zoomItem_;
33 IBOutlet NSButton* zoomPlus_; 38 IBOutlet NSButton* zoomPlus_;
34 IBOutlet NSButton* zoomDisplay_; 39 IBOutlet NSButton* zoomDisplay_;
35 IBOutlet NSButton* zoomMinus_; 40 IBOutlet NSButton* zoomMinus_;
36 IBOutlet NSButton* zoomFullScreen_; 41 IBOutlet NSButton* zoomFullScreen_;
42
43 scoped_ptr<WrenchMenuControllerInternal::ZoomLevelObserver> observer_;
37 } 44 }
38 45
39 // Designated initializer; called within the NIB. 46 // Designated initializer; called within the NIB.
40 - (id)init; 47 - (id)init;
41 48
42 // Used to dispatch commands from the Wrench menu. The custom items within the 49 // Used to dispatch commands from the Wrench menu. The custom items within the
43 // menu cannot be hooked up directly to First Responder because the window in 50 // menu cannot be hooked up directly to First Responder because the window in
44 // which the controls reside is not the BrowserWindowController, but a 51 // which the controls reside is not the BrowserWindowController, but a
45 // NSCarbonMenuWindow; this screws up the typical |-commandDispatch:| system. 52 // NSCarbonMenuWindow; this screws up the typical |-commandDispatch:| system.
46 - (IBAction)dispatchWrenchMenuCommand:(id)sender; 53 - (IBAction)dispatchWrenchMenuCommand:(id)sender;
(...skipping 12 matching lines...) Expand all
59 // |-dispatchWrenchMenuCommand:| calls this after it has determined the tag of 66 // |-dispatchWrenchMenuCommand:| calls this after it has determined the tag of
60 // the sender. The default implementation executes the command on the outermost 67 // the sender. The default implementation executes the command on the outermost
61 // run loop using |-performSelector...withDelay:|. This is not desirable in 68 // run loop using |-performSelector...withDelay:|. This is not desirable in
62 // unit tests because it's hard to test around run loops in a deterministic 69 // unit tests because it's hard to test around run loops in a deterministic
63 // manner. To avoid those headaches, tests should provide an alternative 70 // manner. To avoid those headaches, tests should provide an alternative
64 // implementation. 71 // implementation.
65 - (void)dispatchCommandInternal:(NSInteger)tag; 72 - (void)dispatchCommandInternal:(NSInteger)tag;
66 @end 73 @end
67 74
68 #endif // CHROME_BROWSER_COCOA_WRENCH_MENU_CONTROLLER_H_ 75 #endif // CHROME_BROWSER_COCOA_WRENCH_MENU_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/menu_tracked_button.mm ('k') | chrome/browser/cocoa/wrench_menu_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698