From b4c33e24030bac79220bcfb4ec65dc8547de919e Mon Sep 17 00:00:00 2001 From: richard Date: Sat, 9 Jan 1999 21:43:09 +0000 Subject: [PATCH] Fixed [NSWindow -setContentView:] method to make view fill window. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3554 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/NSWindow.m | 36 +++++++++++++++++++----------------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index bf709cc68..267f03d0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Jan 9 21:10:00 1999 Richard Frith-Macdonald + + * Source/NSWindow.m: ([-setcontentView:]) Corrected to resize the + new content view to fill the window. + Sat Jan 9 6:10:00 1999 Richard Frith-Macdonald * Source/NSApplication.m: ([-run]) reorganize so that the app can be diff --git a/Source/NSWindow.m b/Source/NSWindow.m index a44ecba33..ea5bd9797 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -205,30 +205,32 @@ NSRect cframe; - (void)setContentView:(NSView *)aView { -NSView *wv; + NSView *wv; - if (!aView) // contentview can't be nil - aView = [[[NSView alloc] initWithFrame: frame] autorelease]; - // If window view has not + if (!aView) // contentview can't be nil + aView = [[[NSView alloc] initWithFrame: frame] autorelease]; + // If window view has not // been created, create it - if ((!content_view) || ([content_view superview] == nil)) - { - wv = [NSWindow _windowViewWithFrame: frame]; - [wv viewWillMoveToWindow: self]; - } - else - wv = [content_view superview]; + if ((!content_view) || ([content_view superview] == nil)) + { + wv = [NSWindow _windowViewWithFrame: frame]; + [wv viewWillMoveToWindow: self]; + } + else + wv = [content_view superview]; - if (content_view) - [content_view removeFromSuperview]; + if (content_view) + [content_view removeFromSuperview]; - ASSIGN(content_view, aView); + ASSIGN(content_view, aView); - [wv addSubview: content_view]; // Add to our window view - NSAssert1 ([[wv subviews] count] == 1, @"window's view has %d subviews!", + [content_view setFrame: [wv frame]]; // Resize to fill window. + [wv addSubview: content_view]; // Add to our window view + NSAssert1 ([[wv subviews] count] == 1, @"window's view has %d subviews!", [[wv subviews] count]); // Make self the view's - [content_view setNextResponder:self]; // next responder + [content_view setNextResponder:self]; // next responder + [content_view setNeedsDisplay: YES]; // Make sure we redraw. } //