set up scrollbars correctly when we don't need them (fixes the problems reported by the patches 1460482 and 1456060)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38751 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2006-04-16 01:14:28 +00:00
parent 6fb683081c
commit 760f0fc2f4

View 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;
// truncate here as we want to show visible lines entirely
adj->page_size =
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;
// 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) )
{