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 |
|
---|
20 | Sometimes important layout/rendering geometries are not
|
---|
21 | available or changeable from the public Qt class interface.
|
---|
22 | ( f.e hidden in the style implementation ).
|
---|
23 |
|
---|
24 | QwtNullPaintDevice can be used to manipulate or filter out
|
---|
25 | this information by analyzing the stream of paint primitives.
|
---|
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:
|
---|
34 | /*!
|
---|
35 | \brief Render mode
|
---|
36 |
|
---|
37 | \sa setMode(), mode()
|
---|
38 | */
|
---|
39 | enum Mode
|
---|
40 | {
|
---|
41 | /*!
|
---|
42 | All vector graphic primitives are painted by
|
---|
43 | the corresponding draw methods
|
---|
44 | */
|
---|
45 | NormalMode,
|
---|
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();
|
---|
72 | virtual ~QwtNullPaintDevice();
|
---|
73 |
|
---|
74 | void setMode( Mode );
|
---|
75 | Mode mode() const;
|
---|
76 |
|
---|
77 | virtual QPaintEngine *paintEngine() const;
|
---|
78 |
|
---|
79 | virtual int metric( PaintDeviceMetric metric ) const;
|
---|
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 &,
|
---|
107 | const QPixmap &, const QPointF &s);
|
---|
108 |
|
---|
109 | virtual void drawImage(const QRectF &,
|
---|
110 | const QImage &, const QRectF &, Qt::ImageConversionFlags );
|
---|
111 |
|
---|
112 | virtual void updateState( const QPaintEngineState &state );
|
---|
113 |
|
---|
114 | protected:
|
---|
115 | //! \return Size needed to implement metric()
|
---|
116 | virtual QSize sizeMetrics() const = 0;
|
---|
117 |
|
---|
118 | private:
|
---|
119 | class PaintEngine;
|
---|
120 | PaintEngine *d_engine;
|
---|
121 |
|
---|
122 | class PrivateData;
|
---|
123 | PrivateData *d_data;
|
---|
124 | };
|
---|
125 |
|
---|
126 | #endif
|
---|