mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:38:11 +00:00
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:
parent
c7b7b65309
commit
d17b42b28d
4 changed files with 12 additions and 4 deletions
|
@ -39,6 +39,7 @@ namespace GUI {
|
|||
|
||||
ItemView::ItemView()
|
||||
{
|
||||
set_fill_with_background_color(true);
|
||||
set_background_role(ColorRole::Base);
|
||||
set_foreground_role(ColorRole::BaseText);
|
||||
horizontal_scrollbar().set_visible(false);
|
||||
|
|
|
@ -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,6 +171,7 @@ void ListView::paint_event(PaintEvent& event)
|
|||
};
|
||||
|
||||
Gfx::Rect unpainted_rect(0, painted_item_index * item_height(), exposed_width, height());
|
||||
if (fill_with_background_color())
|
||||
painter.fill_rect(unpainted_rect, palette().color(background_role()));
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ namespace GUI {
|
|||
|
||||
TableView::TableView()
|
||||
{
|
||||
set_fill_with_background_color(true);
|
||||
set_background_role(ColorRole::Base);
|
||||
set_foreground_role(ColorRole::BaseText);
|
||||
}
|
||||
|
@ -56,6 +57,7 @@ void TableView::paint_event(PaintEvent& event)
|
|||
Painter painter(*this);
|
||||
painter.add_clip_rect(frame_inner_rect());
|
||||
painter.add_clip_rect(event.rect());
|
||||
if (fill_with_background_color())
|
||||
painter.fill_rect(event.rect(), widget_background_color);
|
||||
painter.translate(frame_thickness(), frame_thickness());
|
||||
painter.translate(-horizontal_scrollbar().value(), -vertical_scrollbar().value());
|
||||
|
@ -144,6 +146,7 @@ void TableView::paint_event(PaintEvent& event)
|
|||
};
|
||||
|
||||
Gfx::Rect unpainted_rect(0, header_height() + painted_item_index * item_height(), exposed_width, height());
|
||||
if (fill_with_background_color())
|
||||
painter.fill_rect(unpainted_rect, widget_background_color);
|
||||
|
||||
// Untranslate the painter vertically and do the column headers.
|
||||
|
|
|
@ -53,6 +53,7 @@ TreeView::MetadataForIndex& TreeView::ensure_metadata_for_index(const ModelIndex
|
|||
|
||||
TreeView::TreeView()
|
||||
{
|
||||
set_fill_with_background_color(true);
|
||||
set_background_role(ColorRole::Base);
|
||||
set_foreground_role(ColorRole::BaseText);
|
||||
set_size_columns_to_fit_content(true);
|
||||
|
@ -173,6 +174,7 @@ void TreeView::paint_event(PaintEvent& event)
|
|||
Painter painter(*this);
|
||||
painter.add_clip_rect(frame_inner_rect());
|
||||
painter.add_clip_rect(event.rect());
|
||||
if (fill_with_background_color())
|
||||
painter.fill_rect(event.rect(), palette().color(background_role()));
|
||||
|
||||
if (!model())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue