[89] | 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_PICKER_H
|
---|
| 13 | #define QWT_PLOT_PICKER_H
|
---|
| 14 |
|
---|
| 15 | #include "qwt_double_rect.h"
|
---|
| 16 | #include "qwt_plot_canvas.h"
|
---|
| 17 | #include "qwt_picker.h"
|
---|
| 18 |
|
---|
| 19 | class QwtPlot;
|
---|
| 20 |
|
---|
| 21 | /*!
|
---|
| 22 | \brief QwtPlotPicker provides selections on a plot canvas
|
---|
| 23 |
|
---|
| 24 | QwtPlotPicker is a QwtPicker tailored for selections on
|
---|
| 25 | a plot canvas. It is set to a x-Axis and y-Axis and
|
---|
| 26 | translates all pixel coordinates into this coodinate system.
|
---|
| 27 | */
|
---|
| 28 |
|
---|
| 29 | class QWT_EXPORT QwtPlotPicker: public QwtPicker
|
---|
| 30 | {
|
---|
| 31 | Q_OBJECT
|
---|
| 32 |
|
---|
| 33 | public:
|
---|
| 34 | explicit QwtPlotPicker(QwtPlotCanvas *);
|
---|
| 35 | virtual ~QwtPlotPicker();
|
---|
| 36 |
|
---|
| 37 | explicit QwtPlotPicker(int xAxis, int yAxis,
|
---|
| 38 | QwtPlotCanvas *);
|
---|
| 39 |
|
---|
| 40 | explicit QwtPlotPicker(int xAxis, int yAxis, int selectionFlags,
|
---|
| 41 | RubberBand rubberBand, DisplayMode trackerMode,
|
---|
| 42 | QwtPlotCanvas *);
|
---|
| 43 |
|
---|
| 44 | virtual void setAxis(int xAxis, int yAxis);
|
---|
| 45 |
|
---|
| 46 | int xAxis() const;
|
---|
| 47 | int yAxis() const;
|
---|
| 48 |
|
---|
| 49 | QwtPlot *plot();
|
---|
| 50 | const QwtPlot *plot() const;
|
---|
| 51 |
|
---|
| 52 | QwtPlotCanvas *canvas();
|
---|
| 53 | const QwtPlotCanvas *canvas() const;
|
---|
| 54 |
|
---|
| 55 | signals:
|
---|
| 56 |
|
---|
| 57 | /*!
|
---|
| 58 | A signal emitted in case of selectionFlags() & PointSelection.
|
---|
| 59 | \param pos Selected point
|
---|
| 60 | */
|
---|
| 61 | void selected(const QwtDoublePoint &pos);
|
---|
| 62 |
|
---|
| 63 | /*!
|
---|
| 64 | A signal emitted in case of selectionFlags() & RectSelection.
|
---|
| 65 | \param rect Selected rectangle
|
---|
| 66 | */
|
---|
| 67 | void selected(const QwtDoubleRect &rect);
|
---|
| 68 |
|
---|
| 69 | /*!
|
---|
| 70 | A signal emitting the selected points,
|
---|
| 71 | at the end of a selection.
|
---|
| 72 |
|
---|
| 73 | \param pa Selected points
|
---|
| 74 | */
|
---|
| 75 | void selected(const QwtArray<QwtDoublePoint> &pa);
|
---|
| 76 |
|
---|
| 77 | /*!
|
---|
| 78 | A signal emitted when a point has been appended to the selection
|
---|
| 79 |
|
---|
| 80 | \param pos Position of the appended point.
|
---|
| 81 | \sa append(). moved()
|
---|
| 82 | */
|
---|
| 83 | void appended(const QwtDoublePoint &pos);
|
---|
| 84 |
|
---|
| 85 | /*!
|
---|
| 86 | A signal emitted whenever the last appended point of the
|
---|
| 87 | selection has been moved.
|
---|
| 88 |
|
---|
| 89 | \param pos Position of the moved last point of the selection.
|
---|
| 90 | \sa move(), appended()
|
---|
| 91 | */
|
---|
| 92 | void moved(const QwtDoublePoint &pos);
|
---|
| 93 |
|
---|
| 94 | protected:
|
---|
| 95 | QwtDoubleRect scaleRect() const;
|
---|
| 96 |
|
---|
| 97 | QwtDoubleRect invTransform(const QRect &) const;
|
---|
| 98 | QRect transform(const QwtDoubleRect &) const;
|
---|
| 99 |
|
---|
| 100 | QwtDoublePoint invTransform(const QPoint &) const;
|
---|
| 101 | QPoint transform(const QwtDoublePoint &) const;
|
---|
| 102 |
|
---|
| 103 | virtual QwtText trackerText(const QPoint &) const;
|
---|
| 104 | virtual QwtText trackerText(const QwtDoublePoint &) const;
|
---|
| 105 |
|
---|
| 106 | virtual void move(const QPoint &);
|
---|
| 107 | virtual void append(const QPoint &);
|
---|
| 108 | virtual bool end(bool ok = true);
|
---|
| 109 |
|
---|
| 110 | private:
|
---|
| 111 | int d_xAxis;
|
---|
| 112 | int d_yAxis;
|
---|
| 113 | };
|
---|
| 114 |
|
---|
| 115 | #endif
|
---|