]> git.tdb.fi Git - libs/gui.git/blob - source/input/touchscreen.h
Add decorations for things which should be exported from the library
[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/mspgui_api.h>
6 #include <msp/graphics/window.h>
7 #include "device.h"
8
9 namespace Msp {
10 namespace Input {
11
12 class MSPGUI_API Touchscreen: public Device, public sigc::trackable
13 {
14 private:
15         static constexpr unsigned UNUSED = static_cast<unsigned>(-1);
16
17         Graphics::Window &window;
18         std::vector<unsigned> active_points;
19
20 public:
21         Touchscreen(Graphics::Window &);
22         ~Touchscreen();
23
24         static bool is_available();
25
26         Graphics::Window &get_window() const { return window; }
27
28         std::string get_button_name(unsigned) const override;
29         std::string get_axis_name(unsigned) const override;
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