00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef QWT_PLOT_ZOOMER
00013 #define QWT_PLOT_ZOOMER
00014
00015 #include <qvaluestack.h>
00016 #include "qwt_double_rect.h"
00017 #include "qwt_plot_picker.h"
00018
00019 #if defined(QWT_TEMPLATEDLL)
00020
00021 template class QWT_EXPORT QValueStack<QwtDoubleRect>;
00022
00023 #endif
00024
00059 class QWT_EXPORT QwtPlotZoomer: public QwtPlotPicker
00060 {
00061 Q_OBJECT
00062 public:
00063 QwtPlotZoomer(QwtPlotCanvas *, const char *name = 0);
00064 QwtPlotZoomer(int xAxis, int yAxis,
00065 QwtPlotCanvas *, const char *name = 0);
00066 QwtPlotZoomer(int xAxis, int yAxis, int selectionFlags,
00067 DisplayMode cursorLabelMode, QwtPlotCanvas *, const char *name = 0);
00068
00069 virtual void setZoomBase();
00070 virtual void setZoomBase(const QwtDoubleRect &);
00071
00072 QwtDoubleRect zoomBase() const;
00073 QwtDoubleRect zoomRect() const;
00074
00075 virtual void setAxis(int xAxis, int yAxis);
00076
00077 void setMaxStackDepth(int);
00078 int maxStackDepth() const;
00079
00080 const QValueStack<QwtDoubleRect> &zoomStack() const;
00081 uint zoomRectIndex() const;
00082
00083 virtual void setSelectionFlags(int);
00084
00085 public slots:
00086 void moveBy(double x, double y);
00087 virtual void move(double x, double y);
00088
00089 virtual void zoom(const QwtDoubleRect &);
00090 virtual void zoom(int up);
00091
00092 signals:
00102 void zoomed(const QwtDoubleRect &rect);
00103
00104 protected:
00105 QValueStack<QwtDoubleRect> &zoomStack();
00106
00107 virtual void rescale();
00108
00109 virtual QwtDoubleSize minZoomSize() const;
00110
00111 virtual void widgetMouseReleaseEvent(QMouseEvent *);
00112 virtual void widgetKeyPressEvent(QKeyEvent *);
00113
00114 virtual void begin();
00115 virtual bool end(bool ok = TRUE);
00116 virtual bool accept(QPointArray &) const;
00117
00118 private:
00119 void init(int selectionFlags = RectSelection & ClickSelection,
00120 DisplayMode cursorLabelMode = ActiveOnly);
00121
00122 uint d_zoomRectIndex;
00123 QValueStack<QwtDoubleRect> d_zoomStack;
00124
00125 int d_maxStackDepth;
00126 };
00127
00128 #endif
00129
00130
00131
00132
00133
00134