[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 | #include "UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.hpp"
|
---|
| 23 |
|
---|
[ca1535] | 24 | #include "UIElements/Qt4/InstanceBoard/QtObservedMolecule.hpp"
|
---|
| 25 |
|
---|
[6d1e0a] | 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 | static const char *COLUMNNAMES[];
|
---|
| 44 |
|
---|
| 45 | /** Creates all QtMoleculeItem's that make up the row for a single molecule.
|
---|
| 46 | *
|
---|
[ca1535] | 47 | * \param _ObservedMolecule observed representation of the molecule
|
---|
[6d1e0a] | 48 | * \param _emitDirtyState callback function to model to inform about required state update
|
---|
| 49 | * \return list of prepared items to be appended to a group item
|
---|
| 50 | */
|
---|
| 51 | QList<QStandardItem *> createMoleculeItems(
|
---|
[ca1535] | 52 | QtObservedMolecule::ptr &_ObservedMolecule,
|
---|
| 53 | const QtMoleculeItem::emitDirtyState_t &_emitDirtyState);
|
---|
[bed759] | 54 |
|
---|
[6d1e0a] | 55 | /** Creates all QtMoleculeItem's that make up a row of a group item.
|
---|
| 56 | *
|
---|
| 57 | * \param _formula chemical formula which describes all molecules in this group
|
---|
| 58 | * \return list of prepared items to be appended to the invisibleRootItem()
|
---|
| 59 | */
|
---|
| 60 | QList<QStandardItem *> createGroupItems(const std::string &_formula);
|
---|
[bed759] | 61 | };
|
---|
| 62 |
|
---|
| 63 |
|
---|
| 64 | #endif /* QTMOLECULEITEMFACTORY_HPP_ */
|
---|