]> git.saurik.com Git - wxWidgets.git/commitdiff
Added fix to wxMDIClientWindow to redisplay contents when
authorJulian Smart <julian@anthemion.co.uk>
Fri, 25 Feb 2000 15:16:39 +0000 (15:16 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 25 Feb 2000 15:16:39 +0000 (15:16 +0000)
window is repositioned

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6285 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/mdi.h
src/msw/mdi.cpp
utils/ogl/samples/studio/mainfrm.cpp

index 62d3657dd3eb86955b332830db28443a30ee7e08..319d880da3f2476a14617b10e3c5e989bb478a44 100644 (file)
@@ -197,6 +197,9 @@ public:
     // Explicitly call default scroll behaviour
     void OnScroll(wxScrollEvent& event);
 
+    virtual void DoSetSize(int x, int y,
+                           int width, int height,
+                           int sizeFlags = wxSIZE_AUTO);
 protected:
     void Init() { m_scrollX = m_scrollY = 0; }
 
index 4a024cd1a84593908b3cacd5229d885880c133fd..a9c6967d6390179954f21c7f12ea72ad745ce9b2 100644 (file)
@@ -1155,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
 // ---------------------------------------------------------------------------
index 77c1751ac339454a6529e265e41d959b456b202d..c1d856c30122214b4f0691ddffbcef1c426b9c5e 100644 (file)
@@ -187,8 +187,10 @@ void csFrame::OnIdle(wxIdleEvent& event)
         // window doesn't cause the proper refresh. Just refreshing the
         // client doesn't work (presumably because it's clipping the
         // children).
-        // TODO: how to put this fix in wxWindows, and not the app.
-        // How about at least having a wxWindow::RedrawWindow?
+        // FIXED in wxWindows, by intercepting wxMDIClientWindow::DoSetSize
+        // and checking if the position has changed, before redrawing the
+        // child windows.
+#if 0
         wxMDIChildFrame* childFrame = GetActiveChild();
         if (childFrame)
         {
@@ -196,6 +198,7 @@ void csFrame::OnIdle(wxIdleEvent& event)
             ::RedrawWindow(hWnd, NULL, NULL, RDW_FRAME|RDW_ALLCHILDREN|RDW_INVALIDATE );
 
         }
+#endif
 #endif
     }
 }