diff options
author | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-15 20:51:55 +0000 |
---|---|---|
committer | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-15 20:51:55 +0000 |
commit | dfb6089698f447ef9d564e0222a8137b0c017321 (patch) | |
tree | c7eee1bd27855fb90659815eef2ff5ca3eee2c2c | |
parent | 2c49511423700ea206402a5d2a55daa65cb1bd3d (diff) | |
download | chromium_src-dfb6089698f447ef9d564e0222a8137b0c017321.zip chromium_src-dfb6089698f447ef9d564e0222a8137b0c017321.tar.gz chromium_src-dfb6089698f447ef9d564e0222a8137b0c017321.tar.bz2 |
Cocoa: Fix clipping issue in search engine protector
GlobalErrorBubble.xib Changes: Hooked up the new layoutTweaker_ and buttonContainer_ outlet. Made the GTMWidthBasedTweaker slightly wider so that if the bubble was expanded there would be some extra padding on the left side.
BUG=100854
TEST=Hard coded some long titles for the accept and cancel buttons. Verified that they were no longer clipped. Hard coded short titles and verified that the buttons looked the same as before.
Review URL: http://codereview.chromium.org/8447014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110161 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/nibs/GlobalErrorBubble.xib | 77 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/global_error_bubble_controller.h | 4 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/global_error_bubble_controller.mm | 15 |
3 files changed, 78 insertions, 18 deletions
diff --git a/chrome/app/nibs/GlobalErrorBubble.xib b/chrome/app/nibs/GlobalErrorBubble.xib index 1c3a9e6..ea02768 100644 --- a/chrome/app/nibs/GlobalErrorBubble.xib +++ b/chrome/app/nibs/GlobalErrorBubble.xib @@ -2,17 +2,17 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">10F2521</string> - <string key="IBDocument.InterfaceBuilderVersion">823</string> - <string key="IBDocument.AppKitVersion">1038.29</string> + <string key="IBDocument.SystemVersion">10K549</string> + <string key="IBDocument.InterfaceBuilderVersion">851</string> + <string key="IBDocument.AppKitVersion">1038.36</string> <string key="IBDocument.HIToolboxVersion">461.00</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> - <string key="NS.object.0">823</string> + <string key="NS.object.0">851</string> </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="71"/> + <integer value="4"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -65,7 +65,7 @@ <object class="NSButton" id="888011893"> <reference key="NSNextResponder" ref="755607118"/> <int key="NSvFlags">289</int> - <string key="NSFrame">{{5, -3}, {96, 32}}</string> + <string key="NSFrame">{{16, -3}, {96, 32}}</string> <reference key="NSSuperview" ref="755607118"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="943193880"> @@ -89,7 +89,7 @@ <object class="NSButton" id="487768874"> <reference key="NSNextResponder" ref="755607118"/> <int key="NSvFlags">289</int> - <string key="NSFrame">{{101, -3}, {96, 32}}</string> + <string key="NSFrame">{{112, -3}, {96, 32}}</string> <reference key="NSSuperview" ref="755607118"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="1030439829"> @@ -107,7 +107,7 @@ </object> </object> </object> - <string key="NSFrame">{{69, 7}, {203, 28}}</string> + <string key="NSFrame">{{59, 8}, {214, 28}}</string> <reference key="NSSuperview" ref="301729179"/> <string key="NSClassName">GTMWidthBasedTweaker</string> </object> @@ -318,6 +318,22 @@ </object> <int key="connectionID">73</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">buttonContainer_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="755607118"/> + </object> + <int key="connectionID">74</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">layoutTweaker_</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="684547419"/> + </object> + <int key="connectionID">75</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -509,10 +525,10 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{702, 986}, {273, 121}}</string> + <string>{{664, 988}, {273, 121}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <boolean value="YES"/> - <string>{{702, 986}, {273, 121}}</string> + <string>{{664, 988}, {273, 121}}</string> <boolean value="NO"/> <string>{196, 240}</string> <string>{{357, 418}, {480, 270}}</string> @@ -520,9 +536,7 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <object class="NSAffineTransform"> - <bytes key="NSTransformStruct">AQAAAABDAgAAA</bytes> - </object> + <object class="NSAffineTransform"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <object class="NSAffineTransform"> <bytes key="NSTransformStruct">AUJEAABDNgAAA</bytes> @@ -549,7 +563,7 @@ </object> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <object class="NSAffineTransform"> - <bytes key="NSTransformStruct">AUKKAABBEAAAA</bytes> + <bytes key="NSTransformStruct">AUKOAABBAAAAA</bytes> </object> </object> </object> @@ -569,7 +583,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">73</int> + <int key="maxID">75</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -772,6 +786,25 @@ <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> + <string key="className">BaseBubbleController</string> + <string key="superclassName">NSWindowController</string> + <object class="NSMutableDictionary" key="outlets"> + <string key="NS.key.0">bubble_</string> + <string key="NS.object.0">InfoBubbleView</string> + </object> + <object class="NSMutableDictionary" key="toOneOutletInfosByName"> + <string key="NS.key.0">bubble_</string> + <object class="IBToOneOutletInfo" key="NS.object.0"> + <string key="name">bubble_</string> + <string key="candidateClassName">InfoBubbleView</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBDocumentRelativeSource</string> + <string key="minorKey">../../browser/ui/cocoa/base_bubble_controller.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> <string key="className">GlobalErrorBubbleController</string> <string key="superclassName">BaseBubbleController</string> <object class="NSMutableDictionary" key="actions"> @@ -811,16 +844,20 @@ <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>acceptButton_</string> + <string>buttonContainer_</string> <string>cancelButton_</string> <string>iconView_</string> + <string>layoutTweaker_</string> <string>message_</string> <string>title_</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>NSButton</string> + <string>GTMWidthBasedTweaker</string> <string>NSButton</string> <string>NSImageView</string> + <string>GTMUILocalizerAndLayoutTweaker</string> <string>NSTextField</string> <string>NSTextField</string> </object> @@ -830,8 +867,10 @@ <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>acceptButton_</string> + <string>buttonContainer_</string> <string>cancelButton_</string> <string>iconView_</string> + <string>layoutTweaker_</string> <string>message_</string> <string>title_</string> </object> @@ -842,6 +881,10 @@ <string key="candidateClassName">NSButton</string> </object> <object class="IBToOneOutletInfo"> + <string key="name">buttonContainer_</string> + <string key="candidateClassName">GTMWidthBasedTweaker</string> + </object> + <object class="IBToOneOutletInfo"> <string key="name">cancelButton_</string> <string key="candidateClassName">NSButton</string> </object> @@ -850,6 +893,10 @@ <string key="candidateClassName">NSImageView</string> </object> <object class="IBToOneOutletInfo"> + <string key="name">layoutTweaker_</string> + <string key="candidateClassName">GTMUILocalizerAndLayoutTweaker</string> + </object> + <object class="IBToOneOutletInfo"> <string key="name">message_</string> <string key="candidateClassName">NSTextField</string> </object> diff --git a/chrome/browser/ui/cocoa/global_error_bubble_controller.h b/chrome/browser/ui/cocoa/global_error_bubble_controller.h index 63e5605..9c61c8b 100644 --- a/chrome/browser/ui/cocoa/global_error_bubble_controller.h +++ b/chrome/browser/ui/cocoa/global_error_bubble_controller.h @@ -11,6 +11,8 @@ #import "chrome/browser/ui/cocoa/base_bubble_controller.h" class GlobalError; +@class GTMUILocalizerAndLayoutTweaker; +@class GTMWidthBasedTweaker; // This is a bubble view shown from the wrench menu to display information // about a global error. @@ -24,6 +26,8 @@ class GlobalError; IBOutlet NSTextField* message_; IBOutlet NSButton* acceptButton_; IBOutlet NSButton* cancelButton_; + IBOutlet GTMUILocalizerAndLayoutTweaker* layoutTweaker_; + IBOutlet GTMWidthBasedTweaker* buttonContainer_; } - (IBAction)onAccept:(id)sender; diff --git a/chrome/browser/ui/cocoa/global_error_bubble_controller.mm b/chrome/browser/ui/cocoa/global_error_bubble_controller.mm index 1691e7e..1315e08 100644 --- a/chrome/browser/ui/cocoa/global_error_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/global_error_bubble_controller.mm @@ -16,6 +16,7 @@ #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" #import "chrome/browser/ui/global_error.h" #include "grit/generated_resources.h" +#import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image.h" @@ -66,13 +67,21 @@ const CGFloat kWrenchBubblePointOffsetY = 6; else [cancelButton_ setTitle:SysUTF16ToNSString(cancelLabel)]; - // Adapt window size to bottom buttons. Do this before all other layouting. + // First make sure that the window is wide enough to accomidate the buttons. + NSRect frame = [[self window] frame]; + [layoutTweaker_ tweakUI:buttonContainer_]; + CGFloat delta = NSWidth([buttonContainer_ frame]) - NSWidth(frame); + if (delta > 0) { + frame.size.width += delta; + [[self window] setFrame:frame display:NO]; + } + + // Adapt window height to bottom buttons. Do this before all other layouting. NSArray* views = [NSArray arrayWithObjects: - title_, message_, [acceptButton_ superview], nil]; + title_, message_, buttonContainer_, nil]; NSSize ds = NSMakeSize(0, cocoa_l10n_util::VerticallyReflowGroup(views)); ds = [[self bubble] convertSize:ds toView:nil]; - NSRect frame = [[self window] frame]; frame.origin.y -= ds.height; frame.size.height += ds.height; [[self window] setFrame:frame display:YES]; |