Version dialog: fix library versions not showing up with some languages

It turned out that GUI2 wasn't prepared for the possibility that list box
headers might need more horizontal space than the actual content.
This commit is contained in:
Jyrki Vesterinen 2017-09-17 10:56:41 +03:00
parent 8d2124104e
commit 12661c6e8a

View file

@ -25,6 +25,7 @@
#include "gui/widgets/window.hpp"
#include "sdl/rect.hpp"
#include <algorithm>
#include "utils/functional.hpp"
#define LOG_SCOPE_HEADER get_control_type() + " [" + id() + "] " + __func__
@ -207,6 +208,10 @@ void scrollbar_container::request_reduce_width(const unsigned maximum_width)
{
DBG_GUI_L << LOG_HEADER << " requested width " << maximum_width << ".\n";
if(static_cast<unsigned>(get_grid().get_best_size().x) > maximum_width) {
get_grid().request_reduce_width(maximum_width);
}
// First ask our content, it might be able to wrap which looks better as
// a scrollbar.
assert(content_grid_);
@ -258,6 +263,8 @@ void scrollbar_container::request_reduce_width(const unsigned maximum_width)
size.x = scrollbar_size.x;
}
size.x = std::max(size.x, get_grid().get_best_size().x);
// FIXME adjust for the step size of the scrollbar
set_layout_size(size);