qwt_polar_canvas.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
  2. * QwtPolar Widget Library
  3. * Copyright (C) 2008 Uwe Rathmann
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the Qwt License, Version 1.0
  7. *****************************************************************************/
  8. #ifndef QWT_POLAR_CANVAS_H
  9. #define QWT_POLAR_CANVAS_H 1
  10. #include "qwt_polar_global.h"
  11. #include <qwt_point_polar.h>
  12. #include <qframe.h>
  13. class QPainter;
  14. class QwtPolarPlot;
  15. /*!
  16. \brief Canvas of a QwtPolarPlot.
  17. The canvas is the widget, where all polar items are painted to.
  18. \note In opposite to QwtPlot all axes are painted on the canvas.
  19. \sa QwtPolarPlot
  20. */
  21. class QWT_POLAR_EXPORT QwtPolarCanvas: public QFrame
  22. {
  23. Q_OBJECT
  24. public:
  25. /*!
  26. \brief Paint attributes
  27. The default setting enables BackingStore
  28. \sa setPaintAttribute(), testPaintAttribute(), backingStore()
  29. */
  30. enum PaintAttribute
  31. {
  32. /*!
  33. Paint double buffered and reuse the content of the pixmap buffer
  34. for some spontaneous repaints that happen when a plot gets unhidden,
  35. deiconified or changes the focus.
  36. */
  37. BackingStore = 0x01
  38. };
  39. //! Paint attributes
  40. typedef QFlags<PaintAttribute> PaintAttributes;
  41. explicit QwtPolarCanvas( QwtPolarPlot * );
  42. virtual ~QwtPolarCanvas();
  43. QwtPolarPlot *plot();
  44. const QwtPolarPlot *plot() const;
  45. void setPaintAttribute( PaintAttribute, bool on = true );
  46. bool testPaintAttribute( PaintAttribute ) const;
  47. const QPixmap *backingStore() const;
  48. void invalidateBackingStore();
  49. QwtPointPolar invTransform( const QPoint & ) const;
  50. QPoint transform( const QwtPointPolar & ) const;
  51. protected:
  52. virtual void paintEvent( QPaintEvent * );
  53. virtual void resizeEvent( QResizeEvent * );
  54. private:
  55. class PrivateData;
  56. PrivateData *d_data;
  57. };
  58. Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarCanvas::PaintAttributes )
  59. #endif