1
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
3
* Copyright (C) 1997 Josef Wilgen
4
* Copyright (C) 2002 Uwe Rathmann
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
*****************************************************************************/
12
#ifndef QWT_PLOT_ZOOMER_H
13
#define QWT_PLOT_ZOOMER_H
16
#if QT_VERSION < 0x040000
17
#include <qvaluestack.h>
22
#include "qwt_double_rect.h"
23
#include "qwt_plot_picker.h"
26
\brief QwtPlotZoomer provides stacked zooming for a plot widget
28
QwtPlotZoomer offers rubberband selections on the plot canvas,
29
translating the selected rectangles into plot coordinates and
30
adjusting the axes to them. Zooming can repeated as often as
31
possible, limited only by maxStackDepth() or minZoomSize().
32
Each rectangle is pushed on a stack.
34
Zoom rectangles can be selected depending on selectionFlags() using the
35
mouse or keyboard (QwtEventPattern, QwtPickerMachine).
36
QwtEventPattern::MouseSelect3/QwtEventPattern::KeyUndo,
37
or QwtEventPattern::MouseSelect6/QwtEventPattern::KeyRedo
38
walk up and down the zoom stack.
39
QwtEventPattern::MouseSelect2 or QwtEventPattern::KeyHome unzoom to
42
QwtPlotZoomer is tailored for plots with one x and y axis, but it is
43
allowed to attach a second QwtPlotZoomer for the other axes.
45
\note The realtime example includes an derived zoomer class that adds
46
scrollbars to the plot canvas.
49
class QWT_EXPORT QwtPlotZoomer: public QwtPlotPicker
53
explicit QwtPlotZoomer(QwtPlotCanvas *, bool doReplot = true);
54
explicit QwtPlotZoomer(int xAxis, int yAxis,
55
QwtPlotCanvas *, bool doReplot = true);
56
explicit QwtPlotZoomer(int xAxis, int yAxis, int selectionFlags,
57
DisplayMode trackerMode, QwtPlotCanvas *,
58
bool doReplot = true);
60
virtual ~QwtPlotZoomer();
62
virtual void setZoomBase();
63
virtual void setZoomBase(const QwtDoubleRect &);
65
QwtDoubleRect zoomBase() const;
66
QwtDoubleRect zoomRect() const;
68
virtual void setAxis(int xAxis, int yAxis);
70
void setMaxStackDepth(int);
71
int maxStackDepth() const;
73
#if QT_VERSION < 0x040000
74
const QValueStack<QwtDoubleRect> &zoomStack() const;
76
const QStack<QwtDoubleRect> &zoomStack() const;
78
uint zoomRectIndex() const;
80
virtual void setSelectionFlags(int);
83
void moveBy(double x, double y);
84
virtual void move(double x, double y);
86
virtual void zoom(const QwtDoubleRect &);
87
virtual void zoom(int up);
91
A signal emitting the zoomRect(), when the plot has been
94
\param rect Current zoom rectangle.
97
void zoomed(const QwtDoubleRect &rect);
100
virtual void rescale();
102
virtual QwtDoubleSize minZoomSize() const;
104
virtual void widgetMouseReleaseEvent(QMouseEvent *);
105
virtual void widgetKeyPressEvent(QKeyEvent *);
107
virtual void begin();
108
virtual bool end(bool ok = true);
109
virtual bool accept(QwtPolygon &) const;
112
void init(int selectionFlags, DisplayMode trackerMode, bool doReplot);