qwt_dial_needle.h
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_DIAL_NEEDLE_H
#define QWT_DIAL_NEEDLE_H 1
#include "qwt_global.h"
#include <qpalette.h>
class QPainter;
class QPoint;
class QWT_EXPORT QwtDialNeedle
{
public:
QwtDialNeedle();
virtual ~QwtDialNeedle();
virtual void setPalette( const QPalette & );
const QPalette &palette() const;
virtual void draw( QPainter *painter, const QPointF &center,
double length, double direction,
QPalette::ColorGroup = QPalette::Active ) const;
protected:
virtual void drawNeedle( QPainter *painter,
double length, QPalette::ColorGroup colorGroup ) const = 0;
virtual void drawKnob( QPainter *, double width,
const QBrush &, bool sunken ) const;
private:
QPalette d_palette;
};
class QWT_EXPORT QwtDialSimpleNeedle: public QwtDialNeedle
{
public:
enum Style
{
Arrow,
Ray
};
QwtDialSimpleNeedle( Style, bool hasKnob = true,
const QColor &mid = Qt::gray, const QColor &base = Qt::darkGray );
void setWidth( double width );
double width() const;
protected:
virtual void drawNeedle( QPainter *, double length,
QPalette::ColorGroup ) const;
private:
Style d_style;
bool d_hasKnob;
double d_width;
};
class QWT_EXPORT QwtCompassMagnetNeedle: public QwtDialNeedle
{
public:
enum Style
{
TriangleStyle,
ThinStyle
};
QwtCompassMagnetNeedle( Style = TriangleStyle,
const QColor &light = Qt::white, const QColor &dark = Qt::red );
protected:
virtual void drawNeedle( QPainter *,
double length, QPalette::ColorGroup ) const;
private:
Style d_style;
};
class QWT_EXPORT QwtCompassWindArrow: public QwtDialNeedle
{
public:
enum Style
{
Style1,
Style2
};
QwtCompassWindArrow( Style, const QColor &light = Qt::white,
const QColor &dark = Qt::gray );
protected:
virtual void drawNeedle( QPainter *,
double length, QPalette::ColorGroup ) const;
private:
Style d_style;
};
#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.