WindowRecord
#include <Windows.h>
GrafPort port; 108 0 portBits, portRect, pnSize,txFont, etc....
short windowKind; 2 108 holds dialogKind, userKind, or
negative refnum of DA.
Boolean visible; 1 110 TRUE if window is visible Boolean hilited; 1 111 TRUE if window hilited Boolean goAwayFlag; 1 112 TRUE if window has a close box in top left
Boolean spareFlag; 1 113 TRUE=zoom is enabled RgnHandle strucRgn; 4 114 Content region plus the frame ( global coords)
RgnHandle contRgn; 4 118 Content rgn, including scroll bars ( global)
RgnHandle updateRgn; 4 122 Area needing update,(local) Handle windowDefProc; 4 126 Code to draw the window ('WDEF') Handle dataHandle; 4 130 Additional info; may lead to a short titleWidth; 2 138 Width, in pixels, of the window title
text
WindowPeek nextWindow; 4 144 The window behind this one (0 if this
is last)
typedef WindowRecord *WindowPeek; /* use WindowPeek to access these fields */
Notes: A WindowPeek (ie, the address of a WindowRecord) is used in nearly all
Window Manager calls.
The port field is a GrafPort (all 108 bytes of it). It contains such important items as the size and location of the window, the text font and
display attributes, etc.
The windowKind field identifies which of the standard or user- defined
window definition routines will draw the window.
Note: For desk accessories, windowKind contains the driver reference number (a negative value). This affects how DAs must handle calls to
The dataHandle field may contain either four bytes of data (as used in
rDocProc type windows), or a handle to additional data needed by the
window definition procedure. In the case of zoomable window types,
The nextWindow field contains the address of the next WindowRecord in the
Window Manager's list. The global variable WindowList (at 0x09D6)
contains the address of the first (frontmost) window in that list.
Notice that a WindowRecord begins with a GrafPort. Similarly, a DialogRecord begins with a WindowRecord (and thus begins with a inter changeably when you pass a pointer to a function which expects a
subset:
To access the additional fields of a WindowRecord structure, create a
WindowPeek variable:
WindowPtr myWin;
WindowPeek myWinPeek = (WindowPeek) myWin;
myWin->txFont = geneva; // access GrafPort fields myWinPeek-> windowKind = dBoxProc; // access WindowRecord fields
To query the contents of a field, you can use "quick-and-dirty" type
coercion:
aLong = ((WindowPeek)myWin)->refCon;