aboutsummaryrefslogtreecommitdiff
path: root/AppKit/GTMUILocalizerAndLayoutTweaker.m
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2009-09-16 16:30:26 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2009-09-16 16:30:26 +0000
commit9ebf8b15cfb105864e97a0e8b005de8e6e5d5c42 (patch)
tree504cf51b686c9da2a2fc97d03bc445f0e2f4bd97 /AppKit/GTMUILocalizerAndLayoutTweaker.m
parent77abbd0120948a146cf4646e619c211f306486d5 (diff)
[Author: thomasvl]
add a helper for resizing a window without the subview resizing. R=stuartmorgan DELTA=32 (32 added, 0 deleted, 0 changed)
Diffstat (limited to 'AppKit/GTMUILocalizerAndLayoutTweaker.m')
-rw-r--r--AppKit/GTMUILocalizerAndLayoutTweaker.m24
1 files changed, 24 insertions, 0 deletions
diff --git a/AppKit/GTMUILocalizerAndLayoutTweaker.m b/AppKit/GTMUILocalizerAndLayoutTweaker.m
index cae8a02..c79bfa1 100644
--- a/AppKit/GTMUILocalizerAndLayoutTweaker.m
+++ b/AppKit/GTMUILocalizerAndLayoutTweaker.m
@@ -104,6 +104,30 @@ static BOOL IsRightAnchored(NSView *view);
return newSize.height - NSHeight(initialFrame);
}
++ (void)resizeWindowWithoutAutoResizingSubViews:(NSWindow*)window
+ delta:(NSSize)delta {
+ NSView *contentView = [window contentView];
+
+ // Clear autosizesSubviews (saving the state).
+ BOOL autoresizesSubviews = [contentView autoresizesSubviews];
+ if (autoresizesSubviews) {
+ [contentView setAutoresizesSubviews:NO];
+ }
+
+ NSRect rect = [window frame];
+ rect.size.width += delta.width;
+ rect.size.height += delta.height;
+ [window setFrame:rect display:NO];
+ // For some reason the content view is resizing, but some times not adjusting
+ // its origin, so correct it manually.
+ [contentView setFrameOrigin:NSMakePoint(0, 0)];
+
+ // Restore autosizesSubviews.
+ if (autoresizesSubviews) {
+ [contentView setAutoresizesSubviews:YES];
+ }
+}
+
@end
@implementation GTMWidthBasedTweaker