]> git.tdb.fi Git - libs/gui.git/blob - source/input/touchscreen.h
Use constexpr instead of enum to define "typeless" constants
[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         static constexpr unsigned UNUSED = static_cast<unsigned>(-1);
15
16         Graphics::Window &window;
17         std::vector<unsigned> active_points;
18
19 public:
20         Touchscreen(Graphics::Window &);
21         ~Touchscreen();
22
23         static bool is_available();
24
25         Graphics::Window &get_window() const { return window; }
26
27         std::string get_button_name(unsigned) const override;
28         std::string get_axis_name(unsigned) const override;
29 private:
30         void input_event(const Graphics::Window::Event &);
31
32         unsigned map_point_id(unsigned);
33         void touch_down(unsigned);
34         void touch_move(unsigned, float, float);
35         void touch_up(unsigned);
36 };
37
38 } // namespace Input
39 } // namespace Msp
40
41 #endif