Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

qwt_legend_item.h

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 // vim: expandtab
00011 
00012 #ifndef QWT_LEGEND_ITEM_H
00013 #define QWT_LEGEND_ITEM_H
00014 
00015 #include "qwt_global.h"
00016 #include "qwt_legend.h"
00017 #include <qlabel.h>
00018 
00019 class QPainter;
00020 class QPen;
00021 class QwtText;
00022 class QwtSymbol;
00023 
00035 class QWT_EXPORT QwtLegendItem: public QLabel
00036 {
00037     Q_OBJECT
00038 public:
00039     
00047     enum IdentifierMode
00048     {
00049         NoIdentifier = 0,
00050         ShowLine = 1,
00051         ShowSymbol = 2,
00052         ShowText = 4
00053     };
00054 
00055     explicit QwtLegendItem(QWidget *parent = 0);
00056     explicit QwtLegendItem(const QwtSymbol &, const QPen &,
00057         const QString &, QWidget *parent = 0);
00058     virtual ~QwtLegendItem();
00059 
00060     void setItemMode(QwtLegend::LegendItemMode);
00061     QwtLegend::LegendItemMode itemMode() const;
00062 
00063     virtual void setTitle(const QString &);
00064     virtual QString title() const;
00065 
00066     void setIdentifierMode(int);
00067     int identifierMode() const;
00068 
00069     void setSymbol(const QwtSymbol &);
00070     const QwtSymbol& symbol() const;
00071 
00072     void setCurvePen(const QPen &);
00073     const QPen& curvePen() const;
00074 
00075     virtual void drawIdentifier(QPainter *, const QRect &) const;
00076     virtual void drawItem(QPainter *p, const QRect &) const; 
00077 
00078     virtual QSize sizeHint() const;
00079 
00080     bool isChecked() const;
00081 
00082 public slots:
00083     void setChecked(bool on);
00084 
00085 signals:
00086     void clicked();
00087     void pressed();
00088     void released();
00089     void checked(bool);
00090 
00091 protected:
00092     void setDown(bool);
00093     bool isDown() const;
00094 
00095     virtual QwtText *titleText() const;
00096 
00097     virtual void paintEvent(QPaintEvent *);
00098     virtual void mousePressEvent(QMouseEvent *);
00099     virtual void mouseReleaseEvent(QMouseEvent *);
00100     virtual void keyPressEvent(QKeyEvent *);
00101     virtual void keyReleaseEvent(QKeyEvent *);
00102 
00103 private:
00104     void init();
00105 
00106     class PrivateData;
00107     PrivateData *d_data;
00108 };
00109 
00110 #endif // QWT_LEGEND_ITEM_H

Generated on Wed Aug 31 23:02:29 2005 for Qwt User's Guide by  doxygen 1.4.1