Include wx/intl.h according to precompiled headers of wx/wx.h (with other minor clean...
[wxWidgets.git] / src / generic / vscroll.cpp
index 3fc8a940d5f5ab6e6b1438225f6dbfda3a5d3a06..609d6e0f52fb41ef74da72cce9b1d5dc1ee8f0b6 100644 (file)
 #pragma hdrstop
 #endif
 
+#ifndef WX_PRECOMP
+    #include "wx/sizer.h"
+#endif
+
 #include "wx/vscroll.h"
 
 // ----------------------------------------------------------------------------
@@ -282,6 +286,27 @@ void wxVScrolledWindow::RefreshAll()
     Refresh();
 }
 
+bool wxVScrolledWindow::Layout()
+{
+    if ( GetSizer() )
+    {
+        // adjust the sizer dimensions/position taking into account the
+        // virtual size and scrolled position of the window.
+
+        int w, h;
+        GetVirtualSize(&w, &h);
+
+        // x is always 0 so no variable needed
+        int y = -GetLinesHeight(0, GetFirstVisibleLine());
+
+        GetSizer()->SetDimension(0, y, w, h);
+        return true;
+    }
+
+    // fall back to default for LayoutConstraints
+    return wxPanel::Layout();
+}
+
 int wxVScrolledWindow::HitTest(wxCoord WXUNUSED(x), wxCoord y) const
 {
     const size_t lineMax = GetVisibleEnd();