[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_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
|
---|
[8127] | 27 | and horizontal grid lines. The locations of the grid lines
|
---|
[4271] | 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 tf );
|
---|
| 43 | bool xEnabled() const;
|
---|
| 44 |
|
---|
| 45 | void enableY( bool tf );
|
---|
| 46 | bool yEnabled() const;
|
---|
| 47 |
|
---|
| 48 | void enableXMin( bool tf );
|
---|
| 49 | bool xMinEnabled() const;
|
---|
| 50 |
|
---|
| 51 | void enableYMin( bool tf );
|
---|
| 52 | bool yMinEnabled() const;
|
---|
| 53 |
|
---|
| 54 | void setXDiv( const QwtScaleDiv &sx );
|
---|
| 55 | const QwtScaleDiv &xScaleDiv() const;
|
---|
| 56 |
|
---|
| 57 | void setYDiv( const QwtScaleDiv &sy );
|
---|
| 58 | const QwtScaleDiv &yScaleDiv() const;
|
---|
| 59 |
|
---|
[8127] | 60 | void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
|
---|
| 61 | void setPen( const QPen & );
|
---|
[4271] | 62 |
|
---|
[8127] | 63 | void setMajorPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
|
---|
| 64 | void setMajorPen( const QPen & );
|
---|
| 65 | const QPen& majorPen() const;
|
---|
[4271] | 66 |
|
---|
[8127] | 67 | void setMinorPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
|
---|
| 68 | void setMinorPen( const QPen &p );
|
---|
| 69 | const QPen& minorPen() const;
|
---|
[4271] | 70 |
|
---|
| 71 | virtual void draw( QPainter *p,
|
---|
| 72 | const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
| 73 | const QRectF &rect ) const;
|
---|
| 74 |
|
---|
| 75 | virtual void updateScaleDiv(
|
---|
| 76 | const QwtScaleDiv &xMap, const QwtScaleDiv &yMap );
|
---|
| 77 |
|
---|
| 78 | private:
|
---|
| 79 | void drawLines( QPainter *painter, const QRectF &,
|
---|
| 80 | Qt::Orientation orientation, const QwtScaleMap &,
|
---|
| 81 | const QList<double> & ) const;
|
---|
| 82 |
|
---|
| 83 | class PrivateData;
|
---|
| 84 | PrivateData *d_data;
|
---|
| 85 | };
|
---|
| 86 |
|
---|
| 87 | #endif
|
---|