LibGUI: Make view widgets fill background by default

Most clients will want background autofill, so let's make it the
default mode.
This commit is contained in:
Andreas Kling 2020-04-18 21:55:37 +02:00
parent c7b7b65309
commit d17b42b28d
Notes: sideshowbarker 2024-07-19 07:29:59 +09:00
4 changed files with 12 additions and 4 deletions

View file

@ -35,6 +35,7 @@ namespace GUI {
ListView::ListView()
{
set_fill_with_background_color(true);
set_background_role(ColorRole::Base);
set_foreground_role(ColorRole::BaseText);
}
@ -170,7 +171,8 @@ void ListView::paint_event(PaintEvent& event)
};
Gfx::Rect unpainted_rect(0, painted_item_index * item_height(), exposed_width, height());
painter.fill_rect(unpainted_rect, palette().color(background_role()));
if (fill_with_background_color())
painter.fill_rect(unpainted_rect, palette().color(background_role()));
}
int ListView::item_count() const