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

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

Issue 3008010: [Mac] Minor tweaks to the Wrench menu. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: nits 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 unified diff | Download patch
« no previous file with comments | « chrome/app/nibs/Toolbar.xib ('k') | chrome/browser/wrench_menu_model.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import "chrome/browser/cocoa/wrench_menu_controller.h" 5 #import "chrome/browser/cocoa/wrench_menu_controller.h"
6 6
7 #include "app/menus/menu_model.h" 7 #include "app/menus/menu_model.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "chrome/app/chrome_dll_resource.h" 9 #include "chrome/app/chrome_dll_resource.h"
10 #include "chrome/browser/browser.h"
11 #include "chrome/browser/browser_window.h"
10 #import "chrome/browser/cocoa/toolbar_controller.h" 12 #import "chrome/browser/cocoa/toolbar_controller.h"
11 #include "chrome/browser/wrench_menu_model.h" 13 #include "chrome/browser/wrench_menu_model.h"
12 14
13 @interface WrenchMenuController (Private) 15 @interface WrenchMenuController (Private)
14 - (WrenchMenuModel*)wrenchMenuModel; 16 - (WrenchMenuModel*)wrenchMenuModel;
15 - (void)adjustPositioning; 17 - (void)adjustPositioning;
16 @end 18 @end
17 19
18 @implementation WrenchMenuController 20 @implementation WrenchMenuController
19 21
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 if (![menu delegate]) { 66 if (![menu delegate]) {
65 [menu setDelegate:self]; 67 [menu setDelegate:self];
66 } 68 }
67 return menu; 69 return menu;
68 } 70 }
69 71
70 - (void)menuWillOpen:(NSMenu*)menu { 72 - (void)menuWillOpen:(NSMenu*)menu {
71 NSString* title = base::SysUTF16ToNSString( 73 NSString* title = base::SysUTF16ToNSString(
72 [self wrenchMenuModel]->GetLabelForCommandId(IDC_ZOOM_PERCENT_DISPLAY)); 74 [self wrenchMenuModel]->GetLabelForCommandId(IDC_ZOOM_PERCENT_DISPLAY));
73 [[zoomItem_ viewWithTag:IDC_ZOOM_PERCENT_DISPLAY] setTitle:title]; 75 [[zoomItem_ viewWithTag:IDC_ZOOM_PERCENT_DISPLAY] setTitle:title];
76
77 NSImage* icon = [self wrenchMenuModel]->browser()->window()->IsFullscreen() ?
78 [NSImage imageNamed:NSImageNameExitFullScreenTemplate] :
79 [NSImage imageNamed:NSImageNameEnterFullScreenTemplate];
80 [zoomFullScreen_ setImage:icon];
74 } 81 }
75 82
76 // Used to dispatch commands from the Wrench menu. The custom items within the 83 // Used to dispatch commands from the Wrench menu. The custom items within the
77 // menu cannot be hooked up directly to First Responder because the window in 84 // menu cannot be hooked up directly to First Responder because the window in
78 // which the controls reside is not the BrowserWindowController, but a 85 // which the controls reside is not the BrowserWindowController, but a
79 // NSCarbonMenuWindow; this screws up the typical |-commandDispatch:| system. 86 // NSCarbonMenuWindow; this screws up the typical |-commandDispatch:| system.
80 - (IBAction)dispatchWrenchMenuCommand:(id)sender { 87 - (IBAction)dispatchWrenchMenuCommand:(id)sender {
81 NSInteger tag = [sender tag]; 88 NSInteger tag = [sender tag];
82 89
83 // NSSegmentedControls (used for the Edit item) need a little help to get the 90 // NSSegmentedControls (used for the Edit item) need a little help to get the
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // of the segmented control. 125 // of the segmented control.
119 itemFrame.size.width += resizeAmount; 126 itemFrame.size.width += resizeAmount;
120 [editItem_ setFrame:itemFrame]; 127 [editItem_ setFrame:itemFrame];
121 128
122 // Keep the spacing between the right edges of the menu and the control. 129 // Keep the spacing between the right edges of the menu and the control.
123 controlFrame.origin.x = NSWidth(itemFrame) - edge - NSWidth(controlFrame); 130 controlFrame.origin.x = NSWidth(itemFrame) - edge - NSWidth(controlFrame);
124 [editControl_ setFrame:controlFrame]; 131 [editControl_ setFrame:controlFrame];
125 } 132 }
126 133
127 @end // @implementation WrenchMenuController 134 @end // @implementation WrenchMenuController
OLDNEW
« no previous file with comments | « chrome/app/nibs/Toolbar.xib ('k') | chrome/browser/wrench_menu_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698