Introduction
An application displays windows on the screen that must be managed and coordinated. A 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.
Organization of This Document
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 Windows 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.
Setting Window Collection Behavior describes how to set a window’s behavior with Spaces, Exposé, and window cycles.
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 into 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.
Minimizing Windows describes how to replace a window with a smaller counterpart in the Dock.
Using the Window 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.
Updating the Cursor Image in a Window directs you to information on how to change the cursor image when the cursor is over a specified area in a view.
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.
See Also
For additional information on specific types of windows and panels, you can also see the following programming topics:
Sheet Programming Topics describes a dialog attached to a specific window, ensuring that a user never loses track of which window the dialog belongs to.
Drawer Programming Topics 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 App Programming Guide for Mac describes how to use the architecture supplied by AppKit 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.
Copyright © 2002, 2009 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2009-11-27