Instance Method

addWindowController:

Adds the specified window controller to this document’s list of attached window controllers and sets the document of the passed-in window controller.

Declaration

- (void)addWindowController:(NSWindowController *)windowController;

Parameters

aController

The window controller that is added.

Discussion

An NSDocument object uses its list of window controllers when it displays all document windows, sets window edited status upon an undo or redo operation, and modifies window titles. If you create window controllers by overriding windowNibName, this method is invoked automatically. If you create window controllers in makeWindowControllers or in any other context, such as in apps that present multiple windows per document, you should invoke this method for each window controller created.

You cannot attach a window controller to more than one document at a time. The default implementation of this method removes the passed-in window controller from the document to which it is attached, if it is already attached to one, then sends it a document message with self as the argument. It also ignores redundant invocations.

You would not typically override this method.

See Also

Creating and Managing Window Controllers

- makeWindowControllers

Subclasses may override this method to create the initial window controller(s) for the document.

windowNibName

The name of the document’s sole nib file.

- windowControllerDidLoadNib:

Sent after the specified window controller loads a nib file if the receiver is the nib file’s owner.

- windowControllerWillLoadNib:

Sent before the specified window controller loads a nib file if the receiver is the nib file’s owner.

windowControllers

The document’s current window controllers.

- removeWindowController:

Removes the specified window controller from the receiver’s array of window controllers.

- shouldCloseWindowController:delegate:shouldCloseSelector:contextInfo:

Invokes shouldCloseSelector with the result of canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo: if the specified window controller that is closing is the last one or is marked as causing the document to close.