Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лабораторная работа 31 / oot / OLEApp / Elements
.h#ifndef Elements_h
#define Elements_h
#include "Hashable.h"
#include <iostream>
using namespace std;
// Generic element class
class CElement: virtual public CObject, virtual public Hashable
{
private:
static unsigned long int count;
static unsigned long int total;
const unsigned long int id;
protected:
COLORREF m_Color; // Color of an element
CRect m_EnclosingRect; // Rectangle enclosing an element
CRect m_keyRectangle;
int m_Pen; // Pen width
public:
virtual ~CElement(){ // Virtual destructor
count--;
cout << "destroy Shape#" << id << endl;
}
virtual void Draw(CDC* pDC, CElement* pElement=0, string key = "") {}
virtual void setColor(COLORREF aColor);
virtual COLORREF getColor();
virtual void Move(CSize& aSize) {} // Move an element
CRect GetBoundRect(); // Get the bounding rectangle for an element
virtual ostream& print(ostream& os) const = 0;
friend ostream& operator<<(ostream& os, const CElement* o) {
return o->print(os);
}
friend ostream& operator<<(ostream& os, const CElement& o) {
return o.print(os);
}
virtual CArchive& save(CArchive& ar);
virtual CArchive& load(CArchive& ar);
unsigned long int getObjectId() const{
return id;
}
static unsigned long int getNumberOfObjects(){ //const
return count;
}
CElement(): id(++total){ // Default constructor
count++;
cout << "create Shape#" << id << endl;
}
CRect drawKey(CDC* pDC, string text);
CRect getKeyRectangle();
};
#endif
Соседние файлы в папке OLEApp