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

Method UpdateWidgetSize

src/newgrf_debug_gui.cpp:351–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349 }
350
351 void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
352 {
353 switch (widget) {
354 case WID_NGRFI_VEH_CHAIN: {
355 assert(this->HasChainIndex());
356 GrfSpecFeature f = GetFeatureNum(this->window_number);
357 size.height = std::max(size.height, GetVehicleImageCellSize((VehicleType)(VEH_TRAIN + (f - GSF_TRAINS)), EIT_IN_DEPOT).height + 2 + WidgetDimensions::scaled.bevel.Vertical());
358 break;
359 }
360
361 case WID_NGRFI_MAINPANEL:
362 fill.height = resize.height = std::max(11, GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal);
363 resize.width = 1;
364
365 size.height = 5 * resize.height + WidgetDimensions::scaled.frametext.Vertical();
366 break;
367 }
368 }
369
370 /**
371 * Helper function to draw a string (line) in the window.

Callers

nothing calls this directly

Calls 5

HasChainIndexMethod · 0.95
GetFeatureNumFunction · 0.85
GetVehicleImageCellSizeFunction · 0.85
GetCharacterHeightFunction · 0.85
VerticalMethod · 0.80

Tested by

no test coverage detected