Qwt User's Guide  6.0.2
qwt_plot_zoomer.h
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 
41 class QWT_EXPORT QwtPlotZoomer: public QwtPlotPicker
42 {
43  Q_OBJECT
44 public:
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 
68 public 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 
75 Q_SIGNALS:
83  void zoomed( const QRectF &rect );
84 
85 protected:
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 
97 private:
98  void init( bool doReplot );
99 
100  class PrivateData;
101  PrivateData *d_data;
102 };
103 
104 #endif