Added command 'dialog-toggle' - toggles display of dialogue.
E.g. useful for keyboard shortcuts.
This commit is contained in:
parent
3c9fae3016
commit
43468727ad
3 changed files with 35 additions and 0 deletions
|
@ -217,6 +217,19 @@ NewGUI::showDialog (const string &name)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
NewGUI::toggleDialog (const string &name)
|
||||
{
|
||||
if (_active_dialogs.find(name) == _active_dialogs.end()) {
|
||||
showDialog(name);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
closeDialog(name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
NewGUI::closeActiveDialog ()
|
||||
{
|
||||
|
|
|
@ -82,6 +82,14 @@ public:
|
|||
*/
|
||||
virtual bool showDialog (const std::string &name);
|
||||
|
||||
/**
|
||||
* Toggle display of a dialog box.
|
||||
*
|
||||
* @param name The name of the dialog box.
|
||||
* @return true if the dialog is being displayed, false otherwise.
|
||||
*/
|
||||
virtual bool toggleDialog (const std::string &name);
|
||||
|
||||
|
||||
/**
|
||||
* Close the currenty active dialog. This function is intended to
|
||||
|
|
|
@ -303,6 +303,19 @@ do_dialog_show (const SGPropertyNode * arg, SGPropertyNode * root)
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Built-in command: Show an XML-configured dialog.
|
||||
*
|
||||
* dialog-name: the name of the GUI dialog to display.
|
||||
*/
|
||||
static bool
|
||||
do_dialog_toggle (const SGPropertyNode * arg, SGPropertyNode * root)
|
||||
{
|
||||
NewGUI * gui = (NewGUI *)globals->get_subsystem("gui");
|
||||
gui->toggleDialog(arg->getStringValue("dialog-name"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Built-in Command: Hide the active XML-configured dialog.
|
||||
|
@ -516,6 +529,7 @@ static struct {
|
|||
{ "tile-cache-reload", do_tile_cache_reload },
|
||||
{ "dialog-new", do_dialog_new },
|
||||
{ "dialog-show", do_dialog_show },
|
||||
{ "dialog-toggle", do_dialog_toggle },
|
||||
{ "dialog-close", do_dialog_close },
|
||||
{ "dialog-update", do_dialog_update },
|
||||
{ "dialog-apply", do_dialog_apply },
|
||||
|
|
Loading…
Add table
Reference in a new issue