home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-05-19 | 2.1 KB | 80 lines | [TEXT/CWIE] |
- // =================================================================================
- // CGWorldPane.cp ©1997 BB's Team Inc. All rights reserved
- // =================================================================================
- #include "PL_Utils.h"
- #include "CGWorldPane.h"
-
- #include "UDrawingState.h"
-
-
- // ---------------------------------------------------------------------------------
- // • CreateGWorldPaneStream [static]
- // ---------------------------------------------------------------------------------
-
- CGWorldPane *
- CGWorldPane::CreateGWorldPaneStream(
- LStream *inStream )
- {
- return new CGWorldPane (inStream);
- }
-
-
- // ---------------------------------------------------------------------------------
- // • CGWorldPane(LStream*)
- // ---------------------------------------------------------------------------------
-
- CGWorldPane::CGWorldPane (LStream *inStream )
- : LPane (inStream), mGW(nil)
- {
- }
-
-
- // ---------------------------------------------------------------------------------
- // • ~CGWorldPane
- // ---------------------------------------------------------------------------------
-
- CGWorldPane::~CGWorldPane()
- {
- }
-
-
- // ---------------------------------------------------------------------------------
- // • SetGWorld
- // ---------------------------------------------------------------------------------
- void
- CGWorldPane::SetGWorld (GWorldPtr inGW)
- {
- mGW = inGW;
- Refresh ();
- }
-
-
- // ---------------------------------------------------------------------------------
- // • DrawSelf
- // ---------------------------------------------------------------------------------
- void
- CGWorldPane::DrawSelf()
- {
- Rect theFrame;
-
- CalcLocalFrameRect( theFrame );
- ::InsetRect (&theFrame, 2, 2);
-
- StColorState::Normalize(); // also wanted by CopyBits
- ::EraseRect (&theFrame);
-
- if (mGW) {
- PixMapHandle thePM;
- thePM = ::GetGWorldPixMap (mGW);
-
- Rect theDisplayRect;
- theDisplayRect = (**thePM).bounds;
-
- PL_Utils::FitRect (&theDisplayRect, theFrame);
- PL_Utils::CenterRect (&theDisplayRect, theFrame);
-
- ::CopyBits ((BitMap*)*thePM, &GetMacPort()->portBits,
- &(**thePM).bounds, &theDisplayRect, srcCopy, nil);
- }
- }
-