Лабораторные работы: пятнашки и редактор фигур
This commit is contained in:
commit
a5dbf9d3a2
1 changed files with 2579 additions and 0 deletions
51
BaseFigure.h
Normal file
51
BaseFigure.h
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
// Базовый (абстрактный) класс фигуры
|
||||
#ifndef BaseFigureH
|
||||
#define BaseFigureH
|
||||
|
||||
#include <vcl.h>
|
||||
|
||||
// ограничения из задания
|
||||
const int SIDE_MIN = 20;
|
||||
const int SIDE_MAX = 1000;
|
||||
const int POS_MIN = -2000;
|
||||
const int POS_MAX = 10000;
|
||||
|
||||
int InRange(int v, int a, int b);
|
||||
|
||||
class TFigure
|
||||
{
|
||||
protected:
|
||||
int num; // номер фигуры
|
||||
int x, y; // левый верхний угол
|
||||
int w, h; // ширина и высота
|
||||
TColor fillColor; // цвет заливки
|
||||
TColor lineColor; // цвет обводки
|
||||
|
||||
void SetupCanvas(TCanvas *c);
|
||||
void PaintNumber(TCanvas *c);
|
||||
|
||||
public:
|
||||
TFigure(int aNum);
|
||||
virtual ~TFigure();
|
||||
|
||||
// чисто виртуальные методы - их переопределяют наследники
|
||||
virtual void Draw(TCanvas *c) = 0;
|
||||
virtual bool Contains(int px, int py) = 0;
|
||||
virtual String TypeName() = 0; // имя для файла
|
||||
virtual String RusName() = 0; // имя для меню
|
||||
|
||||
int GetNum();
|
||||
int GetX();
|
||||
int GetY();
|
||||
int GetW();
|
||||
int GetH();
|
||||
TColor GetFill();
|
||||
TColor GetLine();
|
||||
|
||||
void SetBounds(int ax, int ay, int aw, int ah);
|
||||
void MoveTo(int ax, int ay);
|
||||
void SetFill(TColor c);
|
||||
void SetLine(TColor c);
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Reference in a new issue