qwt_legend_label.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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_LEGEND_LABEL_H
  10. #define QWT_LEGEND_LABEL_H
  11. #include "qwt_global.h"
  12. #include "qwt_legend_data.h"
  13. #include "qwt_text.h"
  14. #include "qwt_text_label.h"
  15. #include <qpixmap.h>
  16. class QwtLegendData;
  17. /*!
  18. \brief A widget representing something on a QwtLegend.
  19. */
  20. class QWT_EXPORT QwtLegendLabel: public QwtTextLabel
  21. {
  22. Q_OBJECT
  23. public:
  24. explicit QwtLegendLabel( QWidget *parent = 0 );
  25. virtual ~QwtLegendLabel();
  26. void setData( const QwtLegendData & );
  27. const QwtLegendData &data() const;
  28. void setItemMode( QwtLegendData::Mode );
  29. QwtLegendData::Mode itemMode() const;
  30. void setSpacing( int spacing );
  31. int spacing() const;
  32. virtual void setText( const QwtText & );
  33. void setIcon( const QPixmap & );
  34. QPixmap icon() const;
  35. virtual QSize sizeHint() const;
  36. bool isChecked() const;
  37. public Q_SLOTS:
  38. void setChecked( bool on );
  39. Q_SIGNALS:
  40. //! Signal, when the legend item has been clicked
  41. void clicked();
  42. //! Signal, when the legend item has been pressed
  43. void pressed();
  44. //! Signal, when the legend item has been released
  45. void released();
  46. //! Signal, when the legend item has been toggled
  47. void checked( bool );
  48. protected:
  49. void setDown( bool );
  50. bool isDown() const;
  51. virtual void paintEvent( QPaintEvent * );
  52. virtual void mousePressEvent( QMouseEvent * );
  53. virtual void mouseReleaseEvent( QMouseEvent * );
  54. virtual void keyPressEvent( QKeyEvent * );
  55. virtual void keyReleaseEvent( QKeyEvent * );
  56. private:
  57. class PrivateData;
  58. PrivateData *d_data;
  59. };
  60. #endif