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

Method UpdateSettingsPanelSize

src/cheat_gui.cpp:415–427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413 }
414
415 void UpdateSettingsPanelSize(Dimension &size)
416 {
417 uint width = 0;
418 for (const auto &desc : this->sandbox_settings) {
419 const IntSettingDesc *sd = desc->AsIntSetting();
420
421 auto [param1, param2] = sd->GetValueParams(sd->GetDefaultValue());
422 width = std::max(width, GetStringBoundingBox(GetString(sd->GetTitle(), STR_CONFIG_SETTING_VALUE, param1, param2)).width);
423 }
424
425 size.width = width + WidgetDimensions::scaled.hsep_wide * 2 + SETTING_BUTTON_WIDTH;
426 size.height = this->line_height * static_cast<uint>(std::size(this->sandbox_settings));
427 }
428
429 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
430 {

Callers

nothing calls this directly

Calls 7

GetStringBoundingBoxFunction · 0.85
AsIntSettingMethod · 0.80
GetDefaultValueMethod · 0.80
GetTitleMethod · 0.80
GetStringFunction · 0.70
sizeFunction · 0.50
GetValueParamsMethod · 0.45

Tested by

no test coverage detected