+// menubar.hxx - XML-configured menu bar.
+
#ifndef __MENUBAR_HXX
#define __MENUBAR_HXX 1
-#ifndef __cplusplus
-# error This library requires C++
-#endif
-
-#include <simgear/compiler.h> // for SG_USING_STD
-
-#include <plib/pu.h>
-
-#include <map>
-SG_USING_STD(map);
-
-#include <vector>
-SG_USING_STD(vector);
-
-
-class puMenuBar;
-class puObject;
-class FGBinding;
-
+class SGPropertyNode;
/**
- * XML-configured PUI menu bar.
+ * XML-configured menu bar interface
+ *
+ * This class creates a menu bar from a tree of XML properties. These
+ * properties are not part of the main FlightGear property tree, but
+ * are read from a separate file ($FG_ROOT/gui/menubar.xml).
+
*/
class FGMenuBar
{
public:
-
- /**
- * Constructor.
- */
- FGMenuBar ();
-
+ FGMenuBar();
/**
* Destructor.
/**
* Initialize the menu bar from $FG_ROOT/gui/menubar.xml
*/
- virtual void init ();
-
+ virtual void init () = 0;
/**
* Make the menu bar visible.
*/
- virtual void show ();
+ virtual void show () = 0;
/**
* Make the menu bar invisible.
*/
- virtual void hide ();
+ virtual void hide () = 0;
/**
* Test whether the menu bar is visible.
*/
- virtual bool isVisible () const;
-
+ virtual bool isVisible () const = 0;
/**
- * IGNORE THIS METHOD!!!
- *
- * This is necessary only because plib does not provide any easy
- * way to attach user data to a menu item. FlightGear should not
- * have to know about PUI internals, but this method allows the
- * callback to pass the menu item one-shot on to the current menu.
+ * Read a menu label from the menu's property tree.
+ * Take care of mapping it to the appropriate translation, if available.
+ * Returns an UTF-8 encoded string.
*/
- virtual void fireItem (puObject * item);
-
-
-private:
-
- void make_menu (SGPropertyNode_ptr node);
- void make_menubar ();
+ const char* getLocalizedLabel(SGPropertyNode* node);
- bool _visible;
- puMenuBar * _menuBar;
- map<string,vector<FGBinding *> > _bindings;
};
#endif // __MENUBAR_HXX