Window Creation, Storage, and Disposal

Prior to the Mac OS 8.5 Window Manager, there were two forms of window data: the window structure in memory that is referenced at execution time by a window pointer and the window resource (of type 'WIND' ). With the Mac OS 8.5 Window Manager, there are three forms of window data from which your application can create a window: the live window, the window's collection data, and the window's flattened collection data. See Creating a Window for an example of how your application might use Mac OS 8.5 Window Manager functions to create a window.

A collection is an abstract data type, defined by the Collection Manager, that allows you to store multiple pieces of related information. For purposes of the Window Manager, however, a collection might best be understood as an intermediate state between a live window and a 'wind' resource. Using the Mac OS 8.5 Window Manager, your application can store any window, even those not created with Mac OS 8.5 Window Manager functions, into a collection. You can also store data associated with the window into the same collection. This provides a quick way for your application to save a simple document.

From a collection, your application can create a flattened collection --that is, a stream of address-independent data--using the Collection Manager. Because the 'wind' resource consists of an extensible flattened collection, your application can store a flattened collection consisting of a window and its data into a 'wind' resource using the Resource Manager. Storing a Document Window Into a Collection provides an example of how your application might store a window and its data as a single flattened collection in an extended 'wind' resource.

The Mac OS 8.5 Window Manager provides the following functions to create and store windows:

With the Mac OS 8.5 Window Manager, all references to a window are counted and thereby tracked. As there is only one owner with a reference to a given window when it is first created, windows are created with a reference count (or "owner count") of one. When another owner acquires a reference to a window, the window's reference count increases by one. When an owner stops using a window and releases its reference, the number of references to the window decreases by one. When the reference count reaches zero, the Window Manager automatically disposes of the window.

The Mac OS 8.5 Window Manager provides the following functions for working with references to windows:


� 1999 Apple Computer, Inc. – (Last Updated 18 March 99)