]> git.mxchange.org Git - flightgear.git/blob - src/GUI/menubar.hxx
Go back to the simpler arrangement syntax of a map of vectors.
[flightgear.git] / src / GUI / menubar.hxx
1 #ifndef __MENUBAR_HXX
2 #define __MENUBAR_HXX 1
3
4 #ifndef __cplusplus
5 # error This library requires C++
6 #endif
7
8 #include <simgear/compiler.h>   // for SG_USING_STD
9
10 #include <plib/pu.h>
11
12 #include <map>
13 SG_USING_STD(map);
14
15 #include <vector>
16 SG_USING_STD(vector);
17
18
19 class puMenuBar;
20 class puObject;
21 class FGBinding;
22
23
24 /**
25  * XML-configured PUI menu bar.
26  */
27 class FGMenuBar
28 {
29 public:
30
31     /**
32      * Constructor.
33      */
34     FGMenuBar ();
35
36
37     /**
38      * Destructor.
39      */
40     virtual ~FGMenuBar ();
41
42
43     /**
44      * Initialize the menu bar from $FG_ROOT/gui/menubar.xml
45      */
46     virtual void init ();
47
48     
49     /**
50      * Make the menu bar visible.
51      */
52     virtual void show ();
53
54
55     /**
56      * Make the menu bar invisible.
57      */
58     virtual void hide ();
59
60
61     /**
62      * Test whether the menu bar is visible.
63      */
64     virtual bool isVisible () const;
65
66
67     /**
68      * IGNORE THIS METHOD!!!
69      *
70      * This is necessary only because plib does not provide any easy
71      * way to attach user data to a menu item.  FlightGear should not
72      * have to know about PUI internals, but this method allows the
73      * callback to pass the menu item one-shot on to the current menu.
74      */
75     virtual void fireItem (puObject * item);
76
77
78 private:
79
80     void make_menu (SGPropertyNode_ptr node);
81     void make_menubar ();
82
83     bool _visible;
84     puMenuBar * _menuBar;
85     map<string,vector<FGBinding *> > _bindings;
86 };
87
88 #endif // __MENUBAR_HXX