0ad/binaries/data/mods/public/gui/reference/common/Buttons/StructreeButton.js
phosit 094a7c2268 Return a promise from most page-inits
Adopt the new interface by all pages which close themself. (Not thous
using `Engine.SwitchGuiPage`.)
2025-03-09 10:39:20 +01:00

32 lines
696 B
JavaScript

class StructreeButton
{
constructor(parentPage)
{
this.parentPage = parentPage;
this.civInfoButton = Engine.GetGUIObjectByName("structreeButton");
this.civInfoButton.onPress = this.onPress.bind(this);
this.civInfoButton.caption = this.Caption;
this.civInfoButton.tooltip = colorizeHotkey(this.Tooltip, this.Hotkey);
}
onPress()
{
this.parentPage.closePageCallback({
"nextPage": "page_structree.xml",
"args": {
"civ": this.parentPage.activeCiv
}
});
}
}
StructreeButton.prototype.Caption =
translate("Structure Tree");
StructreeButton.prototype.Hotkey =
"structree";
StructreeButton.prototype.Tooltip =
translate("%(hotkey)s: Switch to Structure Tree.");