1
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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_DIAL_NEEDLE_H
11
#define QWT_DIAL_NEEDLE_H 1
14
#include "qwt_global.h"
20
\brief Base class for needles that can be used in a QwtDial.
22
QwtDialNeedle is a pointer that indicates a value by pointing
23
to a specific direction.
25
Qwt is missing a set of good looking needles.
26
Contributions are very welcome.
28
\sa QwtDial, QwtCompass
31
class QWT_EXPORT QwtDialNeedle
35
virtual ~QwtDialNeedle();
40
\param painter Painter
41
\param center Center of the dial, start position for the needle
42
\param length Length of the needle
43
\param direction Direction of the needle, in degrees counter clockwise
44
\param cg Color group, used for painting
46
virtual void draw(QPainter *painter, const QPoint ¢er,
47
int length, double direction,
48
QPalette::ColorGroup cg = QPalette::Active) const = 0;
50
virtual void setPalette(const QPalette &);
51
const QPalette &palette() const;
54
static void drawKnob(QPainter *, const QPoint &pos,
55
int width, const QBrush &, bool sunken);
62
\brief A needle for dial widgets
64
The following colors are used:
70
\sa QwtDial, QwtCompass
73
class QWT_EXPORT QwtDialSimpleNeedle: public QwtDialNeedle
76
//! Style of the needle
83
QwtDialSimpleNeedle(Style, bool hasKnob = true,
84
const QColor &mid = Qt::gray, const QColor &base = Qt::darkGray);
86
virtual void draw(QPainter *, const QPoint &, int length,
87
double direction, QPalette::ColorGroup = QPalette::Active) const;
89
static void drawArrowNeedle(QPainter *,
90
const QPalette&, QPalette::ColorGroup,
91
const QPoint &, int length, int width, double direction,
94
static void drawRayNeedle(QPainter *,
95
const QPalette&, QPalette::ColorGroup,
96
const QPoint &, int length, int width, double direction,
99
void setWidth(int width);
109
\brief A magnet needle for compass widgets
111
A magnet needle points to two opposite directions indicating
114
The following colors are used:
115
- QColorGroup::Light\n
116
Used for pointing south
117
- QColorGroup::Dark\n
118
Used for pointing north
119
- QColorGroup::Base\n
120
Knob (ThinStyle only)
122
\sa QwtDial, QwtCompass
125
class QWT_EXPORT QwtCompassMagnetNeedle: public QwtDialNeedle
128
//! Style of the needle
134
QwtCompassMagnetNeedle(Style = TriangleStyle,
135
const QColor &light = Qt::white, const QColor &dark = Qt::red);
137
virtual void draw(QPainter *, const QPoint &, int length,
138
double direction, QPalette::ColorGroup = QPalette::Active) const;
140
static void drawTriangleNeedle(QPainter *,
141
const QPalette &, QPalette::ColorGroup,
142
const QPoint &, int length, double direction);
144
static void drawThinNeedle(QPainter *,
145
const QPalette &, QPalette::ColorGroup,
146
const QPoint &, int length, double direction);
149
static void drawPointer(QPainter *painter, const QBrush &brush,
150
int colorOffset, const QPoint ¢er,
151
int length, int width, double direction);
158
\brief An indicator for the wind direction
160
QwtCompassWindArrow shows the direction where the wind comes from.
162
- QColorGroup::Light\n
163
Used for Style1, or the light half of Style2
164
- QColorGroup::Dark\n
165
Used for the dark half of Style2
167
\sa QwtDial, QwtCompass
170
class QWT_EXPORT QwtCompassWindArrow: public QwtDialNeedle
173
//! Style of the arrow
180
QwtCompassWindArrow(Style, const QColor &light = Qt::white,
181
const QColor &dark = Qt::gray);
183
virtual void draw(QPainter *, const QPoint &, int length,
184
double direction, QPalette::ColorGroup = QPalette::Active) const;
186
static void drawStyle1Needle(QPainter *,
187
const QPalette &, QPalette::ColorGroup,
188
const QPoint &, int length, double direction);
190
static void drawStyle2Needle(QPainter *,
191
const QPalette &, QPalette::ColorGroup,
192
const QPoint &, int length, double direction);
198
#endif // QWT_DIAL_NEEDLE_H