]> git.tdb.fi Git - r2c2.git/blob - source/designer/tool.h
Refactor Designer::use_tool so tools don't need to take a set of objects
[r2c2.git] / source / designer / tool.h
1 #ifndef TOOL_H_
2 #define TOOL_H_
3
4 #include <string>
5 #include <sigc++/signal.h>
6 #include <sigc++/trackable.h>
7 #include <msp/input/mouse.h>
8 #include "libr2c2/geometry.h"
9
10 class Designer;
11 class Selection;
12
13 class Tool: public sigc::trackable
14 {
15 public:
16         sigc::signal<void> signal_done;
17         sigc::signal<void, const std::string &> signal_status;
18
19 protected:
20         Designer &designer;
21         R2C2::Vector pointer;
22         R2C2::Vector ground_pointer;
23         std::string status;
24         bool done;
25         bool accepted;
26
27         Tool(Designer &, Msp::Input::Mouse &);
28 public:
29         virtual ~Tool() { }
30
31 protected:
32         void set_status(const std::string &);
33         void set_done(bool);
34 public:
35         const std::string &get_status() const { return status; }
36         bool is_done() const { return done; }
37
38 protected:
39         virtual void button_press(unsigned);
40         virtual void axis_motion(unsigned, float, float);
41         virtual void pointer_motion() { }
42         virtual void finish() { }
43
44 public:
45         virtual void update_selection(Selection &) const { }
46 };
47
48 #endif