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

  1. //========================================================================================
  2. //
  3. //    File:                FWStyle.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWSTYLE_H
  11. #define FWSTYLE_H
  12.  
  13. #ifndef FWGRDEF_H
  14. #include "FWGrDef.h"
  15. #endif
  16.  
  17. #ifndef FWGROBJ_H
  18. #include "FWGrObj.h"
  19. #endif
  20.  
  21. #ifndef FWGConst_H
  22. #include "FWGConst.h"
  23. #endif
  24.  
  25. #ifndef FWPAT_H
  26. #include "FWPat.h"
  27. #endif
  28.  
  29. #ifndef FWGRGLOB_H
  30. #include "FWGrGlob.h"
  31. #endif
  32.  
  33. #ifndef FWFXMATH_H
  34. #include "FWFxMath.h"
  35. #endif
  36.  
  37. // ----- Foundation Includes -----
  38.  
  39. #ifndef FWSTDDEF_H
  40. #include <FWStdDef.h>
  41. #endif
  42.  
  43. // ----- OpenDoc Includes -----
  44.  
  45. #ifndef _ODTYPES_
  46. #include <ODTypes.h>
  47. #endif
  48.  
  49. #if FW_LIB_EXPORT_PRAGMAS
  50. #pragma lib_export on
  51. #endif
  52.  
  53. //========================================================================================
  54. //    Forward Class Declarations
  55. //========================================================================================
  56.  
  57. class FW_CLASS_ATTR FW_CStyleRep;
  58. class FW_CLASS_ATTR ODTransform;
  59. class FW_CLASS_ATTR FW_CGraphicDevice;
  60.  
  61. //========================================================================================
  62. //    CLASS FW_PStyle
  63. //========================================================================================
  64.  
  65. class FW_CLASS_ATTR FW_PStyle : public FW_CGraphicCountedPtr
  66. {
  67. public:
  68.     FW_DECLARE_CLASS
  69.  
  70. public:
  71.     FW_PStyle();
  72.     virtual ~ FW_PStyle();
  73.     
  74.     FW_PStyle(FW_CFixed penSize, FW_EStyleDash dash = FW_kSolidLine);
  75.     FW_PStyle(FW_CFixed penSize, const FW_PPattern& pattern);
  76.     
  77.     FW_PStyle(const FW_PStyle& other);
  78.     FW_PStyle& operator=(const FW_PStyle& other);        
  79.                     
  80.     FW_PStyle(FW_EStandardStyles std);
  81.     FW_PStyle& operator=(FW_EStandardStyles std);        
  82.                     
  83.     FW_CStyleRep* operator->();
  84.     const FW_CStyleRep* operator->() const;
  85.     
  86. };
  87.  
  88. //----------------------------------------------------------------------------------------
  89. //    FW_PStyle::operator->
  90. //----------------------------------------------------------------------------------------
  91. inline FW_CStyleRep* FW_PStyle::operator->()
  92. {
  93.     return (FW_CStyleRep*)GetRep();
  94. }
  95.  
  96. //----------------------------------------------------------------------------------------
  97. //    FW_PStyle::operator->
  98. //----------------------------------------------------------------------------------------
  99. inline const FW_CStyleRep* FW_PStyle::operator->() const
  100. {
  101.     return (const FW_CStyleRep*)GetRep();
  102. }
  103.  
  104. //========================================================================================
  105. //    class FW_CStyleRep
  106. //========================================================================================
  107.  
  108. class FW_CLASS_ATTR FW_CStyleRep : public FW_CGraphicCountedPtrRep
  109. {
  110.     friend class FW_CLASS_ATTR FW_PStyle;
  111.     
  112. public:
  113.     FW_DECLARE_CLASS
  114.  
  115. //----------------------------------------------------------------------------------------
  116. //    Constructors/Destructors
  117. //
  118. public:
  119.     FW_CStyleRep(FW_CFixed penSize, FW_EStyleDash dash, const FW_PPattern& pattern);
  120.  
  121.     FW_CStyleRep& operator=(const FW_CStyleRep& otherRep);
  122.  
  123.     virtual ~FW_CStyleRep();
  124.     
  125. //----------------------------------------------------------------------------------------
  126. //    Memory management
  127. //
  128. public:
  129.     void*                operator new(size_t size);
  130.     void                operator delete(void* p);
  131.  
  132. //----------------------------------------------------------------------------------------
  133. //    Inherited API
  134. //
  135. public:
  136.     // ----- Flatten -----
  137.     virtual void    Flatten(FW_CWritableStream& archive) const;
  138.     
  139.     // ----- Equal -----
  140.     virtual FW_Boolean IsEqual(const FW_CGraphicCountedPtrRep* other) const;
  141.     
  142. //----------------------------------------------------------------------------------------
  143. //    New API
  144. //
  145. public:
  146.     // ----- Copying -----
  147.     FW_PStyle            Copy() const;
  148.     
  149.     // ----- Archiving -----
  150.     static void*         Read(FW_CReadableStream& archive);
  151.                             
  152.     // ----- Accessors -----
  153.     void                SetPenSize(FW_CFixed penSize)
  154.                             {fPenSize = penSize;}
  155.     FW_CFixed             GetPenSize() const
  156.                             {return fPenSize;}
  157.  
  158.     void                SetPattern(const FW_PPattern& pattern)
  159.                             {fPattern = pattern;}
  160.     FW_PPattern&        GetPattern()
  161.                             {return fPattern;}
  162.     const FW_PPattern&    GetPattern() const
  163.                             {return fPattern;}
  164.     FW_PPattern&        GetUnSharedPattern();
  165.                             
  166.     void                SetDashStyle(FW_EStyleDash dash)
  167.                             { fDash = dash; }
  168.     FW_EStyleDash        GetDashStyle() const
  169.                             { return fDash; }
  170.  
  171. //----------------------------------------------------------------------------------------
  172. //    Data Members
  173. //
  174. private:
  175.     FW_CFixed            fPenSize;
  176.     FW_EStyleDash        fDash;
  177.     FW_PPattern            fPattern;
  178. };
  179.  
  180. #if FW_LIB_EXPORT_PRAGMAS
  181. #pragma lib_export off
  182. #endif
  183.  
  184. #endif
  185.