mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 07:36:50 +00:00
LibGfx: Add Paths to themes
Paths allows themes to specify directories/files where custom resources are located.
This commit is contained in:
committed by
Andreas Kling
parent
044b4cc090
commit
41aacdf815
@@ -85,6 +85,19 @@ RefPtr<SharedBuffer> load_system_theme(const String& path)
|
||||
return metric;
|
||||
};
|
||||
|
||||
auto get_path = [&](auto& name, auto role) {
|
||||
auto path = file->read_entry("Paths", name);
|
||||
if (path.is_empty()) {
|
||||
switch (role) {
|
||||
case (int)PathRole::TitleButtonIcons:
|
||||
return "/res/icons/16x16/";
|
||||
default:
|
||||
return "/res/";
|
||||
}
|
||||
}
|
||||
return &path[0];
|
||||
};
|
||||
|
||||
#define DO_COLOR(x) \
|
||||
data->color[(int)ColorRole::x] = get_color(#x)
|
||||
|
||||
@@ -153,6 +166,11 @@ RefPtr<SharedBuffer> load_system_theme(const String& path)
|
||||
DO_METRIC(TitleButtonWidth);
|
||||
DO_METRIC(TitleButtonHeight);
|
||||
|
||||
#define DO_PATH(x) \
|
||||
data->path[(int)PathRole::x] = get_path(#x, (int)PathRole::x)
|
||||
|
||||
DO_PATH(TitleButtonIcons);
|
||||
|
||||
buffer->seal();
|
||||
buffer->share_globally();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user