]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/mdi.cpp
fatal bug in wxSplitPath fixed
[wxWidgets.git] / src / msw / mdi.cpp
index 19d9e410cf5dc537485ea7a182600bd1e7117923..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)
@@ -724,7 +724,7 @@ void wxMDIChildFrame::DoSetClientSize(int width, int height)
   int actual_width = rect2.right - rect2.left - rect.right + width;
   int actual_height = rect2.bottom - rect2.top - rect.bottom + height;
 
-  if (GetStatusBar())
+  if (GetStatusBar() && GetStatusBar()->IsShown())
   {
     int sx, sy;
     GetStatusBar()->GetSize(&sx, &sy);
@@ -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;
     }
 
@@ -1033,7 +988,7 @@ bool wxMDIChildFrame::HandleWindowPosChanging(void *pos)
             lpPos->cy = rectClient.bottom - rectClient.top;
         }
         wxMDIParentFrame* pFrameWnd = (wxMDIParentFrame *)GetParent();
-        if (pFrameWnd && pFrameWnd->GetToolBar())
+        if (pFrameWnd && pFrameWnd->GetToolBar() && pFrameWnd->GetToolBar()->IsShown())
         {
             pFrameWnd->GetToolBar()->Refresh();
         }
@@ -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
 // ---------------------------------------------------------------------------