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