Fix wxOSX sizing of borderless wxBitmapButton

Don't apply the workaround required for NSRoundedBezelStyle and
NSTexturedRoundedBezelStyle, i.e. enlarging too small buttons, if these
bezel styles are not used. In particular, avoid enlarging buttons with
wxBORDER_NONE or wxBORDER_SIMPLE.

Follow-up to 0941b25.
This commit is contained in:
Václav Slavík 2021-02-21 09:58:27 +01:00
parent 7eeab1bb7e
commit 26826c9bea

View File

@ -66,9 +66,18 @@ wxSize wxBitmapButton::DoGetBestSize() const
// account for it here to prevent part of the image from being cut off. // account for it here to prevent part of the image from being cut off.
// //
// Note that the magic 20px comes from SetBezelStyleFromBorderFlags() // Note that the magic 20px comes from SetBezelStyleFromBorderFlags()
// defined in src/osx/cocoa/button.mm. // defined in src/osx/cocoa/button.mm and so do the style checks.
if ( bitmapSize.y < 20 ) switch ( GetWindowStyle() & wxBORDER_MASK )
best += wxSize(4,0); {
case wxBORDER_NONE:
case wxBORDER_SIMPLE:
break;
default:
if ( bitmapSize.y < 20 )
best += wxSize(4,0);
break;
}
} }
return best; return best;