mitushkin-infa/FigureList.h

50 lines
1.1 KiB
C++

#ifndef FigureListH
#define FigureListH
#include <vector>
#include "BaseFigure.h"
struct TFigLink
{
TFigure *from;
TFigure *to;
TColor color;
int width;
};
class TFigureManager
{
private:
std::vector<TFigure*> list;
std::vector<TFigLink*> links;
int lastNum;
TFigure* MakeFigure(String type, int aNum);
void FreeAll();
bool Joined(TFigure *a, TFigure *b);
public:
TFigureManager();
~TFigureManager();
TFigure* Add(String type, int ax, int ay, int aw, int ah, TColor fill, TColor line);
void Delete(TFigure *f);
void Clear();
int Count();
TFigure* FindAt(int px, int py);
void FindInRect(TRect r, std::vector<TFigure*> &out);
bool ToTop(std::vector<TFigure*> &figs);
TFigLink* JoinTwo(TFigure *a, TFigure *b, TColor color, int width);
bool Join(std::vector<TFigure*> &figs, TColor color, int width);
bool Unjoin(std::vector<TFigure*> &figs);
bool AnyLinks(std::vector<TFigure*> &figs);
TFigLink* LinkAt(int px, int py);
void DeleteLink(TFigLink *l);
void PaintAll(TCanvas *c);
void Save(String fileName);
void Load(String fileName);
};
#endif