[4271] | 1 | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
---|
| 2 | * Qwt Widget Library
|
---|
| 3 | * Copyright (C) 1997 Josef Wilgen
|
---|
| 4 | * Copyright (C) 2002 Uwe Rathmann
|
---|
| 5 | *
|
---|
| 6 | * This library is free software; you can redistribute it and/or
|
---|
| 7 | * modify it under the terms of the Qwt License, Version 1.0
|
---|
| 8 | *****************************************************************************/
|
---|
| 9 |
|
---|
| 10 | #ifndef QWT_NULL_PAINT_DEVICE_H
|
---|
| 11 | #define QWT_NULL_PAINT_DEVICE_H 1
|
---|
| 12 |
|
---|
| 13 | #include "qwt_global.h"
|
---|
| 14 | #include <qpaintdevice.h>
|
---|
| 15 | #include <qpaintengine.h>
|
---|
| 16 |
|
---|
| 17 | /*!
|
---|
| 18 | \brief A null paint device doing nothing
|
---|
| 19 |
|
---|
[9383] | 20 | Sometimes important layout/rendering geometries are not
|
---|
| 21 | available or changeable from the public Qt class interface.
|
---|
[4271] | 22 | ( f.e hidden in the style implementation ).
|
---|
| 23 |
|
---|
[9383] | 24 | QwtNullPaintDevice can be used to manipulate or filter out
|
---|
[8127] | 25 | this information by analyzing the stream of paint primitives.
|
---|
[4271] | 26 |
|
---|
| 27 | F.e. QwtNullPaintDevice is used by QwtPlotCanvas to identify
|
---|
| 28 | styled backgrounds with rounded corners.
|
---|
| 29 | */
|
---|
| 30 |
|
---|
| 31 | class QWT_EXPORT QwtNullPaintDevice: public QPaintDevice
|
---|
| 32 | {
|
---|
| 33 | public:
|
---|
[8127] | 34 | /*!
|
---|
| 35 | \brief Render mode
|
---|
[4271] | 36 |
|
---|
[8127] | 37 | \sa setMode(), mode()
|
---|
| 38 | */
|
---|
| 39 | enum Mode
|
---|
| 40 | {
|
---|
| 41 | /*!
|
---|
| 42 | All vector graphic primitives are painted by
|
---|
| 43 | the corresponding draw methods
|
---|
| 44 | */
|
---|
[9383] | 45 | NormalMode,
|
---|
[8127] | 46 |
|
---|
| 47 | /*!
|
---|
| 48 | Vector graphic primitives ( beside polygons ) are mapped to a QPainterPath
|
---|
| 49 | and are painted by drawPath. In PathMode mode
|
---|
| 50 | only a few draw methods are called:
|
---|
| 51 |
|
---|
| 52 | - drawPath()
|
---|
| 53 | - drawPixmap()
|
---|
| 54 | - drawImage()
|
---|
| 55 | - drawPolygon()
|
---|
| 56 | */
|
---|
| 57 | PolygonPathMode,
|
---|
| 58 |
|
---|
| 59 | /*!
|
---|
| 60 | Vector graphic primitives are mapped to a QPainterPath
|
---|
| 61 | and are painted by drawPath. In PathMode mode
|
---|
| 62 | only a few draw methods are called:
|
---|
| 63 |
|
---|
| 64 | - drawPath()
|
---|
| 65 | - drawPixmap()
|
---|
| 66 | - drawImage()
|
---|
| 67 | */
|
---|
| 68 | PathMode
|
---|
| 69 | };
|
---|
| 70 |
|
---|
| 71 | QwtNullPaintDevice();
|
---|
[4271] | 72 | virtual ~QwtNullPaintDevice();
|
---|
| 73 |
|
---|
[8127] | 74 | void setMode( Mode );
|
---|
| 75 | Mode mode() const;
|
---|
[4271] | 76 |
|
---|
| 77 | virtual QPaintEngine *paintEngine() const;
|
---|
[8127] | 78 |
|
---|
[9383] | 79 | virtual int metric( PaintDeviceMetric ) const;
|
---|
[4271] | 80 |
|
---|
| 81 | virtual void drawRects(const QRect *, int );
|
---|
| 82 | virtual void drawRects(const QRectF *, int );
|
---|
| 83 |
|
---|
| 84 | virtual void drawLines(const QLine *, int );
|
---|
| 85 | virtual void drawLines(const QLineF *, int );
|
---|
| 86 |
|
---|
| 87 | virtual void drawEllipse(const QRectF &);
|
---|
| 88 | virtual void drawEllipse(const QRect &);
|
---|
| 89 |
|
---|
| 90 | virtual void drawPath(const QPainterPath &);
|
---|
| 91 |
|
---|
| 92 | virtual void drawPoints(const QPointF *, int );
|
---|
| 93 | virtual void drawPoints(const QPoint *, int );
|
---|
| 94 |
|
---|
| 95 | virtual void drawPolygon(
|
---|
| 96 | const QPointF *, int , QPaintEngine::PolygonDrawMode );
|
---|
| 97 |
|
---|
| 98 | virtual void drawPolygon(
|
---|
| 99 | const QPoint *, int , QPaintEngine::PolygonDrawMode );
|
---|
| 100 |
|
---|
| 101 | virtual void drawPixmap(const QRectF &,
|
---|
| 102 | const QPixmap &, const QRectF &);
|
---|
| 103 |
|
---|
| 104 | virtual void drawTextItem(const QPointF &, const QTextItem &);
|
---|
| 105 |
|
---|
| 106 | virtual void drawTiledPixmap(const QRectF &,
|
---|
[9383] | 107 | const QPixmap &, const QPointF & );
|
---|
[4271] | 108 |
|
---|
| 109 | virtual void drawImage(const QRectF &,
|
---|
| 110 | const QImage &, const QRectF &, Qt::ImageConversionFlags );
|
---|
| 111 |
|
---|
[9383] | 112 | virtual void updateState( const QPaintEngineState & );
|
---|
[4271] | 113 |
|
---|
[8127] | 114 | protected:
|
---|
| 115 | //! \return Size needed to implement metric()
|
---|
| 116 | virtual QSize sizeMetrics() const = 0;
|
---|
| 117 |
|
---|
[4271] | 118 | private:
|
---|
| 119 | class PaintEngine;
|
---|
| 120 | PaintEngine *d_engine;
|
---|
| 121 |
|
---|
| 122 | class PrivateData;
|
---|
| 123 | PrivateData *d_data;
|
---|
| 124 | };
|
---|
| 125 |
|
---|
| 126 | #endif
|
---|