diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2021-10-20 09:15:06 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2021-10-20 09:15:06 +0200 |
commit | 82accaf200ab3a2cbf5a9112628a8f6eac27b1c8 (patch) | |
tree | 6efc02aaa0a8f5a1d26a5fcc2ec0a9e7204021f6 /src/stardict-view.c | |
parent | e461189f0e67f237d7bfb8280b58a6881cf914d0 (diff) | |
download | tdv-82accaf200ab3a2cbf5a9112628a8f6eac27b1c8.tar.gz tdv-82accaf200ab3a2cbf5a9112628a8f6eac27b1c8.tar.xz tdv-82accaf200ab3a2cbf5a9112628a8f6eac27b1c8.zip |
sdgui: make Page Up/Down scroll the view
Diffstat (limited to 'src/stardict-view.c')
-rw-r--r-- | src/stardict-view.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/stardict-view.c b/src/stardict-view.c index 5371475..8eefa1a 100644 --- a/src/stardict-view.c +++ b/src/stardict-view.c @@ -555,3 +555,24 @@ stardict_view_set_matched (StardictView *self, const gchar *matched) self->matched = g_strdup (matched); reload (self); } + +void +stardict_view_scroll (StardictView *self, GtkScrollStep step, gdouble amount) +{ + g_return_if_fail (STARDICT_IS_VIEW (self)); + + GtkWidget *widget = GTK_WIDGET (self); + switch (step) + { + case GTK_SCROLL_STEPS: + self->top_offset += amount * natural_row_size (widget); + break; + case GTK_SCROLL_PAGES: + self->top_offset += amount * gtk_widget_get_allocated_height (widget); + break; + default: + break; + } + + adjust_for_offset (self); +} |