prevent the parent window from losing activation when a popup is shown

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15662 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-05-25 13:02:58 +00:00
parent d45bc43695
commit 7e25f59e48
7 changed files with 119 additions and 25 deletions

View File

@@ -39,6 +39,8 @@
#include "wx/msw/private.h"
#include "wx/popupwin.h"
#ifndef ICON_BIG
#define ICON_BIG 1
#endif
@@ -653,3 +655,41 @@ bool wxTopLevelWindowMSW::EnableCloseButton(bool enable)
return TRUE;
}
// ----------------------------------------------------------------------------
// wxTopLevelWindowMSW message processing
// ----------------------------------------------------------------------------
long wxTopLevelWindowMSW::HandleNcActivate(bool activate)
{
#if wxUSE_POPUPWIN
/*
Normally, when another top level (whether it is overlapped or popup)
window is shown, it is activated and the parent window (i.e. we) loses
the activation. This, however, looks very ugly when the child window is
a [custom] combobox which we implement using a popup window as surely
opening a combobox shouldn't result in deactivating the parent window.
So we don't redraw the title bar in this case, even if we still return
TRUE to let the change of activation to take place as otherwise the
controls inside the popup window wouldn't work properly.
*/
if ( !activate && wxPopupWindow::FindPopupFor(this) )
{
return TRUE;
}
#endif // wxUSE_POPUPWIN
return FALSE;
}
long
wxTopLevelWindowMSW::MSWWindowProc(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
{
if ( msg == WM_NCACTIVATE && HandleNcActivate(wParam != 0) )
{
// we processed WM_NCACTIVATE ourselves
return TRUE;
}
return wxTopLevelWindowBase::MSWWindowProc(msg, wParam, lParam);
}