1 /* massXpert - the true massist's program. 2 -------------------------------------- 3 Copyright(C) 2006,2007 Filippo Rusconi 4 5 http://www.massxpert.org/massXpert 6 7 This file is part of the massXpert project. 8 9 The massxpert project is the successor to the "GNU polyxmass" 10 project that is an official GNU project package(see 11 www.gnu.org). The massXpert project is not endorsed by the GNU 12 project, although it is released ---in its entirety--- under the 13 GNU General Public License. A huge part of the code in massXpert 14 is actually a C++ rewrite of code in GNU polyxmass. As such 15 massXpert was started at the Centre National de la Recherche 16 Scientifique(FRANCE), that granted me the formal authorization to 17 publish it under this Free Software License. 18 19 This software is free software; you can redistribute it and/or 20 modify it under the terms of the GNU General Public 21 License version 3, as published by the Free Software Foundation. 22 23 24 This software is distributed in the hope that it will be useful, 25 but WITHOUT ANY WARRANTY; without even the implied warranty of 26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 General Public License for more details. 28 29 You should have received a copy of the GNU General Public License 30 along with this software; if not, write to the 31 32 Free Software Foundation, Inc., 33 34 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 35 */ 36 37 38 #ifndef COMPOSITION_TREEVIEW_ITEM_HPP 39 #define COMPOSITION_TREEVIEW_ITEM_HPP 40 41 42 /////////////////////// Qt includes 43 #include <QList> 44 #include <QVariant> 45 #include <QTreeView> 46 #include <QMainWindow> 47 48 49 /////////////////////// Local includes 50 #include "monomer.hpp" 51 52 53 namespace massXpert 54 { 55 56 enum 57 { 58 COMPOSITION_NAME_COLUMN, 59 COMPOSITION_CODE_COLUMN, 60 COMPOSITION_COUNT_COLUMN, 61 COMPOSITION_MODIF_COLUMN, 62 COMPOSITION_TOTAL_COLUMNS 63 }; 64 65 66 class CompositionTreeViewItem 67 { 68 private: 69 QList<CompositionTreeViewItem *> m_childItemsList; 70 QList<QVariant> m_itemData; 71 CompositionTreeViewItem *mp_parentItem; 72 Monomer *mp_monomer; 73 74 public: 75 CompositionTreeViewItem(const QList<QVariant> &data, 76 CompositionTreeViewItem *parent = 0); 77 78 ~CompositionTreeViewItem(); 79 80 CompositionTreeViewItem *parent(); 81 82 void appendChild(CompositionTreeViewItem *item); 83 void insertChild(int index, 84 CompositionTreeViewItem *item); 85 86 CompositionTreeViewItem *child(int row); 87 CompositionTreeViewItem *takeChild(int row); 88 const QList<CompositionTreeViewItem *> &childItems(); 89 90 int childCount() const; 91 int columnCount() const; 92 93 QVariant data(int column) const; 94 bool setData(int column, const QVariant & value); 95 96 int row() const; 97 98 void setMonomer(Monomer *); 99 Monomer *monomer(); 100 }; 101 102 } // namespace massXpert 103 104 105 #endif // COMPOSITION_TREEVIEW_ITEM_HPP 106