home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / FWRecShp.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.2 KB  |  107 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWRecShp.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWRECSHP_H
  11. #define FWRECSHP_H
  12.  
  13. #ifndef FWSHAPE_H
  14. #include "FWShape.h"
  15. #endif
  16.  
  17. #ifndef FWBNDSHP_H
  18. #include "FWBndShp.h"
  19. #endif
  20.  
  21. //========================================================================================
  22. //    Forward Declarations
  23. //========================================================================================
  24.  
  25. class FW_CGraphicContext;
  26.  
  27. //=======================================================================================
  28. //    class FW_CRectShape
  29. //=======================================================================================
  30.  
  31. class FW_CRectShape : public FW_CBoundedShape
  32. {
  33. public:
  34.     FW_DECLARE_CLASS
  35.     FW_DECLARE_AUTO(FW_CRectShape)
  36.  
  37. //----------------------------------------------------------------------------------------
  38. //    Constructors/Destructors
  39. //
  40. public:
  41.     FW_CRectShape();
  42.     FW_CRectShape(const FW_CRect& rect, 
  43.                   FW_ERenderVerbs renderVerb,
  44.                   const FW_CInk& ink = FW_kNormalInk,
  45.                   const FW_CStyle& style = FW_kNormalStyle);
  46.  
  47.     FW_CRectShape(const FW_CRectShape& other);
  48.     FW_CRectShape(FW_CReadableStream& stream);
  49.     
  50.     virtual ~ FW_CRectShape();
  51.         
  52. //----------------------------------------------------------------------------------------
  53. //    Inherited API
  54. //
  55. public:
  56.     // ----- Hit Testing -----
  57.     virtual FW_Boolean         HitTest(FW_CGraphicContext& gc,
  58.                                         const FW_CPoint& test,
  59.                                         FW_Fixed tolerance) const;
  60.  
  61.     // ----- Copying -----
  62.     virtual FW_CShape*            Copy() const;
  63.     
  64.     // ----- Rendering -----
  65.     virtual void                 Render(FW_CGraphicContext& gc) const;
  66.     
  67. //----------------------------------------------------------------------------------------
  68. //    New API
  69. //
  70. public:
  71.     // ----- Geometry -----
  72.     void                        SetGeometry(const FW_CRect& rect);
  73.     void                         GetGeometry(FW_CRect& rect) const;
  74.                         
  75.     // ----- Static rendering method -----
  76.     static void                 RenderRect(FW_CGraphicContext& gc,
  77.                                             const FW_CRect& rect, 
  78.                                             FW_ERenderVerbs renderVerb,
  79.                                             const FW_CInk& ink = FW_kNormalInk,
  80.                                             const FW_CStyle& style = FW_kNormalStyle);
  81.     // ----- Archiving -----
  82.     static void*                Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
  83.  
  84. };
  85.  
  86. //=======================================================================================
  87. //    Inlines
  88. //=======================================================================================
  89.  
  90. //----------------------------------------------------------------------------------------
  91. //    FW_CRectShape::GetGeometry
  92. //----------------------------------------------------------------------------------------
  93. inline void FW_CRectShape::GetGeometry(FW_CRect& rect) const
  94. {
  95.     rect = fRect;
  96. }
  97.  
  98. //----------------------------------------------------------------------------------------
  99. //    FW_CRectShape::SetGeometry
  100. //----------------------------------------------------------------------------------------
  101. inline void FW_CRectShape::SetGeometry(const FW_CRect& rect)
  102. {
  103.     fRect = rect;
  104. }
  105.  
  106. #endif
  107.