| 1 | |
| 2 | /**************************************************************************** |
| 3 | ** |
| 4 | ** Copyright (C) 2011 Christian B. Huebschle & George M. Sheldrick |
| 5 | ** All rights reserved. |
| 6 | ** Contact: [email protected] |
| 7 | ** |
| 8 | ** This file is part of the ShelXle |
| 9 | ** |
| 10 | ** This file may be used under the terms of the GNU Lesser |
| 11 | ** General Public License version 2.1 as published by the Free Software |
| 12 | ** Foundation and appearing in the file COPYING included in the |
| 13 | ** packaging of this file. Please review the following information to |
| 14 | ** ensure the GNU Lesser General Public License version 2.1 requirements |
| 15 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
| 16 | ** |
| 17 | ** |
| 18 | ****************************************************************************/ |
| 19 | #ifndef PSEWIDGET_H |
| 20 | #define PSEWIDGET_H |
| 21 | |
| 22 | #include <QWidget> |
| 23 | #include <QSignalMapper> |
| 24 | #include <QDebug> |
| 25 | #include <QToolButton> |
| 26 | #include <QApplication> |
| 27 | #include "molecule.h" |
| 28 | #include "itsme.h" |
| 29 | /*! \brief PSEWidget is a widget that features a periodic table of the elements. |
| 30 | * |
| 31 | * The color scheme is given by the molecule class and the settings given there. |
| 32 | * |
| 33 | * The elements in the table can be clicked to select one of them. |
| 34 | */ |
| 35 | class PSEWidget : public QWidget |
| 36 | { |
| 37 | Q_OBJECT |
| 38 | public: |
| 39 | explicit PSEWidget(Molecule *_mol, QWidget *parent = 0); |
| 40 | int selection;//!< The curent selected element starting from zero which refers to Hydrogen |
| 41 | QSignalMapper* esm; |
| 42 | bool HisD; |
| 43 | signals: |
| 44 | void pseSelected(int index, bool HisD);//!< This signal is emitted when an element is clicked. |
| 45 | void Htransmutated(int, bool HisD); |
| 46 | public slots: |
| 47 | void selectPSE(int index){ |
| 48 | selection=index; |
| 49 | //printf("PSE %d %d\n", index, QApplication::keyboardModifiers () == Qt::ShiftModifier); |
| 50 | emit pseSelected(index,QApplication::keyboardModifiers () == Qt::ShiftModifier); |
| 51 | }//!< Change the current element by the program. |
| 52 | void incFontSize();//!< Increase the font size of the Elements by one point. |
| 53 | void decFontSize();//!< Decrease the font size of the Elements by one point. |
| 54 | void colorchange(QColor bgcolor); //! Assign a new color to the current element. |
| 55 | void probeShiftState(); |
| 56 | private: |
| 57 | int sz; |
| 58 | Molecule *mole; |
| 59 | QSettings *einstellung; |
| 60 | QToolButton *elebutt[109]; |
| 61 | QToolButton *lplus,*lminus; |
| 62 | }; |
| 63 | |
| 64 | #endif // PSEWIDGET_H |