diff --git a/src/GUI/FGNasalMenuBar.cxx b/src/GUI/FGNasalMenuBar.cxx index c5509c361..410b4ec49 100644 --- a/src/GUI/FGNasalMenuBar.cxx +++ b/src/GUI/FGNasalMenuBar.cxx @@ -18,6 +18,7 @@ #include
#include
+#include static bool nameIsSeperator(const std::string& n) { @@ -275,6 +276,23 @@ void FGNasalMenuBar::init() configure(props); } +void FGNasalMenuBar::postinit() +{ + auto nas = globals->get_subsystem(); + nasal::Context ctx; + nasal::Hash guiModule{nas->getModule("gui"), ctx}; + + using MenuBarRef = std::shared_ptr; + auto f = guiModule.get>("_createMenuBar"); + if (!f) { + SG_LOG(SG_GUI, SG_DEV_ALERT, "GUI: _createMenuBar implementation not found"); + return; + } + + // invoke nasal callback to build up the menubar + f(_d); +} + void FGNasalMenuBar::show() { _d->visibilityMode = VisibilityMode::Visible; diff --git a/src/GUI/FGNasalMenuBar.hxx b/src/GUI/FGNasalMenuBar.hxx index 09a6929fa..a28312e88 100644 --- a/src/GUI/FGNasalMenuBar.hxx +++ b/src/GUI/FGNasalMenuBar.hxx @@ -42,6 +42,8 @@ public: */ void init() override; + void postinit() override; + /** * Make the menu bar visible. */ diff --git a/src/GUI/menubar.hxx b/src/GUI/menubar.hxx index e46b28983..73a6aab83 100644 --- a/src/GUI/menubar.hxx +++ b/src/GUI/menubar.hxx @@ -30,7 +30,11 @@ public: * Initialize the menu bar from $FG_ROOT/gui/menubar.xml */ virtual void init () = 0; - + + virtual void postinit() + { + } + /** * Make the menu bar visible. */ diff --git a/src/GUI/new_gui.cxx b/src/GUI/new_gui.cxx index 1b55ec232..c5ad3882a 100644 --- a/src/GUI/new_gui.cxx +++ b/src/GUI/new_gui.cxx @@ -269,6 +269,8 @@ void NewGUI::postinit() FGPUICompatDialog::setupGhost(compatModule); PUICompatObject::setupGhost(compatModule); FGNasalMenuBar::setupGhosts(compatModule); + + _menubar->postinit(); } void