[bed759] | 1 | /*
|
---|
| 2 | * QtMoleculeItemFactory.hpp
|
---|
| 3 | *
|
---|
| 4 | * Created on: Jan 18, 2015
|
---|
| 5 | * Author: heber
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #ifndef QTMOLECULEITEMFACTORY_HPP_
|
---|
| 9 | #define QTMOLECULEITEMFACTORY_HPP_
|
---|
| 10 |
|
---|
| 11 | // include config.h
|
---|
| 12 | #ifdef HAVE_CONFIG_H
|
---|
| 13 | #include <config.h>
|
---|
| 14 | #endif
|
---|
| 15 |
|
---|
[6d1e0a] | 16 | #include "CodePatterns/Singleton.hpp"
|
---|
| 17 |
|
---|
| 18 | #include <QList>
|
---|
| 19 |
|
---|
| 20 | #include <string>
|
---|
| 21 |
|
---|
| 22 | class molecule;
|
---|
| 23 |
|
---|
| 24 | #include "UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.hpp"
|
---|
| 25 |
|
---|
| 26 | /** This class is a factory for a list of QtMoleculeItem's.
|
---|
| 27 | *
|
---|
| 28 | * QtMoleculeList contains these per row, either a group item which combines
|
---|
| 29 | * molecules of the same formula, or a molecule item which represents a single
|
---|
| 30 | * molecule.
|
---|
| 31 | */
|
---|
| 32 | class QtMoleculeItemFactory : public Singleton<QtMoleculeItemFactory>
|
---|
[bed759] | 33 | {
|
---|
[6d1e0a] | 34 | //!> grant Singleton access to cstor and dstor.
|
---|
| 35 | friend class Singleton<QtMoleculeItemFactory>;
|
---|
| 36 | private:
|
---|
| 37 | // private constructor and destructor due to singleton
|
---|
| 38 | QtMoleculeItemFactory();
|
---|
| 39 | virtual ~QtMoleculeItemFactory() {}
|
---|
| 40 |
|
---|
| 41 | public:
|
---|
| 42 | static const int COLUMNCOUNT;
|
---|
| 43 | enum {NAME,VISIBILITY,ATOMCOUNT,FORMULA,OCCURRENCE,COLUMNTYPES_MAX} COLUMNTYPES;
|
---|
| 44 | static const char *COLUMNNAMES[];
|
---|
| 45 |
|
---|
| 46 | /** Creates all QtMoleculeItem's that make up the row for a single molecule.
|
---|
| 47 | *
|
---|
| 48 | * \param _mol ref to molecule which is stored internally
|
---|
| 49 | * \param _emitDirtyState callback function to model to inform about required state update
|
---|
| 50 | * \return list of prepared items to be appended to a group item
|
---|
| 51 | */
|
---|
| 52 | QList<QStandardItem *> createMoleculeItems(
|
---|
[53c1ff] | 53 | const molecule * const _mol,
|
---|
[6d1e0a] | 54 | const QtMoleculeItem::emitDirtyState_t &_emitDirtyState);
|
---|
[bed759] | 55 |
|
---|
[6d1e0a] | 56 | /** Creates all QtMoleculeItem's that make up a row of a group item.
|
---|
| 57 | *
|
---|
| 58 | * \param _formula chemical formula which describes all molecules in this group
|
---|
| 59 | * \return list of prepared items to be appended to the invisibleRootItem()
|
---|
| 60 | */
|
---|
| 61 | QList<QStandardItem *> createGroupItems(const std::string &_formula);
|
---|
[bed759] | 62 | };
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 | #endif /* QTMOLECULEITEMFACTORY_HPP_ */
|
---|