| 1 | /*
 | 
|---|
| 2 |  * MoleculeView.hpp
 | 
|---|
| 3 |  *
 | 
|---|
| 4 |  *  Created on: Mar 4, 2010
 | 
|---|
| 5 |  *      Author: crueger
 | 
|---|
| 6 |  */
 | 
|---|
| 7 | 
 | 
|---|
| 8 | #ifndef MOLECULEVIEW_HPP_
 | 
|---|
| 9 | #define MOLECULEVIEW_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 "CodePatterns/Observer/Observer.hpp"
 | 
|---|
| 20 | 
 | 
|---|
| 21 | class molecule;
 | 
|---|
| 22 | 
 | 
|---|
| 23 | // Forwarding of the Tab-Pages
 | 
|---|
| 24 | class QTAllMoleculePage;
 | 
|---|
| 25 | class QTMoleculePage;
 | 
|---|
| 26 | 
 | 
|---|
| 27 | class QtMoleculeView : public QTabWidget
 | 
|---|
| 28 | {
 | 
|---|
| 29 |   Q_OBJECT
 | 
|---|
| 30 | public:
 | 
|---|
| 31 |   QtMoleculeView();
 | 
|---|
| 32 |   virtual ~QtMoleculeView();
 | 
|---|
| 33 | 
 | 
|---|
| 34 | public slots:
 | 
|---|
| 35 |   void moleculeSelected(molecule *);
 | 
|---|
| 36 |   void moleculeUnSelected(molecule *);
 | 
|---|
| 37 | 
 | 
|---|
| 38 |   void nameChanged(QTMoleculePage *page, std::string name);
 | 
|---|
| 39 | 
 | 
|---|
| 40 | signals:
 | 
|---|
| 41 |   void addMolecule(molecule *);
 | 
|---|
| 42 |   void removeMolecule(molecule *);
 | 
|---|
| 43 | 
 | 
|---|
| 44 | 
 | 
|---|
| 45 | private:
 | 
|---|
| 46 |   QTAllMoleculePage *allPage; //!< contained widget to cary information of all selected molecules
 | 
|---|
| 47 |   std::map<molecule*,QTMoleculePage *> pages;//!< contained widget to cary information on a specific molecule
 | 
|---|
| 48 | };
 | 
|---|
| 49 | 
 | 
|---|
| 50 | /**
 | 
|---|
| 51 |  * Widget to display the tab page for all selected molecules
 | 
|---|
| 52 |  */
 | 
|---|
| 53 | class QTAllMoleculePage : public QWidget, public Observer {
 | 
|---|
| 54 |   Q_OBJECT
 | 
|---|
| 55 | public:
 | 
|---|
| 56 |   QTAllMoleculePage();
 | 
|---|
| 57 |   void update(Observable *subject);
 | 
|---|
| 58 |   void subjectKilled(Observable *subject);
 | 
|---|
| 59 | public slots:
 | 
|---|
| 60 |   void addMolecule(molecule *mol);
 | 
|---|
| 61 |   void removeMolecule(molecule *mol);
 | 
|---|
| 62 | };
 | 
|---|
| 63 | 
 | 
|---|
| 64 | /**
 | 
|---|
| 65 |  * Widget to display the tab page for a single molecule
 | 
|---|
| 66 |  */
 | 
|---|
| 67 | class QTMoleculePage : public QWidget,  public Observer {
 | 
|---|
| 68 |   Q_OBJECT
 | 
|---|
| 69 | public:
 | 
|---|
| 70 |   QTMoleculePage(molecule *_mol,std::string _name);
 | 
|---|
| 71 |   virtual ~QTMoleculePage();
 | 
|---|
| 72 | 
 | 
|---|
| 73 |   void update(Observable *subject);
 | 
|---|
| 74 |   void subjectKilled(Observable *subject);
 | 
|---|
| 75 | 
 | 
|---|
| 76 | signals:
 | 
|---|
| 77 |   void nameChanged(QTMoleculePage*,std::string);
 | 
|---|
| 78 | 
 | 
|---|
| 79 | private:
 | 
|---|
| 80 |   molecule *mol;
 | 
|---|
| 81 |   std::string name;
 | 
|---|
| 82 | };
 | 
|---|
| 83 | #endif /* MOLECULEVIEW_HPP_ */
 | 
|---|