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 #include "qwt_global.h"
00015
00016 class QPoint;
00017 class QPointArray;
00018
00023 class QWT_EXPORT QwtRect : public QRect
00024 {
00025 public:
00026 QwtRect();
00027 QwtRect(const QRect &r);
00028
00029 QRect cutTop(int h , int distTop = 0, int distBottom = 0);
00030 QRect cutBottom(int h, int distTop = 0, int distBottom = 0);
00031 QRect cutLeft(int w, int distLeft = 0, int distRight = 0);
00032 QRect cutRight(int w, int distLeft = 0, int distRight = 0);
00033 const QwtRect &cutMargin(int mLeft, int mRight, int Top, int mBottom);
00034
00035 QPointArray clip(const QPointArray &) const;
00036
00037 private:
00038 enum Edge { Left, Top, Right, Bottom, NEdges };
00039
00040 void clipEdge(Edge, const QPointArray &, QPointArray &) const;
00041 bool insideEdge(const QPoint &, Edge edge) const;
00042 QPoint intersectEdge(const QPoint &p1,
00043 const QPoint &p2, Edge edge) const;
00044 };
00045
00046 #endif