]> git.cworth.org Git - vogl/blob - src/vogleditor/vogleditor_qstatetreemodel.h
Initial vogl checkin
[vogl] / src / vogleditor / vogleditor_qstatetreemodel.h
1 /**************************************************************************
2  *
3  * Copyright 2013-2014 RAD Game Tools and Valve Software
4  * All Rights Reserved.
5  *
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:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
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
22  * THE SOFTWARE.
23  *
24  **************************************************************************/
25
26 #ifndef VOGLEDITOR_QSTATETREEMODEL_H
27 #define VOGLEDITOR_QSTATETREEMODEL_H
28
29 #include <QAbstractItemModel>
30 #include <QList>
31 #include <QVariant>
32
33 #include "vogleditor_statetreeitem.h"
34 #include "vogleditor_gl_state_snapshot.h"
35
36 class vogleditor_stateTreeProgramItem;
37 class vogleditor_stateTreeContextItem;
38
39 class vogleditor_QStateTreeModel : public QAbstractItemModel
40 {
41    Q_OBJECT
42
43 public:
44    vogleditor_QStateTreeModel(QObject* parent);
45    vogleditor_QStateTreeModel(vogleditor_gl_state_snapshot* pSnapshot, QObject* parent);
46
47    virtual ~vogleditor_QStateTreeModel();
48
49    // QAbstractItemModel interface
50    virtual QModelIndex index(int row, int column, const QModelIndex& parent) const;
51
52    virtual QModelIndex parent(const QModelIndex& child) const;
53
54    virtual int rowCount(const QModelIndex& parent) const;
55
56    virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
57
58    virtual QVariant data(const QModelIndex& index, int role) const;
59
60    QVariant headerData(int section, Qt::Orientation orientation,
61                        int role = Qt::DisplayRole) const;
62
63    // end QAbstractItemModel interface
64
65    vogleditor_stateTreeItem* root() const;
66
67    void set_snapshot(vogleditor_gl_state_snapshot* pSnapshot);
68    vogleditor_gl_state_snapshot* get_snapshot() const;
69
70    void set_diff_base_snapshot(const vogleditor_gl_state_snapshot* pBaseSnapshot);
71
72    vogl::vector<vogleditor_stateTreeProgramItem*> get_program_objects();
73
74 private:
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;
80
81    void setupModelData(vogleditor_gl_state_snapshot *pSnapshot, vogleditor_stateTreeItem* parent);
82 };
83
84 #endif // VOGLEDITOR_QSTATETREEMODEL_H