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]; + } } }