/////////////////////////////////////////////////////////////////////////////
-// Name: radiobut.cpp
+// Name: src/gtk/radiobut.cpp
// Purpose:
// Author: Robert Roebling
// Id: $Id$
if (g_blockEventsOnDrag) return;
- if (!button->active) return;
+ if (!gtk_toggle_button_get_active(button)) return;
wxCommandEvent event( wxEVT_COMMAND_RADIOBUTTON_SELECTED, rb->GetId());
event.SetInt( rb->GetValue() );
// wxRadioButton
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxRadioButton,wxControl)
-
bool wxRadioButton::Create( wxWindow *parent,
wxWindowID id,
const wxString& label,
{
wxCHECK_RET( m_widget != NULL, wxT("invalid radiobutton") );
- GTKSetLabelForLabel(GTK_LABEL(GTK_BIN(m_widget)->child), label);
+ // save the original label
+ wxControlBase::SetLabel(label);
+
+ GTKSetLabelForLabel(GTK_LABEL(gtk_bin_get_child(GTK_BIN(m_widget))), label);
}
void wxRadioButton::SetValue( bool val )
{
wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobutton") );
- return GTK_TOGGLE_BUTTON(m_widget)->active;
+ return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_widget)) != 0;
}
bool wxRadioButton::Enable( bool enable )
{
- bool isEnabled = IsEnabled();
-
- if ( !wxControl::Enable( enable ) )
+ if (!base_type::Enable(enable))
return false;
- gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
+ gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(m_widget)), enable);
- if (!isEnabled && enable)
- {
+ if (enable)
GTKFixSensitivity();
- }
return true;
}
void wxRadioButton::DoApplyWidgetStyle(GtkRcStyle *style)
{
gtk_widget_modify_style(m_widget, style);
- gtk_widget_modify_style(GTK_BIN(m_widget)->child, style);
+ gtk_widget_modify_style(gtk_bin_get_child(GTK_BIN(m_widget)), style);
}
GdkWindow *