Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

# 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 <qpointarray.h>
    00015 #include <qrect.h>
    00016 #include "qwt_global.h"
    00017 #include "qwt_layout_metrics.h"
    00018
    00019 class QPainter;
    00020
    00021 #if defined(Q_WS_X11)
    00022 // Warning: QCOORD_MIN, QCOORD_MAX are wrong on X11.
    00023 #define QWT_COORD_MAX 16384
    00024 #define QWT_COORD_MIN (-QWT_COORD_MAX - 1)
    00025 #else
    00026 #define QWT_COORD_MAX QCOORD_MAX
    00027 #define QWT_COORD_MIN QCOORD_MIN
    00028 #endif
    00029
    00050 class QWT_EXPORT QwtPainter
    00051 {
    00052 public:
    00060     enum TextXorRopMode {
    00061         XorRopTextNormal = 0,
    00062         XorRopTextKeepFont = 1,
    00063         XorRopTextKeepColor = 2
    00064     };
    00065
    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
    00075     static void setClipRect(QPainter *, const QRect &);
    00076
    00077     static void drawText(QPainter *, int x, int y,
    00078         const QString &, int len = -1);
    00079     static void drawText(QPainter *, const QPoint &,
    00080         const QString &, int len = -1);
    00081     static void drawText(QPainter *, int x, int y, int w, int h,
    00082         int flags, const QString &, int len = -1);
    00083     static void drawText(QPainter *, const QRect &,
    00084         int flags, const QString &, int len = -1);
    00085
    00086 #ifndef QT_NO_RICHTEXT
    00087     static void drawSimpleRichText(QPainter *, const QRect &,
    00088         int flags, QSimpleRichText &);
    00089 #endif
    00090
    00091     static void drawRect(QPainter *, int x, int y, int w, int h);
    00092     static void drawRect(QPainter *, const QRect &rect);
    00093     static void fillRect(QPainter *, const QRect &, const QBrush &);
    00094
    00095     static void drawEllipse(QPainter *, const QRect &);
    00096
    00097     static void drawLine(QPainter *, int x1, int y1, int x2, int y2);
    00098     static void drawLine(QPainter *, const QPoint &p1, const QPoint &p2);
    00099     static void drawPolygon(QPainter *, const QPointArray &pa);
    00100     static void drawPolyline(QPainter *, const QPointArray &pa);
    00101     static void drawPoint(QPainter *, int x, int y);
    00102
    00103     static void drawRoundFrame(QPainter *, const QRect &,
    00104         int width, const QColorGroup &cg, bool sunken);
    00105
    00106     static QPointArray clip(const QPointArray &);
    00107
    00108     static int textXorRopMode();
    00109     static int setTextXorRopMode(TextXorRopMode mode);
    00110
    00111 private:
    00112     static const QRect &deviceClipRect();
    00113     static void drawColoredArc(QPainter *, const QRect &,
    00114         int peak, int arc, int intervall, const QColor &c1, const QColor &c2);
    00115
    00116     static bool d_deviceClipping;
    00117     static QwtMetricsMap d_metricsMap;
    00118     static int d_textXorRopMode;
    00119 };
    00120
    00121 #endif
    00122
    00123 // Local Variables:
    00124 // mode: C++
    00125 // c-file-style: "stroustrup"
    00126 // indent-tabs-mode: nil
    00127 // End: