MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / UpdateWidgetSize

Method UpdateWidgetSize

src/newgrf_debug_gui.cpp:878–899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

876 }
877
878 void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
879 {
880 switch (widget) {
881 case WID_SA_SPRITE:
882 size.height = ScaleGUITrad(200);
883 break;
884
885 case WID_SA_LIST: {
886 Dimension d = {};
887 for (const auto &spritefile : GetCachedSpriteFiles()) {
888 d = maxdim(d, GetStringBoundingBox(GetString(STR_SPRITE_ALIGNER_SPRITE, spritefile->GetSimplifiedFilename(), GetParamMaxDigits(6))));
889 }
890 size.width = d.width + padding.width;
891 fill.height = resize.height = GetCharacterHeight(FS_NORMAL) + padding.height;
892 resize.width = 1;
893 break;
894 }
895
896 default:
897 break;
898 }
899 }
900
901 void DrawWidget(const Rect &r, WidgetID widget) const override
902 {

Callers

nothing calls this directly

Calls 7

GetCachedSpriteFilesFunction · 0.85
maxdimFunction · 0.85
GetStringBoundingBoxFunction · 0.85
GetParamMaxDigitsFunction · 0.85
GetCharacterHeightFunction · 0.85
ScaleGUITradFunction · 0.70
GetStringFunction · 0.70

Tested by

no test coverage detected