X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bd1a4a99fc1bec4ac5d0b14379dc5345d6ce3253..94e0018723919fe2ca2f5b5f0a42804c16dbf3a1:/src/gtk1/stattext.cpp diff --git a/src/gtk1/stattext.cpp b/src/gtk1/stattext.cpp index 36d2e64fd5..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,13 +59,8 @@ bool wxStaticText::Create(wxWindow *parent, return FALSE; } - // the base class version which - // will 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 - wxString label1(wxStripMenuCodes(label)); - wxControl::SetLabel(label); - m_widget = gtk_label_new( wxGTK_CONV( label1 ) ); + m_label = label; + m_widget = gtk_label_new( wxGTK_CONV( GTKRemoveMnemonics(label)) ); GtkJustification justify; if ( style & wxALIGN_CENTER ) @@ -100,18 +93,13 @@ wxString wxStaticText::GetLabel() const void wxStaticText::SetLabel( const wxString &label ) { - wxControl::SetLabel(label); - - wxString label1(wxStripMenuCodes(label)); + wxCHECK_RET( m_widget != NULL, wxT("invalid static text") ); - gtk_label_set( GTK_LABEL(m_widget), wxGTK_CONV( label1 ) ); + 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 )