Скачиваний:
9
Добавлен:
01.05.2014
Размер:
3.64 Кб
Скачать
// SketcherDoc.h : interface of the CSketcherDoc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_SKETCHERDOC_H__623441AB_57EA_11D0_9257_00201834E2A3__INCLUDED_)
#define AFX_SKETCHERDOC_H__623441AB_57EA_11D0_9257_00201834E2A3__INCLUDED_

#include "figure.h"
#include "textDialog.h"
#include "Graph.h"
#include "Iterator.h"
#include "GraphStructureException.h"

class CSketcherDoc : public CDocument
{
protected: // create from serialization only
	CSketcherDoc();
	DECLARE_DYNCREATE(CSketcherDoc)

// Attributes
public:
	const char*ptext;
	Graph<Figure*> elements;

protected:
	COLORREF m_Color;		// Current drawing color
	WORD m_Element;			// Current element type
    //CTypedPtrList<CObList, Figure*> m_ElementList;  // Element list

// Operations
public:
   WORD GetElementType()                     // Get the element type
      { return m_Element; }
   COLORREF GetElementColor()                // Get the element color
      { return m_Color; }
   void AddElement(Figure* pElement)       // Add an element to the list
   {
	   //m_ElementList.AddTail(pElement); 
	   try {
			elements.add(pElement);
	   	   } catch (GraphStructureException ex) {
		AfxMessageBox(ex.getCauseMsg(), MB_OK);
	   }
   }
//   POSITION GetListHeadPosition()            // Return list head POSITION value
//      { return m_ElementList.GetHeadPosition(); }
//  Figure* GetNext(POSITION& aPos)         // Return current element pointer
//      { return m_ElementList.GetNext(aPos); }
//  POSITION GetListTailPosition()            // Return list tail POSITION value
//     { return m_ElementList.GetTailPosition(); }
//   Figure* GetPrev(POSITION& aPos)         // Return current element pointer
//      { return m_ElementList.GetPrev(aPos); }
   void DeleteElement(Figure* pElement);   // Delete an element
   void SendToBack(Figure* pElement);      // Send element to start of list
   CSize GetDocSize()                        // Retrieve the document size
	  { return m_DocSize; }
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSketcherDoc)
	public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CSketcherDoc();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	CTextDialog txtDlg;
	CSize m_DocSize;
public:
	int m_view_scale;

// Generated message map functions
protected:
	//{{AFX_MSG(CSketcherDoc)
	afx_msg void OnColorBlack();
	afx_msg void OnColorRed();
	afx_msg void OnUpdateColorBlack(CCmdUI* pCmdUI);
	afx_msg void OnUpdateColorRed(CCmdUI* pCmdUI);
	afx_msg void OnElementPentagon();
	afx_msg void OnUpdateElementPentagon(CCmdUI* pCmdUI);
	afx_msg void OnElementTriangle();
	afx_msg void OnUpdateElementTriangle(CCmdUI* pCmdUI);
	afx_msg void OnElementTextinpentagon();
	afx_msg void OnUpdateElementTextinpentagon(CCmdUI* pCmdUI);
	afx_msg void OnElementText();
	afx_msg void OnUpdateElementText(CCmdUI* pCmdUI);
	afx_msg void OnColorBlue();
	afx_msg void OnUpdateColorBlue(CCmdUI* pCmdUI);
	afx_msg void OnColorGreen();
	afx_msg void OnUpdateColorGreen(CCmdUI* pCmdUI);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SKETCHERDOC_H__623441AB_57EA_11D0_9257_00201834E2A3__INCLUDED_)
Соседние файлы в папке Лабораторная работа 23