don't call gtk_label_set_line_wrap() from DoGetBestSize() as this results in an infinite resizing loop when the control is inside a GTK+ widget doing its own layout (such as wxToolBar)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45131 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-03-30 12:14:23 +00:00
parent 2e61f68141
commit 61053de43b
2 changed files with 9 additions and 3 deletions

View File

@@ -123,9 +123,12 @@ wxMSW:
- Don't lose combobox text when it's opened and closed (Kolya Kosenko) - Don't lose combobox text when it's opened and closed (Kolya Kosenko)
- Corrected GetChecked() for events from checkable menu items (smanders) - Corrected GetChecked() for events from checkable menu items (smanders)
- Fixed popup menus under Windows NT 4 - Fixed popup menus under Windows NT 4
- Fixed bug in wxThread::Wait() in console applications introduced in 2.8.3
- Compilation fixed with WXWIN_COMPATIBILITY_2_6==0
wxGTK: wxGTK:
- Fix infinite loop when adding a wxStaticText control to a toolbar
- Fix wxNO_BORDER style for wxRadioBox (David Hart) - Fix wxNO_BORDER style for wxRadioBox (David Hart)

View File

@@ -178,8 +178,11 @@ wxSize wxStaticText::DoGetBestSize() const
// Do not return any arbitrary default value... // Do not return any arbitrary default value...
wxASSERT_MSG( m_widget, wxT("wxStaticText::DoGetBestSize called before creation") ); wxASSERT_MSG( m_widget, wxT("wxStaticText::DoGetBestSize called before creation") );
// GetBestSize is supposed to return unwrapped size // GetBestSize is supposed to return unwrapped size but calling
gtk_label_set_line_wrap( GTK_LABEL(m_widget), FALSE ); // 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; GtkRequisition req;
req.width = -1; req.width = -1;
@@ -187,7 +190,7 @@ wxSize wxStaticText::DoGetBestSize() const
(* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request ) (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request )
(m_widget, &req ); (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 // Adding 1 to width to workaround GTK sometimes wrapping the text needlessly
return wxSize (req.width+1, req.height); return wxSize (req.width+1, req.height);