LibGUI: More system theme support in GTabWidget and GTableView

This commit is contained in:
Andreas Kling 2019-12-24 02:25:11 +01:00
parent 8ae826f5c3
commit 7b78f63f85
Notes: sideshowbarker 2024-07-19 10:43:31 +09:00
2 changed files with 6 additions and 6 deletions

View file

@ -124,7 +124,7 @@ void GTabWidget::paint_event(GPaintEvent& event)
bool hovered = i == m_hovered_tab_index;
auto button_rect = this->button_rect(i);
StylePainter::paint_tab_button(painter, button_rect, false, hovered, m_tabs[i].widget->is_enabled());
painter.draw_text(button_rect.translated(0, 1), m_tabs[i].title, TextAlignment::Center);
painter.draw_text(button_rect.translated(0, 1), m_tabs[i].title, TextAlignment::Center, SystemColor::ButtonText);
}
for (int i = 0; i < m_tabs.size(); ++i) {
@ -133,8 +133,8 @@ void GTabWidget::paint_event(GPaintEvent& event)
bool hovered = i == m_hovered_tab_index;
auto button_rect = this->button_rect(i);
StylePainter::paint_tab_button(painter, button_rect, true, hovered, m_tabs[i].widget->is_enabled());
painter.draw_text(button_rect.translated(0, 1), m_tabs[i].title, TextAlignment::Center);
painter.draw_line(button_rect.bottom_left().translated(1, 1), button_rect.bottom_right().translated(-1, 1), background_color());
painter.draw_text(button_rect.translated(0, 1), m_tabs[i].title, TextAlignment::Center, SystemColor::ButtonText);
painter.draw_line(button_rect.bottom_left().translated(1, 1), button_rect.bottom_right().translated(-1, 1), SystemColor::Button);
break;
}
}

View file

@ -57,11 +57,11 @@ void GTableView::paint_event(GPaintEvent& event)
key_column_background_color = is_focused() ? Color::from_rgb(0x84351a) : Color::from_rgb(0x606060);
} else {
if (alternating_row_colors() && (painted_item_index % 2)) {
background_color = Color(220, 220, 220);
key_column_background_color = Color(200, 200, 200);
background_color = Color(SystemColor::Base).darkened(0.8f);
key_column_background_color = Color(SystemColor::Base).darkened(0.7f);
} else {
background_color = SystemColor::Base;
key_column_background_color = Color(220, 220, 220);
key_column_background_color = Color(SystemColor::Base).darkened(0.9f);
}
}
painter.fill_rect(row_rect(painted_item_index), background_color);