allow scrolling to top and bottom from lua

This commit is contained in:
Tim Felgentreff 2020-10-07 12:03:09 +02:00
parent 3babafb53d
commit 8d0cd713e2
3 changed files with 16 additions and 0 deletions
src
guichan
include/guichan/widgets
widgets
tolua

View file

@ -162,6 +162,10 @@ namespace gcn
*/
virtual void setScrollPolicy(unsigned int hPolicy, unsigned int vPolicy);
virtual void scrollToBottom();
virtual void scrollToTop();
/**
* Sets the amount to scroll verticaly.
*

View file

@ -181,6 +181,16 @@ namespace gcn
checkPolicies();
}
void ScrollArea::scrollToBottom()
{
setVerticalScrollAmount(getVerticalMaxScroll());
}
void ScrollArea::scrollToTop()
{
setVerticalScrollAmount(0);
}
void ScrollArea::setVerticalScrollAmount(int vScroll)
{
int max = getVerticalMaxScroll();

View file

@ -325,6 +325,8 @@ class ScrollArea : public BasicContainer
virtual Widget *getContent();
virtual void setScrollbarWidth(int width);
virtual int getScrollbarWidth();
virtual void scrollToBottom();
virtual void scrollToTop();
};
class ImageWidget : public Widget