ladybird/Applications/PaintBrush/LineTool.h
Zyper 413618454b PaintBrush: Shift key constrains LineTool angle
Holding Shift key will constrain the LineTool's line angle to 15 degrees
increments. Many graphics editors have similar feature.
2019-12-17 21:21:24 +01:00

30 lines
857 B
C++

#pragma once
#include "Tool.h"
#include <LibDraw/Point.h>
class GMenu;
class LineTool final : public Tool {
public:
LineTool();
virtual ~LineTool() override;
virtual void on_mousedown(GMouseEvent&) override;
virtual void on_mousemove(GMouseEvent&) override;
virtual void on_mouseup(GMouseEvent&) override;
virtual void on_contextmenu(GContextMenuEvent&) override;
virtual void on_second_paint(GPaintEvent&) override;
virtual void on_keydown(GKeyEvent&) override;
virtual void on_keyup(GKeyEvent&) override;
private:
virtual const char* class_name() const override { return "LineTool"; }
GMouseButton m_drawing_button { GMouseButton::None };
Point m_line_start_position;
Point m_line_end_position;
RefPtr<GMenu> m_context_menu;
int m_thickness { 1 };
bool m_constrain_angle { false };
};