00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_PICKER_MACHINE
00011 #define QWT_PICKER_MACHINE 1
00012
00013 #include "qwt_global.h"
00014 #if QT_VERSION < 0x040000
00015 #include <qvaluelist.h>
00016 #else
00017 #include <qlist.h>
00018 #endif
00019
00020 class QEvent;
00021 class QwtEventPattern;
00022
00032 class QWT_EXPORT QwtPickerMachine
00033 {
00034 public:
00049 enum SelectionType
00050 {
00051 NoSelection = -1,
00052
00053 PointSelection,
00054 RectSelection,
00055 PolygonSelection
00056 };
00057
00059 enum Command
00060 {
00061 Begin,
00062 Append,
00063 Move,
00064 Remove,
00065 End
00066 };
00067
00068 #if QT_VERSION < 0x040000
00069 typedef QValueList<Command> CommandList;
00070 #else
00071 typedef QList<Command> CommandList;
00072 #endif
00073
00074 QwtPickerMachine(SelectionType);
00075 virtual ~QwtPickerMachine();
00076
00078 virtual CommandList transition(
00079 const QwtEventPattern &, const QEvent *) = 0;
00080 void reset();
00081
00082 int state() const;
00083 void setState(int);
00084
00085 SelectionType selectionType() const;
00086
00087 private:
00088 const SelectionType d_selectionType;
00089 int d_state;
00090 };
00091
00099 class QWT_EXPORT QwtPickerTrackerMachine: public QwtPickerMachine
00100 {
00101 public:
00102 QwtPickerTrackerMachine();
00103
00104 virtual CommandList transition(
00105 const QwtEventPattern &, const QEvent *);
00106 };
00107
00116 class QWT_EXPORT QwtPickerClickPointMachine: public QwtPickerMachine
00117 {
00118 public:
00119 QwtPickerClickPointMachine();
00120
00121 virtual CommandList transition(
00122 const QwtEventPattern &, const QEvent *);
00123 };
00124
00132 class QWT_EXPORT QwtPickerDragPointMachine: public QwtPickerMachine
00133 {
00134 public:
00135 QwtPickerDragPointMachine();
00136
00137 virtual CommandList transition(
00138 const QwtEventPattern &, const QEvent *);
00139 };
00140
00154 class QWT_EXPORT QwtPickerClickRectMachine: public QwtPickerMachine
00155 {
00156 public:
00157 QwtPickerClickRectMachine();
00158
00159 virtual CommandList transition(
00160 const QwtEventPattern &, const QEvent *);
00161 };
00162
00175 class QWT_EXPORT QwtPickerDragRectMachine: public QwtPickerMachine
00176 {
00177 public:
00178 QwtPickerDragRectMachine();
00179
00180 virtual CommandList transition(
00181 const QwtEventPattern &, const QEvent *);
00182 };
00183
00195 class QWT_EXPORT QwtPickerPolygonMachine: public QwtPickerMachine
00196 {
00197 public:
00198 QwtPickerPolygonMachine();
00199
00200 virtual CommandList transition(
00201 const QwtEventPattern &, const QEvent *);
00202 };
00203
00204 #endif