Override DoEnable() instead of Enable() in wxGTK controls
This is slightly simpler, as it doesn't require checking whether the control state really changes or not (it always does if DoEnable() is called) and allows disabling the controls before creating them, e.g. code like wxButton* const b = new wxButton(); b->Disable(); b->Create(this, wxID_OK); works as expected now instead of spewing GTK+ errors.
This commit is contained in:
@@ -222,17 +222,17 @@ void wxCheckBox::SetLabel( const wxString& label )
|
||||
GTKSetLabelForLabel(GTK_LABEL(m_widgetLabel), label);
|
||||
}
|
||||
|
||||
bool wxCheckBox::Enable( bool enable )
|
||||
void wxCheckBox::DoEnable(bool enable)
|
||||
{
|
||||
if (!base_type::Enable(enable))
|
||||
return false;
|
||||
if ( !m_widgetLabel )
|
||||
return;
|
||||
|
||||
base_type::DoEnable(enable);
|
||||
|
||||
gtk_widget_set_sensitive( m_widgetLabel, enable );
|
||||
|
||||
if (enable)
|
||||
GTKFixSensitivity();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxCheckBox::DoApplyWidgetStyle(GtkRcStyle *style)
|
||||
|
Reference in New Issue
Block a user