mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:28:12 +00:00
WindowServer: New title bar vars for themes
The theming system can now control title bar height, title button size, title stripe color and the title text shadow color. The implemented theme metrics system could be later extended to LibGUI to allow themes to change widget padding, border width, etc.
This commit is contained in:
parent
8e364b9780
commit
51b2b0d5e5
7 changed files with 142 additions and 10 deletions
|
@ -61,6 +61,12 @@ Color PaletteImpl::color(ColorRole role) const
|
|||
return theme().color[(int)role];
|
||||
}
|
||||
|
||||
int PaletteImpl::metric(MetricRole role) const
|
||||
{
|
||||
ASSERT((int)role < (int)MetricRole::__Count);
|
||||
return theme().metric[(int)role];
|
||||
}
|
||||
|
||||
NonnullRefPtr<PaletteImpl> PaletteImpl::clone() const
|
||||
{
|
||||
auto new_theme_buffer = SharedBuffer::create_with_size(m_theme_buffer->size());
|
||||
|
@ -76,6 +82,14 @@ void Palette::set_color(ColorRole role, Color color)
|
|||
theme.color[(int)role] = color;
|
||||
}
|
||||
|
||||
void Palette::set_metric(MetricRole role, int value)
|
||||
{
|
||||
if (m_impl->ref_count() != 1)
|
||||
m_impl = m_impl->clone();
|
||||
auto& theme = const_cast<SystemTheme&>(impl().theme());
|
||||
theme.metric[(int)role] = value;
|
||||
}
|
||||
|
||||
PaletteImpl::~PaletteImpl()
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue