1 | /*
|
---|
2 | * QtMoleculeList.hpp
|
---|
3 | *
|
---|
4 | * Created on: Jan 21, 2010
|
---|
5 | * Author: crueger
|
---|
6 | */
|
---|
7 |
|
---|
8 | #ifndef QTMOLECULELIST_HPP_
|
---|
9 | #define QTMOLECULELIST_HPP_
|
---|
10 |
|
---|
11 | // include config.h
|
---|
12 | #ifdef HAVE_CONFIG_H
|
---|
13 | #include <config.h>
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | #include <QtGui/QTreeWidget>
|
---|
17 |
|
---|
18 | #include <map>
|
---|
19 | #include <string>
|
---|
20 |
|
---|
21 | #include "CodePatterns/Observer/Observer.hpp"
|
---|
22 |
|
---|
23 | #include "types.hpp"
|
---|
24 |
|
---|
25 | class molecule;
|
---|
26 | class MoleculeListClass;
|
---|
27 |
|
---|
28 | class QtMoleculeList : public QTreeWidget, public Observer
|
---|
29 | {
|
---|
30 | Q_OBJECT
|
---|
31 |
|
---|
32 | public:
|
---|
33 | QtMoleculeList(QWidget * _parent=0);
|
---|
34 | virtual ~QtMoleculeList();
|
---|
35 |
|
---|
36 | protected:
|
---|
37 | virtual void update(Observable *publisher);
|
---|
38 | virtual void recieveNotification(Observable *publisher, Notification_ptr notification);
|
---|
39 | virtual void subjectKilled(Observable *publisher);
|
---|
40 | virtual void paintEvent(QPaintEvent * event);
|
---|
41 | void refill();
|
---|
42 |
|
---|
43 | static const int COLUMNCOUNT;
|
---|
44 | enum {NAME,VISIBILITY,ATOMCOUNT,FORMULA,OCCURRENCE,COLUMNTYPES_MAX} COLUMNTYPES;
|
---|
45 | static const char *COLUMNNAMES[];
|
---|
46 |
|
---|
47 | private slots:
|
---|
48 | void moleculeChanged();
|
---|
49 | void visibilityChanged(QTreeWidgetItem*, int);
|
---|
50 |
|
---|
51 | void rowsSelected(const QItemSelection & selected, const QItemSelection & deselected);
|
---|
52 |
|
---|
53 | signals:
|
---|
54 | void moleculeSelected(molecule*);
|
---|
55 | void moleculeUnSelected(molecule*);
|
---|
56 | void moleculesVisibilityChanged(const moleculeId_t, bool);
|
---|
57 |
|
---|
58 | private:
|
---|
59 | bool dirty;
|
---|
60 | bool clearing;
|
---|
61 | bool selecting;
|
---|
62 | bool ChangingChildrensVisibility;
|
---|
63 |
|
---|
64 | typedef std::map<std::string, unsigned int> FormulaVisibilityCountMap_t;
|
---|
65 | FormulaVisibilityCountMap_t FormulaVisibilityCountMap;
|
---|
66 |
|
---|
67 | typedef std::map<std::string, QTreeWidgetItem*> FormulaTreeItemMap_t;
|
---|
68 | //!> map of (unique) formulas in the world
|
---|
69 | FormulaTreeItemMap_t formula;
|
---|
70 | };
|
---|
71 |
|
---|
72 | #endif /* QTMOLECULELIST_HPP_ */
|
---|