Qwt User's Guide 5.2.2

qwt_legend.h

00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * Qwt Widget Library
00003  * Copyright (C) 1997   Josef Wilgen
00004  * Copyright (C) 2002   Uwe Rathmann
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the Qwt License, Version 1.0
00008  *****************************************************************************/
00009 
00010 // vim: expandtab
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 QwtLegendItemManager;
00025 
00036 class QWT_EXPORT QwtLegend : public QFrame
00037 {
00038     Q_OBJECT
00039 
00040 public:
00062     enum LegendDisplayPolicy
00063     {
00064         NoIdentifier = 0,
00065         FixedIdentifier = 1,
00066         AutoIdentifier = 2
00067     };
00068 
00087     enum LegendItemMode
00088     {
00089         ReadOnlyItem,
00090         ClickableItem,
00091         CheckableItem
00092     };
00093 
00094     explicit QwtLegend(QWidget *parent = NULL);
00095     virtual ~QwtLegend();
00096     
00097     void setDisplayPolicy(LegendDisplayPolicy policy, int mode);
00098     LegendDisplayPolicy displayPolicy() const;
00099 
00100     void setItemMode(LegendItemMode);
00101     LegendItemMode itemMode() const;
00102 
00103     int identifierMode() const;
00104 
00105     QWidget *contentsWidget();
00106     const QWidget *contentsWidget() const;
00107 
00108     void insert(const QwtLegendItemManager *, QWidget *);
00109     void remove(const QwtLegendItemManager *);
00110 
00111     QWidget *find(const QwtLegendItemManager *) const;
00112     QwtLegendItemManager *find(const QWidget *) const;
00113 
00114 #if QT_VERSION < 0x040000
00115     virtual QValueList<QWidget *> legendItems() const;
00116 #else
00117     virtual QList<QWidget *> legendItems() const;
00118 #endif
00119 
00120     void clear();
00121     
00122     bool isEmpty() const;
00123     uint itemCount() const;
00124 
00125     virtual bool eventFilter(QObject *, QEvent *);
00126 
00127     virtual QSize sizeHint() const;
00128     virtual int heightForWidth(int w) const;
00129 
00130     QScrollBar *horizontalScrollBar() const;
00131     QScrollBar *verticalScrollBar() const;
00132 
00133 protected:
00134     virtual void resizeEvent(QResizeEvent *);
00135     virtual void layoutContents();
00136 
00137 private:
00138     class PrivateData;
00139     PrivateData *d_data;
00140 };
00141 
00142 #endif // QWT_LEGEND_H