int *lines,
int *linesPerPage)
{
- if ( pixelsPerLine == 0 )
+ if ( pixelsPerLine == 0 || winSize >= virtSize)
{
+ if ( !wxIsNullDouble(adj->value) )
+ {
+ adj->value = 0.0;
+ g_signal_emit_by_name (adj, "value_changed");
+ }
+
adj->upper = 1.0;
adj->page_increment = 1.0;
adj->page_size = 1.0;
}
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) )
{
if (adj->value < 0.0)
adj->value = 0.0;
- if ( m_win->GetChildren().empty() )
- {
- // This is enough without child windows
- *pos = (int)adj->value;
- }
- else
- {
- // We need to actually scroll window
- gtk_signal_emit_by_name( GTK_OBJECT(adj), "value_changed" );
- }
+ g_signal_emit_by_name (adj, "value_changed");
}
}
*lines = (int)(adj->upper + 0.5);
*linesPerPage = (int)(adj->page_increment + 0.5);
- gtk_signal_emit_by_name( GTK_OBJECT(adj), "changed" );
+ g_signal_emit_by_name (adj, "changed");
}
void wxScrollHelperNative::AdjustScrollbars()
int w, h;
int vw, vh;
+ m_targetWindow->m_hasScrolling = m_xScrollPixelsPerLine != 0 || m_yScrollPixelsPerLine != 0;
+
m_targetWindow->GetClientSize( &w, &h );
m_targetWindow->GetVirtualSize( &vw, &vh );