1. wxWindowDisabler modified to bring parent window back to top under MSW
2. modal dialogs without parent now use the app top window as parent or use wxWindowDisabler if none 3. modal dialogs bring parent windows to top when activated 4. wxBase dsp will now compile it with MT CRT git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6451 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -419,8 +419,29 @@ bool wxDialog::Show(bool show)
|
||||
// Replacement for Show(TRUE) for modal dialogs - returns return code
|
||||
int wxDialog::ShowModal()
|
||||
{
|
||||
// modal dialog needs a parent window, so try to find one
|
||||
if ( !GetParent() )
|
||||
{
|
||||
wxWindow *parent = wxTheApp->GetTopWindow();
|
||||
if ( parent && parent != this )
|
||||
{
|
||||
// use it
|
||||
m_parent = parent;
|
||||
}
|
||||
}
|
||||
|
||||
wxWindowDisabler *wd = (wxWindowDisabler *)NULL;
|
||||
if ( !GetParent() )
|
||||
{
|
||||
// still no parent? make the dialog app modal by disabling all windows
|
||||
wd = new wxWindowDisabler(this);
|
||||
}
|
||||
|
||||
m_windowStyle |= wxDIALOG_MODAL;
|
||||
Show(TRUE);
|
||||
|
||||
delete wd;
|
||||
|
||||
return GetReturnCode();
|
||||
}
|
||||
|
||||
@@ -521,6 +542,33 @@ long wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
|
||||
switch ( message )
|
||||
{
|
||||
case WM_ACTIVATE:
|
||||
switch ( LOWORD(wParam) )
|
||||
{
|
||||
case WA_ACTIVE:
|
||||
case WA_CLICKACTIVE:
|
||||
if ( IsModalShowing() && GetParent() )
|
||||
{
|
||||
// bring the owner window to top as the standard dialog
|
||||
// boxes do
|
||||
if ( !::SetWindowPos
|
||||
(
|
||||
GetHwndOf(GetParent()),
|
||||
GetHwnd(),
|
||||
0, 0,
|
||||
0, 0,
|
||||
SWP_NOACTIVATE |
|
||||
SWP_NOMOVE |
|
||||
SWP_NOSIZE
|
||||
) )
|
||||
{
|
||||
wxLogLastError("SetWindowPos(SWP_NOACTIVATE)");
|
||||
}
|
||||
}
|
||||
// fall through to process it normally as well
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
// if we can't close, tell the system that we processed the
|
||||
// message - otherwise it would close us
|
||||
|
Reference in New Issue
Block a user