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