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 / Draw / Sources / GroupShp.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  5.3 KB  |  173 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                GroupShp.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Author:                Mary Boetcher
  7. //
  8. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef GROUPSHP_H
  13. #define GROUPSHP_H
  14.  
  15. #ifndef CONSTANT_H
  16. #include "Constant.h"
  17. #endif
  18.  
  19. #ifndef BASESHP_H
  20. #include "BaseShp.h"
  21. #endif
  22.  
  23. // ----- OS Layer -----
  24.  
  25. #ifndef FWINK_H
  26. #include "FWInk.h"
  27. #endif
  28.  
  29. #ifndef FWSTYLE_H
  30. #include "FWStyle.h"
  31. #endif
  32.  
  33. #ifndef FWPOINT_H
  34. #include "FWPoint.h"
  35. #endif
  36.  
  37. #ifndef FWRECT_H
  38. #include "FWRect.h"
  39. #endif
  40.  
  41. // ----- Foundation Layer -----
  42.  
  43. #ifndef FWRUNTYP_H
  44. #include "FWRunTyp.h"
  45. #endif
  46.  
  47. //========================================================================================
  48. // Forward Declarations
  49. //========================================================================================
  50.  
  51. class ODFacet;
  52. class ODShape;
  53. class CDrawPart;
  54. class FW_CGraphicContext;
  55. class FW_CMouseEvent;
  56.  
  57. class CDrawFacetClipper;
  58. class CUngroupShapesCommand;
  59. class CShapeCollectionIterator;
  60. class CDrawContent;
  61.  
  62. //========================================================================================
  63. // class CGroupShape
  64. //========================================================================================
  65.  
  66. class CGroupShape : public CBaseShape
  67. {
  68.   public:
  69.     FW_DECLARE_CLASS
  70.     FW_DECLARE_AUTO(CGroupShape)
  71.  
  72.   public:
  73.     CGroupShape(CDrawPart* drawPart);
  74.     CGroupShape(CDrawPart* drawPart, CShapeCollection* shapeList);
  75.     CGroupShape(CDrawPart* drawPart, FW_CReadableStream& archive);
  76.     virtual ~CGroupShape();
  77.                 
  78.     // ----- Archiving -----
  79.     static void*         Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
  80.     virtual void         Flatten(FW_CWritableStream& archive);
  81.  
  82.     // ----- Required CBaseShape overrides -----
  83.     virtual ODShape*    CreateShapeOutline(Environment* ev);
  84.     virtual ODShape*    CalcClipShape(Environment* ev);
  85.     virtual void        GetHandleCenter(short whichHandle, FW_CPoint& center) const;
  86.     virtual void        GetMapRects(short whichHandle, const FW_CPoint& lastLocation,
  87.                                     FW_CRect& srcRect, FW_CRect& dstRect);
  88.     virtual FW_CRect    GetRectGeometry() const;
  89.     virtual FW_Boolean    HitTest(Environment* ev, FW_CGraphicContext& gc, const FW_CMouseEvent& theMouseEvent) const;
  90.     virtual void        MapShape(Environment* ev, const FW_CRect& srcRect, const FW_CRect& dstRect);
  91.     virtual void        OffsetShape(Environment* ev, FW_Fixed xDelta, FW_Fixed yDelta);
  92.     virtual void        RenderShape(Environment* ev, ODFacet* facet, FW_CGraphicContext& gc);
  93.     virtual void        ResizeFeedback(FW_CGraphicContext& gc, const FW_CInk& ink, const FW_CStyle& style, 
  94.                                         short whichHandle, const FW_CPoint& mouseLoc);
  95.     virtual void        SetShapeGeometry(const FW_CPoint& anchorPoint,  const FW_CPoint& currentPoint);
  96.  
  97.     // ----- Other CBaseShape overrides -----
  98.     virtual void        Deleted(Environment* ev);
  99.     virtual void        Removed(Environment* ev);
  100.     virtual void        RestoreShape(Environment* ev);
  101.  
  102.     virtual void         SelectShape(Environment* ev, FW_Boolean state);
  103.     virtual void        SubtractToWorkingClip(Environment* ev, 
  104.                                             CDrawFacetClipper* facetClipper, 
  105.                                             ODFacet* containingFacet, 
  106.                                             ODShape* workingClip,
  107.                                             ODShape* tempShape,
  108.                                             ODShape* limitShape);
  109.  
  110.     virtual void        SetSubscribeLink(Environment* ev, CDrawSubscribeLink* subscribeLink);
  111.  
  112.     // ----- Shape shifting -----
  113.     virtual void        ChangeFrameColor(Environment* ev, const FW_CColor& color);
  114.     virtual void        ChangeFramePattern(Environment* ev, const FW_CPattern& pattern);
  115.     virtual void        ChangeFillColor(Environment* ev, const FW_CColor& color);
  116.     virtual void        ChangeFillPattern(Environment* ev, const FW_CPattern& pattern);
  117.     virtual void        ChangePenSize(Environment* ev, FW_Fixed newPenSize);
  118.     virtual void        ChangeRenderVerb(Environment* ev, unsigned short renderVerb);
  119.  
  120.     // ----- Shape list operations -----
  121.     void                AddShape(CBaseShape* shape);
  122.     unsigned long        CountShapes() const;
  123.     unsigned long        CountProxyShapes(Environment* ev) const;
  124.     void                EmptyShapes(FW_Boolean deleteShapes);
  125.     CBaseShape*            GetFirstShape() const;
  126.     void                RemoveShapes();
  127.     void                Remove1Shape(CBaseShape* shape);
  128.  
  129.     CShapeCollection*    GetShapeList();
  130.  
  131.   private:
  132.     void                 OutlineShape(FW_CGraphicContext& gc, const FW_CInk& ink, const FW_CStyle& style, const FW_CRect& rect);
  133.  
  134.   private:
  135.     CShapeCollection*    fShapeList;    // list of CBaseShape*
  136. };
  137.  
  138. //----------------------------------------------------------------------------------------
  139. inline CShapeCollection* CGroupShape::GetShapeList()
  140. {
  141.     return fShapeList;
  142. }
  143.  
  144. //========================================================================================
  145. //    class CAllShapeIterator - iterate grouped shapes recursively
  146. //========================================================================================
  147.  
  148. class CAllShapeIterator
  149. {
  150.   public:
  151.     FW_DECLARE_AUTO(CAllShapeIterator)
  152.  
  153.     CAllShapeIterator(CShapeCollection* shapeList);
  154.     CAllShapeIterator(CDrawContent* content);
  155.     ~CAllShapeIterator();
  156.  
  157.     CBaseShape*    First();
  158.     CBaseShape*    Next();
  159.     FW_Boolean    IsNotComplete();
  160.     CBaseShape*    Last();
  161.     CBaseShape*    Previous();
  162.  
  163.     unsigned long CountShapes();
  164.  
  165.   private:
  166.     void        PrivFlattenList(CShapeCollection* shapeList);
  167.  
  168.     CShapeCollectionIterator*    fIter;
  169.     CShapeCollection*            fTempList;        // flattened list - temporary
  170. };
  171.  
  172. #endif
  173.