mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix #13431: [Plugin] UI disabled widgets can still be interacted with.
This commit is contained in:
parent
acaa72cce8
commit
a55bcff99c
|
@ -10,6 +10,7 @@
|
|||
- Fix: [#13334] Uninitialised variables in CustomTabDesc.
|
||||
- Fix: [#13342] Rename tabChange to onTabChange in WindowDesc interface.
|
||||
- Fix: [#13427] Newly created Go-Karts show "Race won by <blank>".
|
||||
- Fix: [#13431] [Plugin] UI disabled widgets can still be interacted with.
|
||||
- Fix: [#13454] Plug-ins do not load on Windows if the user directory contains non-ASCII characters.
|
||||
- Fix: [#13469] Exception thrown from plugin in context.subscribe.
|
||||
- Fix: [#13477] Plug-in widget tooltips do not work.
|
||||
|
|
|
@ -1014,6 +1014,18 @@ void WidgetSetEnabled(rct_window* w, rct_widgetindex widgetIndex, bool enabled)
|
|||
}
|
||||
}
|
||||
|
||||
void WidgetSetDisabled(rct_window* w, rct_widgetindex widgetIndex, bool value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
w->disabled_widgets |= (1ULL << widgetIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
w->disabled_widgets &= ~(1ULL << widgetIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void WidgetSetCheckboxValue(rct_window* w, rct_widgetindex widgetIndex, int32_t value)
|
||||
{
|
||||
if (value)
|
||||
|
|
|
@ -871,6 +871,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
widget.text = STR_DROPDOWN_GLYPH;
|
||||
widget.tooltip = STR_NONE;
|
||||
widget.flags |= WIDGET_FLAGS::IS_ENABLED;
|
||||
if (desc.IsDisabled)
|
||||
widget.flags |= WIDGET_FLAGS::IS_DISABLED;
|
||||
widgetList.push_back(widget);
|
||||
}
|
||||
else if (desc.Type == "groupbox")
|
||||
|
@ -917,6 +919,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
widget.text = STR_NUMERIC_DOWN;
|
||||
widget.tooltip = STR_NONE;
|
||||
widget.flags |= WIDGET_FLAGS::IS_ENABLED;
|
||||
if (desc.IsDisabled)
|
||||
widget.flags |= WIDGET_FLAGS::IS_DISABLED;
|
||||
widgetList.push_back(widget);
|
||||
|
||||
// Add the increment button
|
||||
|
|
|
@ -299,11 +299,21 @@ namespace OpenRCT2::Scripting
|
|||
auto w = GetWindow();
|
||||
if (w != nullptr)
|
||||
{
|
||||
auto mask = 1ULL << _widgetIndex;
|
||||
if (value)
|
||||
w->disabled_widgets |= mask;
|
||||
else
|
||||
w->disabled_widgets &= ~mask;
|
||||
WidgetSetDisabled(w, _widgetIndex, value);
|
||||
|
||||
auto widget = GetWidget();
|
||||
if (widget != nullptr)
|
||||
{
|
||||
if (widget->type == WindowWidgetType::DropdownMenu)
|
||||
{
|
||||
WidgetSetDisabled(w, _widgetIndex + 1, value);
|
||||
}
|
||||
else if (widget->type == WindowWidgetType::Spinner)
|
||||
{
|
||||
WidgetSetDisabled(w, _widgetIndex + 1, value);
|
||||
WidgetSetDisabled(w, _widgetIndex + 2, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -145,6 +145,7 @@ void WidgetScrollGetPart(
|
|||
int32_t* output_scroll_area, int32_t* scroll_id);
|
||||
|
||||
void WidgetSetEnabled(rct_window* w, rct_widgetindex widgetIndex, bool enabled);
|
||||
void WidgetSetDisabled(rct_window* w, rct_widgetindex widgetIndex, bool value);
|
||||
void WidgetSetCheckboxValue(rct_window* w, rct_widgetindex widgetIndex, int32_t value);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue