1
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
3
* Copyright (C) 1997 Josef Wilgen
4
* Copyright (C) 2002 Uwe Rathmann
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
*****************************************************************************/
11
#include "qwt_event_pattern.h"
12
#include "qwt_picker_machine.h"
15
QwtPickerMachine::QwtPickerMachine():
21
QwtPickerMachine::~QwtPickerMachine()
25
//! Return the current state
26
int QwtPickerMachine::state() const
31
//! Change the current state
32
void QwtPickerMachine::setState(int state)
37
//! Set the current state to 0.
38
void QwtPickerMachine::reset()
44
QwtPickerMachine::CommandList QwtPickerClickPointMachine::transition(
45
const QwtEventPattern &eventPattern, const QEvent *e)
47
QwtPickerMachine::CommandList cmdList;
51
case QEvent::MouseButtonPress:
53
if ( eventPattern.mouseMatch(
54
QwtEventPattern::MouseSelect1, (const QMouseEvent *)e) )
62
case QEvent::KeyPress:
64
if ( eventPattern.keyMatch(
65
QwtEventPattern::KeySelect1, (const QKeyEvent *)e) )
81
QwtPickerMachine::CommandList QwtPickerDragPointMachine::transition(
82
const QwtEventPattern &eventPattern, const QEvent *e)
84
QwtPickerMachine::CommandList cmdList;
88
case QEvent::MouseButtonPress:
90
if ( eventPattern.mouseMatch(
91
QwtEventPattern::MouseSelect1, (const QMouseEvent *)e) )
102
case QEvent::MouseMove:
109
case QEvent::MouseButtonRelease:
118
case QEvent::KeyPress:
120
if ( eventPattern.keyMatch(
121
QwtEventPattern::KeySelect1, (const QKeyEvent *)e) )
145
QwtPickerMachine::CommandList QwtPickerClickRectMachine::transition(
146
const QwtEventPattern &eventPattern, const QEvent *e)
148
QwtPickerMachine::CommandList cmdList;
152
case QEvent::MouseButtonPress:
154
if ( eventPattern.mouseMatch(
155
QwtEventPattern::MouseSelect1, (const QMouseEvent *)e) )
168
// Uh, strange we missed the MouseButtonRelease
179
case QEvent::MouseMove:
186
case QEvent::MouseButtonRelease:
188
if ( eventPattern.mouseMatch(
189
QwtEventPattern::MouseSelect1, (const QMouseEvent *)e) )
199
case QEvent::KeyPress:
201
if ( eventPattern.keyMatch(
202
QwtEventPattern::KeySelect1, (const QKeyEvent *)e) )
217
else if ( state() == 2 )
234
QwtPickerMachine::CommandList QwtPickerDragRectMachine::transition(
235
const QwtEventPattern &eventPattern, const QEvent *e)
237
QwtPickerMachine::CommandList cmdList;
241
case QEvent::MouseButtonPress:
243
if ( eventPattern.mouseMatch(
244
QwtEventPattern::MouseSelect1, (const QMouseEvent *)e) )
256
case QEvent::MouseMove:
263
case QEvent::MouseButtonRelease:
272
case QEvent::KeyPress:
274
if ( eventPattern.keyMatch(
275
QwtEventPattern::KeySelect1, (const QKeyEvent *)e) )
300
QwtPickerMachine::CommandList QwtPickerPolygonMachine::transition(
301
const QwtEventPattern &eventPattern, const QEvent *e)
303
QwtPickerMachine::CommandList cmdList;
307
case QEvent::MouseButtonPress:
309
if ( eventPattern.mouseMatch(
310
QwtEventPattern::MouseSelect1, (const QMouseEvent *)e) )
325
if ( eventPattern.mouseMatch(
326
QwtEventPattern::MouseSelect2, (const QMouseEvent *)e) )
333
case QEvent::MouseMove:
340
case QEvent::KeyPress:
342
if ( eventPattern.keyMatch(
343
QwtEventPattern::KeySelect1, (const QKeyEvent *)e) )
358
else if ( eventPattern.keyMatch(
359
QwtEventPattern::KeySelect2, (const QKeyEvent *)e) )