1
0
Fork 0

Reset: GUI can be shutdown.

This commit is contained in:
James Turner 2013-10-06 17:34:53 +01:00
parent e62a4f502a
commit 02a5261797
2 changed files with 22 additions and 11 deletions

View file

@ -52,18 +52,10 @@ using std::string;
NewGUI::NewGUI () :
_active_dialog(0)
{
#if defined(SG_MAC)
if (fgGetBool("/sim/menubar/native", true)) {
_menubar.reset(new FGCocoaMenuBar);
return;
}
#endif
_menubar.reset(new FGPUIMenuBar);
}
NewGUI::~NewGUI ()
{
_dialog_props.clear();
for (_itt_t it = _colors.begin(); it != _colors.end(); ++it)
delete it->second;
}
@ -71,6 +63,18 @@ NewGUI::~NewGUI ()
void
NewGUI::init ()
{
#if defined(SG_MAC)
if (fgGetBool("/sim/menubar/native", true)) {
_menubar.reset(new FGCocoaMenuBar);
}
#endif
if (!_menubar.get()) {
_menubar.reset(new FGPUIMenuBar);
}
fgTie("/sim/menubar/visibility", this,
&NewGUI::getMenuBarVisible, &NewGUI::setMenuBarVisible);
setStyle();
SGPath p(globals->get_fg_root(), "gui/dialogs");
readDir(p);
@ -82,6 +86,14 @@ NewGUI::init ()
_menubar->init();
}
void
NewGUI::shutdown()
{
fgUntie("/sim/menubar/visibility");
_menubar.reset();
_dialog_props.clear();
}
void
NewGUI::reinit ()
{
@ -132,14 +144,11 @@ NewGUI::reset (bool reload)
void
NewGUI::bind ()
{
fgTie("/sim/menubar/visibility", this,
&NewGUI::getMenuBarVisible, &NewGUI::setMenuBarVisible);
}
void
NewGUI::unbind ()
{
fgUntie("/sim/menubar/visibility");
}
void

View file

@ -46,6 +46,8 @@ public:
*/
virtual void init ();
virtual void shutdown ();
/**
* Reinitialize the GUI subsystem. Reloads all XML dialogs.
*/