00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef __TOPIECHART_H
00036 #define __TOPIECHART_H
00037
00038 #include <list>
00039 #include <qwidget.h>
00040
00041 class QPopupMenu;
00042
00045 class toPieChart : public QWidget {
00046 Q_OBJECT
00047
00048 std::list<double> Values;
00049 std::list<QString> Labels;
00050 QString Postfix;
00051 bool Legend;
00052 bool DisplayPercent;
00053 QString Title;
00054 QPopupMenu *Menu;
00055
00056 protected:
00057 virtual void mouseDoubleClickEvent(QMouseEvent *e);
00058 virtual void mousePressEvent(QMouseEvent *e);
00059 public:
00065 toPieChart(QWidget *parent=NULL,const char *name=NULL,WFlags f=0);
00066
00073 toPieChart(toPieChart *pie,QWidget *parent=NULL,const char *name=NULL,WFlags f=0);
00074
00080 void setPostfix(const QString &post)
00081 { Postfix=post; update(); }
00085 const QString &postfix(void) const
00086 { return Postfix; }
00087
00091 void setTitle(const QString &title=QString::null)
00092 { Title=title; update(); }
00096 const QString &title(void)
00097 { return Title; }
00098
00102 void setDisplayPercent(bool pct)
00103 { DisplayPercent=pct; update(); }
00107 bool displayPercent(void) const
00108 { return DisplayPercent; }
00109
00113 void showLegend(bool on)
00114 { Legend=on; update(); }
00118 bool legend(void) const
00119 { return Legend; }
00120
00125 void setValues(std::list<double> &values,std::list<QString> &labels)
00126 { Values=values; Labels=labels; update(); }
00131 void addValue(double value,const QString &label)
00132 { Values.insert(Values.end(),value); Labels.insert(Labels.end(),label); update(); }
00136 std::list<double> &values(void)
00137 { return Values; }
00141 std::list<QString> &labels(void)
00142 { return Labels; }
00143
00144 public slots:
00147 void editPrint(void);
00150 void openCopy(void);
00151 protected:
00154 virtual void paintChart(QPainter *p,QRect rect);
00157 virtual void paintEvent(QPaintEvent *e);
00158 };
00159
00160 #endif