wxScrolledWindow::GetVirtualSize now returns client size
authorJulian Smart <julian@anthemion.co.uk>
Wed, 10 Apr 2002 18:15:17 +0000 (18:15 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Wed, 10 Apr 2002 18:15:17 +0000 (18:15 +0000)
if scrolling parameters have not been set. This makes Layout()
work again for scrolled windows.

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

src/generic/scrlwing.cpp

index b19d93d85b57860fa5e4571a2fb6f9abaa19428a..904104e3713b42dbc0b3e74a7d6b94e2259c0ea9 100644 (file)
@@ -799,10 +799,24 @@ void wxScrollHelper::EnableScrolling (bool x_scroll, bool y_scroll)
 
 void wxScrollHelper::GetVirtualSize (int *x, int *y) const
 {
+    wxSize sz(0, 0);
+    if (m_targetWindow)
+        sz = m_targetWindow->GetClientSize();
+
     if ( x )
-        *x = m_xScrollPixelsPerLine * m_xScrollLines;
+    {
+        if (m_xScrollPixelsPerLine == 0)
+            *x = sz.x;
+        else
+            *x = m_xScrollPixelsPerLine * m_xScrollLines;
+    }
     if ( y )
-        *y = m_yScrollPixelsPerLine * m_yScrollLines;
+    {
+        if (m_yScrollPixelsPerLine == 0)
+            *y = sz.y;
+        else
+            *y = m_yScrollPixelsPerLine * m_yScrollLines;
+    }
 }
 
 // Where the current view starts from