Protocol

NSWindowDelegate

A set of optional methods that a delegate of NSWindow can implement to respond to events, such as window resizing, moving, exposing, and minimizing.

Declaration

@protocol NSWindowDelegate

Topics

Managing Sheets

- window:willPositionSheet:usingRect:

Tells the delegate that the window is about to show a sheet at the specified location, giving it the opportunity to return a custom location for the attachment of the sheet to the window.

- windowWillBeginSheet:

Notifies the delegate that the window is about to open a sheet.

- windowDidEndSheet:

Tells the delegate that the window has closed a sheet.

Sizing Windows

- windowWillResize:toSize:

Tells the delegate that the window is being resized (whether by the user or through one of the setFrame... methods other than setFrame:display:).

- windowDidResize:

Tells the delegate that the window has been resized.

- windowWillStartLiveResize:

Tells the delegate that the window is about to be live resized.

- windowDidEndLiveResize:

Tells the delegate that a live resize operation on the window has ended.

Minimizing Windows

- windowWillMiniaturize:

Tells the delegate that the window is about to be minimized.

- windowDidMiniaturize:

Tells the delegate that the window has been minimized.

- windowDidDeminiaturize:

Tells the delegate that the window has been deminimized.

Zooming Window

- windowWillUseStandardFrame:defaultFrame:

Called by NSWindow’s zoom: method while determining the frame a window may be zoomed to.

- windowShouldZoom:toFrame:

Asks the delegate whether the specified window should zoom to the specified frame.

Managing Full-Screen Presentation

- window:willUseFullScreenContentSize:

Called to allow the delegate to modify the full-screen content size.

- window:willUseFullScreenPresentationOptions:

Returns the presentation options the window uses when transitioning to full-screen mode.

- windowWillEnterFullScreen:

The window is about to enter full-screen mode.

- windowDidEnterFullScreen:

The window has entered full-screen mode.

- windowWillExitFullScreen:

The window is about to exit full-screen mode.

- windowDidExitFullScreen:

The window has left full-screen mode.

Custom Full-Screen Presentation Animations

- customWindowsToEnterFullScreenForWindow:

Called when the window is about to enter full-screen mode.

- customWindowsToEnterFullScreenForWindow:onScreen:

Called when the window is about to enter full-screen mode.

- window:startCustomAnimationToEnterFullScreenWithDuration:

This method is called to start the window animation into full-screen mode, including transitioning to a new space.

- window:startCustomAnimationToEnterFullScreenOnScreen:withDuration:

This method is called to start the window animation into full-screen mode, including transitioning to a new space.

- windowDidFailToEnterFullScreen:

Called if the window failed to enter full-screen mode.

- customWindowsToExitFullScreenForWindow:

Called when the window is about to exit full-screen mode.

- window:startCustomAnimationToExitFullScreenWithDuration:

This method is called to start the window animation out of full-screen mode, including transitioning back to the desktop space.

- windowDidFailToExitFullScreen:

Called if the window failed to exit full-screen mode.

Moving Windows

- windowWillMove:

Tells the delegate that the window is about to move.

- windowDidMove:

Tells the delegate that the window has moved.

- windowDidChangeScreen:

Tells the delegate that the window has changed screens.

- windowDidChangeScreenProfile:

Tells the delegate that the window has changed screen display profiles.

- windowDidChangeBackingProperties:

Tells the delegate that the window backing properties changed.

Closing Windows

- windowShouldClose:

Tells the delegate that the user has attempted to close a window or the window has received a performClose: message.

- windowWillClose:

Tells the delegate that the window is about to close.

Managing Key Status

- windowDidBecomeKey:

Tells the delegate that the window has become the key window.

- windowDidResignKey:

Tells the delegate that the window has resigned key window status.

Managing Main Status

- windowDidBecomeMain:

Tells the delegate that the window has become main.

- windowDidResignMain:

Tells the delegate that the window has resigned main window status.

Managing Field Editors

- windowWillReturnFieldEditor:toObject:

Tells the delegate that the field editor for a text-displaying object has been requested.

Updating Windows

- windowDidUpdate:

Tells the delegate that the window received an update message.

Exposing Windows

- windowDidExpose:

Tells the delegate that the window has been exposed.

Managing Occlusion State

- windowDidChangeOcclusionState:

Tells the delegate that the window changed its occlusion state.

Dragging Windows

- window:shouldDragDocumentWithEvent:from:withPasteboard:

Asks the delegate whether a user can drag the document icon from the window’s title bar.

Getting the Undo Manager

- windowWillReturnUndoManager:

Tells the delegate that the window’s undo manager has been requested. Returns the appropriate undo manager for the window.

Managing Titles

- window:shouldPopUpDocumentPathMenu:

Asks the delegate whether the window displays the title pop-up menu in response to a Command-click or Control-click on its title.

Managing Restorable State

- window:willEncodeRestorableState:

Tells the delegate the window is about to add its restorable state to a given archiver.

- window:didDecodeRestorableState:

Tells the delegate the window is has extracted its restorable state from a given archiver.

Managing Presentation in Version Browsers

- window:willResizeForVersionBrowserWithMaxPreferredSize:maxAllowedSize:

Tells the delegate the window will resize for presentation during version browsing.

- windowWillEnterVersionBrowser:

Tells the delegate the window is about to enter version browsing.

- windowDidEnterVersionBrowser:

Tells the delegate that the window has entered version browsing.

- windowWillExitVersionBrowser:

Tells the delegate that the window is about to leave version browsing.

- windowDidExitVersionBrowser:

Tells the delegate that the window has left version browsing.

Relationships

Inherits From

See Also

Windows

NSWindow

A window that an app displays on the screen.

NSPanel

A special kind of window that typically performs a function that is auxiliary to the main window.

NSWindowTab

A tab associated with a window that is part of a tabbing group.

NSWindowTabGroup

A group of windows that display together as a single tabbed window.