Qwt User's Guide 6.0.2

- Main Page
- Related Pages
- Classes

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
31 class QWT_EXPORT QwtDialNeedle
32 {
33 public:
34 QwtDialNeedle();
35 virtual ~QwtDialNeedle();
36
37 virtual void setPalette( const QPalette & );
38 const QPalette &palette() const;
39
40 virtual void draw( QPainter *painter, const QPointF &center,
41 double length, double direction,
42 QPalette::ColorGroup = QPalette::Active ) const;
43
44 protected:
60 virtual void drawNeedle( QPainter *painter,
61 double length, QPalette::ColorGroup colorGroup ) const = 0;
62
63 virtual void drawKnob( QPainter *, double width,
64 const QBrush &, bool sunken ) const;
65
66 private:
67 QPalette d_palette;
68 };
69
83 class QWT_EXPORT QwtDialSimpleNeedle: public QwtDialNeedle
84 {
85 public:
87 enum Style
88 {
90 Arrow,
91
93 Ray
94 };
95
96 QwtDialSimpleNeedle( Style, bool hasKnob = true,
97 const QColor &mid = Qt::gray, const QColor &base = Qt::darkGray );
98
99 void setWidth( double width );
100 double width() const;
101
102 protected:
103 virtual void drawNeedle( QPainter *, double length,
104 QPalette::ColorGroup ) const;
105
106 private:
107 Style d_style;
108 bool d_hasKnob;
109 double d_width;
110 };
111
129 class QWT_EXPORT QwtCompassMagnetNeedle: public QwtDialNeedle
130 {
131 public:
133 enum Style
134 {
136 TriangleStyle,
137
139 ThinStyle
140 };
141
142 QwtCompassMagnetNeedle( Style = TriangleStyle,
143 const QColor &light = Qt::white, const QColor &dark = Qt::red );
144
145 protected:
146 virtual void drawNeedle( QPainter *,
147 double length, QPalette::ColorGroup ) const;
148
149 private:
150 Style d_style;
151 };
152
166 class QWT_EXPORT QwtCompassWindArrow: public QwtDialNeedle
167 {
168 public:
170 enum Style
171 {
173 Style1,
174
176 Style2
177 };
178
179 QwtCompassWindArrow( Style, const QColor &light = Qt::white,
180 const QColor &dark = Qt::gray );
181
182 protected:
183 virtual void drawNeedle( QPainter *,
184 double length, QPalette::ColorGroup ) const;
185
186 private:
187 Style d_style;
188 };
189
190 #endif