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_GRID_H
|
---|
11 | #define QWT_PLOT_GRID_H
|
---|
12 |
|
---|
13 | #include "qwt_global.h"
|
---|
14 | #include "qwt_plot_item.h"
|
---|
15 | #include "qwt_scale_div.h"
|
---|
16 |
|
---|
17 | class QPainter;
|
---|
18 | class QPen;
|
---|
19 | class QwtScaleMap;
|
---|
20 | class QwtScaleDiv;
|
---|
21 |
|
---|
22 | /*!
|
---|
23 | \brief A class which draws a coordinate grid
|
---|
24 |
|
---|
25 | The QwtPlotGrid class can be used to draw a coordinate grid.
|
---|
26 | A coordinate grid consists of major and minor vertical
|
---|
27 | and horizontal grid lines. The locations of the grid lines
|
---|
28 | are determined by the X and Y scale divisions which can
|
---|
29 | be assigned with setXDiv() and setYDiv().
|
---|
30 | The draw() member draws the grid within a bounding
|
---|
31 | rectangle.
|
---|
32 | */
|
---|
33 |
|
---|
34 | class QWT_EXPORT QwtPlotGrid: public QwtPlotItem
|
---|
35 | {
|
---|
36 | public:
|
---|
37 | explicit QwtPlotGrid();
|
---|
38 | virtual ~QwtPlotGrid();
|
---|
39 |
|
---|
40 | virtual int rtti() const;
|
---|
41 |
|
---|
42 | void enableX( bool );
|
---|
43 | bool xEnabled() const;
|
---|
44 |
|
---|
45 | void enableY( bool );
|
---|
46 | bool yEnabled() const;
|
---|
47 |
|
---|
48 | void enableXMin( bool );
|
---|
49 | bool xMinEnabled() const;
|
---|
50 |
|
---|
51 | void enableYMin( bool );
|
---|
52 | bool yMinEnabled() const;
|
---|
53 |
|
---|
54 | void setXDiv( const QwtScaleDiv & );
|
---|
55 | const QwtScaleDiv &xScaleDiv() const;
|
---|
56 |
|
---|
57 | void setYDiv( const QwtScaleDiv & );
|
---|
58 | const QwtScaleDiv &yScaleDiv() const;
|
---|
59 |
|
---|
60 | void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
|
---|
61 | void setPen( const QPen & );
|
---|
62 |
|
---|
63 | void setMajorPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
|
---|
64 | void setMajorPen( const QPen & );
|
---|
65 | const QPen& majorPen() const;
|
---|
66 |
|
---|
67 | void setMinorPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
|
---|
68 | void setMinorPen( const QPen & );
|
---|
69 | const QPen& minorPen() const;
|
---|
70 |
|
---|
71 | virtual void draw( QPainter *,
|
---|
72 | const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
73 | const QRectF &canvasRect ) const;
|
---|
74 |
|
---|
75 | virtual void updateScaleDiv(
|
---|
76 | const QwtScaleDiv &xScaleDiv, const QwtScaleDiv &yScaleDiv );
|
---|
77 |
|
---|
78 | private:
|
---|
79 | void drawLines( QPainter *, const QRectF &,
|
---|
80 | Qt::Orientation, const QwtScaleMap &,
|
---|
81 | const QList<double> & ) const;
|
---|
82 |
|
---|
83 | class PrivateData;
|
---|
84 | PrivateData *d_data;
|
---|
85 | };
|
---|
86 |
|
---|
87 | #endif
|
---|