[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_LEGEND_LABEL_H
|
---|
| 11 | #define QWT_LEGEND_LABEL_H
|
---|
| 12 |
|
---|
| 13 | #include "qwt_global.h"
|
---|
| 14 | #include "qwt_legend_data.h"
|
---|
| 15 | #include "qwt_text.h"
|
---|
| 16 | #include "qwt_text_label.h"
|
---|
| 17 | #include <qpixmap.h>
|
---|
| 18 |
|
---|
| 19 | class QwtLegendData;
|
---|
| 20 |
|
---|
| 21 | /*!
|
---|
| 22 | \brief A widget representing something on a QwtLegend.
|
---|
| 23 | */
|
---|
| 24 | class QWT_EXPORT QwtLegendLabel: public QwtTextLabel
|
---|
| 25 | {
|
---|
| 26 | Q_OBJECT
|
---|
| 27 | public:
|
---|
| 28 | explicit QwtLegendLabel( QWidget *parent = 0 );
|
---|
| 29 | virtual ~QwtLegendLabel();
|
---|
| 30 |
|
---|
| 31 | void setData( const QwtLegendData & );
|
---|
| 32 | const QwtLegendData &data() const;
|
---|
| 33 |
|
---|
| 34 | void setItemMode( QwtLegendData::Mode );
|
---|
| 35 | QwtLegendData::Mode itemMode() const;
|
---|
| 36 |
|
---|
| 37 | void setSpacing( int spacing );
|
---|
| 38 | int spacing() const;
|
---|
| 39 |
|
---|
| 40 | virtual void setText( const QwtText & );
|
---|
| 41 |
|
---|
| 42 | void setIcon( const QPixmap & );
|
---|
| 43 | QPixmap icon() const;
|
---|
| 44 |
|
---|
| 45 | virtual QSize sizeHint() const;
|
---|
| 46 |
|
---|
| 47 | bool isChecked() const;
|
---|
| 48 |
|
---|
| 49 | public Q_SLOTS:
|
---|
| 50 | void setChecked( bool on );
|
---|
| 51 |
|
---|
| 52 | Q_SIGNALS:
|
---|
| 53 | //! Signal, when the legend item has been clicked
|
---|
| 54 | void clicked();
|
---|
| 55 |
|
---|
| 56 | //! Signal, when the legend item has been pressed
|
---|
| 57 | void pressed();
|
---|
| 58 |
|
---|
| 59 | //! Signal, when the legend item has been released
|
---|
| 60 | void released();
|
---|
| 61 |
|
---|
| 62 | //! Signal, when the legend item has been toggled
|
---|
| 63 | void checked( bool );
|
---|
| 64 |
|
---|
| 65 | protected:
|
---|
| 66 | void setDown( bool );
|
---|
| 67 | bool isDown() const;
|
---|
| 68 |
|
---|
| 69 | virtual void paintEvent( QPaintEvent * );
|
---|
| 70 | virtual void mousePressEvent( QMouseEvent * );
|
---|
| 71 | virtual void mouseReleaseEvent( QMouseEvent * );
|
---|
| 72 | virtual void keyPressEvent( QKeyEvent * );
|
---|
| 73 | virtual void keyReleaseEvent( QKeyEvent * );
|
---|
| 74 |
|
---|
| 75 | private:
|
---|
| 76 | class PrivateData;
|
---|
| 77 | PrivateData *d_data;
|
---|
| 78 | };
|
---|
| 79 |
|
---|
| 80 | #endif
|
---|