Grow wxGenericProgressDialog automatically if needed

If the new message is longer than the previously shown one, increase the
dialog size to fit it, instead of truncating the message. Still don't do
anything if the new message is shorter to avoid unwanted constant
changes in the dialog size if the message keeps changing.

This is the original patch proposed in #10624, which it really makes
sense to apply now because it makes the generic version match the
behaviour of the native one under MSW (and the behaviour of the native
version cannot be changed).

See #10624.
This commit is contained in:
Andrew Radke 2017-10-27 01:43:10 +02:00 committed by Vadim Zeitlin
parent 0473d14ef1
commit 4101849b4d

View File

@ -765,8 +765,17 @@ void wxGenericProgressDialog::UpdateMessage(const wxString &newmsg)
{
if ( !newmsg.empty() && newmsg != m_msg->GetLabel() )
{
const wxSize sizeOld = m_msg->GetSize();
m_msg->SetLabel(newmsg);
if ( m_msg->GetSize().x > sizeOld.x )
{
// Resize the dialog to fit its new, longer contents instead of
// just truncating it.
Fit();
}
// allow the window to repaint:
// NOTE: since we yield only for UI events with this call, there
// should be no side-effects