]> git.tdb.fi Git - libs/gui.git/blob - source/input/touchscreen.h
Touchscreen 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         virtual std::string get_button_name(unsigned) const;
27         virtual std::string get_axis_name(unsigned) const;
28 private:
29         void input_event(const Graphics::Window::Event &);
30
31         unsigned map_point_id(unsigned);
32         void touch_down(unsigned);
33         void touch_move(unsigned, float, float);
34         void touch_up(unsigned);
35 };
36
37 } // namespace Input
38 } // namespace Msp
39
40 #endif