home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / FWIconSh.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.6 KB  |  127 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWIconSh.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWICONSH_H
  11. #define FWICONSH_H
  12.  
  13. #ifndef FWBNDSHP_H
  14. #include "FWBndShp.h"
  15. #endif
  16.  
  17. #ifndef FWRECT_H
  18. #include "FWRect.h"
  19. #endif
  20.  
  21. #ifndef FWICON_H
  22. #include "FWIcon.h"
  23. #endif
  24.  
  25. #ifndef FWGCONST_H
  26. #include "FWGConst.h"
  27. #endif
  28.  
  29. //========================================================================================
  30. //    Forward Declarations
  31. //========================================================================================
  32.  
  33. class FW_CGraphicContext;
  34.  
  35. //========================================================================================
  36. //    class FW_CIconShape
  37. //========================================================================================
  38.  
  39. class FW_CIconShape : public FW_CBoundedShape
  40. {
  41. public:
  42.     FW_DECLARE_CLASS
  43.     FW_DECLARE_AUTO(FW_CIconShape)
  44.  
  45. //---------------------------------------------------------------------------------------
  46. //    Constructors/Destructors
  47. //
  48. public:
  49.     
  50.     enum
  51.     {
  52.         kDefaultAlignment = FW_kIconAlignLeft | FW_kIconAlignTop
  53.     };
  54.  
  55.                             FW_CIconShape(const FW_CIcon& icon,
  56.                                           const FW_CRect& rect,
  57.                                           FW_RenderIconTransform transform = FW_kIconTransformNone,
  58.                                           FW_RenderIconAlignment alignment = kDefaultAlignment);
  59.                         
  60.                             FW_CIconShape(const FW_CIconShape& other);
  61.                             FW_CIconShape(FW_CReadableStream& stream);
  62.  
  63.     virtual                    ~FW_CIconShape();
  64.  
  65. //----------------------------------------------------------------------------------------
  66. //    Operators
  67. //
  68. public:
  69.     FW_CIconShape&            operator=(const FW_CIconShape& other);
  70.  
  71. //---------------------------------------------------------------------------------------
  72. //    Inherited API
  73. //
  74. public:
  75.     // ----- Rendering -----
  76.     virtual void            Render(FW_CGraphicContext& gc) const;
  77.  
  78.     // ----- Copying -----
  79.     virtual FW_CShape*        Copy() const;
  80.     
  81.     // ----- Flatten -----
  82.     virtual void            Flatten(FW_CWritableStream& stream) const;
  83.  
  84. //---------------------------------------------------------------------------------------
  85. //    New API
  86. //
  87. public:
  88.     // ----- Rendering -----
  89.     static void                RenderIcon(FW_CGraphicContext& gc,
  90.                                           const FW_CIcon& icon,
  91.                                        const FW_CRect& rect,
  92.                                        FW_RenderIconTransform transform = FW_kIconTransformNone,
  93.                                        FW_RenderIconAlignment alignment = kDefaultAlignment);
  94.  
  95.     // ----- Archiving -----
  96.     static void*            Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
  97.  
  98.     // ----- Geometry -----
  99.     void                    GetGeometry(FW_CIcon& icon,
  100.                                         FW_CRect& bounds,
  101.                                         FW_RenderIconTransform& transform,
  102.                                         FW_RenderIconAlignment& alignment) const;
  103.     void                    SetGeometry(const FW_CIcon& icon,
  104.                                         const FW_CRect& bounds,
  105.                                         FW_RenderIconTransform transform = FW_kIconTransformNone,
  106.                                         FW_RenderIconAlignment alignment = kDefaultAlignment);
  107.  
  108.     FW_RenderIconTransform    GetIconTransform() const
  109.                                 {return fTransform;}
  110.     void                    SetIconTransform(FW_RenderIconTransform iconTransform)
  111.                                 {fTransform = iconTransform;}
  112.     FW_RenderIconAlignment    GetIconAlignment() const
  113.                                 {return fAlignment;}
  114.     void                    SetIconAlignment(FW_RenderIconAlignment iconAlignment)
  115.                                 {fAlignment = iconAlignment;}
  116.                                 
  117. //---------------------------------------------------------------------------------------
  118. //    Data Members
  119. //
  120. private:
  121.     FW_CIcon                fIcon;
  122.     FW_RenderIconTransform    fTransform;
  123.     FW_RenderIconAlignment    fAlignment;
  124. };
  125.  
  126. #endif // FWICONSH_H
  127.