Add proportionality support for GameUI panels (#35)

* Add proportionality support for GameUI panels

* Add Android platform define

* Fix button wrong state on fast clicking

Co-authored-by: JusicP <slender87844@gmail.com>
This commit is contained in:
nillerusr
2022-01-09 17:04:47 +03:00
committed by GitHub
co-authored by JusicP
parent 1f3436945f
commit 9d77bb17c5
20 changed files with 296 additions and 150 deletions
+19 -7
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();