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 
8 class ToolDrawLine : public ToolHelperLineWidthSetting, public ToolHelperRestrict {
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::ToolDrawLine::begin
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
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
horizon::ToolDrawLine::update
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.