mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:17:44 +00:00
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.
This commit is contained in:
parent
033a4aee50
commit
bc305a16ae
2 changed files with 46 additions and 53 deletions
|
@ -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" };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue