source: pacpusframework/branches/2.0-beta1/include/extlib/qwt-5.2.1/qwt_picker_machine.h@ 89

Last change on this file since 89 was 89, checked in by morasjul, 11 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 4.1 KB
Line 
1/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10#ifndef QWT_PICKER_MACHINE
11#define QWT_PICKER_MACHINE 1
12
13#include "qwt_global.h"
14#if QT_VERSION < 0x040000
15#include <qvaluelist.h>
16#else
17#include <qlist.h>
18#endif
19
20class QEvent;
21class QwtEventPattern;
22
23/*!
24 \brief A state machine for QwtPicker selections
25
26 QwtPickerMachine accepts key and mouse events and translates them
27 into selection commands.
28
29 \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
30*/
31
32class QWT_EXPORT QwtPickerMachine
33{
34public:
35 //! Commands - the output of the state machine
36 enum Command
37 {
38 Begin,
39 Append,
40 Move,
41 End
42 };
43
44#if QT_VERSION < 0x040000
45 typedef QValueList<Command> CommandList;
46#else
47 typedef QList<Command> CommandList;
48#endif
49
50 virtual ~QwtPickerMachine();
51
52 //! Transition
53 virtual CommandList transition(
54 const QwtEventPattern &, const QEvent *) = 0;
55 void reset();
56
57 int state() const;
58 void setState(int);
59
60protected:
61 QwtPickerMachine();
62
63private:
64 int d_state;
65};
66
67/*!
68 \brief A state machine for point selections
69
70 Pressing QwtEventPattern::MouseSelect1 or
71 QwtEventPattern::KeySelect1 selects a point.
72
73 \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
74*/
75class QWT_EXPORT QwtPickerClickPointMachine: public QwtPickerMachine
76{
77public:
78 virtual CommandList transition(
79 const QwtEventPattern &, const QEvent *);
80};
81
82/*!
83 \brief A state machine for point selections
84
85 Pressing QwtEventPattern::MouseSelect1 or QwtEventPattern::KeySelect1
86 starts the selection, releasing QwtEventPattern::MouseSelect1 or
87 a second press of QwtEventPattern::KeySelect1 terminates it.
88*/
89class QWT_EXPORT QwtPickerDragPointMachine: public QwtPickerMachine
90{
91public:
92 virtual CommandList transition(
93 const QwtEventPattern &, const QEvent *);
94};
95
96/*!
97 \brief A state machine for rectangle selections
98
99 Pressing QwtEventPattern::MouseSelect1 starts
100 the selection, releasing it selects the first point. Pressing it
101 again selects the second point and terminates the selection.
102 Pressing QwtEventPattern::KeySelect1 also starts the
103 selection, a second press selects the first point. A third one selects
104 the second point and terminates the selection.
105
106 \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
107*/
108
109class QWT_EXPORT QwtPickerClickRectMachine: public QwtPickerMachine
110{
111public:
112 virtual CommandList transition(
113 const QwtEventPattern &, const QEvent *);
114};
115
116/*!
117 \brief A state machine for rectangle selections
118
119 Pressing QwtEventPattern::MouseSelect1 selects
120 the first point, releasing it the second point.
121 Pressing QwtEventPattern::KeySelect1 also selects the
122 first point, a second press selects the second point and terminates
123 the selection.
124
125 \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
126*/
127
128class QWT_EXPORT QwtPickerDragRectMachine: public QwtPickerMachine
129{
130public:
131 virtual CommandList transition(
132 const QwtEventPattern &, const QEvent *);
133};
134
135/*!
136 \brief A state machine for polygon selections
137
138 Pressing QwtEventPattern::MouseSelect1 or QwtEventPattern::KeySelect1
139 starts the selection and selects the first point, or appends a point.
140 Pressing QwtEventPattern::MouseSelect2 or QwtEventPattern::KeySelect2
141 appends the last point and terminates the selection.
142
143 \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
144*/
145
146class QWT_EXPORT QwtPickerPolygonMachine: public QwtPickerMachine
147{
148public:
149 virtual CommandList transition(
150 const QwtEventPattern &, const QEvent *);
151};
152
153#endif
Note: See TracBrowser for help on using the repository browser.