X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/259858fc6a55dd1f611dbec323264fdbad8b44fb..dcae64c221450a7ca9b530ecf44757543c33a754:/src/gtk/window.cpp diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 43673380dc..e573871d0d 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -3652,6 +3652,39 @@ void wxWindowGTK::WarpPointer( int x, int y ) gdk_window_warp_pointer( window, x, y ); } +static bool wxScrollAdjust(GtkAdjustment* adj, double change) +{ + double value_start = adj->value; + double value = value_start + change; + double upper = adj->upper - adj->page_size; + if (value > upper) + { + value = upper; + } + // Lower bound will be checked by gtk_adjustment_set_value + gtk_adjustment_set_value(adj, value); + return adj->value != value_start; +} + +bool wxWindowGTK::ScrollLines(int lines) +{ + return + m_vAdjust != NULL && + wxScrollAdjust(m_vAdjust, lines * m_vAdjust->step_increment); +} + +bool wxWindowGTK::ScrollPages(int pages) +{ + return + m_vAdjust != NULL && + wxScrollAdjust(m_vAdjust, pages * m_vAdjust->page_increment); +} + +void wxWindowGTK::SetVScrollAdjustment(GtkAdjustment* adj) +{ + wxASSERT(m_vAdjust == NULL); + m_vAdjust = adj; +} void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect ) {