Qwt User's Guide 6.1.6

qwt_dial_needle.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_DIAL_NEEDLE_H
11 #define QWT_DIAL_NEEDLE_H 1
12
13 #include "qwt_global.h"
14 #include <qpalette.h>
15
16 class QPainter;
17 class QPoint;
18
28 class QWT_EXPORT QwtDialNeedle
29 {
30 public:
31 QwtDialNeedle();
32 virtual ~QwtDialNeedle();
33
34 virtual void setPalette( const QPalette & );
35 const QPalette &palette() const;
36
37 virtual void draw( QPainter *painter, const QPointF &center,
38 double length, double direction,
39 QPalette::ColorGroup = QPalette::Active ) const;
40
41 protected:
57 virtual void drawNeedle( QPainter *painter,
58 double length, QPalette::ColorGroup colorGroup ) const = 0;
59
60 virtual void drawKnob( QPainter *, double width,
61 const QBrush &, bool sunken ) const;
62
63 private:
64 QPalette d_palette;
65 };
66
80 class QWT_EXPORT QwtDialSimpleNeedle: public QwtDialNeedle
81 {
82 public:
84 enum Style
85 {
87 Arrow,
88
90 Ray
91 };
92
93 QwtDialSimpleNeedle( Style, bool hasKnob = true,
94 const QColor &mid = Qt::gray, const QColor &base = Qt::darkGray );
95
96 void setWidth( double width );
97 double width() const;
98
99 protected:
100 virtual void drawNeedle( QPainter *, double length,
101 QPalette::ColorGroup ) const;
102
103 private:
104 Style d_style;
105 bool d_hasKnob;
106 double d_width;
107 };
108
126 class QWT_EXPORT QwtCompassMagnetNeedle: public QwtDialNeedle
127 {
128 public:
130 enum Style
131 {
133 TriangleStyle,
134
136 ThinStyle
137 };
138
139 QwtCompassMagnetNeedle( Style = TriangleStyle,
140 const QColor &light = Qt::white, const QColor &dark = Qt::red );
141
142 protected:
143 virtual void drawNeedle( QPainter *,
144 double length, QPalette::ColorGroup ) const;
145
146 private:
147 Style d_style;
148 };
149
163 class QWT_EXPORT QwtCompassWindArrow: public QwtDialNeedle
164 {
165 public:
167 enum Style
168 {
170 Style1,
171
173 Style2
174 };
175
176 QwtCompassWindArrow( Style, const QColor &light = Qt::white,
177 const QColor &dark = Qt::gray );
178
179 protected:
180 virtual void drawNeedle( QPainter *,
181 double length, QPalette::ColorGroup ) const;
182
183 private:
184 Style d_style;
185 };
186
187 #endif
QwtDialSimpleNeedle::Style
Style
Style of the needle.
Definition: qwt_dial_needle.h:85
QwtCompassWindArrow
An indicator for the wind direction.
Definition: qwt_dial_needle.h:164
QwtCompassMagnetNeedle
A magnet needle for compass widgets.
Definition: qwt_dial_needle.h:127
QwtCompassMagnetNeedle::TriangleStyle
@ TriangleStyle
A needle with a triangular shape.
Definition: qwt_dial_needle.h:133
QwtDialSimpleNeedle::Arrow
@ Arrow
Arrow.
Definition: qwt_dial_needle.h:87
QwtDialSimpleNeedle
A needle for dial widgets.
Definition: qwt_dial_needle.h:81
QwtCompassWindArrow::Style1
@ Style1
A needle pointing to the center.
Definition: qwt_dial_needle.h:170
QwtDialNeedle
Base class for needles that can be used in a QwtDial.
Definition: qwt_dial_needle.h:29
QwtCompassMagnetNeedle::Style
Style
Style of the needle.
Definition: qwt_dial_needle.h:131
QwtCompassWindArrow::Style
Style
Style of the arrow.
Definition: qwt_dial_needle.h:168
QwtDialNeedle::drawNeedle
virtual void drawNeedle(QPainter *painter, double length, QPalette::ColorGroup colorGroup) const =0
Draw the needle.