1
0
Fork 0

Nasal/gui.nas: nextStyle(): popup new GUI style's name.

Also added delta param to control direction of change.
This commit is contained in:
Julian Smith 2019-08-19 13:14:40 +01:00
parent 2d8ec16afc
commit 48911a8131

View file

@ -703,16 +703,24 @@ var enable_widgets = func(node, name, enable = 1) {
# GUI theming
########################################################################
var nextStyle = func {
var nextStyle = func(delta=1) {
var curr = getprop("/sim/gui/current-style");
var styles = props.globals.getNode("/sim/gui").getChildren("style");
forindex (var i; styles)
if (styles[i].getIndex() == curr)
break;
if ((i += 1) >= size(styles))
i += delta;
if (i >= size(styles))
i = 0;
if (i < 0) {
i = size(styles) - 1;
}
setprop("/sim/gui/current-style", styles[i].getIndex());
fgcommand("gui-redraw");
popupTip(sprintf("GUI style %s: %s",
styles[i].getIndex(),
styles[i].getValue("name"),
));
}