ZoomWindow
ZoomWindow implements window zooming - automatic resizing to a predefined position and size.
partCode is a value returned by FindWindow, indicating a mouse-down while in the zoom box of a window of type zoomDocProc or
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
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 redrawing peculiarities, use EraseRect, specifying the portRect of the window's GrafPort, to clear the entire window before zooming. The normal sequence is:
FindWindow when return value is inZoomIn or inZoomOut. . . EraseRect ( optional, but best to do) erase the whole 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
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 -> stdState.top = 80;
wsdp -> stdState.left = 20; /* etc. */
... or ...
SetRect( &(wsdp -> stdState), 20,80, 200,300 );