diff --git a/data/gui/schema.cfg b/data/gui/schema.cfg index fc17546f7dad..9db483fc8b6e 100644 --- a/data/gui/schema.cfg +++ b/data/gui/schema.cfg @@ -481,6 +481,11 @@ type="unsigned" default=0 [/key] + [key] + name="can_shrink" + type="bool" + default=false + [/key] [tag] name="linked_group" min="0" diff --git a/data/gui/widget/label_default.cfg b/data/gui/widget/label_default.cfg index ea7bc206c0bc..5e060ae87a3e 100644 --- a/data/gui/widget/label_default.cfg +++ b/data/gui/widget/label_default.cfg @@ -20,6 +20,8 @@ max_width = 0 max_height = 0 + can_shrink = true + text_font_family = {FONT_FAMILY} text_font_size = {FONT_SIZE} text_font_style = {FONT_STYLE} diff --git a/src/gui/core/widget_definition.cpp b/src/gui/core/widget_definition.cpp index 2f800c2920d1..b29d2898535c 100644 --- a/src/gui/core/widget_definition.cpp +++ b/src/gui/core/widget_definition.cpp @@ -98,6 +98,7 @@ resolution_definition::resolution_definition(const config& cfg) , default_height(cfg["default_height"]) , max_width(cfg["max_width"]) , max_height(cfg["max_height"]) + , can_shrink(cfg["can_shrink"].to_bool()) , linked_groups() , text_extra_width(cfg["text_extra_width"]) , text_extra_height(cfg["text_extra_height"]) diff --git a/src/gui/core/widget_definition.hpp b/src/gui/core/widget_definition.hpp index 2d5ea3e331c4..5e19fad41493 100644 --- a/src/gui/core/widget_definition.hpp +++ b/src/gui/core/widget_definition.hpp @@ -57,6 +57,8 @@ struct resolution_definition unsigned max_width; unsigned max_height; + bool can_shrink; + std::vector linked_groups; unsigned text_extra_width; diff --git a/src/gui/widgets/styled_widget.cpp b/src/gui/widgets/styled_widget.cpp index bc84eff78042..8400836a60a7 100644 --- a/src/gui/widgets/styled_widget.cpp +++ b/src/gui/widgets/styled_widget.cpp @@ -219,7 +219,7 @@ void styled_widget::request_reduce_width(const unsigned maximum_width) << "' maximum_width " << maximum_width << " result " << size << ".\n"; - } else if(label_.empty()) { + } else if(label_.empty() || config_->can_shrink) { point size = get_best_size(); point min_size = get_config_minimum_size(); size.x = std::min(size.x, std::max(maximum_width, min_size.x));