# qwt_picker_machine.h

    00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
    00002  * Qwt Widget Library
    00003  * Copyright (C) 1997   Josef Wilgen
    00004  * Copyright (C) 2002   Uwe Rathmann
    00005  *
    00006  * This library is free software; you can redistribute it and/or
    00007  * modify it under the terms of the Qwt License, Version 1.0
    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:
    00035     enum SelectionType
    00036     {
    00038         NoSelection = -1,
    00039
    00041         PointSelection,
    00042
    00044         RectSelection,
    00045
    00047         PolygonSelection
    00048     };
    00049
    00051     enum Command
    00052     {
    00053         Begin,
    00054         Append,
    00055         Move,
    00056         Remove,
    00057         End
    00058     };
    00059
    00060     QwtPickerMachine( SelectionType );
    00061     virtual ~QwtPickerMachine();
    00062
    00064     virtual QList<Command> transition(
    00065         const QwtEventPattern &, const QEvent * ) = 0;
    00066     void reset();
    00067
    00068     int state() const;
    00069     void setState( int );
    00070
    00071     SelectionType selectionType() const;
    00072
    00073 private:
    00074     const SelectionType d_selectionType;
    00075     int d_state;
    00076 };
    00077
    00085 class QWT_EXPORT QwtPickerTrackerMachine: public QwtPickerMachine
    00086 {
    00087 public:
    00088     QwtPickerTrackerMachine();
    00089
    00090     virtual QList<Command> transition(
    00091         const QwtEventPattern &, const QEvent * );
    00092 };
    00093
    00102 class QWT_EXPORT QwtPickerClickPointMachine: public QwtPickerMachine
    00103 {
    00104 public:
    00105     QwtPickerClickPointMachine();
    00106
    00107     virtual QList<Command> transition(
    00108         const QwtEventPattern &, const QEvent * );
    00109 };
    00110
    00118 class QWT_EXPORT QwtPickerDragPointMachine: public QwtPickerMachine
    00119 {
    00120 public:
    00121     QwtPickerDragPointMachine();
    00122
    00123     virtual QList<Command> transition(
    00124         const QwtEventPattern &, const QEvent * );
    00125 };
    00126
    00140 class QWT_EXPORT QwtPickerClickRectMachine: public QwtPickerMachine
    00141 {
    00142 public:
    00143     QwtPickerClickRectMachine();
    00144
    00145     virtual QList<Command> transition(
    00146         const QwtEventPattern &, const QEvent * );
    00147 };
    00148
    00161 class QWT_EXPORT QwtPickerDragRectMachine: public QwtPickerMachine
    00162 {
    00163 public:
    00164     QwtPickerDragRectMachine();
    00165
    00166     virtual QList<Command> transition(
    00167         const QwtEventPattern &, const QEvent * );
    00168 };
    00169
    00181 class QWT_EXPORT QwtPickerPolygonMachine: public QwtPickerMachine
    00182 {
    00183 public:
    00184     QwtPickerPolygonMachine();
    00185
    00186     virtual QList<Command> transition(
    00187         const QwtEventPattern &, const QEvent * );
    00188 };
    00189
    00190 #endif