home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / mac / UserInterface / CGWorld.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.2 KB  |  108 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  20. //
  21. //    This is a replacement class for PowerPlant's LGWorld.  It allows for the
  22. //    resizing and reorienting of the offscreen world, which LGWorld won't let
  23. //    you do.  Because the CGWorld can be updated, the pixmap can be made
  24. //    purgeable by passing in the pixPurge flag in the constructor.  LGWorld
  25. //    would let you do this, however, if the pixels ever got purged you'd be
  26. //    completely hosed.
  27. //
  28. //    This class has ben submitted to metrowerks for a potential replacement
  29. //    of LGWorld.  In the event that metrowerks adds the extended functionality
  30. //    that CGWorld offers, we can make this module obsolete.
  31. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  32.  
  33. #pragma once
  34.  
  35. #include <LSharable.h>
  36.  
  37. #ifndef __QDOFFSCREEN__
  38. #include <QDOffscreen.h>
  39. #endif
  40.  
  41. class CGWorld
  42. {
  43.     public:
  44.                         CGWorld();
  45.                         CGWorld(
  46.                             const Rect&        inBounds,
  47.                             Int16             inPixelDepth = 0,
  48.                             GWorldFlags     inFlags = 0,
  49.                             CTabHandle         inCTableH = nil,
  50.                             GDHandle         inGDeviceH = nil);
  51.                             
  52.                         ~CGWorld();
  53.                         
  54.         Boolean            BeginDrawing(void);
  55.         void            EndDrawing(void);
  56.         
  57.         void            CopyImage(
  58.                                 GrafPtr     inDestPort,
  59.                                 const Rect&    inDestRect,
  60.                                 Int16         inXferMode = srcCopy,
  61.                                 RgnHandle     inMaskRegion = nil);
  62.  
  63.         GWorldPtr        GetMacGWorld(void);
  64.  
  65.         void            SetBounds(const Rect &inBounds);
  66.         const Rect&        GetBounds(void) const;
  67.  
  68.         Boolean            IsConsistent(void) const;
  69.         
  70.         void            AdjustGWorld(const Rect& inToBounds);
  71.  
  72.         
  73.     virtual    void            UpdateBounds(const Rect& inBounds);
  74.         void            UpdateOrigin(const Point& inOrigin);
  75.  
  76.     protected:
  77.  
  78.         GWorldPtr        mMacGWorld;
  79.         QDErr            mGWorldStatus;
  80.         Rect            mBounds;
  81.         Int16            mDepth;
  82.         
  83.         CGrafPtr        mSavePort;
  84.         GDHandle        mSaveDevice;
  85. };
  86.  
  87. inline const Rect& CGWorld::GetBounds(void) const
  88.     {    return mBounds;                                    }
  89. inline Boolean CGWorld::IsConsistent(void) const
  90.     {    return (mGWorldStatus == noErr);                }
  91. inline GWorldPtr CGWorld::GetMacGWorld(void)
  92.     {    return mMacGWorld;                                }
  93.     
  94.  
  95. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  96. //    Ñ    
  97. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  98.  
  99. class CSharedWorld : public CGWorld, public LSharable
  100. {
  101.     public:
  102.                         CSharedWorld(
  103.                                 const Rect&     inFrame,
  104.                                 Int16             inDepth,
  105.                                 GWorldFlags     inFlags);
  106. };
  107.  
  108.