source: ntrip/trunk/BNC/qwt/qwt_panner.h@ 6381

Last change on this file since 6381 was 4271, checked in by mervart, 12 years ago
File size: 2.8 KB
RevLine 
[4271]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 "qwt_global.h"
14#include <qwidget.h>
15#include <qpixmap.h>
16
17class 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 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*/
35class QWT_EXPORT QwtPanner: public QWidget
36{
37 Q_OBJECT
38
39public:
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 void setOrientations( Qt::Orientations );
55 Qt::Orientations orientations() const;
56
57 bool isOrientationEnabled( Qt::Orientation ) const;
58
59 virtual bool eventFilter( QObject *, QEvent * );
60
61Q_SIGNALS:
62 /*!
63 Signal emitted, when panning is done
64
65 \param dx Offset in horizontal direction
66 \param dy Offset in vertical direction
67 */
68 void panned( int dx, int dy );
69
70 /*!
71 Signal emitted, while the widget moved, but panning
72 is not finished.
73
74 \param dx Offset in horizontal direction
75 \param dy Offset in vertical direction
76 */
77 void moved( int dx, int dy );
78
79protected:
80 virtual void widgetMousePressEvent( QMouseEvent * );
81 virtual void widgetMouseReleaseEvent( QMouseEvent * );
82 virtual void widgetMouseMoveEvent( QMouseEvent * );
83 virtual void widgetKeyPressEvent( QKeyEvent * );
84 virtual void widgetKeyReleaseEvent( QKeyEvent * );
85
86 virtual void paintEvent( QPaintEvent * );
87
88 virtual QBitmap contentsMask() const;
89 virtual QPixmap grab() const;
90
91private:
92#ifndef QT_NO_CURSOR
93 void showCursor( bool );
94#endif
95
96 class PrivateData;
97 PrivateData *d_data;
98};
99
100#endif
Note: See TracBrowser for help on using the repository browser.