Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_DIAL_NEEDLE_H
00011 #define QWT_DIAL_NEEDLE_H 1
00012
00013 #include "qwt_global.h"
00014 #include <qpalette.h>
00015
00016 class QPainter;
00017 class QPoint;
00018
00028 class QWT_EXPORT QwtDialNeedle
00029 {
00030 public:
00031 QwtDialNeedle();
00032 virtual ~QwtDialNeedle();
00033
00034 virtual void setPalette( const QPalette & );
00035 const QPalette &palette() const;
00036
00037 virtual void draw( QPainter *painter, const QPointF ¢er,
00038 double length, double direction,
00039 QPalette::ColorGroup = QPalette::Active ) const;
00040
00041 protected:
00057 virtual void drawNeedle( QPainter *painter,
00058 double length, QPalette::ColorGroup colorGroup ) const = 0;
00059
00060 virtual void drawKnob( QPainter *, double width,
00061 const QBrush &, bool sunken ) const;
00062
00063 private:
00064 Q_DISABLE_COPY(QwtDialNeedle)
00065
00066 QPalette d_palette;
00067 };
00068
00082 class QWT_EXPORT QwtDialSimpleNeedle: public QwtDialNeedle
00083 {
00084 public:
00086 enum Style
00087 {
00089 Arrow,
00090
00092 Ray
00093 };
00094
00095 QwtDialSimpleNeedle( Style, bool hasKnob = true,
00096 const QColor &mid = Qt::gray, const QColor &base = Qt::darkGray );
00097
00098 void setWidth( double width );
00099 double width() const;
00100
00101 protected:
00102 virtual void drawNeedle( QPainter *, double length,
00103 QPalette::ColorGroup ) const;
00104
00105 private:
00106 Style d_style;
00107 bool d_hasKnob;
00108 double d_width;
00109 };
00110
00128 class QWT_EXPORT QwtCompassMagnetNeedle: public QwtDialNeedle
00129 {
00130 public:
00132 enum Style
00133 {
00135 TriangleStyle,
00136
00138 ThinStyle
00139 };
00140
00141 QwtCompassMagnetNeedle( Style = TriangleStyle,
00142 const QColor &light = Qt::white, const QColor &dark = Qt::red );
00143
00144 protected:
00145 virtual void drawNeedle( QPainter *,
00146 double length, QPalette::ColorGroup ) const;
00147
00148 private:
00149 Style d_style;
00150 };
00151
00165 class QWT_EXPORT QwtCompassWindArrow: public QwtDialNeedle
00166 {
00167 public:
00169 enum Style
00170 {
00172 Style1,
00173
00175 Style2
00176 };
00177
00178 QwtCompassWindArrow( Style, const QColor &light = Qt::white,
00179 const QColor &dark = Qt::gray );
00180
00181 protected:
00182 virtual void drawNeedle( QPainter *,
00183 double length, QPalette::ColorGroup ) const;
00184
00185 private:
00186 Style d_style;
00187 };
00188
00189 #endif