home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 3.8 KB | 140 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWLinShp.h
- // Release Version: $ 1.0d11 $
- //
- // Copyright: © 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWLINSHP_H
- #define FWLINSHP_H
-
- #ifndef FWSHAPE_H
- #include "FWShape.h"
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CGraphicContext;
- class FW_CLASS_ATTR ODTransform;
-
- //========================================================================================
- // class FW_CLineShape
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CLineShape : public FW_CShape
- {
- public:
- FW_DECLARE_CLASS
-
- //---------------------------------------------------------------------------------------
- // Constructors/Destructors
- //
- public:
- FW_CLineShape();
-
- FW_CLineShape(FW_CFixed xStart, FW_CFixed yStart,
- FW_CFixed xEnd, FW_CFixed yEnd,
- const FW_PInk& ink = FW_kNormalInk,
- const FW_PStyle& style = FW_kNormalStyle);
-
- FW_CLineShape(const FW_CPoint& start,
- const FW_CPoint& end,
- const FW_PInk& ink = FW_kNormalInk,
- const FW_PStyle& style = FW_kNormalStyle);
-
- FW_CLineShape(const FW_CLineShape& other);
- FW_CLineShape(FW_CReadableStream& archive);
-
- virtual ~ FW_CLineShape();
-
- //----------------------------------------------------------------------------------------
- // Operators
- //
- public:
- FW_CLineShape& operator=(const FW_CLineShape& other);
-
- //---------------------------------------------------------------------------------------
- // Inherited API
- //
- public:
- // ----- Rendering -----
- virtual void Render(FW_CGraphicContext& gc) const;
-
- // ----- Hit Testing -----
- virtual FW_Boolean HitTest(FW_CGraphicContext& gc,
- const FW_CPoint& test,
- FW_CFixed tolerance) const;
-
- // ----- Copying -----
- virtual FW_CShape* Copy() const;
-
- // ----- Transform -----
- virtual void Transform(Environment *ev, ODTransform* transform);
- virtual void InverseTransform(Environment *ev, ODTransform* transform);
-
- virtual void MoveShape(FW_CFixed deltaX, FW_CFixed deltaY);
- virtual void MoveShapeTo(FW_CFixed x, FW_CFixed y);
-
- virtual void Inset(FW_CFixed x, FW_CFixed y);
-
- // ----- Geometry -----
- virtual void GetBounds(FW_CGraphicContext& gc, FW_CRect& rect) const;
-
- // ----- Flatten -----
- virtual void Flatten(FW_CWritableStream& archive) const;
-
- //---------------------------------------------------------------------------------------
- // New API
- //
- public:
- // ----- Rendering -----
- static void RenderLine(FW_CGraphicContext& gc,
- const FW_CPoint& start,
- const FW_CPoint& end,
- const FW_PInk& ink = FW_kNormalInk,
- const FW_PStyle& style = FW_kNormalStyle);
-
- // ----- Archiving -----
- static void* Read(FW_CReadableStream& archive);
-
- // ----- Geometry -----
- void GetGeometry(FW_CPoint& start, FW_CPoint& end) const;
- void SetGeometry(const FW_CPoint& start, const FW_CPoint& end);
-
- FW_CPoint GetLineStart() const
- {return fStart;}
- FW_CPoint GetLineEnd() const
- {return fEnd;}
-
- void SetLineStart(FW_CFixed xStart, FW_CFixed yStart)
- {fStart.x = xStart; fStart.y = yStart;}
-
- void SetLineEnd(FW_CFixed xEnd, FW_CFixed yEnd)
- {fEnd.x = xEnd; fEnd.y = yEnd;}
-
- //---------------------------------------------------------------------------------------
- // Data Members
- //
- private:
- FW_CPoint fStart;
- FW_CPoint fEnd;
- };
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export off
- #endif
-
- #endif
-