source: ntrip/trunk/BNC/qwt/qwt_plot_zoomer.h@ 7636

Last change on this file since 7636 was 4271, checked in by mervart, 13 years ago
File size: 2.9 KB
RevLine 
[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_ZOOMER_H
11#define QWT_PLOT_ZOOMER_H
12
13#include "qwt_global.h"
14#include "qwt_plot_picker.h"
15#include <qstack.h>
16
17/*!
18 \brief QwtPlotZoomer provides stacked zooming for a plot widget
19
20 QwtPlotZoomer offers rubberband selections on the plot canvas,
21 translating the selected rectangles into plot coordinates and
22 adjusting the axes to them. Zooming can repeated as often as
23 possible, limited only by maxStackDepth() or minZoomSize().
24 Each rectangle is pushed on a stack.
25
26 Zoom rectangles can be selected depending on selectionFlags() using the
27 mouse or keyboard (QwtEventPattern, QwtPickerMachine).
28 QwtEventPattern::MouseSelect3,QwtEventPattern::KeyUndo,
29 or QwtEventPattern::MouseSelect6,QwtEventPattern::KeyRedo
30 walk up and down the zoom stack.
31 QwtEventPattern::MouseSelect2 or QwtEventPattern::KeyHome unzoom to
32 the initial size.
33
34 QwtPlotZoomer is tailored for plots with one x and y axis, but it is
35 allowed to attach a second QwtPlotZoomer for the other axes.
36
37 \note The realtime example includes an derived zoomer class that adds
38 scrollbars to the plot canvas.
39*/
40
41class QWT_EXPORT QwtPlotZoomer: public QwtPlotPicker
42{
43 Q_OBJECT
44public:
45 explicit QwtPlotZoomer( QwtPlotCanvas *, bool doReplot = true );
46 explicit QwtPlotZoomer( int xAxis, int yAxis,
47 QwtPlotCanvas *, bool doReplot = true );
48
49 virtual ~QwtPlotZoomer();
50
51 virtual void setZoomBase( bool doReplot = true );
52 virtual void setZoomBase( const QRectF & );
53
54 QRectF zoomBase() const;
55 QRectF zoomRect() const;
56
57 virtual void setAxis( int xAxis, int yAxis );
58
59 void setMaxStackDepth( int );
60 int maxStackDepth() const;
61
62 const QStack<QRectF> &zoomStack() const;
63 void setZoomStack( const QStack<QRectF> &,
64 int zoomRectIndex = -1 );
65
66 uint zoomRectIndex() const;
67
68public Q_SLOTS:
69 void moveBy( double x, double y );
70 virtual void moveTo( const QPointF & );
71
72 virtual void zoom( const QRectF & );
73 virtual void zoom( int up );
74
75Q_SIGNALS:
76 /*!
77 A signal emitting the zoomRect(), when the plot has been
78 zoomed in or out.
79
80 \param rect Current zoom rectangle.
81 */
82
83 void zoomed( const QRectF &rect );
84
85protected:
86 virtual void rescale();
87
88 virtual QSizeF minZoomSize() const;
89
90 virtual void widgetMouseReleaseEvent( QMouseEvent * );
91 virtual void widgetKeyPressEvent( QKeyEvent * );
92
93 virtual void begin();
94 virtual bool end( bool ok = true );
95 virtual bool accept( QPolygon & ) const;
96
97private:
98 void init( bool doReplot );
99
100 class PrivateData;
101 PrivateData *d_data;
102};
103
104#endif
Note: See TracBrowser for help on using the repository browser.