]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/mdi.cpp
added missing include mdi.h
[wxWidgets.git] / src / msw / mdi.cpp
index 8e213d82129e1bce3be7df131b6a89f9eb2ee02d..a9c6967d6390179954f21c7f12ea72ad745ce9b2 100644 (file)
@@ -122,9 +122,9 @@ static void UnpackMDIActivate(WXWPARAM wParam, WXLPARAM lParam,
 // wxWin macros
 // ---------------------------------------------------------------------------
 
-    IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
-    IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
-    IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
+IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
+IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
+IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
 
 BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
     EVT_SIZE(wxMDIParentFrame::OnSize)
@@ -881,51 +881,6 @@ long wxMDIChildFrame::MSWWindowProc(WXUINT message,
     return rc;
 }
 
-bool wxMDIChildFrame::HandleSize(int x, int y, WXUINT id)
-{
-    HWND hwnd = GetHwnd();
-
-    if ( !hwnd || hwnd == invalidHandle )
-    {
-        return FALSE;
-    }
-
-    switch (id)
-    {
-        case SIZEFULLSCREEN:
-        case SIZENORMAL:
-            m_iconized = FALSE;
-            break;
-
-        case SIZEICONIC:
-            m_iconized = TRUE;
-            break;
-    }
-
-    if ( !m_iconized )
-    {
-        // forward WM_SIZE to status bar control
-#if wxUSE_NATIVE_STATUSBAR
-        if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95)))
-        {
-            wxSizeEvent event(wxSize(x, y), m_frameStatusBar->GetId());
-            event.SetEventObject( m_frameStatusBar );
-
-            ((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
-        }
-#endif // wxUSE_NATIVE_STATUSBAR
-
-        PositionStatusBar();
-        PositionToolBar();
-
-        return wxWindow::HandleSize(x, y, id);
-    }
-    else
-    {
-        return FALSE;
-    }
-}
-
 bool wxMDIChildFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd)
 {
     // In case it's e.g. a toolbar.
@@ -996,7 +951,7 @@ bool wxMDIChildFrame::HandleMDIActivate(long WXUNUSED(activate),
     }
     else
     {
-        // we have nothing to with it
+        // we have nothing to do with it
         return FALSE;
     }
 
@@ -1076,6 +1031,10 @@ void wxMDIChildFrame::MSWDestroyWindow()
     HWND oldHandle = (HWND)GetHWND();
     SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIDESTROY,
                 (WPARAM)oldHandle, 0);
+
+    if (parent->GetActiveChild() == (wxMDIChildFrame*) NULL)
+        ResetWindowStyle((void*) NULL);
+
     invalidHandle = 0;
 
     if (m_hMenu)
@@ -1196,6 +1155,38 @@ void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
     event.Skip();
 }
 
+void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
+{
+    // Try to fix a problem whereby if you show an MDI child frame, then reposition the
+    // client area, you can end up with a non-refreshed portion in the client window
+    // (see OGL studio sample). So check if the position is changed and if so,
+    // redraw the MDI child frames.
+
+    wxPoint oldPos = GetPosition();
+
+    wxWindow::DoSetSize(x, y, width, height, sizeFlags);
+
+    wxPoint newPos = GetPosition();
+
+    if ((newPos.x != oldPos.x) || (newPos.y != oldPos.y))
+    {
+        if (GetParent())
+        {
+            wxNode* node = GetParent()->GetChildren().First();
+            while (node)
+            {
+                wxWindow* child = (wxWindow*) node->Data();
+                if (child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
+                {
+                    HWND hWnd = (HWND) child->GetHWND();
+                   ::RedrawWindow(hWnd, NULL, NULL, RDW_FRAME|RDW_ALLCHILDREN|RDW_INVALIDATE );
+                }
+                node = node->Next();
+            }
+        }
+    }
+}
+
 // ---------------------------------------------------------------------------
 // non member functions
 // ---------------------------------------------------------------------------