Qwt User's Guide
|
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 #ifndef QWT_LEGEND_H 00011 #define QWT_LEGEND_H 00012 00013 #include "qwt_global.h" 00014 #include "qwt_abstract_legend.h" 00015 #include <qvariant.h> 00016 00017 class QScrollBar; 00018 00029 class QWT_EXPORT QwtLegend : public QwtAbstractLegend 00030 { 00031 Q_OBJECT 00032 00033 public: 00034 explicit QwtLegend( QWidget *parent = NULL ); 00035 virtual ~QwtLegend(); 00036 00037 void setMaxColumns( uint numColums ); 00038 uint maxColumns() const; 00039 00040 void setDefaultItemMode( QwtLegendData::Mode ); 00041 QwtLegendData::Mode defaultItemMode() const; 00042 00043 QWidget *contentsWidget(); 00044 const QWidget *contentsWidget() const; 00045 00046 QWidget *legendWidget( const QVariant & ) const; 00047 QList<QWidget *> legendWidgets( const QVariant & ) const; 00048 00049 QVariant itemInfo( const QWidget * ) const; 00050 00051 virtual bool eventFilter( QObject *, QEvent * ); 00052 00053 virtual QSize sizeHint() const; 00054 virtual int heightForWidth( int w ) const; 00055 00056 QScrollBar *horizontalScrollBar() const; 00057 QScrollBar *verticalScrollBar() const; 00058 00059 virtual void renderLegend( QPainter *, 00060 const QRectF &, bool fillBackground ) const; 00061 00062 virtual void renderItem( QPainter *, 00063 const QWidget *, const QRectF &, bool fillBackground ) const; 00064 00065 virtual bool isEmpty() const; 00066 virtual int scrollExtent( Qt::Orientation ) const; 00067 00068 Q_SIGNALS: 00081 void clicked( const QVariant &itemInfo, int index ); 00082 00096 void checked( const QVariant &itemInfo, bool on, int index ); 00097 00098 public Q_SLOTS: 00099 virtual void updateLegend( const QVariant &, 00100 const QList<QwtLegendData> & ); 00101 00102 protected Q_SLOTS: 00103 void itemClicked(); 00104 void itemChecked( bool ); 00105 00106 protected: 00107 virtual QWidget *createWidget( const QwtLegendData & ) const; 00108 virtual void updateWidget( QWidget *widget, const QwtLegendData &data ); 00109 00110 private: 00111 void updateTabOrder(); 00112 00113 class PrivateData; 00114 PrivateData *d_data; 00115 }; 00116 00117 #endif