Qwt User's Guide 6.0.2

- Main Page
- Related Pages
- Classes

qwt_plot_renderer.h
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_PLOT_RENDERER_H
11 #define QWT_PLOT_RENDERER_H
12
13 #include "qwt_global.h"
14 #include <qobject.h>
15
16 class QwtPlot;
17 class QwtScaleMap;
18 class QSizeF;
19 class QRectF;
20 class QPainter;
21 class QPaintDevice;
22
23 #ifndef QT_NO_PRINTER
24 class QPrinter;
25 #endif
26
27 #ifndef QWT_NO_SVG
28 #ifdef QT_SVG_LIB
29 class QSvgGenerator;
30 #endif
31 #endif
32
37 class QWT_EXPORT QwtPlotRenderer: public QObject
38 {
39 Q_OBJECT
40
41 public:
43 enum DiscardFlag
44 {
46 DiscardNone = 0x00,
47
49 DiscardBackground = 0x01,
50
52 DiscardTitle = 0x02,
53
55 DiscardLegend = 0x04,
56
58 DiscardCanvasBackground = 0x08
59 };
60
62 typedef QFlags<DiscardFlag> DiscardFlags;
63
68 enum LayoutFlag
69 {
71 DefaultLayout = 0x00,
72
77 KeepFrames = 0x01,
78
83 FrameWithScales = 0x02
84 };
85
87 typedef QFlags<LayoutFlag> LayoutFlags;
88
89 explicit QwtPlotRenderer( QObject * = NULL );
90 virtual ~QwtPlotRenderer();
91
92 void setDiscardFlag( DiscardFlag flag, bool on = true );
93 bool testDiscardFlag( DiscardFlag flag ) const;
94
95 void setDiscardFlags( DiscardFlags flags );
96 DiscardFlags discardFlags() const;
97
98 void setLayoutFlag( LayoutFlag flag, bool on = true );
99 bool testLayoutFlag( LayoutFlag flag ) const;
100
101 void setLayoutFlags( LayoutFlags flags );
102 LayoutFlags layoutFlags() const;
103
104 void renderDocument( QwtPlot *, const QString &fileName,
105 const QSizeF &sizeMM, int resolution = 85 );
106
107 void renderDocument( QwtPlot *,
108 const QString &fileName, const QString &format,
109 const QSizeF &sizeMM, int resolution = 85 );
110
111 #ifndef QWT_NO_SVG
112 #ifdef QT_SVG_LIB
113 #if QT_VERSION >= 0x040500
114 void renderTo( QwtPlot *, QSvgGenerator & ) const;
115 #endif
116 #endif
117 #endif
118
119 #ifndef QT_NO_PRINTER
120 void renderTo( QwtPlot *, QPrinter & ) const;
121 #endif
122
123 void renderTo( QwtPlot *, QPaintDevice &p ) const;
124
125 virtual void render( QwtPlot *,
126 QPainter *, const QRectF &rect ) const;
127
128 virtual void renderLegendItem( const QwtPlot *,
129 QPainter *, const QWidget *, const QRectF & ) const;
130
131 virtual void renderTitle( const QwtPlot *,
132 QPainter *, const QRectF & ) const;
133
134 virtual void renderScale( const QwtPlot *, QPainter *,
135 int axisId, int startDist, int endDist,
136 int baseDist, const QRectF & ) const;
137
138 virtual void renderCanvas( const QwtPlot *,
139 QPainter *, const QRectF &canvasRect,
140 const QwtScaleMap* maps ) const;
141
142 virtual void renderLegend(
143 const QwtPlot *, QPainter *, const QRectF & ) const;
144
145 protected:
146 void buildCanvasMaps( const QwtPlot *,
147 const QRectF &, QwtScaleMap maps[] ) const;
148
149 private:
150 class PrivateData;
151 PrivateData *d_data;
152 };
153
154 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::DiscardFlags )
155 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::LayoutFlags )
156
157 #endif