# qwt_plot_zoomer.h

    00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
    00002  * Qwt Widget Library
    00003  * Copyright (C) 1997   Josef Wilgen
    00004  * Copyright (C) 2002   Uwe Rathmann
    00005  *
    00006  * This library is free software; you can redistribute it and/or
    00007  * modify it under the terms of the Qwt License, Version 1.0
    00008  *****************************************************************************/
    00009
    00010 // vim: expandtab
    00011
    00012 #ifndef QWT_PLOT_ZOOMER_H
    00013 #define QWT_PLOT_ZOOMER_H
    00014
    00015 #include <qglobal.h>
    00016 #if QT_VERSION < 0x040000
    00017 #include <qvaluestack.h>
    00018 #else
    00019 #include <qstack.h>
    00020 #endif
    00021
    00022 #include "qwt_double_rect.h"
    00023 #include "qwt_plot_picker.h"
    00024
    00049 class QWT_EXPORT QwtPlotZoomer: public QwtPlotPicker
    00050 {
    00051     Q_OBJECT
    00052 public:
    00053     explicit QwtPlotZoomer(QwtPlotCanvas *, bool doReplot = true);
    00054     explicit QwtPlotZoomer(int xAxis, int yAxis,
    00055         QwtPlotCanvas *, bool doReplot = true);
    00056     explicit QwtPlotZoomer(int xAxis, int yAxis, int selectionFlags,
    00057         DisplayMode trackerMode, QwtPlotCanvas *,
    00058         bool doReplot = true);
    00059
    00060     virtual ~QwtPlotZoomer();
    00061
    00062     virtual void setZoomBase(bool doReplot = true);
    00063     virtual void setZoomBase(const QwtDoubleRect &);
    00064
    00065     QwtDoubleRect zoomBase() const;
    00066     QwtDoubleRect zoomRect() const;
    00067
    00068     virtual void setAxis(int xAxis, int yAxis);
    00069
    00070     void setMaxStackDepth(int);
    00071     int maxStackDepth() const;
    00072
    00073 #if QT_VERSION < 0x040000
    00074     const QValueStack<QwtDoubleRect> &zoomStack() const;
    00075     void setZoomStack(const QValueStack<QwtDoubleRect> &,
    00076         int zoomRectIndex = -1);
    00077 #else
    00078     const QStack<QwtDoubleRect> &zoomStack() const;
    00079     void setZoomStack(const QStack<QwtDoubleRect> &,
    00080         int zoomRectIndex = -1);
    00081 #endif
    00082     uint zoomRectIndex() const;
    00083
    00084     virtual void setSelectionFlags(int);
    00085
    00086 public slots:
    00087     void moveBy(double x, double y);
    00088     virtual void move(double x, double y);
    00089
    00090     virtual void zoom(const QwtDoubleRect &);
    00091     virtual void zoom(int up);
    00092
    00093 signals:
    00101     void zoomed(const QwtDoubleRect &rect);
    00102
    00103 protected:
    00104     virtual void rescale();
    00105
    00106     virtual QwtDoubleSize minZoomSize() const;
    00107
    00108     virtual void widgetMouseReleaseEvent(QMouseEvent *);
    00109     virtual void widgetKeyPressEvent(QKeyEvent *);
    00110
    00111     virtual void begin();
    00112     virtual bool end(bool ok = true);
    00113     virtual bool accept(QwtPolygon &) const;
    00114
    00115 private:
    00116     void init(int selectionFlags, DisplayMode trackerMode, bool doReplot);
    00117
    00118     class PrivateData;
    00119     PrivateData *d_data;
    00120 };
    00121
    00122 #endif