home *** CD-ROM | disk | FTP | other *** search
/ Mastering Microsoft Visual C++ 4 (2nd Edition) / VisualC4.ISO / minidrw6 / miniddoc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-30  |  3.5 KB  |  162 lines

  1. // MiniDDoc.h : interface of the CMiniDrawDoc class
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4.  
  5. // class hierarchy for figures:
  6.    
  7. class CFigure : public CObject
  8. {  
  9. protected:
  10.    COLORREF m_Color;
  11.    DWORD m_X1, m_Y1, m_X2, m_Y2;
  12.  
  13.    CFigure () {}
  14.    DECLARE_SERIAL (CFigure)
  15.    
  16. public:
  17.    virtual void Draw (CDC *PDC) {}
  18.    CRect GetDimRect ();
  19.    virtual void Serialize (CArchive& ar);
  20. };
  21.  
  22. class CLine : public CFigure
  23. {
  24. protected:
  25.    DWORD m_Thickness;
  26.    
  27.    CLine () {}
  28.    DECLARE_SERIAL (CLine)
  29.    
  30. public:
  31.    CLine (int X1, int Y1, int X2, int Y2, COLORREF Color, int Thickness);
  32.    virtual void Draw (CDC *PDC);
  33.    virtual void Serialize (CArchive& ar);
  34. };         
  35.  
  36. class CRectangle : public CFigure
  37. {
  38. protected:
  39.    DWORD m_Thickness;
  40.    
  41.    CRectangle () {}
  42.    DECLARE_SERIAL (CRectangle) 
  43.    
  44. public:   
  45.    CRectangle (int X1, int Y1, int X2, int Y2, COLORREF Color, int Thickness);
  46.    virtual void Draw (CDC *PDC);
  47.    virtual void Serialize (CArchive& ar);
  48. };
  49.  
  50. class CRectFill : public CFigure
  51. {
  52. protected:
  53.    CRectFill () {}
  54.    DECLARE_SERIAL (CRectFill) 
  55.    
  56. public:   
  57.    CRectFill (int X1, int Y1, int X2, int Y2, COLORREF Color);
  58.    virtual void Draw (CDC *PDC);
  59. };
  60.  
  61. class CRectRound : public CFigure
  62. {
  63. protected:
  64.    DWORD m_Thickness;
  65.    
  66.    CRectRound () {}
  67.    DECLARE_SERIAL (CRectRound) 
  68.    
  69. public:   
  70.    CRectRound (int X1, int Y1, int X2, int Y2, COLORREF Color, int Thickness);
  71.    virtual void Draw (CDC *PDC);
  72.    virtual void Serialize (CArchive& ar);
  73. };            
  74.  
  75. class CRectRoundFill : public CFigure
  76. {
  77. protected:
  78.    CRectRoundFill () {}
  79.    DECLARE_SERIAL (CRectRoundFill) 
  80.    
  81. public:   
  82.    CRectRoundFill (int X1, int Y1, int X2, int Y2, COLORREF Color);
  83.    virtual void Draw (CDC *PDC);
  84. };            
  85.  
  86. class CCircle : public CFigure
  87. {
  88. protected:
  89.    DWORD m_Thickness;
  90.    
  91.    CCircle () {}
  92.    DECLARE_SERIAL (CCircle) 
  93.    
  94. public:   
  95.    CCircle (int X1, int Y1, int X2, int Y2, COLORREF Color, int Thickness);
  96.    virtual void Draw (CDC *PDC);
  97.    virtual void Serialize (CArchive& ar);
  98. };
  99.  
  100. class CCircleFill : public CFigure
  101. {
  102. protected:
  103.    CCircleFill () {}
  104.    DECLARE_SERIAL (CCircleFill) 
  105.    
  106. public:   
  107.    CCircleFill (int X1, int Y1, int X2, int Y2, COLORREF Color);
  108.    virtual void Draw (CDC *PDC);
  109. };
  110.  
  111. class CMiniDrawDoc : public CDocument
  112. {
  113. protected:
  114.    CTypedPtrArray<CObArray, CFigure*> m_FigArray;
  115.    
  116. public:
  117.    void AddFigure (CFigure *PFigure);
  118.    CFigure *GetFigure (int Index);
  119.    int GetNumFigs ();
  120.  
  121. protected: // create from serialization only
  122.    CMiniDrawDoc();
  123.    DECLARE_DYNCREATE(CMiniDrawDoc)
  124.  
  125. // Attributes
  126. public:
  127.  
  128. // Operations
  129. public:
  130.  
  131. // Overrides
  132.    // ClassWizard generated virtual function overrides
  133.    //{{AFX_VIRTUAL(CMiniDrawDoc)
  134.    public:
  135.    virtual BOOL OnNewDocument();
  136.    virtual void Serialize(CArchive& ar);
  137.    virtual void DeleteContents();
  138.    //}}AFX_VIRTUAL
  139.  
  140. // Implementation
  141. public:
  142.    virtual ~CMiniDrawDoc();
  143. #ifdef _DEBUG
  144.    virtual void AssertValid() const;
  145.    virtual void Dump(CDumpContext& dc) const;
  146. #endif
  147.  
  148. protected:
  149.  
  150. // Generated message map functions
  151. protected:
  152.    //{{AFX_MSG(CMiniDrawDoc)
  153.    afx_msg void OnEditClearAll();
  154.    afx_msg void OnUpdateEditClearAll(CCmdUI* pCmdUI);
  155.    afx_msg void OnEditUndo();
  156.    afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
  157.    //}}AFX_MSG
  158.    DECLARE_MESSAGE_MAP()
  159. };
  160.  
  161. /////////////////////////////////////////////////////////////////////////////
  162.