]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/tglbtn.cpp
truncate the static box label to fit the control size (patch 1695228)
[wxWidgets.git] / src / gtk / tglbtn.cpp
index 1e7e2acfc56d9ea9a8d5bdae9b421c98f8b55ec3..134fa7a9d5c8ef60c80260b1c156b63e671c7af5 100644 (file)
@@ -59,7 +59,6 @@ bool wxToggleBitmapButton::Create(wxWindow *parent, wxWindowID id,
                             const wxString &name)
 {
     m_needParent = true;
-    m_acceptsFocus = true;
 
     m_blockEvent = false;
 
@@ -202,7 +201,6 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
                             const wxString &name)
 {
     m_needParent = true;
-    m_acceptsFocus = true;
 
     m_blockEvent = false;
 
@@ -213,10 +211,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 +258,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*/)