only set maximal tooltip width if it's greater than the previously set one to avoid breaking long lines if a shorter tooltip is added afterwards (see #10537)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59366 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2009-03-06 10:54:56 +00:00
parent 78e7881208
commit d90ef8e4c2

View File

@ -394,9 +394,16 @@ void wxToolTip::Add(WXHWND hWnd)
if ( ms_maxWidth != -1 && maxWidth > ms_maxWidth )
maxWidth = ms_maxWidth;
// only set a new width if it is bigger than the current setting
SendTooltipMessage(GetToolTipCtrl(), TTM_SETMAXTIPWIDTH,
wxUIntToPtr(maxWidth));
// only set a new width if it is bigger than the current setting:
// otherwise adding a tooltip with shorter line(s) than a previous
// one would result in breaking the longer lines unnecessarily as
// all our tooltips share the same maximal width
if ( maxWidth > SendTooltipMessage(GetToolTipCtrl(),
TTM_GETMAXTIPWIDTH, 0) )
{
SendTooltipMessage(GetToolTipCtrl(), TTM_SETMAXTIPWIDTH,
wxUIntToPtr(maxWidth));
}
}
else
#endif // TTM_SETMAXTIPWIDTH