diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | ce599e4f9f94b4eb00c1b5edb85bce5431ab3df2 (patch) | |
tree | d3bb9f5d25a2dc09ca81adecf39621d871534297 /kalzium/src/elementdataviewer.h | |
download | tdeedu-ce599e4f9f94b4eb00c1b5edb85bce5431ab3df2.tar.gz tdeedu-ce599e4f9f94b4eb00c1b5edb85bce5431ab3df2.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kalzium/src/elementdataviewer.h')
-rw-r--r-- | kalzium/src/elementdataviewer.h | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/kalzium/src/elementdataviewer.h b/kalzium/src/elementdataviewer.h new file mode 100644 index 00000000..4414377c --- /dev/null +++ b/kalzium/src/elementdataviewer.h @@ -0,0 +1,147 @@ +#ifndef ELEMENTDATAVIEWER_H +#define ELEMENTDATAVIEWER_H +/*************************************************************************** + copyright : (C) 2004, 2005 by Carsten Niehaus + email : cniehaus@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <kdialogbase.h> + +typedef QValueList<double> DoubleList; + +class Element; +class KalziumDataObject; +class PlotSetupWidget; +class PlotWidget; +class KActionCollection; + +/** + * @short the values of the y-Axis + * @author Carsten Niehaus + */ +class AxisData +{ + friend class ElementDataViewer; + + public: + AxisData(); + + /** + * sets the dataList to @p list + */ + void setDataList( DoubleList list ){ + dataList = list; + } + + /** + * @return the value of the selected dataset of element @p element + */ + double value( int element ){ + return *dataList.at( element-1 ); + } + + /** + * This represents the possible datasets. + * @li MASS: the mass of the element + * @li MELTINGPOINT: the meanmass of the element + */ + enum PAXISDATA{ + MASS=0, + MEANWEIGHT, + DENSITY, + EN, + MELTINGPOINT, + BOILINGPOINT, + ATOMICRADIUS, + COVALENTRADIUS + }; + + /** + * @return the currently selected data type + * @see AxisData::PAXISDATA + */ + int currentDataType(){ + return m_currentDataType; + } + + int numberOfElements() const{ + return dataList.count(); + } + + private: + /** + * the dataList contains the values off all elements + * but only of the currently selected data type. This + * means that it eg contains all boiling points + */ + DoubleList dataList; + + int m_currentDataType; +}; + +/** + * @short This widget shows the plot and the widget + * where you can setup the plot + * @author Carsten Niehaus + */ +class ElementDataViewer : public KDialogBase +{ + Q_OBJECT + + public: + ElementDataViewer( QWidget *parent=0 , const char *name =0 ); + + /** + * the AxixData for the y-Axis + */ + AxisData *yData; + + public slots: + void slotZoomIn(); + void slotZoomOut(); + + /** + * draws the plot + */ + void drawPlot(); + + void slotUser1(); + + protected: + virtual void paintEvent(QPaintEvent*); + virtual void keyPressEvent(QKeyEvent *e); + + protected slots: + /** + * invoke the help of the correct chapter + */ + virtual void slotHelp(); + + private: + PlotWidget *m_pPlotWidget; + PlotSetupWidget *m_pPlotSetupWidget; + + KalziumDataObject *d; + + QStringList names; + + KActionCollection* m_actionCollection; + + void initData(); + void setupAxisData(); + + void setLimits(int, int); + +}; + +#endif // ELEMENTDATAVIEWER_H + |