]> git.tdb.fi Git - libs/gui.git/blob - source/input/touchscreen.h
Add a gesture detector input device
[libs/gui.git] / source / input / touchscreen.h
1 #ifndef MSP_INPUT_TOUCHSCREEN_H_
2 #define MSP_INPUT_TOUCHSCREEN_H_
3
4 #include <sigc++/trackable.h>
5 #include <msp/graphics/window.h>
6 #include "device.h"
7
8 namespace Msp {
9 namespace Input {
10
11 class Touchscreen: public Device, public sigc::trackable
12 {
13 private:
14         enum
15         {
16                 UNUSED = static_cast<unsigned>(-1)
17         };
18
19         Graphics::Window &window;
20         std::vector<unsigned> active_points;
21
22 public:
23         Touchscreen(Graphics::Window &);
24         ~Touchscreen();
25
26         Graphics::Window &get_window() const { return window; }
27
28         virtual std::string get_button_name(unsigned) const;
29         virtual std::string get_axis_name(unsigned) const;
30 private:
31         void input_event(const Graphics::Window::Event &);
32
33         unsigned map_point_id(unsigned);
34         void touch_down(unsigned);
35         void touch_move(unsigned, float, float);
36         void touch_up(unsigned);
37 };
38
39 } // namespace Input
40 } // namespace Msp
41
42 #endif