[4271] | 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_ROUND_SCALE_DRAW_H
|
---|
| 11 | #define QWT_ROUND_SCALE_DRAW_H
|
---|
| 12 |
|
---|
| 13 | #include "qwt_global.h"
|
---|
| 14 | #include "qwt_abstract_scale_draw.h"
|
---|
| 15 | #include <qpoint.h>
|
---|
| 16 |
|
---|
| 17 | class QPen;
|
---|
| 18 |
|
---|
| 19 | /*!
|
---|
| 20 | \brief A class for drawing round scales
|
---|
| 21 |
|
---|
| 22 | QwtRoundScaleDraw can be used to draw round scales.
|
---|
| 23 | The circle segment can be adjusted by QwtRoundScaleDraw::setAngleRange().
|
---|
| 24 | The geometry of the scale can be specified with
|
---|
| 25 | QwtRoundScaleDraw::moveCenter() and QwtRoundScaleDraw::setRadius().
|
---|
| 26 |
|
---|
| 27 | After a scale division has been specified as a QwtScaleDiv object
|
---|
| 28 | using QwtAbstractScaleDraw::setScaleDiv(const QwtScaleDiv &s),
|
---|
| 29 | the scale can be drawn with the QwtAbstractScaleDraw::draw() member.
|
---|
| 30 | */
|
---|
| 31 |
|
---|
| 32 | class QWT_EXPORT QwtRoundScaleDraw: public QwtAbstractScaleDraw
|
---|
| 33 | {
|
---|
| 34 | public:
|
---|
| 35 | QwtRoundScaleDraw();
|
---|
| 36 | virtual ~QwtRoundScaleDraw();
|
---|
| 37 |
|
---|
| 38 | void setRadius( int radius );
|
---|
| 39 | int radius() const;
|
---|
| 40 |
|
---|
| 41 | void moveCenter( double x, double y );
|
---|
| 42 | void moveCenter( const QPointF & );
|
---|
| 43 | QPointF center() const;
|
---|
| 44 |
|
---|
| 45 | void setAngleRange( double angle1, double angle2 );
|
---|
| 46 |
|
---|
| 47 | virtual double extent( const QFont & ) const;
|
---|
| 48 |
|
---|
| 49 | protected:
|
---|
| 50 | virtual void drawTick( QPainter *p, double val, double len ) const;
|
---|
| 51 | virtual void drawBackbone( QPainter *p ) const;
|
---|
| 52 | virtual void drawLabel( QPainter *p, double val ) const;
|
---|
| 53 |
|
---|
| 54 | private:
|
---|
| 55 | QwtRoundScaleDraw( const QwtRoundScaleDraw & );
|
---|
| 56 | QwtRoundScaleDraw &operator=( const QwtRoundScaleDraw &other );
|
---|
| 57 |
|
---|
| 58 | class PrivateData;
|
---|
| 59 | PrivateData *d_data;
|
---|
| 60 | };
|
---|
| 61 |
|
---|
| 62 | //! Move the center of the scale draw, leaving the radius unchanged
|
---|
| 63 | inline void QwtRoundScaleDraw::moveCenter( double x, double y )
|
---|
| 64 | {
|
---|
| 65 | moveCenter( QPointF( x, y ) );
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | #endif
|
---|