home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 4.8 KB | 197 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWShape.h
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWSHAPE_H
- #define FWSHAPE_H
-
- #ifndef FWPOINT_H
- #include "FWPoint.h"
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- #ifndef SLGRDEF_H
- #include "SLGrDef.h"
- #endif
-
- #ifndef FWINK_H
- #include "FWInk.h"
- #endif
-
- #ifndef FWSTYLE_H
- #include "FWStyle.h"
- #endif
-
- #ifndef FWFONT_H
- #include "FWFont.h"
- #endif
-
- #ifndef FWSTDDEF_H
- #include "FWStdDef.h"
- #endif
-
- // ----- Foundation Includes -----
-
- #ifndef FWEXCLIB_H
- #include "FWExcLib.h"
- #endif
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- class FW_CGraphicContext;
- class FW_CReadableStream;
- class FW_CWritableStream;
-
- //========================================================================================
- // class FW_CShape
- //========================================================================================
-
- class FW_CShape
- {
- public:
- FW_DECLARE_CLASS
- FW_DECLARE_AUTO(FW_CShape)
-
- //----------------------------------------------------------------------------------------
- // Constructors/Destructors
- //
- public:
- virtual ~ FW_CShape();
-
- protected:
- FW_CShape(FW_ERenderVerbs renderVerb,
- const FW_CInk& ink,
- const FW_CStyle& style,
- const FW_CFont& font);
-
- FW_CShape(const FW_CShape& other);
- FW_CShape(FW_CReadableStream& stream);
-
- //----------------------------------------------------------------------------------------
- // Operators
- //
- public:
- FW_CShape& operator=(const FW_CShape& other);
-
- //----------------------------------------------------------------------------------------
- // New API
- //
- public:
- // ----- Memory Management -----
- virtual void Purge();
-
- // ----- Rendering -----
- virtual void Render(FW_CGraphicContext& gc) const = 0;
-
- // ----- Hit Testing -----
- virtual FW_Boolean HitTest(FW_CGraphicContext& gc,
- const FW_CPoint& test,
- FW_Fixed tolerance) const = 0;
-
- // ----- Copying -----
- virtual FW_CShape* Copy() const = 0;
-
- // ----- Transform -----
- virtual void Transform(Environment *ev, ODTransform* transform) = 0;
- virtual void InverseTransform(Environment *ev, ODTransform* transform) = 0;
-
- virtual void MoveShape(FW_Fixed deltaX, FW_Fixed deltaY) = 0;
- virtual void MoveShapeTo(FW_Fixed x, FW_Fixed y) = 0;
-
- virtual void Inset(FW_Fixed h, FW_Fixed v) = 0;
- void Inset(FW_Fixed f)
- {Inset(f, f);}
-
- // ----- Bounds -----
- virtual void GetBounds(FW_CGraphicContext& gc, FW_CRect& rect) const = 0;
-
- // ----- Anchor Points -----
- virtual FW_CPoint GetAnchorPoint() const = 0;
-
- // ----- Archiving -----
- virtual void Flatten(FW_CWritableStream& stream) const;
- static void Write(FW_CWritableStream& stream, FW_ClassTypeConstant type, const void *object);
-
- // ----- Getters/Setters -----
- FW_ERenderVerbs GetRenderVerb() const
- {return fRenderVerb;}
- virtual void SetRenderVerb(FW_ERenderVerbs renderVerb);
-
- // ----- Ink access -----
- FW_CInk& GetInk()
- {return fInk;}
-
- const FW_CInk& GetInk() const
- {return fInk;}
-
- FW_CInk& GetUnSharedInk();
-
- virtual void SetInk(const FW_CInk& newInk);
-
- void GetForeColor(FW_CColor& color) const
- {fInk.GetForeColor(color);}
-
- void GetBackColor(FW_CColor& color) const
- {fInk.GetBackColor(color);}
-
- FW_TransferModes GetTransferMode() const
- {return fInk.GetTransferMode();}
-
- // ----- Style access -----
- FW_CStyle& GetStyle()
- {return fStyle;}
-
- const FW_CStyle& GetStyle() const
- {return fStyle;}
-
- FW_CStyle& GetUnSharedStyle();
-
- virtual void SetStyle(const FW_CStyle& newStyle);
-
- FW_Fixed GetPenSize() const
- {return fStyle.GetPenSize();}
-
- FW_CPattern GetPattern() const
- {return fStyle.GetPattern();}
-
- // ----- Font access -----
- FW_CFont& GetFont()
- {return fFont;}
-
- const FW_CFont& GetFont() const
- {return fFont;}
-
- FW_CFont& GetUnSharedFont();
-
- virtual void SetFont(const FW_CFont& newFont);
-
- FW_Fixed GetFontSize() const
- {return fFont.GetFontSize();}
-
- FW_FontStyle GetFontStyle() const
- {return fFont.GetFontStyle();}
-
- void GetFontName(FW_CString& fontName) const
- {fFont.GetFontName(fontName);}
- //----------------------------------------------------------------------------------------
- // Data Members
- //
- protected:
- FW_ERenderVerbs fRenderVerb;
- FW_CInk fInk;
- FW_CStyle fStyle;
- FW_CFont fFont;
- };
-
- #endif
-