+ // 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 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;
+
+ m_blockEvent = true;
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_widget), state);
+
+ m_blockEvent = false;
+}
+
+// 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*/)
+{
+ if (!wxControl::Enable(enable))
+ return false;
+
+ gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
+
+ 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;