1 | /*
|
---|
2 | * QSeisScrollzoomer.h
|
---|
3 | *
|
---|
4 | * taken from "realtime"-example
|
---|
5 | *
|
---|
6 | */
|
---|
7 |
|
---|
8 | #ifndef _SCROLLZOOMER_HPP
|
---|
9 | #define _SCROLLZOOMER_HPP
|
---|
10 |
|
---|
11 | // include config.h
|
---|
12 | #ifdef HAVE_CONFIG_H
|
---|
13 | #include <config.h>
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | #include <qglobal.h>
|
---|
17 | #if QT_VERSION < 0x040000
|
---|
18 | #include <qscrollview.h>
|
---|
19 | #endif
|
---|
20 | #include <qwt_plot_zoomer.h>
|
---|
21 |
|
---|
22 | class ScrollData;
|
---|
23 | class ScrollBar;
|
---|
24 |
|
---|
25 | class ScrollZoomer: public QwtPlotZoomer
|
---|
26 | {
|
---|
27 | Q_OBJECT
|
---|
28 | public:
|
---|
29 | enum ScrollBarPosition
|
---|
30 | {
|
---|
31 | AttachedToScale,
|
---|
32 | OppositeToScale
|
---|
33 | };
|
---|
34 |
|
---|
35 | ScrollZoomer(QwtPlotCanvas *);
|
---|
36 | virtual ~ScrollZoomer();
|
---|
37 |
|
---|
38 | ScrollBar *horizontalScrollBar() const;
|
---|
39 | ScrollBar *verticalScrollBar() const;
|
---|
40 |
|
---|
41 | #if QT_VERSION < 0x040000
|
---|
42 | void setHScrollBarMode(QScrollView::ScrollBarMode);
|
---|
43 | void setVScrollBarMode(QScrollView::ScrollBarMode);
|
---|
44 |
|
---|
45 | QScrollView::ScrollBarMode vScrollBarMode () const;
|
---|
46 | QScrollView::ScrollBarMode hScrollBarMode () const;
|
---|
47 | #else
|
---|
48 | void setHScrollBarMode(Qt::ScrollBarPolicy);
|
---|
49 | void setVScrollBarMode(Qt::ScrollBarPolicy);
|
---|
50 |
|
---|
51 | Qt::ScrollBarPolicy vScrollBarMode () const;
|
---|
52 | Qt::ScrollBarPolicy hScrollBarMode () const;
|
---|
53 | #endif
|
---|
54 |
|
---|
55 | void setHScrollBarPosition(ScrollBarPosition);
|
---|
56 | void setVScrollBarPosition(ScrollBarPosition);
|
---|
57 |
|
---|
58 | ScrollBarPosition hScrollBarPosition() const;
|
---|
59 | ScrollBarPosition vScrollBarPosition() const;
|
---|
60 |
|
---|
61 | QWidget* cornerWidget() const;
|
---|
62 | virtual void setCornerWidget(QWidget *);
|
---|
63 |
|
---|
64 | virtual bool eventFilter(QObject *, QEvent *);
|
---|
65 |
|
---|
66 | virtual void rescale();
|
---|
67 |
|
---|
68 | protected:
|
---|
69 | virtual ScrollBar *scrollBar(Qt::Orientation);
|
---|
70 | virtual void updateScrollBars();
|
---|
71 | virtual void layoutScrollBars(const QRect &);
|
---|
72 |
|
---|
73 | private slots:
|
---|
74 | void scrollBarMoved(Qt::Orientation o, double min, double max);
|
---|
75 |
|
---|
76 | private:
|
---|
77 | bool needScrollBar(Qt::Orientation) const;
|
---|
78 | int oppositeAxis(int) const;
|
---|
79 |
|
---|
80 | QWidget *d_cornerWidget;
|
---|
81 |
|
---|
82 | ScrollData *d_hScrollData;
|
---|
83 | ScrollData *d_vScrollData;
|
---|
84 |
|
---|
85 | bool d_inZoom;
|
---|
86 | bool d_alignCanvasToScales;
|
---|
87 | };
|
---|
88 |
|
---|
89 | #endif // _SCROLLZOOMER_HPP
|
---|