libavogadro/src/filetreeitem.h

00001 /**********************************************************************
00002   FileTreeItem - general tree model item for files
00003 
00004   Copyright (C) 2008 Geoffrey R. Hutchison
00005 
00006   Inspired by example code from Qt/Examples by Trolltech.
00007 
00008   This file is part of the Avogadro molecular editor project.
00009   For more information, see <http://avogadro.openmolecules.net/>
00010 
00011   Avogadro is free software; you can redistribute it and/or modify
00012   it under the terms of the GNU General Public License as published by
00013   the Free Software Foundation; either version 2 of the License, or
00014   (at your option) any later version.
00015 
00016   Avogadro is distributed in the hope that it will be useful,
00017   but WITHOUT ANY WARRANTY; without even the implied warranty of
00018   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019   GNU General Public License for more details.
00020 
00021   You should have received a copy of the GNU General Public License
00022   along with this program; if not, write to the Free Software
00023   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00024   02110-1301, USA.
00025  **********************************************************************/
00026 
00027 #ifndef FILETREEITEM_H
00028 #define FILETREEITEM_H
00029 
00030 #include <QList>
00031 #include <QVariant>
00032 #include <QString>
00033 #include <avogadro/global.h>
00034 
00035 namespace Avogadro {
00036 
00050   class A_EXPORT FileTreeItem
00051   {
00052     public:
00053       explicit FileTreeItem(const QList<QVariant> &data, FileTreeItem *parent = 0, QString path = "");
00054       ~FileTreeItem();
00055 
00056       void appendChild(FileTreeItem *child);
00057       void deleteChildren();
00058 
00059       FileTreeItem *child(int row);
00060       int childCount() const;
00061       int columnCount() const;
00062       QVariant data(int column) const;
00063       int row() const;
00064       FileTreeItem *parent();
00065 
00066       void setFilePath(QString path);
00067       QString filePath() const;
00068 
00069     private:
00070       QList<FileTreeItem*> childItems;
00071       QList<QVariant> itemData;
00072       FileTreeItem *parentItem;
00073 
00074       QString _filePath;                 
00075   };
00076 
00077 }
00078 
00079 #endif

Generated on Sun Jun 14 02:00:42 2009 for Avogadro by  doxygen 1.5.4