1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:48:11 +00:00

LibGUI: Add GScrollableWidget::scroll_to_bottom/top().

This commit is contained in:
Andreas Kling 2019-03-19 03:09:21 +01:00
parent e15cc4509f
commit 9551e2e4b5
2 changed files with 13 additions and 0 deletions

View file

@ -124,3 +124,13 @@ void GScrollableWidget::set_scrollbars_enabled(bool scrollbars_enabled)
m_horizontal_scrollbar->set_visible(m_scrollbars_enabled);
m_corner_widget->set_visible(m_scrollbars_enabled);
}
void GScrollableWidget::scroll_to_top()
{
scroll_into_view({ 0, 0, 1, 1 }, Orientation::Vertical);
}
void GScrollableWidget::scroll_to_bottom()
{
scroll_into_view({ 0, content_height(), 1, 1 }, Orientation::Vertical);
}

View file

@ -27,6 +27,9 @@ public:
GWidget& corner_widget() { return *m_corner_widget; }
const GWidget& corner_widget() const { return *m_corner_widget; }
void scroll_to_top();
void scroll_to_bottom();
virtual const char* class_name() const override { return "GScrollableWidget"; }
protected: