1 /**************************************************************************
3 * Copyright 2013-2014 RAD Game Tools and Valve Software
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 **************************************************************************/
26 #ifndef VOGLEDITOR_QSTATETREEMODEL_H
27 #define VOGLEDITOR_QSTATETREEMODEL_H
29 #include <QAbstractItemModel>
33 #include "vogleditor_statetreeitem.h"
34 #include "vogleditor_gl_state_snapshot.h"
36 class vogleditor_stateTreeProgramItem;
37 class vogleditor_stateTreeContextItem;
39 class vogleditor_QStateTreeModel : public QAbstractItemModel
44 vogleditor_QStateTreeModel(QObject* parent);
45 vogleditor_QStateTreeModel(vogleditor_gl_state_snapshot* pSnapshot, QObject* parent);
47 virtual ~vogleditor_QStateTreeModel();
49 // QAbstractItemModel interface
50 virtual QModelIndex index(int row, int column, const QModelIndex& parent) const;
52 virtual QModelIndex parent(const QModelIndex& child) const;
54 virtual int rowCount(const QModelIndex& parent) const;
56 virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
58 virtual QVariant data(const QModelIndex& index, int role) const;
60 QVariant headerData(int section, Qt::Orientation orientation,
61 int role = Qt::DisplayRole) const;
63 // end QAbstractItemModel interface
65 vogleditor_stateTreeItem* root() const;
67 void set_snapshot(vogleditor_gl_state_snapshot* pSnapshot);
68 vogleditor_gl_state_snapshot* get_snapshot() const;
70 void set_diff_base_snapshot(const vogleditor_gl_state_snapshot* pBaseSnapshot);
72 vogl::vector<vogleditor_stateTreeProgramItem*> get_program_objects();
75 vogleditor_stateTreeItem* m_rootItem;
76 QList<QVariant> m_ColumnTitles;
77 vogleditor_gl_state_snapshot* m_pSnapshot;
78 const vogleditor_gl_state_snapshot* m_pBaseSnapshot;
79 vogleditor_stateTreeContextItem* m_pCurrentContextItem;
81 void setupModelData(vogleditor_gl_state_snapshot *pSnapshot, vogleditor_stateTreeItem* parent);
84 #endif // VOGLEDITOR_QSTATETREEMODEL_H