Add Nasal callback to build menubar
This commit is contained in:
parent
50f487b589
commit
fcd88ac845
4 changed files with 27 additions and 1 deletions
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <Main/globals.hxx>
|
||||
#include <Scripting/NasalSys.hxx>
|
||||
|
||||
static bool nameIsSeperator(const std::string& n)
|
||||
{
|
||||
|
@ -275,6 +276,23 @@ void FGNasalMenuBar::init()
|
|||
configure(props);
|
||||
}
|
||||
|
||||
void FGNasalMenuBar::postinit()
|
||||
{
|
||||
auto nas = globals->get_subsystem<FGNasalSys>();
|
||||
nasal::Context ctx;
|
||||
nasal::Hash guiModule{nas->getModule("gui"), ctx};
|
||||
|
||||
using MenuBarRef = std::shared_ptr<NasalMenuBarPrivate>;
|
||||
auto f = guiModule.get<std::function<void(MenuBarRef)>>("_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;
|
||||
|
|
|
@ -42,6 +42,8 @@ public:
|
|||
*/
|
||||
void init() override;
|
||||
|
||||
void postinit() override;
|
||||
|
||||
/**
|
||||
* Make the menu bar visible.
|
||||
*/
|
||||
|
|
|
@ -31,6 +31,10 @@ public:
|
|||
*/
|
||||
virtual void init () = 0;
|
||||
|
||||
virtual void postinit()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the menu bar visible.
|
||||
*/
|
||||
|
|
|
@ -269,6 +269,8 @@ void NewGUI::postinit()
|
|||
FGPUICompatDialog::setupGhost(compatModule);
|
||||
PUICompatObject::setupGhost(compatModule);
|
||||
FGNasalMenuBar::setupGhosts(compatModule);
|
||||
|
||||
_menubar->postinit();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue