Tracerestrict: Make condition type dropdown variable width

This commit is contained in:
Jonathan G Rennison
2020-11-27 17:44:14 +00:00
parent 2ad446369d
commit ec339b1dfa
2 changed files with 9 additions and 3 deletions

View File

@@ -510,7 +510,7 @@ void ShowDropDownList(Window *w, DropDownList &&list, int selected, int button,
* @param button Button widget number of the parent window \a w that wants the dropdown menu.
* @param disabled_mask Bitmask for disabled items (items with their bit set are displayed, but not selectable in the dropdown list).
* @param hidden_mask Bitmask for hidden items (items with their bit set are not copied to the dropdown list).
* @param width Width of the dropdown menu. If \c 0, use the width of parent widget \a button.
* @param width Width of the dropdown menu. If \c 0, use the width of parent widget \a button. If \c UINT_MAX, use the width of parent widget \a button, and use auto_width.
*/
void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int button, uint32 disabled_mask, uint32 hidden_mask, uint width, DropDownSyncFocus sync_parent_focus)
{
@@ -522,7 +522,13 @@ void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int butt
}
}
if (!list.empty()) ShowDropDownList(w, std::move(list), selected, button, width, false, false, sync_parent_focus);
bool auto_width = false;
if (width == UINT_MAX) {
width = 0;
auto_width = true;
}
if (!list.empty()) ShowDropDownList(w, std::move(list), selected, button, width, auto_width, false, sync_parent_focus);
}
/**