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:
@@ -116,6 +116,11 @@ protected:
|
||||
void ResizeGripper();
|
||||
|
||||
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;
|
||||
bool m_endModalCalled; // allow for closing within InitDialog
|
||||
|
||||
|
@@ -185,8 +185,13 @@ bool wxDialog::Create(wxWindow *parent,
|
||||
#endif
|
||||
|
||||
if ( HasFlag(wxRESIZE_BORDER) )
|
||||
{
|
||||
CreateGripper();
|
||||
|
||||
Connect(wxEVT_CREATE,
|
||||
wxWindowCreateEventHandler(wxDialog::OnWindowCreate));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -384,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;
|
||||
}
|
||||
@@ -414,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
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user