mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00:00
Spreadsheet: Draw cell cursor and selected cells differently
Now that the table view has a cursor, we can distinguish it from the selected cells. Draw the cells with a nice variant of the selection color as background.
This commit is contained in:
parent
9cf37901cd
commit
56e80fafd6
1 changed files with 10 additions and 3 deletions
|
@ -123,9 +123,16 @@ void SpreadsheetView::TableCellPainter::paint(GUI::Painter& painter, const Gfx::
|
||||||
{
|
{
|
||||||
// Draw a border.
|
// Draw a border.
|
||||||
// Undo the horizontal padding done by the table view...
|
// Undo the horizontal padding done by the table view...
|
||||||
painter.draw_rect(rect.inflated(m_table_view.horizontal_padding() * 2, 0), palette.ruler());
|
auto cell_rect = rect.inflated(m_table_view.horizontal_padding() * 2, 0);
|
||||||
if (m_table_view.selection().contains(index))
|
|
||||||
painter.draw_rect(rect.inflated(m_table_view.horizontal_padding() * 2 + 1, 1), palette.ruler_border());
|
painter.draw_rect(cell_rect, palette.ruler());
|
||||||
|
if (m_table_view.selection().contains(index)) {
|
||||||
|
Color fill_color = palette.selection();
|
||||||
|
fill_color.set_alpha(80);
|
||||||
|
painter.fill_rect(cell_rect, fill_color);
|
||||||
|
}
|
||||||
|
if (m_table_view.cursor_index() == index)
|
||||||
|
painter.draw_rect(cell_rect, palette.text_cursor());
|
||||||
|
|
||||||
auto text_color = index.data(GUI::ModelRole::ForegroundColor).to_color(palette.color(m_table_view.foreground_role()));
|
auto text_color = index.data(GUI::ModelRole::ForegroundColor).to_color(palette.color(m_table_view.foreground_role()));
|
||||||
auto data = index.data();
|
auto data = index.data();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue