]> git.mxchange.org Git - flightgear.git/blob - src/GUI/new_gui.hxx
51c22f76cd706e4bbd2ca3aab8c1851cc28880ce
[flightgear.git] / src / GUI / new_gui.hxx
1 #ifndef __NEW_GUI_HXX
2 #define __NEW_GUI_HXX 1
3
4 #ifndef __cplusplus
5 # error This library requires C++
6 #endif
7
8 #include <plib/pu.h>
9
10 #include <simgear/compiler.h>   // for SG_USING_STD
11 #include <simgear/misc/props.hxx>
12
13 #include <vector>
14 SG_USING_STD(vector);
15
16 #include <map>
17 SG_USING_STD(map);
18
19 #include <Main/fgfs.hxx>
20
21
22 class GUIWidget
23 {
24 public:
25     GUIWidget (SGPropertyNode_ptr props);
26     virtual ~GUIWidget ();
27
28     virtual void updateProperties ();
29     virtual void applyProperties ();
30
31 private:
32
33     void display (SGPropertyNode_ptr props);
34
35     GUIWidget (const GUIWidget &); // just for safety
36
37     puObject * makeObject (SGPropertyNode * props,
38                            int parentWidth, int parentHeight);
39
40     void setupObject (puObject * object, SGPropertyNode * props);
41
42     void setupGroup (puGroup * group, SGPropertyNode * props,
43                      int width, int height, bool makeFrame = false);
44
45     puObject * _object;
46
47     struct PropertyObject {
48         PropertyObject (puObject * object, SGPropertyNode_ptr node);
49         puObject * object;
50         SGPropertyNode_ptr node;
51     };
52
53     vector<PropertyObject> _propertyObjects;
54
55 };
56
57
58 class NewGUI : public FGSubsystem
59 {
60 public:
61
62     NewGUI ();
63     virtual ~NewGUI ();
64     virtual void init ();
65     virtual void update (double delta_time_sec);
66     virtual void display (const string &name);
67
68 private:
69
70     void readDir (const char * path);
71
72     map<string,SGPropertyNode_ptr> _widgets;
73
74 };
75
76 #endif // __NEW_GUI_HXX