mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +00:00
LibDraw+LibGUI: Allow changing individual colors in a Palette
Palette is now a value wrapper around a NonnullRefPtr<PaletteImpl>. A new function, set_color(ColorRole, Color) implements a simple copy-on-write mechanism so that we're sharing the PaletteImpl in the common case, but allowing you to create custom palettes if you like, by getting a GWidget's palette, modifying it, and then assigning the modified palette to the widget via GWidget::set_palette(). Use this to make PaintBrush show its palette colors once again. Fixes #943.
This commit is contained in:
parent
19d4f4c7b5
commit
7b2dd7e116
18 changed files with 98 additions and 40 deletions
|
@ -42,7 +42,7 @@ WSWindowManager& WSWindowManager::the()
|
|||
return *s_the;
|
||||
}
|
||||
|
||||
WSWindowManager::WSWindowManager(const Palette& palette)
|
||||
WSWindowManager::WSWindowManager(const PaletteImpl& palette)
|
||||
: m_palette(palette)
|
||||
{
|
||||
s_the = this;
|
||||
|
@ -133,7 +133,7 @@ WSWindowManager::WSWindowManager(const Palette& palette)
|
|||
auto new_theme = load_system_theme(theme.path);
|
||||
ASSERT(new_theme);
|
||||
set_system_theme(*new_theme);
|
||||
m_palette = Palette::create_with_shared_buffer(*new_theme);
|
||||
m_palette = PaletteImpl::create_with_shared_buffer(*new_theme);
|
||||
HashTable<WSClientConnection*> notified_clients;
|
||||
for_each_window([&](WSWindow& window) {
|
||||
if (window.client()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue