1
0
Fork 0

Fix: Include sort button width in content list header minimal size. (#14402)

pull/14403/head
Peter Nelson 2025-06-30 20:40:26 +01:00 committed by GitHub
parent 42a9d27fd9
commit 36d7e09369
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 2 deletions

View File

@ -583,18 +583,25 @@ public:
{
switch (widget) {
case WID_NCL_CHECKBOX:
size.width = this->checkbox_size.width + padding.width;
size.width = std::max<uint>(this->checkbox_size.width, Window::SortButtonWidth()) + padding.width;
break;
case WID_NCL_TYPE: {
/* Width must be enough for header label and sort buttons.*/
size.width += Window::SortButtonWidth() * 2;
/* And also enough for the width of each type of content. */
Dimension d = size;
for (int i = CONTENT_TYPE_BEGIN; i < CONTENT_TYPE_END; i++) {
d = maxdim(d, GetStringBoundingBox(STR_CONTENT_TYPE_BASE_GRAPHICS + i - CONTENT_TYPE_BASE_GRAPHICS));
}
size.width = d.width + padding.width;
size.width = std::max(size.width, d.width + padding.width);
break;
}
case WID_NCL_NAME:
size.width += Window::SortButtonWidth() * 2;
break;
case WID_NCL_MATRIX:
fill.height = resize.height = std::max(this->checkbox_size.height, (uint)GetCharacterHeight(FS_NORMAL)) + padding.height;
size.height = 10 * resize.height;