1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:37:45 +00:00

PaintBrush: Add a "line" tool for drawing straight lines

This implements "preview" of the line by allowing tool subclasses to
hook the second_paint_event on the PaintableWidget.

Work towards #375.
This commit is contained in:
Andreas Kling 2019-11-29 22:34:08 +01:00
parent f04394b9f3
commit 4e6cd541c9
8 changed files with 137 additions and 9 deletions

View file

@ -20,7 +20,8 @@ public:
void set_tool(Tool* tool);
Tool* tool();
Color color_for(const GMouseEvent&);
Color color_for(const GMouseEvent&) const;
Color color_for(GMouseButton) const;
void set_bitmap(const GraphicsBitmap&);
@ -32,6 +33,7 @@ public:
private:
virtual void paint_event(GPaintEvent&) override;
virtual void second_paint_event(GPaintEvent&) override;
virtual void mousedown_event(GMouseEvent&) override;
virtual void mouseup_event(GMouseEvent&) override;
virtual void mousemove_event(GMouseEvent&) override;