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 / FWShape.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  4.9 KB  |  208 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWShape.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWSHAPE_H
  11. #define FWSHAPE_H
  12.  
  13. #ifndef FWGROBJ_H
  14. #include "FWGrObj.h"
  15. #endif
  16.  
  17. #ifndef FWPOINT_H
  18. #include "FWPoint.h"
  19. #endif
  20.  
  21. #ifndef FWRECT_H
  22. #include "FWRect.h"
  23. #endif
  24.  
  25. #ifndef FWGRDEF_H
  26. #include "FWGrDef.h"
  27. #endif
  28.  
  29. #ifndef FWINK_H
  30. #include "FWInk.h"
  31. #endif
  32.  
  33. #ifndef FWSTYLE_H
  34. #include "FWStyle.h"
  35. #endif
  36.  
  37. #ifndef FWFONT_H
  38. #include "FWFont.h"
  39. #endif
  40.  
  41. #ifndef FWGRGLOB_H
  42. #include "FWGrGlob.h"
  43. #endif
  44.  
  45. // ----- Foundation Includes -----
  46.  
  47. #ifndef FWAUTODE_H
  48. #include <FWAutoDe.h>
  49. #endif
  50.  
  51. #if FW_LIB_EXPORT_PRAGMAS
  52. #pragma lib_export on
  53. #endif
  54.  
  55. //========================================================================================
  56. //    Forward Declarations
  57. //========================================================================================
  58.  
  59. class FW_CLASS_ATTR FW_CGraphicContext;
  60. class FW_CLASS_ATTR FW_CReadableStream;
  61. class FW_CLASS_ATTR FW_CWritableStream;
  62.  
  63. //========================================================================================
  64. //    class FW_CShape
  65. //========================================================================================
  66.  
  67. class FW_CLASS_ATTR FW_CShape FW_AUTO_DESTRUCT_OBJECT
  68. {
  69.  
  70. public:
  71.     FW_DECLARE_CLASS
  72.  
  73. //----------------------------------------------------------------------------------------
  74. //    Constructors/Destructors
  75. //
  76. public:
  77.     virtual ~ FW_CShape();
  78.  
  79. protected:
  80.     FW_CShape(FW_ERenderVerbs renderVerb,
  81.               const FW_PInk& ink,
  82.               const FW_PStyle& style,
  83.               const FW_PFont& font);
  84.  
  85.     FW_CShape(const FW_CShape& other);
  86.     FW_CShape(FW_CReadableStream& archive);
  87.  
  88. //----------------------------------------------------------------------------------------
  89. //    Operators
  90. //
  91. public:
  92.     FW_CShape& operator=(const FW_CShape& other);
  93.  
  94. //----------------------------------------------------------------------------------------
  95. //    New API
  96. //
  97. public:
  98.     // ----- Memory Management -----
  99.     virtual void                Purge();
  100.  
  101.     // ----- Rendering -----
  102.     virtual void                 Render(FW_CGraphicContext& gc) const = 0;
  103.     
  104.     // ----- Hit Testing -----
  105.     virtual FW_Boolean         HitTest(FW_CGraphicContext& gc,
  106.                                         const FW_CPoint& test,
  107.                                         FW_CFixed tolerance) const = 0;
  108.     
  109.     // ----- Copying -----
  110.     virtual FW_CShape*            Copy() const = 0;
  111.     
  112.     // ----- Transform -----
  113.     virtual void                Transform(Environment *ev, ODTransform* transform) = 0;
  114.     virtual void                InverseTransform(Environment *ev, ODTransform* transform) = 0;
  115.  
  116.     virtual void                MoveShape(FW_CFixed deltaX, FW_CFixed deltaY) = 0;
  117.     virtual void                MoveShapeTo(FW_CFixed x, FW_CFixed y) = 0;
  118.     
  119.     virtual void                Inset(FW_CFixed h, FW_CFixed v) = 0;
  120.     
  121.     // ----- Bounds -----
  122.     virtual void                 GetBounds(FW_CGraphicContext& gc, FW_CRect& rect) const = 0;
  123.     
  124.     // ----- Archiving -----
  125.     virtual void                Flatten(FW_CWritableStream& archive) const;
  126.     static void                 Write(FW_CWritableStream& archive, const void* shape);
  127.     
  128.     // ----- Getters/Setters -----
  129.     FW_ERenderVerbs                GetRenderVerb() const
  130.                                     {return fRenderVerb;}
  131.     void                        SetRenderVerb(FW_ERenderVerbs renderVerb)
  132.                                     {fRenderVerb = renderVerb;}
  133.                         
  134.     // ----- Ink access -----
  135.     FW_PInk&                    GetInk()
  136.                                     {return fInk;}
  137.  
  138.     const FW_PInk&                GetInk() const
  139.                                     {return fInk;}
  140.  
  141.     FW_PInk&                    GetUnSharedInk();
  142.                                     
  143.     void                        SetInk(const FW_PInk& newInk)
  144.                                     {fInk = newInk;}
  145.  
  146.     void                        GetForeColor(FW_CColor& color) const
  147.                                     {fInk->GetForeColor(color);}
  148.  
  149.     void                        GetBackColor(FW_CColor& color) const
  150.                                     {fInk->GetBackColor(color);}
  151.  
  152.     FW_TransferModes            GetTransferMode() const
  153.                                     {return fInk->GetTransferMode();}
  154.  
  155.     // ----- Style access -----
  156.     FW_PStyle&                    GetStyle()
  157.                                     {return fStyle;}
  158.  
  159.     const FW_PStyle&            GetStyle() const
  160.                                     {return fStyle;}
  161.  
  162.     FW_PStyle&                    GetUnSharedStyle();
  163.  
  164.     void                        SetStyle(const FW_PStyle& newStyle)
  165.                                     {fStyle = newStyle;}
  166.     
  167.     FW_CFixed                    GetPenSize() const
  168.                                     {return fStyle->GetPenSize();}
  169.  
  170.     FW_PPattern                    GetPattern() const
  171.                                     {return fStyle->GetPattern();}
  172.  
  173.     // ----- Font access -----
  174.     FW_PFont&                    GetFont()
  175.                                     {return fFont;}
  176.  
  177.     const FW_PFont&                GetFont() const
  178.                                     {return fFont;}
  179.  
  180.     FW_PFont&                    GetUnSharedFont();
  181.  
  182.     void                        SetFont(const FW_PFont& newFont)
  183.                                     {fFont = newFont;}
  184.     
  185.     FW_CFixed                     GetFontSize() const
  186.                                     {return fFont->GetFontSize();}
  187.  
  188.     FW_FontStyle                 GetFontStyle() const
  189.                                     {return fFont->GetFontStyle();}
  190.  
  191.     void                        GetFontName(FW_CString& fontName) const
  192.                                     {fFont->GetFontName(fontName);}
  193. //----------------------------------------------------------------------------------------
  194. //    Data Members
  195. //
  196. protected:
  197.     FW_ERenderVerbs                fRenderVerb;
  198.     FW_PInk                        fInk;
  199.     FW_PStyle                    fStyle;
  200.     FW_PFont                    fFont;
  201. };
  202.  
  203. #if FW_LIB_EXPORT_PRAGMAS
  204. #pragma lib_export off
  205. #endif
  206.  
  207. #endif
  208.