implemented ScrollLines/Pages() for all classes in wxGTK, not just wxTextCtrl (patch 1281503)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37407 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-02-09 03:53:34 +00:00
parent a8e24848f6
commit 0c131a5ad2
7 changed files with 48 additions and 72 deletions

View File

@@ -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 )
{