]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/tglbtn.cpp
Moved all the coordinate system calculation to wxDCBase
[wxWidgets.git] / src / gtk / tglbtn.cpp
index 1e7e2acfc56d9ea9a8d5bdae9b421c98f8b55ec3..734b351d26ba5ea7f32c2548fdf3855ad070aae1 100644 (file)
@@ -28,9 +28,6 @@ extern bool      g_blockEventsOnDrag;
 extern "C" {
 static void gtk_togglebutton_clicked_callback(GtkWidget *WXUNUSED(widget), wxToggleButton *cb)
 {
-    if (g_isIdle)
-        wxapp_install_idle_handler();
-
     if (!cb->m_hasVMT || g_blockEventsOnDrag)
         return;
 
@@ -58,9 +55,6 @@ bool wxToggleBitmapButton::Create(wxWindow *parent, wxWindowID id,
                             const wxValidator& validator,
                             const wxString &name)
 {
-    m_needParent = true;
-    m_acceptsFocus = true;
-
     m_blockEvent = false;
 
     if (!PreCreation(parent, pos, size) ||
@@ -201,9 +195,6 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
                             const wxValidator& validator,
                             const wxString &name)
 {
-    m_needParent = true;
-    m_acceptsFocus = true;
-
     m_blockEvent = false;
 
     if (!PreCreation(parent, pos, size) ||
@@ -213,10 +204,10 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
         return false;
     }
 
-    wxControl::SetLabel(label);
-
     // Create the gtk widget.
-    m_widget = gtk_toggle_button_new_with_label( wxGTK_CONV( m_label ) );
+    m_widget = gtk_toggle_button_new_with_mnemonic("");
+
+    SetLabel(label);
 
     g_signal_connect (m_widget, "clicked",
                       G_CALLBACK (gtk_togglebutton_clicked_callback),
@@ -260,7 +251,11 @@ void wxToggleButton::SetLabel(const wxString& label)
 
     wxControl::SetLabel(label);
 
-    gtk_label_set_text(GTK_LABEL(GTK_BIN(m_widget)->child), wxGTK_CONV(GetLabel()));
+    const wxString labelGTK = GTKConvertMnemonics(label);
+
+    gtk_button_set_label(GTK_BUTTON(m_widget), wxGTK_CONV(labelGTK));
+
+    ApplyWidgetStyle( false );
 }
 
 bool wxToggleButton::Enable(bool enable /*=true*/)