X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/952f8d3c7a729127bf73ba4f819cbadc51753e79..96b2cbe8b39292fed91654ff0d1f4b1c16561acb:/src/msw/dialog.cpp diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index 0a923fccce..1b66274cc1 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -185,8 +185,13 @@ bool wxDialog::Create(wxWindow *parent, #endif if ( HasFlag(wxRESIZE_BORDER) ) + { CreateGripper(); + Connect(wxEVT_CREATE, + wxWindowCreateEventHandler(wxDialog::OnWindowCreate)); + } + return true; } @@ -256,13 +261,15 @@ bool wxDialog::Show(bool show) if ( show ) { - // dialogs don't get WM_SIZE message after creation unlike most (all?) - // other windows and so could start their life non laid out correctly - // if we didn't call Layout() from here + // dialogs don't get WM_SIZE message from ::ShowWindow() for some + // reason so generate it ourselves for consistency with frames and + // dialogs in other ports // // NB: normally we should call it just the first time but doing it // every time is simpler than keeping a flag - Layout(); + const wxSize size = GetClientSize(); + ::SendMessage(GetHwnd(), WM_SIZE, + SIZE_RESTORED, MAKELPARAM(size.x, size.y)); } return true; @@ -276,7 +283,7 @@ void wxDialog::Raise() // show dialog modally int wxDialog::ShowModal() { - wxASSERT_MSG( !IsModal(), _T("wxDialog::ShowModal() reentered?") ); + wxASSERT_MSG( !IsModal(), _T("ShowModal() can't be called twice") ); m_endModalCalled = false; @@ -382,6 +389,11 @@ void wxDialog::DestroyGripper() { if ( m_hGripper ) { + // we used to have trouble with gripper appearing on top (and hence + // overdrawing) the other, real, dialog children -- check that this + // isn't the case automatically + wxASSERT_MSG( ::GetNextWindow((HWND)m_hGripper, GW_HWNDNEXT) == 0, + _T("Bug in wxWidgets: gripper should be at the bottom of Z-order") ); ::DestroyWindow((HWND) m_hGripper); m_hGripper = 0; } @@ -412,6 +424,19 @@ void wxDialog::ResizeGripper() SWP_NOACTIVATE); } +void wxDialog::OnWindowCreate(wxWindowCreateEvent& event) +{ + if ( m_hGripper && IsShown() && + event.GetWindow() && event.GetWindow()->GetParent() == this ) + { + // Put gripper below the newly created child window + ::SetWindowPos((HWND)m_hGripper, HWND_BOTTOM, 0, 0, 0, 0, + SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); + } + + event.Skip(); +} + // ---------------------------------------------------------------------------- // wxWin event handlers // ---------------------------------------------------------------------------- @@ -520,20 +545,6 @@ WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar } break; - case WM_WINDOWPOSCHANGED: - { - WINDOWPOS * const wp = wx_reinterpret_cast(WINDOWPOS *, lParam); - if ( wp->flags & SWP_SHOWWINDOW ) - { - // we should only show it now to ensure that it's really - // positioned underneath under all the other controls in - // the dialog, if we showed it before it could overlap them - if ( m_hGripper ) - ShowGripper(true); - } - } - break; - #ifndef __WXMICROWIN__ case WM_SETCURSOR: // we want to override the busy cursor for modal dialogs: