Horizon
tool_draw_line.hpp
1 #pragma once
2 #include "core/tool.hpp"
3 #include "tool_helper_line_width_setting.hpp"
4 #include "tool_helper_restrict.hpp"
5 
6 namespace horizon {
7 
9 public:
10  ToolDrawLine(IDocument *c, ToolID tid);
11  ToolResponse begin(const ToolArgs &args) override;
12  ToolResponse update(const ToolArgs &args) override;
13  bool can_begin() override;
14  std::set<InToolActionID> get_actions() const override
15  {
16  using I = InToolActionID;
17  return {
18  I::LMB, I::CANCEL, I::RMB, I::RESTRICT, I::ENTER_WIDTH,
19  };
20  }
21 
22  void apply_settings() override;
23 
24 private:
25  class Junction *temp_junc = 0;
26  class Line *temp_line = 0;
27  void update_tip();
28  bool first_line = true;
29  std::set<const Junction *> junctions_created;
30  void do_move(const Coordi &c);
31 };
32 } // namespace horizon
horizon::IDocument
Definition: idocument.hpp:5
horizon::Line
Graphical line.
Definition: line.hpp:19
horizon::ToolHelperRestrict
Definition: tool_helper_restrict.hpp:6
horizon::ToolHelperLineWidthSetting
Definition: tool_helper_line_width_setting.hpp:6
horizon::Coord< int64_t >
horizon::Junction
A Junction is a point in 2D-Space.
Definition: junction.hpp:22
horizon::ToolDrawLine::begin
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition: tool_draw_line.cpp:25
horizon::ToolDrawLine
Definition: tool_draw_line.hpp:8
horizon::ToolResponse
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition: tool.hpp:42
horizon::ToolArgs
This is what a Tool receives when the user did something.
Definition: tool.hpp:23
horizon::ToolDrawLine::can_begin
bool can_begin() override
Definition: tool_draw_line.cpp:14
horizon::ToolDrawLine::update
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
Definition: tool_draw_line.cpp:67