From 4e5406e6bb416d20f4262314280c2b9087e8f71d Mon Sep 17 00:00:00 2001 From: "thomasvl@chromium.org" Date: Wed, 14 Oct 2009 16:59:41 +0000 Subject: Updates for Under the Hood prefs from Cole: - Make the scroller the width of the window. - Resize the content so any wrapping text fields have the full width. - Tweak the scroller so only bot bottom border shows. BUG=20538 TEST=Under the hood prefs scroller is the width of the window and goes to the bottom of the toolbar. Review URL: http://codereview.chromium.org/276019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28973 0039d316-1c4b-4281-b951-d872f2087c98 --- .../browser/cocoa/preferences_window_controller.mm | 24 +++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'chrome/browser/cocoa') diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm index 11aa419..6227d09 100644 --- a/chrome/browser/cocoa/preferences_window_controller.mm +++ b/chrome/browser/cocoa/preferences_window_controller.mm @@ -177,20 +177,30 @@ class PrefObserverBridge : public NotificationObserver { } - (void)awakeFromNib { - // Put the advanced view into the scroller and scroll it to the top. - [advancedScroller_ setDocumentView:advancedView_]; - NSInteger height = [advancedView_ bounds].size.height; - [advancedView_ scrollPoint:NSMakePoint(0, height)]; + NSRect underTheHoodFrame = [underTheHoodView_ frame]; // Make sure the window is wide enough to fit the the widest view - CGFloat widest = std::max([basicsView_ frame].size.width, - [personalStuffView_ frame].size.width); - widest = std::max(widest, [underTheHoodView_ frame].size.width); + CGFloat widest = std::max(NSWidth([basicsView_ frame]), + NSWidth([personalStuffView_ frame])); + widest = std::max(widest, NSWidth(underTheHoodFrame)); NSWindow* prefsWindow = [self window]; NSRect frame = [prefsWindow frame]; frame.size.width = widest; [prefsWindow setFrame:frame display:NO]; + // The Under the Hood prefs is a scroller, it shouldn't get any border, so it + // gets resized to the as wide as the window ends up. + underTheHoodFrame.size.width = widest; + [underTheHoodView_ setFrame:underTheHoodFrame]; + // Widen the Under the Hood content so things can rewrap + NSSize advancedContentSize = [advancedView_ frame].size; + advancedContentSize.width = [advancedScroller_ contentSize].width; + [advancedView_ setFrameSize:advancedContentSize]; + + // Put the advanced view into the scroller and scroll it to the top. + [advancedScroller_ setDocumentView:advancedView_]; + [advancedView_ scrollPoint:NSMakePoint(0, advancedContentSize.height)]; + // Adjust the view origins so they show up centered. CenterViewForWidth(basicsView_, widest); CenterViewForWidth(personalStuffView_, widest); -- cgit v1.1