qwt_legend.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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_H
  10. #define QWT_LEGEND_H
  11. #include "qwt_global.h"
  12. #include <qframe.h>
  13. #include <qlist.h>
  14. class QScrollBar;
  15. class QwtLegendItemManager;
  16. /*!
  17. \brief The legend widget
  18. The QwtLegend widget is a tabular arrangement of legend items. Legend
  19. items might be any type of widget, but in general they will be
  20. a QwtLegendItem.
  21. \sa QwtLegendItem, QwtLegendItemManager QwtPlot
  22. */
  23. class QWT_EXPORT QwtLegend : public QFrame
  24. {
  25. Q_OBJECT
  26. public:
  27. /*!
  28. \brief Interaction mode for the legend items
  29. - ReadOnlyItem\n
  30. The legend item is not interactive, like a label
  31. - ClickableItem\n
  32. The legend item is clickable, like a push button
  33. - CheckableItem\n
  34. The legend item is checkable, like a checkable button
  35. Default is ReadOnlyItem.
  36. \sa setItemMode(), itemMode(), QwtLegendItem::IdentifierMode
  37. QwtLegendItem::clicked(), QwtLegendItem::checked(),
  38. QwtPlot::legendClicked(), QwtPlot::legendChecked()
  39. */
  40. enum LegendItemMode
  41. {
  42. ReadOnlyItem,
  43. ClickableItem,
  44. CheckableItem
  45. };
  46. explicit QwtLegend( QWidget *parent = NULL );
  47. virtual ~QwtLegend();
  48. void setItemMode( LegendItemMode );
  49. LegendItemMode itemMode() const;
  50. QWidget *contentsWidget();
  51. const QWidget *contentsWidget() const;
  52. void insert( const QwtLegendItemManager *, QWidget * );
  53. void remove( const QwtLegendItemManager * );
  54. QWidget *find( const QwtLegendItemManager * ) const;
  55. QwtLegendItemManager *find( const QWidget * ) const;
  56. virtual QList<QWidget *> legendItems() const;
  57. void clear();
  58. bool isEmpty() const;
  59. uint itemCount() const;
  60. virtual bool eventFilter( QObject *, QEvent * );
  61. virtual QSize sizeHint() const;
  62. virtual int heightForWidth( int w ) const;
  63. QScrollBar *horizontalScrollBar() const;
  64. QScrollBar *verticalScrollBar() const;
  65. protected:
  66. virtual void resizeEvent( QResizeEvent * );
  67. virtual void layoutContents();
  68. private:
  69. class PrivateData;
  70. PrivateData *d_data;
  71. };
  72. #endif