1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 22:34:33 +01:00

Add plugin API for setting button isPressed (#11851)

This commit is contained in:
Ted John
2020-06-02 03:05:24 +01:00
committed by GitHub
parent 1b6899a954
commit 0ca42f453c
4 changed files with 92 additions and 27 deletions

View File

@@ -112,6 +112,7 @@ namespace OpenRCT2::Ui::Windows
int32_t SelectedIndex{};
bool IsChecked{};
bool IsDisabled{};
bool IsPressed{};
bool HasBorder{};
bool ShowColumnHeaders{};
bool IsStriped{};
@@ -149,16 +150,13 @@ namespace OpenRCT2::Ui::Windows
result.Text = ProcessString(desc["text"]);
result.HasBorder = true;
}
result.IsPressed = AsOrDefault(desc["isPressed"], false);
result.OnClick = desc["onClick"];
}
else if (result.Type == "checkbox")
{
result.Text = ProcessString(desc["text"]);
auto dukIsChecked = desc["isChecked"];
if (dukIsChecked.type() == DukValue::Type::BOOLEAN)
{
result.IsChecked = dukIsChecked.as_bool();
}
result.IsChecked = AsOrDefault(desc["isChecked"], false);
result.OnChange = desc["onChange"];
}
else if (result.Type == "dropdown")
@@ -821,6 +819,10 @@ namespace OpenRCT2::Ui::Windows
widget.string = const_cast<utf8*>(desc.Text.c_str());
widget.flags |= WIDGET_FLAGS::TEXT_IS_STRING;
}
if (desc.IsPressed)
{
widget.flags |= WIDGET_FLAGS::IS_PRESSED;
}
widgetList.push_back(widget);
}
else if (desc.Type == "checkbox")