]> git.tdb.fi Git - libs/gui.git/blobdiff - source/input/hub.h
Inherit input devices using Window::signal_input_event from sigc::trackable
[libs/gui.git] / source / input / hub.h
index af4db47d81da96538482ce0fe62c965b71cee323..31eeb94bf5dfb220c793d73d6cff533b345204e5 100644 (file)
@@ -1,6 +1,8 @@
-#ifndef MSP_GBASE_INPUTHUB_H_
-#define MSP_GBASE_INPUTHUB_H_
+#ifndef MSP_INPUT_INPUTHUB_H_
+#define MSP_INPUT_INPUTHUB_H_
 
+#include <map>
+#include <sigc++/trackable.h>
 #include "device.h"
 
 namespace Msp {
@@ -10,22 +12,16 @@ 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
+class Hub: public Device, public sigc::trackable
 {
 protected:
-       std::vector<Device *> devices;
+       std::map<unsigned, 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);
+       /// Attaches an input device to the hub.
+       void attach(Device &dev);
 
        virtual std::string get_button_name(unsigned) const;
        virtual std::string get_axis_name(unsigned) const;