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 "qwt_text.h"
00018 #include "qwt_text_label.h"
00019 
00020 class QPainter;
00021 class QPen;
00022 class QwtSymbol;
00023 
00035 class QWT_EXPORT QwtLegendItem: public QwtTextLabel
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 QwtText &, QWidget *parent = 0);
00058     virtual ~QwtLegendItem();
00059 
00060     virtual void setText(const QwtText &);
00061 
00062     void setItemMode(QwtLegend::LegendItemMode);
00063     QwtLegend::LegendItemMode itemMode() const;
00064 
00065     void setIdentifierMode(int);
00066     int identifierMode() const;
00067 
00068     void setSymbol(const QwtSymbol &);
00069     const QwtSymbol& symbol() const;
00070 
00071     void setCurvePen(const QPen &);
00072     const QPen& curvePen() const;
00073 
00074     virtual void drawIdentifier(QPainter *, const QRect &) const;
00075     virtual void drawItem(QPainter *p, const QRect &) const; 
00076 
00077     virtual QSize sizeHint() const;
00078 
00079     bool isChecked() const;
00080 
00081 public slots:
00082     void setChecked(bool on);
00083 
00084 signals:
00085     void clicked();
00086     void pressed();
00087     void released();
00088     void checked(bool);
00089 
00090 protected:
00091     void setDown(bool);
00092     bool isDown() const;
00093 
00094     virtual void paintEvent(QPaintEvent *);
00095     virtual void mousePressEvent(QMouseEvent *);
00096     virtual void mouseReleaseEvent(QMouseEvent *);
00097     virtual void keyPressEvent(QKeyEvent *);
00098     virtual void keyReleaseEvent(QKeyEvent *);
00099 
00100     virtual void drawText(QPainter *, const QRect &);
00101 
00102 private:
00103     void init(const QwtText &);
00104 
00105     class PrivateData;
00106     PrivateData *d_data;
00107 };
00108 
00109 #endif // QWT_LEGEND_ITEM_H

Generated on Mon Jan 30 22:16:25 2006 for Qwt User's Guide by  doxygen 1.4.4