mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 12:15:08 +00:00
ProcessManager: Make the process table view scrollable while header stays.
This commit is contained in:
parent
6e571b66f1
commit
c49ceb5a1f
1 changed files with 14 additions and 9 deletions
|
@ -75,18 +75,11 @@ void ProcessView::paint_event(GPaintEvent&)
|
||||||
{
|
{
|
||||||
Painter painter(*this);
|
Painter painter(*this);
|
||||||
|
|
||||||
|
painter.translate(0, -m_scrollbar->value());
|
||||||
|
|
||||||
int horizontal_padding = 5;
|
int horizontal_padding = 5;
|
||||||
int painted_item_index = 0;
|
int painted_item_index = 0;
|
||||||
|
|
||||||
int x_offset = 0;
|
|
||||||
for (int column_index = 0; column_index < m_model->column_count(); ++column_index) {
|
|
||||||
Rect cell_rect(horizontal_padding + x_offset, 0, m_model->column_width(column_index), item_height());
|
|
||||||
painter.draw_text(cell_rect, m_model->column_name(column_index), TextAlignment::CenterLeft, Color::Black);
|
|
||||||
x_offset += m_model->column_width(column_index) + horizontal_padding;
|
|
||||||
}
|
|
||||||
painter.draw_line({ 0, 0 }, { width() - 1, 0 }, Color::White);
|
|
||||||
painter.draw_line({ 0, header_height() - 1 }, { width() - 1, header_height() - 1 }, Color::DarkGray);
|
|
||||||
|
|
||||||
int y_offset = header_height();
|
int y_offset = header_height();
|
||||||
|
|
||||||
for (int row_index = 0; row_index < m_model->row_count(); ++row_index) {
|
for (int row_index = 0; row_index < m_model->row_count(); ++row_index) {
|
||||||
|
@ -116,6 +109,18 @@ void ProcessView::paint_event(GPaintEvent&)
|
||||||
Rect unpainted_rect(0, painted_item_index * item_height(), width(), height());
|
Rect unpainted_rect(0, painted_item_index * item_height(), width(), height());
|
||||||
unpainted_rect.intersect(rect());
|
unpainted_rect.intersect(rect());
|
||||||
painter.fill_rect(unpainted_rect, Color::White);
|
painter.fill_rect(unpainted_rect, Color::White);
|
||||||
|
|
||||||
|
// Untranslate the painter and paint the column headers.
|
||||||
|
painter.translate(0, m_scrollbar->value());
|
||||||
|
painter.fill_rect({ 0, 0, width(), header_height() }, Color::LightGray);
|
||||||
|
int x_offset = 0;
|
||||||
|
for (int column_index = 0; column_index < m_model->column_count(); ++column_index) {
|
||||||
|
Rect cell_rect(horizontal_padding + x_offset, 0, m_model->column_width(column_index), item_height());
|
||||||
|
painter.draw_text(cell_rect, m_model->column_name(column_index), TextAlignment::CenterLeft, Color::Black);
|
||||||
|
x_offset += m_model->column_width(column_index) + horizontal_padding;
|
||||||
|
}
|
||||||
|
painter.draw_line({ 0, 0 }, { width() - 1, 0 }, Color::White);
|
||||||
|
painter.draw_line({ 0, header_height() - 1 }, { width() - 1, header_height() - 1 }, Color::DarkGray);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessView::set_status_message(String&& message)
|
void ProcessView::set_status_message(String&& message)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue