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
#define QWT_PANNER_H 1
13
#include <qnamespace.h>
15
#include "qwt_global.h"
20
\brief QwtPanner provides panning of a widget
22
QwtPanner grabs the contents of a widget, that can be dragged
23
in all directions. The offset between the start and the end position
24
is emitted by the panned signal.
26
QwtPanner grabs the content of the widget into a pixmap and moves
27
the pixmap around, without initiating any repaint events for the widget.
28
Areas, that are not part of content are not painted while panning
29
in in process. This makes panning fast enough for widgets, where
30
repaints are too slow for mouse movements.
32
For widgets, where repaints are very fast it might be better to
33
implement panning manually by mapping mouse events into paint events.
35
class QWT_EXPORT QwtPanner: public QWidget
40
QwtPanner(QWidget* parent);
43
void setEnabled(bool);
44
bool isEnabled() const;
46
void setMouseButton(int button, int buttonState = Qt::NoButton);
47
void getMouseButton(int &button, int &buttonState) const;
48
void setAbortKey(int key, int state = Qt::NoButton);
49
void getAbortKey(int &key, int &state) const;
51
void setCursor(const QCursor &);
52
const QCursor cursor() const;
54
#if QT_VERSION >= 0x040000
55
void setOrientations(Qt::Orientations);
56
Qt::Orientations orientations() const;
58
void enableOrientation(Qt::Orientation, bool enable);
61
bool isOrientationEnabled(Qt::Orientation) const;
63
virtual bool eventFilter(QObject *, QEvent *);
67
Signal emitted, when panning is done
69
\param dx Offset in horizontal direction
70
\param dy Offset in vertical direction
72
void panned(int dx, int dy);
75
Signal emitted, while the widget moved, but panning
78
\param dx Offset in horizontal direction
79
\param dy Offset in vertical direction
81
void moved(int dx, int dy);
84
virtual void widgetMousePressEvent(QMouseEvent *);
85
virtual void widgetMouseReleaseEvent(QMouseEvent *);
86
virtual void widgetMouseMoveEvent(QMouseEvent *);
87
virtual void widgetKeyPressEvent(QKeyEvent *);
88
virtual void widgetKeyReleaseEvent(QKeyEvent *);
90
virtual void paintEvent(QPaintEvent *);
94
void showCursor(bool);