diff options
author | Andreas Kling <kling@serenityos.org> | 2020-04-29 15:24:34 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-29 15:30:01 +0200 |
commit | bc305a16aeeabdbccd2735da0560341450940c3d (patch) | |
tree | 42f24761b087cecc9e7e328ff167633fb6f256c0 /Libraries/LibGUI/ColorInput.h | |
parent | 033a4aee50d1e037a3133ee791ebe86a0ee4e0d4 (diff) | |
download | serenity-bc305a16aeeabdbccd2735da0560341450940c3d.zip |
LibGUI: Allow editing ColorInput widgets as text
You can now enter a specific color as #rrggbb instead of clicking your
way through the color picker.
If you still want the color picker, just click the little color rect in
the widget and we'll bring up a ColorPicker. For a visual cue that this
rect is interactive, we use a hover hand cursor when hovering the rect.
Diffstat (limited to 'Libraries/LibGUI/ColorInput.h')
-rw-r--r-- | Libraries/LibGUI/ColorInput.h | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Libraries/LibGUI/ColorInput.h b/Libraries/LibGUI/ColorInput.h index 8e541d6e3d..5efbfa98af 100644 --- a/Libraries/LibGUI/ColorInput.h +++ b/Libraries/LibGUI/ColorInput.h @@ -41,24 +41,22 @@ public: void set_color(Color); Color color() { return m_color; } - void set_color_picker_title(String title) { m_color_picker_title = title; } + void set_color_picker_title(String title) { m_color_picker_title = move(title); } String color_picker_title() { return m_color_picker_title; } Function<void()> on_change; protected: virtual void mousedown_event(MouseEvent&) override; - virtual void mouseup_event(MouseEvent&) override; - virtual void enter_event(Core::Event&) override; + virtual void mousemove_event(MouseEvent&) override; virtual void paint_event(PaintEvent&) override; private: - void click(); + Gfx::Rect color_rect() const; + void set_color_without_changing_text(Color); Color m_color; - String m_color_picker_title { "Select Color" }; - - bool m_being_pressed { false }; + String m_color_picker_title { "Select color" }; }; } |