ensure that dialog gripper is always positioned below the other children, even if they're created after it (#9519)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54009 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-06-07 02:04:16 +00:00
parent 533171c287
commit eddc468e25
2 changed files with 28 additions and 0 deletions

View File

@@ -116,6 +116,11 @@ protected:
void ResizeGripper(); void ResizeGripper();
private: private:
// this function is used to adjust Z-order of new children relative to the
// gripper if we have one
void OnWindowCreate(wxWindowCreateEvent& event);
wxWindow* m_oldFocus; wxWindow* m_oldFocus;
bool m_endModalCalled; // allow for closing within InitDialog bool m_endModalCalled; // allow for closing within InitDialog

View File

@@ -185,8 +185,13 @@ bool wxDialog::Create(wxWindow *parent,
#endif #endif
if ( HasFlag(wxRESIZE_BORDER) ) if ( HasFlag(wxRESIZE_BORDER) )
{
CreateGripper(); CreateGripper();
Connect(wxEVT_CREATE,
wxWindowCreateEventHandler(wxDialog::OnWindowCreate));
}
return true; return true;
} }
@@ -384,6 +389,11 @@ void wxDialog::DestroyGripper()
{ {
if ( m_hGripper ) 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); ::DestroyWindow((HWND) m_hGripper);
m_hGripper = 0; m_hGripper = 0;
} }
@@ -414,6 +424,19 @@ void wxDialog::ResizeGripper()
SWP_NOACTIVATE); 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 // wxWin event handlers
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------