X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FGUI%2Fmenubar.hxx;h=eab4b7ff8c6d939b700fe5d1a71e6615fb45d100;hb=5cad5aa7da2476ca8323a61f81dea59676dca085;hp=52e82ac0488470a8c850ca83b961356dc65851db;hpb=123931834f9f3dc99f5a301f9d325ffb5ee4d065;p=flightgear.git diff --git a/src/GUI/menubar.hxx b/src/GUI/menubar.hxx index 52e82ac04..eab4b7ff8 100644 --- a/src/GUI/menubar.hxx +++ b/src/GUI/menubar.hxx @@ -8,19 +8,20 @@ #endif #include // for SG_USING_STD +#include
#include #include -SG_USING_STD(map); +using std::map; #include -SG_USING_STD(vector); +using std::vector; class puMenuBar; class puObject; -class FGBinding; +class SGBinding; /** @@ -54,7 +55,6 @@ public: * Initialize the menu bar from $FG_ROOT/gui/menubar.xml */ virtual void init (); - /** * Make the menu bar visible. @@ -85,14 +85,38 @@ public: virtual void fireItem (puObject * item); + /** + * create a menubar based on a PropertyList within the PropertyTree + */ + void make_menubar (SGPropertyNode * props); + + + /** + * destroy a menubar based on a PropertyList within the PropertyTree + */ + void destroy_menubar (); + + + /** + * Disable/enable menu titles and entries + */ + bool enable_item (const SGPropertyNode * item, bool state); + + private: // Make a single menu. - void make_menu (SGPropertyNode_ptr node); + void make_menu (SGPropertyNode * node); // Make the top-level menubar. void make_menubar (); + // Create a property-path -> puObject map for menu node + void make_object_map(SGPropertyNode * node); + + // Add listener that enables/disables menu entries. + void add_enabled_listener(SGPropertyNode * node); + // Is the menu visible? bool _visible; @@ -100,7 +124,7 @@ private: puMenuBar * _menuBar; // A map of bindings for the menubar. - map > _bindings; + map > _bindings; // These are hoops that we have to jump through because PUI doesn't // do memory management for lists. We have to allocate the arrays, @@ -110,6 +134,9 @@ private: puCallback * make_callback_array (int size); vector _char_arrays; vector _callback_arrays; + + // A map for {menu node path}->puObject translation. + map _objects; }; #endif // __MENUBAR_HXX