Qwt User's Guide  5.2.3
qwt_panner.h
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_PANNER_H
11 #define QWT_PANNER_H 1
12 
13 #include <qnamespace.h>
14 #include <qwidget.h>
15 #include "qwt_global.h"
16 
17 class QCursor;
18 
35 class QWT_EXPORT QwtPanner: public QWidget
36 {
37  Q_OBJECT
38 
39 public:
40  QwtPanner(QWidget* parent);
41  virtual ~QwtPanner();
42 
43  void setEnabled(bool);
44  bool isEnabled() const;
45 
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;
50 
51  void setCursor(const QCursor &);
52  const QCursor cursor() const;
53 
54 #if QT_VERSION >= 0x040000
55  void setOrientations(Qt::Orientations);
56  Qt::Orientations orientations() const;
57 #else
58  void enableOrientation(Qt::Orientation, bool enable);
59 #endif
60 
61  bool isOrientationEnabled(Qt::Orientation) const;
62 
63  virtual bool eventFilter(QObject *, QEvent *);
64 
65 signals:
72  void panned(int dx, int dy);
73 
81  void moved(int dx, int dy);
82 
83 protected:
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 *);
89 
90  virtual void paintEvent(QPaintEvent *);
91 
92 private:
93 #ifndef QT_NO_CURSOR
94  void showCursor(bool);
95 #endif
96 
97  class PrivateData;
98  PrivateData *d_data;
99 };
100 
101 #endif