GUI-WX: Restore panel size override.

Fixes the panels going wonky after the recent dead code removal
This commit is contained in:
refractionpcsx2 2022-05-07 16:10:32 +01:00
parent 41e8a2a7d1
commit 631ed8c0fd
2 changed files with 27 additions and 0 deletions

View File

@ -124,6 +124,32 @@ int pxStaticText::calcPaddingHeight(int newHeight) const
return (int)(newHeight * m_paddingPct_vert * 2) + (m_paddingPix_vert * 2);
}
// Overloaded form wxPanel and friends.
wxSize pxStaticText::DoGetBestSize() const
{
wxClientDC dc(const_cast<pxStaticText*>(this));
dc.SetFont(GetFontOk());
wxSize best;
if (m_autowrap)
{
best = GetBestWrappedSize(dc);
//best.x = wxDefaultCoord;
}
else
{
// No autowrapping, so we can force a specific size here!
best = dc.GetMultiLineTextExtent(GetLabel());
best.x += calcPaddingWidth(best.x);
}
best.y += calcPaddingHeight(best.y);
CacheBestSize(best);
return best;
}
wxSize pxStaticText::GetBestWrappedSize(const wxClientDC& dc) const
{
pxAssert(m_autowrap);

View File

@ -57,6 +57,7 @@ protected:
bool AcceptsFocus() const { return false; }
bool HasTransparentBackground() { return true; }
void DoSetSize(int x, int y, int w, int h, int sizeFlags = wxSIZE_AUTO);
wxSize DoGetBestSize() const;
public:
pxStaticText(wxWindow* parent, const wxString& label, wxAlignment align = wxALIGN_CENTRE_HORIZONTAL);