Organization of This Document
See Also
An application displays windows on the screen that must be managed and coordinated. A single window object corresponds to at most one on-screen window. The two principal functions of windows are to provide an area in which views can be placed, and to accept and distribute events the user sends through actions with the mouse and keyboard. The term window sometimes refers to the Application Kit object and sometimes to the Window Server’s window device; which meaning is intended is made clear in context. Panels are a special kind of window, typically serving an auxiliary function in an application, such as utility windows.
This document is intended for Cocoa developers who need to work with windows and panels in their applications.
This programming topic describes how to use windows and panels. These articles give you basic information on the different types of windows and how they work:
“How Windows Work” describes the classes that define objects that manage and coordinate the windows an application displays.
“How a Window is Displayed” describes how window drawing is accomplished.
“How Modal Windows Work” describes the behavior of modal windows.
“How Panels Work” describes the various uses of panels.
“How Window Controllers Work” describes the relationship between a window and its controller.
“Window Layering and Types of Window” describes window layering and the concepts of key and main windows, and how a window can avoid becoming key or main.
“Window Layers and Levels” describes window levels, and how to place a window in a specific level, such as the level for document windows, palettes, or tear-off menus.
These articles describe how to use windows:
“Opening and Closing Windows” describes how to open and close, or just show and hide, a window.
“Sizing and Placing Windows” describes how to control a window’s size and position, including how to set its minimum and maximum size, how to constrain it to the screen, how to cascade it so its title bar remains visible, how to zoom it as though the user pressed the zoom button, and how to center it on the screen.
“Saving A Window’s Position In the User’s Defaults” describes how to store a window’s position in the user defaults system, so that it appears in the same location the next time the user starts the application.
“Miniaturizing Windows” describes how to replace a window with a smaller counterpart in the Dock.
“Using the Windows Menu” describes how to place a window’s name in the Windows menu that appears in most Cocoa applications.
These articles describe how to change what a window looks like:
“Setting a Window’s Appearance” describes how to choose whether to display a window’s peripheral elements, including its title bar, close box, zoom box, or size box. It also describes how to set a window’s background color and transparency,
“Setting a Window’s Title and Represented File” describes how to set a window’s title with either a string or the filename of the window’s represented file.
“Setting Attributes for the Window’s Image” describes how to set attributes for the window’s device, which stores the window’s image, including how the image is stored, when the image is created, and the image’s color depth.
These articles describe how to handle a window’s events:
“Handling Events in Windows” gives basic information on how a window handles events.
“Using Keyboard Interface Control in Windows” describes how to navigate between a window’s fields using the Tab key and how to use the Return and Escape keys to select default buttons.
“Using the Window’s Field Editor” describes how to use the window’s text object, which is shared for light editing tasks.
These articles describe some advanced features of windows:
“Using Window Notifications and Delegate Methods” describes the notifications and delegate methods used when a window gains or loses key or main window status, minimizes, moves or resizes, becomes exposed, or closes.
“Dragging Images to and from Windows” describes what happens when the user wants to drag an object into or out of a window.
“Setting Cursor Rectangles for Windows” describes how windows can define areas where the cursor image changes when the mouse enters them.
“Caching Window Images” describes how to temporarily cache a portion of a window’s image so that it can be restored later. This is useful when highly dynamic drawing must be done over an otherwise static image of the window.
For additional information on specific types of windows and panels, you can also see the following programming topics:
Sheet Programming Topics for Cocoa describes a dialog attached to a specific window, ensuring that a user never loses track of which window the dialog belongs to.
Drawers describes a type of view that slides out from one side of a window.
Toolbar Programming Topics for Cocoa describes a standard way to display a toolbar for a titled window below its title bar and provide users with a way to customize toolbars and save those customizations.
Dialogs and Special Panels describes alert panels and other specialized types of panels, such as Font, Save, and Print panels.
Document-Based Applications Overview describes how to use the architecture supplied by the Application Kit to create applications that can create, open, load, and save multiple document files.
Cocoa Event-Handling Guide discusses the variety of ways your application objects can handle the events they receive.
© 2002, 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-02-04)