Horizon
tool_place_junction.hpp
1 #pragma once
2 #include "core/tool.hpp"
3 #include <forward_list>
4 
5 namespace horizon {
6 
7 class ToolPlaceJunction : public virtual ToolBase {
8 public:
9  ToolPlaceJunction(IDocument *c, ToolID tid);
10  ToolResponse begin(const ToolArgs &args) override;
11  ToolResponse update(const ToolArgs &args) override;
12  bool can_begin() override;
13  std::set<InToolActionID> get_actions() const override
14  {
15  using I = InToolActionID;
16  return {
17  I::LMB,
18  I::CANCEL,
19  I::RMB,
20  };
21  }
22 
23 protected:
24  class Junction *temp = 0;
25  std::forward_list<Junction *> junctions_placed;
26 
27  void create_junction(const Coordi &c);
28  virtual void create_attached()
29  {
30  }
31  virtual void delete_attached()
32  {
33  }
34  virtual bool update_attached(const ToolArgs &args)
35  {
36  return false;
37  }
38  virtual bool check_line(class LineNet *li)
39  {
40  return true;
41  }
42  virtual bool begin_attached()
43  {
44  return true;
45  }
46 };
47 } // namespace horizon
horizon::ToolPlaceJunction::can_begin
bool can_begin() override
horizon::ToolPlaceJunction::update
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
horizon::ToolPlaceJunction::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