-
Notifications
You must be signed in to change notification settings - Fork 0
/
GtkAbstractInspector.h
101 lines (73 loc) · 4.37 KB
/
GtkAbstractInspector.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#pragma once
#include "Inspector.h"
#include "GtkChildPopulator.h"
#include <gtkmm/container.h>
#include "GtkInspectionField.h"
#include "Inspectable.h"
#include <Magnum/SceneGraph/AbstractObject.h>
namespace MagnumInspector {
class InspectorNode;
class GtkAbstractInspector : public Inspector
{
public:
virtual void editable(const char* name, std::string& s);
virtual void readonly(const char* name, const std::string& s);
virtual void editable(const char* name, bool& i);
virtual void readonly(const char* name, bool i);
virtual void editable(const char* name, char& i) { editableInteger(name, i); }
virtual void readonly(const char* name, const char& i) { readonlyInteger(name, i); }
virtual void editable(const char* name, unsigned char& i) { editableInteger(name, i); }
virtual void readonly(const char* name, const unsigned char& i) { readonlyInteger(name, i); }
virtual void editable(const char* name, short& i) { editableInteger(name, i); }
virtual void readonly(const char* name, const short& i) { readonlyInteger(name, i); }
virtual void editable(const char* name, unsigned short& i) { editableInteger(name, i); }
virtual void readonly(const char* name, const unsigned short& i) { readonlyInteger(name, i); }
virtual void editable(const char* name, int& i) { editableInteger(name, i); }
virtual void readonly(const char* name, const int& i) { readonlyInteger(name, i); }
virtual void editable(const char* name, unsigned& i) { editableInteger(name, i); }
virtual void readonly(const char* name, const unsigned& i) { readonlyInteger(name, i); }
virtual void editable(const char* name, long& i) { editableInteger(name, i); }
virtual void readonly(const char* name, const long& i) { readonlyInteger(name, i); }
virtual void editable(const char* name, unsigned long& i) { editableInteger(name, i); }
virtual void readonly(const char* name, const unsigned long& i) { readonlyInteger(name, i); }
virtual void editable(const char* name, float& f);
virtual void readonly(const char* name, const float& f);
virtual void editable(const char* name, float* f, uint n, uint m);
virtual void readonly(const char* name, const float* f, uint n, uint m);
virtual void editable(const char* name, Inspectable* i);
virtual void readonly(const char* name, Inspectable* i);
virtual void editable(const char* name, Magnum::SceneGraph::AbstractObject2D& i) { editableObject(name, i); }
virtual void readonly(const char* name, Magnum::SceneGraph::AbstractObject2D& i) { readonlyObject(name, i); }
virtual void editable(const char* name, Magnum::SceneGraph::AbstractObject3D& i) { editableObject(name, i); }
virtual void readonly(const char* name, Magnum::SceneGraph::AbstractObject3D& i) { readonlyObject(name, i); }
virtual void editable(const char* name, Magnum::SceneGraph::AbstractFeature2D& i) { editableFeature(name, i); }
virtual void readonly(const char* name, Magnum::SceneGraph::AbstractFeature2D& i) { readonlyFeature(name, i); }
virtual void editable(const char* name, Magnum::SceneGraph::AbstractFeature3D& i) { editableFeature(name, i); }
virtual void readonly(const char* name, Magnum::SceneGraph::AbstractFeature3D& i) { readonlyFeature(name, i); }
virtual void inspectAsMain(const char* name, Inspectable& i);
protected:
GtkChildPopulator childPopulator;
template<typename FieldValueWidget>
FieldValueWidget& addField(const char* name)
{
GtkInspectionField& field = childPopulator.ensureChild<GtkInspectionField>();
if (field.getLabel().get_text() != name) {
field.getLabel().set_text(name);
}
return field.ensureChild<FieldValueWidget>();
}
private:
template<uint Dimensions, typename ValueType>
void editableObject(const char* name, Magnum::SceneGraph::AbstractObject<Dimensions, ValueType>& object);
template<uint Dimensions, typename ValueType>
void readonlyObject(const char* name, Magnum::SceneGraph::AbstractObject<Dimensions, ValueType>& object);
template<uint Dimensions, typename ValueType>
void editableFeature(const char* name, Magnum::SceneGraph::AbstractFeature<Dimensions, ValueType>& feature);
template<uint Dimensions, typename ValueType>
void readonlyFeature(const char* name, Magnum::SceneGraph::AbstractFeature<Dimensions, ValueType>& feature);
template<typename ValueType>
void editableInteger(const char* name, ValueType& i);
template<typename ValueType>
void readonlyInteger(const char* name, const ValueType& i);
};
}