mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 02:40:49 +00:00
LibGUI: Move selection behavior from TableView up to AbstractView
Let's make SelectionBehavior a view concept where views can either select individual items (row, index) or whole rows. Maybe some day we'll do whole columns, but I don't think we need that now.
This commit is contained in:
@@ -149,13 +149,13 @@ void TableView::paint_event(PaintEvent& event)
|
||||
if (m_grid_style == GridStyle::Vertical || m_grid_style == GridStyle::Both)
|
||||
painter.draw_line(cell_rect_for_fill.top_right(), cell_rect_for_fill.bottom_right(), palette().ruler());
|
||||
|
||||
if (m_cursor_style == CursorStyle::Item && cell_index == cursor_index())
|
||||
if (selection_behavior() == SelectionBehavior::SelectItems && cell_index == cursor_index())
|
||||
painter.draw_rect(cell_rect_for_fill, palette().text_cursor());
|
||||
|
||||
x += column_width + horizontal_padding() * 2;
|
||||
}
|
||||
|
||||
if (is_focused() && cursor_style() == CursorStyle::Row && row_index == cursor_index().row()) {
|
||||
if (is_focused() && selection_behavior() == SelectionBehavior::SelectRows && row_index == cursor_index().row()) {
|
||||
painter.draw_rect(row_rect, widget_background_color);
|
||||
painter.draw_focus_rect(row_rect, palette().focus_outline());
|
||||
}
|
||||
@@ -244,12 +244,4 @@ void TableView::set_grid_style(GridStyle style)
|
||||
update();
|
||||
}
|
||||
|
||||
void TableView::set_cursor_style(CursorStyle style)
|
||||
{
|
||||
if (m_cursor_style == style)
|
||||
return;
|
||||
m_cursor_style = style;
|
||||
update();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user