~l3on/ubuntu/oneiric/qwt/fix-921430

« back to all changes in this revision

Viewing changes to qwt-5.0.1/src/qwt_panner.h

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2007-10-05 15:20:41 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20071005152041-qmybqh4fj9jejyo2
Tags: 5.0.2-2
* Handle nostrip build option. (Closes: #437877)
* Build libqwt5-doc package in binary-indep target. (Closes: #443110)

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 
19
 
/*!
20
 
  \brief QwtPanner provides panning of a widget
21
 
 
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.
25
 
   
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. 
31
 
 
32
 
  For widgets, where repaints are very fast it might be better to
33
 
  implement panning manually by mapping mouse events into paint events.
34
 
*/
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
 
    virtual bool eventFilter(QObject *, QEvent *);
55
 
 
56
 
signals:
57
 
    /*!
58
 
      Signal emitted, when panning is done
59
 
 
60
 
      \param dx Offset in horizontal direction
61
 
      \param dy Offset in vertical direction
62
 
    */
63
 
    void panned(int dx, int dy);
64
 
 
65
 
    /*!
66
 
      Signal emitted, while the widget moved, but panning
67
 
      is not finished.
68
 
 
69
 
      \param dx Offset in horizontal direction
70
 
      \param dy Offset in vertical direction
71
 
    */
72
 
    void moved(int dx, int dy);
73
 
 
74
 
protected:
75
 
    virtual void widgetMousePressEvent(QMouseEvent *);
76
 
    virtual void widgetMouseReleaseEvent(QMouseEvent *);
77
 
    virtual void widgetMouseMoveEvent(QMouseEvent *);
78
 
    virtual void widgetKeyPressEvent(QKeyEvent *);
79
 
    virtual void widgetKeyReleaseEvent(QKeyEvent *);
80
 
 
81
 
    virtual void paintEvent(QPaintEvent *);
82
 
 
83
 
private:
84
 
#ifndef QT_NO_CURSOR
85
 
    void showCursor(bool);
86
 
#endif
87
 
 
88
 
    class PrivateData;
89
 
    PrivateData *d_data;
90
 
};
91
 
 
92
 
#endif