mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:57:36 +00:00
LibDraw: Add Button and ButtonText system theme colors
These are now separate from the Window and WindowText colors.
This commit is contained in:
parent
9171aef724
commit
df3a2dba43
21 changed files with 57 additions and 39 deletions
|
@ -25,7 +25,7 @@ void WSButton::paint(Painter& painter)
|
|||
x_location.move_by(-(m_bitmap->width() / 2), -(m_bitmap->height() / 2));
|
||||
if (m_pressed)
|
||||
x_location.move_by(1, 1);
|
||||
painter.draw_bitmap(x_location, *m_bitmap, SystemColor::Text);
|
||||
painter.draw_bitmap(x_location, *m_bitmap, SystemColor::ButtonText);
|
||||
}
|
||||
|
||||
void WSButton::on_mouse_event(const WSMouseEvent& event)
|
||||
|
|
|
@ -153,7 +153,7 @@ void WSMenu::draw()
|
|||
|
||||
for (auto& item : m_items) {
|
||||
if (item.type() == WSMenuItem::Text) {
|
||||
Color text_color = Color::Black;
|
||||
Color text_color = SystemColor::WindowText;
|
||||
if (&item == m_hovered_item && item.is_enabled()) {
|
||||
painter.fill_rect(item.rect(), SystemColor::MenuSelection);
|
||||
painter.draw_rect(item.rect(), Color(SystemColor::MenuSelection).darkened());
|
||||
|
@ -169,7 +169,7 @@ void WSMenu::draw()
|
|||
painter.fill_rect(checkbox_rect, SystemColor::Base);
|
||||
StylePainter::paint_frame(painter, checkbox_rect, FrameShape::Container, FrameShadow::Sunken, 2);
|
||||
if (item.is_checked()) {
|
||||
painter.draw_bitmap(checkmark_rect.location(), *s_checked_bitmap, SystemColor::Text);
|
||||
painter.draw_bitmap(checkmark_rect.location(), *s_checked_bitmap, SystemColor::ButtonText);
|
||||
}
|
||||
} else if (item.icon()) {
|
||||
Rect icon_rect { item.rect().x() + 3, 0, s_item_icon_width, s_item_icon_width };
|
||||
|
@ -189,13 +189,13 @@ void WSMenu::draw()
|
|||
s_submenu_arrow_bitmap_height
|
||||
};
|
||||
submenu_arrow_rect.center_vertically_within(item.rect());
|
||||
painter.draw_bitmap(submenu_arrow_rect.location(), submenu_arrow_bitmap, Color::Black);
|
||||
painter.draw_bitmap(submenu_arrow_rect.location(), submenu_arrow_bitmap, SystemColor::WindowText);
|
||||
}
|
||||
} else if (item.type() == WSMenuItem::Separator) {
|
||||
Point p1(item.rect().translated(stripe_rect.width() + 4, 0).x(), item.rect().center().y() - 1);
|
||||
Point p2(width - 7, item.rect().center().y() - 1);
|
||||
painter.draw_line(p1, p2, Color::MidGray);
|
||||
painter.draw_line(p1.translated(0, 1), p2.translated(0, 1), Color::White);
|
||||
painter.draw_line(p1, p2, SystemColor::ThreedShadow1);
|
||||
painter.draw_line(p1.translated(0, 1), p2.translated(0, 1), SystemColor::ThreedHighlight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ void WSMenuManager::draw()
|
|||
painter.draw_line({ 0, menubar_rect.bottom() }, { menubar_rect.right(), menubar_rect.bottom() }, SystemColor::ThreedShadow1);
|
||||
int index = 0;
|
||||
wm.for_each_active_menubar_menu([&](WSMenu& menu) {
|
||||
Color text_color = SystemColor::Text;
|
||||
Color text_color = SystemColor::WindowText;
|
||||
if (is_open(menu)) {
|
||||
painter.fill_rect(menu.rect_in_menubar(), SystemColor::MenuSelection);
|
||||
painter.draw_rect(menu.rect_in_menubar(), Color(SystemColor::MenuSelection).darkened());
|
||||
|
@ -103,7 +103,7 @@ void WSMenuManager::draw()
|
|||
return IterationDecision::Continue;
|
||||
});
|
||||
|
||||
painter.draw_text(m_username_rect, m_username, Font::default_bold_font(), TextAlignment::CenterRight, SystemColor::Text);
|
||||
painter.draw_text(m_username_rect, m_username, Font::default_bold_font(), TextAlignment::CenterRight, SystemColor::WindowText);
|
||||
|
||||
time_t now = time(nullptr);
|
||||
auto* tm = localtime(&now);
|
||||
|
@ -115,7 +115,7 @@ void WSMenuManager::draw()
|
|||
tm->tm_min,
|
||||
tm->tm_sec);
|
||||
|
||||
painter.draw_text(m_time_rect, time_text, wm.font(), TextAlignment::CenterRight, SystemColor::Text);
|
||||
painter.draw_text(m_time_rect, time_text, wm.font(), TextAlignment::CenterRight, SystemColor::WindowText);
|
||||
|
||||
for (auto& applet : m_applets) {
|
||||
if (!applet)
|
||||
|
|
|
@ -192,7 +192,7 @@ void WSWindowFrame::paint(Painter& painter)
|
|||
if (!window.show_titlebar())
|
||||
return;
|
||||
|
||||
painter.draw_line(titlebar_rect.bottom_left().translated(0, 1), titlebar_rect.bottom_right().translated(0, 1), Color::WarmGray);
|
||||
painter.draw_line(titlebar_rect.bottom_left().translated(0, 1), titlebar_rect.bottom_right().translated(0, 1), SystemColor::Button);
|
||||
|
||||
auto leftmost_button_rect = m_buttons.is_empty() ? Rect() : m_buttons.last().relative_rect();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue