00001
00002
00003 #ifndef RECT_H
00004 #define RECT_H
00005
00006 #include <qcolor.h>
00007 #include <qpainter.h>
00008 #include <qstringlist.h>
00009 #include "Point.h"
00010
00011 class Rect
00012 {
00013 public:
00014 Rect(Point s=0,Point e=0,QColor c="black",int w=1,bool f=true, QColor fi="white");
00015 QStringList Info();
00016 void save(QTextStream *t);
00017 void open(QTextStream *t,int version);
00018 Point startPoint() { return start; }
00019 Point endPoint() { return end; }
00020 void setStartPoint(double x, double y) { start=Point(x,y);}
00021 void setEndPoint(double x, double y) { end=Point(x,y);}
00022 int Width() { return width; }
00023 void setWidth(int w) { width=w; }
00024 QColor Color() { return color; }
00025 void setColor(QColor c) { color=c; }
00026 void setColor(QString c) { color=QColor(c); }
00027 QColor FillColor() { return fill; }
00028 void setFillColor(QColor c) { fill=c; }
00029 void setFillColor(QString c) { fill=QColor(c); }
00030 bool isFilled() { return filled; }
00031 void setFilled(bool f=true) { filled=f; }
00032 void draw(QPainter *p, int w, int h);
00033 bool inside(int x, int y, int w, int h);
00034 protected:
00035 Point start, end;
00036 QColor color;
00037 int width;
00038 bool filled;
00039 QColor fill;
00040 };
00041
00042 #endif //RECT_H