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 <qdom.h>
00010 #include "Point.h"
00011
00012 class Rect
00013 {
00014 public:
00015 Rect(Point s=0,Point e=0,QColor c="black",int w=1,bool f=true, QColor fi="white");
00016 QStringList Info();
00017 void save(QTextStream *t);
00018 void open(QTextStream *t,int version);
00019 QDomElement saveXML(QDomDocument doc);
00020 void openXML(QDomNode node);
00021 Point startPoint() { return start; }
00022 Point endPoint() { return end; }
00023 void setStartPoint(double x, double y) { start=Point(x,y);}
00024 void setEndPoint(double x, double y) { end=Point(x,y);}
00025 int Width() { return width; }
00026 void setWidth(int w) { width=w; }
00027 QColor Color() { return color; }
00028 void setColor(QColor c) { color=c; }
00029 void setColor(QString c) { color=QColor(c); }
00030 QColor FillColor() { return fillcolor; }
00031 void setFillColor(QColor c) { fillcolor=c; }
00032 void setFillColor(QString c) { fillcolor=QColor(c); }
00033 bool isFilled() { return filled; }
00034 void setFilled(bool f=true) { filled=f; }
00035 void draw(QPainter *p, int w, int h);
00036 bool inside(int x, int y, int w, int h);
00037 protected:
00038 Point start, end;
00039 QColor color;
00040 int width;
00041 bool filled;
00042 QColor fillcolor;
00043 };
00044
00045 #endif //RECT_H