From: Robert Roebling Date: Sun, 15 Oct 2006 20:12:41 +0000 (+0000) Subject: Implement mnemnic support for wxToggleButton. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ecf3b4a57f0aeebd47e247c721d499d42798fe33?ds=sidebyside Implement mnemnic support for wxToggleButton. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42043 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/tglbtn.cpp b/src/gtk/tglbtn.cpp index 1e7e2acfc5..c90a09ec6d 100644 --- a/src/gtk/tglbtn.cpp +++ b/src/gtk/tglbtn.cpp @@ -213,10 +213,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 +260,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*/)