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

  1. //========================================================================================
  2. //
  3. //    File:                FWLinShp.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWLINSHP_H
  11. #define FWLINSHP_H
  12.  
  13. #ifndef FWSHAPE_H
  14. #include "FWShape.h"
  15. #endif
  16.  
  17. #ifndef FWRECT_H
  18. #include "FWRect.h"
  19. #endif
  20.  
  21. #if FW_LIB_EXPORT_PRAGMAS
  22. #pragma lib_export on
  23. #endif
  24.  
  25. //========================================================================================
  26. //    Forward Declarations
  27. //========================================================================================
  28.  
  29. class FW_CLASS_ATTR FW_CGraphicContext;
  30. class FW_CLASS_ATTR ODTransform;
  31.  
  32. //========================================================================================
  33. //    class FW_CLineShape
  34. //========================================================================================
  35.  
  36. class FW_CLASS_ATTR FW_CLineShape : public FW_CShape
  37. {
  38. public:
  39.     FW_DECLARE_CLASS
  40.  
  41. //---------------------------------------------------------------------------------------
  42. //    Constructors/Destructors
  43. //
  44. public:
  45.     FW_CLineShape();
  46.  
  47.     FW_CLineShape(FW_CFixed xStart, FW_CFixed yStart,
  48.                   FW_CFixed xEnd, FW_CFixed yEnd,
  49.                   const FW_PInk& ink = FW_kNormalInk,
  50.                   const FW_PStyle& style = FW_kNormalStyle);
  51.  
  52.     FW_CLineShape(const FW_CPoint& start,
  53.                   const FW_CPoint& end,
  54.                   const FW_PInk& ink = FW_kNormalInk,
  55.                   const FW_PStyle& style = FW_kNormalStyle);
  56.  
  57.     FW_CLineShape(const FW_CLineShape& other);
  58.     FW_CLineShape(FW_CReadableStream& archive);
  59.     
  60.     virtual ~ FW_CLineShape();
  61.  
  62. //----------------------------------------------------------------------------------------
  63. //    Operators
  64. //
  65. public:
  66.     FW_CLineShape& operator=(const FW_CLineShape& other);
  67.     
  68. //---------------------------------------------------------------------------------------
  69. //    Inherited API
  70. //
  71. public:
  72.     // ----- Rendering -----
  73.     virtual void            Render(FW_CGraphicContext& gc) const;
  74.  
  75.     // ----- Hit Testing -----
  76.     virtual FW_Boolean     HitTest(FW_CGraphicContext& gc,
  77.                                     const FW_CPoint& test,
  78.                                     FW_CFixed tolerance) const;
  79.     
  80.     // ----- Copying -----
  81.     virtual FW_CShape*        Copy() const;
  82.     
  83.     // ----- Transform -----
  84.     virtual void            Transform(Environment *ev, ODTransform* transform);
  85.     virtual void            InverseTransform(Environment *ev, ODTransform* transform);
  86.  
  87.     virtual void            MoveShape(FW_CFixed deltaX, FW_CFixed deltaY);
  88.     virtual void            MoveShapeTo(FW_CFixed x, FW_CFixed y);
  89.  
  90.     virtual void            Inset(FW_CFixed x, FW_CFixed y);
  91.     
  92.     // ----- Geometry -----
  93.     virtual void             GetBounds(FW_CGraphicContext& gc, FW_CRect& rect) const;
  94.  
  95.     // ----- Flatten -----
  96.     virtual void            Flatten(FW_CWritableStream& archive) const;
  97.     
  98. //---------------------------------------------------------------------------------------
  99. //    New API
  100. //
  101. public:
  102.     // ----- Rendering -----
  103.     static void    RenderLine(FW_CGraphicContext& gc,
  104.                                 const FW_CPoint& start, 
  105.                                 const FW_CPoint& end,
  106.                                 const FW_PInk& ink = FW_kNormalInk,
  107.                                 const FW_PStyle& style = FW_kNormalStyle);
  108.  
  109.     // ----- Archiving -----
  110.     static void*     Read(FW_CReadableStream& archive);
  111.  
  112.     // ----- Geometry -----
  113.     void            GetGeometry(FW_CPoint& start, FW_CPoint& end) const;
  114.     void            SetGeometry(const FW_CPoint& start, const FW_CPoint& end);
  115.  
  116.     FW_CPoint        GetLineStart() const
  117.                         {return fStart;}
  118.     FW_CPoint        GetLineEnd() const
  119.                         {return fEnd;}
  120.     
  121.     void            SetLineStart(FW_CFixed xStart, FW_CFixed yStart)
  122.                         {fStart.x = xStart; fStart.y = yStart;}
  123.  
  124.     void            SetLineEnd(FW_CFixed xEnd, FW_CFixed yEnd)
  125.                         {fEnd.x = xEnd; fEnd.y = yEnd;}
  126.  
  127. //---------------------------------------------------------------------------------------
  128. //    Data Members
  129. //
  130. private:
  131.     FW_CPoint        fStart;
  132.     FW_CPoint        fEnd;
  133. };
  134.  
  135. #if FW_LIB_EXPORT_PRAGMAS
  136. #pragma lib_export off
  137. #endif
  138.  
  139. #endif
  140.