]> git.tdb.fi Git - libs/gui.git/blobdiff - source/input/touchscreen.h
Touchscreen input device
[libs/gui.git] / source / input / touchscreen.h
diff --git a/source/input/touchscreen.h b/source/input/touchscreen.h
new file mode 100644 (file)
index 0000000..363111c
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef MSP_INPUT_TOUCHSCREEN_H_
+#define MSP_INPUT_TOUCHSCREEN_H_
+
+#include <sigc++/trackable.h>
+#include <msp/graphics/window.h>
+#include "device.h"
+
+namespace Msp {
+namespace Input {
+
+class Touchscreen: public Device, public sigc::trackable
+{
+private:
+       enum
+       {
+               UNUSED = static_cast<unsigned>(-1)
+       };
+
+       Graphics::Window &window;
+       std::vector<unsigned> active_points;
+
+public:
+       Touchscreen(Graphics::Window &);
+       ~Touchscreen();
+
+       virtual std::string get_button_name(unsigned) const;
+       virtual std::string get_axis_name(unsigned) const;
+private:
+       void input_event(const Graphics::Window::Event &);
+
+       unsigned map_point_id(unsigned);
+       void touch_down(unsigned);
+       void touch_move(unsigned, float, float);
+       void touch_up(unsigned);
+};
+
+} // namespace Input
+} // namespace Msp
+
+#endif