Horizon
tool_place_shape.hpp
1 #pragma once
2 #include "common/shape.hpp"
3 #include "core/tool.hpp"
4 #include <forward_list>
5 
6 namespace horizon {
7 
8 class ToolPlaceShape : public ToolBase {
9 public:
10  using ToolBase::ToolBase;
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::EDIT, I::ROTATE,
19  };
20  }
21 
22 protected:
23  Shape *temp = 0;
24  std::forward_list<Shape *> shapes_placed;
25 
26  void create_shape(const Coordi &c);
27 };
28 } // namespace horizon
For commonly used Pad shapes.
Definition: shape.hpp:18
This is what a Tool receives when the user did something.
Definition: tool.hpp:23
Common interface for all Tools.
Definition: tool.hpp:121
Definition: tool_place_shape.hpp:8
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition: tool_place_shape.cpp:15
bool can_begin() override
Definition: tool_place_shape.cpp:10
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
Definition: tool_place_shape.cpp:50
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition: tool.hpp:42