diff options
author | networkException <git@nwex.de> | 2022-06-16 22:30:18 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-06-17 19:46:30 +0100 |
commit | c76c3e38e68436e27f44adf53ba376bd907bebbc (patch) | |
tree | fa8dd8896068ad17191e32313ff8b67d2ef5fc33 /Userland | |
parent | ef7fbbcf70ff1ebd6bb839fd287a564418b57746 (diff) | |
download | serenity-c76c3e38e68436e27f44adf53ba376bd907bebbc.zip |
LibGUI: Support setting an in memory theme in AbstractThemePreview
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibGUI/AbstractThemePreview.cpp | 7 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/AbstractThemePreview.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/AbstractThemePreview.cpp b/Userland/Libraries/LibGUI/AbstractThemePreview.cpp index 18a4e2c11c..743ce60a0e 100644 --- a/Userland/Libraries/LibGUI/AbstractThemePreview.cpp +++ b/Userland/Libraries/LibGUI/AbstractThemePreview.cpp @@ -78,6 +78,13 @@ void AbstractThemePreview::set_preview_palette(Gfx::Palette const& palette) update(); } +void AbstractThemePreview::set_theme(Core::AnonymousBuffer const& theme_buffer) +{ + VERIFY(theme_buffer.is_valid()); + m_preview_palette = Gfx::Palette(Gfx::PaletteImpl::create_with_anonymous_buffer(theme_buffer)); + set_preview_palette(m_preview_palette); +} + void AbstractThemePreview::set_theme_from_file(Core::File& file) { auto config_file = Core::ConfigFile::open(file.filename(), file.leak_fd()).release_value_but_fixme_should_propagate_errors(); diff --git a/Userland/Libraries/LibGUI/AbstractThemePreview.h b/Userland/Libraries/LibGUI/AbstractThemePreview.h index 7345a5471d..43d3214981 100644 --- a/Userland/Libraries/LibGUI/AbstractThemePreview.h +++ b/Userland/Libraries/LibGUI/AbstractThemePreview.h @@ -25,6 +25,7 @@ public: Gfx::Palette const& preview_palette() const { return m_preview_palette; } void set_preview_palette(Gfx::Palette const&); void set_theme_from_file(Core::File&); + void set_theme(Core::AnonymousBuffer const&); void paint_window(StringView title, Gfx::IntRect const& rect, Gfx::WindowTheme::WindowState, Gfx::Bitmap const& icon, int button_count = 3); |