justify = GTK_JUSTIFY_RIGHT;
else // wxALIGN_LEFT is 0
justify = GTK_JUSTIFY_LEFT;
-
+
if (GetLayoutDirection() == wxLayout_RightToLeft)
- {
+ {
if (justify == GTK_JUSTIFY_RIGHT)
justify = GTK_JUSTIFY_LEFT;
if (justify == GTK_JUSTIFY_LEFT)
justify = GTK_JUSTIFY_RIGHT;
}
-
+
gtk_label_set_justify(GTK_LABEL(m_widget), justify);
// GTK_JUSTIFY_LEFT is 0, RIGHT 1 and CENTER 2
PangoAttrList *attrs = pango_attr_list_new();
PangoAttribute *a = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
a->start_index = 0;
- a->end_index = -1;
+ 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);
// Do not return any arbitrary default value...
wxASSERT_MSG( m_widget, wxT("wxStaticText::DoGetBestSize called before creation") );
- // GetBestSize is supposed to return unwrapped size
- gtk_label_set_line_wrap( GTK_LABEL(m_widget), FALSE );
+ // 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;
GtkRequisition req;
req.width = -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 );
+ GTK_LABEL(m_widget)->wrap = TRUE; // restore old value
// Adding 1 to width to workaround GTK sometimes wrapping the text needlessly
return wxSize (req.width+1, req.height);