mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 14:58:46 +00:00
LibGUI: Pad row/column headers of AbstractTableView
This commit is contained in:
parent
876b7b4619
commit
3ce97b9c0e
Notes:
sideshowbarker
2024-07-19 02:19:17 +09:00
Author: https://github.com/xTibor
Commit: 3ce97b9c0e
Pull-request: https://github.com/SerenityOS/serenity/pull/3564
2 changed files with 24 additions and 4 deletions
|
@ -346,15 +346,25 @@ void AbstractTableView::did_scroll()
|
|||
void AbstractTableView::layout_headers()
|
||||
{
|
||||
if (column_header().is_visible()) {
|
||||
int x = frame_thickness() + (row_header().is_visible() ? row_header().width() : 0) + -horizontal_scrollbar().value();
|
||||
int row_header_width = row_header().is_visible() ? row_header().width() : 0;
|
||||
int vertical_scrollbar_width = vertical_scrollbar().is_visible() ? vertical_scrollbar().width() : 0;
|
||||
|
||||
int x = frame_thickness() + row_header_width - horizontal_scrollbar().value();
|
||||
int y = frame_thickness();
|
||||
column_header().set_relative_rect(x, y, content_width(), column_header().preferred_size().height());
|
||||
int width = AK::max(content_width(), rect().width() - frame_thickness() * 2 - row_header_width - vertical_scrollbar_width);
|
||||
|
||||
column_header().set_relative_rect(x, y, width, column_header().preferred_size().height());
|
||||
}
|
||||
|
||||
if (row_header().is_visible()) {
|
||||
int column_header_height = column_header().is_visible() ? column_header().height() : 0;
|
||||
int horizontal_scrollbar_height = horizontal_scrollbar().is_visible() ? horizontal_scrollbar().height() : 0;
|
||||
|
||||
int x = frame_thickness();
|
||||
int y = (frame_thickness() + (column_header().is_visible() ? column_header().height() : 0)) + -vertical_scrollbar().value();
|
||||
row_header().set_relative_rect(x, y, row_header().preferred_size().width(), content_height());
|
||||
int y = frame_thickness() + column_header_height - vertical_scrollbar().value();
|
||||
int height = AK::max(content_height(), rect().height() - frame_thickness() * 2 - column_header_height - horizontal_scrollbar_height);
|
||||
|
||||
row_header().set_relative_rect(x, y, row_header().preferred_size().width(), height);
|
||||
}
|
||||
|
||||
if (row_header().is_visible() && column_header().is_visible()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue