Fix recent wxMSW buttons with bitmaps appearance regression

Revert both 53eff92ea7 (Call AdjustForBitmapMargins() only once in
wxAnyButton, 2021-04-24), which was completely wrong and was due to not
reading the code attentively enough, and the subsequent 5d508b6e6 (Fix
regression in sizes of buttons with bitmaps in wxMSW, 2021-07-08) which
fixed the problem introduced by the first commit partly, but not
completely.

Closes #13130.
This commit is contained in:
Vadim Zeitlin
2021-08-26 22:24:13 +01:00
parent 91ae4e2f8a
commit 051418ac00

View File

@@ -589,6 +589,9 @@ wxSize wxAnyButton::DoGetBestSize() const
SIZE idealSize = { 0, 0 };
if ( ::SendMessage(GetHwnd(), BCM_GETIDEALSIZE, 0, (LPARAM)&idealSize) )
size.Set(idealSize.cx, idealSize.cy);
if ( m_imageData )
AdjustForBitmapMargins(size);
}
// If we failed to set the size using BCM_GETIDEALSIZE above, determine it
@@ -618,10 +621,10 @@ wxSize wxAnyButton::DoGetBestSize() const
size = wxMSWButton::ComputeBestFittingSize(self, flags);
}
}
}
if ( m_imageData )
AdjustForBitmapSize(size);
if ( m_imageData )
AdjustForBitmapSize(size);
}
return wxMSWButton::IncreaseToStdSizeAndCache(self, size);
}