~ubuntu-branches/ubuntu/oneiric/qwt/oneiric-proposed

« back to all changes in this revision

Viewing changes to qwt-5.0.1/src/qwt_plot_zoomer.h

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2007-10-05 15:20:41 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20071005152041-qmybqh4fj9jejyo2
Tags: 5.0.2-2
* Handle nostrip build option. (Closes: #437877)
* Build libqwt5-doc package in binary-indep target. (Closes: #443110)

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 
25
 
/*!
26
 
  \brief QwtPlotZoomer provides stacked zooming for a plot widget
27
 
 
28
 
  QwtPlotZoomer offers rubberband selections on the plot canvas, 
29
 
  translating the selected rectangles into plot coordinates and
30
 
  adjusting the axes to them. Zooming can repeated as often as 
31
 
  possible, limited only by maxStackDepth() or minZoomSize(). 
32
 
  Each rectangle is pushed on a stack. 
33
 
 
34
 
  Zoom rectangles can be selected depending on selectionFlags() using the
35
 
  mouse or keyboard (QwtEventPattern, QwtPickerMachine).
36
 
  QwtEventPattern::MouseSelect3/QwtEventPattern::KeyUndo, 
37
 
  or QwtEventPattern::MouseSelect6/QwtEventPattern::KeyRedo 
38
 
  walk up and down the zoom stack.
39
 
  QwtEventPattern::MouseSelect2 or QwtEventPattern::KeyHome unzoom to
40
 
  the initial size. 
41
 
  
42
 
  QwtPlotZoomer is tailored for plots with one x and y axis, but it is
43
 
  allowed to attach a second QwtPlotZoomer for the other axes.
44
 
 
45
 
  \note The realtime example includes an derived zoomer class that adds 
46
 
        scrollbars to the plot canvas.
47
 
*/
48
 
 
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();
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
 
#else
76
 
    const QStack<QwtDoubleRect> &zoomStack() const;
77
 
#endif
78
 
    uint zoomRectIndex() const;
79
 
 
80
 
    virtual void setSelectionFlags(int);
81
 
 
82
 
public slots:
83
 
    void moveBy(double x, double y);
84
 
    virtual void move(double x, double y);
85
 
 
86
 
    virtual void zoom(const QwtDoubleRect &);
87
 
    virtual void zoom(int up);
88
 
 
89
 
signals:
90
 
    /*!
91
 
      A signal emitting the zoomRect(), when the plot has been 
92
 
      zoomed in or out.
93
 
 
94
 
      \param rect Current zoom rectangle.
95
 
    */
96
 
 
97
 
    void zoomed(const QwtDoubleRect &rect);
98
 
 
99
 
protected:
100
 
    virtual void rescale();
101
 
 
102
 
    virtual QwtDoubleSize minZoomSize() const;
103
 
 
104
 
    virtual void widgetMouseReleaseEvent(QMouseEvent *);
105
 
    virtual void widgetKeyPressEvent(QKeyEvent *);
106
 
 
107
 
    virtual void begin();
108
 
    virtual bool end(bool ok = true);
109
 
    virtual bool accept(QwtPolygon &) const;
110
 
 
111
 
private:
112
 
    void init(int selectionFlags, DisplayMode trackerMode, bool doReplot);
113
 
 
114
 
    class PrivateData;
115
 
    PrivateData *d_data;
116
 
};
117
 
            
118
 
#endif