~ubuntu-branches/ubuntu/oneiric/qwt/oneiric-proposed

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2009-04-12 23:25:58 UTC
  • mfrom: (1.1.4 upstream) (2.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090412232558-3bl06x785yr8xm8u
Tags: 5.1.2-1
* New upstream release.
* Bump compat/debhelper to 7.
* Bump Standards-Version to 3.8.1. No changes needed.
* Invert Maintainers and Uploaders field.
* Fix lintian warnings:
  - dh_clean _k deprecated.
  - missing dependency on libc.

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
#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:
 
66
    /*!
 
67
      Signal emitted, when panning is done
 
68
 
 
69
      \param dx Offset in horizontal direction
 
70
      \param dy Offset in vertical direction
 
71
    */
 
72
    void panned(int dx, int dy);
 
73
 
 
74
    /*!
 
75
      Signal emitted, while the widget moved, but panning
 
76
      is not finished.
 
77
 
 
78
      \param dx Offset in horizontal direction
 
79
      \param dy Offset in vertical direction
 
80
    */
 
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