summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzawwwu <58145197+zawwwu@users.noreply.github.com>2021-07-03 16:55:02 +0300
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-07-04 21:54:50 +0430
commitcf918156543fd22a0939ee93e786a6c442da33fd (patch)
tree27beaa6f8803ea0989314326c505fec0230805df
parente8579ed24a00e95deabbcfe3486d73ca541bc68c (diff)
downloadserenity-cf918156543fd22a0939ee93e786a6c442da33fd.zip
Spreadsheet: Add function for moving cursor
This function allows to access cursor movement functionality outside of SpreadsheetView class.
-rw-r--r--Userland/Applications/Spreadsheet/SpreadsheetView.cpp5
-rw-r--r--Userland/Applications/Spreadsheet/SpreadsheetView.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
index b0d2322e94..eb239f6936 100644
--- a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
+++ b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
@@ -315,6 +315,11 @@ void SpreadsheetView::show_event(GUI::ShowEvent&)
}
}
+void SpreadsheetView::move_cursor(GUI::AbstractView::CursorMovement direction)
+{
+ m_table_view->move_cursor(direction, GUI::AbstractView::SelectionUpdate::Set);
+}
+
void SpreadsheetView::TableCellPainter::paint(GUI::Painter& painter, const Gfx::IntRect& rect, const Gfx::Palette& palette, const GUI::ModelIndex& index)
{
// Draw a border.
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetView.h b/Userland/Applications/Spreadsheet/SpreadsheetView.h
index a02589e64a..3c5f371fc9 100644
--- a/Userland/Applications/Spreadsheet/SpreadsheetView.h
+++ b/Userland/Applications/Spreadsheet/SpreadsheetView.h
@@ -100,6 +100,8 @@ public:
Function<void(Vector<Position>&&)> on_selection_changed;
Function<void()> on_selection_dropped;
+ void move_cursor(GUI::AbstractView::CursorMovement);
+
private:
virtual void hide_event(GUI::HideEvent&) override;
virtual void show_event(GUI::ShowEvent&) override;