]> git.saurik.com Git - wxWidgets.git/commitdiff
delay gripper positioning until the dialog is shown to ensure that it doesn't overwri...
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 14 May 2008 00:53:16 +0000 (00:53 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 14 May 2008 00:53:16 +0000 (00:53 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/dialog.cpp

index 64d7f61bc6c404f8708f98cef6e13f6350c54945..0a923fccce87413cb2ca49c6031f4217c065fee3 100644 (file)
@@ -184,7 +184,7 @@ bool wxDialog::Create(wxWindow *parent,
     CreateToolBar();
 #endif
 
     CreateToolBar();
 #endif
 
-    if( HasFlag(wxRESIZE_BORDER) )
+    if ( HasFlag(wxRESIZE_BORDER) )
         CreateGripper();
 
     return true;
         CreateGripper();
 
     return true;
@@ -349,7 +349,7 @@ void wxDialog::SetWindowStyleFlag(long style)
 {
     wxDialogBase::SetWindowStyleFlag(style);
 
 {
     wxDialogBase::SetWindowStyleFlag(style);
 
-    if( HasFlag(wxRESIZE_BORDER) )
+    if ( HasFlag(wxRESIZE_BORDER) )
         CreateGripper();
     else
         DestroyGripper();
         CreateGripper();
     else
         DestroyGripper();
@@ -357,13 +357,15 @@ void wxDialog::SetWindowStyleFlag(long style)
 
 void wxDialog::CreateGripper()
 {
 
 void wxDialog::CreateGripper()
 {
-    if( !m_hGripper )
+    if ( !m_hGripper )
     {
     {
+        // just create it here, it will be positioned and shown later
         m_hGripper = (WXHWND)::CreateWindow
                                (
                                     wxT("SCROLLBAR"),
                                     wxT(""),
         m_hGripper = (WXHWND)::CreateWindow
                                (
                                     wxT("SCROLLBAR"),
                                     wxT(""),
-                                    WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
+                                    WS_CHILD |
+                                    WS_CLIPSIBLINGS |
                                     SBS_SIZEGRIP |
                                     SBS_SIZEBOX |
                                     SBS_SIZEBOXBOTTOMRIGHTALIGN,
                                     SBS_SIZEGRIP |
                                     SBS_SIZEBOX |
                                     SBS_SIZEBOXBOTTOMRIGHTALIGN,
@@ -373,9 +375,6 @@ void wxDialog::CreateGripper()
                                     wxGetInstance(),
                                     NULL
                                );
                                     wxGetInstance(),
                                     NULL
                                );
-
-        // position the gripper correctly after creation
-        ResizeGripper();
     }
 }
 
     }
 }
 
@@ -392,6 +391,9 @@ void wxDialog::ShowGripper(bool show)
 {
     wxASSERT_MSG( m_hGripper, _T("shouldn't be called if we have no gripper") );
 
 {
     wxASSERT_MSG( m_hGripper, _T("shouldn't be called if we have no gripper") );
 
+    if ( show )
+        ResizeGripper();
+
     ::ShowWindow((HWND)m_hGripper, show ? SW_SHOW : SW_HIDE);
 }
 
     ::ShowWindow((HWND)m_hGripper, show ? SW_SHOW : SW_HIDE);
 }
 
@@ -501,10 +503,6 @@ WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar
 
                     case SIZE_RESTORED:
                         ShowGripper(true);
 
                     case SIZE_RESTORED:
                         ShowGripper(true);
-                        // fall through
-
-                    default:
-                        ResizeGripper();
                 }
             }
 
                 }
             }
 
@@ -522,6 +520,20 @@ WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar
             }
             break;
 
             }
             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:
 #ifndef __WXMICROWIN__
         case WM_SETCURSOR:
             // we want to override the busy cursor for modal dialogs: