+ // Create the gtk widget.
+ m_widget = gtk_toggle_button_new_with_mnemonic("");
+ g_object_ref(m_widget);
+
+ SetLabel(label);
+
+ g_signal_connect (m_widget, "clicked",
+ G_CALLBACK (gtk_togglebutton_clicked_callback),
+ this);
+
+ 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();
+ }
+
+ return true;
+}
+
+void wxToggleButton::DoApplyWidgetStyle(GtkRcStyle *style)
+{
+ gtk_widget_modify_style(m_widget, style);
+ gtk_widget_modify_style(GTK_BIN(m_widget)->child, style);
+}
+
+GdkWindow *
+wxToggleButton::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
+{
+ return GTK_BUTTON(m_widget)->event_window;