00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_RECT_H
00011 #define QWT_RECT_H
00012
00013 #include <qrect.h>
00014 #if QT_VERSION < 0x040000
00015 #include <qpointarray.h>
00016 #else
00017 #include <qpolygon.h>
00018 #endif
00019 #include "qwt_global.h"
00020
00021 class QPoint;
00022
00027 class QWT_EXPORT QwtRect : public QRect
00028 {
00029 public:
00030 QwtRect();
00031 QwtRect(const QRect &r);
00032
00033 QRect cutTop(int h , int distTop = 0, int distBottom = 0);
00034 QRect cutBottom(int h, int distTop = 0, int distBottom = 0);
00035 QRect cutLeft(int w, int distLeft = 0, int distRight = 0);
00036 QRect cutRight(int w, int distLeft = 0, int distRight = 0);
00037 const QwtRect &cutMargin(int mLeft, int mRight, int Top, int mBottom);
00038
00039 #if QT_VERSION < 0x040000
00040 QPointArray clip(const QPointArray &) const;
00041 #else
00042 QPolygon clip(const QPolygon &) const;
00043 #endif
00044
00045 private:
00046 enum Edge { Left, Top, Right, Bottom, NEdges };
00047
00048 #if QT_VERSION < 0x040000
00049 void clipEdge(Edge, const QPointArray &, QPointArray &) const;
00050 #else
00051 void clipEdge(Edge, const QPolygon &, QPolygon &) const;
00052 #endif
00053 bool insideEdge(const QPoint &, Edge edge) const;
00054 QPoint intersectEdge(const QPoint &p1,
00055 const QPoint &p2, Edge edge) const;
00056 };
00057
00058 #endif