- Main Page
- Related Pages
- Classes
- Files

- File List

# qwt_painter.h

    00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
    00002  * Qwt Widget Library
    00003  * Copyright (C) 1997   Josef Wilgen
    00004  * Copyright (C) 2002   Uwe Rathmann
    00005  *
    00006  * This library is free software; you can redistribute it and/or
    00007  * modify it under the terms of the Qwt License, Version 1.0
    00008  *****************************************************************************/
    00009
    00010 #ifndef QWT_PAINTER_H
    00011 #define QWT_PAINTER_H
    00012
    00013 #include <qpoint.h>
    00014 #include <qrect.h>
    00015 #include <qpen.h>
    00016 #include "qwt_global.h"
    00017 #include "qwt_layout_metrics.h"
    00018 #include "qwt_polygon.h"
    00019
    00020 class QPainter;
    00021 class QBrush;
    00022 class QColor;
    00023 class QWidget;
    00024 class QwtScaleMap;
    00025 class QwtColorMap;
    00026 class QwtDoubleInterval;
    00027
    00028 #if QT_VERSION < 0x040000
    00029 class QColorGroup;
    00030 class QSimpleRichText;
    00031 #else
    00032 class QPalette;
    00033 class QTextDocument;
    00034 #endif
    00035
    00036 #if defined(Q_WS_X11)
    00037 // Warning: QCOORD_MIN, QCOORD_MAX are wrong on X11.
    00038 #define QWT_COORD_MAX 16384
    00039 #define QWT_COORD_MIN (-QWT_COORD_MAX - 1)
    00040 #else
    00041 #define QWT_COORD_MAX 2147483647
    00042 #define QWT_COORD_MIN -QWT_COORD_MAX - 1
    00043 #endif
    00044
    00063 class QWT_EXPORT QwtPainter
    00064 {
    00065 public:
    00066     static void setMetricsMap(const QPaintDevice *layout,
    00067         const QPaintDevice *device);
    00068     static void setMetricsMap(const QwtMetricsMap &);
    00069     static void resetMetricsMap();
    00070     static const QwtMetricsMap &metricsMap();
    00071
    00072     static void setDeviceClipping(bool);
    00073     static bool deviceClipping();
    00074     static const QRect &deviceClipRect();
    00075
    00076     static void setClipRect(QPainter *, const QRect &);
    00077
    00078     static void drawText(QPainter *, int x, int y,
    00079         const QString &);
    00080     static void drawText(QPainter *, const QPoint &,
    00081         const QString &);
    00082     static void drawText(QPainter *, int x, int y, int w, int h,
    00083         int flags, const QString &);
    00084     static void drawText(QPainter *, const QRect &,
    00085         int flags, const QString &);
    00086
    00087 #ifndef QT_NO_RICHTEXT
    00088 #if QT_VERSION < 0x040000
    00089     static void drawSimpleRichText(QPainter *, const QRect &,
    00090         int flags, QSimpleRichText &);
    00091 #else
    00092     static void drawSimpleRichText(QPainter *, const QRect &,
    00093         int flags, QTextDocument &);
    00094 #endif
    00095 #endif
    00096
    00097     static void drawRect(QPainter *, int x, int y, int w, int h);
    00098     static void drawRect(QPainter *, const QRect &rect);
    00099     static void fillRect(QPainter *, const QRect &, const QBrush &);
    00100
    00101     static void drawEllipse(QPainter *, const QRect &);
    00102     static void drawPie(QPainter *, const QRect & r, int a, int alen);
    00103
    00104     static void drawLine(QPainter *, int x1, int y1, int x2, int y2);
    00105     static void drawLine(QPainter *, const QPoint &p1, const QPoint &p2);
    00106     static void drawPolygon(QPainter *, const QwtPolygon &pa);
    00107     static void drawPolyline(QPainter *, const QwtPolygon &pa);
    00108     static void drawPoint(QPainter *, int x, int y);
    00109
    00110 #if QT_VERSION < 0x040000
    00111     static void drawRoundFrame(QPainter *, const QRect &,
    00112         int width, const QColorGroup &cg, bool sunken);
    00113 #else
    00114     static void drawRoundFrame(QPainter *, const QRect &,
    00115         int width, const QPalette &, bool sunken);
    00116 #endif
    00117     static void drawFocusRect(QPainter *, QWidget *);
    00118     static void drawFocusRect(QPainter *, QWidget *, const QRect &);
    00119
    00120     static void drawColorBar(QPainter *painter,
    00121         const QwtColorMap &, const QwtDoubleInterval &,
    00122         const QwtScaleMap &, Qt::Orientation, const QRect &);
    00123
    00124 #if QT_VERSION < 0x040000
    00125     static void setSVGMode(bool on);
    00126     static bool isSVGMode();
    00127 #endif
    00128
    00129     static QPen scaledPen(const QPen &);
    00130
    00131 private:
    00132     static void drawColoredArc(QPainter *, const QRect &,
    00133         int peak, int arc, int intervall, const QColor &c1, const QColor &c2);
    00134
    00135     static bool d_deviceClipping;
    00136     static QwtMetricsMap d_metricsMap;
    00137 #if QT_VERSION < 0x040000
    00138     static bool d_SVGMode;
    00139 #endif
    00140 };
    00141
    00143 inline void QwtPainter::drawLine(QPainter *painter,
    00144     const QPoint &p1, const QPoint &p2)
    00145 {
    00146     drawLine(painter, p1.x(), p1.y(), p2.x(), p2.y());
    00147 }
    00148
    00154 inline bool QwtPainter::deviceClipping()
    00155 {
    00156     return d_deviceClipping;
    00157 }
    00158
    00159 #endif