ZoomWindow
ZoomWindow Zoom or unzoom a window
#include <Windows.h> Window Manager
void ZoomWindow( theWindow, partCode, front );
WindowPtr theWindow ; window to zoom
short partCode ; obtained from FindWindow
Boolean front ; TRUE=bring window to front, FALSE=don't
ZoomWindow implements window zooming - automatic resizing to a
predefined position and size.
theWindow is a WindowPtr obtained via NewWindow or GetNewWindow.
partCode is a value returned by FindWindow, indicating a mouse-down
while in the zoom box of a window of type zoomDocProc or
zoomNoGrow. It must be one of:
inZoomIn (7) in zoom box while zoomed out (in standard/larger state)
inZoomOut (8) in zoom box while zoomed in (in user/small state)
front is a Boolean value specifying whether to bring theWindow to the
front (as if specified in a SelectWindow call). It is one of:
FALSE Leave the window where it is
TRUE Move window to front and activate it
Returns: none

Notes: This function is used for windows that are capable of being zoomed (that is,
window types of 8 or 12). Normally this implies the use of a zoom box in
the top right corner; however, zooming may be implemented via menu
selection or other mechanism (hint: you must keep track of the current
window in/out state in order to pass the correct partCode ).
Be sure that theWindow is the active GrafPort before calling
ZoomWindow (e.g., use SetPort). To avoid some screen flicker and
redrawing peculiarities, use EraseRect, specifying the portRect of the
window's GrafPort, to clear the entire window before zooming.
The normal sequence is:
NewWindow with wDefProcID =zoomDocProc or zoomNoGrow
GetNextEvent wait for a mouse-down event
FindWindow when return value is inZoomIn or inZoomOut. . .
TrackBox when return value is TRUE. . .
EraseRect ( optional, but best to do) erase the whole window
ZoomWindow zoom or unzoom the window
The zoomed-in and zoomed-out window sizes are stored in a WStateData
structure whose handle is stored in the dataHandle field of the
The WStateData.userState field contains a Rect defining the zoomed-in size.
This field is maintained automatically by the Window Manager and is updated
whenever the window is moved or sized. WStateData.stdState is set to the
initial size of the window and is not changed by the Window Manager.
If you want to modify these fields (e.g., as a step in recreating a window
layout from a previous session in a program), you must store the data
directly. Because of some oddities of the structure definitions and the depth
of in direction, this is not so straightforward. The following code
illustrates:
WindowPeek wPeek; /* pointer to the right kind of structure*/
WStateData *wsdp; /* an aid to the following in direction */
wPeek=(WindowPeek) theWindow;
wsdp = (WStateData *) *(wPeek -> dataHandle);
wsdp -> stdState.top = 80;
wsdp -> stdState.left = 20; /* etc. */
... or ...
SetRect( &(wsdp -> stdState), 20,80, 200,300 );