1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

LibGfx: Add Paths to themes

Paths allows themes to specify directories/files where custom
resources are located.
This commit is contained in:
thankyouverycool 2020-07-29 16:09:04 -04:00 committed by Andreas Kling
parent 044b4cc090
commit 41aacdf815
4 changed files with 45 additions and 0 deletions

View file

@ -67,6 +67,12 @@ int PaletteImpl::metric(MetricRole role) const
return theme().metric[(int)role];
}
String PaletteImpl::path(PathRole role) const
{
ASSERT((int)role < (int)PathRole::__Count);
return theme().path[(int)role];
}
NonnullRefPtr<PaletteImpl> PaletteImpl::clone() const
{
auto new_theme_buffer = SharedBuffer::create_with_size(m_theme_buffer->size());
@ -90,6 +96,14 @@ void Palette::set_metric(MetricRole role, int value)
theme.metric[(int)role] = value;
}
void Palette::set_path(PathRole role, String path)
{
if (m_impl->ref_count() != 1)
m_impl = m_impl->clone();
auto& theme = const_cast<SystemTheme&>(impl().theme());
theme.path[(int)role] = path;
}
PaletteImpl::~PaletteImpl()
{
}