| 1 | /*
|
|---|
| 2 | * QtMoleculeItem_visibility.hpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: Jan 18, 2015
|
|---|
| 5 | * Author: heber
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #ifndef QTMOLECULEITEM_VISIBILITY_HPP_
|
|---|
| 9 | #define QTMOLECULEITEM_VISIBILITY_HPP_
|
|---|
| 10 |
|
|---|
| 11 | // include config.h
|
|---|
| 12 | #ifdef HAVE_CONFIG_H
|
|---|
| 13 | #include <config.h>
|
|---|
| 14 | #endif
|
|---|
| 15 |
|
|---|
| 16 | #include "UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.hpp"
|
|---|
| 17 |
|
|---|
| 18 | class QtMoleculeItemFactory;
|
|---|
| 19 |
|
|---|
| 20 | /** This class contains the visibility of a molecule and keeps it up to date.
|
|---|
| 21 | *
|
|---|
| 22 | */
|
|---|
| 23 | class QtMoleculeItem_visibility : public QtMoleculeItem
|
|---|
| 24 | {
|
|---|
| 25 | //!> only allow factory to instantiate items
|
|---|
| 26 | friend class QtMoleculeItemFactory;
|
|---|
| 27 |
|
|---|
| 28 | QtMoleculeItem_visibility(
|
|---|
| 29 | QtObservedMolecule::ptr &_ObservedMolecule) :
|
|---|
| 30 | id(_ObservedMolecule->getIndex())
|
|---|
| 31 | {
|
|---|
| 32 | setFlags(flags() | Qt::ItemIsUserCheckable);
|
|---|
| 33 | setCheckState(Qt::Unchecked);
|
|---|
| 34 | // cannot call pure virtual function in QtMoleculeItem's cstor
|
|---|
| 35 | updateState(_ObservedMolecule);
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | /** Performs the update of the molecule's visibility.
|
|---|
| 39 | *
|
|---|
| 40 | * \param _ObservedMolecule object to update state from
|
|---|
| 41 | */
|
|---|
| 42 | void updateState(const QtObservedMolecule::ptr &_ObservedMolecule)
|
|---|
| 43 | {}
|
|---|
| 44 |
|
|---|
| 45 | QtMoleculeItem::COLUMNTYPES getType() const
|
|---|
| 46 | { return QtMoleculeItem::VISIBILITY; }
|
|---|
| 47 |
|
|---|
| 48 | /** Getter for the id of the observed molecule for this item.
|
|---|
| 49 | *
|
|---|
| 50 | * \return id of the observed molecule
|
|---|
| 51 | */
|
|---|
| 52 | ObservedValue_Index_t getMoleculeIndex() const
|
|---|
| 53 | { return id; }
|
|---|
| 54 |
|
|---|
| 55 | private:
|
|---|
| 56 | const ObservedValue_Index_t id;
|
|---|
| 57 | };
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 | #endif /* QTMOLECULEITEM_VISIBILITY_HPP_ */
|
|---|