summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI/IconView.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-12-27 11:34:38 +0100
committerAndreas Kling <kling@serenityos.org>2020-12-27 14:48:12 +0100
commit0117c57418423b4049877f62ea509f76e1853273 (patch)
treec15bc1cf3af7d158cde08d045c419dfe657e082a /Libraries/LibGUI/IconView.h
parent815d39886f4f0e835bb6300682bafc7dc266ac2b (diff)
downloadserenity-0117c57418423b4049877f62ea509f76e1853273.zip
LibGUI: Move some large IconView internal helpers to the .cpp file
Stuff that's only used internally by the class is nice to keep out of the header when possible.
Diffstat (limited to 'Libraries/LibGUI/IconView.h')
-rw-r--r--Libraries/LibGUI/IconView.h36
1 files changed, 2 insertions, 34 deletions
diff --git a/Libraries/LibGUI/IconView.h b/Libraries/LibGUI/IconView.h
index 14faed7929..67a3d39421 100644
--- a/Libraries/LibGUI/IconView.h
+++ b/Libraries/LibGUI/IconView.h
@@ -102,42 +102,10 @@ private:
};
template<typename Function>
- IterationDecision for_each_item_intersecting_rect(const Gfx::IntRect& rect, Function f) const
- {
- ASSERT(model());
- if (rect.is_empty())
- return IterationDecision::Continue;
- int begin_row, begin_column;
- column_row_from_content_position(rect.top_left(), begin_row, begin_column);
- int end_row, end_column;
- column_row_from_content_position(rect.bottom_right(), end_row, end_column);
- int items_per_column = end_column - begin_column + 1;
- int item_index = max(0, begin_row * m_visual_column_count + begin_column);
- int last_index = min(item_count(), end_row * m_visual_column_count + end_column + 1);
- while (item_index < last_index) {
- for (int i = item_index; i < min(item_index + items_per_column, last_index); i++) {
- auto& item_data = get_item_data(i);
- if (item_data.is_intersecting(rect)) {
- auto decision = f(item_data);
- if (decision != IterationDecision::Continue)
- return decision;
- }
- }
- item_index += m_visual_column_count;
- };
- return IterationDecision::Continue;
- }
+ IterationDecision for_each_item_intersecting_rect(const Gfx::IntRect&, Function) const;
template<typename Function>
- IterationDecision for_each_item_intersecting_rects(const Vector<Gfx::IntRect>& rects, Function f) const
- {
- for (auto& rect : rects) {
- auto decision = for_each_item_intersecting_rect(rect, f);
- if (decision != IterationDecision::Continue)
- return decision;
- }
- return IterationDecision::Continue;
- }
+ IterationDecision for_each_item_intersecting_rects(const Vector<Gfx::IntRect>&, Function) const;
void column_row_from_content_position(const Gfx::IntPoint& content_position, int& row, int& column) const
{