Most Cocoa applications include the Windows menu, which displays the titles of various of the application’s windows. When you change a window’s title, this change is automatically reflected in the Windows menu. This menu automatically lists windows that have a title bar and are resizable and that can become the main window (as described in “Window Layering and Types of Window”). Typically you can rely on the automatic updating provided by Cocoa. In rare circumstances, however, you might want to modify the default behavior.
You can exclude a window that would otherwise be listed in the Windows menu by sending it a setExcludedFromWindowsMenu:YES
message. Since they cannot become main, NSPanel
objects are excluded from the Windows menu. Instances of subclasses of NSPanel
can be included in the menu by returning NO
for the isExcludedFromWindowsMenu
message and YES
for the canBecomeMainWindow
message. If you change a window’s configuration such that it should be added to or removed from the Windows menu, you can update the Windows menu by sending the shared application instance addWindowsItem:title:filename:
or removeWindowsItem:
.
© 2002, 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-02-04)