Qwt User's Guide  5.2.3
qwt_magnifier.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_MAGNIFIER_H
11 #define QWT_MAGNIFIER_H 1
12 
13 #include "qwt_global.h"
14 #include <qobject.h>
15 
16 class QWidget;
17 class QMouseEvent;
18 class QWheelEvent;
19 class QKeyEvent;
20 
27 class QWT_EXPORT QwtMagnifier: public QObject
28 {
29  Q_OBJECT
30 
31 public:
32  explicit QwtMagnifier(QWidget *);
33  virtual ~QwtMagnifier();
34 
35  QWidget *parentWidget();
36  const QWidget *parentWidget() const;
37 
38  void setEnabled(bool);
39  bool isEnabled() const;
40 
41  // mouse
42  void setMouseFactor(double);
43  double mouseFactor() const;
44 
45  void setMouseButton(int button, int buttonState = Qt::NoButton);
46  void getMouseButton(int &button, int &buttonState) const;
47 
48  // mouse wheel
49  void setWheelFactor(double);
50  double wheelFactor() const;
51 
52  void setWheelButtonState(int buttonState);
53  int wheelButtonState() const;
54 
55  // keyboard
56  void setKeyFactor(double);
57  double keyFactor() const;
58 
59  void setZoomInKey(int key, int modifiers);
60  void getZoomInKey(int &key, int &modifiers) const;
61 
62  void setZoomOutKey(int key, int modifiers);
63  void getZoomOutKey(int &key, int &modifiers) const;
64 
65  virtual bool eventFilter(QObject *, QEvent *);
66 
67 protected:
72  virtual void rescale(double factor) = 0;
73 
74  virtual void widgetMousePressEvent(QMouseEvent *);
75  virtual void widgetMouseReleaseEvent(QMouseEvent *);
76  virtual void widgetMouseMoveEvent(QMouseEvent *);
77  virtual void widgetWheelEvent(QWheelEvent *);
78  virtual void widgetKeyPressEvent(QKeyEvent *);
79  virtual void widgetKeyReleaseEvent(QKeyEvent *);
80 
81 private:
82  class PrivateData;
83  PrivateData *d_data;
84 };
85 
86 #endif