1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:17:35 +00:00

LibGUI: Add AllowCallback parameter to ColorInput::set_color()

The `TextEditor::on_change` callback now only fires if the user types in
the box, or `set_text()` is called with `AllowCallback::Yes`.
Previously that callback was what set `m_color`, so I've rearranged
things a little so that the color still updates regardless of what
source the color came from.
This commit is contained in:
Sam Atkins 2022-04-29 10:46:56 +01:00 committed by Andreas Kling
parent 91230ff28d
commit 5fd0140772
2 changed files with 9 additions and 9 deletions

View file

@ -21,7 +21,7 @@ public:
bool has_alpha_channel() const { return m_color_has_alpha_channel; }
void set_color_has_alpha_channel(bool has_alpha) { m_color_has_alpha_channel = has_alpha; }
void set_color(Color);
void set_color(Color, AllowCallback = AllowCallback::Yes);
Color color() { return m_color; }
void set_color_picker_title(String title) { m_color_picker_title = move(title); }
@ -39,7 +39,7 @@ private:
ColorInput();
Gfx::IntRect color_rect() const;
void set_color_without_changing_text(Color);
void set_color_internal(Color, AllowCallback, bool change_text);
Color m_color;
String m_color_picker_title { "Select color" };