source: ntrip/branches/BNC_2.13.beta/qwt/qwt_picker_machine.h@ 10132

Last change on this file since 10132 was 9383, checked in by stoecker, 4 years ago

update to qwt verion 6.1.1 to fix build with newer Qt5

File size: 5.6 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#include <qlist.h>
15
16class QEvent;
17class QwtEventPattern;
18
19/*!
20 \brief A state machine for QwtPicker selections
21
22 QwtPickerMachine accepts key and mouse events and translates them
23 into selection commands.
24
25 \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
26*/
27
28class QWT_EXPORT QwtPickerMachine
29{
30public:
31 /*!
32 Type of a selection.
33 \sa selectionType()
34 */
35 enum SelectionType
36 {
37 //! The state machine not usable for any type of selection.
38 NoSelection = -1,
39
40 //! The state machine is for selecting a single point.
41 PointSelection,
42
43 //! The state machine is for selecting a rectangle (2 points).
44 RectSelection,
45
46 //! The state machine is for selecting a polygon (many points).
47 PolygonSelection
48 };
49
50 //! Commands - the output of a state machine
51 enum Command
52 {
53 Begin,
54 Append,
55 Move,
56 Remove,
57 End
58 };
59
60 QwtPickerMachine( SelectionType );
61 virtual ~QwtPickerMachine();
62
63 //! Transition
64 virtual QList<Command> transition(
65 const QwtEventPattern &, const QEvent * ) = 0;
66 void reset();
67
68 int state() const;
69 void setState( int );
70
71 SelectionType selectionType() const;
72
73private:
74 const SelectionType d_selectionType;
75 int d_state;
76};
77
78/*!
79 \brief A state machine for indicating mouse movements
80
81 QwtPickerTrackerMachine supports displaying information
82 corresponding to mouse movements, but is not intended for
83 selecting anything. Begin/End are related to Enter/Leave events.
84*/
85class QWT_EXPORT QwtPickerTrackerMachine: public QwtPickerMachine
86{
87public:
88 QwtPickerTrackerMachine();
89
90 virtual QList<Command> transition(
91 const QwtEventPattern &, const QEvent * );
92};
93
94/*!
95 \brief A state machine for point selections
96
97 Pressing QwtEventPattern::MouseSelect1 or
98 QwtEventPattern::KeySelect1 selects a point.
99
100 \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
101*/
102class QWT_EXPORT QwtPickerClickPointMachine: public QwtPickerMachine
103{
104public:
105 QwtPickerClickPointMachine();
106
107 virtual QList<Command> transition(
108 const QwtEventPattern &, const QEvent * );
109};
110
111/*!
112 \brief A state machine for point selections
113
114 Pressing QwtEventPattern::MouseSelect1 or QwtEventPattern::KeySelect1
115 starts the selection, releasing QwtEventPattern::MouseSelect1 or
116 a second press of QwtEventPattern::KeySelect1 terminates it.
117*/
118class QWT_EXPORT QwtPickerDragPointMachine: public QwtPickerMachine
119{
120public:
121 QwtPickerDragPointMachine();
122
123 virtual QList<Command> transition(
124 const QwtEventPattern &, const QEvent * );
125};
126
127/*!
128 \brief A state machine for rectangle selections
129
130 Pressing QwtEventPattern::MouseSelect1 starts
131 the selection, releasing it selects the first point. Pressing it
132 again selects the second point and terminates the selection.
133 Pressing QwtEventPattern::KeySelect1 also starts the
134 selection, a second press selects the first point. A third one selects
135 the second point and terminates the selection.
136
137 \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
138*/
139
140class QWT_EXPORT QwtPickerClickRectMachine: public QwtPickerMachine
141{
142public:
143 QwtPickerClickRectMachine();
144
145 virtual QList<Command> transition(
146 const QwtEventPattern &, const QEvent * );
147};
148
149/*!
150 \brief A state machine for rectangle selections
151
152 Pressing QwtEventPattern::MouseSelect1 selects
153 the first point, releasing it the second point.
154 Pressing QwtEventPattern::KeySelect1 also selects the
155 first point, a second press selects the second point and terminates
156 the selection.
157
158 \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
159*/
160
161class QWT_EXPORT QwtPickerDragRectMachine: public QwtPickerMachine
162{
163public:
164 QwtPickerDragRectMachine();
165
166 virtual QList<Command> transition(
167 const QwtEventPattern &, const QEvent * );
168};
169
170/*!
171 \brief A state machine for line selections
172
173 Pressing QwtEventPattern::MouseSelect1 selects
174 the first point, releasing it the second point.
175 Pressing QwtEventPattern::KeySelect1 also selects the
176 first point, a second press selects the second point and terminates
177 the selection.
178
179 A common use case of QwtPickerDragLineMachine are pickers for
180 distance measurements.
181
182 \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
183*/
184
185class QWT_EXPORT QwtPickerDragLineMachine: public QwtPickerMachine
186{
187public:
188 QwtPickerDragLineMachine();
189
190 virtual QList<Command> transition(
191 const QwtEventPattern &, const QEvent * );
192};
193
194/*!
195 \brief A state machine for polygon selections
196
197 Pressing QwtEventPattern::MouseSelect1 or QwtEventPattern::KeySelect1
198 starts the selection and selects the first point, or appends a point.
199 Pressing QwtEventPattern::MouseSelect2 or QwtEventPattern::KeySelect2
200 appends the last point and terminates the selection.
201
202 \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode
203*/
204
205class QWT_EXPORT QwtPickerPolygonMachine: public QwtPickerMachine
206{
207public:
208 QwtPickerPolygonMachine();
209
210 virtual QList<Command> transition(
211 const QwtEventPattern &, const QEvent * );
212};
213
214#endif
Note: See TracBrowser for help on using the repository browser.