/* * QtMoleculeItem_name.hpp * * Created on: Jan 18, 2015 * Author: heber */ #ifndef QTMOLECULEITEM_NAME_HPP_ #define QTMOLECULEITEM_NAME_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.hpp" class QtMoleculeItemFactory; /** This class contains the name of a molecule and keeps it up to date. * */ class QtMoleculeItem_name : public QtMoleculeItem { //!> only allow factory to instantiate items friend class QtMoleculeItemFactory; QtMoleculeItem_name( QtObservedMolecule::ptr &_ObservedMolecule) : id(_ObservedMolecule->getIndex()) { // cannot call pure virtual function in QtMoleculeItem's cstor updateState(_ObservedMolecule); } /** Performs the update of the molecule's name. * * \param _ObservedMolecule object to update state from */ void updateState(const QtObservedMolecule::ptr &_ObservedMolecule) { setText(QString(_ObservedMolecule->getMolName().c_str())); } QtMoleculeItem::COLUMNTYPES getType() const { return QtMoleculeItem::NAME; } /** Getter for the id of the observed molecule for this item. * * \return id of the observed molecule */ ObservedValue_Index_t getMoleculeIndex() const { return id; } private: const ObservedValue_Index_t id; }; #endif /* QTMOLECULEITEM_NAME_HPP_ */