Don't make wxBU_EXACTFIT buttons too tall in wxMSW

Fix regression introduced by bd388e9827: bitmap
buttons could now be made significantly taller than the text control height if
their bitmap was big enough. Only make buttons taller if they wouldn't be tall
enough on their own, instead of always increasing their height, even if it's
already big enough.

Closes #17576.
This commit is contained in:
Vadim Zeitlin 2016-06-23 22:16:26 +02:00
parent ff5981230a
commit 093a955fcc

View File

@ -459,7 +459,11 @@ wxSize wxMSWButton::IncreaseToStdSizeAndCache(wxControl *btn, const wxSize& size
{ {
// Such buttons are typically used alongside a text control or similar, // Such buttons are typically used alongside a text control or similar,
// so make them as high as it. // so make them as high as it.
sizeBtn.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(size.y); int yText;
wxGetCharSize(GetHwndOf(btn), NULL, &yText, btn->GetFont());
yText = EDIT_HEIGHT_FROM_CHAR_HEIGHT(yText);
sizeBtn.IncTo(wxSize(-1, yText));
} }
btn->CacheBestSize(sizeBtn); btn->CacheBestSize(sizeBtn);