mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:58:11 +00:00
LibGUI: Paint a focus rect around the cursor index in TableView
This commit is contained in:
parent
5030f1ed4b
commit
c0076681ad
2 changed files with 11 additions and 2 deletions
|
@ -99,7 +99,9 @@ void TableView::paint_event(PaintEvent& event)
|
||||||
key_column_background_color = widget_background_color.darkened(0.9f);
|
key_column_background_color = widget_background_color.darkened(0.9f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
painter.fill_rect(row_rect(painted_item_index), background_color);
|
|
||||||
|
auto row_rect = this->row_rect(painted_item_index);
|
||||||
|
painter.fill_rect(row_rect, background_color);
|
||||||
|
|
||||||
int x = x_offset;
|
int x = x_offset;
|
||||||
for (int column_index = 0; column_index < model()->column_count(); ++column_index) {
|
for (int column_index = 0; column_index < model()->column_count(); ++column_index) {
|
||||||
|
@ -152,6 +154,12 @@ void TableView::paint_event(PaintEvent& event)
|
||||||
|
|
||||||
x += column_width + horizontal_padding() * 2;
|
x += column_width + horizontal_padding() * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (is_focused() && cursor_style() == CursorStyle::Row && row_index == cursor_index().row()) {
|
||||||
|
painter.draw_rect(row_rect, widget_background_color);
|
||||||
|
painter.draw_focus_rect(row_rect, palette().focus_outline());
|
||||||
|
}
|
||||||
++painted_item_index;
|
++painted_item_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ public:
|
||||||
enum class CursorStyle {
|
enum class CursorStyle {
|
||||||
None,
|
None,
|
||||||
Item,
|
Item,
|
||||||
|
Row,
|
||||||
};
|
};
|
||||||
|
|
||||||
GridStyle grid_style() const { return m_grid_style; }
|
GridStyle grid_style() const { return m_grid_style; }
|
||||||
|
@ -63,7 +64,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GridStyle m_grid_style { GridStyle::None };
|
GridStyle m_grid_style { GridStyle::None };
|
||||||
CursorStyle m_cursor_style { CursorStyle::None };
|
CursorStyle m_cursor_style { CursorStyle::Row };
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue