Fix: it was possible to shrink GUI canvas widgets

Regression from e4aa7c0d95. It was the
drawing widget code that was in the wrong, since styled_widget has never
explicitly guaranteed that it won't shrink.

Fixes a WML error in shop dialogs in the UMC campaign Bad Moon Rising with
a low screen resolution.
This commit is contained in:
Jyrki Vesterinen 2017-01-17 22:15:28 +02:00
parent 1ac990413c
commit 02b39fff53
2 changed files with 24 additions and 0 deletions

View file

@ -37,6 +37,24 @@ point drawing::calculate_best_size() const
: styled_widget::calculate_best_size();
}
void drawing::request_reduce_width(const unsigned maximum_width)
{
if(best_size_ != point()) {
// This drawing is of fixed size, do nothing.
} else {
styled_widget::request_reduce_width(maximum_width);
}
}
void drawing::request_reduce_height(const unsigned maximum_height)
{
if(best_size_ != point()) {
// This drawing is of fixed size, do nothing.
} else {
styled_widget::request_reduce_height(maximum_height);
}
}
void drawing::set_active(const bool /*active*/)
{
/* DO NOTHING */

View file

@ -40,6 +40,12 @@ public:
/***** ***** ***** ***** layout functions ***** ***** ***** *****/
/** See @ref widget::request_reduce_width. */
virtual void request_reduce_width(const unsigned maximum_width) override;
/** See @ref widget::request_reduce_height. */
virtual void request_reduce_height(const unsigned maximum_height) override;
private:
/** See @ref widget::calculate_best_size. */
virtual point calculate_best_size() const override;