mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 22:57:34 +00:00
PaintBrush: Add a PaletteWidget to allow color selection.
Also use different colors for left/right mouse button. :^)
This commit is contained in:
parent
642c82fbff
commit
f86b1bdca1
6 changed files with 82 additions and 9 deletions
|
@ -9,12 +9,23 @@ public:
|
|||
|
||||
virtual const char* class_name() const override { return "PaintableWidget"; }
|
||||
|
||||
Color primary_color() const { return m_primary_color; }
|
||||
Color secondary_color() const { return m_secondary_color; }
|
||||
|
||||
void set_primary_color(Color color) { m_primary_color = color; }
|
||||
void set_secondary_color(Color color) { m_secondary_color = color; }
|
||||
|
||||
private:
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
virtual void mousedown_event(GMouseEvent&) override;
|
||||
virtual void mouseup_event(GMouseEvent&) override;
|
||||
virtual void mousemove_event(GMouseEvent&) override;
|
||||
|
||||
Color color_for(const GMouseEvent&);
|
||||
|
||||
Point m_last_drawing_event_position { -1, -1 };
|
||||
RetainPtr<GraphicsBitmap> m_bitmap;
|
||||
|
||||
Color m_primary_color { Color::Black };
|
||||
Color m_secondary_color { Color::White };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue