home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-07-11 | 1023 b | 67 lines | [TEXT/CWIE] |
- /*************************************************************************************************
- *
- *
- * MacZoop - "the framework for the rest of us"
- *
- *
- *
- * ZGrafState.cp -- a simple object for saving and restoring grafport state
- *
- *
- * © 1997, Graham Cox
- *
- *
- *
- *************************************************************************************************/
-
- #include "ZGrafState.h"
- #include <QDOffscreen.h>
-
- ZGrafState::ZGrafState()
- {
- clip = NewRgn();
-
- Record();
- }
-
-
-
- ZGrafState::~ZGrafState()
- {
- Restore();
-
- DisposeRgn( clip );
- }
-
-
- void ZGrafState::Record()
- {
- GetGWorld( &port, &dev );
- GetClip( clip );
- GetPenState( &pen );
- GetBackColor( &back );
- GetForeColor( &fore );
-
- font = port->txFont;
- fSize = port->txSize;
- fStyle = port->txFace;
- fMode = port->txMode;
- }
-
-
- void ZGrafState::Restore()
- {
- SetGWorld( port, dev );
- SetClip( clip );
-
- SetPenState( &pen );
- RGBForeColor( &fore );
- RGBBackColor( &back );
-
- TextFont( font );
- TextSize( fSize );
- TextFace( fStyle );
- TextMode( fMode );
- }
-
-