1
0
Fork 0

nextStyle: switch to next available style, allowing the index range to

have holes. That way people can start their private styles with e.g. 100
and can be sure that the system doesn't mess with them.
This commit is contained in:
mfranz 2007-07-17 10:05:14 +00:00
parent 8a974bc9c1
commit b6b39def59

View file

@ -377,18 +377,19 @@ var dialog_update = func(dialog, objects...) {
# GUI theming
########################################################################
nextStyle = func {
numStyles = size(props.globals.getNode("/sim/gui").getChildren("style"));
curr = getprop("/sim/gui/current-style") + 1;
if (curr >= numStyles) {
curr = 0;
}
setprop("/sim/gui/current-style", curr);
var nextStyle = func {
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 = 0;
setprop("/sim/gui/current-style", styles[i].getIndex());
fgcommand("gui-redraw");
}
########################################################################
# Dialog Boxes
########################################################################