//-------------------------------------------
// DrawList.h - sicherer@sichemsoft.nl
// Complete commented code available on line
//-------------------------------------------
// ... #includes and typedefs omitted
//-------------------------------------------
class TDrawItem : public TObject
{
public:
static TDrawItem *Load(ifstream &ifp);
virtual void Save(ofstream &ofp) = 0;
virtual void Draw(TDrawBox *drawBox) = 0;
// ... other functions
protected:
TDrawItem(double x1, double y1,
double x2, double y2,
TColor lineColor,
TColor fillColor);
TDrawItem(ifstream &ifp);
void
Save(ofstream &ofp, TDrawItemType type);
// ... other functions
double X1, Y1, X2, Y2;
TColor LineColor, FillColor;
};
//-------------------------------------------
class TLineItem : public TDrawItem
{
public:
TLineItem(double x1, double y1,
double x2, double y2, TColor lineColor);
TLineItem(ifstream &ifp);
virtual void Save(ofstream &ofp);
virtual void Draw(TDrawBox *drawBox);
private:
double LX1, LY1, LX2, LY2;
};
//-------------------------------------------
// other shape classes omitted
//-------------------------------------------
class TDrawList
{
public:
TDrawList();
~TDrawList();
bool Load(const AnsiString &filename);
void Save(const AnsiString &filename);
void Draw(TDrawBox *drawBox);
// ... other functions omitted
private:
typedef list<TDrawItem *> TInternalDrawList;
TInternalDrawList List;
TInternalDrawList::iterator Current;
};