X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3cbab64109b007fa1d939fe588f5e79f9105b915..64ea838d8f4d1853b7d850db93ee565e901d099a:/src/gtk1/stattext.cpp diff --git a/src/gtk1/stattext.cpp b/src/gtk1/stattext.cpp index b8d9145e50..d3b0f138f0 100644 --- a/src/gtk1/stattext.cpp +++ b/src/gtk1/stattext.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: stattext.cpp +// Name: src/gtk1/stattext.cpp // Purpose: // Author: Robert Roebling // Id: $Id$ @@ -27,8 +27,6 @@ void wxgtk_window_size_request_callback(GtkWidget *widget, // wxStaticText //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxStaticText,wxControl) - wxStaticText::wxStaticText() { } @@ -61,12 +59,8 @@ bool wxStaticText::Create(wxWindow *parent, return FALSE; } - // notice that we call the base class version which will just remove the - // '&' characters from the string, but not set the label's text to it - // because the label is not yet created and because SetLabel() has a side - // effect of changing the control size which might not be desirable - wxControl::SetLabel(label); - m_widget = gtk_label_new( wxGTK_CONV( m_label ) ); + m_label = label; + m_widget = gtk_label_new( wxGTK_CONV( GTKRemoveMnemonics(label)) ); GtkJustification justify; if ( style & wxALIGN_CENTER ) @@ -99,16 +93,13 @@ wxString wxStaticText::GetLabel() const void wxStaticText::SetLabel( const wxString &label ) { - wxControl::SetLabel(label); + wxCHECK_RET( m_widget != NULL, wxT("invalid static text") ); - gtk_label_set( GTK_LABEL(m_widget), wxGTK_CONV( m_label ) ); + GTKSetLabelForLabel(GTK_LABEL(m_widget), label); // adjust the label size to the new label unless disabled if (!HasFlag(wxST_NO_AUTORESIZE)) - { - InvalidateBestSize(); SetSize( GetBestSize() ); - } } bool wxStaticText::SetFont( const wxFont &font )