]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/mdi.cpp
Added event sample to VC+ project file
[wxWidgets.git] / src / msw / mdi.cpp
index 2aa8a208f79aa56444bccdad069a41992dfbd650..0250f4c389c6a95b4850f2b9c6102a9c65556801 100644 (file)
@@ -1088,25 +1088,31 @@ bool wxMDIChildFrame::ResetWindowStyle(void *vrect)
     wxMDIChildFrame* pChild = pFrameWnd->GetActiveChild();
     if (!pChild || (pChild == this))
     {
-        DWORD dwStyle = ::GetWindowLong(GetWinHwnd(pFrameWnd->GetClientWindow()), GWL_EXSTYLE);
-        DWORD dwThisStyle = ::GetWindowLong(GetHwnd(), GWL_STYLE);
+        HWND hwndClient = GetWinHwnd(pFrameWnd->GetClientWindow());
+        DWORD dwStyle = ::GetWindowLong(hwndClient, GWL_EXSTYLE);
+
+        // we want to test whether there is a maximized child, so just set
+        // dwThisStyle to 0 if there is no child at all
+        DWORD dwThisStyle = pChild
+            ? ::GetWindowLong(GetWinHwnd(pChild), GWL_STYLE) : NULL;
         DWORD dwNewStyle = dwStyle;
-        if (pChild != NULL && (dwThisStyle & WS_MAXIMIZE))
+        if ( dwThisStyle & WS_MAXIMIZE )
             dwNewStyle &= ~(WS_EX_CLIENTEDGE);
         else
             dwNewStyle |= WS_EX_CLIENTEDGE;
 
         if (dwStyle != dwNewStyle)
         {
-            HWND hwnd = GetWinHwnd(pFrameWnd->GetClientWindow());
-            ::RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);
-            ::SetWindowLong(hwnd, GWL_EXSTYLE, dwNewStyle);
-            ::SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
+            // force update of everything
+            ::RedrawWindow(hwndClient, NULL, NULL,
+                           RDW_INVALIDATE | RDW_ALLCHILDREN);
+            ::SetWindowLong(hwndClient, GWL_EXSTYLE, dwNewStyle);
+            ::SetWindowPos(hwndClient, NULL, 0, 0, 0, 0,
                            SWP_FRAMECHANGED | SWP_NOACTIVATE |
                            SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
                            SWP_NOCOPYBITS);
             if (rect)
-                ::GetClientRect(hwnd, rect);
+                ::GetClientRect(hwndClient, rect);
 
             return TRUE;
         }
@@ -1134,7 +1140,7 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
         ccs.hWindowMenu = (HMENU) parent->GetWindowMenu()->GetHMenu();
     ccs.idFirstChild = wxFIRST_MDI_CHILD;
 
-    DWORD msStyle = WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN;
+    DWORD msStyle = MDIS_ALLCHILDSTYLES | WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN;
     if ( style & wxHSCROLL )
         msStyle |= WS_HSCROLL;
     if ( style & wxVSCROLL )