1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-22 03:42:41 +01:00

Codechange: Add OnClick handler for dropdown items.

This allows each dropdown item to indicate if something different should happen depending on where in the item was clicked.
This commit is contained in:
Peter Nelson
2025-05-23 17:44:17 +01:00
committed by Peter Nelson
parent 04e07dff84
commit 984d864c72
29 changed files with 95 additions and 55 deletions

View File

@@ -491,14 +491,14 @@ struct ScriptSettingsWindow : public Window {
SetValue(*value);
}
void OnDropdownSelect(WidgetID widget, int index) override
void OnDropdownSelect(WidgetID widget, int index, int) override
{
if (widget != WID_SCRS_SETTING_DROPDOWN) return;
assert(this->clicked_dropdown);
SetValue(index);
}
void OnDropdownClose(Point, WidgetID widget, int, bool) override
void OnDropdownClose(Point, WidgetID widget, int, int, bool) override
{
if (widget != WID_SCRS_SETTING_DROPDOWN) return;
/* We cannot raise the dropdown button just yet. OnClick needs some hint, whether