Codechange: Use window parent association for dropdowns.

This replaces the separate window class and number properties, and
allows the window system to close dropdowns automatically.
This commit is contained in:
Peter Nelson
2023-06-02 14:27:06 +01:00
committed by PeterN
parent dec7ff6b0c
commit 2511649938
8 changed files with 22 additions and 39 deletions

View File

@@ -434,7 +434,7 @@ struct ScriptSettingsWindow : public Window {
int num = it - this->visible_settings.begin();
if (this->clicked_row != num) {
this->CloseChildWindows(WC_QUERY_STRING);
HideDropDownMenu(this);
this->CloseChildWindows(WC_DROPDOWN_MENU);
this->clicked_row = num;
this->clicked_dropdown = false;
}
@@ -450,7 +450,7 @@ struct ScriptSettingsWindow : public Window {
if (!bool_item && IsInsideMM(x, 0, SETTING_BUTTON_WIDTH) && config_item.complete_labels) {
if (this->clicked_dropdown) {
/* unclick the dropdown */
HideDropDownMenu(this);
this->CloseChildWindows(WC_DROPDOWN_MENU);
this->clicked_dropdown = false;
this->closing_dropdown = false;
} else {
@@ -560,7 +560,7 @@ struct ScriptSettingsWindow : public Window {
void OnInvalidateData(int data = 0, bool gui_scope = true) override
{
this->RebuildVisibleSettings();
HideDropDownMenu(this);
this->CloseChildWindows(WC_DROPDOWN_MENU);
this->CloseChildWindows(WC_QUERY_STRING);
}