]> git.saurik.com Git - wxWidgets.git/commitdiff
set up scrollbars correctly when we don't need them (fixes the problems reported...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 16 Apr 2006 01:14:28 +0000 (01:14 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 16 Apr 2006 01:14:28 +0000 (01:14 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38751 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/scrolwin.cpp

index 001017f7313327cc422443925e16e674e9014fc0..0ca01db2474961046ffd7ad01132826735a45f59 100644 (file)
@@ -81,7 +81,7 @@ void wxScrollHelperNative::DoAdjustScrollbar(GtkAdjustment *adj,
                                              int *lines,
                                              int *linesPerPage)
 {
-    if ( pixelsPerLine == 0 )
+    if ( pixelsPerLine == 0 || winSize >= virtSize )
     {
         adj->upper = 1.0;
         adj->page_increment = 1.0;
@@ -89,19 +89,15 @@ void wxScrollHelperNative::DoAdjustScrollbar(GtkAdjustment *adj,
     }
     else // we do have scrollbar
     {
+        // round because we need to show all the items
         adj->upper = (virtSize + pixelsPerLine - 1) / pixelsPerLine;
-        adj->page_size = winSize / pixelsPerLine;
-        adj->page_increment = winSize / pixelsPerLine;
-
-        // Special case. When client and virtual size are very close but
-        // the client is big enough, kill scrollbar.
 
-        if ((adj->page_size < adj->upper) && (winSize >= virtSize))
-            adj->page_size += 1.0;
+        // truncate here as we want to show visible lines entirely
+        adj->page_size =
+        adj->page_increment = winSize / pixelsPerLine;
 
         // If the scrollbar hits the right side, move the window
         // right to keep it from over extending.
-
         if ( !wxIsNullDouble(adj->value) &&
                 (adj->value + adj->page_size > adj->upper) )
         {