]> git.tdb.fi Git - r2c2.git/blob - source/designer/tool.h
Sprinkle some comments on the routing system
[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/keyboard.h>
8 #include <msp/input/mouse.h>
9 #include "libr2c2/geometry.h"
10
11 class Designer;
12 class Selection;
13
14 class Tool: public sigc::trackable
15 {
16 public:
17         sigc::signal<void> signal_done;
18         sigc::signal<void, const std::string &> signal_status;
19
20 protected:
21         Designer &designer;
22         R2C2::Vector pointer;
23         R2C2::Vector ground_pointer;
24         bool shift_held;
25         bool ctrl_held;
26         std::string status;
27         bool done;
28         bool accepted;
29
30         Tool(Designer &, Msp::Input::Keyboard &, Msp::Input::Mouse &);
31 public:
32         virtual ~Tool() { }
33
34 protected:
35         void set_status(const std::string &);
36         void set_done(bool);
37 public:
38         const std::string &get_status() const { return status; }
39         bool is_done() const { return done; }
40
41 protected:
42         virtual void key_press(unsigned);
43         virtual void key_release(unsigned);
44         virtual void button_press(unsigned);
45         virtual void button_release(unsigned) { }
46         virtual void axis_motion(unsigned, float, float);
47         virtual void pointer_motion() { }
48         virtual void finish() { }
49
50 public:
51         virtual void update_selection(Selection &) const { }
52 };
53
54 #endif