Don't change CSS for wxCheckNox with wxNO_BORDER in wxGTK 3

This makes the checkbox look ugly as it's clearly not supposed to be
rendered without the border at all, so it's better to do nothing than
mangle its CSS.

It could be better to add some virtual GTKTurnOffBorder() method that
could be overridden to do nothing in wxCheckBox and we should consider
doing this if there are other classes for which wxNO_BORDER breaks their
appearance, but for now, as long as it's the only case in which we need
to do this, just turn wxNO_BORDER off when calling PostCreation().
This commit is contained in:
Vadim Zeitlin 2019-11-29 04:31:14 +01:00
parent edd0d9b68f
commit eadee05729

View File

@ -156,8 +156,22 @@ bool wxCheckBox::Create(wxWindow *parent,
m_parent->DoAddChild( this );
#ifdef __WXGTK3__
// CSS added if the window has wxNO_BORDER inside base class PostCreation()
// makes checkbox look broken in the default GTK 3 theme, so avoid doing
// this by temporarily turning this flag off.
if ( style & wxNO_BORDER )
ToggleWindowStyle(wxNO_BORDER);
#endif
PostCreation(size);
#ifdef __WXGTK3__
// Turn it back on if necessary.
if ( style & wxNO_BORDER )
ToggleWindowStyle(wxNO_BORDER);
#endif
return true;
}