some fixes to the cmake files. It still is not working
[kdeedu-porting.git] / kalzium / libavogadro-kalzium / src / primitiveitemmodel.h
blob239a81cfcdbe48fd4c0689be2a9ea20219a8aa21
1 /**********************************************************************
2 PrimitiveItemModel - Model for representing primitives.
4 Copyright (C) 2007 Donald Ephraim Curtis <dcurtis3@sourceforge.net>
6 This file is part of the Avogadro molecular editor project.
7 For more information, see <http://avogadro.sourceforge.net/>
9 Avogadro is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 Avogadro is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 02110-1301, USA.
23 **********************************************************************/
25 #ifndef __PRIMITIVEITEMMODEL_H
26 #define __PRIMITIVEITEMMODEL_H
28 #include <avogadro/global.h>
29 #include <avogadro/engine.h>
32 class QTreeView;
33 namespace Avogadro {
35 class PrimitiveItemModelPrivate;
36 class A_EXPORT PrimitiveItemModel : public QAbstractItemModel
38 Q_OBJECT
40 public:
41 enum Role {
42 PrimitiveRole = Qt::UserRole + 1,
43 PrimitiveTypeRole,
46 public:
47 explicit PrimitiveItemModel( Engine *engine, QObject *parent = 0 );
48 explicit PrimitiveItemModel( Molecule *molecule, QObject *parent = 0 );
50 QModelIndex parent( const QModelIndex & index ) const;
51 int rowCount( const QModelIndex & parent = QModelIndex() ) const;
52 int columnCount( const QModelIndex & parent = QModelIndex() ) const;
53 QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
54 Qt::ItemFlags flags ( const QModelIndex & index ) const;
56 QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
58 private Q_SLOTS:
59 void engineChanged();
60 void addPrimitive(Primitive *primitive);
61 void updatePrimitive(Primitive *primitive);
62 void removePrimitive(Primitive *primitive);
64 private:
65 PrimitiveItemModelPrivate * const d;
67 int primitiveIndex(Primitive *primitive);
71 } // end namespace Avogadro
73 #endif // __PRIMITIVEITEMMODEL_H