Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лабораторная работа 3 / lab3 / Sketcher / Elements
.h#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