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
QwtDialNeedle::drawNeedle
virtual void drawNeedle(QPainter *painter, double length, QPalette::ColorGroup colorGroup) const =0
Draw the needle.
QwtCompassMagnetNeedle::Style
Style
Style of the needle.
Definition: qwt_dial_needle.h:130
QwtCompassWindArrow::Style1
A needle pointing to the center.
Definition: qwt_dial_needle.h:170
QwtCompassWindArrow::Style
Style
Style of the arrow.
Definition: qwt_dial_needle.h:167
QwtCompassMagnetNeedle
A magnet needle for compass widgets.
Definition: qwt_dial_needle.h:126
QwtCompassWindArrow
An indicator for the wind direction.
Definition: qwt_dial_needle.h:163
QwtCompassMagnetNeedle::TriangleStyle
A needle with a triangular shape.
Definition: qwt_dial_needle.h:133
QwtDialSimpleNeedle
A needle for dial widgets.
Definition: qwt_dial_needle.h:80
QwtDialNeedle
Base class for needles that can be used in a QwtDial.
Definition: qwt_dial_needle.h:28
QwtDialSimpleNeedle::Style
Style
Style of the needle.
Definition: qwt_dial_needle.h:84
QwtDialSimpleNeedle::Arrow
Arrow.
Definition: qwt_dial_needle.h:87