]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/menubar.hxx
VS2015 compatability fixes.
[flightgear.git] / src / GUI / menubar.hxx
index 52e82ac0488470a8c850ca83b961356dc65851db..3e70c48c1feb6ef6366f85bd18dcacd0120c4838 100644 (file)
@@ -3,46 +3,20 @@
 #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).
- *
- * WARNING: because PUI provides no easy way to attach user data to a
- * menu item, all menu item strings must be unique; otherwise, this
- * class will always use the first binding with any given name.
+
  */
 class FGMenuBar
 {
 public:
-
-    /**
-     * Constructor.
-     */
-    FGMenuBar ();
-
+    FGMenuBar();
 
     /**
      * Destructor.
@@ -53,63 +27,32 @@ public:
     /**
      * 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:
-
-    // Make a single menu.
-    void make_menu (SGPropertyNode_ptr node);
-
-    // Make the top-level menubar.
-    void make_menubar ();
-
-    // Is the menu visible?
-    bool _visible;
-
-    // The top-level menubar itself.
-    puMenuBar * _menuBar;
-
-    // A map of bindings for the menubar.
-    map<string,vector<FGBinding *> > _bindings;
+    static const char* getLocalizedLabel(SGPropertyNode* node);
 
-    // These are hoops that we have to jump through because PUI doesn't
-    // do memory management for lists.  We have to allocate the arrays,
-    // hang onto pointers, and then delete them when the menubar is
-    // freed.
-    char ** make_char_array (int size);
-    puCallback * make_callback_array (int size);
-    vector<char **> _char_arrays;
-    vector<puCallback *> _callback_arrays;
 };
 
 #endif // __MENUBAR_HXX