1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 20:43:04 +01:00

Move title height helper functions to WindowBase and fix FlexUI plugins

This commit is contained in:
Aaron van Geffen
2025-04-11 23:26:34 +02:00
parent 883845bcf9
commit a8267412c2
14 changed files with 94 additions and 46 deletions

View File

@@ -99,7 +99,7 @@ namespace OpenRCT2
}
// Figure out if we need to push the other widgets down to accommodate a resized title/caption
auto preferredHeight = getTitleBarHeight();
auto preferredHeight = getTitleBarTargetHeight();
auto currentHeight = titleWidget.height();
auto heightDifference = preferredHeight - currentHeight;
@@ -133,4 +133,27 @@ namespace OpenRCT2
if (viewport != nullptr)
viewport->pos.y += heightDifference;
}
int16_t WindowBase::getTitleBarTargetHeight() const
{
return Config::Get().interface.EnlargedUi ? kTitleHeightLarge : kTitleHeightNormal;
}
int16_t WindowBase::getTitleBarCurrentHeight() const
{
if (!(flags & WF_NO_TITLE_BAR) && widgets.size() > 2)
return widgets[1].height();
else
return 0;
}
int16_t WindowBase::getTitleBarDiffTarget() const
{
return getTitleBarTargetHeight() - getTitleBarCurrentHeight();
}
int16_t WindowBase::getTitleBarDiffNormal() const
{
return getTitleBarCurrentHeight() - kTitleHeightNormal;
}
} // namespace OpenRCT2