diff options
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/textarea.c | 16 | ||||
-rw-r--r-- | desktop/textarea.h | 11 |
2 files changed, 27 insertions, 0 deletions
diff --git a/desktop/textarea.c b/desktop/textarea.c index 59257d208..25630e464 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -2078,3 +2078,19 @@ void textarea_set_layout(struct textarea *ta, int width, int height, ta->pad_left = left; textarea_reflow(ta, 0); } + + +/* exported interface, documented in textarea.h */ +bool textarea_scroll(struct textarea *ta, int scrx, int scry) +{ + bool handled_scroll = false; + + if (ta->bar_x != NULL && scrx != 0 && + scrollbar_scroll(ta->bar_x, scrx)) + handled_scroll = true; + if (ta->bar_y != NULL && scry != 0 && + scrollbar_scroll(ta->bar_y, scry)) + handled_scroll = true; + + return handled_scroll; +} diff --git a/desktop/textarea.h b/desktop/textarea.h index 266b8356a..560f1ca28 100644 --- a/desktop/textarea.h +++ b/desktop/textarea.h @@ -219,5 +219,16 @@ void textarea_set_dimensions(struct textarea *ta, int width, int height); */ void textarea_set_layout(struct textarea *ta, int width, int height, int top, int right, int bottom, int left); + +/** + * Scroll a textarea by an amount. Only does anything if multi-line textarea + * has scrollbars. If it scrolls, it will emit a redraw request. + * + * \param ta textarea widget + * \param scrx number of px try to scroll in x direction + * \param scry number of px try to scroll in y direction + * \return true iff the textarea was scrolled + */ +bool textarea_scroll(struct textarea *ta, int scrx, int scry); #endif |