| 1 | /* | 
|---|
| 2 | * MoleculeView.hpp | 
|---|
| 3 | * | 
|---|
| 4 | *  Created on: Mar 4, 2010 | 
|---|
| 5 | *      Author: crueger | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef QTINFOBOX_HPP_ | 
|---|
| 9 | #define QTINFOBOX_HPP_ | 
|---|
| 10 |  | 
|---|
| 11 | // include config.h | 
|---|
| 12 | #ifdef HAVE_CONFIG_H | 
|---|
| 13 | #include <config.h> | 
|---|
| 14 | #endif | 
|---|
| 15 |  | 
|---|
| 16 |  | 
|---|
| 17 | #include <string> | 
|---|
| 18 | #include <QtGui/QTabWidget> | 
|---|
| 19 | #include <QtGui/QTreeWidget> | 
|---|
| 20 | #include <QTimer> | 
|---|
| 21 |  | 
|---|
| 22 | #include "UIElements/Qt4/InstanceBoard/QtObservedAtom.hpp" | 
|---|
| 23 | #include "UIElements/Qt4/InstanceBoard/QtObservedMolecule.hpp" | 
|---|
| 24 |  | 
|---|
| 25 | #include <boost/thread/recursive_mutex.hpp> | 
|---|
| 26 |  | 
|---|
| 27 | #include "types.hpp" | 
|---|
| 28 |  | 
|---|
| 29 | class periodentafel; | 
|---|
| 30 |  | 
|---|
| 31 | // Forwarding of the Tab-Pages | 
|---|
| 32 | class QtAtomInfoPage; | 
|---|
| 33 | class QtMoleculeInfoPage; | 
|---|
| 34 |  | 
|---|
| 35 | class QtObservedInstanceBoard; | 
|---|
| 36 |  | 
|---|
| 37 | class QtInfoBox : public QTabWidget | 
|---|
| 38 | { | 
|---|
| 39 | Q_OBJECT | 
|---|
| 40 | public: | 
|---|
| 41 | QtInfoBox(QtObservedInstanceBoard *_board, QWidget *_parent = NULL); | 
|---|
| 42 | virtual ~QtInfoBox(); | 
|---|
| 43 |  | 
|---|
| 44 | void showAtom(const atomId_t _id); | 
|---|
| 45 | void showMolecule(const moleculeId_t _id); | 
|---|
| 46 |  | 
|---|
| 47 | public slots: | 
|---|
| 48 | void atomHover(const atomId_t _id); | 
|---|
| 49 | void moleculeHover(const moleculeId_t _id); | 
|---|
| 50 | void timerTimeout(); | 
|---|
| 51 |  | 
|---|
| 52 | void clearAtomTab(); | 
|---|
| 53 | void clearMoleculeTab(); | 
|---|
| 54 |  | 
|---|
| 55 | private: | 
|---|
| 56 | atomId_t curAtomId; | 
|---|
| 57 | atomId_t nextAtomId; | 
|---|
| 58 | moleculeId_t curMoleculeId; | 
|---|
| 59 | moleculeId_t nextMoleculeId; | 
|---|
| 60 | QtMoleculeInfoPage *page_mol; | 
|---|
| 61 | QtAtomInfoPage *page_atom; | 
|---|
| 62 |  | 
|---|
| 63 | mutable boost::recursive_mutex tabs_mutex; | 
|---|
| 64 |  | 
|---|
| 65 | QTimer *timer; | 
|---|
| 66 |  | 
|---|
| 67 | QtObservedInstanceBoard *board; | 
|---|
| 68 |  | 
|---|
| 69 | int currentPage; | 
|---|
| 70 |  | 
|---|
| 71 | periodentafel *periode; | 
|---|
| 72 | }; | 
|---|
| 73 |  | 
|---|
| 74 | /** | 
|---|
| 75 | * Widget to display the tab page for a single atom | 
|---|
| 76 | */ | 
|---|
| 77 | class QtAtomInfoPage : public QTreeWidget | 
|---|
| 78 | { | 
|---|
| 79 | Q_OBJECT | 
|---|
| 80 | public: | 
|---|
| 81 | QtAtomInfoPage(QtObservedAtom::ptr &_atom, periodentafel *_periode, QWidget *parent); | 
|---|
| 82 | virtual ~QtAtomInfoPage(); | 
|---|
| 83 |  | 
|---|
| 84 | QtObservedAtom::ptr getAtom() const | 
|---|
| 85 | { return atomRef; } | 
|---|
| 86 |  | 
|---|
| 87 | private slots: | 
|---|
| 88 | void updatePage(); | 
|---|
| 89 |  | 
|---|
| 90 | private: | 
|---|
| 91 | QtObservedAtom::ptr atomRef; | 
|---|
| 92 | periodentafel *periode; | 
|---|
| 93 | QTreeWidget *info; | 
|---|
| 94 | }; | 
|---|
| 95 |  | 
|---|
| 96 | /** | 
|---|
| 97 | * Widget to display the tab page for a single molecule | 
|---|
| 98 | */ | 
|---|
| 99 | class QtMoleculeInfoPage : public QTreeWidget | 
|---|
| 100 | { | 
|---|
| 101 | Q_OBJECT | 
|---|
| 102 | public: | 
|---|
| 103 | QtMoleculeInfoPage(QtObservedMolecule::ptr &_mol, QWidget *parent); | 
|---|
| 104 | virtual ~QtMoleculeInfoPage(); | 
|---|
| 105 |  | 
|---|
| 106 | QtObservedMolecule::ptr getMolecule() const | 
|---|
| 107 | { return mol; } | 
|---|
| 108 |  | 
|---|
| 109 | private slots: | 
|---|
| 110 | void updatePage(); | 
|---|
| 111 |  | 
|---|
| 112 | private: | 
|---|
| 113 | QtObservedMolecule::ptr mol; | 
|---|
| 114 | QTreeWidget *info; | 
|---|
| 115 | }; | 
|---|
| 116 | #endif /* QTINFOBOX_HPP_ */ | 
|---|