home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 4.9 KB | 208 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWShape.h
- // Release Version: $ 1.0d11 $
- //
- // Copyright: © 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWSHAPE_H
- #define FWSHAPE_H
-
- #ifndef FWGROBJ_H
- #include "FWGrObj.h"
- #endif
-
- #ifndef FWPOINT_H
- #include "FWPoint.h"
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- #ifndef FWGRDEF_H
- #include "FWGrDef.h"
- #endif
-
- #ifndef FWINK_H
- #include "FWInk.h"
- #endif
-
- #ifndef FWSTYLE_H
- #include "FWStyle.h"
- #endif
-
- #ifndef FWFONT_H
- #include "FWFont.h"
- #endif
-
- #ifndef FWGRGLOB_H
- #include "FWGrGlob.h"
- #endif
-
- // ----- Foundation Includes -----
-
- #ifndef FWAUTODE_H
- #include <FWAutoDe.h>
- #endif
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CGraphicContext;
- class FW_CLASS_ATTR FW_CReadableStream;
- class FW_CLASS_ATTR FW_CWritableStream;
-
- //========================================================================================
- // class FW_CShape
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CShape FW_AUTO_DESTRUCT_OBJECT
- {
-
- public:
- FW_DECLARE_CLASS
-
- //----------------------------------------------------------------------------------------
- // Constructors/Destructors
- //
- public:
- virtual ~ FW_CShape();
-
- protected:
- FW_CShape(FW_ERenderVerbs renderVerb,
- const FW_PInk& ink,
- const FW_PStyle& style,
- const FW_PFont& font);
-
- FW_CShape(const FW_CShape& other);
- FW_CShape(FW_CReadableStream& archive);
-
- //----------------------------------------------------------------------------------------
- // 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_CFixed 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_CFixed deltaX, FW_CFixed deltaY) = 0;
- virtual void MoveShapeTo(FW_CFixed x, FW_CFixed y) = 0;
-
- virtual void Inset(FW_CFixed h, FW_CFixed v) = 0;
-
- // ----- Bounds -----
- virtual void GetBounds(FW_CGraphicContext& gc, FW_CRect& rect) const = 0;
-
- // ----- Archiving -----
- virtual void Flatten(FW_CWritableStream& archive) const;
- static void Write(FW_CWritableStream& archive, const void* shape);
-
- // ----- Getters/Setters -----
- FW_ERenderVerbs GetRenderVerb() const
- {return fRenderVerb;}
- void SetRenderVerb(FW_ERenderVerbs renderVerb)
- {fRenderVerb = renderVerb;}
-
- // ----- Ink access -----
- FW_PInk& GetInk()
- {return fInk;}
-
- const FW_PInk& GetInk() const
- {return fInk;}
-
- FW_PInk& GetUnSharedInk();
-
- void SetInk(const FW_PInk& newInk)
- {fInk = 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_PStyle& GetStyle()
- {return fStyle;}
-
- const FW_PStyle& GetStyle() const
- {return fStyle;}
-
- FW_PStyle& GetUnSharedStyle();
-
- void SetStyle(const FW_PStyle& newStyle)
- {fStyle = newStyle;}
-
- FW_CFixed GetPenSize() const
- {return fStyle->GetPenSize();}
-
- FW_PPattern GetPattern() const
- {return fStyle->GetPattern();}
-
- // ----- Font access -----
- FW_PFont& GetFont()
- {return fFont;}
-
- const FW_PFont& GetFont() const
- {return fFont;}
-
- FW_PFont& GetUnSharedFont();
-
- void SetFont(const FW_PFont& newFont)
- {fFont = newFont;}
-
- FW_CFixed 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_PInk fInk;
- FW_PStyle fStyle;
- FW_PFont fFont;
- };
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export off
- #endif
-
- #endif
-