+ m_parent->DoAddChild(this);
+
+ PostCreation(size);
+
+ return true;
+}
+
+void wxToggleButton::GTKDisableEvents()
+{
+ g_signal_handlers_block_by_func(m_widget,
+ (gpointer) gtk_togglebutton_clicked_callback, this);
+}
+
+void wxToggleButton::GTKEnableEvents()
+{
+ g_signal_handlers_unblock_by_func(m_widget,
+ (gpointer) gtk_togglebutton_clicked_callback, this);
+}
+
+// void SetValue(bool state)
+// Set the value of the toggle button.
+void wxToggleButton::SetValue(bool state)
+{
+ wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button"));
+
+ if (state == GetValue())
+ return;
+
+ GTKDisableEvents();
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_widget), state);
+
+ GTKEnableEvents();
+}
+
+// bool GetValue() const
+// Get the value of the toggle button.
+bool wxToggleButton::GetValue() const
+{
+ wxCHECK_MSG(m_widget != NULL, false, wxT("invalid toggle button"));
+
+ return GTK_TOGGLE_BUTTON(m_widget)->active;
+}
+
+void wxToggleButton::SetLabel(const wxString& label)
+{
+ wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button"));
+
+ wxControl::SetLabel(label);
+
+ const wxString labelGTK = GTKConvertMnemonics(label);
+
+ gtk_button_set_label(GTK_BUTTON(m_widget), wxGTK_CONV(labelGTK));
+
+ ApplyWidgetStyle( false );
+}
+
+bool wxToggleButton::Enable(bool enable /*=true*/)
+{
+ bool isEnabled = IsEnabled();
+
+ if (!wxControl::Enable(enable))
+ return false;
+
+ gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
+
+ if (!isEnabled && enable)
+ {
+ GTKFixSensitivity();