qwt_legend_item.h 2.0 KB

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