MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / WindowSetResize

Function WindowSetResize

src/openrct2-ui/interface/Window.cpp:959–998  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

957 }
958
959 bool WindowSetResize(WindowBase& w, ScreenSize minSize, ScreenSize maxSize)
960 {
961 w.minWidth = std::min(minSize.width, maxSize.width);
962 w.minHeight = std::min(minSize.height, maxSize.height);
963 w.maxWidth = std::max(minSize.width, maxSize.width);
964 w.maxHeight = std::max(minSize.height, maxSize.height);
965
966 if (Config::Get().interface.enlargedUi)
967 {
968 // Not sure why plugin windows have to be treated differently,
969 // but they currently show a deviation if we don't.
970 if (w.classification == WindowClass::custom)
971 {
972 w.minHeight += w.getTitleBarDiffTarget();
973 w.maxHeight += w.getTitleBarDiffTarget();
974 }
975 else
976 {
977 w.minHeight += w.getTitleBarDiffNormal();
978 w.maxHeight += w.getTitleBarDiffNormal();
979 }
980 }
981
982 // Clamp width and height to minimum and maximum
983 int16_t width = std::clamp<int16_t>(w.width, w.minWidth, w.maxWidth);
984 int16_t height = std::clamp<int16_t>(w.height, w.minHeight, w.maxHeight);
985
986 // Resize window if size has changed
987 if (w.width != width || w.height != height)
988 {
989 w.invalidate();
990 w.width = width;
991 w.height = height;
992 w.resizeFrame();
993 w.invalidate();
994 return true;
995 }
996
997 return false;
998 }
999
1000 /**
1001 *

Callers 15

onOpenMethod · 0.85
onOpenMethod · 0.85
onResizeMethod · 0.85
onOpenMethod · 0.85
MainResizeMethod · 0.85
VehicleResizeMethod · 0.85
OperatingResizeMethod · 0.85
MaintenanceResizeMethod · 0.85
ColourResizeMethod · 0.85
MusicResizeMethod · 0.85
MeasurementsResizeMethod · 0.85

Calls 4

getTitleBarDiffTargetMethod · 0.80
getTitleBarDiffNormalMethod · 0.80
resizeFrameMethod · 0.80
invalidateMethod · 0.45

Tested by 1

onOpenMethod · 0.68