mirror of https://github.com/OpenTTD/OpenTTD
Fix: Include sort button width in content list header minimal size. (#14402)
parent
42a9d27fd9
commit
36d7e09369
|
@ -583,18 +583,25 @@ public:
|
||||||
{
|
{
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case WID_NCL_CHECKBOX:
|
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;
|
break;
|
||||||
|
|
||||||
case WID_NCL_TYPE: {
|
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;
|
Dimension d = size;
|
||||||
for (int i = CONTENT_TYPE_BEGIN; i < CONTENT_TYPE_END; i++) {
|
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));
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case WID_NCL_NAME:
|
||||||
|
size.width += Window::SortButtonWidth() * 2;
|
||||||
|
break;
|
||||||
|
|
||||||
case WID_NCL_MATRIX:
|
case WID_NCL_MATRIX:
|
||||||
fill.height = resize.height = std::max(this->checkbox_size.height, (uint)GetCharacterHeight(FS_NORMAL)) + padding.height;
|
fill.height = resize.height = std::max(this->checkbox_size.height, (uint)GetCharacterHeight(FS_NORMAL)) + padding.height;
|
||||||
size.height = 10 * resize.height;
|
size.height = 10 * resize.height;
|
||||||
|
|
Loading…
Reference in New Issue