Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / ground / gcs / src / libs / qwt / src / qwt_wheel.h
blob846543b843f80723c3034ff748bb9b14742e42ab
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
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 *****************************************************************************/
10 #ifndef QWT_WHEEL_H
11 #define QWT_WHEEL_H
13 #include "qwt_global.h"
14 #include <qwidget.h>
16 /*!
17 \brief The Wheel Widget
19 The wheel widget can be used to change values over a very large range
20 in very small steps. Using the setMass() member, it can be configured
21 as a flying wheel.
23 The default range of the wheel is [0.0, 100.0]
25 \sa The radio example.
27 class QWT_EXPORT QwtWheel: public QWidget
29 Q_OBJECT
31 Q_PROPERTY( Qt::Orientation orientation
32 READ orientation WRITE setOrientation )
34 Q_PROPERTY( double value READ value WRITE setValue )
35 Q_PROPERTY( double minimum READ minimum WRITE setMinimum )
36 Q_PROPERTY( double maximum READ maximum WRITE setMaximum )
38 Q_PROPERTY( double singleStep READ singleStep WRITE setSingleStep )
39 Q_PROPERTY( int pageStepCount READ pageStepCount WRITE setPageStepCount )
40 Q_PROPERTY( bool stepAlignment READ stepAlignment WRITE setStepAlignment )
42 Q_PROPERTY( bool tracking READ isTracking WRITE setTracking )
43 Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping )
44 Q_PROPERTY( bool inverted READ isInverted WRITE setInverted )
46 Q_PROPERTY( double mass READ mass WRITE setMass )
47 Q_PROPERTY( int updateInterval READ updateInterval WRITE setUpdateInterval )
49 Q_PROPERTY( double totalAngle READ totalAngle WRITE setTotalAngle )
50 Q_PROPERTY( double viewAngle READ viewAngle WRITE setViewAngle )
51 Q_PROPERTY( int tickCount READ tickCount WRITE setTickCount )
52 Q_PROPERTY( int wheelWidth READ wheelWidth WRITE setWheelWidth )
53 Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
54 Q_PROPERTY( int wheelBorderWidth READ wheelBorderWidth WRITE setWheelBorderWidth )
56 public:
57 explicit QwtWheel( QWidget *parent = NULL );
58 virtual ~QwtWheel();
60 double value() const;
62 void setOrientation( Qt::Orientation );
63 Qt::Orientation orientation() const;
65 double totalAngle() const;
66 double viewAngle() const;
68 void setTickCount( int );
69 int tickCount() const;
71 void setWheelWidth( int );
72 int wheelWidth() const;
74 void setWheelBorderWidth( int );
75 int wheelBorderWidth() const;
77 void setBorderWidth( int );
78 int borderWidth() const;
80 void setInverted( bool tf );
81 bool isInverted() const;
83 void setWrapping( bool tf );
84 bool wrapping() const;
86 void setSingleStep( double );
87 double singleStep() const;
89 void setPageStepCount( int );
90 int pageStepCount() const;
92 void setStepAlignment( bool on );
93 bool stepAlignment() const;
95 void setRange( double vmin, double vmax );
97 void setMinimum( double min );
98 double minimum() const;
100 void setMaximum( double max );
101 double maximum() const;
103 void setUpdateInterval( int );
104 int updateInterval() const;
106 void setTracking( bool enable );
107 bool isTracking() const;
109 double mass() const;
111 public Q_SLOTS:
112 void setValue( double );
113 void setTotalAngle ( double );
114 void setViewAngle( double );
115 void setMass( double );
117 Q_SIGNALS:
120 \brief Notify a change of value.
122 When tracking is enabled this signal will be emitted every
123 time the value changes.
125 \param value new value
126 \sa setTracking()
128 void valueChanged( double value );
131 This signal is emitted when the user presses the
132 the wheel with the mouse
134 void wheelPressed();
137 This signal is emitted when the user releases the mouse
139 void wheelReleased();
142 This signal is emitted when the user moves the
143 wheel with the mouse.
145 \param value new value
147 void wheelMoved( double value );
149 protected:
150 virtual void paintEvent( QPaintEvent * );
151 virtual void mousePressEvent( QMouseEvent * );
152 virtual void mouseReleaseEvent( QMouseEvent * );
153 virtual void mouseMoveEvent( QMouseEvent * );
154 virtual void keyPressEvent( QKeyEvent * );
155 virtual void wheelEvent( QWheelEvent * );
156 virtual void timerEvent( QTimerEvent * );
158 void stopFlying();
160 QRect wheelRect() const;
162 virtual QSize sizeHint() const;
163 virtual QSize minimumSizeHint() const;
165 virtual void drawTicks( QPainter *, const QRectF & );
166 virtual void drawWheelBackground( QPainter *, const QRectF & );
168 virtual double valueAt( const QPoint & ) const;
170 private:
171 double alignedValue( double ) const;
172 double boundedValue( double ) const;
174 class PrivateData;
175 PrivateData *d_data;
178 #endif