]> git.cworth.org Git - vogl/blob - src/vogleditor/vogleditor_statetreearbprogramitem.h
Initial vogl checkin
[vogl] / src / vogleditor / vogleditor_statetreearbprogramitem.h
1 #ifndef VOGLEDITOR_STATETREEARBPROGRAMITEM_H
2 #define VOGLEDITOR_STATETREEARBPROGRAMITEM_H
3
4 #include "vogleditor_statetreeitem.h"
5 #include "vogl_arb_program_state.h"
6
7 class vogleditor_stateTreeArbProgramDiffableItem : public vogleditor_stateTreeItem
8 {
9 public:
10     vogleditor_stateTreeArbProgramDiffableItem(QString name, QString value, vogleditor_stateTreeItem* parent, const vogl_arb_program_state& state)
11         : vogleditor_stateTreeItem(name, value, parent),
12           m_pState(&state),
13           m_pDiffBaseState(NULL)
14     {
15     }
16
17     virtual void set_diff_base_state(const vogl_arb_program_state* pBaseState) {
18         m_pDiffBaseState = pBaseState;
19     }
20
21     const vogl_arb_program_state* get_current_state() const { return m_pState; }
22     const vogl_arb_program_state* get_base_state() const { return m_pDiffBaseState; }
23
24     virtual bool hasChanged() const = 0;
25
26 protected:
27     const vogl_arb_program_state* m_pState;
28     const vogl_arb_program_state* m_pDiffBaseState;
29 };
30
31 class vogleditor_stateTreeArbProgramBoolItem : public vogleditor_stateTreeArbProgramDiffableItem
32 {
33 public:
34     vogleditor_stateTreeArbProgramBoolItem(QString name, bool (vogl_arb_program_state::* func)(void) const, vogleditor_stateTreeItem* parent, const vogl_arb_program_state& state);
35     virtual ~vogleditor_stateTreeArbProgramBoolItem() { m_pState = NULL; }
36
37     virtual bool hasChanged() const;
38     virtual QString getDiffedValue() const;
39
40 private:
41     bool (vogl_arb_program_state::* m_pFunc)(void) const;
42 };
43
44 class vogleditor_stateTreeArbProgramUIntItem : public vogleditor_stateTreeArbProgramDiffableItem
45 {
46 public:
47     vogleditor_stateTreeArbProgramUIntItem(QString name, uint (vogl_arb_program_state::* func)(void) const, vogleditor_stateTreeItem* parent, const vogl_arb_program_state& state);
48     virtual ~vogleditor_stateTreeArbProgramUIntItem() { m_pState = NULL; }
49
50     virtual bool hasChanged() const;
51     virtual QString getDiffedValue() const;
52
53 private:
54     uint (vogl_arb_program_state::* m_pFunc)(void) const;
55 };
56
57 class vogleditor_stateTreeArbProgramIntItem : public vogleditor_stateTreeArbProgramDiffableItem
58 {
59 public:
60     vogleditor_stateTreeArbProgramIntItem(QString name, GLint (vogl_arb_program_state::* func)(void) const, vogleditor_stateTreeItem* parent, const vogl_arb_program_state& state);
61     virtual ~vogleditor_stateTreeArbProgramIntItem() { m_pState = NULL; }
62
63     virtual bool hasChanged() const;
64     virtual QString getDiffedValue() const;
65
66 private:
67     GLint (vogl_arb_program_state::* m_pFunc)(void) const;
68 };
69
70 class vogleditor_stateTreeArbProgramEnumItem : public vogleditor_stateTreeArbProgramDiffableItem
71 {
72 public:
73     vogleditor_stateTreeArbProgramEnumItem(QString name, GLenum (vogl_arb_program_state::* func)(void) const, vogleditor_stateTreeItem* parent, const vogl_arb_program_state& state);
74     virtual ~vogleditor_stateTreeArbProgramEnumItem() { m_pState = NULL; }
75
76     virtual bool hasChanged() const;
77     virtual QString getDiffedValue() const;
78
79 private:
80     GLenum (vogl_arb_program_state::* m_pFunc)(void) const;
81 };
82
83 class vogleditor_stateTreeArbProgramStringItem : public vogleditor_stateTreeArbProgramDiffableItem
84 {
85 public:
86     vogleditor_stateTreeArbProgramStringItem(QString name, const uint8_vec& (vogl_arb_program_state::* func)(void) const, vogleditor_stateTreeItem* parent, const vogl_arb_program_state& state);
87     virtual ~vogleditor_stateTreeArbProgramStringItem() { m_pState = NULL; }
88
89     virtual bool hasChanged() const;
90     virtual QString getDiffedValue() const;
91
92 private:
93     const uint8_vec& (vogl_arb_program_state::* m_pFunc)(void) const;
94 };
95
96 class vogleditor_stateTreeArbProgramParamItem : public vogleditor_stateTreeArbProgramDiffableItem
97 {
98 public:
99     vogleditor_stateTreeArbProgramParamItem(QString name, unsigned int paramIndex, vogleditor_stateTreeItem* parent, const vogl_arb_program_state& state);
100     virtual ~vogleditor_stateTreeArbProgramParamItem() { m_pState = NULL; }
101
102     virtual bool hasChanged() const;
103     virtual QString getDiffedValue() const;
104
105 private:
106     unsigned int m_paramIndex;
107 };
108
109 class vogleditor_stateTreeArbProgramItem : public vogleditor_stateTreeItem
110 {
111 public:
112    vogleditor_stateTreeArbProgramItem(QString name, QString value, vogleditor_stateTreeItem* parent, vogl_arb_program_state& state);
113    virtual ~vogleditor_stateTreeArbProgramItem() { m_pState = NULL; m_pDiffBaseState = NULL; }
114
115    vogl_arb_program_state* get_current_state() const { return m_pState; }
116    const vogl_arb_program_state* get_base_state() const { return m_pDiffBaseState; }
117
118    void set_diff_base_state(const vogl_arb_program_state* pBaseState)
119    {
120        m_pDiffBaseState = pBaseState;
121        for (vogleditor_stateTreeArbProgramDiffableItem** iter = m_diffableItems.begin(); iter != m_diffableItems.end(); iter++)
122        {
123            (*iter)->set_diff_base_state(pBaseState);
124        }
125    }
126
127 private:
128    vogl_arb_program_state* m_pState;
129    const vogl_arb_program_state* m_pDiffBaseState;
130    vogl::vector<vogleditor_stateTreeArbProgramDiffableItem*> m_diffableItems;
131 };
132
133 #endif // VOGLEDITOR_STATETREEARBPROGRAMITEM_H