qwt_round_scale_draw.h 2.0 KB

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