Qwt User's Guide  5.2.3
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 // vim: expandtab
11 
12 #ifndef QWT_PLOT_ZOOMER_H
13 #define QWT_PLOT_ZOOMER_H
14 
15 #include <qglobal.h>
16 #if QT_VERSION < 0x040000
17 #include <qvaluestack.h>
18 #else
19 #include <qstack.h>
20 #endif
21 
22 #include "qwt_double_rect.h"
23 #include "qwt_plot_picker.h"
24 
49 class QWT_EXPORT QwtPlotZoomer: public QwtPlotPicker
50 {
51  Q_OBJECT
52 public:
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);
59 
60  virtual ~QwtPlotZoomer();
61 
62  virtual void setZoomBase(bool doReplot = true);
63  virtual void setZoomBase(const QwtDoubleRect &);
64 
65  QwtDoubleRect zoomBase() const;
66  QwtDoubleRect zoomRect() const;
67 
68  virtual void setAxis(int xAxis, int yAxis);
69 
70  void setMaxStackDepth(int);
71  int maxStackDepth() const;
72 
73 #if QT_VERSION < 0x040000
74  const QValueStack<QwtDoubleRect> &zoomStack() const;
75  void setZoomStack(const QValueStack<QwtDoubleRect> &,
76  int zoomRectIndex = -1);
77 #else
78  const QStack<QwtDoubleRect> &zoomStack() const;
79  void setZoomStack(const QStack<QwtDoubleRect> &,
80  int zoomRectIndex = -1);
81 #endif
82  uint zoomRectIndex() const;
83 
84  virtual void setSelectionFlags(int);
85 
86 public slots:
87  void moveBy(double x, double y);
88  virtual void move(double x, double y);
89 
90  virtual void zoom(const QwtDoubleRect &);
91  virtual void zoom(int up);
92 
93 signals:
101  void zoomed(const QwtDoubleRect &rect);
102 
103 protected:
104  virtual void rescale();
105 
106  virtual QwtDoubleSize minZoomSize() const;
107 
108  virtual void widgetMouseReleaseEvent(QMouseEvent *);
109  virtual void widgetKeyPressEvent(QKeyEvent *);
110 
111  virtual void begin();
112  virtual bool end(bool ok = true);
113  virtual bool accept(QwtPolygon &) const;
114 
115 private:
116  void init(int selectionFlags, DisplayMode trackerMode, bool doReplot);
117 
118  class PrivateData;
119  PrivateData *d_data;
120 };
121 
122 #endif