Window Manager Toolset - NewWindow
Purpose: Creates and registers a Window Manager window.
The value returned is a pointer to the new window’s GrafPort.
C usage:
#include <Window.h>
GrafPortPtr NewWindow(ParamListPtr paramListPtr);
Original documentation
Apple IIGS Toolbox Reference, Volume 2, p. 25-83 to 25-88
Apple Programmer’s Workshop <Window.h>
Mark Andrews, Programming the Apple IIGS, pp. 253-260, 287-290
Parameter structure:
typedef struct ParamList {
Word paramLength;
Word wFrameBits;
Pointer wTitle;
LongWord wRefCon;
Rect wZoom;
WindColorPtr wColor;
Word wYOrigin;
Word wXOrigin;
Word wDataH;
Word wDataW;
Word wMaxH;
Word wMaxW;
Word wScrollVer;
Word wScrollHor;
Word wPageVer;
Word wPageHor;
LongWord wInfoRefCon;
Word wInfoHeight;
LongProcPtr wFrameDefProc;
VoidProcPtr wInfoDefProc;
VoidProcPtr wContDefProc;
Rect wPosition;
WindowPtr wPlane;
WindRecPtr wStorage;
} ParamList, *ParamListPtr, **ParamListHndl;
Minimal example
ParamList template;
memset(&template, 0, sizeof(ParamList));
template.paramLength = sizeof(ParamList);
template.wFrameBits = fQContent + fMove + fZoom + fGrow + fBScroll + fRScroll + fClose + fTitle;
template.wTitle = "\pNew window example";
template.wDataH = 200;
template.wDataW = 320;
template.wMaxH = 200;
template.wMaxW = 320;
template.wPlane = -1L; /* topmost plane */
template.wPosition.v1 = 0;
template.wPosition.h1 = 20;
template.wPosition.v2 = 320;
template.wPosition.h2 = 200;
GrafPortPtr windowPort = NewWindow(&template);
Important requirements
- Initialize the ParamList before filling it.
- Set paramLength = sizeof(ParamList).
- Set wPosition to the initial window rectangle.
- Select the desired wFrameBits.
- If you leave wStorage set to 0, the Window Manager will allocate the record.
wFrame Field Bits
The wFrame field is the sum of values chosen from below.
| Macro | Value | Description |
|---|---|---|
| fHilited | 0x0001 | Window is highlighted. |
| fZoomed | 0x0002 | Window is zoomed. |
| fAllocated | 0x0004 | Window record was allocated. |
| fCtlTie | 0x0008 | Window state tied to controls. |
| fInfo | 0x0010 | Window has an information bar. |
| fVis | 0x0020 | Window is visible. |
| fQContent | 0x0040 | Return wInContent even if window is inactive |
| fMove | 0x0080 | Window is movable. |
| fZoom | 0x0100 | Window is zoomable. |
| fFlex | 0x0200 | GrowWindow and ZoomWindow will not change the origin |
| fGrow | 0x0400 | Window has grow box. |
| fBScroll | 0x0800 | Window has horizontal scroll bar. |
| fRScroll | 0x1000 | Window has vertical scroll bar. |
| fAlert | 0x2000 | Window has alert type frame. |
| fClose | 0x4000 | Window has a close box. |
| fTitle | 0x8000 | Window has a title bar. |