| [8127] | 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_ABSTRACT_LEGEND_H | 
|---|
|  | 11 | #define QWT_ABSTRACT_LEGEND_H | 
|---|
|  | 12 |  | 
|---|
|  | 13 | #include "qwt_global.h" | 
|---|
|  | 14 | #include "qwt_legend_data.h" | 
|---|
|  | 15 | #include <qframe.h> | 
|---|
|  | 16 | #include <qlist.h> | 
|---|
|  | 17 |  | 
|---|
|  | 18 | class QVariant; | 
|---|
|  | 19 |  | 
|---|
|  | 20 | /*! | 
|---|
|  | 21 | \brief Abstract base class for legend widgets | 
|---|
|  | 22 |  | 
|---|
|  | 23 | Legends, that need to be under control of the QwtPlot layout system | 
|---|
|  | 24 | need to be derived from QwtAbstractLegend. | 
|---|
|  | 25 |  | 
|---|
|  | 26 | \note Other type of legends can be implemented by connecting to | 
|---|
|  | 27 | the QwtPlot::legendDataChanged() signal. But as these legends | 
|---|
|  | 28 | are unknown to the plot layout system the layout code | 
|---|
|  | 29 | ( on screen and for QwtPlotRenderer ) need to be organized | 
|---|
|  | 30 | in application code. | 
|---|
|  | 31 |  | 
|---|
|  | 32 | \sa QwtLegend | 
|---|
|  | 33 | */ | 
|---|
|  | 34 | class QWT_EXPORT QwtAbstractLegend : public QFrame | 
|---|
|  | 35 | { | 
|---|
|  | 36 | Q_OBJECT | 
|---|
|  | 37 |  | 
|---|
|  | 38 | public: | 
|---|
|  | 39 | explicit QwtAbstractLegend( QWidget *parent = NULL ); | 
|---|
|  | 40 | virtual ~QwtAbstractLegend(); | 
|---|
|  | 41 |  | 
|---|
|  | 42 | /*! | 
|---|
|  | 43 | Render the legend into a given rectangle. | 
|---|
|  | 44 |  | 
|---|
|  | 45 | \param painter Painter | 
|---|
|  | 46 | \param rect Bounding rectangle | 
|---|
|  | 47 | \param fillBackground When true, fill rect with the widget background | 
|---|
|  | 48 |  | 
|---|
|  | 49 | \sa renderLegend() is used by QwtPlotRenderer | 
|---|
|  | 50 | */ | 
|---|
|  | 51 | virtual void renderLegend( QPainter *painter, | 
|---|
|  | 52 | const QRectF &rect, bool fillBackground ) const = 0; | 
|---|
|  | 53 |  | 
|---|
|  | 54 | //! \return True, when no plot item is inserted | 
|---|
|  | 55 | virtual bool isEmpty() const = 0; | 
|---|
|  | 56 |  | 
|---|
|  | 57 | virtual int scrollExtent( Qt::Orientation ) const; | 
|---|
|  | 58 |  | 
|---|
|  | 59 | public Q_SLOTS: | 
|---|
|  | 60 |  | 
|---|
|  | 61 | /*! | 
|---|
|  | 62 | \brief Update the entries for a plot item | 
|---|
|  | 63 |  | 
|---|
|  | 64 | \param itemInfo Info about an item | 
|---|
|  | 65 | \param data List of legend entry attributes for the  item | 
|---|
|  | 66 | */ | 
|---|
|  | 67 | virtual void updateLegend( const QVariant &itemInfo, | 
|---|
|  | 68 | const QList<QwtLegendData> &data ) = 0; | 
|---|
|  | 69 | }; | 
|---|
|  | 70 |  | 
|---|
|  | 71 | #endif | 
|---|