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 gridlines. The locations of the gridlines
|
---|
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 |
|
---|
60 | void setPen(const QPen &p);
|
---|
61 |
|
---|
62 | void setMajPen(const QPen &p);
|
---|
63 | const QPen& majPen() const;
|
---|
64 |
|
---|
65 | void setMinPen(const QPen &p);
|
---|
66 | const QPen& minPen() const;
|
---|
67 |
|
---|
68 | virtual void draw(QPainter *p,
|
---|
69 | const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
70 | const QRect &rect) const;
|
---|
71 |
|
---|
72 | virtual void updateScaleDiv(const QwtScaleDiv &xMap,
|
---|
73 | const QwtScaleDiv &yMap);
|
---|
74 |
|
---|
75 | private:
|
---|
76 | void drawLines(QPainter *painter, const QRect &,
|
---|
77 | Qt::Orientation orientation, const QwtScaleMap &,
|
---|
78 | const QwtValueList &) const;
|
---|
79 |
|
---|
80 | class PrivateData;
|
---|
81 | PrivateData *d_data;
|
---|
82 | };
|
---|
83 |
|
---|
84 | #endif
|
---|