1 | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
---|
2 | * QwtPolar Widget Library
|
---|
3 | * Copyright (C) 2008 Uwe Rathmann
|
---|
4 | *
|
---|
5 | * This library is free software; you can redistribute it and/or
|
---|
6 | * modify it under the terms of the Qwt License, Version 1.0
|
---|
7 | *****************************************************************************/
|
---|
8 |
|
---|
9 | #ifndef QWT_POLAR_CANVAS_H
|
---|
10 | #define QWT_POLAR_CANVAS_H 1
|
---|
11 |
|
---|
12 | #include "qwt_polar_global.h"
|
---|
13 | #include <qwt_point_polar.h>
|
---|
14 | #include <qframe.h>
|
---|
15 |
|
---|
16 | class QPainter;
|
---|
17 | class QwtPolarPlot;
|
---|
18 |
|
---|
19 | /*!
|
---|
20 | \brief Canvas of a QwtPolarPlot.
|
---|
21 |
|
---|
22 | The canvas is the widget, where all polar items are painted to.
|
---|
23 |
|
---|
24 | \note In opposite to QwtPlot all axes are painted on the canvas.
|
---|
25 | \sa QwtPolarPlot
|
---|
26 | */
|
---|
27 | class QWT_POLAR_EXPORT QwtPolarCanvas: public QFrame
|
---|
28 | {
|
---|
29 | Q_OBJECT
|
---|
30 |
|
---|
31 | public:
|
---|
32 | /*!
|
---|
33 | \brief Paint attributes
|
---|
34 |
|
---|
35 | The default setting enables BackingStore
|
---|
36 |
|
---|
37 | \sa setPaintAttribute(), testPaintAttribute(), backingStore()
|
---|
38 | */
|
---|
39 |
|
---|
40 | enum PaintAttribute
|
---|
41 | {
|
---|
42 | /*!
|
---|
43 | Paint double buffered and reuse the content of the pixmap buffer
|
---|
44 | for some spontaneous repaints that happen when a plot gets unhidden,
|
---|
45 | deiconified or changes the focus.
|
---|
46 | */
|
---|
47 | BackingStore = 0x01
|
---|
48 | };
|
---|
49 |
|
---|
50 | //! Paint attributes
|
---|
51 | typedef QFlags<PaintAttribute> PaintAttributes;
|
---|
52 |
|
---|
53 | explicit QwtPolarCanvas( QwtPolarPlot * );
|
---|
54 | virtual ~QwtPolarCanvas();
|
---|
55 |
|
---|
56 | QwtPolarPlot *plot();
|
---|
57 | const QwtPolarPlot *plot() const;
|
---|
58 |
|
---|
59 | void setPaintAttribute( PaintAttribute, bool on = true );
|
---|
60 | bool testPaintAttribute( PaintAttribute ) const;
|
---|
61 |
|
---|
62 | const QPixmap *backingStore() const;
|
---|
63 | void invalidateBackingStore();
|
---|
64 |
|
---|
65 | QwtPointPolar invTransform( const QPoint & ) const;
|
---|
66 | QPoint transform( const QwtPointPolar & ) const;
|
---|
67 |
|
---|
68 | protected:
|
---|
69 | virtual void paintEvent( QPaintEvent * );
|
---|
70 | virtual void resizeEvent( QResizeEvent * );
|
---|
71 |
|
---|
72 | private:
|
---|
73 | class PrivateData;
|
---|
74 | PrivateData *d_data;
|
---|
75 | };
|
---|
76 |
|
---|
77 | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarCanvas::PaintAttributes )
|
---|
78 |
|
---|
79 | #endif
|
---|