Hide empty wxCheckBoxes in wxGTK to fix display problem

Focus rectangle was still drawn around the label when it was empty with some
themes, so hide it completely to ensure this doesn't happen.

Closes #17443.
This commit is contained in:
Damien Ruscoe 2016-07-09 15:32:34 +02:00 committed by Vadim Zeitlin
parent fa54e1af15
commit fc0108ce71
2 changed files with 8 additions and 0 deletions

View File

@ -101,6 +101,7 @@ wxGTK:
- Support background colour in wxDataViewCtrl attributes.
- Improve wxSpinCtrl best size calculation.
- Implement support for icon locations in wxMimeTypesManager (Hanmac).
- Cosmetic fix for empty wxCheckBoxes display (Chuddah).
wxMSW:

View File

@ -204,6 +204,13 @@ void wxCheckBox::SetLabel( const wxString& label )
{
wxCHECK_RET( m_widgetLabel != NULL, wxT("invalid checkbox") );
// If we don't hide the empty label, in some themes a focus rectangle is
// still drawn around it and this looks out of place.
if ( label.empty() )
gtk_widget_hide(m_widgetLabel);
else
gtk_widget_show(m_widgetLabel);
// save the label inside m_label in case user calls GetLabel() later
wxControl::SetLabel(label);