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 #include <qlist.h>
00015
00016 class QEvent;
00017 class QwtEventPattern;
00018
00028 class QWT_EXPORT QwtPickerMachine
00029 {
00030 public:
00045 enum SelectionType
00046 {
00047 NoSelection = -1,
00048
00049 PointSelection,
00050 RectSelection,
00051 PolygonSelection
00052 };
00053
00055 enum Command
00056 {
00057 Begin,
00058 Append,
00059 Move,
00060 Remove,
00061 End
00062 };
00063
00064 typedef QList<Command> CommandList;
00065
00066 QwtPickerMachine(SelectionType);
00067 virtual ~QwtPickerMachine();
00068
00070 virtual CommandList transition(
00071 const QwtEventPattern &, const QEvent *) = 0;
00072 void reset();
00073
00074 int state() const;
00075 void setState(int);
00076
00077 SelectionType selectionType() const;
00078
00079 private:
00080 const SelectionType d_selectionType;
00081 int d_state;
00082 };
00083
00091 class QWT_EXPORT QwtPickerTrackerMachine: public QwtPickerMachine
00092 {
00093 public:
00094 QwtPickerTrackerMachine();
00095
00096 virtual CommandList transition(
00097 const QwtEventPattern &, const QEvent *);
00098 };
00099
00108 class QWT_EXPORT QwtPickerClickPointMachine: public QwtPickerMachine
00109 {
00110 public:
00111 QwtPickerClickPointMachine();
00112
00113 virtual CommandList transition(
00114 const QwtEventPattern &, const QEvent *);
00115 };
00116
00124 class QWT_EXPORT QwtPickerDragPointMachine: public QwtPickerMachine
00125 {
00126 public:
00127 QwtPickerDragPointMachine();
00128
00129 virtual CommandList transition(
00130 const QwtEventPattern &, const QEvent *);
00131 };
00132
00146 class QWT_EXPORT QwtPickerClickRectMachine: public QwtPickerMachine
00147 {
00148 public:
00149 QwtPickerClickRectMachine();
00150
00151 virtual CommandList transition(
00152 const QwtEventPattern &, const QEvent *);
00153 };
00154
00167 class QWT_EXPORT QwtPickerDragRectMachine: public QwtPickerMachine
00168 {
00169 public:
00170 QwtPickerDragRectMachine();
00171
00172 virtual CommandList transition(
00173 const QwtEventPattern &, const QEvent *);
00174 };
00175
00187 class QWT_EXPORT QwtPickerPolygonMachine: public QwtPickerMachine
00188 {
00189 public:
00190 QwtPickerPolygonMachine();
00191
00192 virtual CommandList transition(
00193 const QwtEventPattern &, const QEvent *);
00194 };
00195
00196 #endif