mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:08:11 +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
|
@ -154,7 +154,7 @@ void GAbstractButton::paint_text(GPainter& painter, const Rect& rect, const Font
|
|||
|
||||
if (text().is_empty())
|
||||
return;
|
||||
painter.draw_text(clipped_rect, text(), font, text_alignment, SystemColor::Text, TextElision::Right);
|
||||
painter.draw_text(clipped_rect, text(), font, text_alignment, SystemColor::ButtonText, TextElision::Right);
|
||||
if (is_focused())
|
||||
painter.draw_rect(clipped_rect.inflated(6, 4), Color(140, 140, 140));
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ void GAbstractColumnView::paint_headers(GPainter& painter)
|
|||
auto text_rect = cell_rect.translated(horizontal_padding(), 0);
|
||||
if (pressed)
|
||||
text_rect.move_by(1, 1);
|
||||
painter.draw_text(text_rect, text, header_font(), TextAlignment::CenterLeft, SystemColor::Text);
|
||||
painter.draw_text(text_rect, text, header_font(), TextAlignment::CenterLeft, SystemColor::ButtonText);
|
||||
x_offset += column_width + horizontal_padding() * 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ void GCheckBox::paint_event(GPaintEvent& event)
|
|||
if (is_checked()) {
|
||||
if (!s_checked_bitmap)
|
||||
s_checked_bitmap = &CharacterBitmap::create_from_ascii(s_checked_bitmap_data, s_checked_bitmap_width, s_checked_bitmap_height).leak_ref();
|
||||
painter.draw_bitmap(box_rect.shrunken(4, 4).location(), *s_checked_bitmap, SystemColor::Text);
|
||||
painter.draw_bitmap(box_rect.shrunken(4, 4).location(), *s_checked_bitmap, SystemColor::ButtonText);
|
||||
}
|
||||
|
||||
paint_text(painter, text_rect, font(), TextAlignment::TopLeft);
|
||||
|
|
|
@ -230,7 +230,7 @@ void GItemView::paint_event(GPaintEvent& event)
|
|||
if (is_selected_item)
|
||||
text_color = Color::White;
|
||||
else
|
||||
text_color = model()->data(model_index, GModel::Role::ForegroundColor).to_color(SystemColor::Text);
|
||||
text_color = model()->data(model_index, GModel::Role::ForegroundColor).to_color(SystemColor::WindowText);
|
||||
painter.fill_rect(text_rect, background_color);
|
||||
painter.draw_text(text_rect, item_text.to_string(), font, TextAlignment::Center, text_color, TextElision::Right);
|
||||
};
|
||||
|
|
|
@ -129,7 +129,7 @@ void GListView::paint_event(GPaintEvent& event)
|
|||
if (is_selected_row)
|
||||
text_color = Color::White;
|
||||
else
|
||||
text_color = model()->data(index, GModel::Role::ForegroundColor).to_color(SystemColor::Text);
|
||||
text_color = model()->data(index, GModel::Role::ForegroundColor).to_color(SystemColor::WindowText);
|
||||
auto text_rect = row_rect;
|
||||
text_rect.move_by(horizontal_padding(), 0);
|
||||
text_rect.set_width(text_rect.width() - horizontal_padding() * 2);
|
||||
|
|
|
@ -20,7 +20,7 @@ void GResizeCorner::paint_event(GPaintEvent& event)
|
|||
{
|
||||
GPainter painter(*this);
|
||||
painter.add_clip_rect(event.rect());
|
||||
painter.fill_rect(rect(), SystemColor::Window);
|
||||
painter.fill_rect(rect(), SystemColor::Button);
|
||||
painter.blit({ 0, 0 }, *m_bitmap, m_bitmap->rect());
|
||||
GWidget::paint_event(event);
|
||||
}
|
||||
|
|
|
@ -203,14 +203,14 @@ void GScrollBar::paint_event(GPaintEvent& event)
|
|||
GPainter painter(*this);
|
||||
painter.add_clip_rect(event.rect());
|
||||
|
||||
painter.fill_rect(rect(), Color::from_rgb(0xd6d2ce));
|
||||
painter.fill_rect(rect(), Color(SystemColor::Button).lightened());
|
||||
|
||||
StylePainter::paint_button(painter, decrement_button_rect(), ButtonStyle::Normal, false, m_hovered_component == Component::DecrementButton);
|
||||
StylePainter::paint_button(painter, increment_button_rect(), ButtonStyle::Normal, false, m_hovered_component == Component::IncrementButton);
|
||||
|
||||
if (length(orientation()) > default_button_size()) {
|
||||
painter.draw_bitmap(decrement_button_rect().location().translated(3, 3), orientation() == Orientation::Vertical ? *s_up_arrow_bitmap : *s_left_arrow_bitmap, has_scrubber() ? SystemColor::Text : SystemColor::DisabledText);
|
||||
painter.draw_bitmap(increment_button_rect().location().translated(3, 3), orientation() == Orientation::Vertical ? *s_down_arrow_bitmap : *s_right_arrow_bitmap, has_scrubber() ? SystemColor::Text : SystemColor::DisabledText);
|
||||
painter.draw_bitmap(decrement_button_rect().location().translated(3, 3), orientation() == Orientation::Vertical ? *s_up_arrow_bitmap : *s_left_arrow_bitmap, has_scrubber() ? SystemColor::ButtonText : SystemColor::DisabledText);
|
||||
painter.draw_bitmap(increment_button_rect().location().translated(3, 3), orientation() == Orientation::Vertical ? *s_down_arrow_bitmap : *s_right_arrow_bitmap, has_scrubber() ? SystemColor::ButtonText : SystemColor::DisabledText);
|
||||
}
|
||||
|
||||
if (has_scrubber())
|
||||
|
|
|
@ -95,7 +95,7 @@ void GTableView::paint_event(GPaintEvent& event)
|
|||
if (is_selected_row)
|
||||
text_color = Color::White;
|
||||
else
|
||||
text_color = model()->data(cell_index, GModel::Role::ForegroundColor).to_color(SystemColor::Text);
|
||||
text_color = model()->data(cell_index, GModel::Role::ForegroundColor).to_color(SystemColor::WindowText);
|
||||
painter.draw_text(cell_rect, data.to_string(), font, column_metadata.text_alignment, text_color, TextElision::Right);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ void GTreeView::paint_event(GPaintEvent& event)
|
|||
|
||||
bool is_selected_row = selection().contains(index);
|
||||
|
||||
Color text_color = SystemColor::Text;
|
||||
Color text_color = SystemColor::WindowText;
|
||||
if (is_selected_row)
|
||||
text_color = Color::White;
|
||||
|
||||
|
@ -226,7 +226,7 @@ void GTreeView::paint_event(GPaintEvent& event)
|
|||
painter.blit(cell_rect.location(), *bitmap, bitmap->rect());
|
||||
} else {
|
||||
if (!is_selected_row)
|
||||
text_color = model.data(cell_index, GModel::Role::ForegroundColor).to_color(SystemColor::Text);
|
||||
text_color = model.data(cell_index, GModel::Role::ForegroundColor).to_color(SystemColor::WindowText);
|
||||
painter.draw_text(cell_rect, data.to_string(), font, column_metadata.text_alignment, text_color, TextElision::Right);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ GWidget::GWidget(GWidget* parent)
|
|||
, m_font(Font::default_font())
|
||||
{
|
||||
m_background_color = SystemColor::Window;
|
||||
m_foreground_color = SystemColor::Text;
|
||||
m_foreground_color = SystemColor::WindowText;
|
||||
}
|
||||
|
||||
GWidget::~GWidget()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue