+ wxCHECK_RET( m_widget != NULL, wxT("invalid static text") );
+
+ GTKSetLabelForLabel(GTK_LABEL(m_widget), label);
+
+ // adjust the label size to the new label unless disabled
+ if (!HasFlag(wxST_NO_AUTORESIZE))
+ SetSize( GetBestSize() );
+}
+
+bool wxStaticText::SetFont( const wxFont &font )
+{
+ bool ret = wxControl::SetFont(font);
+
+ // adjust the label size to the new label unless disabled
+ if (!HasFlag(wxST_NO_AUTORESIZE))
+ {
+ InvalidateBestSize();
+ SetSize( GetBestSize() );
+ }
+ return ret;
+}
+
+void wxStaticText::DoSetSize(int x, int y,
+ int width, int height,
+ int sizeFlags )
+{
+ wxControl::DoSetSize( x, y, width, height, sizeFlags );
+}
+
+wxSize wxStaticText::DoGetBestSize() const
+{
+ // Do not return any arbitrary default value...
+ wxASSERT_MSG( m_widget, wxT("wxStaticText::DoGetBestSize called before creation") );
+
+ // This resets the internal GTK1 size calculation, which
+ // otherwise would be cashed (incorrectly)
+ gtk_label_set_pattern( GTK_LABEL(m_widget), NULL );
+
+ // GetBestSize is supposed to return unwrapped size
+ gtk_label_set_line_wrap( GTK_LABEL(m_widget), FALSE );
+
+ GtkRequisition req;
+ req.width = -1;
+ req.height = -1;
+ (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request )
+ (m_widget, &req );
+
+ gtk_label_set_line_wrap( GTK_LABEL(m_widget), TRUE );
+
+ return wxSize (req.width, req.height);
+}
+
+bool wxStaticText::SetForegroundColour(const wxColour& colour)
+{
+ // First, we call the base class member
+ wxControl::SetForegroundColour(colour);
+ // Then, to force the color change, we set the label with the current label
+ SetLabel(GetLabel());
+ return true;
+}
+
+// static
+wxVisualAttributes
+wxStaticText::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+ return GetDefaultAttributesFromGTKWidget(gtk_label_new);
+}
+
+#endif // wxUSE_STATTEXT