qwt_interval_symbol.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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_INTERVAL_SYMBOL_H
  10. #define QWT_INTERVAL_SYMBOL_H
  11. #include "qwt_global.h"
  12. #include <qpen.h>
  13. #include <qsize.h>
  14. class QPainter;
  15. class QRect;
  16. class QPointF;
  17. /*!
  18. \brief A drawing primitive for displaying an interval like an error bar
  19. \sa QwtPlotIntervalCurve
  20. */
  21. class QWT_EXPORT QwtIntervalSymbol
  22. {
  23. public:
  24. //! Symbol style
  25. enum Style
  26. {
  27. //! No Style. The symbol cannot be drawn.
  28. NoSymbol = -1,
  29. /*!
  30. The symbol displays a line with caps at the beginning/end.
  31. The size of the caps depends on the symbol width().
  32. */
  33. Bar,
  34. /*!
  35. The symbol displays a plain rectangle using pen() and brush().
  36. The size of the rectangle depends on the translated interval and
  37. the width(),
  38. */
  39. Box,
  40. /*!
  41. Styles >= UserSymbol are reserved for derived
  42. classes of QwtIntervalSymbol that overload draw() with
  43. additional application specific symbol types.
  44. */
  45. UserSymbol = 1000
  46. };
  47. public:
  48. QwtIntervalSymbol( Style = NoSymbol );
  49. QwtIntervalSymbol( const QwtIntervalSymbol & );
  50. virtual ~QwtIntervalSymbol();
  51. QwtIntervalSymbol &operator=( const QwtIntervalSymbol & );
  52. bool operator==( const QwtIntervalSymbol & ) const;
  53. bool operator!=( const QwtIntervalSymbol & ) const;
  54. void setWidth( int );
  55. int width() const;
  56. void setBrush( const QBrush & );
  57. const QBrush& brush() const;
  58. void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
  59. void setPen( const QPen & );
  60. const QPen& pen() const;
  61. void setStyle( Style );
  62. Style style() const;
  63. virtual void draw( QPainter *, Qt::Orientation,
  64. const QPointF& from, const QPointF& to ) const;
  65. private:
  66. class PrivateData;
  67. PrivateData* d_data;
  68. };
  69. #endif