]> git.saurik.com Git - wxWidgets.git/commitdiff
ensure that dialog gripper is always positioned below the other children, even if...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 7 Jun 2008 02:04:16 +0000 (02:04 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 7 Jun 2008 02:04:16 +0000 (02:04 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54009 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/dialog.h
src/msw/dialog.cpp

index cf91c11961f56365a05127c8434c1740f475c8c8..c9da9e53d27e9dcad2a27f730ce8223514388a95 100644 (file)
@@ -116,6 +116,11 @@ protected:
     void ResizeGripper();
 
 private:
     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
 
     wxWindow*   m_oldFocus;
     bool        m_endModalCalled; // allow for closing within InitDialog
 
index d89e8ede2c441173a7f25cd59a8475d50af5a440..9d28a6e039b52c7f525661fd99fec7dca691ee20 100644 (file)
@@ -185,8 +185,13 @@ bool wxDialog::Create(wxWindow *parent,
 #endif
 
     if ( HasFlag(wxRESIZE_BORDER) )
 #endif
 
     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);
         m_hGripper = 0;
     }
         ::DestroyWindow((HWND) m_hGripper);
         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
 // ----------------------------------------------------------------------------