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