]> git.tdb.fi Git - libs/gui.git/blobdiff - source/input/hub.h
Reorganize files to separate gbase and input
[libs/gui.git] / source / input / hub.h
diff --git a/source/input/hub.h b/source/input/hub.h
new file mode 100644 (file)
index 0000000..4385f27
--- /dev/null
@@ -0,0 +1,47 @@
+/* $Id$
+
+This file is part of libmspgbase
+Copyright © 2007 Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#ifndef MSP_GBASE_INPUTHUB_H_
+#define MSP_GBASE_INPUTHUB_H_
+
+#include "device.h"
+
+namespace Msp {
+namespace Input {
+
+/**
+The Hub device collects events from multiple input devices and presents an
+aggregate of them.  Button and axis numbers are mapped to unique values.
+*/
+class Hub: public Device
+{
+protected:
+       std::vector<Device *> devices;
+
+public:
+       Hub();
+
+       /**
+       Attaches an input device to the hub.
+
+       @param   dev  Device to attach
+
+       @return  Index of the device within the hub
+       */
+       unsigned attach(Device &dev);
+
+       virtual std::string get_button_name(unsigned) const;
+protected:
+       void button_press(unsigned, unsigned);
+       void button_release(unsigned, unsigned);
+       void axis_motion(unsigned, float, float, unsigned);
+};
+
+} // namespace Input
+} // namespace Msp
+
+#endif