- Main Page
- Related Pages
- Classes
- Files

- File List

# 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 setIdentifierWidth(int width);
    00069     int identifierWidth() const;
    00070
    00071     void setSpacing(int spacing);
    00072     int spacing() const;
    00073
    00074     void setSymbol(const QwtSymbol &);
    00075     const QwtSymbol& symbol() const;
    00076
    00077     void setCurvePen(const QPen &);
    00078     const QPen& curvePen() const;
    00079
    00080     virtual void drawIdentifier(QPainter *, const QRect &) const;
    00081     virtual void drawItem(QPainter *p, const QRect &) const;
    00082
    00083     virtual QSize sizeHint() const;
    00084
    00085     bool isChecked() const;
    00086
    00087 public slots:
    00088     void setChecked(bool on);
    00089
    00090 signals:
    00092     void clicked();
    00093
    00095     void pressed();
    00096
    00098     void released();
    00099
    00101     void checked(bool);
    00102
    00103 protected:
    00104     void setDown(bool);
    00105     bool isDown() const;
    00106
    00107     virtual void paintEvent(QPaintEvent *);
    00108     virtual void mousePressEvent(QMouseEvent *);
    00109     virtual void mouseReleaseEvent(QMouseEvent *);
    00110     virtual void keyPressEvent(QKeyEvent *);
    00111     virtual void keyReleaseEvent(QKeyEvent *);
    00112
    00113     virtual void drawText(QPainter *, const QRect &);
    00114
    00115 private:
    00116     void init(const QwtText &);
    00117
    00118     class PrivateData;
    00119     PrivateData *d_data;
    00120 };
    00121
    00122 #endif // QWT_LEGEND_ITEM_H