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
This commit is contained in:
Richard Frith-MacDonald 1999-01-09 21:43:09 +00:00
parent 28711509a7
commit 2d23c8e038
2 changed files with 24 additions and 17 deletions

View file

@ -1,3 +1,8 @@
Sat Jan 9 21:10:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* 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 <richard@brainstorm.co.uk>
* Source/NSApplication.m: ([-run]) reorganize so that the app can be

View file

@ -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.
}
//