+bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
+ const wxString &label, const wxPoint &pos,
+ const wxSize &size, long style,
+ const wxValidator& validator,
+ const wxString &name)
+{
+ if (!PreCreation(parent, pos, size) ||
+ !CreateBase(parent, id, pos, size, style, validator, name ))
+ {
+ wxFAIL_MSG(wxT("wxToggleButton creation failed"));
+ return false;
+ }
+
+ // create either a standard toggle button with text label (which may still contain
+ // an image under GTK+ 2.6+) or a bitmap-only toggle button if we don't have any
+ // label
+ const bool
+ useLabel = !(style & wxBU_NOTEXT) && !label.empty();
+ if ( useLabel )
+ {
+ m_widget = gtk_toggle_button_new_with_mnemonic("");
+ }
+ else // no label, suppose we will have a bitmap
+ {
+ m_widget = gtk_toggle_button_new();
+
+ GtkWidget *image = gtk_image_new();
+ gtk_widget_show(image);
+ gtk_container_add(GTK_CONTAINER(m_widget), image);
+ }
+
+ g_object_ref(m_widget);
+
+ if ( useLabel )
+ SetLabel(label);
+
+ g_signal_connect (m_widget, "clicked",
+ G_CALLBACK (gtk_togglebutton_clicked_callback),
+ this);
+
+ m_parent->DoAddChild(this);
+
+ PostCreation(size);
+
+ return true;
+}