home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Include / FWPoly.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  4.4 KB  |  156 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWPoly.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWPOLY_H
  11. #define FWPOLY_H
  12.  
  13. #ifndef FWGROBJ_H
  14. #include "FWGrObj.h"
  15. #endif
  16.  
  17. #ifndef FWFXMATH_H
  18. #include "FWFxMath.h"
  19. #endif
  20.  
  21. #if FW_LIB_EXPORT_PRAGMAS
  22. #pragma lib_export on
  23. #endif
  24.  
  25. //========================================================================================
  26. //    Forward Class Declarations
  27. //========================================================================================
  28.  
  29. class FW_CLASS_ATTR FW_CPoint;
  30. class FW_CLASS_ATTR FW_CRect;
  31. class FW_CLASS_ATTR FW_CPolygonRep;
  32.  
  33. class FW_CLASS_ATTR ODTransform;
  34.  
  35. //========================================================================================
  36. //    class FW_PPolygon
  37. //========================================================================================
  38.  
  39. class FW_CLASS_ATTR FW_PPolygon : public FW_CGraphicCountedPtr
  40. {
  41. public:
  42.     FW_DECLARE_CLASS
  43.  
  44. public:
  45.     FW_PPolygon();
  46.     FW_PPolygon(FW_CReadableStream& archive);
  47.     FW_PPolygon(unsigned long count, const FW_CPoint* points);
  48.     virtual ~ FW_PPolygon();
  49.     
  50.     FW_PPolygon(const FW_PPolygon& other);
  51.     FW_PPolygon& operator=(const FW_PPolygon& other);
  52.         
  53.     FW_CPolygonRep* operator->();
  54.     const FW_CPolygonRep* operator->() const;
  55. };
  56.  
  57. //========================================================================================
  58. //    class FW_CPolygonRep
  59. //========================================================================================
  60.  
  61. class FW_CLASS_ATTR FW_CPolygonRep : public FW_CGraphicCountedPtrRep
  62. {
  63.     friend class FW_CLASS_ATTR FW_PPolygon;
  64.  
  65. public:
  66.     FW_DECLARE_CLASS
  67.  
  68. //----------------------------------------------------------------------------------------
  69. //    Constructors/Destructors
  70. //
  71. protected:
  72.     FW_CPolygonRep(unsigned long count, const FW_CPoint* points);
  73.     FW_CPolygonRep(FW_CReadableStream& archive);
  74.     
  75.     virtual ~FW_CPolygonRep();
  76.  
  77. //----------------------------------------------------------------------------------------
  78. //    Operations
  79. //
  80. public:
  81.     void                    Transform(Environment *ev, ODTransform* transform);
  82.     void                    InverseTransform(Environment *ev, ODTransform* transform);
  83.  
  84.     void                    Move(FW_CFixed deltaX, FW_CFixed deltaY);
  85.     void                    MoveTo(FW_CFixed x, FW_CFixed y);
  86.  
  87.     void                    Inset(FW_CFixed x, FW_CFixed y);
  88.     
  89.     void                     GetBounds(FW_CRect& rect) const;
  90.     
  91.     void                    SetPoints(const FW_CPoint* points,
  92.                                       unsigned long startIndex,
  93.                                       unsigned long pointCount);
  94.  
  95.     void                    GetPoints(FW_CPoint* points,
  96.                                       unsigned long startIndex,
  97.                                       unsigned long pointCount) const;
  98.  
  99. //----------------------------------------------------------------------------------------
  100. //    Attributes
  101. //
  102. public:
  103.     unsigned long            GetCount() const;
  104.     const FW_CPoint*        GetPoints() const;
  105.  
  106. //----------------------------------------------------------------------------------------
  107. //    Inherited API
  108. //
  109. public:
  110.     virtual void            Flatten(FW_CWritableStream& archive) const;
  111.     virtual FW_Boolean        IsEqual(const FW_CGraphicCountedPtrRep* other) const;
  112.     
  113. //----------------------------------------------------------------------------------------
  114. //    New API
  115. //
  116. public:
  117.     // ----- Copying -----
  118.     FW_PPolygon            Copy() const;
  119.  
  120.     // ----- Archiving -----
  121.     static void*        Read(FW_CReadableStream& archive);
  122.     
  123. //----------------------------------------------------------------------------------------
  124. //    Data Members
  125. //
  126. private:
  127.     unsigned long        fCount;
  128.     FW_CPoint*            fPoints;
  129. };
  130.  
  131. //========================================================================================
  132. //    Inlines
  133. //========================================================================================
  134.  
  135. //----------------------------------------------------------------------------------------
  136. //    FW_PPolygon::operator->
  137. //----------------------------------------------------------------------------------------
  138. inline FW_CPolygonRep* FW_PPolygon::operator->()
  139. {
  140.     return (FW_CPolygonRep*)GetRep();
  141. }
  142.  
  143. //----------------------------------------------------------------------------------------
  144. //    FW_PPolygon::operator->
  145. //----------------------------------------------------------------------------------------
  146. inline const FW_CPolygonRep* FW_PPolygon::operator->() const
  147. {
  148.     return (const FW_CPolygonRep*)GetRep();
  149. }
  150.  
  151. #if FW_LIB_EXPORT_PRAGMAS
  152. #pragma lib_export off
  153. #endif
  154.  
  155. #endif
  156.