]> git.saurik.com Git - wxWidgets.git/commitdiff
account for the scrollbars in GetViewRect()
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 14 Sep 2003 19:52:46 +0000 (19:52 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 14 Sep 2003 19:52:46 +0000 (19:52 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23585 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/listctrl.cpp

index 583333642acd0cb7ec9c8bd30e5c8a16dc20381c..750e3a7222f4bbfd12ee29ac45de831257b88b52 100644 (file)
@@ -3800,11 +3800,16 @@ wxRect wxListMainWindow::GetViewRect() const
         }
     }
 
-#if 0
-    // account for the scrollbar
-    yMax += wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y);
-    xMax += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
-#endif
+    // some fudge needed to make it look prettier
+    xMax += EXTRA_WIDTH;
+    yMax += EXTRA_HEIGHT;
+
+    // account for the scrollbars if necessary
+    const wxSize sizeAll = GetClientSize();
+    if ( xMax > sizeAll.x )
+        yMax += wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y);
+    if ( yMax > sizeAll.y )
+        xMax += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
 
     return wxRect(0, 0, xMax, yMax);
 }