From 15c24d53a998841b4611d35c1a15daea50f36f81 Mon Sep 17 00:00:00 2001 From: wlux Date: Fri, 8 Oct 2010 06:46:58 +0000 Subject: [PATCH] Send windowControllerWillLoadNib: and windowControllerDidLoadNib: to the owner of the nib, since this is what Apple seems to do and since this behavior is more useful when a non-document class uses a window controller. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31491 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 8 ++++++++ Source/NSWindowController.m | 22 ++++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index ede0335c3..efc82009a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-10-08 Wolfgang Lux + + * Source/NSWindowController.m (-window): Send + windowControllerWillLoadNib: and windowControllerDidLoadNib: to + the owner of the nib, since this is what Apple seems to do and + since this behavior is more useful when a non-document class uses + a window controller. + 2010-09-27 Quentin Mathe Fixed NSOutlineView to use incremental loading as Mac OS X does. diff --git a/Source/NSWindowController.m b/Source/NSWindowController.m index 396e0e207..ba195b679 100644 --- a/Source/NSWindowController.m +++ b/Source/NSWindowController.m @@ -295,22 +295,28 @@ { // Do all the notifications. Yes, the docs say this should // be implemented here instead of in -loadWindow itself. + + // Note: The docs say that windowController{Will,Did}LoadNib: are sent + // to the window controller's document, but Apple's implementation + // really sends them to the owner of the nib. Since this behavior is + // more useful, in particular when non-document classes use a window + // controller, we implement it here too. [self windowWillLoad]; - if ([_document respondsToSelector: - @selector(windowControllerWillLoadNib:)]) + if (_owner != self && + [_owner respondsToSelector: @selector(windowControllerWillLoadNib:)]) { - [_document windowControllerWillLoadNib:self]; + [_owner windowControllerWillLoadNib: self]; } [self loadWindow]; if ([self isWindowLoaded]) { [self _windowDidLoad]; - if ([_document respondsToSelector: - @selector(windowControllerDidLoadNib:)]) - { - [_document windowControllerDidLoadNib:self]; - } + if (_owner != self && + [_owner respondsToSelector: @selector(windowControllerDidLoadNib:)]) + { + [_owner windowControllerDidLoadNib: self]; + } } }