set released when closed

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17703 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2003-09-22 21:07:22 +00:00
parent 695a9abf04
commit 4ecf1a67d3
2 changed files with 29 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2003-09-22 Adam Fedor <fedor@gnu.org>
* Source/NSWindowController.m (-setWindow:): Set window's
releaseWhenClosed when document is not nil. Add documentation.
2003-09-21 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSPopUpButtonCell.m

View file

@ -144,6 +144,11 @@
return _owner;
}
/** Sets the document associated with this controller. A document
automatically calls this method when adding a window controller to
its list of window controllers. You should not call this method
directly when using NSWindowController with an NSDocument
or subclass. */
- (void) setDocument: (NSDocument *)document
{
// As the document retains us, we only keep a week reference.
@ -161,7 +166,13 @@
[_window setReleasedWhenClosed: NO];
}
else
[_window setReleasedWhenClosed: YES];
{
/* When a window owned by a document is closed, it is released
and the window controller is removed from the documents
list of controllers.
*/
[_window setReleasedWhenClosed: YES];
}
}
- (id) document
@ -275,6 +286,8 @@
return _window;
}
/** Sets the window that this controller managers to aWindow. The old
window is released. */
- (void) setWindow: (NSWindow *)aWindow
{
NSNotificationCenter *nc;
@ -304,10 +317,17 @@
name: NSWindowWillCloseNotification
object: _window];
/* For information on the following, see the description in
-setDocument: */
if (_document == nil)
{
[_window setReleasedWhenClosed: NO];
}
{
[_window setReleasedWhenClosed: NO];
}
else
{
[_window setReleasedWhenClosed: YES];
}
}
}