/////////////////////////////////////////////////////////////////////////////
-// Name: stattext.cpp
+// Name: src/gtk1/stattext.cpp
// Purpose:
// Author: Robert Roebling
-// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// wxStaticText
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxStaticText,wxControl)
-
wxStaticText::wxStaticText()
{
}
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 )
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 )