00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef QWT_LEGEND_H
00013 #define QWT_LEGEND_H
00014
00015 #include <qframe.h>
00016 #include "qwt_global.h"
00017 #if QT_VERSION < 0x040000
00018 #include <qvaluelist.h>
00019 #else
00020 #include <qlist.h>
00021 #endif
00022
00023 class QScrollBar;
00024 class QwtPlotItem;
00025
00036 class QWT_EXPORT QwtLegend : public QFrame
00037 {
00038 Q_OBJECT
00039
00040 public:
00062 enum LegendDisplayPolicy
00063 {
00064 None = 0,
00065 Fixed = 1,
00066 Auto = 2
00067 };
00068
00069 enum LegendItemMode
00070 {
00071 ReadOnlyItem,
00072 ClickableItem,
00073 CheckableItem
00074 };
00075
00076 explicit QwtLegend(QWidget *parent = NULL);
00077 virtual ~QwtLegend();
00078
00079 void setDisplayPolicy(LegendDisplayPolicy policy, int mode = -1);
00080 LegendDisplayPolicy displayPolicy() const;
00081
00082 void setItemMode(LegendItemMode);
00083 LegendItemMode itemMode() const;
00084
00085 int identifierMode() const;
00086
00087 QWidget *contentsWidget();
00088 const QWidget *contentsWidget() const;
00089
00090 void insert(const QwtPlotItem *, QWidget *);
00091 void remove(const QwtPlotItem *);
00092
00093 QWidget *find(const QwtPlotItem *) const;
00094 QwtPlotItem *find(const QWidget *) const;
00095
00096 #if QT_VERSION < 0x040000
00097 virtual QValueList<QWidget *> legendItems() const;
00098 #else
00099 virtual QList<QWidget *> legendItems() const;
00100 #endif
00101
00102 void clear();
00103
00104 bool isEmpty() const;
00105 uint itemCount() const;
00106
00107 virtual bool eventFilter(QObject *, QEvent *);
00108
00109 virtual QSize sizeHint() const;
00110 virtual int heightForWidth(int w) const;
00111
00112 QScrollBar *horizontalScrollBar() const;
00113 QScrollBar *verticalScrollBar() const;
00114
00115 protected:
00116 virtual void resizeEvent(QResizeEvent *);
00117 virtual void layoutContents();
00118
00119 private:
00120 class PrivateData;
00121 PrivateData *d_data;
00122 };
00123
00124 #endif // QWT_LEGEND_H