# 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 #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:
    00036     enum Command
    00037     {
    00038         Begin,
    00039         Append,
    00040         Move,
    00041         End
    00042     };
    00043
    00044 #if QT_VERSION < 0x040000
    00045     typedef QValueList<Command> CommandList;
    00046 #else
    00047     typedef QList<Command> CommandList;
    00048 #endif
    00049
    00050     virtual ~QwtPickerMachine();
    00051
    00053     virtual CommandList transition(
    00054         const QwtEventPattern &, const QEvent *) = 0;
    00055     void reset();
    00056
    00057     int state() const;
    00058     void setState(int);
    00059
    00060 protected:
    00061     QwtPickerMachine();
    00062
    00063 private:
    00064     int d_state;
    00065 };
    00066
    00075 class QWT_EXPORT QwtPickerClickPointMachine: public QwtPickerMachine
    00076 {
    00077 public:
    00078     virtual CommandList transition(
    00079         const QwtEventPattern &, const QEvent *);
    00080 };
    00081
    00089 class QWT_EXPORT QwtPickerDragPointMachine: public QwtPickerMachine
    00090 {
    00091 public:
    00092     virtual CommandList transition(
    00093         const QwtEventPattern &, const QEvent *);
    00094 };
    00095
    00109 class QWT_EXPORT QwtPickerClickRectMachine: public QwtPickerMachine
    00110 {
    00111 public:
    00112     virtual CommandList transition(
    00113         const QwtEventPattern &, const QEvent *);
    00114 };
    00115
    00128 class QWT_EXPORT QwtPickerDragRectMachine: public QwtPickerMachine
    00129 {
    00130 public:
    00131     virtual CommandList transition(
    00132         const QwtEventPattern &, const QEvent *);
    00133 };
    00134
    00146 class QWT_EXPORT QwtPickerPolygonMachine: public QwtPickerMachine
    00147 {
    00148 public:
    00149     virtual CommandList transition(
    00150         const QwtEventPattern &, const QEvent *);
    00151 };
    00152
    00153 #endif