diff options
author | Andreas Kling <kling@serenityos.org> | 2020-09-01 15:41:56 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-09-01 16:17:17 +0200 |
commit | 27e86c03da69507e6c38cb8a7a6384d721dbacf8 (patch) | |
tree | 8bcb5134f84ee74fe80df1b995157be2c3e0a9cd | |
parent | 72443bd1abe8f773516d493dc5e2bf4b91d02573 (diff) | |
download | serenity-27e86c03da69507e6c38cb8a7a6384d721dbacf8.zip |
LibGUI: Implement the virtual IconView::scroll_into_view()
This is virtual in AbstractView so let's not shadow it with an IconView
specific variant.
-rw-r--r-- | Libraries/LibGUI/IconView.cpp | 6 | ||||
-rw-r--r-- | Libraries/LibGUI/IconView.h | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/Libraries/LibGUI/IconView.cpp b/Libraries/LibGUI/IconView.cpp index 0d92e7fb89..26d3899341 100644 --- a/Libraries/LibGUI/IconView.cpp +++ b/Libraries/LibGUI/IconView.cpp @@ -62,9 +62,11 @@ void IconView::select_all() } } -void IconView::scroll_into_view(const ModelIndex& index, Orientation orientation) +void IconView::scroll_into_view(const ModelIndex& index, bool scroll_horizontally, bool scroll_vertically) { - ScrollableWidget::scroll_into_view(item_rect(index.row()), orientation); + if (!index.is_valid()) + return; + ScrollableWidget::scroll_into_view(item_rect(index.row()), scroll_horizontally, scroll_vertically); } void IconView::resize_event(ResizeEvent& event) diff --git a/Libraries/LibGUI/IconView.h b/Libraries/LibGUI/IconView.h index 2e23f2fcf7..c4ae146e86 100644 --- a/Libraries/LibGUI/IconView.h +++ b/Libraries/LibGUI/IconView.h @@ -41,7 +41,8 @@ public: int content_width() const; int horizontal_padding() const { return m_horizontal_padding; } - void scroll_into_view(const ModelIndex&, Orientation); + virtual void scroll_into_view(const ModelIndex&, bool scroll_horizontally = true, bool scroll_vertically = true) override; + Gfx::IntSize effective_item_size() const { return m_effective_item_size; } int model_column() const { return m_model_column; } |