Скачиваний:
10
Добавлен:
01.05.2014
Размер:
2.41 Кб
Скачать
#ifndef Elements_h
#define Elements_h
//////////////////////////////////////////////////////////////////////////
#include "OurConstants.h"
//////////////////////////////////////////////////////////////////////////
// Generic element class

class CElement: public CObject
{
	DECLARE_SERIAL(CElement)
protected:
    // Color of an element
	
    COLORREF m_Color;                 

    // Rectangle enclosing an element
	
    CRect m_EnclosingRect;            

    // Pen width
	
    int m_Pen;                         
public:
	
    COLORREF Color() const { return m_Color; }
	
    void Color(COLORREF val) { m_Color = val; }

	//изменяет размер фигуры
	
    virtual void resize(CPoint Start, CPoint End);

	//определен для совместимости с фигурой по указателю
	
    virtual bool operator==(const CElement& rhs) const;

    // Virtual destructor
	
    virtual ~CElement(){}

    // Virtual draw operation
	
    virtual void Draw(CDC* pDC, CElement* pElement=0, bool isIdVisible = true){};

    // Get the bounding rectangle for an element
	
    CRect GetBoundRect();

	
    virtual void Move(CSize& aSize);
protected:
    // Default constructor
	
    CElement(){m_Color = BLACK;}
	//{{AFX_VIRTUAL(CElement)
	public:
	
	virtual void Serialize(CArchive& ar);
	//}}AFX_VIRTUAL

};

// Class defining a line object

class CLine: public CElement
{
public:
	//изменяет размер фигуры
	
	virtual void resize(CPoint Start, CPoint End);

    // Function to display a line
	
	virtual void Draw(CDC* pDC, CElement* pElement=0, bool isIdVisible = true);

	
	void Move(CSize& aSize);

    // Constructor for a line object
	
    CLine(CPoint Start, CPoint End, COLORREF aColor);
protected:
    // Start point of line
	
    CPoint m_StartPoint;          

    // End point of line
	
    CPoint m_EndPoint;            

    // Default constructor - should not be used
	
    CLine(){}             
};

// Class defining a rectangle object

class CRectangle: public CElement
{
public:
    // Function to display a rectangle
	
	virtual void Draw(CDC* pDC, CElement* pElement=0);  

	
	void Move(CSize& aSize);

    // Constructor for a rectangle object
	
    CRectangle(CPoint Start, CPoint End, COLORREF aColor);
protected:
    // Default constructor - should not be used
	
    CRectangle(){}        
};
#endif
Соседние файлы в папке Sketcher