diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-11-27 13:55:14 +0330 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-11-30 12:07:45 +0100 |
commit | 474453244b591ff8c90547831e798d66c5d2be1e (patch) | |
tree | 6a29739f698b40c082cd5f04513abddc0a97c9cf /Applications/Spreadsheet/SpreadsheetView.cpp | |
parent | f6ae4edbd230dab2dcc4e108f731f00f54627497 (diff) | |
download | serenity-474453244b591ff8c90547831e798d66c5d2be1e.zip |
Spreadsheet: Implement infinit-scroll for columns
This naturally also implements multi-char columns, and also integrates
it into the js runtime (such columns can be named in ranges too).
Diffstat (limited to 'Applications/Spreadsheet/SpreadsheetView.cpp')
-rw-r--r-- | Applications/Spreadsheet/SpreadsheetView.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Applications/Spreadsheet/SpreadsheetView.cpp b/Applications/Spreadsheet/SpreadsheetView.cpp index 7361258cc0..2148b9281f 100644 --- a/Applications/Spreadsheet/SpreadsheetView.cpp +++ b/Applications/Spreadsheet/SpreadsheetView.cpp @@ -62,10 +62,15 @@ void InfinitelyScrollableTableView::did_scroll() { TableView::did_scroll(); auto& vscrollbar = vertical_scrollbar(); + auto& hscrollbar = horizontal_scrollbar(); if (vscrollbar.is_visible() && vscrollbar.value() == vscrollbar.max()) { if (on_reaching_vertical_end) on_reaching_vertical_end(); } + if (hscrollbar.is_visible() && hscrollbar.value() == hscrollbar.max()) { + if (on_reaching_horizontal_end) + on_reaching_horizontal_end(); + } } void SpreadsheetView::update_with_model() @@ -92,6 +97,15 @@ SpreadsheetView::SpreadsheetView(Sheet& sheet) }; update_with_model(); }; + m_table_view->on_reaching_horizontal_end = [&]() { + for (size_t i = 0; i < 10; ++i) { + m_sheet->add_column(); + auto last_column_index = m_sheet->column_count() - 1; + m_table_view->set_column_width(last_column_index, 50); + m_table_view->set_column_header_alignment(last_column_index, Gfx::TextAlignment::Center); + } + update_with_model(); + }; set_focus_proxy(m_table_view); |