| 1 | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ***************************** | 
|---|
| 2 | * QwtPolar Widget Library | 
|---|
| 3 | * Copyright (C) 2008   Uwe Rathmann | 
|---|
| 4 | * | 
|---|
| 5 | * This library is free software; you can redistribute it and/or | 
|---|
| 6 | * modify it under the terms of the Qwt License, Version 1.0 | 
|---|
| 7 | *****************************************************************************/ | 
|---|
| 8 |  | 
|---|
| 9 | #ifndef QWT_POLAR_PICKER_H | 
|---|
| 10 | #define QWT_POLAR_PICKER_H | 
|---|
| 11 |  | 
|---|
| 12 | #include "qwt_polar_global.h" | 
|---|
| 13 | #include "qwt_picker.h" | 
|---|
| 14 | #include <qvector.h> | 
|---|
| 15 | #include <qpainterpath.h> | 
|---|
| 16 |  | 
|---|
| 17 | class QwtPolarPlot; | 
|---|
| 18 | class QwtPolarCanvas; | 
|---|
| 19 | class QwtPointPolar; | 
|---|
| 20 |  | 
|---|
| 21 | /*! | 
|---|
| 22 | \brief QwtPolarPicker provides selections on a plot canvas | 
|---|
| 23 |  | 
|---|
| 24 | QwtPolarPicker is a QwtPicker tailored for selections on | 
|---|
| 25 | a polar plot canvas. | 
|---|
| 26 | */ | 
|---|
| 27 |  | 
|---|
| 28 | class QWT_POLAR_EXPORT QwtPolarPicker: public QwtPicker | 
|---|
| 29 | { | 
|---|
| 30 | Q_OBJECT | 
|---|
| 31 |  | 
|---|
| 32 | public: | 
|---|
| 33 | explicit QwtPolarPicker( QwtPolarCanvas * ); | 
|---|
| 34 | virtual ~QwtPolarPicker(); | 
|---|
| 35 |  | 
|---|
| 36 | explicit QwtPolarPicker( | 
|---|
| 37 | RubberBand rubberBand, DisplayMode trackerMode, | 
|---|
| 38 | QwtPolarCanvas * ); | 
|---|
| 39 |  | 
|---|
| 40 | QwtPolarPlot *plot(); | 
|---|
| 41 | const QwtPolarPlot *plot() const; | 
|---|
| 42 |  | 
|---|
| 43 | QwtPolarCanvas *canvas(); | 
|---|
| 44 | const QwtPolarCanvas *canvas() const; | 
|---|
| 45 |  | 
|---|
| 46 | virtual QRect pickRect() const; | 
|---|
| 47 |  | 
|---|
| 48 | Q_SIGNALS: | 
|---|
| 49 |  | 
|---|
| 50 | /*! | 
|---|
| 51 | A signal emitted in case of selectionFlags() & PointSelection. | 
|---|
| 52 | \param pos Selected point | 
|---|
| 53 | */ | 
|---|
| 54 | void selected( const QwtPointPolar &pos ); | 
|---|
| 55 |  | 
|---|
| 56 | /*! | 
|---|
| 57 | A signal emitting the selected points, | 
|---|
| 58 | at the end of a selection. | 
|---|
| 59 |  | 
|---|
| 60 | \param points Selected points | 
|---|
| 61 | */ | 
|---|
| 62 | void selected( const QVector<QwtPointPolar> &points ); | 
|---|
| 63 |  | 
|---|
| 64 | /*! | 
|---|
| 65 | A signal emitted when a point has been appended to the selection | 
|---|
| 66 |  | 
|---|
| 67 | \param pos Position of the appended point. | 
|---|
| 68 | \sa append(). moved() | 
|---|
| 69 | */ | 
|---|
| 70 | void appended( const QwtPointPolar &pos ); | 
|---|
| 71 |  | 
|---|
| 72 | /*! | 
|---|
| 73 | A signal emitted whenever the last appended point of the | 
|---|
| 74 | selection has been moved. | 
|---|
| 75 |  | 
|---|
| 76 | \param pos Position of the moved last point of the selection. | 
|---|
| 77 | \sa move(), appended() | 
|---|
| 78 | */ | 
|---|
| 79 | void moved( const QwtPointPolar &pos ); | 
|---|
| 80 |  | 
|---|
| 81 | protected: | 
|---|
| 82 | QwtPointPolar invTransform( const QPoint & ) const; | 
|---|
| 83 |  | 
|---|
| 84 | virtual QwtText trackerText( const QPoint & ) const; | 
|---|
| 85 | virtual QwtText trackerTextPolar( const QwtPointPolar & ) const; | 
|---|
| 86 |  | 
|---|
| 87 | virtual void move( const QPoint & ); | 
|---|
| 88 | virtual void append( const QPoint & ); | 
|---|
| 89 | virtual bool end( bool ok = true ); | 
|---|
| 90 |  | 
|---|
| 91 | private: | 
|---|
| 92 | virtual QPainterPath pickArea() const; | 
|---|
| 93 |  | 
|---|
| 94 | class PrivateData; | 
|---|
| 95 | PrivateData *d_data; | 
|---|
| 96 | }; | 
|---|
| 97 |  | 
|---|
| 98 | #endif | 
|---|