From be5fa778399726cb561f552dbf9b205b7f0f58eb Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 5 Feb 2024 19:05:02 +0100 Subject: [PATCH] Reuse wxButton::GetDefaultSize() instead of duplicating it Just reuse the existing function in IncreaseToStdSizeAndCache() helper instead of using a separate and, until the parent commit, different, way of computing the default button size here. This will hopefully avoid introducing any discrepancies between the size returned by GetDefaultSize() and the size actually used for the buttons by default in the future. See #24283. --- src/msw/anybutton.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/msw/anybutton.cpp b/src/msw/anybutton.cpp index bc8b9f9560..c5a51f8c16 100644 --- a/src/msw/anybutton.cpp +++ b/src/msw/anybutton.cpp @@ -546,17 +546,7 @@ wxSize wxMSWButton::IncreaseToStdSizeAndCache(wxControl *btn, const wxSize& size // By default all buttons have at least the standard size. if ( !btn->HasFlag(wxBU_EXACTFIT) ) { - // The "Recommended sizing and spacing" section of MSDN layout article - // documents the default button size as being 50*14 dialog units or - // 75*23 relative pixels (what we call DIPs). As dialog units don't - // scale well in high DPI because of rounding errors, just DIPs here. - // - // Moreover, it looks like the extra 2px borders around the visible - // part of the button are not scaled correctly in higher than normal - // DPI, so add them without scaling. - const wxSize sizeDef = btn->FromDIP(wxSize(73, 21)) + wxSize(2, 2); - - sizeBtn.IncTo(sizeDef); + sizeBtn.IncTo(wxButton::GetDefaultSize(btn)); } // wxBU_EXACTFIT is typically used alongside a text control or similar,