mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-08 09:49:36 +00:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user