qwt_picker_machine.h
/******************************************************************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_PICKER_MACHINE
#define QWT_PICKER_MACHINE
#include "qwt_global.h"
class QwtEventPattern;
class QEvent;
template< typename T > class QList;
class QWT_EXPORT QwtPickerMachine
{
public:
enum SelectionType
{
NoSelection = -1,
PointSelection,
RectSelection,
PolygonSelection
};
enum Command
{
Begin,
Append,
Move,
Remove,
End
};
explicit QwtPickerMachine( SelectionType );
virtual ~QwtPickerMachine();
virtual QList< Command > transition(
const QwtEventPattern&, const QEvent* ) = 0;
void reset();
int state() const;
void setState( int );
SelectionType selectionType() const;
private:
const SelectionType m_selectionType;
int m_state;
};
class QWT_EXPORT QwtPickerTrackerMachine : public QwtPickerMachine
{
public:
QwtPickerTrackerMachine();
virtual QList< Command > transition(
const QwtEventPattern&, const QEvent* ) QWT_OVERRIDE;
};
class QWT_EXPORT QwtPickerClickPointMachine : public QwtPickerMachine
{
public:
QwtPickerClickPointMachine();
virtual QList< Command > transition(
const QwtEventPattern&, const QEvent* ) QWT_OVERRIDE;
};
class QWT_EXPORT QwtPickerDragPointMachine : public QwtPickerMachine
{
public:
QwtPickerDragPointMachine();
virtual QList< Command > transition(
const QwtEventPattern&, const QEvent* ) QWT_OVERRIDE;
};
class QWT_EXPORT QwtPickerClickRectMachine : public QwtPickerMachine
{
public:
QwtPickerClickRectMachine();
virtual QList< Command > transition(
const QwtEventPattern&, const QEvent* ) QWT_OVERRIDE;
};
class QWT_EXPORT QwtPickerDragRectMachine : public QwtPickerMachine
{
public:
QwtPickerDragRectMachine();
virtual QList< Command > transition(
const QwtEventPattern&, const QEvent* ) QWT_OVERRIDE;
};
class QWT_EXPORT QwtPickerDragLineMachine : public QwtPickerMachine
{
public:
QwtPickerDragLineMachine();
virtual QList< Command > transition(
const QwtEventPattern&, const QEvent* ) QWT_OVERRIDE;
};
class QWT_EXPORT QwtPickerPolygonMachine : public QwtPickerMachine
{
public:
QwtPickerPolygonMachine();
virtual QList< Command > transition(
const QwtEventPattern&, const QEvent* ) QWT_OVERRIDE;
};
#endif
QList
Definition: qwt_abstract_legend.h:17
QwtEventPattern
A collection of event patterns.
Definition: qwt_event_pattern.h:31
QwtPickerClickPointMachine
A state machine for point selections.
Definition: qwt_picker_machine.h:103
QwtPickerClickRectMachine
A state machine for rectangle selections.
Definition: qwt_picker_machine.h:141
QwtPickerDragLineMachine
A state machine for line selections.
Definition: qwt_picker_machine.h:186
QwtPickerDragPointMachine
A state machine for point selections.
Definition: qwt_picker_machine.h:119
QwtPickerDragRectMachine
A state machine for rectangle selections.
Definition: qwt_picker_machine.h:162
QwtPickerMachine
A state machine for QwtPicker selections.
Definition: qwt_picker_machine.h:29
QwtPickerMachine::SelectionType
SelectionType
Definition: qwt_picker_machine.h:36
QwtPickerMachine::RectSelection
@ RectSelection
The state machine is for selecting a rectangle (2 points).
Definition: qwt_picker_machine.h:44
QwtPickerMachine::PointSelection
@ PointSelection
The state machine is for selecting a single point.
Definition: qwt_picker_machine.h:41
QwtPickerMachine::Command
Command
Commands - the output of a state machine.
Definition: qwt_picker_machine.h:52
QwtPickerMachine::transition
virtual QList< Command > transition(const QwtEventPattern &, const QEvent *)=0
Transition.
QwtPickerPolygonMachine
A state machine for polygon selections.
Definition: qwt_picker_machine.h:206
QwtPickerTrackerMachine
A state machine for indicating mouse movements.
Definition: qwt_picker_machine.h:86