OLD | NEW |
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/toolbar_controller.h" | 5 #import "chrome/browser/cocoa/toolbar_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/l10n_util_mac.h" | 9 #include "app/l10n_util_mac.h" |
10 #include "base/mac_util.h" | 10 #include "base/mac_util.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 NSString* const kStarButtonImageName = @"star_Template.pdf"; | 53 NSString* const kStarButtonImageName = @"star_Template.pdf"; |
54 NSString* const kStarButtonFillingImageName = @"starred.pdf"; | 54 NSString* const kStarButtonFillingImageName = @"starred.pdf"; |
55 NSString* const kGoButtonGoImageName = @"go_Template.pdf"; | 55 NSString* const kGoButtonGoImageName = @"go_Template.pdf"; |
56 NSString* const kGoButtonStopImageName = @"stop_Template.pdf"; | 56 NSString* const kGoButtonStopImageName = @"stop_Template.pdf"; |
57 NSString* const kPageButtonImageName = @"menu_page_Template.pdf"; | 57 NSString* const kPageButtonImageName = @"menu_page_Template.pdf"; |
58 NSString* const kWrenchButtonImageName = @"menu_chrome_Template.pdf"; | 58 NSString* const kWrenchButtonImageName = @"menu_chrome_Template.pdf"; |
59 | 59 |
60 // Height of the toolbar in pixels when the bookmark bar is closed. | 60 // Height of the toolbar in pixels when the bookmark bar is closed. |
61 const CGFloat kBaseToolbarHeight = 36.0; | 61 const CGFloat kBaseToolbarHeight = 36.0; |
62 | 62 |
63 // The threshold width in pixels between the reload button (the home button is | 63 // The distance from the 'Go' button to the Browser Actions container in pixels. |
64 // optional) and the right side of the window for use in determining whether to | 64 const CGFloat kBrowserActionsContainerLeftPadding = 5.0; |
65 // show or hide Browser Action buttons depending on window size. | 65 |
66 const CGFloat kHideBrowserActionThresholdWidth = 300.0; | 66 // The minimum width of the location bar in pixels. |
| 67 const CGFloat kMinimumLocationBarWidth = 100.0; |
67 | 68 |
68 } // namespace | 69 } // namespace |
69 | 70 |
70 @interface ToolbarController(Private) | 71 @interface ToolbarController(Private) |
71 - (void)addAccessibilityDescriptions; | 72 - (void)addAccessibilityDescriptions; |
72 - (void)windowResized; | |
73 - (void)initCommandStatus:(CommandUpdater*)commands; | 73 - (void)initCommandStatus:(CommandUpdater*)commands; |
74 - (void)prefChanged:(std::wstring*)prefName; | 74 - (void)prefChanged:(std::wstring*)prefName; |
75 - (BackgroundGradientView*)backgroundGradientView; | 75 - (BackgroundGradientView*)backgroundGradientView; |
76 - (void)showOrHideBrowserActionButtons; | 76 - (void)toolbarFrameChanged; |
77 - (void)browserActionsChanged; | 77 - (void)pinGoButtonToLeftOfBrowserActionsContainer; |
| 78 - (void)maintainMinimumLocationBarWidth; |
| 79 - (void)adjustBrowserActionsContainerForNewWindow; |
| 80 - (void)browserActionsContainerDragged; |
| 81 - (void)browserActionsVisibilityChanged; |
78 - (void)adjustLocationAndGoPositionsBy:(CGFloat)dX; | 82 - (void)adjustLocationAndGoPositionsBy:(CGFloat)dX; |
79 @end | 83 @end |
80 | 84 |
81 namespace { | 85 namespace { |
82 | 86 |
83 // A C++ class used to correctly position the omnibox. | 87 // A C++ class used to correctly position the omnibox. |
84 class BubblePositionerMac : public BubblePositioner { | 88 class BubblePositionerMac : public BubblePositioner { |
85 public: | 89 public: |
86 BubblePositionerMac(ToolbarController* controller) | 90 BubblePositionerMac(ToolbarController* controller) |
87 : controller_(controller) { } | 91 : controller_(controller) { } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 [pageButton_ setShowsBorderOnlyWhileMouseInside:YES]; | 214 [pageButton_ setShowsBorderOnlyWhileMouseInside:YES]; |
211 [wrenchButton_ setShowsBorderOnlyWhileMouseInside:YES]; | 215 [wrenchButton_ setShowsBorderOnlyWhileMouseInside:YES]; |
212 | 216 |
213 [self initCommandStatus:commands_]; | 217 [self initCommandStatus:commands_]; |
214 bubblePositioner_.reset(new BubblePositionerMac(self)); | 218 bubblePositioner_.reset(new BubblePositionerMac(self)); |
215 locationBarView_.reset(new LocationBarViewMac(locationBar_, | 219 locationBarView_.reset(new LocationBarViewMac(locationBar_, |
216 bubblePositioner_.get(), | 220 bubblePositioner_.get(), |
217 commands_, toolbarModel_, | 221 commands_, toolbarModel_, |
218 profile_, browser_)); | 222 profile_, browser_)); |
219 [locationBar_ setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]]; | 223 [locationBar_ setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]]; |
220 [[NSNotificationCenter defaultCenter] | |
221 addObserver:self | |
222 selector:@selector(windowResized) | |
223 name:NSWindowDidResizeNotification | |
224 object:[[self view] window]]; | |
225 // Register pref observers for the optional home and page/options buttons | 224 // Register pref observers for the optional home and page/options buttons |
226 // and then add them to the toolbar based on those prefs. | 225 // and then add them to the toolbar based on those prefs. |
227 prefObserver_.reset(new ToolbarControllerInternal::PrefObserverBridge(self)); | 226 prefObserver_.reset(new ToolbarControllerInternal::PrefObserverBridge(self)); |
228 PrefService* prefs = profile_->GetPrefs(); | 227 PrefService* prefs = profile_->GetPrefs(); |
229 showHomeButton_.Init(prefs::kShowHomeButton, prefs, prefObserver_.get()); | 228 showHomeButton_.Init(prefs::kShowHomeButton, prefs, prefObserver_.get()); |
230 showPageOptionButtons_.Init(prefs::kShowPageOptionsButtons, prefs, | 229 showPageOptionButtons_.Init(prefs::kShowPageOptionsButtons, prefs, |
231 prefObserver_.get()); | 230 prefObserver_.get()); |
232 [self showOptionalHomeButton]; | 231 [self showOptionalHomeButton]; |
233 [self showOptionalPageWrenchButtons]; | 232 [self showOptionalPageWrenchButtons]; |
234 | 233 |
235 // Create the controllers for the back/forward menus. | 234 // Create the controllers for the back/forward menus. |
236 backMenuController_.reset([[BackForwardMenuController alloc] | 235 backMenuController_.reset([[BackForwardMenuController alloc] |
237 initWithBrowser:browser_ | 236 initWithBrowser:browser_ |
238 modelType:BACK_FORWARD_MENU_TYPE_BACK | 237 modelType:BACK_FORWARD_MENU_TYPE_BACK |
239 button:backButton_]); | 238 button:backButton_]); |
240 forwardMenuController_.reset([[BackForwardMenuController alloc] | 239 forwardMenuController_.reset([[BackForwardMenuController alloc] |
241 initWithBrowser:browser_ | 240 initWithBrowser:browser_ |
242 modelType:BACK_FORWARD_MENU_TYPE_FORWARD | 241 modelType:BACK_FORWARD_MENU_TYPE_FORWARD |
243 button:forwardButton_]); | 242 button:forwardButton_]); |
244 browserActionsController_.reset([[BrowserActionsController alloc] | 243 |
245 initWithBrowser:browser_ | |
246 containerView:browserActionsContainerView_]); | |
247 // When new browser actions are added/removed, the container view for them is | |
248 // resized, necessitating the probable resizing of surrounding elements | |
249 // handled by this controller. | |
250 [[NSNotificationCenter defaultCenter] | |
251 addObserver:self | |
252 selector:@selector(browserActionsChanged) | |
253 name:kBrowserActionsChangedNotification | |
254 object:browserActionsController_]; | |
255 // For a popup window, the toolbar is really just a location bar | 244 // For a popup window, the toolbar is really just a location bar |
256 // (see override for [ToolbarController view], below). When going | 245 // (see override for [ToolbarController view], below). When going |
257 // fullscreen, we remove the toolbar controller's view from the view | 246 // fullscreen, we remove the toolbar controller's view from the view |
258 // hierarchy. Calling [locationBar_ removeFromSuperview] when going | 247 // hierarchy. Calling [locationBar_ removeFromSuperview] when going |
259 // fullscreen causes it to get released, making us unhappy | 248 // fullscreen causes it to get released, making us unhappy |
260 // (http://crbug.com/18551). We avoid the problem by incrementing | 249 // (http://crbug.com/18551). We avoid the problem by incrementing |
261 // the retain count of the location bar; use of the scoped object | 250 // the retain count of the location bar; use of the scoped object |
262 // helps us remember to release it. | 251 // helps us remember to release it. |
263 locationBarRetainer_.reset([locationBar_ retain]); | 252 locationBarRetainer_.reset([locationBar_ retain]); |
264 trackingArea_.reset( | 253 trackingArea_.reset( |
265 [[NSTrackingArea alloc] initWithRect:NSZeroRect // Ignored | 254 [[NSTrackingArea alloc] initWithRect:NSZeroRect // Ignored |
266 options:NSTrackingMouseMoved | | 255 options:NSTrackingMouseMoved | |
267 NSTrackingInVisibleRect | | 256 NSTrackingInVisibleRect | |
268 NSTrackingMouseEnteredAndExited | | 257 NSTrackingMouseEnteredAndExited | |
269 NSTrackingActiveAlways | 258 NSTrackingActiveAlways |
270 owner:self | 259 owner:self |
271 userInfo:nil]); | 260 userInfo:nil]); |
272 [[self view] addTrackingArea:trackingArea_.get()]; | 261 NSView* toolbarView = [self view]; |
| 262 [toolbarView addTrackingArea:trackingArea_.get()]; |
273 | 263 |
274 // We want a dynamic tooltip on the go button, so tell the go button to ask | 264 // We want a dynamic tooltip on the go button, so tell the go button to ask |
275 // us for the tooltip. | 265 // us for the tooltip. |
276 [goButton_ addToolTipRect:[goButton_ bounds] owner:self userData:nil]; | 266 [goButton_ addToolTipRect:[goButton_ bounds] owner:self userData:nil]; |
| 267 |
| 268 // If the user has any Browser Actions installed, the container view for them |
| 269 // may have to be resized depending on the width of the toolbar frame. |
| 270 [toolbarView setPostsFrameChangedNotifications:YES]; |
| 271 [[NSNotificationCenter defaultCenter] |
| 272 addObserver:self |
| 273 selector:@selector(toolbarFrameChanged) |
| 274 name:NSViewFrameDidChangeNotification |
| 275 object:toolbarView]; |
277 } | 276 } |
278 | 277 |
279 - (void)addAccessibilityDescriptions { | 278 - (void)addAccessibilityDescriptions { |
280 // Set accessibility descriptions. http://openradar.appspot.com/7496255 | 279 // Set accessibility descriptions. http://openradar.appspot.com/7496255 |
281 NSString* description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_BACK); | 280 NSString* description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_BACK); |
282 [[backButton_ cell] | 281 [[backButton_ cell] |
283 accessibilitySetOverrideValue:description | 282 accessibilitySetOverrideValue:description |
284 forAttribute:NSAccessibilityDescriptionAttribute]; | 283 forAttribute:NSAccessibilityDescriptionAttribute]; |
285 description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_FORWARD); | 284 description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_FORWARD); |
286 [[forwardButton_ cell] | 285 [[forwardButton_ cell] |
(...skipping 22 matching lines...) Expand all Loading... |
309 description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_PAGE); | 308 description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_PAGE); |
310 [[pageButton_ cell] | 309 [[pageButton_ cell] |
311 accessibilitySetOverrideValue:description | 310 accessibilitySetOverrideValue:description |
312 forAttribute:NSAccessibilityDescriptionAttribute]; | 311 forAttribute:NSAccessibilityDescriptionAttribute]; |
313 description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_APP); | 312 description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_APP); |
314 [[wrenchButton_ cell] | 313 [[wrenchButton_ cell] |
315 accessibilitySetOverrideValue:description | 314 accessibilitySetOverrideValue:description |
316 forAttribute:NSAccessibilityDescriptionAttribute]; | 315 forAttribute:NSAccessibilityDescriptionAttribute]; |
317 } | 316 } |
318 | 317 |
319 - (void)windowResized { | |
320 // Some Browser Action buttons may have to be hidden or shown depending on the | |
321 // window's size. | |
322 [self showOrHideBrowserActionButtons]; | |
323 } | |
324 | |
325 - (void)mouseExited:(NSEvent*)theEvent { | 318 - (void)mouseExited:(NSEvent*)theEvent { |
326 [[hoveredButton_ cell] setMouseInside:NO animate:YES]; | 319 [[hoveredButton_ cell] setMouseInside:NO animate:YES]; |
327 [hoveredButton_ release]; | 320 [hoveredButton_ release]; |
328 hoveredButton_ = nil; | 321 hoveredButton_ = nil; |
329 } | 322 } |
330 | 323 |
331 - (NSButton*)hoverButtonForEvent:(NSEvent*)theEvent { | 324 - (NSButton*)hoverButtonForEvent:(NSEvent*)theEvent { |
332 NSButton* targetView = (NSButton*)[[self view] | 325 NSButton* targetView = (NSButton*)[[self view] |
333 hitTest:[theEvent locationInWindow]]; | 326 hitTest:[theEvent locationInWindow]]; |
334 | 327 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 - (void)prefChanged:(std::wstring*)prefName { | 585 - (void)prefChanged:(std::wstring*)prefName { |
593 if (!prefName) return; | 586 if (!prefName) return; |
594 if (*prefName == prefs::kShowHomeButton) { | 587 if (*prefName == prefs::kShowHomeButton) { |
595 [self showOptionalHomeButton]; | 588 [self showOptionalHomeButton]; |
596 } else if (*prefName == prefs::kShowPageOptionsButtons) { | 589 } else if (*prefName == prefs::kShowPageOptionsButtons) { |
597 [self showOptionalPageWrenchButtons]; | 590 [self showOptionalPageWrenchButtons]; |
598 } | 591 } |
599 } | 592 } |
600 | 593 |
601 - (void)createBrowserActionButtons { | 594 - (void)createBrowserActionButtons { |
602 [browserActionsController_ createButtons]; | 595 if (browserActionsController_.get() == nil) { |
603 [self showOrHideBrowserActionButtons]; | 596 browserActionsController_.reset([[BrowserActionsController alloc] |
| 597 initWithBrowser:browser_ |
| 598 containerView:browserActionsContainerView_]); |
| 599 [[NSNotificationCenter defaultCenter] |
| 600 addObserver:self |
| 601 selector:@selector(browserActionsContainerDragged) |
| 602 name:kBrowserActionGrippyDraggingNotification |
| 603 object:browserActionsController_]; |
| 604 [[NSNotificationCenter defaultCenter] |
| 605 addObserver:self |
| 606 selector:@selector(browserActionsVisibilityChanged) |
| 607 name:kBrowserActionVisibilityChangedNotification |
| 608 object:browserActionsController_]; |
| 609 [[NSNotificationCenter defaultCenter] |
| 610 addObserver:self |
| 611 selector:@selector(adjustBrowserActionsContainerForNewWindow) |
| 612 name:NSWindowDidBecomeKeyNotification |
| 613 object:[[self view] window]]; |
| 614 } |
| 615 |
| 616 CGFloat dX = NSWidth([browserActionsContainerView_ frame]) * -1; |
| 617 [self adjustLocationAndGoPositionsBy:dX]; |
604 BOOL rightBorderShown = !([pageButton_ isHidden] && [wrenchButton_ isHidden]); | 618 BOOL rightBorderShown = !([pageButton_ isHidden] && [wrenchButton_ isHidden]); |
605 [browserActionsContainerView_ setRightBorderShown:rightBorderShown]; | 619 [browserActionsContainerView_ setRightBorderShown:rightBorderShown]; |
606 } | 620 } |
607 | 621 |
608 - (void)showOrHideBrowserActionButtons { | 622 - (void)adjustBrowserActionsContainerForNewWindow { |
609 // TODO(andybons): This is ugly as sin and hard to follow. Fix it up. | 623 [self toolbarFrameChanged]; |
| 624 [[NSNotificationCenter defaultCenter] |
| 625 removeObserver:self |
| 626 name:NSWindowDidBecomeKeyNotification |
| 627 object:[[self view] window]]; |
| 628 } |
610 | 629 |
611 int buttonCount = [browserActionsController_ buttonCount]; | 630 - (void)browserActionsContainerDragged { |
612 if (buttonCount == 0 || !hasToolbar_) | 631 CGFloat locationBarWidth = NSWidth([locationBar_ frame]); |
613 return; | 632 locationBarAtMinSize_ = locationBarWidth <= kMinimumLocationBarWidth; |
| 633 [browserActionsContainerView_ setCanDragLeft:!locationBarAtMinSize_]; |
| 634 [browserActionsContainerView_ setGrippyPinned:locationBarAtMinSize_]; |
614 | 635 |
615 CGFloat curWidth = NSWidth([[[self view] window] frame]); | 636 [self adjustLocationAndGoPositionsBy: |
616 NSRect reloadFrame = [reloadButton_ frame]; | 637 [browserActionsContainerView_ resizeDeltaX]]; |
617 // Calculate the width between the reload button and the end of the frame and | 638 } |
618 // subtract the threshold width, which represents the space that the | |
619 // (optional) home button, omnibar, go button and page/wrench buttons take up | |
620 // when no Browser Actions are displayed. This is to prevent the Browser | |
621 // Action buttons from pushing the elements to the left of them too far over. | |
622 CGFloat availableWidth = std::max(0.0f, | |
623 curWidth - reloadFrame.origin.x + NSWidth(reloadFrame) - | |
624 kHideBrowserActionThresholdWidth); | |
625 // How many Browser Action buttons can we safely display without overflow? | |
626 int numAvailableSlots = availableWidth / | |
627 (kBrowserActionWidth + kBrowserActionButtonPadding); | |
628 int visibleCount = [browserActionsController_ visibleButtonCount]; | |
629 | 639 |
630 // |delta| is the number of buttons that should be shown or hidden based on | 640 - (void)browserActionsVisibilityChanged { |
631 // the number of available slots and the number of visible buttons. | 641 [self pinGoButtonToLeftOfBrowserActionsContainer]; |
632 int delta = numAvailableSlots - visibleCount; | 642 } |
633 BOOL hide = delta < 0; | |
634 if (hide) { | |
635 delta *= -1; | |
636 } else if (visibleCount == buttonCount) { | |
637 // The number of available slots is greater than the number of displayed | |
638 // buttons then all buttons are already displayed. | |
639 return; | |
640 } | |
641 int arrayOffset = hide ? -1 : 0; | |
642 | 643 |
643 while (delta > 0) { | 644 - (void)pinGoButtonToLeftOfBrowserActionsContainer { |
644 visibleCount = [browserActionsController_ visibleButtonCount]; | 645 NSRect goFrame = [goButton_ frame]; |
645 if (visibleCount == buttonCount && !hide) | 646 NSRect containerFrame = [browserActionsContainerView_ frame]; |
646 return; | 647 CGFloat leftPadding = containerFrame.origin.x - |
647 BrowserActionButton* button = [[browserActionsContainerView_ subviews] | 648 (goFrame.origin.x + NSWidth(goFrame)); |
648 objectAtIndex:visibleCount + arrayOffset]; | 649 if (leftPadding != kBrowserActionsContainerLeftPadding) { |
649 [button setHidden:hide]; | 650 CGFloat dX = leftPadding - kBrowserActionsContainerLeftPadding; |
650 [self browserActionsChanged]; | 651 [self adjustLocationAndGoPositionsBy:dX]; |
651 --delta; | |
652 } | 652 } |
653 } | 653 } |
654 | 654 |
655 - (void)browserActionsChanged { | 655 - (void)maintainMinimumLocationBarWidth { |
656 CGFloat width = [browserActionsController_ idealContainerWidth]; | 656 CGFloat locationBarWidth = NSWidth([locationBar_ frame]); |
657 NSRect containerFrame = [browserActionsContainerView_ frame]; | 657 locationBarAtMinSize_ = locationBarWidth <= kMinimumLocationBarWidth; |
658 CGFloat dX = containerFrame.size.width - width; | 658 if (locationBarAtMinSize_) { |
659 containerFrame.size.width = width; | 659 CGFloat dX = kMinimumLocationBarWidth - locationBarWidth; |
| 660 [self adjustLocationAndGoPositionsBy:dX]; |
| 661 } |
| 662 } |
660 | 663 |
661 [browserActionsContainerView_ setFrame:NSOffsetRect(containerFrame, dX, 0)]; | 664 - (void)toolbarFrameChanged { |
662 [self adjustLocationAndGoPositionsBy:dX]; | 665 [self maintainMinimumLocationBarWidth]; |
| 666 |
| 667 if (locationBarAtMinSize_) { |
| 668 // Once the grippy is pinned, leave it until it is explicity un-pinned. |
| 669 [browserActionsContainerView_ setGrippyPinned:YES]; |
| 670 NSRect containerFrame = [browserActionsContainerView_ frame]; |
| 671 // Determine how much the container needs to move in case it's overlapping |
| 672 // with the location bar. |
| 673 CGFloat dX = ([goButton_ frame].origin.x + NSWidth([goButton_ frame])) - |
| 674 containerFrame.origin.x + kBrowserActionsContainerLeftPadding; |
| 675 containerFrame = NSOffsetRect(containerFrame, dX, 0); |
| 676 containerFrame.size.width -= dX; |
| 677 [browserActionsContainerView_ setFrame:containerFrame]; |
| 678 } else if (!locationBarAtMinSize_ && |
| 679 [browserActionsContainerView_ grippyPinned]) { |
| 680 // Expand out the container until it hits the saved size, then unpin the |
| 681 // grippy. |
| 682 // Add 0.1 pixel so that it doesn't hit the minimum width codepath above. |
| 683 CGFloat dX = NSWidth([locationBar_ frame]) - |
| 684 (kMinimumLocationBarWidth + 0.1); |
| 685 NSRect containerFrame = [browserActionsContainerView_ frame]; |
| 686 containerFrame = NSOffsetRect(containerFrame, -dX, 0); |
| 687 containerFrame.size.width += dX; |
| 688 CGFloat savedContainerWidth = [browserActionsController_ savedWidth]; |
| 689 if (NSWidth(containerFrame) >= savedContainerWidth) { |
| 690 containerFrame = NSOffsetRect(containerFrame, |
| 691 NSWidth(containerFrame) - savedContainerWidth, 0); |
| 692 containerFrame.size.width = savedContainerWidth; |
| 693 [browserActionsContainerView_ setGrippyPinned:NO]; |
| 694 } |
| 695 [browserActionsContainerView_ setFrame:containerFrame]; |
| 696 [self pinGoButtonToLeftOfBrowserActionsContainer]; |
| 697 } |
663 } | 698 } |
664 | 699 |
665 - (void)adjustLocationAndGoPositionsBy:(CGFloat)dX { | 700 - (void)adjustLocationAndGoPositionsBy:(CGFloat)dX { |
| 701 // Ensure that the 'Go' button is in its proper place. |
| 702 NSRect goFrame = [goButton_ frame]; |
| 703 NSRect locationFrame = [locationBar_ frame]; |
| 704 CGFloat rightDelta = (locationFrame.origin.x + NSWidth(locationFrame)) - |
| 705 goFrame.origin.x; |
| 706 if (rightDelta != 0.0) |
| 707 [goButton_ setFrame:NSOffsetRect(goFrame, rightDelta, 0)]; |
| 708 |
666 [goButton_ setFrame:NSOffsetRect([goButton_ frame], dX, 0)]; | 709 [goButton_ setFrame:NSOffsetRect([goButton_ frame], dX, 0)]; |
667 NSRect locationFrame = [locationBar_ frame]; | |
668 locationFrame.size.width += dX; | 710 locationFrame.size.width += dX; |
669 [locationBar_ setFrame:locationFrame]; | 711 [locationBar_ setFrame:locationFrame]; |
670 } | 712 } |
671 | 713 |
672 - (NSRect)starButtonInWindowCoordinates { | 714 - (NSRect)starButtonInWindowCoordinates { |
673 return [[[starButton_ window] contentView] convertRect:[starButton_ bounds] | 715 return [[[starButton_ window] contentView] convertRect:[starButton_ bounds] |
674 fromView:starButton_]; | 716 fromView:starButton_]; |
675 } | 717 } |
676 | 718 |
677 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight { | 719 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { | 839 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { |
798 // Do nothing. | 840 // Do nothing. |
799 } | 841 } |
800 | 842 |
801 // (URLDropTargetController protocol) | 843 // (URLDropTargetController protocol) |
802 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 844 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
803 // Do nothing. | 845 // Do nothing. |
804 } | 846 } |
805 | 847 |
806 @end | 848 @end |
OLD | NEW |