source: pacpusframework/branches/2.0-beta1/include/extlib/qwt-5.2.1/qwt_plot_zoomer.h@ 89

Last change on this file since 89 was 89, checked in by morasjul, 11 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 3.6 KB
Line 
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
49class QWT_EXPORT QwtPlotZoomer: public QwtPlotPicker
50{
51 Q_OBJECT
52public:
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
86public 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
93signals:
94 /*!
95 A signal emitting the zoomRect(), when the plot has been
96 zoomed in or out.
97
98 \param rect Current zoom rectangle.
99 */
100
101 void zoomed(const QwtDoubleRect &rect);
102
103protected:
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
115private:
116 void init(int selectionFlags, DisplayMode trackerMode, bool doReplot);
117
118 class PrivateData;
119 PrivateData *d_data;
120};
121
122#endif
Note: See TracBrowser for help on using the repository browser.