Hide tooltip when its associated window is hidden in wxMSW.
Don't leave the tooltip shown on screen if the window it was shown for was hidden or iconized (without moving the mouse, as that would have dismissed the tooltip as well). Closes #16265. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76657 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -298,6 +298,40 @@ WXHWND wxToolTip::GetToolTipCtrl()
|
||||
return ms_hwndTT;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void wxToolTip::UpdateVisibility()
|
||||
{
|
||||
wxToolInfo ti(NULL, 0, wxRect());
|
||||
ti.uFlags = 0;
|
||||
|
||||
if ( !SendTooltipMessage(ms_hwndTT, TTM_GETCURRENTTOOL, &ti) )
|
||||
return;
|
||||
|
||||
wxWindow* const associatedWindow = wxFindWinFromHandle(ti.hwnd);
|
||||
if ( !associatedWindow )
|
||||
return;
|
||||
|
||||
bool hideTT = false;
|
||||
if ( !associatedWindow->IsShownOnScreen() )
|
||||
{
|
||||
// If the associated window or its parent is hidden, the tooltip
|
||||
// shouldn't remain shown.
|
||||
hideTT = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Even if it's not hidden, it could also be iconized.
|
||||
wxTopLevelWindow* const
|
||||
frame = wxDynamicCast(wxGetTopLevelParent(associatedWindow), wxTopLevelWindow);
|
||||
|
||||
if ( frame && frame->IsIconized() )
|
||||
hideTT = true;
|
||||
}
|
||||
|
||||
if ( hideTT )
|
||||
::ShowWindow(ms_hwndTT, SW_HIDE);
|
||||
}
|
||||
|
||||
/* static */
|
||||
void wxToolTip::RelayEvent(WXMSG *msg)
|
||||
{
|
||||
|
Reference in New Issue
Block a user