+ if ( wasUnderlined )
+ {
+ // it's not underlined any more, remove the attributes we set
+ gtk_label_set_attributes(GTK_LABEL(m_widget), NULL);
+ }
+ else // the text is underlined now
+ {
+ PangoAttrList *attrs = pango_attr_list_new();
+ PangoAttribute *a = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
+ a->start_index = 0;
+ a->end_index = (guint)-1;
+ pango_attr_list_insert(attrs, a);
+ gtk_label_set_attributes(GTK_LABEL(m_widget), attrs);
+ pango_attr_list_unref(attrs);
+ }
+ }
+
+ // 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 );
+
+ if (gtk_check_version(2,6,0))
+ {
+ // GTK+ < 2.6 does not support ellipsization - we need to run our
+ // generic code (actually it will be run only if IsEllipsized() == true)
+ UpdateLabel();
+ }
+}
+
+wxSize wxStaticText::DoGetBestSize() const
+{
+ // Do not return any arbitrary default value...
+ wxASSERT_MSG( m_widget, wxT("wxStaticText::DoGetBestSize called before creation") );
+
+ // GetBestSize is supposed to return unwrapped size but calling
+ // gtk_label_set_line_wrap() from here is a bad idea as it queues another
+ // size request by calling gtk_widget_queue_resize() and we end up in
+ // infinite loop sometimes (notably when the control is in a toolbar)
+ GTK_LABEL(m_widget)->wrap = FALSE;