Add proportionality support for GameUI panels

This commit is contained in:
JusicP
2021-10-31 21:45:57 +02:00
parent 7a69af7b00
commit 82545dfe26
18 changed files with 280 additions and 143 deletions

View File

@@ -115,24 +115,36 @@ void PropertyDialog::PerformLayout()
GetClientArea(x, y, wide, tall);
_propertySheet->SetBounds(x, y, wide, tall - iBottom);
// calc button size and indent for proportionality
int iBtnWide = 72;
int iBtnTall = 24;
int iWideIndent = 8;
int iTallIndent = 4;
if (IsProportional())
{
iBtnWide = scheme()->GetProportionalScaledValueEx(GetScheme(), iBtnWide);
iBtnTall = scheme()->GetProportionalScaledValueEx(GetScheme(), iBtnTall);
iWideIndent = scheme()->GetProportionalScaledValueEx(GetScheme(), iWideIndent);
iTallIndent = scheme()->GetProportionalScaledValueEx(GetScheme(), iTallIndent);
}
// move the buttons to the bottom-right corner
int xpos = x + wide - 80;
int ypos = tall + y - 28;
int xpos = x + wide - iBtnWide - iWideIndent;
int ypos = tall + y - iBtnTall - iTallIndent;
if (_applyButton->IsVisible())
{
_applyButton->SetBounds(xpos, ypos, 72, 24);
xpos -= 80;
_applyButton->SetBounds(xpos, ypos, iBtnWide, iBtnTall);
xpos -= iBtnWide + iWideIndent;
}
if (_cancelButton->IsVisible())
{
_cancelButton->SetBounds(xpos, ypos, 72, 24);
xpos -= 80;
_cancelButton->SetBounds(xpos, ypos, iBtnWide, iBtnTall);
xpos -= iBtnWide + iWideIndent;
}
_okButton->SetBounds(xpos, ypos, 72, 24);
_okButton->SetBounds(xpos, ypos, iBtnWide, iBtnTall);
_propertySheet->InvalidateLayout(); // tell the propertysheet to redraw!
Repaint();