]> git.cworth.org Git - vogl/blob - src/vogleditor/vogleditor_statetreecontextgeneralitem.h
UI: Add a settings file
[vogl] / src / vogleditor / vogleditor_statetreecontextgeneralitem.h
1 #ifndef VOGLEDITOR_STATETREECONTEXTGENERALITEM_H
2 #define VOGLEDITOR_STATETREECONTEXTGENERALITEM_H
3
4 #include "vogleditor_statetreeitem.h"
5
6 #include "vogl_state_vector.h"
7 #include "vogl_general_context_state.h"
8
9 class vogleditor_stateTreeContextGeneralCompressTextureFormatItem : public vogleditor_stateTreeDatatypeItem<int>
10 {
11 public:
12    vogleditor_stateTreeContextGeneralCompressTextureFormatItem(QString glenumName, GLenum name, unsigned int index, const vogl_state_vector& stateVec, int formatEnum, unsigned int numComponents, bool isIndexed, vogleditor_stateTreeItem* parent);
13    virtual ~vogleditor_stateTreeContextGeneralCompressTextureFormatItem() {}
14
15    virtual void set_diff_base_state(const vogl_state_vector* pBaseState) { VOGL_NOTE_UNUSED(pBaseState); VOGL_ASSERT(!"This version of the function is not supported for vogleditor_stateTreeContextGeneralCompressTextureFormatItem"); }
16    void set_diff_base_state(const vogl_general_context_state* pBaseGeneralState) { m_pDiffBaseGeneralState = pBaseGeneralState; }
17
18    virtual bool hasChanged() const;
19
20 private:
21    int m_formatEnum;
22    const vogl_general_context_state* m_pDiffBaseGeneralState;
23 };
24
25 class vogleditor_stateTreeContextGeneralItem : public vogleditor_stateTreeItem
26 {
27 public:
28    vogleditor_stateTreeContextGeneralItem(QString name, QString value, vogleditor_stateTreeItem* parent, vogl_general_context_state& generalState, const vogl_context_info& info);
29    virtual ~vogleditor_stateTreeContextGeneralItem()
30    {
31        m_pState = NULL; m_pDiffBaseState = NULL;
32    }
33
34    vogl_general_context_state* get_context_general_state() const { return m_pState; }
35    void set_diff_base_state(const vogl_general_context_state* pBaseState) {
36        m_pDiffBaseState = pBaseState;
37        for (vogleditor_stateTreeStateVecDiffableItem** iter = m_diffableItems.begin(); iter != m_diffableItems.end(); iter++)
38        {
39            (*iter)->set_diff_base_state(static_cast<const vogl_state_vector*>(pBaseState));
40        }
41
42        for (vogleditor_stateTreeContextGeneralCompressTextureFormatItem** iter = m_formatItems.begin(); iter != m_formatItems.end(); iter++)
43        {
44            (*iter)->set_diff_base_state(pBaseState);
45        }
46    }
47
48 private:
49    vogl_general_context_state* m_pState;
50    const vogl_general_context_state* m_pDiffBaseState;
51    vogl::vector<vogleditor_stateTreeStateVecDiffableItem*> m_diffableItems;
52    vogl::vector<vogleditor_stateTreeContextGeneralCompressTextureFormatItem*> m_formatItems;
53 };
54
55
56 #endif // VOGLEDITOR_STATETREECONTEXTGENERALITEM_H