]> git.saurik.com Git - wxWidgets.git/blobdiff - src/dfb/window.cpp
Layout correction
[wxWidgets.git] / src / dfb / window.cpp
index 70ee92126693fe889df78b99dff7975769c52e71..c115e67ab9d9b49e78933bf2f31414ed07b0a400 100644 (file)
@@ -28,6 +28,7 @@
 
 #ifndef WX_PRECOMP
     #include "wx/dcclient.h"
+    #include "wx/nonownedwnd.h"
 #endif
 
 #include "wx/caret.h"
@@ -492,6 +493,15 @@ void wxWindowDFB::DoMoveWindow(int x, int y, int width, int height)
     {
         // queue both former and new position of the window for repainting:
         wxWindow *parent = GetParent();
+
+        // only refresh the visible parts:
+        if ( !CanBeOutsideClientArea() )
+        {
+            wxRect parentClient(parent->GetClientSize());
+            oldpos.Intersect(parentClient);
+            newpos.Intersect(parentClient);
+        }
+
         parent->RefreshRect(oldpos);
         parent->RefreshRect(newpos);
     }
@@ -682,6 +692,11 @@ void wxWindowDFB::DoRefreshRect(const wxRect& rect)
     r.Offset(GetPosition());
     r.Offset(parent->GetClientAreaOrigin());
 
+    // normal windows cannot extend out of its parent's client area, so don't
+    // refresh any hidden parts:
+    if ( !CanBeOutsideClientArea() )
+        r.Intersect(parent->GetClientRect());
+
     parent->DoRefreshRect(r);
 }
 
@@ -763,6 +778,10 @@ void wxWindowDFB::PaintWindow(const wxRect& rect)
 
     m_updateRegion.Clear();
 
+    // client area portion of 'rect':
+    wxRect rectClientOnly(rect);
+    rectClientOnly.Intersect(clientRect);
+
     // paint the children:
     wxPoint origin = GetClientAreaOrigin();
     wxWindowList& children = GetChildren();
@@ -777,7 +796,12 @@ void wxWindowDFB::PaintWindow(const wxRect& rect)
         // compute child's area to repaint
         wxRect childrect(child->GetRect());
         childrect.Offset(origin);
-        childrect.Intersect(rect);
+
+        if ( child->CanBeOutsideClientArea() )
+            childrect.Intersect(rect);
+        else
+            childrect.Intersect(rectClientOnly);
+
         if ( childrect.IsEmpty() )
             continue;