mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:17:35 +00:00
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).
This commit is contained in:
parent
f6ae4edbd2
commit
474453244b
7 changed files with 233 additions and 50 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue