Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Macintosh Toolbox Essentials /
Chapter 4 - Window Manager / Window Manager Reference
Application-Defined Routine


The Window Definition Function

If your application defines its own window types, you must supply your own window definition function to handle them. Store your definition function as a resource of type 'WDEF' with an ID from 128 through 4096. (Window definition function resource IDs 0 and 1 are the default window definition functions; resource IDs 2 through 127 are reserved by Apple Computer, Inc.)

Your window definition function can support up to 16 variation codes, which are identified by integers 0 through 15. To invoke your own window type, you specify the window's definition ID, which contains the resource ID of the window's definition function in the upper 12 bits and the variation code in the lower 4 bits. Thus, for a given resource ID and variation code, the window definition ID is

(16 * resource ID) + (variation code)

When you create a window, the Window Manager calls the Resource Manager to access the window definition function. The Resource Manager reads the window definition function into memory and returns a handle to it. The Window Manager stores this handle in the windowDefProc field of the window record. (If 24-bit addressing is in effect, the Window Manager stores the variation code in the lower 4 bits of the windowDefProc field; if 32-bit addressing is in effect, the Window Manager stores the variation code elsewhere.) Later, when it needs to perform a type-dependent action on the window, the Window Manager calls the window definition function and passes it the variation code as a parameter.


Subtopics
MyWindow

Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996