qwt_round_scale_draw.h 1.9 KB

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