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