Horizon
Loading...
Searching...
No Matches
tool_draw_line_rectangle.hpp
1#pragma once
2#include "core/tool.hpp"
3#include "tool_helper_line_width_setting.hpp"
4#include "tool_settings_rectangle_mode.hpp"
5
6namespace horizon {
7
9public:
10 using ToolHelperLineWidthSetting::ToolHelperLineWidthSetting;
11 ToolResponse begin(const ToolArgs &args) override;
12 ToolResponse update(const ToolArgs &args) override;
13 bool can_begin() override;
14 void apply_settings() override;
15 std::set<InToolActionID> get_actions() const override
16 {
17 using I = InToolActionID;
18 return {
19 I::LMB, I::CANCEL, I::RMB, I::RECTANGLE_MODE, I::ENTER_WIDTH,
20 };
21 }
22
23 std::map<ToolID, ToolSettings *> get_all_settings() override;
24
25private:
26 std::set<class Line *> lines;
27 ToolSettingsRectangleMode settings_rect;
28 using Mode = ToolSettingsRectangleMode::Mode;
29
30 Coordi first_pos;
31 Coordi second_pos;
32 int step = 0;
33
34 std::array<class Junction *, 4> junctions;
35
36 void update_junctions();
37 void update_tip();
38};
39} // namespace horizon
This is what a Tool receives when the user did something.
Definition tool_pub.hpp:23
Definition tool_draw_line_rectangle.hpp:8
bool can_begin() override
Definition tool_draw_line_rectangle.cpp:25
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition tool_draw_line_rectangle.cpp:53
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
Definition tool_draw_line_rectangle.cpp:109
Definition tool_helper_line_width_setting.hpp:6
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition tool_pub.hpp:40
Definition tool_settings_rectangle_mode.hpp:5